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

31 October, 2023

CUDA Compute SM Throughput improvement for multiple loops

 Programing Coderfunda     October 31, 2023     No comments   

I'm interested in exploring different approaches to enhance the Compute (SM) Throughput of a CUDA code. It would be great to discuss with individuals having a good understanding of CUDA optimizations. To ensure a fruitful exchange and better comprehension, I kindly request that you also share code or algorithm snippets. If you are not familiar with CUDA optimizations, please feel free to disregard this request. Thank you!


First, let me describe the serial code. In the C code provided below, within both the first and second loops, we calculate 655 by 655 independent determinants. We then utilize weighted contributions to perform a summation over the second loop. The determinants are computed using LU decomposition. Ultimately, the objective is to compute the weighted contributions of these determinants.
I want to know which parallelization implementation would be better. That is, if there are multiple for loops, which loop should I consider for block and thread computation for time efficiency?


I have provided the details of these loops in the code below.
read_index(ind, ind_u, ind_d); // generates index for qc, det_store used later
int U=6;

for (it = 1; it < 64; it++) { // first loop, can be serial run
double sum1 = 0.0;
double sum2 = 0.0;

for (ii = 0; ii < 24*24*24; ii++) { // second loop, can be made parallel in blocks; values 24^3, 32^3, 48^3, 96^3}

read_qc(qc); // generates 4D qc array, different with each ii; size 3 * 3 * 4 * 4

int al[U], a[U], ap[U], alp[U]; // U=6
double _Complex A[U][U],AL[U][U],AU[U][U];
double _Complex det_store[655][655];

// every 655*655 has a A[6][6]
// det store [655][655]

int i,j,k,l;
for (i = 0; i < 655; i++) { //idx parallelize no dependency on above

for (k = 0; k < U; k++) { // al[k=U=6][i=655]
al[k] = ind[i][k]; //
a[k] = ind[i][k + U];
}

for (j = 0; j < 655; j++) { //jdx

for (k = 0; k < U; k++) {
alp[k] = ind[j][k];
ap[k] = ind[j][k + U];
}

for (k = 0; k < U; k++) {
for (l = 0; l < U; l++) {
A[k][l] = qc[a[k]][al[k]][ap[l]][alp[l]]; //Assigning the matrix element
}
}

Calculating the determinant using LU decomposition and storing them
LU_Decomposition(A, AL, AU);
det_store[i][j] = calculate_determinant(AU);
}
}

double _Complex temp;
//Uses above compute det
//
for (i = 0; i < 2716; i++) { //
for (j = 0; j < 2716; j++) { //
temp = weight[i]
* weight[j]
* det_store[ind_u[i]][ind_u[j]]
* det_store[ind_d[i]][ind_d[j]]; //combining the stored determinants using info from comb_he4.txt files
sum1 = sum1 + creal(temp);
sum2 = sum2 + cimag(temp);
}
}

}
printf("%d\t%.16E\t%.16E\n", it, sum1, sum2);
}



I am exploring various ideas and code snippets for an efficient implementation with minimal time stamp. If you can suggest improvements to LU_Decomposition functions with some CUDA libraries, that would also be helpful. Here is the LU_Decomposition function
void LU_Decomposition(double _Complex A[U][U], double _Complex L[U][U], double _Complex Up[U][U]) {
for (int i = 0; i < U; i++) {
// Upper Triangular Matrix
for (int k = i; k < U; k++) {
double _Complex sum = 0;
for (int j = 0; j < i; j++) {
sum += (L[i][j] * Up[j][k]);
}
Up[i][k] = A[i][k] - sum;
}

// Lower Triangular Matrix
for (int k = i; k < U; k++) {
if (i == k) {
L[i][i] = 1; // The diagonal elements of L are 1
} else {
double _Complex sum = 0;
for (int j = 0; j < i; j++) {
sum += (L[k][j] * Up[j][i]);
}
L[k][i] = (A[k][i] - sum) / Up[i][i];
}
}
}
}



I have parallelized the code mentioned above using CUDA by implementing a global kernel called gpu_sum. This kernel stores the reduced sum values for each iteration of the second loop, as described in the preceding C code. Below is the CUDA kernel
__global__ void gpu_sum(cuDoubleComplex *d_tqprop,
cuDoubleComplex *d_sum_nxyz,
int *d_deg_ind_up, int *d_deg_ind_down, float *d_deg_ind_weight,
int *d_ind, cuDoubleComplex *d_xdet){

int tid = threadIdx.x;
// int bid = blockIdx.x;
int gid = blockIdx.x;// * blockDim.x + threadIdx.x;

cuDoubleComplex sumA, temp_sumA, temp_sum;
cuDoubleComplex x1, x2, x3;

x3 = make_cuDoubleComplex(0.0,0.0);
temp_sum = make_cuDoubleComplex(0.0,0.0);
temp_sumA = make_cuDoubleComplex(0.0,0.0);

int start = 0;
int tx, k;
// int a[UP];
// int al[UP];

cuDoubleComplex d_A[UP*UP], d_UA[UP*UP], d_LA[UP*UP];
cuDoubleComplex detA;

curandState state;
curand_init(clock64(), tid, 0, &state);

__shared__ double sh_sum_re[SHMEM_SIZE];
__shared__ double sh_sum_im[SHMEM_SIZE];

int min_tx_det = (tid) * LOOP_DET_COUNT;
int max_tx_det = (tid + 1) * LOOP_DET_COUNT;

// int ap[UP];
// int alp[UP];
int alp[CHI_COUNT][DET_COUNT];
// int ap[UP][DET_COUNT];

for (int loopj = 0; loopj < DET_COUNT; loopj++) {
for (int i = 0; i < CHI_COUNT; i++) {
// ap[i][loopj] = d_ind[loopj * CHI_COUNT + i + UP];
alp[i][loopj] = d_ind[loopj * CHI_COUNT + i];
}
}

int index_det = 0;

for (tx = min_tx_det; tx < max_tx_det; tx++) {

if(tx < DET_COUNT){

// for (int i = 0; i < UP; i++) {
// a[i] = d_ind[tx * CHI_COUNT + i + UP];
// al[i] = d_ind[tx * CHI_COUNT + i ];
// }

for (int loopj = 0; loopj < DET_COUNT; loopj++) {

// for (int i = 0; i < UP; i++) {
// ap[i] = d_ind[loopj * CHI_COUNT + i + UP];
// alp[i] = d_ind[loopj * CHI_COUNT + i ];
// }

for (int i = 0; i < UP; i++) {
for (int j = 0; j < UP; j++) {

index_det = d_ind[tx * CHI_COUNT + i + UP] * DCD
+ d_ind[tx * CHI_COUNT + i] * CD
+ d_ind[loopj * CHI_COUNT + j + UP] * DDIM
+ d_ind[loopj * CHI_COUNT + j];

// index_det = alp[i+UP][tx]*DCD + alp[i][tx]*CD + alp[j+UP][loopj]*DDIM + alp[j][loopj];
// d_A[i*UP + j] = d_tqprop[gid * CDCD + a[i]*DCD + al[i]*CD + ap[j]*DDIM + alp[j]];
d_A[i*UP + j] = d_tqprop[gid * CDCD + index_det];
// d_A[i*UP + j] = d_tqprop[gid * CDCD + a[i]*DCD + al[i]*CD + ap[j][loopj]*DDIM + alp[j][loopj]];
// d_A[i*UP + j] = d_tqprop[gid * CDCD + alp[i+UP][tx]*DCD + alp[i][tx]*CD + alp[j+UP][loopj]*DDIM + alp[j][loopj]];
}
}

dev_LUD(d_A, d_LA, d_UA);
d_xdet[gid * DET_COUNT * DET_COUNT + tx * DET_COUNT + loopj] = dev_DET_LUD(d_UA);
}
}
}

__syncthreads();

int min_tx_sum = (tid) * LOOP_COUNT_DEG_INDEX;
int max_tx_sum = (tid + 1) * LOOP_COUNT_DEG_INDEX;

if (min_tx_sum < DEG_INDEX_COUNT) {

if (max_tx_sum > DEG_INDEX_COUNT) {
max_tx_sum = DEG_INDEX_COUNT;
}
for (tx = min_tx_sum; tx < max_tx_sum; tx++) {
if (tx >= DEG_INDEX_COUNT) {break;}

for (int loopj = 0; loopj < DEG_INDEX_COUNT; loopj++) {
x1 = d_xdet[gid * DET_COUNT * DET_COUNT + d_deg_ind_up[tx] * DET_COUNT + d_deg_ind_up[loopj]] *
d_xdet[gid * DET_COUNT * DET_COUNT + d_deg_ind_down[tx] * DET_COUNT + d_deg_ind_down[loopj]];
temp_sum = x1 * make_cuDoubleComplex(d_deg_ind_weight[tx] * d_deg_ind_weight[loopj], 0.0) + temp_sum;
}
}
}

// if (gid == 0) {
// printf("temp_sum:%d\t %d\t %f \t %f\n", gid, tid, cuCreal(temp_sum), cuCimag(temp_sum));
// }

sh_sum_re[tid] = cuCreal(temp_sum);
sh_sum_im[tid] = cuCimag(temp_sum);
__syncthreads();

// Perform block reduction in shared memory
for (int s = blockDim.x / 2; s > 0; s >>= 1) {
if (tid < s) {
sh_sum_re[tid] += sh_sum_re[tid + s];
sh_sum_im[tid] += sh_sum_im[tid + s];
}
__syncthreads();
}

if (tid == 0) {
d_sum_nxyz[gid] = make_cuDoubleComplex(sh_sum_re[tid], sh_sum_im[tid]);
}

}



Here are some nsight-compute profiling results:
----------------------- ------------- ------------
Metric Name Metric Unit Metric Value
----------------------- ------------- ------------
DRAM Frequency cycle/nsecond 9.27
SM Frequency cycle/nsecond 1.44
Elapsed Cycles cycle 122692065
Memory Throughput % 27.62
DRAM Throughput % 27.62
Duration msecond 85.00
L1/TEX Cache Throughput % 23.78
L2 Cache Throughput % 21.30
SM Active Cycles cycle 113862083.87
Compute (SM) Throughput % 7.37
----------------------- ------------- ------------

WRN This kernel grid is too small to fill the available resources on this device, resulting in only 0.1 full
waves across all SMs. Look at Launch Statistics for more details.



My grid consists of 64 blocks, with each block containing 64 threads. However, when I increase the grid size, both the compute streaming multiprocessor (SM) throughput decreases and the time taken increases.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

30 October, 2023

Is there a way to use awk to count the number of rows between 2 flags and input that number into a specific field?

 Programing Coderfunda     October 30, 2023     No comments   

I have a set of data that consists of seismic wave travel times and their corresponding information (i.e. source that produced the wave and the time for that wave arriving at each geophone along the spread). I am trying to format the data to fit my code in order to do some tomography using the data, but I'm still relatively new to awk. I am at a point where I need to now insert the number of receivers for each shot/source into the line of shot/source information, but its a variable amount each time. Is there a way to have awk count the number of rows and insert that into the proper field?


My data is formatted like the following.


Each line that documents a source/shot:


s 0.01 0 0 -1 0


Every other line that follows the source/shot information:
r 0.1 0 0 1.218 0.01
r 0.15 0 0 1.214 0.01
r 0.2 0 0 1.213 0.01




I can use the "s" as a flag for the shot lines, and I would like to count the number of "r" lines for each source/shot and insert that number into the corresponding "s" line.


The number of "r" lines for each "s" line varies greatly.


Given this sample input:
s 0.01 0 0 -1 0
r 0.1 0 0 1.218 0.01
r 0.15 0 0 1.214 0.01
r 0.2 0 0 1.213 0.01
s 1.01 0 0 -1 0
r 0.05 0 0 1.159 0.01
r 0.1 0 0 1.127 0.01
r 0.15 0 0 1.106 0.01
r 0.2 0 0 1.115 0.01
r 0.25 0 0 1.107 0.01



The expected output is:
s 0.01 0 3 -1 0
r 0.1 0 0 1.218 0.01
r 0.15 0 0 1.214 0.01
r 0.2 0 0 1.213 0.01
s 1.01 0 5 -1 0
r 0.05 0 0 1.159 0.01
r 0.1 0 0 1.127 0.01
r 0.15 0 0 1.106 0.01
r 0.2 0 0 1.115 0.01
r 0.25 0 0 1.107 0.01



Note the 3 as $4 in the first s line and the 5 as $4 in the second one.


The counted number of rows should be in the 4th column of each "s" line (asterisks here).


My experience with awk is limited to just rearranging/indexing columns, so I don't really know where to begin with this. I've tried googling help with awk, but it's very difficult to find answered awk questions that actually pertain to my specific situation (hence why I have decided to ask it myself).


I'm also new to using stackoverflow, so if I need to include more example data, please let me know. My data consists of approximately 4000 lines.


EDIT: The reason the desired result has slightly different data to the example of my data is because there are hundreds of lines for each "s" line and including that in the question seems excessive. I have cut out the majority of the data for ease of reading.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

29 October, 2023

I am new in springboot, i am getting error while working on sts

 Programing Coderfunda     October 29, 2023     No comments   

I am using Jpa repository in the code, and my code looks like this.


com.example.demo ->
package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;

@SpringBootApplication
@EntityScan("com.example.demo.model")
public class DemoApplication {

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}

}



com.example.demo.controller ->
package com.example.demo.controller;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.model.Employee;
import com.example.demo.service.EmployeeService;
//@Controller
@RestController //@controller+@ResponseBody
public class EmployeeController {
@Autowired
private EmployeeService eService;
// @RequestMapping(value = "/employees",method = RequestMethod.GET)
// @ResponseBody
@GetMapping("/employees")
public List getEmployees() {
return eService.getEmployees();
}
@GetMapping("/employee/{id}")
public String getEmployee(@PathVariable Long id) {
return "Details for: "+id;
}
@PostMapping("/employees")
public String saveEmployee(@RequestBody Employee employee) {
return "Saving employee details to the db "+ employee;
}
@PutMapping("/employee/{id}")
public Employee updateemployee(@PathVariable Long id, @RequestBody Employee employee) {
System.out.print("Update details for"+id);
return employee;
}
@DeleteMapping ("/employee")
public String deleteEmployee(@RequestParam Long id) {
return "Details for: "+id;
}
}



com.example.demo.model ->
package com.example.demo.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="tbl_employee")
public class Employee {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="id")
private Long id;

@Column(name="name")
private String name;

@Column(name="age")
private Long age;

@Column(name="location")
private String location;

@Column(name="email")
private String email;

@Column(name="department")
private String department;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getAge() {
return age;
}
public void setAge(Long age) {
this.age = age;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String toString() {
return "Employee [name=" + name + ", age=" + age + ", location=" + location + ", email=" + email
+ ", department=" + department + "]";
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
}



com.example.demo.repository ->package com.example.demo.repository;
import org.springframework.data.jpa.repository.JpaRepository;

import org.springframework.stereotype.Repository;

import com.example.demo.model.Employee;

*@Repository*

public interface EmployeeRepository extends JpaRepository\ {

}



com.example.demo.service ->enter image description here(interface) enter image description here(Implementation)


pom file ->


4.0.0

org.springframework.boot
spring-boot-starter-parent
3.1.5


com.example
demo
0.0.1-SNAPSHOT
demo
Demo project for Spring Boot

17



org.springframework.boot
spring-boot-starter-web



org.springframework.boot
spring-boot-starter-test
test


org.springframework.boot
spring-boot-starter


org.springframework.boot
spring-boot-devtools
runtime
true



org.springframework.boot
spring-boot-starter-data-jpa



com.mysql
mysql-connector-j
runtime


javax.persistence
javax.persistence-api
2.2






org.springframework.boot
spring-boot-maven-plugin








Here I am just trying to return an empty list via(@GetMapping("/employees")) but it is showing error like below
[2m2023-10-29T12:19:17.956+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.example.demo.DemoApplication [0;39m [2m:[0;39m Starting DemoApplication using Java 17.0.8.1 with PID 5216 (C:\Users\parit\Documents\demo\target\classes started by parit in C:\Users\parit\Documents\demo)
[2m2023-10-29T12:19:17.959+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.example.demo.DemoApplication [0;39m [2m:[0;39m No active profile set, falling back to 1 default profile: "default"
[2m2023-10-29T12:19:18.003+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36m.e.DevToolsPropertyDefaultsPostProcessor[0;39m [2m:[0;39m Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
[2m2023-10-29T12:19:18.003+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36m.e.DevToolsPropertyDefaultsPostProcessor[0;39m [2m:[0;39m For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
[2m2023-10-29T12:19:18.732+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36m.s.d.r.c.RepositoryConfigurationDelegate[0;39m [2m:[0;39m Bootstrapping Spring Data JPA repositories in DEFAULT mode.
[2m2023-10-29T12:19:18.785+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36m.s.d.r.c.RepositoryConfigurationDelegate[0;39m [2m:[0;39m Finished Spring Data repository scanning in 44 ms. Found 1 JPA repository interfaces.
[2m2023-10-29T12:19:20.254+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.s.b.w.embedded.tomcat.TomcatWebServer [0;39m [2m:[0;39m Tomcat initialized with port(s): 8080 (http)
[2m2023-10-29T12:19:20.264+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.apache.catalina.core.StandardService [0;39m [2m:[0;39m Starting service [Tomcat]
[2m2023-10-29T12:19:20.264+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.apache.catalina.core.StandardEngine [0;39m [2m:[0;39m Starting Servlet engine: [Apache Tomcat/10.1.15]
[2m2023-10-29T12:19:20.339+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.a.c.c.C.[Tomcat].[localhost].[/] [0;39m [2m:[0;39m Initializing Spring embedded WebApplicationContext
[2m2023-10-29T12:19:20.340+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mw.s.c.ServletWebServerApplicationContext[0;39m [2m:[0;39m Root WebApplicationContext: initialization completed in 2337 ms
[2m2023-10-29T12:19:20.452+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.zaxxer.hikari.HikariDataSource [0;39m [2m:[0;39m HikariPool-1 - Starting...
[2m2023-10-29T12:19:20.756+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.zaxxer.hikari.pool.HikariPool [0;39m [2m:[0;39m HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@36041206
[2m2023-10-29T12:19:20.758+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.zaxxer.hikari.HikariDataSource [0;39m [2m:[0;39m HikariPool-1 - Start completed.
[2m2023-10-29T12:19:20.803+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.hibernate.jpa.internal.util.LogHelper [0;39m [2m:[0;39m HHH000204: Processing PersistenceUnitInfo [name: default]
[2m2023-10-29T12:19:20.895+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36morg.hibernate.Version [0;39m [2m:[0;39m HHH000412: Hibernate ORM core version 6.2.13.Final
[2m2023-10-29T12:19:20.898+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36morg.hibernate.cfg.Environment [0;39m [2m:[0;39m HHH000406: Using bytecode reflection optimizer
[2m2023-10-29T12:19:21.277+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.s.o.j.p.SpringPersistenceUnitInfo [0;39m [2m:[0;39m No LoadTimeWeaver setup: ignoring JPA class transformer
[2m2023-10-29T12:19:21.659+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.h.e.t.j.p.i.JtaPlatformInitiator [0;39m [2m:[0;39m HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
[2m2023-10-29T12:19:21.665+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mj.LocalContainerEntityManagerFactoryBean[0;39m [2m:[0;39m Initialized JPA EntityManagerFactory for persistence unit 'default'
[2m2023-10-29T12:19:21.792+05:30[0;39m [33m WARN[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mConfigServletWebServerApplicationContext[0;39m [2m:[0;39m Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'employeeController': Unsatisfied dependency expressed through field 'eService': Error creating bean with name 'employeeServiceImpl': Unsatisfied dependency expressed through field 'eRepository': Error creating bean with name 'employeeRepository' defined in com.example.demo.repository.EmployeeRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class com.example.demo.model.Employee
[2m2023-10-29T12:19:21.793+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mj.LocalContainerEntityManagerFactoryBean[0;39m [2m:[0;39m Closing JPA EntityManagerFactory for persistence unit 'default'
[2m2023-10-29T12:19:21.796+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.zaxxer.hikari.HikariDataSource [0;39m [2m:[0;39m HikariPool-1 - Shutdown initiated...
[2m2023-10-29T12:19:21.804+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.zaxxer.hikari.HikariDataSource [0;39m [2m:[0;39m HikariPool-1 - Shutdown completed.
[2m2023-10-29T12:19:21.805+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.apache.catalina.core.StandardService [0;39m [2m:[0;39m Stopping service [Tomcat]
[2m2023-10-29T12:19:21.816+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36m.s.b.a.l.ConditionEvaluationReportLogger[0;39m [2m:[0;39m

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
[2m2023-10-29T12:19:21.834+05:30[0;39m [31mERROR[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.s.boot.SpringApplication [0;39m [2m:[0;39m Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'employeeController': Unsatisfied dependency expressed through field 'eService': Error creating bean with name 'employeeServiceImpl': Unsatisfied dependency expressed through field 'eRepository': Error creating bean with name 'employeeRepository' defined in com.example.demo.repository.EmployeeRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class com.example.demo.model.Employee
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:767) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:747) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:145) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:492) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1416) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:597) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:950) ~[spring-context-6.0.13.jar:6.0.13]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616) ~[spring-context-6.0.13.jar:6.0.13]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:738) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:440) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-3.1.5.jar:3.1.5]
at com.example.demo.DemoApplication.main(DemoApplication.java:12) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.1.5.jar:3.1.5]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'employeeServiceImpl': Unsatisfied dependency expressed through field 'eRepository': Error creating bean with name 'employeeRepository' defined in com.example.demo.repository.EmployeeRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class com.example.demo.model.Employee
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:767) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:747) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:145) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:492) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1416) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:597) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:764) ~[spring-beans-6.0.13.jar:6.0.13]
... 25 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeRepository' defined in com.example.demo.repository.EmployeeRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class com.example.demo.model.Employee
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:764) ~[spring-beans-6.0.13.jar:6.0.13]
... 39 common frames omitted
Caused by: java.lang.IllegalArgumentException: Not a managed type: class com.example.demo.model.Employee
at org.hibernate.metamodel.model.domain.internal.JpaMetamodelImpl.managedType(JpaMetamodelImpl.java:192) ~[hibernate-core-6.2.13.Final.jar:6.2.13.Final]
at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.managedType(MappingMetamodelImpl.java:467) ~[hibernate-core-6.2.13.Final.jar:6.2.13.Final]
at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.managedType(MappingMetamodelImpl.java:97) ~[hibernate-core-6.2.13.Final.jar:6.2.13.Final]
at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.(JpaMetamodelEntityInformation.java:82) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:69) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:246) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:211) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:194) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:81) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:317) ~[spring-data-commons-3.1.5.jar:3.1.5]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:279) ~[spring-data-commons-3.1.5.jar:3.1.5]
at org.springframework.data.util.Lazy.getNullable(Lazy.java:245) ~[spring-data-commons-3.1.5.jar:3.1.5]
at org.springframework.data.util.Lazy.get(Lazy.java:114) ~[spring-data-commons-3.1.5.jar:3.1.5]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:285) ~[spring-data-commons-3.1.5.jar:3.1.5]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:132) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1817) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766) ~[spring-beans-6.0.13.jar:6.0.13]
... 49 common frames omitted



Why it is giving error?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Disable Jupyter Notebook cell only for whole notebook run

 Programing Coderfunda     October 29, 2023     No comments   

I don't know if it is possible, but I have a Jupyter notebook where I'd like to disable some cells in case of a whole run.
That is, 'Run All' would jump over these cells and not trigger them, but they could still be used if ran alone (e.g. with Ctrl+Enter) without changing the code.


I know %%script false --no-raise-error does the trick, but you need to manually change a constant to re-enable the cells when you need them. Ideally, I'd not have to change anything in the code.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

28 October, 2023

what do you do with model names, etc when the project is not in english?

 Programing Coderfunda     October 28, 2023     No comments   

I'm working on a project to manage specific legal orders in a country where english is not the language.

Although it's possible to translate some names in english, it becomes a little weird in some situations. For example a law requires to compile a form, it's weird if I translate the name of the form from the original language name into english, but it's also weird to have so much code in a language that is not english.

What do you do in these cases? submitted by /u/MobilePenor
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

27 October, 2023

cross-table query but filter doesn't works

 Programing Coderfunda     October 27, 2023     No comments   

I have two table,custom(click to show picture) gateway(click to show picture). custom.gateway_id's (pk) value is set as gateway.id
When i give a parameter(ex: 1 )The query is intended to retrieve data from CustomModelSerielPort where CustomModelSerielPort.gateway_id (ex:1)_matches Gateway.id (ex:1), and the data is only returned if Gateway.is_partner_ipc is equal to 1.
def list_serial_port(gateway_id: int, db: Session):
result = {"item_list": []}
serial_ports = (
db.query(CustomModelSerielPort.id, CustomModelSerielPort.path)
.join(Gateway, CustomModelSerielPort.gateway_id == Gateway.id)
.filter(Gateway.id == gateway_id)
.filter(Gateway.is_partner_ipc == 1)
.all()
)



If i give a parameter(ex: 3), i shouldn't get any data because Gateway.is_partner_ipc ==0,
However i still can get data, just like filter doesn't work, and if i change my condition to
.filter(Gateway.is_partner_ipc == 0)



I expect to get data when give a parameter(ex: 3) but no data when give a parameter(ex: 1 ), however both wont get any data, do anyone now what wrong with my code, thank a lot.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

26 October, 2023

Laravel + vue jwt auth

 Programing Coderfunda     October 26, 2023     No comments   

Used this (
https://blog.logrocket.com/implementing-jwt-authentication-laravel-9/) tutorial to setup my backend, getting the user as well as the token itself after login. But how can/should I store it? Is there any good tutorial that is handling that all in the frontend? Any articles to read that you can suggest? Really want to learn to work with jwt in a professional way, and store/use it as an httpOnly cookie if possible. Thanks for your help 😁👍 submitted by /u/IngloriousBastrd7908
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

25 October, 2023

AI foot tracking model

 Programing Coderfunda     October 25, 2023     No comments   

I am a student doing a graduation project. I urgently need to deal with this model (I am attaching a link). I've never worked with python and AI. Please help me understand how to run this model. I really need. Thank you



https://github.com/OllieBoyne/FIND#model-downloads />

This is my first time dealing with this. I sat there for a very long time trying to figure it out, but nothing came of it
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

24 October, 2023

How to completely overwrite previous print with a new one? [duplicate]

 Programing Coderfunda     October 24, 2023     No comments   

I have to print a progress status, so update a print with a new one. I read many post that says you have to use "\r", so I tried this: print(string, end="\r", flush=True).


The problem is that when the previous printed string is bigger than the second one, some stuff of old print will reamins in the new print.


Here's the full code:
import time

long_string = "AAAAA"
short_string = "BB"
c = 0
while True:
if c % 2 == 0:
print(long_string, end="\r", flush=True)
else:
print(short_string, end="\r", flush=True)
c += 1
time.sleep(1)




I would expect that in the if it would print "AAAAA" and in the else it would print just "BB", but instead, in the else, it prints "BBAAA" because the "A" remains from previous print. Here's what I mean. I would like it would be just "BB" instead of "BBAAA".


I saw this post answer Python: How to print on same line, clearing previous text? so I tried to use os.sys.stdout.write('\033[K' + long_string + '\r') instead of print, but I still have the same problem and it also print a strange character


How can I completely delete previous clean and make a new one without traces of the old one?


Edit:


@Thierry Lathuille
Here's the full code with the second solution:
import time, os

long_string = "AAAAA"
short_string = "BB"
c = 0
while True:
if c % 2 == 0:
os.sys.stdout.write('\033[K' + long_string + '\r')
else:
os.sys.stdout.write('\033[K' + short_string + '\r')
c += 1
time.sleep(1)



It produces this output





I'm testing it in Windows 10 cmd.


Edit 2:
I said that the solution of "\r" didn't work and you closed my question and said that it has been answered in that thread. Are you kidding me right? Please open it again, that solution doesn't work, I already said it, that thread's answeres doesn't work to me and I explained why.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

how would you approach baselining models and all of their relations?

 Programing Coderfunda     October 24, 2023     No comments   

I've been tasked with one of the more challenging things I've had to do in my 18 years+ career and as I try to wrap my head around the best approach to solve this, I thought I would ask here as well to see if I can gain anything from outside perspectives.

Hopefully this is allowed, I know it speaks of a specific problem, but it's also a general problem that others might have to deal with at some point so hoping that this thread could be of some use to others in the future.

In my project I have models who contain many nested relations, all of which themselves contain many nested relations. Including many pivot many-to-many relations. I've been tasked with making it possible to save a snapshot of the top level model, including all of its recursive nested relations. These snapshots, also called baselines or versions, can then be loaded at a later time. They can never be edited however, they are frozen in time.

My first approach was to create a new table for this and save the model and all of its recursive relations as json, with the idea that I could then later hydrate that json back into models and return them via my API. This is proving to be quite tricky as the process of re-hydrating my complex json into models and their relations is cumbersome and feels hacky. The idea with this approach is that I could have my snapshots contained and would not have to pollute my database with tons of "cloned" records.

My second approach would be to create duplicate copies of my models and all their relations whenever a snapshot is created. This feels like it would indeed work, but would result in potentially lots of extra rows, though that in itself shouldn't be much concern.

I was wondering if anyone can think of a better approach to my problem? Or if either of my two above approaches seem sound and valid?

Just thought I would pick some brains! Many thanks for any insight! submitted by /u/spar_x
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

23 October, 2023

🚀Introducing ims-laravel-admin-starter: Your Hassle-Free Laravel Admin Panel & API Starter Kit🚀

 Programing Coderfunda     October 23, 2023     No comments   

Hey there, fellow developers! I'm excited to share with you an open-source project that can supercharge your web development journey.

ims-laravel-admin-starter is a purpose-built Admin panel and API starter application, skillfully crafted with the robust Laravel 10 framework and Filament 3.

The primary goal? To make your local development setup a breeze and let you dive into your project right away. No more fussing with intricate configurations. You can hit the ground running with your Laravel-based API and admin panel development. Spend your time building your application's logic, not wrestling with setup complexities.

🔗 Find out more: GitHub Repository

📚 Explore the Wiki: Dedicated Wiki

This project is a brainchild of Innovix Matrix Systems and is proudly released as open-source software under the MIT license. Feel free to use, modify, and distribute this starter kit in harmony with MIT license terms. We're all about collaboration, so don't hesitate to contribute and make this project even more amazing.

Let's shape the future of Laravel development together! 🙌 submitted by /u/AHS12_96
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

22 October, 2023

VSCode IntelliSense autocomplete suddenly stopped working with node modules

 Programing Coderfunda     October 22, 2023     No comments   

I'm trying to make a steam bot with JS, and IntelliSense does not work.





I have my SteamUser object declared:
const SteamUser = require("steam-user");
const client = new SteamUser()



It recognizes the logOn function:





But IntelliSense doesn't work. I tried restarting VSCode, entering command pallete and using the Developer: Reload Window command, but to no avail.


In a discord.js project IntelliSense also doesn't work:





I have run npm install:





Here is my package.json:
{
"dependencies": {
"steam-user": "^5.0.1"
}
}



EDIT: Just found out that local requires also don't work.


Example:
const config = require("./config.json")






config.json:
{
"accountName": "something",
"password": "something2"
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Can't run jupyter using docker compose with nginx

 Programing Coderfunda     October 22, 2023     No comments   

i am trying to run python script on jupyter using docker compose but can't connect to python kernel and this is my docker compose file which running on ubuntu vm :

services:
jupyter:
container_name: jupyter
image: jupyter/scipy-notebook
ports:
- 8888:8888
volumes:
- ./jupyter:/home/jovyan/work
environment:
- JUPYTER_TOKEN=password
command: jupyter notebook --ServerApp.iopub_data_rate_limit=10000000 && ["jupyter", "lab", "--debug"]
networks:
testing_net:
ipv4_address: 172.18.0.3

networks:
testing_net:
ipam:
driver: default
config:
- subnet: 172.18.0.2/16`

and this is my nginx configuration
` location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass
http://localhost:8888; /> proxy_redirect off;
}```
when i'm trying to run any python code on jupyter can't connect to kernel an it gives me this error in the docker logs
```[W 2023-10-22 06:55:09.321 ServerApp] Replacing stale connection: ab4cb6a6-12c1-4d60-9730-ec05070a5f5f:56fc3464-cb08-4d4c-8d8b-7962be661691
[W 2023-10-22 06:55:09.322 ServerApp] 400 GET /api/kernels/ab4cb6a6-12c1-4d60-9730-ec05070a5f5f/channels?session_id=56fc3464-cb08-4d4c-8d8b-7962be661691 (1fd5f82f97c944089c5f3113e6ec60a5@172.18.0.1) 1.78ms referer=None```
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

21 October, 2023

offset formula / dynamic range in Google sheets

 Programing Coderfunda     October 21, 2023     No comments   

I need to set a dynamic range/offset formula in order to track only the last 5 inputs in to separate fields (for each person). Each month I am adding 1 new row for each person (2 new rows in total), so the range of the last 5 inputs should be updated.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

20 October, 2023

Outlook Showing in Process even after closing - C#

 Programing Coderfunda     October 20, 2023     No comments   

I am writing a code to such that I will get a trigger when ever outlook opens
Process[] processlist = System.Diagnostics.Process.GetProcessesByName("OUTLOOK");

if (processlist.Count() > 0)
{
MessageBox.Show("Outlook Opened");
}



Works great for the first time when I open outlook, but the message box continue to show even after outlook is closed .


I also checked the background process there is no outlook process running.
Help appreciated :) .
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

19 October, 2023

Conditionally Assert Throwing An Exception in Pest

 Programing Coderfunda     October 19, 2023     No comments   

---



Pest recently added the throwsUnless() method in Pest v2.24 to conditionally verify an exception if a given boolean expression evaluates to false.





This method is the counterpart to the throwIf() method, which conditionally verifies an exception if a given expression is true:
test('example 1', function () {
// Test that only throws an exception for the mysql driver...
})->throwsIf(DB::getDriverName() === 'mysql', Exception::class, 'MySQL is not supported.');

test('example 2', function () {
// Test that throws unless the db driver is mysql...
})->throwsUnless(DB::getDriverName() === 'mysql', SomeDBException::class);



For example, let's say that you have a PHP package that supports various PHP extensions for manipulating images. Your CI environment might support and test both gd and imagemagick; however, other environments might only support one or the other:
test('gd wrapper can create an image', function () {
$image = imagecreate(width: 200, height: 200);
imagecolorallocate($image, 255, 255, 255);
imagepng($image, '/tmp/new_image_gd.png');

expect(file_exists('/tmp/new_image_gd.png'))->toBeTrue();
})->throwsUnless(extension_loaded('gd'), \Error::class);

test('imagemagic wrapper can create an image', function () {
$image = new Imagick();
// ...

})->throwsUnless(extension_loaded('imagick'), \Error::class);



The throwsIf() and throwsUnless() methods also support callables if you prefer that style or have some custom logic that you want to use to determine if the test should throw an exception:
test('example test with callables', function () {
$image = new Imagick();
// ...
})->throwsUnless(fn () => class_exists(\Imagick::class), 'Class "Imagick" not found');



Learn More




You can learn about handling Exceptions in tests in the Pest Exceptions documentation. Also, if you're new to PestPHP and prefer videos, we recommend checking out Learn PestPHP From Scratch by Luke Downing.



The post Conditionally Assert Throwing An Exception in Pest 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

18 October, 2023

Write Single Page Applications using Laravel Splade

 Programing Coderfunda     October 18, 2023     No comments   

---



Laravel Splade, created by by Pascal Baljet, is a super easy way to build single-page applications (SPA) using Laravel Blade templates. Splade makes it easy to create modern, dynamic web applications that are a joy to use.





Splade provides useful Blade components that are enhanced with renderless Vue 3 components out of the box, such as the Component component. It provides that SPA-like feeling, but you can use Blade, sprinkled with interactive Vue components when required.


As you can see, in the default installation, the components fetch the page data via XHR and provide that SPA snappy feel without full page reloads.





You can use both Blade and Vue markup. Here's an example from Splade's component. Note the v-show directive and @click listener from Vue, and the Blade-specific component and variable usage {{ }}:

{{ $blog->full_content }}




{{ $blog->excerpt }}
Expand





If you need Custom Vue components, Splade has your back, and you can even utilize Server Side Rendering (SSR) to improve performance in your application.


If you also want to use Laravel Breeze or Laravel Jetstream, Splade provides starter kits for both. Splade also provides useful components out of the box you can use to get started quickly, with or without using the starter kits:



* Forms

* Links

* Events

* Flash

* Modals

* Table

* Teleport

* Toggle

* Transition

* And more!






You can get started with Splade quickly by checking out the homepage and accompanying documentation on splade.dev. You can also dive deeper and learn How Splade works under the hood.



The post Write Single Page Applications using Laravel Splade 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

17 October, 2023

Inertia and React or Vue

 Programing Coderfunda     October 17, 2023     No comments   

Hi just checking your thoughts on whether to learn React or Vue, I want to learn React as it may be better to find work and it has a larger ecosystem but my issue is is there are not a lot of tuts for Laravel and React with Inertia, do you have any recomendations for tuts? Also, what are your guys thoughts on Vue vs React with Laravel?

Here is the Reddit post I read that says they are finding it hard to get jobs with Vue.


https://www.reddit.com/r/vuejs/comments/12zevaz/vue_seniors_how_do_you_feel_about_not_picking/ submitted by /u/Blissling
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

16 October, 2023

Weekly /r/Laravel Help Thread

 Programing Coderfunda     October 16, 2023     No comments   

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

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

* Did you provide a code example?

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






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

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

15 October, 2023

Laravel 9 Upgrade: Write Operations Now Overwrite Existing Files

 Programing Coderfunda     October 15, 2023     No comments   

Per the v9 upgrade guide, "write operations such as put, write, and writeStream now overwrite existing files by default."

I'm not exactly sure what "overwriting existing files" means in this context. From what I've observed, Storage::put() operates the same way on both Laravel 8 and 9. That is, if the file exists, then put() replaces that file's contents with what's passed into the $contents argument -- it doesn't append the contents to the file, nor does it delete the original file and create a new one (it modifies the original file).

I'm trying to upgrade our Laravel 8 app to version 9, and this is the last item on the checklist that I have to get through. I was stumped because I'm not noticing any difference in the behavior of Storage::put() between v8 and v9.

Can anyone provide any context, insight, or example to demonstrate? submitted by /u/mattk1017
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

14 October, 2023

Copy and fill column from datagridview to another VBNET

 Programing Coderfunda     October 14, 2023     No comments   

I want to copy and divide data from the "range" column in dgv1 to dgv2, I have tried this code but it still doesn't work as I want.


Any suggestions? thanks..
dgv1 to dgv 2
Dim column As New DataGridViewTextBoxColumn
Dim newCol As Integer = 0

For Each row As DataGridViewRow In DataGridView1.Rows()
If row.Cells(5).Value.ToString().Equals("I") Then
DataGridView2.Columns.Insert(newCol, column)
With column
.HeaderText = "R1"
.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
.ReadOnly = True
End With
For rows As Integer = 0 To DataGridView1.Rows.Count - 1
DataGridView2.Rows.Add(DataGridView1.Rows(rows).Cells(5).Value)
Next
Exit For
End If
Next
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

13 October, 2023

How do you handle small actions?

 Programing Coderfunda     October 13, 2023     No comments   

If you have a pretty basic web app, you will probably have only CRUD. However, as things start to get bigger, you might have a lot of components and each component might have a lot of actions.

For exemple, a blog post might have a "Publish" button. But you might want to "Unpublish". And then you might want to just update the publication date.

I feel like it starts to get cumbersome if you have to create a route for each small action. In Livewire, this isn't an issue because of the way components work. But in Inertia, I have close to 100 controllers, most being small actions like publishing and unpublishing.

What is the best way to organize these small actions? submitted by /u/AsteroidSnowsuit
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Since when did Laravel fill ONLY database fields into a Model?

 Programing Coderfunda     October 13, 2023     No comments   

I recently upgraded a Laravel application and came across some strange bugs. It turns out, the fill() method on models doesn't fill all fields anymore!

Yes, I'm aware of the $fillable and $guarded properties. In my model I don't have fillable set and have guarded set to ['id', 'created_at', 'updated_at']. So it should fill any properties except those three. In the past this worked fine, but now it only fills the fields that explicitly exist in the database. Laravel even runs a separate query to get those fields.

In my case, I had a "location" field with a dropdown and an "other" option to write in freetext. So the form would come with location=other and location_other=customtext. The DB would store "customtext" in the location field. But I can't fill the model and then copy "location_other" over, because the latter doesn't get filled.

When did this change? I never saw this listed anywhere in the documentation. submitted by /u/Disgruntled__Goat
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

12 October, 2023

Compiler Not Recognized (GCC for Visual Studio Code)

 Programing Coderfunda     October 12, 2023     No comments   

Despite installing the compiler and adding the path to my user environment variable path, the compiler isn't recognized when I test it by checking the version through terminal on VS or command prompt.








For some reason, the path changes from C:/msys64/ucrt64/bin/ to C:/msys64/mingw64/bin/ after I reopen it.


File location on computer (path that was added to environment variable)





Compiler not recognized


Edit: Everything above has been resolved, the commands now all work when I put them into the MSYS2 terminal. However, I'm still having issues when I type g++ or any other commands into the VS terminal. I've attached another screenshot below.


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

11 October, 2023

Laravel Breeze with Volt Functional API

 Programing Coderfunda     October 11, 2023     No comments   

---



The Laravel team released the Livewire + Volt functional stack for Breeze. This increases the Breeze offering to six stack variations, offering a tremendous amount of freedom to stacks that are emerging in the Laravel ecosystem:



* Laravel Blade

* Livewire with Volt Class API

* Livewire with Volt Functional API

* Inertia (React)

* Inertia (Vue)

* API-only






Getting Started with a New Project




If you want to install the Breeze + Volt functional API while creating a new Laravel project, all in one go, you can run the following:
laravel new --pest --breeze --git --dark \
--stack=livewire-functional \
breeze-functional-demo



Note: at the time of writing, the installer doesn't support livewire-functional unless you require dev-master. Likely, you can wait for the installer to get a release, or you can run
# Normal update once the release is created
composer global update laravel/installer -W

# For the impatient
composer global require laravel/installer:dev-master -W



If you prefer to install after-the-fact, you can run the following:
laravel new example-project
cd example-project
composer require laravel/breeze
php artisan breeze:install



Then you can follow the prompts to select the stack, include dark mode support, and pick the test suite (Pest or PHPUnit):





Learn More




If you'd like to get started with Laravel Volt, Jason Beggs wrote a tutorial on Laravel News to Learn Livewire 3, Volt, and Folio by building a podcast player. Also, check out the Volt Livewire documentation for more details.



The post Laravel Breeze with Volt Functional API 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

10 October, 2023

R - In a for loop iterating through columns df[[i]] if a data frame, how do I print the name of column df[[i]] for each loop?

 Programing Coderfunda     October 10, 2023     No comments   

I'm trying to use a for-loop to iterate through the columns of a data frame, and for each loop print out the name of the column on each loop before the operation is performed (namely checking if there are missing values for that column).


I have tried all I can think of, but haven't had any luck so far.


This was my best guess, but it just returns NULL for the column name (I'm guessing because once I've extracted the data of the column it's already a nameless vector?).
for (i in seq_along(df)) {
# Print column name
print(colnames(df[[i]]))
# Print sum of missing values for each column
print(sum(is.na(df[[i]])))
# Print NA value rows
}



Output is as follows:
NULL
[1] 70
NULL
[1] 0
NULL
[1] 0
NULL
[1] 0
NULL



What can I do to print the column name for each pass?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

09 October, 2023

AWS Glue Python Shell Upgrade Boto3 Library without Internet Access

 Programing Coderfunda     October 09, 2023     No comments   

I need to use a newer boto3 package for an AWS Glue Python3 shell job (Glue Version: 1.0).


The default version is very old and hence all the API's does not work


For eg pause_cluster() and resume_cluster() does not work in AWS Glue Python Shell due to this older version



https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/redshift.html />

Similarly for many other product features.


Additionally, we don't have to Glue internet access by security and hence need a solution based on s3 storage libraries


Which is the best way to upgrade the Python Shell as it seems the lightest weight part of our architecture


Basically, we are using python glue shell as our core workflow engine to asynchronously deisgn our pipeline through boto3 apis
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

08 October, 2023

compact(): Undefined variable $pesanan_details

 Programing Coderfunda     October 08, 2023     No comments   

My error


compact(): Undefined variable $pesanan_details


Line 138 experienced an error and a red notification on that line
return view('checkout.check_out', compact('pesanan','pesanan_details'));



Controller controller/PesananController

@foreach ($pesanan_details as $pesanan_detail )


{{ $no++ }}

{{ $pesanan_detail->post->title }}

{{ $pesanan_detail->jumlah }} Style

Rp. {{ number_format($pesanan_detail->post->harga) }}

Rp. {{ $pesanan_detail->jumlah_harga }}



@csrf
{{ method_field('DELETE') }}





@endforeach


Total Harga :

Rp. {{ number_format($pesanan->jumlah_harga) }}



Check Out








@endif



{{-- Kembali --}}
Kembali






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

How to create a customized Error using TypeScript and node.js?

 Programing Coderfunda     October 08, 2023     No comments   

I am new to TypeScript and now working on a personal project, developing an API using TypeScript + node.js + Express.
What I want to do is to create a customized Error that contains some extra properties over the built-in Error. For instance, to handle an inexsitent url/endpoint, I implemented the middleware as
const app = express();
//... skip some imports and basic middlewares
app.use("/api/v1/events", eventRouter);
app.use("/api/v1/users", userRouter);

interface IError extends Error {
status: string;
statusCode: number;
}

app.all("*", (req: Request, res: Response, next: NextFunction) => {
const err = new Error(`Can't find ${req.originalUrl}.`);
(err as any).status = "fail";
(err as any).statusCode = 404;
next(err);
});

app.use((err: IError, req: Request, res: Response, next: NextFunction) => {
err.statusCode = err.statusCode || 500;
err.name;
err.status = err.status || "error";
res.status(err.statusCode).json({
status: err.status,
message: err.message,
});
});



I had to cast err to type any because it would raise an error when I added the properties status and statusCode to err since type Error doesn't include these two properties. I am not sure if this is a good practice because I know it is not recommanded to declare or cast a variable to any, which actually is against the purpose of TypeScipt.
Are there any better solutions to it?


I had to cast err to type any because it would raise an error when I added the properties status and statusCode to err since type Error doesn't include these two properties. I am not sure if this is a good practice because I know it is not recommanded to declare or cast a variable to any, which actually is against the purpose of TypeScipt.
Are there any better solutions to it?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

07 October, 2023

Manage a User's Browser Sessions in Laravel

 Programing Coderfunda     October 07, 2023     No comments   

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

06 October, 2023

Reshape data from wide to long (Creating Panel Data)

 Programing Coderfunda     October 06, 2023     No comments   

I downloaded data from data stream Refinitiv. The data is in wide format which resulted in too many variables (761). I only want to form 8 variables.


How can I do that in Stata?


enter image description here


I wrote this syntax
reshape long Date variable, i(date) j(UVBKP, PCHUVBKP1D, UVBKPA, UVBKPB, UVBKTNA, UVBKNAV, UVBKPH, UVBKPL)



but I don't know why it says
variable date not found
```
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Configure and Display a Schedule of Opening Hours in PHP

 Programing Coderfunda     October 06, 2023     No comments   

---



Opening Hours is a PHP package by Spatie to query and format a set of business operating hours. You can use it to present the times per day and include exceptions for things like holidays and other days off on a given year-specific date or recurring (happening each year). The project's readme file has this example to illustrate how you can configure hours:
$openingHours = OpeningHours::create([
'monday' => ['09:00-12:00', '13:00-18:00'],
'tuesday' => ['09:00-12:00', '13:00-18:00'],
'wednesday' => ['09:00-12:00'],
'thursday' => ['09:00-12:00', '13:00-18:00'],
'friday' => ['09:00-12:00', '13:00-20:00'],
'saturday' => ['09:00-12:00', '13:00-16:00'],
'sunday' => [],
'exceptions' => [
'2016-11-11' => ['09:00-12:00'],
'2016-12-25' => [],
'01-01' => [], // Recurring on each 1st of January
'12-25' => ['09:00-12:00'], // Recurring on each 25th of December
],
]);

// This will allow you to display things like:

$now = new DateTime('now');
$range = $openingHours->currentOpenRange($now);

if ($range) {
echo "It's open since ".$range->start()."\n";
echo "It will close at ".$range->end()."\n";
} else {
echo "It's closed since ".$openingHours->previousClose($now)->format('l H:i')."\n";
echo "It will re-open at ".$openingHours->nextOpen($now)->format('l H:i')."\n";
}




This package has tons of configuration options and can be used on any PHP project without any dependencies. While this package isn't a brand-new Spatie package, we've never covered it and think you should check it out! You can get setup instructions and see more API examples on GitHub at spatie/opening-hours.


If you'd like to learn more background information on why this package as created, Freek Van der Herten originally wrote about it on his blog: Managing opening hours with PHP.



The post Configure and Display a Schedule of Opening Hours in PHP 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

05 October, 2023

searching a list in a list model in flutter

 Programing Coderfunda     October 05, 2023     No comments   

I have been working on a LLM-like very simple project in Flutter. I need to find a string list, for example "what is my lecture score" in a list data. But the order doesn't matter.
If my search finds the "what", "is", "my", "lecture", "score" in one of the sentence list in any order, the result will be true, otherwise false.


Here is my sentence list as a List:
class vaModel {
final int id;
final List stringData;
final String response;

vaModel({
required this.id,
required this.stringData,
required this.response,
});
}



and here is the data of this model:
import "package:flut2deneme/pages/vaModel.dart";

List vaData = [
vaModel(id: 1, stringData: ["what", "my", "score", "lecture"], response: "load1"),
vaModel(id: 2, stringData: ["total", "lectures", "hours", "week"], response: "load2"),
vaModel(id: 3, stringData: ["how", "much", "cost"], response: "load3"),
//other
];



for example, if the user enters "what my score is for this lecture", it will return "load1" in id:1 in the vaData list. Because however the order is different and it has more other words, the desired words (what, my, score, lecture) are found in the data list. As seen, there are other words in the received sentence and the words are not in given order, the result is true, since all required words exist in item 1 (id:1)


It may also be explained in searching a list in a list of List.


Thank you for any support.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel 10.26 Released

 Programing Coderfunda     October 05, 2023     No comments   

---



This week, the Laravel team released v10.26 with a search feature for the Artisan vendor:publish command, array cache expiry updates, more.


This week was a smaller release, but we get an excellent vendor:publish update that makes finding providers and tags a breeze! Laravel also saw some fixes and a few reverts leading us to Laravel 10.26.2. Thanks again for all the contributions from the Laravel team and the community!


Allow Searching on the vendor:publish prompt




Jess Archer contributed filtering the vendor:publish command to quickly search for providers and tags that you would like to publish. You can also select all providers and tags from the dropdown:





Ensure array cache considers milliseconds




In Laravel 10.25, Tim MacDonald contributed an update to ensure that array cache driver values expire at the expiry time; however, there were some testing issues around this update (which was reverted) and now in larval 10.26, those issues are all sorted. We would encourage you to update to the latest Laravel 10.26 version if you noticed any array cache driver flakiness, and thank you to Tim MacDonald for sorting it all out!


See Pull Request #48573 if you're interested in the updates made around that driver to ensure it honors expiry time.


Release notes




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


v10.26.2






* Revert "Hint query builder closures (#48562)" by @taylorotwell in
https://github.com/laravel/framework/pull/48620 />





v10.26.1






* [10.x] Fix selection of vendor files after searching by @jessarcher in
https://github.com/laravel/framework/pull/48619 />





v10.26.0






* [10.x] Convert Expression to string for from in having subqueries by @ikari7789 in
https://github.com/laravel/framework/pull/48525 />

* [10.x] Allow searching on vendor:publish prompt by @jessarcher in
https://github.com/laravel/framework/pull/48586 />

* [10.x] Enhance Test Coverage for Macroable Trait by @salehhashemi1992 in
https://github.com/laravel/framework/pull/48583 />

* [10.x] Add new SQL error messages by @magnusvin in
https://github.com/laravel/framework/pull/48601 />

* [10.x] Ensure array cache considers milliseconds by @timacdonald in
https://github.com/laravel/framework/pull/48573 />

* [10.x] Prevent session:table command from creating duplicates by @jessarcher in
https://github.com/laravel/framework/pull/48602 />

* [10.x] Handle expiration in seconds by @timacdonald in
https://github.com/laravel/framework/pull/48600 />

* [10.x] Avoid duplicate code for create table commands by extending new Illuminate\Console\MigrationGeneratorCommand by @crynobone in
https://github.com/laravel/framework/pull/48603 />

* [10.x] Add Closure Type Hinting for Query Builders by @AJenbo in
https://github.com/laravel/framework/pull/48562 />






The post Laravel 10.26 Released 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

Why I choose Inertia over Livewire

 Programing Coderfunda     October 05, 2023     No comments   

Hi, back when Livewire was first announced I gave it a try. I was excited, but I felt like the way it's hydrated doesn't fulfill my needs. Then I found Inertia and got excited again. Even tho it doesn't allow me to use Laravel's helpers I feel like I have full control and that's what I need.

Now that Livewire v3 came about, it looks much better and I had to try it again, to see if I could use it for my future projects. Wire:navigate is so amazing, but I just tested the very thing that made me leave the first time.

If it's a skill issue on my part, well, I'm a fool, will eat my critique and be happy that I was using Livewire wrong and can start using it properly now.

Let me demonstrate:

Model: class File extends Model { protected $appends = ['rand']; protected $fillable = ['name']; public function getRandAttribute() { return rand(1, 100); } }

Livewire Component: class Test extends Component { public $count = 1; // public $files = []; public function mount() { // $this->files = File::all(); } public function do() { $this->count++; } public function render() { return view('livewire.test')->with([ 'files' => File::all(), ]); } }

Livewire Blade: {{ $count }} @foreach ($files as $file) {{ $file->name }} {{ $file->rand }} @endforeach

I tested both commented and `with()` options, but both had same result. On every click, which only increases the count, the `rand` value changed.

Now you might see what's my problem. If the rand attribute was s3 file getter, I'm paying for every rerender.


https://i.redd.it/46gzkg08t5sb1.gif

So, is this doable in Livewire with different approach, or does it have to be like this? submitted by /u/narrei
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

04 October, 2023

I want to have the Fibonacci sequence returned with commas between the numbers

 Programing Coderfunda     October 04, 2023     No comments   

def get_fibonacci_sequence(num: int) -> str:
'''
Function to return string with fibonacci sequence

>>> get_fibonacci_sequence(0)
''
>>> get_fibonacci_sequence(1)
'0'
>>> get_fibonacci_sequence(9)
'0,1,1,2,3,5,8,13,21'
'''

first_term = 0
second_term = 1
nth_term = 0
result = ''

for sequence in range(num):
result += str(first_term)
nth_term = first_term + second_term
first_term = second_term
second_term = nth_term
return(result)



I tried adding (+ ',') in the loop where I convert the numbers to a string and it works but not the way I want it to.


'0,1,1,2,3,5,8,13,21,'


I want to get rid of the comma after 21
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

03 October, 2023

Unfinalize tool

 Programing Coderfunda     October 03, 2023     No comments   


https://laravel-news.com/unfinalize

​

I think this tool is useful either for poorly designed libraries or for users who aren't fully aware of the library's capabilities.

What are your thoughts? submitted by /u/leoshina
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

02 October, 2023

Error when calling a function having a record with float fields as an arg using `function:call` method

 Programing Coderfunda     October 02, 2023     No comments   

isolated function mockFunction(record {|string operation; float operand1; float operand2;|} input) returns string{
return "mockFunction scuccessful";
}

public function main() returns error? {
string input = "{\"operation\":\"ADDITION\",\"operand1\":23.0,\"operand2\":43.0}";
map & readonly inputJson = check input.fromJsonStringWithType();
any|error observation = function:call(mockFunction, inputJson);
io:println(observation);
}



I got the following error when I tried the above.
error: {ballerina/lang.function}IncompatibleArguments {"message":"arguments of incompatible types: argument list '(map & readonly)' cannot be passed to function expecting parameter list '(ai.agent:record {| string operation; float operand1; float operand2; |})'"}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

01 October, 2023

MariaDB Encryption at rest - provide key from app

 Programing Coderfunda     October 01, 2023     No comments   

In the past, I use Sybase anywhere db as my db server. I can encrypt the whole db with password, and from my application, i provide password inside connection string to gain access to server.


I want to use the same / similar scenario with mariaDB.


Suppose i have mariadb with encryption at rest.


1- can i provide key from my application directly?


or build wcf service that mariadb call to get the key it needs when starting


2- can i prevent resetting admin password on encrypted db?


3- Is there any other dbs that support this scenario ?


thanks
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • Sitaare Zameen Par Full Movie Review
     Here’s a  complete Vue.js tutorial for beginners to master level , structured in a progressive and simple way. It covers all essential topi...
  • C++ in Hindi Introduction
    C ++ का परिचय C ++ एक ऑब्जेक्ट ओरिएंटेड प्रोग्रामिंग लैंग्वेज है। C ++ को Bjarne Stroustrup द्वारा विकसित किया गया था। C ++ में आने से पह...
  • 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...

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 (69)
  • 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 (4)
  • 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