31 January, 2024
Laravel Pulse monitor multiple domains
Programing Coderfunda
January 31, 2024
No comments
Is Laravel Pulse able to track multiple domains ? I am running Pulse on a Laravel application and this works nice. Seeing slow queries and exceptions (glad not to many :D ).
However I have multiple Laravel applications, can those application report to a single Pulse installation so that I can see all errors / slow queries etc in a single dashoard ? This gives me a single entry for overviewing issues. Or are there other tools that can archive this.
I know that Sentry etc excists, but as above projects are "hobby" projects, I prefer something free / selfhosted on the server. That's why I like Pulse :) submitted by /u/Noaber
[link] [comments]
30 January, 2024
Laravel + php logo
Programing Coderfunda
January 30, 2024
No comments
[link] [comments]
Unrecognized options while configuring newlib
Programing Coderfunda
January 30, 2024
No comments
$ ../newlib/configure --mno-unaligned-access --enable-newlib-io-
long-long --enable-newlib-io-c99-formats --enable-newlib-reent-check-verify --enable-newlib-register-fini --enable-newlib-retargetable-locking --disable-newlib-supplied-syscalls --disable-nls --target=arm-none-eabi --prefix=/usr/local/test/newlib
configure: error: unrecognized option: --mno-unaligned-access' Try ../newlib/configure --help' for more information.
Looking at the config.log file, I believe the issue is that the target is set to "x86_64-linux-gnu" in the configure script even though the target passed is "arm-none-eabi". "mno-unaligned-access" is not an option for "x86_64-linux-gnu".
configure:2297: checking build system type
configure:2311: result: x86_64-pc-linux-gnu
configure:2358: checking host system type
configure:2371: result: x86_64-pc-linux-gnu
configure:2391: checking target system type
configure:2404: result: arm-none-eabi
configure:2458: checking for a BSD-compatible install
configure:2526: result: /usr/bin/install -c
configure:2537: checking whether ln works
configure:2559: result: yes
configure:2563: checking whether ln -s works
configure:2567: result: yes
configure:2574: checking for a sed that does not truncate output
configure:2638: result: /bin/sed
configure:2647: checking for gawk
configure:2663: found /usr/bin/gawk
configure:2674: result: gawk
configure:4117: checking for gcc
configure:4133: found /usr/bin/gcc
configure:4144: result: gcc
configure:4373: checking for C compiler version
configure:4382: gcc --version >&5
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:4393: $? = 0
configure:4382: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
configure:4393: $? = 0
configure:4382: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:4393: $? = 1
configure:4382: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:4393: $? = 1
configure:4413: checking for C compiler default output file name
configure:4435: gcc -g -O2 -mno-unaligned-access conftest.c >&5
gcc: error: unrecognized command line option '-mno-unaligned-access'
configure:4439: $? = 1
Is there anything I could do to rebuild newlib with the ARM option specified? Do I new to rebuild the GCC toolchain with "arm-none-eabi" specified as the target?
Is this proper semantic html?
Programing Coderfunda
January 30, 2024
No comments
{#each principe.richtlijnen as richtlijn}
Richtlijn {richtlijn.index}
{richtlijn.titel}
{#each richtlijn.succescriteria as succescriterium}
Criteria {succescriterium.index} ({succescriterium.niveau})
{succescriterium.titel}
e.id === succescriterium.id)}
/>
{@html richtlijn.uitleg.html}
{/each}
{/each}
This is the current live link for the component:
https://dry-checklist-vervoerregio.vercel.app/ (It's the only component live because it's a school project).
Can anyone help me make my HTML more semantic?
Dive into the Streamlined Directory Structure in Laravel 11
Programing Coderfunda
January 30, 2024
No comments
We think you’ll love the fresh skeleton you start with in a Laravel 11 app that is coming out next week! Newcomers will appreciate the minimalism, and experienced developers upgrading will not experience breaking changes in how a typical Laravel application is structured.
If you want to follow along and experiment, you can create a Laravel 10 and Laravel 11 project side by side. We used the following commands to do so:
# Update the installer
composer global update laravel/installer -W
cd path/to/projects
# Create a Laravel 10 app
laravel new laravel-10-app -n --git --pest
# Crate a Laravel 11 app
laravel new laravel-11-app --dev -n --git --pest
On the surface, the project directory structure looks identical:
However, if you start diving into the subdirectories, the file count has dropped from a fresh Laravel 11 installation by ~ 69 files:
# Fresh Laravel v10 app
$ find . -type f -not -path "./vendor/*" | wc -l
=> 217
# Fresh Laravel v11 app (as of 01/29/2024)
$ find . -type f -not -path "./vendor/*" | wc -l
=> 148
Let's review the most significant updates and see how they compare to a Laravel 10 application so you can be ready for the changes coming to fresh Laravel 11 apps.
The app Directory
The app directory has been slimmed down tremendously, moving the nine middleware that ships with Laravel into the framework and out of the project. Typically, these middleware are not heavily customized, and Laravel 11 will provide other methods to customize built-in middleware and add your own middleware.
The app directory in a fresh Laravel 11 app
Middleware changes are done through the bootstrap/app.php file, which is, according to Taylor Otwell, a “lean routes-esque style file for configuring Laravel” that looks like the following:
return Application::configure(basePath: dirname(__DIR__))
->withProviders()
->withRouting(
web: __DIR__.'/../routes/web.php',
// api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php',
// channels: __DIR__.'/../routes/channels.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();
You could add an application middleware by adding something like the following in the withMiddeware() closure:
$middleware->web(append: \App\Http\Middleware\ExampleMiddleware::class);
The Kernel.php files are no longer in the Laravel project, and these are handled through the framework bootstrap/app.php file.
You might have also noticed that the Controllers directory only includes one Controller class that doesn’t extend from anything. It’s up to you how you’d like to extend your controllers (or not), but it provides a default abstract Controller class.
The config Directory
The biggest shock for you might be the updated config directory, which has…nothing inside of it (other than the .gitkeep file). You will, however, notice that many more configuration options exist in the .env.example file.
If you want to publish any given configuration file from the framework to customize it, you can do so via the config:publish command:
# config/database.php
php artisan config:publish database
# config/logging.php
php artisan config:publish logging
# Or publish all of them
php artisan config:publish
You are free to only extend the configuration values you care about, and they will be merged with the framework’s defaults so you don’t have to keep all published configuration options in a given file.
Suppose you want to look up configuration values in the framework-shipped configuration. In that case, you can use the Artisan config:showcommand, publish the config, or look it up in the config/logging.php file within the Laravel vendor folder:
php artisan config:show logging
cat vendor/laravel/framework/config/logging.php
The database Directory
The database directory is roughly the same. However, you’ll notice that the migration filenames are prefixed in a way that does not represent a given date but keeps them in order as needed. The create_personal_access_tokens.php migration file is no longer in the project. Personal access tokens are only required if you build an API, which we will cover in the routes directory changes.
Also, the database.sqlite file will be installed by default unless you pick a different database option when creating a new Laravel project.
The routes Directory
The routes directory was also slimmed down only to include the web.php and the console.php routes files. If you want to create an API or use the broadcasting functionality, you can install them via artisan:
php artisan install:api
php artisan install:broadcasting
Those commands will bring in the required migrations, JavaScript, and configuration files. What’s nice about this is that applications that don’t need broadcasting or API routes don’t have to worry about these unnecessary files being in the project.
Laravel 11 routes directory
The test Directory
The test/ directory no longer includes the CreatesApplication trait in Laravel 11 projects. If you upgrade your Laravel 10 project, you can remove this trait, as it’s now provided as part of the base TestCase from the framework.
In a Laravel 10 project, the only thing included in the base TestCase class in Laravel 10 is the CreatesApplication trait, which bootstraps the application when creating a fresh application as part of the setup before each test. You can safely remove this trait (and its usage) once you upgrade existing apps to Laravel 11.
Learn More
If you want to learn more about Laravel 11, check out our Laravel 11 post with all the details on this exciting new release.
The post Dive into the Streamlined Directory Structure in Laravel 11 appeared first on Laravel News.
Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.
Handling Errors with Third-Party APIs
Programing Coderfunda
January 30, 2024
No comments
29 January, 2024
Linker Error: how to work with clang library?
Programing Coderfunda
January 29, 2024
No comments
/usr/bin/ld: cannot find -lLLVMX86AsmPrinter
/usr/bin/ld: cannot find -lLLVMX86Utils
/usr/bin/ld: cannot find -lLLVMipa
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/goodcommit.dir/build.make:97: goodcommit] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/goodcommit.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
here is my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.22)
project(goodcommit)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
set(LLVM_PATH /usr/lib/llvm-14)
link_directories(${LLVM_PATH}/lib)
include_directories(${LLVM_PATH}/include)
add_definitions(
-D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS
)
# Use llvm-config to get compilation flags
execute_process(
COMMAND llvm-config --cxxflags
OUTPUT_VARIABLE LLVM_CXX_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Use llvm-config to get linking flags
execute_process(
COMMAND llvm-config --ldflags
OUTPUT_VARIABLE LLVM_LD_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Set the compilation flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CXX_FLAGS}")
# Set the linking flags
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LLVM_LD_FLAGS}")
set(SOURCE_FILE main.cpp)
add_executable(goodcommit ${SOURCE_FILE})
target_link_libraries(goodcommit
clangFrontend
clangSerialization
clangDriver
clangParse
clangSema
clangAnalysis
clangAST
clangBasic
clangEdit
clangLex
clangTooling
LLVMX86AsmParser
LLVMX86Desc
LLVMX86AsmPrinter
LLVMX86Info
LLVMX86Utils
LLVMipo
LLVMScalarOpts
LLVMInstCombine
LLVMTransformUtils
LLVMipa
LLVMAnalysis
LLVMTarget
LLVMOption
LLVMMCParser
LLVMMC
LLVMObject
LLVMBitReader
LLVMCore
LLVMSupport
-lgit2
)
I have tried following the steps of building llvm project but it doesn't seem to lead anywhere! Plus my header
doesn't seem to be recognized.
Does anyone know how to solve this ?
Return cells that contain numbers with recurring digits
Programing Coderfunda
January 29, 2024
No comments
For example: if a cell contains the number 38,353.03 this would bring "no"
For example: if a cell contains the number 3,404,444 this would bring "yes"
I tried a formula using LOOKUP(SUMPRODUCT(LARGE(FREQUENCY(--MID(
but that was a disaster
so I'm at a loss
Imcremental data import in Power BI Desktop table
Programing Coderfunda
January 29, 2024
No comments
Every day, I need to add (import) 600,000 new rows to this fact table inside Power BI desktop from SQL server data warehouse.
My concern is how can I incrementally import these new data and add it to the already existing one in my Power BI Desktop model.
Simply refresh data will read every day all the 10 million rows which will be time consuming.
I tried to modify the M code of the fact table to get new rows after a specific date but this solution completely erase the already 10 million rows of the fact table in Power BI Desktop.
Below my M code
let
Source = Sql.Database("10.Xx.Xx.Xx", "MY_DB"),
dbo_fact_table = Source{[Schema="dbo",Item="fact_table"]}[Data],
filteredRows = Table.SelectRows(dbo_fact_table, each [date] >= StartDate)
in
filteredRows
How do I fix the health check issue when deploying rails application on Digital Ocean
Programing Coderfunda
January 29, 2024
No comments
The build stage is successful:
But it fails when it gets to the deployment stage and there are no details on this error in the logs.
I tried checking the error logs but instead the server appears to be running.
What i have tried so far:
*
Switched between the scheduled HTTP or TCP under health check in digital ocean.
*
Confirmed if the droplet is live:
Used the rails build pack to create a new application in the droplet:
::: Current build pack::::
Custom Build Command v0.1.2
Procfilev 0.0.4
Ruby: v1.244.3
::::::::::::::::::::::::::::::::
Setup the correct environment variables for the app on the digital ocean console.
RAILS_MASTER_KEY=..correct key ommited deliberately..
RACK_ENV=development
RAILS_ENV=development
RAILS_LOG_TO_STDOUT=enabled
RAILS_SERVE_STATIC_FILES=enabled
SECRET_KEY_BASE=key correct ommited deliberately..
In addition,I am currently on the basic plan which should allow me to deploy a rails application and i also tried setting the app level environment variables but they are were overriden by the env i initially setup when creating a new app.
My setup:
*
Ruby and Rails versions:
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin20]
Rails 7.1.3
*
platform configs in gemfile:
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
group :development, :test do
gem 'debug', platforms: %i[mri mingw x64_mingw]
end (edited)
The App Platform Error Code Reference stipulates that this issue is caused by *
the container not responding to health checks. If a health check is
failing, that means that external traffic is not reaching my service
at the expected HTTP route
*.How do ensure external traffic is reaching my service to resolve this if this is the solution?
Error : Error getting access token for service account: Remote host terminated the handshake, iss
Programing Coderfunda
January 29, 2024
No comments
Java code:
private static String getAccessToken() throws IOException {
String[] SCOPES = {"
https://www.googleapis.com/auth/firebase.messaging"};
/>
GoogleCredentials googleCredentials = GoogleCredentials.fromStream(new FileInputStream("./src/service-account.json")).createScoped(Arrays.asList(SCOPES));
//googleCredentials.refresh();
try {
googleCredentials.getAuthenticationType();
googleCredentials.refreshIfExpired();
} catch (IOException e) {
e.printStackTrace();
}
return googleCredentials.getAccessToken().getTokenValue();
}
Cause: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake.
Detailed Error: Error getting access token for service account: Remote host terminated the handshake, iss: firebase-adminsdk-jnf15@
Are these errors related to jars or certificates? As per Firebase documentation, they did not mentioned anything related to Certificates.your text
Java Snippet code from documentation link :
https://firebase.google.com/docs/cloud-messaging/migrate-v1#use-credentials-to-mint-access-tokens
/>
The getAccessToken() method was shared in Google Firebase API documentation and same was used by uploaded certain jars which are required.
This service supposed to return the Access Token which will be used in subsequent service as Bearer token to send the Notifications to devices in REST API call. But this service is not working as expected and returning error.
08 January, 2024
Synchronised Environment Variables
Programing Coderfunda
January 08, 2024
No comments
I've been thinking of a way to cndtaliswd my environment variables and keep it synchronised across all the servers because I've been doing a lot of updates recently and it's very likely to miss one or two servers.
Is this a problem anyone has faced before and how did you go around it? submitted by /u/_1017e_
[link] [comments]
Laravel Pulse cards to show response times, scheduled jobs, broken links
Programing Coderfunda
January 08, 2024
No comments
The current state of Laravel Herd
Programing Coderfunda
January 08, 2024
No comments
i've been looking for something like WAMP on MacOS and it seems Herd is the closest one.
However the fact that it's:
* Not open source ( Developer tools are mostly open source, devs like to know that the software running on their machines is validated by the community. Also it can easily be forked when the need arises )
* No clear monetization strategy ( I assume it not being open source means there are plans to monetize it in the future but this has not been communicated)
* Hasn't been updated in 3 months
* No clear roadmap
For the reasons above, I'm skeptical about the longevity of the project. submitted by /u/MobyFreak
[link] [comments]
07 January, 2024
How to comprehensively evaluate the performance of an arm CPU?
Programing Coderfunda
January 07, 2024
No comments
* Capabilities at the microarchitecture level, such as integer computing capability, floating-point computing capability, etc.
* Higher level capabilities, such as memory access latency, memory bandwidth limits, frequency fluctuations, etc.
* Actual operation situation, typical benchmark operation of computationally intensive or memory intensive workload
I wonder if there are sound and authoritative test suites, workloads, or methodologies for these three aspects?
Force number to text in R
Programing Coderfunda
January 07, 2024
No comments
variable_x = '"' + 5 + '"'
How do I do this in R? I tried as.character. But when I write out the data, the quote is missing.
Weekly /r/Laravel Help Thread
Programing Coderfunda
January 07, 2024
No comments
* 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]
Flutter-When i am changing value in respiratoryRate case and there i applied a setState after that i want to rebuild 'issue' case
Programing Coderfunda
January 07, 2024
No comments
switch (cardioVascularWidget.key) {
case 'respiratoryRate':
VitalComponent? respiratoryRate = widget
.cardiovascularFormModel?.cardiovascularAssessment?.respiratoryRate;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomInputTextFormField(
titleText: respiratoryRate?.title ?? "",
hintText: respiratoryRate?.hintText ?? "",
trailingInputUnitText: respiratoryRate?.suffixValue ?? "",
isTitleRequired: true,
isTitleMandatory: true,
onEnteredValue: (value) {
setState(() {
_respiratoryRate = value;
});
},
),
],
);
case 'issue':
Issue? issue =
widget.cardiovascularFormModel?.cardiovascularAssessment?.issue;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TitleMandatoryWidget(isMandatory: false, title: '${issue?.title}'),
Text('$_respiratoryRate'),
],
);
}
In the switch case, you can see there I have a case 'respiratoryRate' in which have CustomInputTextFormField it return value inside onValueChange then i apply a
setState(() { _respiratoryRate = value ; });
and other switch case is 'issue' is there, i want to rebuild issues case
Anyone please help me
Filtering Pivot Field using VBScript
Programing Coderfunda
January 07, 2024
No comments
enter image description here
I tried below code but it gives that error;
enter image description here
Code;
Dim oExcel
Dim myPivotField
Dim PvtItm
Function CnvTr(str)
str = Replace(str, "İ", ChrW(304))
str = Replace(str, "ı", ChrW(305))
str = Replace(str, "Ç", ChrW(199))
str = Replace(str, "ç", ChrW(231))
str = Replace(str, "Äž", ChrW(286))
str = Replace(str, "ÄŸ", ChrW(287))
str = Replace(str, "Ö", ChrW(214))
str = Replace(str, "ö", ChrW(246))
str = Replace(str, "Åž", ChrW(350))
str = Replace(str, "ÅŸ", ChrW(351))
str = Replace(str, "Ü", ChrW(220))
str = Replace(str, "ü", ChrW(252))
CnvTr = str
End Function
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
oExcel.DisplayAlerts = False
oExcel.AskToUpdateLinks = False
oExcel.AlertBeforeOverwriting = False
Set oWorkbook = oExcel.Workbooks.Open("C:\\RobustaDocs\\OdemeListesi.xlsx")
Set myPivotField = oWorkbook.WorkSheets(2).PivotTables("PivotTable1").PivotFields(CnvTr("\[Workbook\].\[Ödeme_Tarihi\]"))
oWorkbook.RefreshAll
myPivotField.ClearAllFilters
myPivotField.VisibleItemsList = Array(CnvTr("\[Workbook\].\[Ödeme_Tarihi\].&\[5.01.2024\]"))
Set myPivotField = Nothing
Set PvtItm = Nothing
06 January, 2024
Access denied error using move-item to recursively move folders containing files with specific text
Programing Coderfunda
January 06, 2024
No comments
I have a folder tree with a root1\yyyy\mm\dd\hh\uniqueid structure and need to move the uniqueid sub folders into a root2\yyyy\mm\dd\hh tree based on content within a specific json file in each uniqueid folder
After several searches I've arrived at the code below which is correctly identifying the folders I need to move, and creating the root2\yyyy\mm\dd\hh folders to hold the moved uniqueid folders, but it gives an access denied error trying to execute the move cmdlet
$root1 = My-Current-Root-Folder
$root2 = My-New-Root-Folder
(Get-ChildItem -Literalpath $root1 -Recurse -Filter *.json) | Select-String -Pattern content-I-am-looking-for | ForEach-Object {
$folderToMove = (Split-Path -Parent $_.Path)
$destinationFolder = $folderToMove.Substring(0, $folderToMove.Length - 33).Replace($root1 , $root2)
write-host $folderToMove #This correctly displays the source folders I need to move
write-host $destinationFolder #This correctly displays the root2 folder structure to hold the moved folders
If(!(Test-Path $destinationFolder)){
New-Item -Path $destinationFolder -ItemType "directory" #This correctly created the root2 folders for the move
}
move-item -path $folderToMove -destination $destinationFolder -Force
}
The error is like this:
move-item : Access to the path '$root1\2023\10\19\01\uniqueid' is denied.
But if I execute a move-item command explicitly specifying one of the uniqueid folders and the associated root2\yyyy\mm\dd\hh destination, the folder is moved without any issue.
All advice greatly appreciated
Tried wrapping the source and destination in double quotes in case that was needed and also specifying [string] on the source and destinations, but that just gives a different error (cannot find a drive F)
Triangular linear system with triangular right hand side in python
Programing Coderfunda
January 06, 2024
No comments
I was considering looping over the columns,
n=A.shape[0]
X=zeros((n,n))
for i in range(n):
X[:i+1,i]=solve_triangular(A[:i+1,:i+1],B[:i+1,i])
But this does not use fast matrix-matrix operations.
I could also do all right hand sides simultaneously, X=solve_triangular(A,B), but this does not take into account the triangular structure in B.
Finally, I could invert A and multiply with B, X=inv(A)@B, but inverting matrices is usually discouraged from.
Laravel Wallet
Programing Coderfunda
January 06, 2024
No comments
I recently completed the documentation for my Laravel Wallet package and would like to receive feedback on the implementation, if you would be so kind :)
The main objective of this package is to provide a reliable and convenient mechanism for transactions and balances.
Github | Documention
submitted by /u/GiveMeYourSmile
[link] [comments]
Z-Function. String algorithms. Optimize for large strings
Programing Coderfunda
January 06, 2024
No comments
Given a string s. For each i from 1 to |s|, find the number of occurrences of its prefix of length i in the string.
Input:
The first line of input contains an integer q (1≤q≤10^5) — the number of datasets in the test.
Each dataset consists of a string s. The length of the string s is from 1 to 10^6 characters. The string consists exclusively of lowercase Latin alphabet letters.
The sum of the lengths of strings s across all q datasets in the test does not exceed 10^6.
Output:
For each dataset, output |s| integers c1, c2, ..., c|s|, where c[i] is the number of occurrences of the prefix of length i in the string s.
Example
Input:
5
abacaba
eeeee
abcdef
ababababa
kekkekkek
Output:
4 2 2 1 1 1 1
5 4 3 2 1
1 1 1 1 1 1
5 4 4 3 3 2 2 1 1
6 3 3 2 2 2 1 1 1
The task must be solved exclusively using the Z-function, and the total time for a string of length 10^6 characters should not exceed 2 seconds.
My solution looks like this:
#include
#include
#include
std::vector ZFunc(const std::string& s) {
const int sz = s.size();
std::vector z(sz, 0);
for (int i = 1, l = 0, r = 0; i != sz; ++i) {
if (r >= i)
z[i] = std::min(z[i - l], r - i + 1);
while (z[i] + i < sz && s[i + z[i]] == s[z[i]])
z[i]++;
if (z[i] > r - i + 1) {
l = i;
r = i + z[i] - 1;
}
}
return z;
}
int main() {
int n;
std::cin >> n;
std::vector res(n);
for (int k = 0; k != n; ++k) {
std::string s;
std::cin >> s;
res[k].resize(s.size(), 1);
std::vector z = ZFunc(s);
for (int i = 1; i != z.size(); ++i) {
while (z[i]--)
res[k][z[i]]++;
}
}
for (const auto& ivec : res) {
for (int i : ivec)
std::cout
I have a _ctx.product is undefined
Programing Coderfunda
January 06, 2024
No comments
When I try to create a [productId].vue file I get an error _ctx.product is undefined I don't understand why. Thanks for your help
What I tried
ProductList.vue
Filtrer par catégorie
Voir tout
{{ category }}
*
{{ product.category }}
View details for {{ product.title }}
{{ product.title }}
{{ product.price }}
export default {
data() {
return {
selectedCategory: "", // Ajoutez cette propriété
products: [
{ id: 1, title: 'Candy Land', price: '120€ / jour - 180€ / 2 jours', description: 'loremipsum set', image: 'candy.jpg', category: 'Chateaux Gonflables' },
{ id: 2, title: 'Château Fort', price: '100€ / jour - 160€ / 2 jours', description: 'lorem ipsum set', image: 'chateau_fort.jpg', category: 'Chateaux Gonflables' },
],
...
},
...
[productId].vue
{{ product.title }}
{{ product.description }}
export default {
async asyncData({ params }) {
const productId = parseInt(params.productId);
const product = products.find((p) => p.id === productId);
return { product };
},
};
05 January, 2024
I'm getting an unexpected Tensorflow ResourceExhaustedError when I try to use model.predict() with a Keras Sequential model
Programing Coderfunda
January 05, 2024
No comments
I'm training using an NVIDIA GeForce RTX 2070 SUPER with 8Gb of VRAM, and I have 64 Gb of RAM on my PC.
I've used Keras to create a Sequential model to predict POS-tags. I've used the same model format to train models for text in several different languages. The models all trained alright, and when I run model.evaluate(test_data) they all produce a score. Similarly, when I run model.predict(test_data) most models produce the expected results, but there is one model, for one language, which acts differently.
This one model was trained the same as all the other models, so there should be no difference I think. When I run model.predict(test_data) using this model, at first it seems to be working. It starts applying the model to the dataset:
6/152 [=>............................] - ETA: 19s
It even appears to successfully complete this step, though it never gets as far as producing any results:
152/152 [==============================] - 20s 126ms/step
Unfortunately at this point it hangs and produces the following traceback:
2024-01-05 23:08:38.977923: W tensorflow/core/common_runtime/bfc_allocator.cc:479] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.61GiB (rounded to 2804106240)requested by op ConcatV2
If the cause is memory fragmentation maybe the environment variable 'TF_GPU_ALLOCATOR=cuda_malloc_async' will improve the situation.
Current allocation summary follows.
...
...
...
2024-01-05 23:08:38.998922: I tensorflow/core/common_runtime/bfc_allocator.cc:1101] Sum Total of in-use chunks: 4.04GiB
2024-01-05 23:08:38.998977: I tensorflow/core/common_runtime/bfc_allocator.cc:1103] total_region_allocated_bytes_: 6263144448 memory_limit_: 6263144448 available bytes: 0 curr_region_allocation_bytes_: 8589934592
2024-01-05 23:08:38.999071: I tensorflow/core/common_runtime/bfc_allocator.cc:1109] Stats:
Limit: 6263144448
InUse: 4335309312
MaxInUse: 4520417536
NumAllocs: 1293
MaxAllocSize: 536870912
Reserved: 0
PeakReserved: 0
LargestFreeBlock: 0
2024-01-05 23:08:38.999241: W tensorflow/core/common_runtime/bfc_allocator.cc:491] ****************x*****************************************************______________________________
2024-01-05 23:08:38.999336: W tensorflow/core/framework/op_kernel.cc:1780] OP_REQUIRES failed at concat_op.cc:158 : RESOURCE_EXHAUSTED: OOM when allocating tensor with shape[38688,18120] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
Traceback (most recent call last):
File "C:\Users\admd9\PycharmProjects\codalab-sigtyp2024\generate_results.py", line 131, in
predictions = task_model.predict(test_gen)
File "C:\Users\admd9\anaconda3\envs\tf_codalab_sharedtask\lib\site-packages\keras\utils\traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\admd9\anaconda3\envs\tf_codalab_sharedtask\lib\site-packages\tensorflow\python\framework\ops.py", line 7209, in raise_from_not_ok_status
raise core._status_to_exception(e) from None # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.ResourceExhaustedError: {{function_node __wrapped__ConcatV2_N_152_device_/job:localhost/replica:0/task:0/device:GPU:0}} OOM when allocating tensor with shape[38688,18120] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc [Op:ConcatV2] name: concat
I can't work out why it's only happening with this one model, or why there would be a problem with memory allocation when it works for all the other models. It doesn't seem like it's trying to use a lot of memory either. So why am I getting this error message? And, how can I fix it?
I've tried setting memory growth, but it didn't work:
physical_devices = tf.config.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(physical_devices[0], True)
I've also reduced batch sizes. This didn't help. I've even gone back and retrained the model in case there was something wrong with the model itself. Still have the same problem with the new model. As a last option, I tried splitting the test set into smaller divisions, running model.predict(test_data) on each of these divisions, then recombining the results of each division. It sometimes successfully predicts the first division, but always runs out of memory and gives me the same error by the second division.
Is there anything I can do?
Get parameters for currently running queries in PostgreSQL
Programing Coderfunda
January 05, 2024
No comments
The problem is: We dont know the parameters which were given to the query. We can only see the placeholders $1, $2, etc.
Is there any way to get the parameters for a currently running query?
The only workaround could be to enable the query log and parse the parameters from the query log, but this would be a very dirty and slow solution.
Alpine adds a new build to work with Content Security Policies
Programing Coderfunda
January 05, 2024
No comments
Caleb Porzio announced that Alpine.js now has a CSP build that will with environments where CSP is required:
In order for Alpine to be able to execute plain strings from HTML attributes as JavaScript expressions, for example x-on:click="console.log()", it needs to rely on utilities that violate the "unsafe-eval" Content Security Policy that some applications may enforce for security purposes.
In order to accommodate environments where this CSP is necessary, Alpine offer's an alternate build that doesn't violate "unsafe-eval", but has a more restrictive syntax.
One thing to note with this new build is you must Alpine.data:
Since Alpine can no longer interpret strings as plain JavaScript, it has to parse and construct JavaScript functions from them manually.
Due to this limitation, you must use Alpine.data to register your x-data objects, and must reference properties and methods from it by key only.
This new build is available as a CDN or an npm install @alpinejs/csp
See the official documentation for complete details and for detailed instructions.
Note: When asked about Livewire support, Caleb says, "Not yet unfortunately because there is one or two places Livewire relies on eval (wire:click="something('one', 'two')") kinda thing"
The post Alpine adds a new build to work with Content Security Policies appeared first on Laravel News.
Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.
Integrating Cloudflare R2 with Laravel
Programing Coderfunda
January 05, 2024
No comments
We swapped out AWS S3 for Cloudflare R2 in our Laravel app – the bandwidth costs were getting steep.
We've put together a thorough blog post about it, so go ahead and check it out.
Hit me up if you've got any questions!
https://www.luckymedia.dev/blog/integrating-cloudflare-r2-storage-with-laravel submitted by /u/lmusliu
[link] [comments]
Localhost for Mail server?
Programing Coderfunda
January 05, 2024
No comments
[link] [comments]



