CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

10 September, 2024

Are `elf.h` structures packed?

 Programing Coderfunda     September 10, 2024     No comments   

Quoting the man page:



All data structures that the file format defines follow the
"natural" size and alignment guidelines for the relevant class.
If necessary, data structures contain explicit padding to ensure
4-byte alignment for 4-byte objects, to force structure sizes to
a multiple of 4, and so on.



But since aligment is implementation defined I imagine that is not a good
pratice suppose that the structures are allways packed.


For example, the following (pseudocode) can falls in some systems/compilers:
unsigned char e_ident[EI_NIDENT]; // Supposing that sizeof(unsigned char) == sizeof(uint8_t)
Elf32_Ehdr *ehdr;
// First read the e_ident
fread(e_ident, EI_NIDENT, 1, file_ptr);
// Now read the ELF header
if(e_ident[EI_CLASS] == ELFCLASS32){
ehdr = malloc(sizeof(Elf32_Ehdr));
memcpy(ehdr->e_ident, e_ident, EI_NIDENT);
fread(&(ehdr->e_type), sizeof(uint8_t), sizeof(Elf32_Ehdr) - (size_t)EI_NIDENT, file_ptr);
}



On negative answer for the main question, there is some portable way to ensure that elf.h structures are packed?


NOTE: I'm using the elf.h from musl.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

API WOOCOMERCE (INSERT PRODUCT) - Whitespace on attributes (options)

 Programing Coderfunda     September 10, 2024     No comments   

I have the following problem.


I'm uploading a product via api rest v3.


I have the problem loading attribute options


If I use a space option, it separates the terms.


If Gravina Di Catania loads, Gravina takes me then Di and then Catania


If I do the test on postman everything is ok


If I make the call via Php no.


how do i fix it?


I put double quotes in the string.


I used addslashes


i tried doing JSON ENCODE of options array
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

09 September, 2024

Does it cost money to read from aws s3 in Python?

 Programing Coderfunda     September 09, 2024     No comments   

There are certain operations that I am doing in Python and I would like to know if any of these are charging my company or me money. I will give three examples.



* Using s3fs to read a file




import s3fs
s3 = s3fs.S3FileSystem()
path = "s3://my-bucket/foo/bar.txt"
text = s3.read_text(path)




* Using s3fs to glob for files




import s3fs
s3 = s3fs.S3FileSystem()
bar = "s3://my-bucket/foo/*"
my_paths = s3.glob(bar)




* Reading a file with pandas




import pandas as pd
path = "s3://my-bucket/foo/bar.csv"
my_df = pd.read_csv(path)



Is someone getting charged money when I do any of these three things?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Don't undo what you haven't done. Avoid this subtle, but insidious little bug.

 Programing Coderfunda     September 09, 2024     No comments   


https://aaronfrancis.com/2024/dont-undo-what-you-havent-done-430ac590 submitted by /u/aarondf
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Pest v3 Now Available

 Programing Coderfunda     September 09, 2024     No comments   

submitted by /u/nunomaduro
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel Password Hashing With Salt

 Programing Coderfunda     September 09, 2024     No comments   

submitted by /u/valerione
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Theo (t3dotgg) rage-baiting about Laravel without reading the docs

 Programing Coderfunda     September 09, 2024     No comments   

Theo - t3.gg on X: "Apparently "logs" is a PAID FEATURE on the official recommended way to set up Laravel locally???
https://t.co/l6yEb3qd50" / X

Okay so I watched his stream regarding Laravel, and he didn't put much effort to read the docs other than installation page and is already spreading negativity on Twitter/X regarding Laravel.

Any thoughts? Is Laravel docs that confusing for a beginner? submitted by /u/TastyInternet
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

08 September, 2024

Weekly /r/Laravel Help Thread

 Programing Coderfunda     September 08, 2024     No comments   

Ask your Laravel help questions here. To improve your chances of getting an answer from the community, here are some tips:

* What steps have you taken so far?
* What have you tried from the documentation?
* Did you provide any error messages you are getting?
* Are you able to provide instructions to replicate the issue?

* Did you provide a code example?

* Please don't post a screenshot of your code. Use the code block in the Reddit text editor and ensure it's formatted correctly.






For more immediate support, you can ask in the official Laravel Discord.

Thanks and welcome to the /r/Laravel community! submitted by /u/AutoModerator
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

nextjs google sign in

 Programing Coderfunda     September 08, 2024     No comments   

I'm just curious about sign-in/authentication libraries like for example is clerk and Lucia.


right now I'm using nextAuth with a simple sign in to google, the process is opening console.cloud.google, and doing a few setups to get the GOOGLE_CLIENT_ID & GOOGLE_CLIENT_SECRET for getting permissions and once access is granted i would be able to modify,create folders,upload files & delete files/folders on my google drive
.


So my curiosities is, can i use other authentication libraries like clerk and lucia, to get a equivalent of GOOGLE_CLIENT_SECRET & GOOGLE_CLIENT_ID= in which can grant me access to my google account?


Hope my question makes sense to y'all
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Why Postgres query is not using column in Index Condition but uses it in Filter condition

 Programing Coderfunda     September 08, 2024     No comments   

I am running a simple join query, where the table incident_tracker_details is covered by a suitable index. The query is slow because it doesn`t use all the columns in Index Condition, but does use the column as a Filter leading to a large heap searches


Query:
SELECT
relevant_incidents_per_inventory_item.inventory_id,
tracker_id
FROM
relevant_incidents_per_inventory_item
JOIN
incident_tracker_details
ON
incident_tracker_details.incident_id = relevant_incidents_per_inventory_item.incident_id
WHERE
incident_tracker_details.company_id = :companyId
and incident_tracker_details.division_id = :divisionId
AND incident_tracker_details.value > 0



the index in use:
create index companyid_divisionId_incidentId_idx
on incident_tracker_details (company_id, division_id, incident_id)
where (value > 0) include (tracker_id);



the relevant_incidents_per_inventory_item does not have any relevant indexes and the table is very small (few hundreds of rows).


the actual query plan:
QUERY PLAN
Hash Join (cost=6901.58..6913.72 rows=1 width=8) (actual time=90.663..315.278 rows=522 loops=1)
Hash Cond: (incident_tracker_details.incident_id = relevant_incidents_per_inventory_item.incident_id)
-> Index Only Scan using companyid_divisionId_incidentId_idx on incident_tracker_details (cost=0.57..12.68 rows=6 width=16) (actual time=0.039..202.787 rows=246774 loops=1)
Index Cond: ((company_id = '777704491747470679'::bigint) AND (division_id = '777795770460846005'::bigint))
Heap Fetches: 124039
-> Hash (cost=6900.88..6900.88 rows=10 width=8) (actual time=86.704..86.709 rows=259 loops=1)
...not relevant part
Planning Time: 0.518 ms
Execution Time: 315.402 ms



Why is the "incident_id" not part of the Index Cond? this leads to retrieving all the rows under companyId, divisionId , and then the engine has to filter all the rows for those having incident_tracker_details.incident_id = relevant_incidents_per_inventory_item.incident_id


I expected to see all the columns used in the Index Condition, leading to fast retrieval of only the relevant data
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

SQL Server options to handle a large table, from the options listed below [closed]

 Programing Coderfunda     September 08, 2024     No comments   

I have a SQL Server database with a table that contains 50 million rows, I expect the row count to growth to 700 million rows by the end of my processing cycle. The current table performs well, and it’s been tuned with the appropriate indexes.


In order to scale the database, and for performance, I am considering the implementation partitioned tables, however, I keep reading about downsides. I wanted about your experiences and preferred approach between the options listed below, in the context of implementation ease, efficiency and subsequent maintenance:



* Partitioning table

* Indexed views

* Sharding

* Filtered indexes

* Partitioned views

* In-Memory OLTP
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Sonatype Nexus OSS 3.69.0 Npm Issue

 Programing Coderfunda     September 08, 2024     No comments   

I am using a Nexus (3.69.0 oss) Docker image with Maven, npm, and Docker repositories feeded in it. This image needed to be deployed across different environment and use as an artifact central.


For Maven and Docker, it is working fine.


But when it comes to npm, when I use the Nexus container with these image on my local machine without internet access, everything works as expected., However, when I run the same setup in another environment(aws ec2 with 8CPU,32GB RAM), also without internet access, I encounter issues with npm.


Specifically, npm takes about five minutes to retrieve a single package. The npm repository is a combination of both proxy(2k dependencies) and hosted repositories(7 artifacts), and I have artifacts stored in both. Despite this, I am seeing significant delays.


To install a single package, it is taking around 4-5 minutes. instead, 1-2 seconds in local.


I have confirmed that npm ping works correctly, and I can download npm artifacts using wget with no problems. However, npm install is where the issue occurs.


Could you please help me understand why this is happening and how it can be resolved?


In logs also I cannot see any., regarding delays.,


Configuration details:
some packages are in hosted repo, and some are in proxy cached, I kept negative cache to 0, and turned off it, meatda age and max component ages to -1., to use the caching always…No routing rules, and no firewalls enabled etc.


and this is the data that I am using in to create proxy npm repo:
{
“name”: “‘$npm_proxy_repository_name’”,
“online”: true,
“storage”: {
“blobStoreName”: “default”,
“strictContentTypeValidation”: true
},
“cleanup”: {
“policyNames”: [
“string”
]
},
“proxy”: {
“remoteUrl”: “
https://registry.npmjs.org”, /> “contentMaxAge”: -1,
“metadataMaxAge”: -1
},
“negativeCache”: {
“enabled”: false,
“timeToLive”: 0
},
“httpClient”: {
“blocked”: false,
“autoBlock”: false,
“connection”: {
“retries”: 10,
“userAgentSuffix”: null,
“timeout”: 120,
“enableCircularRedirects”: false,
“enableCookies”: false,
“useTrustStore”: false
},
“authentication”: null
},
“routingRule”: “string”,
“replication”: {
“preemptivePullEnabled”: false,
“assetPathRegex”: “string”
},
“npm”: {
“removeNonCataloged”: false,
“removeQuarantined”: false
}
}



It’s a mysterious question still for us , why it is working in local mcahine, not in the aws server,


FYI, using the nexus server and npm client server, both are in same machine
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

07 September, 2024

Shiny downloadButton Status: Waiting for print(obj, file) execution before updating status

 Programing Coderfunda     September 07, 2024     No comments   

I have a shiny app that generates and saves a report when the user clicks a button.
I want to show the save status in the button by changing its label and icon.


I am using a downloadButton to allow the user to specify the location and file name. The report is an officer word document saved using print(obj, target).


The expected flow is:



* user clicks button

* button changes to "Saving..."

* file dialogue opens

* user selects file name/location

* r attempts to save the document

* if the save is successful (i.e., no errors)the button changes to "Saved"

* otherwise, button changes to "Save Failed"






The actual flow is:



* user clicks button

* button changes to "Saving..."

* file dialogue opens

* button changes to "Saved"

* user selects file name/location

* ...






The script does not wait for the user to select the file or see if the file saves correctly before changing the status to "Saved." In this case, the file is saving correctly, but the script has no way of knowing that before it prints to target, and it cannot print to target until the user provides the file name/location.


How may I revise this so that the status change is related to whether or not the file was saved without error?
library(shiny)
library(shinyjs)
library(officer)

ui
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Are there any Laravel courses or reading materials where the author shares experiences that I can't find in the documentation?

 Programing Coderfunda     September 07, 2024     No comments   

Hello everyone,
I recently bought Laracasts. It's nice, but it felt like documentation for lazy people. I already knew most of the things they covered just by reading the documentation (e.g., Filament).

Are there any courses or reading materials where people mainly share their experiences instead of simply rephrasing the documentation? I don't have a specific goal—I'm just looking to spend my spare time learning more about Laravel.

I often come across blog posts, videos, etc., for other programming languages like Java or Python that talks about real world problems and how those people solve those problems with the tools frameworks or languages provide, and I want to find similar content for Laravel or PHP in general.

but most of the content i find is already in the documentation.

For example, I’ve never seen much content on massively scaling Laravel queues.

note: this post is not intended to bash laracasts or say its not good or bash authors who wrote tutorials/make videos about laravel etc. i am simply looking for something different. submitted by /u/desiderkino
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Kotlin spread operator for an array of functions does not satisfy Java Function... function argument definition

 Programing Coderfunda     September 07, 2024     No comments   

I need an overlay function around AssertJ extracting assertion.
Its current implementation:
import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.groups.Tuple

fun checkObjectsHaveExactPropertyValue(
objectsList: List,
properties: Array,
expectedPropertyValue: R
) {
assertThat(objectsList)
.extracting(*properties)
.containsOnly(Tuple.tuple(expectedPropertyValue))
}



I want to be able to pass multiple property extractors as properties argument of my function. Then they are supplied to .extracting method.


And this is there code check and compilation error is:
Kotlin: None of the following functions can be called with the arguments supplied:
public open fun \ extracting(p0: Function\!): AbstractListAssert\! defined in org.assertj.core.api.ListAssert
public final fun extracting(vararg p0: Function\!): AbstractListAssert\! defined in org.assertj.core.api.ListAssert
public open fun extracting(vararg p0: String!): AbstractListAssert\! defined in org.assertj.core.api.ListAssert
public open fun extracting(p0: String!): AbstractListAssert\! defined in org.assertj.core.api.ListAssert
public open fun \ extracting(p0: ThrowingExtractor\!): AbstractListAssert\! defined in org.assertj.core.api.ListAssert



I don't see where I messed up.


I also tried following to debug typing:



* .extracting(properties[0], properties[1]) - compiles, function typing is correct, but not what I need

* different Iterable types (List, ArrayList, ...) - same error

* vararg properties: Function1 - same error

* properties: Array R> - same error






I expect there is correct typing for the argument of my function, so I can use overloaded method extracting(vararg Function!) defined in org.assertj.core.api.ListAssert.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Do you know someone who is helping PHP community and deserve sponsoring? (nominate)

 Programing Coderfunda     September 07, 2024     No comments   

Based on recent prosperous news around PHP, I realize many of those projects were started by sole developers, once unknown 🙏

I want to give back love and sponsor couple developers, who grow our PHP community grow ❤️

Do you know someone like that? Let me know:
https://docs.google.com/forms/d/15sUIo3PnN4oLlaxKg6so8zYClrXjh8F3F2kzV5np3YU/ submitted by /u/Tomas_Votruba
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Good vector database options with Laravel

 Programing Coderfunda     September 07, 2024     No comments   

I have recently doing a lot of Python work because of AI/ML requirements in my company. And to be honest from personal interest as well.

Now, with python there are so many vector db options (OS) LIKE Faiss, chroma db etc.

I can find good resources to learn about them as well. For example chromadb has great documentation.

Can anyone guide me which are options for Laravel? I don't want to have postgresql. Just because I have heard that the pgsql vector extension is not that performent compared to chroma or faiss submitted by /u/amitavroy
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

06 September, 2024

Learn to Fly with Laravel Reverb | Joe Dixon at Laracon US 2024 in Dallas, TX

 Programing Coderfunda     September 06, 2024     No comments   

submitted by /u/octarino
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Prezet: Markdown Blogging for Laravel

 Programing Coderfunda     September 06, 2024     No comments   

submitted by /u/amalinovic
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Let's build a Twitter clone with Livewire 3 & Laravel Reverb | 7 - Displaying Retweets

 Programing Coderfunda     September 06, 2024     No comments   

submitted by /u/Tilly-w-e
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Python Web scraping [D:websockets.client] > GET %s HTTP/1.1 [D:websockets.client] > %s: %s doesn't show all the results

 Programing Coderfunda     September 06, 2024     No comments   

I'm trying to make web scraping with Python 3.10, and the library requests-HTML 0.10.0.


I attach the code:
from requests_html import HTMLSession

url = '
https://bodysolid-europe.com/collections/all' />
s = HTMLSession()
r = s.get(url)

r.html.render(sleep=1)

products = r.html.xpath('/html/body/div[2]/div[2]/div', first=True)

for item in products.absolute_links:
r = s.get(item)
print(r.html.find('header.product-header', first=True).text)



When I try to extract information from the URL by Xpath, in the console shows the next output:
[D:urllib3.connectionpool] Starting new HTTPS connection (%d): %s:%s
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
[D:asyncio] Using proactor: %s
[D:websockets.client] = connection is CONNECTING
[D:websockets.client] > GET %s HTTP/1.1
[D:websockets.client] > %s: %s
[D:websockets.client] > %s: %s
[D:websockets.client] > %s: %s
[D:websockets.client] > %s: %s
[D:websockets.client] > %s: %s
[D:websockets.client] > %s: %s
[D:websockets.client] > %s: %s
[D:websockets.client] < HTTP/1.1 %d %s



It doesn't show all the information from the items, only a little bit, like these:
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
Body-Solid Europe
Best Fitness Dumbbell Rack BFDR10
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
Best Fitness
Best Fitness Bench BFFID10
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
Best Fitness
Best Fitness Mountain Climber BFMC10
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
Body-Solid Europe
Best Fitness Multi-Station Gym BFMG30
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
Best Fitness
Best Fitness Center Drive Elliptical BFE1
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
Best Fitness
Best Fitness Olympic Bench BFOB10
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
Best Fitness
Best Fitness Functional Trainer BFFT10
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
Best Fitness
Best Fitness Leg Developer and Preacher Curl Attachment BFPL10
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
Best Fitness
Best Fitness Inversion Table BFINVER10
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
[D:urllib3.connectionpool] %s://%s:%s "%s %s %s" %s %s
Body-Solid Europe



The most of the output are only:
D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s
[D:websockets.client] < %s



I don't know what the problem is. I already installed the pyppeteer==1.0.0, because previously, I had this:
NoSuchKey. The specified key does not exist. No such object: chromium-browser-snapshots/Win_x64/1181205/chrome-win.zip



but now it's showing the "[D:websockets.client] < %s
[D:websockets.client] < %s"


I need to fix that error with the output to get the information from the URL by web scraping.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

winrt::hresult_class_not_registered - AudioEffectDefinition with custom effect

 Programing Coderfunda     September 06, 2024     No comments   

I'm trying to create a winrt custom audio effect using this tutorial.
#include "MyAudioEffect.g.h"

auto effectName = winrt::name_of();
auto effect = winrt::Windows::Media::Effects::AudioEffectDefinition(effectName);
// Exception thrown
// winrt::hresult_class_not_registered
// 80040154 - Class not registered



I made a MRE:
https://github.com/tom-huntington/MRE_ClassNotRegistered />

To create the .idl .h .cpp files for the MyAudioEffect class, I used the template
-> Add -> New Item -> Custom Control (WinUI 3)



How do I register the class? Can someone fix my MRE please?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

05 September, 2024

Why does emptyArray.every() return true in Javascript?

 Programing Coderfunda     September 05, 2024     No comments   

Why emptyArray.every() returns true? It doesn´t make sense to me because there is no element which you can apply the callBackFunction on?


Example:
let x=[];
x.every(n=>n>10);



I would expect an error...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Error with uno module when using unoconv for file conversion in Python: 'Cannot find a suitable pyuno library' despite venv setup

 Programing Coderfunda     September 05, 2024     No comments   

I only have problems with my new project. I want to build a file converter.


I am doing this with Python and LibreOffice. I have installed everything, but it always gives me an error message with uno, although I have inhaled it. With Python, I actually always need venv.


I once asked ChatGPT for a Python script:
import subprocess
import os

def convert_pdf_to_odt(pdf_file):
# Überprüfen, ob die Datei existiert
if not os.path.exists(pdf_file):
print(f"Die Datei {pdf_file} wurde nicht gefunden.")
return

# Zielpfad: gleiche Datei mit der Endung .odt
output_file = os.path.splitext(pdf_file)[0] + '.odt'

try:
# Verwende unoconv, um das PDF in ODT zu konvertieren
subprocess.run(['unoconv', '-f', 'odt', pdf_file], check=True)
print(f"Erfolgreich konvertiert: {pdf_file} -> {output_file}")
except subprocess.CalledProcessError as e:
print(f"Fehler bei der Konvertierung: {e}")

if __name__ == "__main__":
# Beispiel-PDF-Datei (Pfad zur Datei anpassen)
pdf_file = '/home/ben/convert-commander/test/pdfs/Bild4.pdf'

# Konvertiere die PDF-Datei in ODT
convert_pdf_to_odt(pdf_file)



When executing, it gives me the error message:
unoconv: Cannot find a suitable pyuno library and python binary combination in /usr/lib/libreoffice
ERROR: No module named 'uno'

unoconv: Cannot find a suitable office installation on your system.
ERROR: Please locate your office installation and send your feedback to:

http://github.com/dagwieers/unoconv/issues /> Fehler bei der Konvertierung: Command '['unoconv', '-f', 'odt', '/home/ben/convert-commander/test/pdfs/Bild4.pdf']' returned non-zero exit status 1.



As I said, I am in a venv


Can you help me?


Thanks!


(translated with deepl from german)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to Locate and Interact with Elements Inside Shadow DOM and iframe in Selenium?

 Programing Coderfunda     September 05, 2024     No comments   

I am trying to scrape a website which has Shadow DOM and iframe. As you can see in the image I can't find any selector for the Shadow DOM so I can get to iframe.


HTML elements


How do I locate Shadow DOM (either CSS Selector, XPATH, etc.)?


The page I am trying to scrape is: scrape.do


P.S. I was aiming for the iframe in this way:
iframe = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, 'cf-chl-widget-3kwf9'))
)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

When to use livewire by understanding jetstream ? (See description)

 Programing Coderfunda     September 05, 2024     No comments   

Lately, I’ve been diving into the Jetstream project (check it out here: Jetstream GitHub) and how it’s set up, especially looking at the stubs they provide. One thing that stood out to me is how everything is organized by features, which makes a lot of sense for a clean structure. But I noticed that in routes/livewire.php, instead of using full-page Livewire components, they’ve opted to handle everything through controllers. It's an interesting choice.

When I looked at the views (here's the link: views folder), it seems like they’re mixing traditional Blade templates with small Livewire components here and there, rather than going all-in with Livewire. The entry point for these routes tends to be a show.blade.php file, which centralizes the layout for the page.

Another thing I found curious is that the Http/Livewire directory is pretty flat (see it here: Livewire Directory). It doesn’t use a livewire folder inside the views directory like some other setups might. This got me thinking about how this might affect organization and scaling as the project gets bigger.

My Take on It:

I actually like the idea of organizing things by feature—it keeps everything focused and easy to find. And having that single entry point like show.blade.php makes the layout more predictable. If this were my own project, whether personal or for a company, I’d probably do something similar. However, I might lean towards using Volt instead of class-based Blade components because I like how everything stays in one place with Volt—it just feels tidier to me.

I’m also thinking about the approach of starting with a controller. It’s a good starting point, but the tricky part is deciding when to shift from Blade over to Livewire. Jetstream seems to mix actions with inline logic in places like DeleteUserForm.php, which can be pretty flexible. But it does raise questions about maintainability and where to draw the line between keeping things simple and being overly granular.

I’d love to hear how others are handling similar setups or any thoughts on where Jetstream could do things differently. What would you change if it was your personal/enterprise project? submitted by /u/Eznix86
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

gpg check fails when installing wp-cli using ansible role debops.wpcli

 Programing Coderfunda     September 05, 2024     No comments   

I'm trying to use Ansible with Debops to install WP-CLI on my webserver.


I have this in my meta/main.yml:
---
dependencies:
- role: debops.debops.wpcli



I have this in my ansible log:
TASK [debops.debops.wpcli : Install required APT packages] *********************
ok: [webserver]
Thursday 05 September 2024 06:45:21 +0000 (0:00:02.504) 0:01:21.198 ****
Thursday 05 September 2024 06:45:21 +0000 (0:00:02.504) 0:01:21.197 ****

TASK [debops.debops.wpcli : Create wp-cli source directory] ********************
changed: [webserver]
Thursday 05 September 2024 06:45:21 +0000 (0:00:00.852) 0:01:22.051 ****
Thursday 05 September 2024 06:45:21 +0000 (0:00:00.852) 0:01:22.050 ****

TASK [debops.debops.wpcli : Download wp-cli release files] *********************
skipping: [webserver] => (item={'url': '
https://github.com/wp-cli/wp-cli/releases/download/v2.2.0/wp-cli-2.2.0.phar.gpg', 'dest': '/usr/local/src/wpcli/wp-cli-2.2.0.phar.gpg', 'checksum': 'sha256:6ed3c78adea2801ce900f3dc8f09ce799958955cc842b5f8d17d8ffb74eca7a2', 'version': '2.2.0'})
skipping: [webserver] => (item={'url': '
https://raw.githubusercontent.com/wp-cli/wp-cli/v2.2.0/utils/wp-completion.bash', 'dest': '/usr/local/src/wpcli/wp-cli-2.2.0.completion.bash', 'checksum': 'sha256:443ca0610ccae8d2d6aceba0ec4aa7929b87ed6cf54f666afed18d663a18a395', 'version': '2.2.0'})
skipping: [webserver] => (item={'url': '
https://github.com/wp-cli/wp-cli/releases/download/v2.3.0/wp-cli-2.3.0.phar.gpg', 'dest': '/usr/local/src/wpcli/wp-cli-2.3.0.phar.gpg', 'checksum': 'sha256:24e16d96d22baec166ffb8807bf751cabd62b84e1716523f94d61b2a8d7e2255', 'version': '2.3.0'})
skipping: [webserver] => (item={'url': '
https://raw.githubusercontent.com/wp-cli/wp-cli/v2.3.0/utils/wp-completion.bash', 'dest': '/usr/local/src/wpcli/wp-cli-2.3.0.completion.bash', 'checksum': 'sha256:443ca0610ccae8d2d6aceba0ec4aa7929b87ed6cf54f666afed18d663a18a395', 'version': '2.3.0'})
skipping: [webserver] => (item={'url': '
https://github.com/wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar.gpg', 'dest': '/usr/local/src/wpcli/wp-cli-2.4.0.phar.gpg', 'checksum': 'sha256:c009a0d9e84436eab671272ca0d0a75b5aefd1af17177c83c2b33ad945976def', 'version': '2.4.0'})
skipping: [webserver] => (item={'url': '
https://raw.githubusercontent.com/wp-cli/wp-cli/v2.4.0/utils/wp-completion.bash', 'dest': '/usr/local/src/wpcli/wp-cli-2.4.0.completion.bash', 'checksum': 'sha256:443ca0610ccae8d2d6aceba0ec4aa7929b87ed6cf54f666afed18d663a18a395', 'version': '2.4.0'})
changed: [webserver] => (item={'url': '
https://github.com/wp-cli/wp-cli/releases/download/v2.5.0/wp-cli-2.5.0.phar.gpg', 'dest': '/usr/local/src/wpcli/wp-cli-2.5.0.phar.gpg', 'checksum': 'sha256:a5faf98302ac3c96f0aad38e5d1a7142cfbd28fc2df03c687094b3fbf67a19a8', 'version': '2.5.0'})
changed: [webserver] => (item={'url': '
https://raw.githubusercontent.com/wp-cli/wp-cli/v2.5.0/utils/wp-completion.bash', 'dest': '/usr/local/src/wpcli/wp-cli-2.5.0.completion.bash', 'checksum': 'sha256:443ca0610ccae8d2d6aceba0ec4aa7929b87ed6cf54f666afed18d663a18a395', 'version': '2.5.0'})
Thursday 05 September 2024 06:45:24 +0000 (0:00:02.864) 0:01:24.916 ****
Thursday 05 September 2024 06:45:24 +0000 (0:00:02.864) 0:01:24.915 ****

TASK [debops.debops.wpcli : Verify and install wp-cli binary] ******************
fatal: [webserver]: FAILED! => changed=true
cmd: set -o nounset -o pipefail -o errexit && gpg --batch --decrypt --output /usr/local/src/wpcli/wp-cli-2.5.0.phar /usr/local/src/wpcli/wp-cli-2.5.0.phar.gpg && ( install --mode 755 --owner root --group root /usr/local/src/wpcli/wp-cli-2.5.0.phar /usr/local/bin/wp && install --mode 644 --owner root --group root /usr/local/src/wpcli/wp-cli-2.5.0.completion.bash /etc/bash_completion.d/wp-completion ) || ( rm -f /usr/local/src/wpcli/wp-cli-2.5.0.phar && exit 2 )
delta: '0:00:00.092231'
end: '2024-09-05 06:45:25.499750'
msg: non-zero return code
rc: 2
start: '2024-09-05 06:45:25.407519'
stderr: |-
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: Signature made Wed May 19 15:24:41 2021 UTC
gpg: using RSA key 63AF7AA15067C05616FDDD88A3A2E8F226F0BC06
gpg: issuer "releases@wp-cli.org"
gpg: Can't check signature: No public key
stderr_lines:
stdout: ''
stdout_lines:



For me this reads as:



* I am using the debops role wpcli in the correct way because it starts installing WP-CLI

* But the currect public key that is used to sign WP-CLI is not found






Is my assumption correct?


How do I fix this problem?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

04 September, 2024

GitHub Desktop is not signing GPG key automatically

 Programing Coderfunda     September 04, 2024     No comments   

After following the GitHub guide for generating a new GPG key, telling git about my key and adding the key to my GitHub account, I get the following error in every commit:





I also tried setting the path of the gpg program in .gitconfig to
[gpg]
program = "C:\\Program Files (x86)\\GnuPG\\bin\\gpg.exe"



However, if I try to open the repo in Command Prompt, it actually works (it allows me to commit and enter the passphrase). I have correctly installed gpg4win and I'm on Windows 10. Can anyone help me here?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Chaperone Eloquent Models in Laravel 11.22

 Programing Coderfunda     September 04, 2024     No comments   

---




The Laravel team released v11.22 this week, with the chaperone() Eloquent method for inverse relations, support for passing backed Enums to Queuable methods, the ability to pass backed Enums to route ->name() and ->domain() methods, and more.


Chaperone Eloquent Relations




Samuel Levy contributed the Eloquent inverse/chaperone model relation that Taylor demonstrated in his 2024 Larcon US keynote during the open-source part of the talk.
public function comments(): HasMany
{
return $this->hasMany(Comment::class)->chaperone('post');
}



The chaperone()/inverse() method avoids unexpected N+1 queries by linking back to the parent after the relationship query has run. The above relationship will link the appropriate Post model in the correct relation on Comment instances (with scopes intact).


See Pull Request #51582 for more details.


Support Backed Enum in the Queueable Trait




Seth Phat contributed support for BackedEnum in Queuable trait methods:




*
onQueue()


*
onConnection()


*
allOnQueue()


*
allOnConnection()






Here's an example from the pull request:
use App\Enums\QueueConnection;
use App\Enums\QueueName;

// Before
public function register()
{
$user = User::create([...]);

SendWelcomeEmailJob::dispatch($user)
->withConnection(QueueConnection::REDIS->value)
->onQueue(QueueName::HIGH->value);
}

// After
public function register()
{
$user = User::create([...]);

SendWelcomeEmailJob::dispatch($user)
->withConnection(QueueConnection::REDIS)
->onQueue(QueueName::HIGH);
}



Allow Enums to be Passed to Routes




@NickSdot contributed passing BackedEnum to Route domain() and name() methods:
// Before
Route::domain(InterfaceDomain::Marketing->value)
->name(Routes::Home->value)
->get('/contact', ContactController::class);

// After
Route::domain(InterfaceDomain::Marketing)
->name(Routes::Home)
->get('/'contact, ContactController::class);



Release notes




You can see the complete list of new features and updates below and the diff between 11.21.0 and 11.22.0 on GitHub. The following release notes are directly from the changelog:


v11.22.0






* [11.x] Fix FoundationServiceProvider docblock by @seriquynh in
https://github.com/laravel/framework/pull/52542 />

* [11.x] Fix ReflectionParameter @param type on Util::getContextualAttributeFromDependency() by @samsonasik in
https://github.com/laravel/framework/pull/52541 />

* [11.x] More specific parameter type in CastsInboundAttributes by @lorenzolosa in
https://github.com/laravel/framework/pull/52536 />

* [11.x] Unify prefetch API by @timacdonald in
https://github.com/laravel/framework/pull/52550 />

* [11.x] Add PDO subclass support for PHP 8.4 by @ju5t in
https://github.com/laravel/framework/pull/52538 />

* [11.x] Handle circular references in model serialization by @samlev in
https://github.com/laravel/framework/pull/52461 />

* [11.x] Eloquent inverse relations by @samlev in
https://github.com/laravel/framework/pull/51582 />

* [11.x] Feature/whereany closures by @liamduckett in
https://github.com/laravel/framework/pull/52555 />

* [11.x] Update remaining workflows to run on latest possible ubuntu version by @Jubeki in
https://github.com/laravel/framework/pull/52566 />

* Correct comments to better represent the updated method functionality by @dropweb in
https://github.com/laravel/framework/pull/52564 />

* [11.x] Support CSP nonce by @timacdonald in
https://github.com/laravel/framework/pull/52558 />

* [11.x] Allow enums to be passed to routes by @NickSdot in
https://github.com/laravel/framework/pull/52561 />

* [11.x] SORT_NATURAL on Collection no longer throws warning for nulls by @Chaplinski in
https://github.com/laravel/framework/pull/52557 />

* [11.x] Allow prefetch to start on custom event by @timacdonald in
https://github.com/laravel/framework/pull/52574 />

* [11.x] Fix regression in database assertions with custom model connections by @devfrey in
https://github.com/laravel/framework/pull/52581 />

* [11] Update DetectsLostConnections.php by @webartisan10 in
https://github.com/laravel/framework/pull/52614 />

* Fix docblock for Model::getEventDispatcher() by @inmula in
https://github.com/laravel/framework/pull/52602 />

* [11.x] Restore Request::HEADER_X_FORWARDED_PREFIX in TrustProxies by @taka-oyama in
https://github.com/laravel/framework/pull/52598 />

* [11.x] Accepts BackedEnum for onQueue, onConnection, allOnQueue, and allOnConnection methods in the Queueable trait by @sethsandaru in
https://github.com/laravel/framework/pull/52604 />

* [11.x] Use the same parameter type for 'throwUnless' as used for 'throwIf' by @pataar in
https://github.com/laravel/framework/pull/52626 />

* [11.x] Pass iterable keys to withProgressBar in InteractsWithIO by @robinmoisson in
https://github.com/laravel/framework/pull/52623 />

* [11.x] Fix docblock for Filesystem::hash() by @sunaoka in
https://github.com/laravel/framework/pull/52630 />

* Fix Apostrophe Handling in SeeInOrder.php and Enhance Test Coverage by @nomitoor in
https://github.com/laravel/framework/pull/52627 />

* [11.x] SQLite Error: "General error: 1 no such table" after adding a foreign key when using a table prefix. by @incrize in
https://github.com/laravel/framework/pull/52578 />






The post Chaperone Eloquent Models in Laravel 11.22 appeared first on Laravel News.


Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Has Microsoft changed anything that could be causing DdeConnect to delay after the startup of the computer?

 Programing Coderfunda     September 04, 2024     No comments   

Our developers have noticed that DdeConnect is causing a 30-second delay (time:ing out), in our software (which has worked for over 10 years without problems). It seems to mostly occur right after starting the computer, where it will time out several times in a row, and later on it gets fast again.


When starting our appliction the DdeConnet makes it delay with 30 minutes eventhough it doens't fail. It wasn't like this before. It worked instantly.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • Write API Integrations in Laravel and PHP Projects with Saloon
    Write API Integrations in Laravel and PHP Projects with Saloon Saloon  is a Laravel/PHP package that allows you to write your API integratio...
  • Credit card validation in laravel
      Validation rules for credit card using laravel-validation-rules/credit-card package in laravel Install package laravel-validation-rules/cr...
  • iOS 17 Force Screen Rotation not working on iPAD only
    I have followed all the links on Google and StackOverFlow, unfortunately, I could not find any reliable solution Specifically for iPad devic...
  • C++ in Hindi Introduction
    C ++ का परिचय C ++ एक ऑब्जेक्ट ओरिएंटेड प्रोग्रामिंग लैंग्वेज है। C ++ को Bjarne Stroustrup द्वारा विकसित किया गया था। C ++ में आने से पह...
  • Python AttributeError: 'str' has no attribute glob
    I am trying to look for a folder in a directory but I am getting the error.AttributeError: 'str' has no attribute glob Here's ...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (68)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • July (2)
  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

Loading...

Laravel News

Loading...

Copyright © CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda