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

14 September, 2024

An auth helper package for Laravel HTTP Client

 Programing Coderfunda     September 14, 2024     No comments   

I really like the built in HTTP Client in Laravel. It makes it so quick and easy to make calls to external services. But a common thing for me to solve when building applications with Laravel is simple authentication with external API:s. Especially OAuth2 or API:s that is using refresh tokens to fetch short lived access tokens. I was also very surprised that I couldn’t find any simple solutions for this. So I created one.

It is just an extension of the built in HTTP Client that provides a very simple, yet flexible and powerful API to manage the refreshing and usage of short lived access tokens. Managing this in a robust way required significant amount of boilerplate code or custom API clients for each integration. Now it is just a chained method call on the HTTP Client you are already using.

I’m about to release the 1.0 version, but first I wanted reach out to collect some feedback on the API and overall solution. Once I tag the 1.0 version, I don’t want to make any breaking changes for a good while.

Here is the repository:
https://github.com/pelmered/laravel-http-client-auth-helper

I’d love to get some feedback on this. Specifically I would like feedback on the following:


*

The API to use it. Is it good? How would you want to improve it?
*

What are the most sensible defaults? (See usage for example on how these are used)
*

Auth type: Basic or bearer? (for the access token)
*

Expires option (how should this be set by default? The package supports reading a field from the response from the refresh request, either as a string for the key in the response, or as a closure that receives the whole response object. You can also set it with an integer for TTL in seconds)
*

Credential token key name (If sent in body, or as a query string, what should be the the field name? Currently it is “token”)
*

Access token key (From what key should we get the access token from the refresh response be default? Accepts both a string or a closure that receives the response object and returns the token)
*

Right now I’m just using the default cache driver to store the tokens. Would you want this to be configurable?



The plan is to release version 1.0.0 with a stable API next weekend.

Thank you for reading! submitted by /u/pekz0r
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Error when i run commend php composer dump-autoload

 Programing Coderfunda     September 14, 2024     No comments   

Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover --ansi



Error


Class "Composer\InstalledVersions" not found


at vendor/maatwebsite/excel/src/Cache/CacheManager.php:43
39▕ * @return MemoryCache
40▕ */
41▕ public function createMemoryDriver(): CacheInterface
42▕ {
➜ 43▕ if (!InstalledVersions::satisfies(new VersionParser, 'psr/simple-cache', '^3.0')) {
44▕ return new MemoryCacheDeprecated(
45▕ config('excel.cache.batch.memory_limit', 60000)
46▕ );
47▕ }
+11 vendor frames



12 artisan:35
Illuminate\Foundation\Console\Kernel::handle()


Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1


I tried to change databass password and server
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Should Laravel introduce AI validation rules into core?

 Programing Coderfunda     September 14, 2024     No comments   

I think this could be a great addition. Would you use it? submitted by /u/jdcarnivore
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Where to find the latest version of google-api-services-gmail maven?

 Programing Coderfunda     September 14, 2024     No comments   

I am trying to find the latest version of the google-api-services-gmail api. At
https://central.sonatype.com/artifact/com.google.apis/google-api-services-gmail I see 1-rev20240520-2.0.0 which 'sounds' right. But the place where I usually get the versions is
https://mvnrepository.com/ which only has data from 2020:
https://mvnrepository.com/artifact/com.google.apis/google-api-services-gmail . Am I looking at the wrong place on mvnrepository ?


Thanks for any help in advance!


I also see
https://javadoc.io/doc/com.google.apis/google-api-services-gmail/latest/index.html which seems to be managed by Google as well as
https://mvnrepository.com/artifact/com.google.apis/google-api-services-artifactregistry/v1-rev20240903-2.0.0
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

I am trying to insert a timestamp from one spreadsheet to another spreadsheet

 Programing Coderfunda     September 14, 2024     No comments   

I have two spreadsheets, we will call them Active Spreadsheet (where the code is being implemented) and Target Spreadsheet (where the timestamps go) The Active Spreadsheet will have data entered on sheet "Week1" into column D starting at row 4. When the data is entered into column D I want an "Initial Date" timestamp and a "Modified Date" timestamp populated into the Target Spreadsheet, sheet "Week#1" at the corresponding rows in columns 1 and 2 respectively. I have the following code written, and it runs without errors. However, when I input data into column D of the Active Spreadsheet, nothing populates in the Target Spreadsheet. I have tried running the code and researching various reasons as to why it is not working but cannot find a solution.
function onEdit(e){
const row = e.range.getRow();
const col = e.range.getColumn();
const sheetName = "Week1";

if (col === 4 && row > 3 && e.source.getActiveSheet().getName() === "Week1"){

var activeSpreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var targetSpreadsheetId = "TargetSpreadsheetID";
var targetSpreadsheet = SpreadsheetApp.openById(targetSpreadsheetId);
var targetSheet = targetSpreadsheet.getSheetByName("Week#1");
var targetRow = range.getRow();
var timestamp = new Date();
var formattedTimestamp = Utilities.formatDate(timestamp, Session.getScriptTimeZone(), "yyyy-MM-dd HH:mm:ss");

targetSheet.getRange(row,2).setValue(formattedTimestamp);

if(targetSheet.getRange(row,1).getValue() == ""){
targetSheet.getRange(row,1).setValue(formattedTimestamp);

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

13 September, 2024

Different plots of marginal effects with interaction term and offset when using different packages

 Programing Coderfunda     September 13, 2024     No comments   

I'm trying to understand why when I plot marginal effects using different packages I get different plots. Admittedly, I suspect it's because I do not understand how data transformations and offsets are being handled by the respective packages. I'm afraid I don't know how to make a reproducible sample of data, but I hope I can provide enough context below.


I have the following model using package MASS:
model
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel Singletons Can Be Dangerous in Long Living Processes

 Programing Coderfunda     September 13, 2024     No comments   

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

Stop using arrays

 Programing Coderfunda     September 13, 2024     No comments   

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

Laravel Herd Adds Forge Integration, Dump Updates, and More in v1.11

 Programing Coderfunda     September 13, 2024     No comments   

---




Laravel Herd released v1.11 this week, a significant update that includes Laravel Forge integration, sharing Herd project configuration across a team, a convenient profiler integration, and more:


Laravel Herd v1.11 Main Features






*
Forge Integration - Integrate directly with Forge and deploy applications via the UI

*
Share Configuration With Your Team - share project configuration via a Herd.yml file

*
Profiler - profile applications with the SPX profiler using herd profile


*
Reverb TLS Support - Reverb TLS support with the click of a checkbox

*
Dump UI Improvements - Dump queries, HTTP requests, logs, and more directly in Herd





Forge Integration




Herd now has direct integration with Laravel Forge, enabling you to deploy your site directly from Herd, open an SSH connection on the server, or even open your site on forge.laravel.com. Head over to the documentation to learn more!


Sharing Configuration With Herd.yml




With Herd v1.11, you can share project configuration with your team using a Herd.yml file in the root of your project. You can configure the project name, domain aliases, PHP version, and SSL certificates.


You set up the Herd.yml using the herd init command. If your project doesn't have the file, the init command prompts you through the setup process. Pro users can also define services in the Herd.yml file.


When a new developer clones your project, running herd init will get them up and running immediately, and all developers will have the same setup. Projects can configure the Forge server and site IDs to share site configurations with all developers.


Check out the Herd documentation to learn all about Sharing project configurations.


The Herd v1.11 update is available immediately on macOS, with the Windows release happening soon.


Profiler




Herd v1.11 has a new profiler for identifying performance issues in your code. Herd makes profile requests, CLI scripts, and long-running tasks seamless.


Profiler example from the Herd documentation



Here's an example of profiling Artisan commands via the Herd CLI:
herd profile artisan my-command



Dump UI Improvements




Herd's dump debugging features a new custom PHP extension that makes using dd() and dump() automatic. You can also configure Herd to dump queries, HTTP requests, views, jobs, and logs.





Learn More




You can learn more about Herd's features in the official documentation.



The post Laravel Herd Adds Forge Integration, Dump Updates, and More in v1.11 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

What’s New in Laravel 11.23: A Summary

 Programing Coderfunda     September 13, 2024     No comments   

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

12 September, 2024

Excel VBA Selecting the files xxx_Before.log then xxx_After.log

 Programing Coderfunda     September 12, 2024     No comments   

Main goal is to select Tag1_Before.log then Tag1_After.log (The name of the files will be different but there will definitely have a before or after in the name of the files). Currently the files are being selected in alphabetical order because I am using the Dir function. Below is part of the code I have gathered, and a visual representation of where I will access the files.
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Filters.Add "Log Files", "*.log", 1

If .Show = -1 Then
FullPath = .SelectedItems.Item(1) 'selected text file full path
End If
End With

If FullPath = "" Then Exit Sub 'if Cancel pressed, the code stops

textFileLocation = Left(FullPath, InStrRev(FullPath, "\") - 1)
fileName = Dir(textFileLocation & "\*.log") 'first text file name
fileDate = Format(FileDateTime(textFileLocation), "mm/dd/yyyy")

If fileName "" Then
Do While fileName "" 'loop since there still are not processed text files
'Get File Name
sFullFilename = Right(fileName, Len(fileName) - InStrRev(fileName, "\"))
sFileName = Left(sFullFilename, (InStr(sFullFilename, ".") - 1))

'place the content of the text file in an array (split by VbCrLf):
arrTxt = Split(CreateObject("Scripting.FileSystemObject").OpenTextFile(textFileLocation & "\" & fileName, 1).ReadAll, vbCrLf)
lastR = ws.Range("A" & ws.Rows.Count).End(xlUp).Row 'the row where to paste the array content

'drop the transposed array content:
ws.Range("A" & IIf(lastR = 1, lastR, lastR + 1)).Resize(UBound(arrTxt) + 1, 1).Value = Application.Transpose(arrTxt)

'apply TextToColumns to whole returned data:
ws.Columns(1).TextToColumns Destination:=ws.Range("A1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(43, 1), Array(70, 1)), TrailingMinusNumbers:=True
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

✅ Command Validator: validate the input of console commands

 Programing Coderfunda     September 12, 2024     No comments   

Command Validator is a Laravel package to validate the input of console commands. ✅


https://github.com/cerbero90/command-validator

The validation of our command arguments and options is just one trait away! 🙌


https://preview.redd.it/018z0tn9pfod1.png?width=1748&format=png&auto=webp&s=e523f7bd24f8c4b94c9a08b1f19a383a699982cb submitted by /u/cerbero90
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Invalid Grant Error with MSAL in Next.js - Insufficient Permissions (AADB2C90205)

 Programing Coderfunda     September 12, 2024     No comments   

I am implementing login functionality in my Next.js application using Azure AD B2C and the MSAL library. However, I am encountering the following error when attempting to log in:
{
"error": "invalid_grant",
"error_description": "AADB2C90205:This application does not have sufficient permissions
against this web resource to perform the operation.
\r\nCorrelation ID: 425d0c39-3bf7-48be-9b81-8bc5cd5abc02\r\nTimestamp: 2024-09-06 12:41:31Z\r\n"
}



Here are the relevant details:
@azure/msal-browser: ^3.23.0
@azure/msal-react: ^2.0.13



I am using Azure AD B2C to handle user authentication.


Steps Taken:


I registered the application in Azure AD B2C.
Configured the necessary redirect URIs and API permissions.
Set up the MSAL configuration in my Next.js app using the MSAL React library.


Troubleshooting Attempts:


Checked API permissions and made sure they were granted admin consent.
Verified that the redirect URIs and scopes in my MSAL configuration match those in Azure AD B2C.
Question: What might be causing this "insufficient permissions" error, and how can I resolve it? Is there something specific I need to configure in Azure AD B2C for MSAL to successfully authenticate users?


Any help would be appreciated!
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laracon US Keynote Framework Updates Are Now In Laravel 11.23

 Programing Coderfunda     September 12, 2024     No comments   

---




The Laravel team released v11.23 this week, with the Laracon US 2024 open-source updates like defer(), concurrency, contextual container attritubes, and more.


Laracon 2024 Updates




Taylor Otwell contributed all of the goodies he shared in his Laracon US 2024 keynote, including chaperone(), defer(), Cache::flexible(), contextual container attributes, and more.


The documentation is being updated; here are a few highlights you should check out to get familiar with these updates:




*
Concurrency Documentation


*
Container Contextual Attributes


*
Automatically Hydrating Parent Models on Children (AKA chaperone())

*
Helpers: Deferred Functions






See Pull Request #52710 for full details on everything added related to Taylor's .


Add minRatio and maxRatio Rules to Dimension Validation




Cam Kemshal-Bell added min and max ratio to the dimensions validation rule:



You can use these methods fluently, using minRatio(), maxRatio(), and ratioBetween():
use Illuminate\Validation\Rule;

//
// Using minRatio and maxRatio fluent methods
//
Rule::dimensions()
->minRatio(1 / 2)
->maxRatio(1 / 3);
// dimensions:min_ratio=0.5,max_ratio=0.33333333333333

//
// Equivalent using ratioBetween()
//
Rule::dimensions()->ratioBetween(min: 1 / 2, max: 1 / 3);

// dimensions:min_ratio=0.5,max_ratio=0.33333333333333



You can also use the string style dimensions rule with this update as well:
use Illuminate\Support\Facades\Validator;

Validator::make($request->all(), [
'min_12' => 'dimensions:min_ratio=1/2',
'square' => 'dimensions:ratio=1',
'max_25' => 'dimensions:max_ratio=2/5',
'min_max' => 'dimensions:min_ratio=1/4,max_ratio=2/5',
]);



Backed Enum Support in Gate Methods and Authorize Middleware




Diaa Fares contributed two pull requests that continue to add backed enum support. This release includes updates to the Gate methods and Authorize middleware.


Here are some examples of using Enums with Gate methods:
enum Abilities: string {
case VIEW_DASHBOARD = 'view-dashboard';
case EDIT = 'edit';
case UPDATE = 'update';
}

// Before
Gate::define('view-dashboard', function (User $user) {
return $user->isAdmin;
});

Gate::authorize('view-dashboard');
Gate::inspect('view-dashboard');
Gate::check('view-dashboard');
Gate::any(['edit', 'update], $post);
Gate::none(['edit', 'update]], $post);
Gate::allows('update', $post);
Gate::denies('update', $post);

// After
Gate::define(Abilities::VIEW_DASHBOARD, function (User $user) {
return $user->isAdmin;
});

Gate::authorize(Abilities::VIEW_DASHBOARD);
Gate::inspect(Abilities::VIEW_DASHBOARD);
Gate::check(Abilities::VIEW_DASHBOARD);
Gate::any([Abilities::EDIT, Abilities::UPDATE], $post);
Gate::none([Abilities::EDIT, Abilities::UPDATE], $post);
Gate::allows(Abilities::UPDATE, $post);
Gate::denies(Abilities::UPDATE, $post);



Here's an example of the Authorize middleware's support for backed enums:
Route::get('/dashboard', [AdminDashboardController::class, 'index'])
->middleware(
Authorize::using(Abilities::VIEW_DASHBOARD)
)
->name(AdminRoutes::DASHBOARD);



Skip Middleware for Queue Jobs




Kennedy Tedesco contributed a Skip middleware to skip a job based on a condition. This middleware has three static constructor methods you can use, including when(), unless(). The job is skipped based on the result of the condition used:
class MyJob implements ShouldQueue
{
use Queueable;

public function handle(): void
{
// TODO
}

public function middleware(): array
{
return [
Skip::when($someCondition), // Skip when `true`

Skip::unless($someCondition), // Skip when `false`

Skip::when(function(): bool {
if ($someCondition) {
return true;
}
return false;
}),
];
}
}



Eloquent Collection findOrFail() Method




Steve Bauman contributed a findOrFail() method on Eloquent collections that adds a way to find a model on an already populated collection:
$users = User::get(); // [User(id: 1), User(id: 2)]

$users->findOrFail(1); // User

$user->findOrFail([]); // []

$user->findOrFail([1, 2]); // [User, User]

$user->findOrFail(3); // ModelNotFoundException: 'No query results for model [User] 3'

$user->findOrFail([1, 2, 3]); // ModelNotFoundException: 'No query results for model [User] 3'



Release notes




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


v11.23.0






* [11.x] Fix $fail closure type in docblocks for validation rules by @bastien-phi in
https://github.com/laravel/framework/pull/52644 />

* [11.x] Add MSSQL 2017 and PGSQL 10 builds by @driesvints in
https://github.com/laravel/framework/pull/52631 />

* Update everyThirtyMinutes cron expression by @SamuelNitsche in
https://github.com/laravel/framework/pull/52662 />

* Bump micromatch from 4.0.5 to 4.0.8 in /src/Illuminate/Foundation/resources/exceptions/renderer by @dependabot in
https://github.com/laravel/framework/pull/52664 />

* [11.x] apply excludeUnvalidatedArrayKeys to list validation by @lorenzolosa in
https://github.com/laravel/framework/pull/52658 />

* [11.x] Adding minRatio & maxRatio rules on Dimension validation ruleset by @CamKem in
https://github.com/laravel/framework/pull/52482 />

* [11.x] Add BackedEnum support to Authorize middleware by @diaafares in
https://github.com/laravel/framework/pull/52679 />

* [11.x] Add BackedEnum support to Gate methods by @diaafares in
https://github.com/laravel/framework/pull/52677 />

* [11.x] Suggest serializable-closure by @driesvints in
https://github.com/laravel/framework/pull/52673 />

* [11.x] Fix alter table expressions on SQLite by @hafezdivandari in
https://github.com/laravel/framework/pull/52678 />

* [11.x] Add Exceptions\Handler::mapLogLevel(...) so the logic can be easily overridden by @taka-oyama in
https://github.com/laravel/framework/pull/52666 />

* [11.x] Bugfix for calling pluck() on chaperoned relations. by @samlev in
https://github.com/laravel/framework/pull/52680 />

* [11.x] Fix build failures due to enum collide After adding BackedEnum support to Gate by @diaafares in
https://github.com/laravel/framework/pull/52683 />

* Fixing Str::trim to remove the default trim/ltrim/rtim characters " \n\r\t\v\0" by @mathiasgrimm in
https://github.com/laravel/framework/pull/52684 />

* [11.x] Add Skip middleware for Queue Jobs by @KennedyTedesco in
https://github.com/laravel/framework/pull/52645 />

* [11.x] Fix etag headers for binary file responses by @wouterrutgers in
https://github.com/laravel/framework/pull/52705 />

* [11.x] add withoutDelay() to PendingDispatch by @KennedyTedesco in
https://github.com/laravel/framework/pull/52696 />

* [11.x] Refactor Container::getInstance() to use null coalescing assignment by @xurshudyan in
https://github.com/laravel/framework/pull/52693 />

* [11.x] Removed unnecessary call to setAccessible(true) by @xurshudyan in
https://github.com/laravel/framework/pull/52691 />

* [11.x] Add Eloquent\Collection::findOrFail by @stevebauman in
https://github.com/laravel/framework/pull/52690 />

* [11.x] PHPStan Improvements by @crynobone in
https://github.com/laravel/framework/pull/52712 />

* [11.x] Fix Collection PHPDoc by @staudenmeir in
https://github.com/laravel/framework/pull/52724 />

* [11.x] Add optional parameter for confirmed validator rule by @jwpage in
https://github.com/laravel/framework/pull/52722 />

* [11.x] Test Improvements by @crynobone in
https://github.com/laravel/framework/pull/52718 />

* [11.x] Fix incorrect variable-length argument $guards from array to string by @kayw-geek in
https://github.com/laravel/framework/pull/52719 />

* Allow testing of relative signed routes by @shealavington in
https://github.com/laravel/framework/pull/52726 />

* [11.x] fix: Builder::with closure types by @calebdw in
https://github.com/laravel/framework/pull/52729 />

* Laracon 2024 by @taylorotwell in
https://github.com/laravel/framework/pull/52710 />

* Add Tag attribute by @TijmenWierenga in
https://github.com/laravel/framework/pull/52743 />

* [11.x] Adds BackedEnum to PendingDispatch's phpDoc for onQueue, allOnQueue, onConnection, allOnConnection methods by @sethsandaru in
https://github.com/laravel/framework/pull/52739 />

* New when() helper. by @danmatthews in
https://github.com/laravel/framework/pull/52665 />

* [11.x] Add fromUrl() to Attachment by @KennedyTedesco in
https://github.com/laravel/framework/pull/52688 />






The post Laracon US Keynote Framework Updates Are Now In Laravel 11.23 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

Getting Authentication error when connecting to another private repo from the github actions workflow

 Programing Coderfunda     September 12, 2024     No comments   

I'm using the self-hosted runner in the GitHub actions workflow. Facing issue when running the terraform init command. It throws the Authentication error. I'm using PAT to connect to the other repo.
terraform:
runs-on: self-hosted
needs: determine_scope
if: needs.determine_scope.outputs.deploy == 'yes'
environment: ${{ inputs.environment }}
env:
TF_VAR_snowflake_account: ${{ vars.SNOWFLAKE_ACCOUNT }}
TF_VAR_snowflake_username: ${{ vars.SNOWFLAKE_USERNAME }}
TF_VAR_snowflake_role: ${{ vars.SNOWFLAKE_ROLE }}
TF_VAR_snowflake_private_key_passphrase: ${{ secrets.SNOWFLAKE_PASSPHRASE }}
TF_VAR_snowflake_private_key: ${{ secrets.SNOWFLAKE_PRIVATE_KEY }}

defaults:
run:
working-directory: ${{ inputs.path }}

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Login to Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZ_CREDENTIALS }}

- name: JSON Parse
id: parse
env:
AZJSON: ${{ secrets.AZ_CREDENTIALS }}
run: |
ARM_CLIENT_ID=$(echo $AZJSON | jq -r '.["clientId"]')
ARM_CLIENT_SECRET=$(echo $AZJSON | jq -r '.["clientSecret"]')
ARM_TENANT_ID=$(echo $AZJSON | jq -r '.["tenantId"]')
ARM_SUBSCRIPTION_ID=$(echo $AZJSON | jq -r '.["subscriptionId"]')
echo ARM_CLIENT_ID=$ARM_CLIENT_ID >> $GITHUB_ENV
echo ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET >> $GITHUB_ENV
echo ARM_TENANT_ID=$ARM_TENANT_ID >> $GITHUB_ENV
echo ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID >> $GITHUB_ENV

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: latest

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Configure Git Credentials
run: |
git config --global credential.helper store
echo "
https://x-access-token:${{ secrets.GIT_PAT }}@github.com" > ~/.git-credentials
env:
GIT_PAT: ${{ secrets.GIT_PAT }}

- name: Terraform Init
run: terraform init -backend-config="${{ inputs.backend_config }}"



error:


You said:
I'm getting this error in terraform init


│ Error: Failed to download module
│
│ on main.tf line 124:
│ 124: module "tag_associations" ***
│
│ Could not download module "tag_associations" (main.tf:124) source code from
│ "git::
https://github.com/g/platform-terraform.git?ref=main": /> │ error downloading
│ '
https://github.com/g/platform-terraform.git?ref=main': /> │ /usr/bin/git exited with 128: Cloning into
│ '.terraform/modules/tag_associations'...
│ remote: Invalid username or password.
│ fatal: Authentication failed for
│ '
https://github.com/g/platform-terraform.git/' />

When I use the github hosted runner (ubuntu-latest) it works fine. But when usig the self-hosted runner. it throws above error
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

11 September, 2024

how can I integrate continuous data and static data using random forest machine learning model?

 Programing Coderfunda     September 11, 2024     No comments   

I am using random forest regression model to predict groundwater level changes. I am using continuous inputs (timeseries data) such as GRACE, Precipitation, Maximum temperature, Minimum temperature, NDVI as well as static data such as land elevation, hydraulic conductivity, slope, sand percent. When I added static inputs to continuous inputs, the model gave high importance to static inputs and neglected continuous inputs. How I can fix this problem.


I got a prediction but the problem in feature importance the model gave high importance to static inputs and no importance for continuous inputs which is wrong. how can I fix this?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Spring boot app (error: method getFirst()) failed to run at local machine, but can run on server

 Programing Coderfunda     September 11, 2024     No comments   

The Spring boot app can run on the online server. Now, we want to replicate the same app at the local machine but the Spring boot jar file failed to run and had the below error.


I read Compilation error on List.getFirst(): cannot find symbol?
The answer stated the issue caused by the different java version of the online server and the local machine. But I checked they both used java 21.


Error message
JSONWebMvcConfigurer.java:
java: cannot find symbol
symbol: method addFirst(com.alibaba.fastjson2.support.spring6.http.converter.FastJsonHttpMessageConverter)
location: variable converters of type java.util.List
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

VS Code feels less

 Programing Coderfunda     September 11, 2024     No comments   

So I decided to move from PHPStorm to VS Code, because 2 PHPStorm reasons:

* PHPStorm Laravel Idea is a paid plugin :( Yes I know 30 days for free. I've been doing that for years now.
* PHPStorm is slow, bulky and takes a lot of Memory.




and several, but not limited to, VS Code reasons:

* It's fast.
* You can spawn cursors w/o switching to some column mode.
* Template shortcuts like "nav.w-full.bg-ping-600".
* Developers tend to use it and if I see video explaining or showing examples, nice to see the same editor.
* A lot of customization and tuning is possible.




How it's going you might ask?



Not easy. It's a nightmare some would say.

* I had to google and install a lot of Extensions. Then I had to deal with errors from said Extensions. Uninstall some of them. Then maybe install a couple back. I uninstalled a pack extensions and that removed all said extensions. I still don't know if I have all Laravel/Vue extensions and if I might need to change them later because of a different project... So many unknowns, where's the PHPStorm you just install and use. That's it.
* Quick fix is not working. Even after installing Volar, ESLint or Laravel extensions and going through all the settings the OpenAI suggested. Not Vuejs, not Laravel quick fix is working. Insane.
* In VSCode/Laravel project you can move or rename a file and nothing will be updated.
* I'm missing a PHPStorm panel where you could double-tap a ctrl and have a list of commands to execute in the terminal.
* VSCode does not have scratch files. Installed an Extensions. That doesn't work either.
* Missing the Laravel Idea make form for Models, Controllers, etc. I now have to either answer a lot of questions from Command Palette or run it manually from the terminal.
* If I ctrl-click "UserController@update" from the terminal, that doesn't work either. I have to delete the @\update to open the UserController.php file.
* PHPStorm has a very nice open modal: Open Class, Open fiile, actions, etc. I can't open a PHP class in VSCode.
* PHPStorm has a Local History modal, where I can go back in time while editing file and maybe re-do something or copy old code.
* I think I forgot a couple issues while writing this but I will end this rant by saying PHPStorm had all configurations in one place. I could configure and run php serve, npm dev, debug, etc all in 1 place. VSCode depends on extensions and whether they add commands to Command Palette.




Atm bootstrapping a full-stack developer to a VSCode feels challenging. Not to mention there's people who won't bother going through configuration or troubleshooting for VSCode. They would simply install PHPStorm and start using it. That's my friend. He's an iphone user. submitted by /u/darknmy
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to Not Turn Your Laravel App into a Circus

 Programing Coderfunda     September 11, 2024     No comments   

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

Lazy JSON Pages: scrape any JSON API in a memory-efficient way

 Programing Coderfunda     September 11, 2024     No comments   

Lazy JSON Pages v2 is finally out! 💝

Scrape literally any JSON API in a memory-efficient way by loading each paginated item one-by-one into a lazy collection 🍃

While being framework-agnostic, Lazy JSON Pages plays nicely with Laravel and Symfony 💞


https://github.com/cerbero90/lazy-json-pages


https://preview.redd.it/c7853u6ec3od1.png?width=2244&format=png&auto=webp&s=08d5394aefaf2058af278de631722bccabc24f03


https://preview.redd.it/dv5jmu6ec3od1.png?width=2096&format=png&auto=webp&s=c648dcc639f393d7bd8c0035b2f12ae13dd9450e


https://preview.redd.it/tm6b7v6ec3od1.png?width=1852&format=png&auto=webp&s=d5c55c167de093ac98aaf38e376cf7fed1f60f65


https://preview.redd.it/vkrl5u6ec3od1.png?width=2056&format=png&auto=webp&s=1d6513c44251e4d0684e77199a8879d093cab0d9 submitted by /u/cerbero90
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

10 September, 2024

Truncating Production Tables Live On Stage with Verbs (Daniel Coulbourne)

 Programing Coderfunda     September 10, 2024     No comments   

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

error when trying to join many upset plots in only one plot using grid.arrange in r

 Programing Coderfunda     September 10, 2024     No comments   

I'm trying to join many upset plots in only one image in r, I can generate the plots individually but when I use grid.arrange (from gridExtra) to join them like this:
grid.arrange(plot1, plot2)



it gives this error:
Error in gList(...): only 'grobs' allowed in 'gList'



I think this is happening because the plot is an 'upset' class, I tried to transform them into a ggplot using ggplotGrob() but it gives:
Error in UseMethod("ggplot_build"): no applicable method for 'ggplot_build' applied to an object of class upset"
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

pip install itself fails with "No module named 'distutils'"

 Programing Coderfunda     September 10, 2024     No comments   

I use Windows 11 and Python 3.12.5 64-bit, installed from
https://www.python.org/downloads/ />

I'm trying to install requirements from some repo, but this fails:
PS C:\Data\Repos\myrepo> pip install -r .\requirements.txt
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "C:\Users\jonathanb\AppData\Local\Programs\Python\Python312\Scripts\pip.exe\__main__.py", line 4, in
File "C:\Users\jonathanb\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_internal\cli\main.py", line 10, in
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\jonathanb\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_internal\cli\autocompletion.py", line 9, in
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\jonathanb\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_internal\cli\main_parser.py", line 7, in
from pip._internal.cli import cmdoptions
File "C:\Users\jonathanb\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_internal\cli\cmdoptions.py", line 18, in
from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils'



From several questions on this site (best one) I understand distutils was removed in Python 3.12, and if I want to use them I should run pip install setuptools. I tried that, and it failed the same way.


So question: How can I use pip to restore requirements?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

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