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

01 March, 2024

is not recognized as an internal or external command

 Programing Coderfunda     March 01, 2024     No comments   

in my windows device i can not install anything on cmd.I try to run react native then i get 'create-expo-app' is not recognized as an internal or external command,
operable program or batch file error then i start to search about it i changed my system environment and everything but then i realize that it is not about node js when i try to code there git pull i get the same error again.How can i fix it ??


I'm a frontend web developer and i can not install anything because of that error in docker i can run my laravel project but i cant install locally react,vue,angular vite or anything else please help me to solve it
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

I want to show a video or Lottie animation for my React Weather App

 Programing Coderfunda     March 01, 2024     No comments   

I am a beginner who is learning react.js and i have made Weather app through React JS Tutorial – Build a Weather App With Cities Autocomplete and now i want to add my lottie animation to appear when a user visits and after the lotties animation goes after 4 seconds then the content of the appilcation appears. Please help me achieve this.


Thank you


I tried to create another component VideoPlayer.jsx and then put the lottie on it and then add variable and used useEffect:
const VideoPlayer = ({ onVideoEnd }) => {
const [videoLoaded, setVideoLoaded] = useState(false);

useEffect(() => {
const handleVideoLoad = () => {
setVideoLoaded(true);
};

const handleVideoEnded = () => {
if (onVideoEnd) {
onVideoEnd();
}
};

const videoElement = document.getElementById('myVideo');
videoElement.addEventListener('loadeddata', handleVideoLoad);
videoElement.addEventListener('ended', handleVideoEnded);

return () => {
videoElement.removeEventListener('loadeddata', handleVideoLoad);
videoElement.removeEventListener('ended', handleVideoEnded);
};
}, [onVideoEnd]);



give it absolute position and z-index of 1000.


In the return i added
{!videoLoaded &&

Loading video...}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Speed up your Laravel application up to 1000x (with FastCGI cache)

 Programing Coderfunda     March 01, 2024     No comments   

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

Laravel Gems - About Command

 Programing Coderfunda     March 01, 2024     No comments   

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

ElementNotInteractableException: element not interactable (When uploading the file by using the CloudFIleOperationUtil )

 Programing Coderfunda     March 01, 2024     No comments   

I'm writing the script for uploading a file by using the CloudFIleOperationUtil.
But I'm getting the element not interactable error.
String uploadFile = "//div[@id='dZUpload']";
String absolutePath = System.getProperty("user.dir") + "\\src\\main\\resources\\uploadFiles\\" + file;
CloudFileOperationUtil.uploadFileToCloud(uploadFile,absolutePath,getDriver());



The same code is working fine when the element is present in the Input tag. But not working when the element is present in the div tag.


Normally the element is clickable only. But when I passing as a parameter the element inside the upload File To Cloud method, I get an error.


So, Please tell me, how to Interact with the element that is present inside the div tag.
I hope, you guys all understand my doubt. If you want some more details to understand my about doubt please ask me.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

29 February, 2024

Render mode does not work properly on blazor web assembly .NET 8

 Programing Coderfunda     February 29, 2024     No comments   

This is my razor component page:
@page "/SignIn"
@inject INotificationService _localStorage
@inject NavigationManager _navigationManager
@inject IAuthenticationService _authService
@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))



...


@code {
public bool PageLoading { get; set; }
private Models.Notification? Notification { get; set; } = null;
public SignInRequestDto SignInRequest { get; set; } = new();
public bool IsAuthFailed { get; set; }
public string ReturnURL { get; set; }
public string Error { get; set; }

protected override async Task OnInitializedAsync()
{
PageLoading = true;
StateHasChanged();
System.Threading.Thread.Sleep(3000);
await GetNotification();
PageLoading = false;
}
...



So when I am on the Home page and I click "Se connecter" (that means sign in), the page does not goes to the signIn page, but instead stall on the Home page executing the OnInitializeAsync of the SignIn and then when it is finish, it shows finally the SingIn page.


I was expected that prerender: false will fix this but it does nothing.


This is the MainLayout that will redirect to the /SignIn page.
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
@inject NavigationManager Navigation



Hello, @context.User.Identity?.Name!
Se déconnecter


Se connecter



@code{
public void BeginLogOut()
{
Navigation.NavigateToLogout(Routes.Disconnect);
}
}



This is the demo:

https://drive.google.com/file/d/15fd0P8a4cuyH1F6rg8B6CN7MBfeSVk16/view?usp=sharing />

I expect that I will see the Loading component and the right page (/signin) instead of waiting on page Home before OnInitializeAsync is finished.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Error in module system when registering controlsFX validator for combo box in JavaFX project

 Programing Coderfunda     February 29, 2024     No comments   

I'm trying to register ControlsFX validator for a ComboBox in JavaFX. Then, I got the below error relating to the module system. When I try to open javafx.scene package to the org.controlsfx.controls module, it also resulted in an error. I'll add all the codes and errors I got below.


This is my code which is causing the error.
ValidationSupport validationSupport = new ValidationSupport();
validationSupport.registerValidator(prefixCombo, Validator.createEmptyValidator("Combobox selection required!"));



This is the error I got when running the project.
Exception in thread "JavaFX Application Thread" java.lang.reflect.InaccessibleObjectException: Unable to make protected javafx.collections.ObservableList javafx.scene.Parent.getChildren() accessible: module javafx.graphics does not "opens javafx.scene" to module org.controlsfx.controls
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)



This is my current module-info.java file
module system {
requires javafx.controls;
requires javafx.fxml;
requires jakarta.persistence;
requires org.hibernate.orm.core;
requires MaterialFX;
requires org.slf4j;
requires de.jensd.fx.glyphs.fontawesome;
requires static lombok;
requires org.controlsfx.controls;
requires javafx.graphics;

opens com.example.system to javafx.fxml, org.controlsfx.controls;
exports com.example.system;
exports com.example.system.controller;
opens com.example.system.controller to javafx.fxml, javafx.graphics;
opens com.example.system.entity to org.hibernate.orm.core;
opens com.example.system.tm to javafx.base;
}



I tried adding opens javafx.scene to org.controlsfx.controls; to module-infor.java.
Then, resulted in another error Package not found: javafx.scene


Thank you all in advance!!
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Azure Functions Credential uses wrong tenant

 Programing Coderfunda     February 29, 2024     No comments   

I am trying to run Azure Function written in python from VSCode.
No matter what I try, I get this error or similar - always the same tenant which I have no idea where it came from.


Various ways of getting credential:
credential = AzureCliCredential(tenant_id=os.environ["AZURE_TENANT_ID"])
credential = DefaultAzureCredential()
credential = EnvironmentCredential()



I have also tried to set local.settings.json (which sets environment variables)
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python",
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AZURE_TENANT_ID": "ad8d36e3-7a5d-4687-bef3-e758fc4f7649",
"AZURE_CLIENT_ID":"xxxxxxxxxxxxxxxx",
"AZURE_CLIENT_SECRET":"xxxxxxxxxxxxxx",
"AZURE_AUTHORITY_HOST":"login.microsoftonline.com"
}
}


The current credential is not configured to acquire tokens for tenant 49793faf-eb3f-4d99-a0cf-aef7cce79dc1. To enable acquiring tokens for this tenant add it to the additionally_allowed_tenants when creating the credential, or add "" to additionally_allowed_tenants to allow acquiring tokens for any tenant.*


It consistently uses the wrong tenant which sometimes appears as "American Airlines" in other error messages.


I have cleared out all the various Azure logins, so the DefaultAzureCredential fails not finding any login configurations.


I have tried:
az login --tenant-id xxx
azd auth login
etc...


This worked recently, and then I had to reboot.


Where is the login logic pulling tenant 49793faf-eb3f-4d99-a0cf-aef7cce79dc1. from ?
How do I get rid of it ?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to best way to construct a static class member in c++?

 Programing Coderfunda     February 29, 2024     No comments   

So simply put, I have a class Foo with a Foo() constructor.


Another class Bar which define a static member of class Foo: the Foo member is being initialized (but not constructed).


What's the best way to construct the static member, in other words where or how should I make sure the constructor is called on the static member?


Should I turn to singleton?
// In demo.h

class Foo {
Foo() {
// doing important stuff in there
}
};

class Bar {
static Foo foo;
};

// In demo.cpp
Foo Bar :: foo = Foo();

void main() {
Bar bar;

// bar.foo is not constructed yet. How to do that?
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Drizzle ORM select return string that isn't a column

 Programing Coderfunda     February 29, 2024     No comments   

I have a SQL query like this:
SELECT *
FROM (
SELECT 'car' AS type, model FROM car
UNION
SELECT 'truck' AS type, model FROM trucks
) vehicles;



I want to replicate the 'car' as type part in Drizzle so I can distinguish the data being returned without adding a column "type" to both tables and having repetitive data.


Is there a way to do this currently?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

08 February, 2024

What's New Video: InsertOrIgnoreUsing, Adding Multiple Global Scopes & Unlink Storage

 Programing Coderfunda     February 08, 2024     No comments   

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

Ask AI Questions About Your Codebase from the CLI With Laragenie

 Programing Coderfunda     February 08, 2024     No comments   

---



Laragenie is an AI chatbot with an Artisan console integration for your Laravel applications. It can understand your source code by indexing directory/file paths. You can then ask questions about your code such as "Describe all the model associations for the App\Models\Post model".


Here's an example of how you can configure the indexes in your configuration file. It works by indexing your configured files with an AI model using OpenAI to generate responses and Pinecone to index data:
// config/laragenie.php
return [
// ...
'indexes' => [
'directories' => ['App/Models', 'App/Http/Controllers'],
'files' => ['tests/Feature/MyTest.php'],
'removal' => [
'strict' => true,
],
],
];




Once you’ve installed this package, you can index your files, clear the index, and ask questions by running the laragenie command:


Ask questions about your code from the command line.



Note that the files you index and ask questions about needn’t be only PHP files! You can also index and ask questions about your JavaScript, GitHub workflows, etc. The neat thing about this CLI is that it’s not generic answers; it’s specifically helpful to answer questions about your unique codebases.


Using AI models is a valuable way to speed up tedious tasks. It can be helpful in onboarding developers new to a project and getting general knowledge about an unfamiliar codebase more rapidly.


This package is available on Github at joshembling/laragenie and installable via composer:
composer require --dev joshembling/laragenie




The post Ask AI Questions About Your Codebase from the CLI With Laragenie 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

Exception "No successful match so far" after Matcher.find() == true

 Programing Coderfunda     February 08, 2024     No comments   

Matcher m = patternFoo.matcher(sFoo);

if(m.find()){
...
m.start()
...
}



I wonder how it is possible for the m.start() in the above code to throw the following exception:
Exception: No successful match so far
Class: java.lang.IllegalStateException
Stack trace: java.lang.IllegalStateException: No successful match so far
at java.util.regex.Matcher.ensureMatch(Matcher.java:1116)
at java.util.regex.Matcher.start(Matcher.java:1158)
at java.util.regex.Matcher.start(Matcher.java:1130)



Could anyone shed some light on this?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

07 February, 2024

Updating associated items in Sequelize

 Programing Coderfunda     February 07, 2024     No comments   

still trying to learn the magic of sequelize. I've made some progress, but I'm totally stumped at how to achieve updating associated items in a clean and organized way. I am using it with postgres.


Basically I have a table "invoices". Those invoices have a table "invoiceItems" associated to them as one invoice to many invoiceItems.


Now I have a route where users can update invoices. The part I cant figure out is how to handle when they update, add, or delete invoiceItems. The front end would be able to send me a JSON object containing all of the data including the IDs for the invoice and the invoiceItems (except the new ones of course). The goal is to update the existing invoice and associated invoiceItems with the new object sent from the front end. I can use the object to create a new invoice no problem, but updating has proven very complicated for me.


My create statement works and looks like this, I would love something similar for update, but I am starting to understand that might not be possible
db.invoice.create(
req.newInvoice, {
include:[
db.invoiceItem
]
}
)



I have tried using transactions as well as mixin methods like set/add/remove etc. With limited success and anything that comes close has so many nested loops comparing the versions it makes my head spin. Is there an easier way to achieve this that I have over looked?


Here's my pared down models for you to see in case it helps:


invoices
module.exports = (sequelize, Sequelize, DataType) => {
const Invoice = sequelize.define('invoice', {
id: {
type: DataType.UUID,
primaryKey: true,
defaultValue: Sequelize.literal( 'uuid_generate_v4()' )
},
userId: {
type: DataType.UUID,
},
createdAt: {
type: DataType.DATE
},
UpdatedAt: {
type: DataType.DATE
}
},{
underscored: true
});

Invoice.associate = models => {
Invoice.hasMany(models.invoiceItem), {
foreignKey: "invoiceId",
onDelete: 'cascade'
}

Invoice.belongsTo(models.user, {
foreignKey: "userId"
})
};

return Invoice
};




invoiceItems
module.exports = (sequelize, Sequelize, DataType) => {
const InvoiceItem = sequelize.define('invoiceItem', {
id: {
type: DataType.UUID,
primaryKey: true,
defaultValue: Sequelize.literal( 'uuid_generate_v4()' )
},
invoiceId: {
type: DataType.UUID,
},
userId: {
type: DataType.UUID,
createdAt: {
type: DataType.DATE
},
updatedAt: {
type: DataType.DATE
}
},{
underscored: true
});

InvoiceItem.associate = models => {
InvoiceItem.belongsTo(models.invoice, {
foreignKey: "invoiceId"
})
InvoiceItem.belongsTo(models.user), {
foreignKey: "userId"
}};

return InvoiceItem
};




Thanks in advance for any help/ideas!
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Is there a way to write a JavaScript program that enables you to Search Words in Multiple PDF Files?

 Programing Coderfunda     February 07, 2024     No comments   

I need to create a simple program/system/application using JavaScript that enables a user to search a certain word in multiple scanned PDF files. So basically a user will scan multiple files and save them to the computer as Searchable PDF Files. Then the user will upload the PDF Files into the program/system/application, that I am trying to create, where he/she will be able to search a certain word in the PDF files that were uploaded.


Basically it's just like the Adobe Acrobat's Advance Search option. I just need to create a similar program but much simpler. It's a project for school. Please help.


JavaScript is my preferred language but if you have any ideas from a different programming language, I'm open to it.


If you can send me links of blogposts or YouTube videos it will be much appreciated.


Thank you so much!


I have already tried this:
https://apryse.com/blog/indexed-search/search-multiple-documents-using-javascript but I can't seem to make it work. An error occurs in installing the package. And this is the only thing out there that's very close to what I'm trying to achieve.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Command CodeSign failed with a nonzero exit code in flutter debug

 Programing Coderfunda     February 07, 2024     No comments   

Uncategorized (Xcode): Command CodeSign failed with a nonzero exit code, when debugging showing this , I build 3 apps first everything is worked after a week trying to debug showing this, when I tried a new app that's also can't debug
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

What do you actually do with Laravel?

 Programing Coderfunda     February 07, 2024     No comments   

Every time I read a post about Laravel I feel like I'm using it wrong. Everyone seems to be using Docker containers, API routes, API filters (like spaties query builder) and/or Collections, creating SPA's, creating their own service providers, using websockets, running things like Sail or node directly on live servers etc, but pretty much none of those things are part of my projects.

I work for a company that have both shared and dedicated servers for their clients, and we mostly create standard website or intranet sites for comparitively low traffic audiences. So the projects usually follow a classic style (db-> front end or external api -> front end) with no need for these extras. The most I've done is a TALL stack plus Filament. And these projects are pretty solid - they're fast, efficient (more efficient recently thanks to better solutions such as Livewire and ES module-bsased javascript). But I feel like I'm out of date because I generally don't understand a lot of these other things, and I don't know when I'd ever need to use them over what I currently work with.

So my question is, what types of projects are you all working on? How advanced are these projects? Do you eveer do "classic" projects anymore?

Am I in the minority, building classic projects?

How can I improve my projects if what I'm doing already works well? I feel like I'm getting left behind a bit.

Edit: Thanks for the replies. Interesting to see all the different points of view. I'm glad I'm not the only one. submitted by /u/No-Echo-8927
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

06 February, 2024

Pass a button variable to controller codeigner 4

 Programing Coderfunda     February 06, 2024     No comments   

I tried passing a variable on a button into the controller, but when I tried to display the value it was always null


here is my code :
`id") . '" data-quotation="' . $row->id_quotation . '">Edit`



my ajax :
`$(document).on('click', '.edit', function() {
var quotation = $(this).attr('data-quotation');
$.ajax({
type: 'POST',
dataType: 'json',
url: baseurl + 'purchase/senddata/' + quotation,
data: {
'quotation': quotation
},
success: function(data) {
window.location = url;
}.then(function() {

})
});
});
`



this my Controller :
public function edit_data($id)
{
$id_quotation = $this->request->getVar('quotation');

$data = [
'title' => 'Edit Purchase Order',
'invoice' => $this->purchases->getPurchase($id),
'dataQuotation' => $this->purchases->getQuotationById($id_quotation)
];
dd($id_quotation);
return view('purchase-order/edit-data', $data);
}



and this my routes :
$routes-\>post('purchase/senddata/(:segment)', 'Purchase::edit_data/$1');



on my controller there I do a var_dump but the value is always null


from the way I tried to do it above can someone be kind enough to tell me where I made a mistake in my code
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Search Through exel file using a search html

 Programing Coderfunda     February 06, 2024     No comments   

function applyFilter(userInput){
/*
Use css to set the display to none first
*/
let allClientIDRows = document.querySelectorAll("ClientID-row > a");
for(let i = 0; i < allClientIDRows.length; i++){
let row = allClientIDRows[i]
let ClientID = row.getElementsByClassName("ClientID")[0]
if(allClientIDRows[i].textContent.trim() == userInput.trim()){
//You can also convert to lowercase for more accurate result
allClientIDRows[i].style.display = "inline";
}
}
}



This is the function that applys the filter to allow you to search and show what you search for and not the entire form.
i am only looking to show the searched item and not the entire spreadsheet



Data






Type in your ID















No ID FOUND






Loading








Failed to get data. Please refresh







function setErrorDisplay(loaderElm, allClientIDsElm, errorMessageElm){
loaderElm.style.display = "none"
allClientIDsElm.style.display = "none"
errorMessageElm.style.display = "block"
}

let allClientIDsElm = document.getElementById("allClientIDs")
let loaderElm = document.getElementById("loader")
let errorMessageElm = document.getElementById("errorMessage")

fetch("
{https://api.apispreadsheets.com/data/").then(res=>{ /> if (res.status === 200){
//sucess
res.json().then(data=>{
const yourData = data["data"]
for(let i = 0; i < yourData.length; i++){
let rowInfo = yourData[i]

let rowInfoDiv = document.createElement("div")
rowInfoDiv.classList.add("ClientID-row")

let rowClientID = document.createElement("h4")
let rowClientIDNode = document.createTextNode(rowInfo["ClientID"])
rowClientID.appendChild(rowClientIDNode)
rowClientID.classList.add("ClientID")

let rowRA = document.createElement("p")
let rowRANode = document.createTextNode(rowInfo["RA"])
rowRA.appendChild(rowRANode)
rowRA.classList.add("RA")

rowInfoDiv.appendChild(rowClientID)
rowInfoDiv.appendChild(rowRA)

allClientIDsElm.appendChild(rowInfoDiv)

}

loaderElm.style.display = "none"
allClientIDsElm.style.display = "block"
errorMessageElm.style.display = "none"

}).catch(err => {
setErrorDisplay(loaderElm, allClientIDsElm, errorMessageElm)
})
}
else{
setErrorDisplay(loaderElm, allClientIDsElm, errorMessageElm)
}
}).catch(err =>{
setErrorDisplay(loaderElm, allClientIDsElm, errorMessageElm)
})




This is the HTML part that runs the html search part


For some reason when i run with the function its still showing all the spreadsheet. What i am trying to do is How to make a search list in which element is only shown when user search for its exact value


when you type it shows you the result but the form will be empty untiil you type


i tryed with a search function with a filter but it shows the entire spreadsheet. Maybe i am doing something wrong or messed up somewhere in the code.


the applyfilter isnt working for me maybe there is another way i can do this
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Resources covering modern non-cloud (Laravel) deployment? Best practices for deploying updates, serving new features to beta-testers, reliable backups, security, etc.

 Programing Coderfunda     February 06, 2024     No comments   

Hey,

my background building Laravel apps is working on comparably small projects for a few clients that just needed more custom functionality than WordPress could offer and a handful of personal one-off projects for organizations I volunteer for. Mostly apps that you build and not touch anymore for long stretches of time.

Recently, someone approached me with a very interesting offer to develop a more complex application they'd use internally. Laravel seems suitable as no mobile app is required. Even down the road a progressive web app would totally suffice if necessary at all. Their business is on the smaller side of what can be considered a SMB, I'd estimate
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

My package Laravel, Lara Hierarchial Collections has been updated to support Laravel 11 - package to performantly convert a flat collection of hierarchical data to a nested collection for things like Org Charts.

 Programing Coderfunda     February 06, 2024     No comments   

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

Laravel Purity vs Spatie's laravel-query-builder?

 Programing Coderfunda     February 06, 2024     No comments   

I'm looking to implement an out-of-the-box solution for filtering & sorting results on my API endpoints, and I've come across Laravel Purity and Spatie's laravel-query-builder. Both are still actively being maintained and offer similar features. I like Purity's approach of defining the filter logic on the model instead of on the controller (which is what Spatie does), but Spatie's solution is a lot more popular.

Is there anyone who has tried both packages or prefers one over another for any good reason? submitted by /u/DigitalEntrepreneur_
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

05 February, 2024

How to know IP of the request made in python using amazon api gateway

 Programing Coderfunda     February 05, 2024     No comments   

I make a question explorer in python. To get IP ban I try to use amazon api gateway to rotate IP using this guide. But the problem is I can not configure to check the response actually goes through api gateway not used my IP. Please also suggest me to any modification required in the code. Any suggestion will be appreaciated.


The code I tried:

import requests
import xml.etree.ElementTree as ET
from requests_ip_rotator import ApiGateway, EXTRA_REGIONS

# Define Class
class QuestionsExplorer:
def GetQuestions(self, questionType, userInput, countryCode):
questionResults = []
# Build Google Search Query
searchQuery = questionType + " " + userInput + " "
# API Call
googleSearchUrl = "
http://google.com/complete/search?output=toolbar&gl=" + \
countryCode + "&q=" + searchQuery

# Call The URL and Read Data
result = session.get(googleSearchUrl)
tree = ET.ElementTree(ET.fromstring(result.content))
root = tree.getroot()
for suggestion in root.findall('CompleteSuggestion'):
question = suggestion.find('suggestion').attrib.get('data')
questionResults.append(question)

return questionResults

gateway = ApiGateway(site="
http://google.com",">
http://google.com", regions=["us-east-1"], access_key_id = "AWS_ACCESS_KEY_ID", access_key_secret = "AWS_SECRET_ACCESS_KEY")
gateway.start()
session = requests.Session()
session.mount("
http://google.com",">
http://google.com", gateway)

# use a Keyword for testing
userInput = "email marketing"

# Create Object of the QuestionsExplorer Class
qObj = QuestionsExplorer()
print("Keyword ideas about 'is'")
# Call The Method and pass the parameters
questions = qObj.GetQuestions("is", userInput, "us")

# Loop over the list and pring the questions
for result in questions:
print(result)
print("Keyword ideas about 'can'")
questions = qObj.GetQuestions("can", userInput, "us")

# Loop over the list and pring the questions
for result in questions:
print(result)

print("Done")
gateway.shutdown()
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

FindQt5.cmake in CMAKE_MODULE_PATH

 Programing Coderfunda     February 05, 2024     No comments   

I have started to practice Qt and now working on a mp3 file player and in order to do that I have to use a library called QtMediaPlayer and QMultiMedia.

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)

find_package(Qt5 COMPONENTS Multimedia REQUIRED)

add_executable(MyMp3Player main.cpp mainwindow.cpp)

target_link_libraries(MyMp3Player Qt5::Multimedia)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How do i tweak my YAML file so that it builds but does not deploy? I want to set up a PR Build pipeline to test build each PR

 Programing Coderfunda     February 05, 2024     No comments   

See below for my YAML code that I have in Azure pipeline, it is based off of a pipeline I created that works great for building and deploying.


I'm hoping to create a new pipeline that triggers when there is a PR to the "main" branch, and it builds the branch in the PR to see if there are any build issues before we merge it with the "main" branch. I believe the name for this is Build Validation, but I'm stuck with creating the pipeline. Or is this right and I need to handle this with settings in the build validation setup?


I tried to update the YAML so it only runs when a PR is created, I think that part is okay. But I can't seem to figure out how to cancel the deployment part. The changes I make keep breaking in the build process of my existing normal pipeline.
name: Azure Static Web Apps CI/CD

pr:
branches:
include:
- main
trigger: none

jobs:
- job: build_and_deploy_job
displayName: Build and Deploy Job
condition: or(eq(variables['Build.Reason'], 'Manual'),or(eq(variables['Build.Reason'], 'PullRequest'),eq(variables['Build.Reason'], 'IndividualCI')))
pool:
vmImage: ubuntu-latest
variables:
- group: Azure-Static-Web-Apps
steps:
- checkout: self
submodules: true
- task: AzureStaticWebApp@0
inputs:
azure_static_web_apps_api_token: $(AZURE_STATIC_WEB_APPS)
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit:
https://aka.ms/swaworkflowconfig /> app_location: "/" # App source code path
api_location: "" # Api source code path - optional
output_location: "" # Built app content directory - optional
env:
NEXT_PUBLIC_OPENAI_KEY: $(NEXT_PUBLIC_OPENAI_KEY)

###### End of Repository/Build Configurations ######
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel Reverb: First-party WebSocket server

 Programing Coderfunda     February 05, 2024     No comments   

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

Best practice for API versioning

 Programing Coderfunda     February 05, 2024     No comments   

Hello! I would like to ask how do you handle the versioning of your laravel API? Can you provide me some documentations on what best approach you follows? Thanks! submitted by /u/Environmental-Put358
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

04 February, 2024

How to get 30 days prior to current date?

 Programing Coderfunda     February 04, 2024     No comments   

I have a start calendar input box and an end calendar input box. We want defaults start calendar input box 30 days prior to current date and the end calendar input box to be the current date. Here is my date vars.

var today = new Date(),
dd = today.getDate(),
mm = today.getMonth(),
yyyy = today.getFullYear(),
month = ["January", "February", "March",
"April", "May", "June", "July", "August",
"September", "October" "November", "December"],
startdate = month[mm] + ", " + yyyy.toString();




The end date would be something like var enddate = startdate - 30; Obviously this won't work.



So if the current date is December 30, 2011 I'd want the start date to read December 1, 2011.



EDIT: My question was answered... sort of. Date.today(); and Date.today().add(-30); work but I need the date in the format of January 13, 2012. Not Fri Jan 13 2012 10:48:56 GMT -055 (EST). Any help?



MORE EDIT: As of this writing it's 2018. Just use Moment.js. It's the best.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Correctly displaying parsed MJML in a Laravel mailable class

 Programing Coderfunda     February 04, 2024     No comments   

I'm using Spatie MJML package and this is what I have in my content() function of my LeadCreatedWelcomeMail class.
public function content()
{
$preview_text = 'Your Test Drive Has Been Scheduled!';
$lead = $this->lead;

$html = Mjml::new()->toHtml(view("emails.lead-created", compact('lead', 'preview_text'))->render());

return new Content(
view: $html,
);
}



The MJML correctly gets parsed as html. How can I pass it to my new Content class to display the email. The way I'm doing above is erroring out.


Error: View [the html strings that gets produced] not found.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Typescript eslint dont not recognize object in array

 Programing Coderfunda     February 04, 2024     No comments   

Hellow i got some problem with typescript or eslint (im new in eslint).


I show code, and next try to explain the error.


types.ts
export type TSettingsIputsState = {
personal: {
label: string;
name: keyof TApiResponseProfile;
value: string;
activeEdit: boolean;
onActionButtonClick: () => void;
}[];
display: boolean;
};



component.tsx
const [profileInputs, setProfileInputs] = useState();

useEffect(() => {
const setFormData = async () => {
if (!profileData) return;
const inputs = await inputsItems();

setProfileInputs({
personal: [
...inputs.personalSettings.map(({ label, name }) => ({
label,
name,
activeEdit: false,
value: profileData[name],
onActionButtonClick: () => console.log("asd"),
})),
],
display: false,
});
};

setFormData();
}, [profileData]);



This code give me no error from ts or eslint, but when i delete name and add dummy value, the ts dont suggest me to add name, and dont not recognize that dummy shouldn't be there.


Another error is when i change onActionButtonClick: (testing: string) => void in type there is no error when no change in onActionButtonClick: () => console.log("asd")


Please see image on link belowa


Why no error? doesn't suggest 'name'? IMAGE

https://i.stack.imgur.com/ppIAv.png />

tsconfig
{
"compilerOptions": {
"baseUrl": ".",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": false,
"strict": true,
"noEmit": true,
"target": "ES2015",
"esModuleInterop": true,
"module": "esnext",
"strictPropertyInitialization": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true,
"sourceMap": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"noImplicitAny": false,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/layouts/*": ["./layouts/*"],
"@/complex/*": ["./components/complex/*"],
"@/parts/*": ["./components/parts/*"],
"@/inputs/*": ["./components/inputs/*"],
"@/forms/*": ["./components/forms/*"],
"@/hooks/*": ["./hooks/*"],
"@/skeletons/*": ["./components/skeletons/*"],
"@/utils/*": ["./utils/*"],
"@/middlewares/*": ["./middlewares/*"],
"@/providers/*": ["./providers/*"],
"@/types/*": ["./types/*"],
"@/apiTypes/*": ["./app/api/_types/*"],
"@/yupSchema/*": ["./yupSchema/*"],
"@/apiYupSchema/*": ["./app/api/_yupSchema/*"],
"@/dbPrisma": ["./utils/db.ts"],
"@/formsInitialValues/*": ["./formsInitialValues/*"],
"@/wretch": ["./utils/wretch"]

}
},
"include": ["next-env.d.ts", "types/**/*.ts", "app/_types/**/*.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}



eslintrc.json
{
"env": {
"browser": true,
"es2021": true,
"jest": true
},
"extends": [
"airbnb",
"airbnb-typescript",
"eslint:recommended",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:@tanstack/eslint-plugin-query/recommended"
],
"globals": {
"__dirname": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"

},
"plugins": [
"react",
"react-hooks",
"@typescript-eslint",
"prettier",
"@kalimahapps/eslint-plugin-tailwind"
],
"rules": {
"react/react-in-jsx-scope": ["off"],
"no-unused-vars": ["off"],
"react/jsx-uses-react": ["off"],
"react/jsx-props-no-spreading": ["off"],
"react/function-component-definition": ["off"],
"react/no-unescaped-entities": ["off"],
"react-hooks/rules-of-hooks": ["error"],
"react-hooks/exhaustive-deps": ["warn"],
"react/no-array-index-key": ["off"],
"arrow-body-style": ["error", "as-needed"],
"import/extensions": ["off"],
"import/prefer-default-export": ["off"],
"import/no-extraneous-dependencies": ["off"],
"@kalimahapps/tailwind/sort": ["warn"],
"@kalimahapps/tailwind/multiline": ["warn"],
"@typescript-eslint/no-throw-literal": ["off"],
"jsx-a11y/click-events-have-key-events": ["off"],
"jsx-a11y/no-static-element-interactions": ["off"],
"no-return-await": ["off"],
"@typescript-eslint/return-await": ["off"],
"react/button-has-type": [
"off",
{
"button": true,
"submit": true,
"reset": true
}
],
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "*", "next": "return" }
]
}
}




P.S.
It's only happend when personal is array, but the error with function parameter check persist anyway.


When i do this, and testing, typescript sugges ok, but not error on function parameter
personal: {
label: string;
name: keyof TApiResponseProfile;
value: string;
activeEdit: boolean;
onActionButtonClick: (testing: string) => void;
};



Can you guys/girls cam check if tsconfig or eslint have some bug?
Ty alot for your time
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • 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...
  • 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...
  • 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