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

01 June, 2024

Can't connect to a specific wifi with error : unsupported get ioctl on awdl0

 Programing Coderfunda     June 01, 2024     No comments   

I'm trying to connect to a mixed 2.4Ghz and 5Ghz wifi. When trying to connect with the right password, my Mac is asking me to type the password again. By checking the logs, I was able to find what was the error:


_Apple80211AWDLCompatibilityInternal: unsupported get ioctl on awdl0 for APPLE80211_IOC_CURRENT_NETWORK[103]


The first time it happened was random, I was on the internet and connected to the same wifi and then suddenly I didn't have access to the internet and my Mac was asking me to type my password.


By running Ifconfig, I was able to see that, both, awdl0 and llw0 were inactive (which lead to Airdrop and Airplay being unusable). I was able to activate awdl0 back but not llw0


Here are the things that I have tried so far:



* Forget wifi

* Removing the following files:






sudo rm /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
sudo rm /Library/Preferences/SystemConfiguration/com.apple.wifi.message-tracer.plist
sudo rm /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist
sudo rm /Library/Preferences/SystemConfiguration/preferences.plist



* Reset NVRAM/PRAM

* sudo ifconfig llw0 up (not working, llw0 still inactive)

* Restart in safe mode

* Manually adding the wifi






None of them worked.


I have a 13 inch MacBook Pro M1 Sonoma 14.5 (up to date)


Any ideas ? I want to avoid a factory reset.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

31 May, 2024

Python interpreter if statement issue

 Programing Coderfunda     May 31, 2024     No comments   

So, I am making a really simple Python interpreter. But, there is a part in the interpreter that checks for if statements. But, whenever I use this interpreted if statement, it checks every other indented line (which is what code should be executed if the statement is true). My code is shown below.
def tof(c):
if eval(c) == True:
return True
elif eval(c) == False:
return False

def interpret(code):
lines = code.splitlines()
for line in lines:
if line.startswith("//") or line.strip() == "" or line.startswith(" "):
continue
if line.startswith("write(") and line.endswith(")"):
if line[6] == '"' and line[-2] == '"':
print(line[7:-2])
elif line[6:-1].isdigit():
print(line[6:-1])
else: # not done yet (variables)
v = line[6:-1]
exec(f"print({v})")
if line.startswith("if ") and line.endswith(" then"):
one = line.split("if ")[1]
c = one.split(" then")[0]
if tof(c) == True:
for x in lines:
if x.startswith(" "):
interpret(x.split(" ")[1])
elif tof(c) == False:
continue
if line[2] == "=" or line[1] == "=": # not done yet (variables)
if line[2] == "=":
a = line.split(" = ")[0]
b = line.split(" = ")[1]
exec(f"{a} = {b}")

code = '''
if 1 + 1 == 2 then
write("This should execute once!")
if 1 + 3 == 4 then
// asterisk are there to tell which message is which.
write("This should execute once! **")
'''

interpret(code)



I tried breaking the loop as soon as it sees an unindented piece of code, but if I put something like this:
if True then
write("Hello, World!")
write("Stops here :(")
write("Never gets here..")
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

The Modern Index.php File (A brief look at Livewire Volt)

 Programing Coderfunda     May 31, 2024     No comments   

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

Google workspace add-on install trigger with toolbar failed

 Programing Coderfunda     May 31, 2024     No comments   

It is very weird! The same code(attached below), user take diff installation ways, diff effects.


Success situation:
User A -> click menu item in Add-on menu to install trigger(Google sheet onEdit trigger).
User A can call that trigger when edit something in sheet.
All other users can call that trigger when edit something in sheet.


Failure situation:
User -> click the button in the sidebar by the toolbar icon to install the same trigger.
User A can call that trigger when edit something in sheet.
All other users cannot call that trigger when edit something in sheet.


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

Eloquent JoinWith Package for Laravel

 Programing Coderfunda     May 31, 2024     No comments   

---



The Eloquent JoinWith package by Mohammed Safadi lets you join existing HasOne and BelongsTo model relationships with a new joinWith() method. According to the package's readme, JoinWith will execute a single query instead of two separate queries, which can translate to faster and more efficient queries.


To use this package, you can either use the package's JoinWith trait or extend the package's provided JoinWithModel class:
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Safadi\EloquentJoinWith\Database\Concerns\JoinWith;

class User extends Model
{
use JoinWith;

// ...
}



You can then call the joinWith() method, which resembles the with() method:
$user = User::joinWith('profile')
->select('users.id', 'users.name')
->first();

// Nested relationships
$user = User::joinWith('profile.country')->first();

// More complex example
$orders = Orders::joinWith(['user' => function ($query) {
$query->where('users.status', '=', 'verified');
}])->get();



This package works specifically with HasOne and BelongsTo model relationships—at the time of writing, other relationships are not supported. You can learn more about this package, get full installation instructions, and view the source code on GitHub at msafadi/laravel-eloquent-join-with.



The post Eloquent JoinWith Package for Laravel 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

Introducing laravel-command-bus!

 Programing Coderfunda     May 31, 2024     No comments   

Hello Laravel developers! I'm excited to announce the release of laravel-command-bus, a package designed to simplify and enhance command handling in your Laravel applications.

With this package, you can:

* Organize Your Code: Cleanly separate command logic from your controllers.
* Boost Maintainability: Keep your application code more readable and maintainable.
* Leverage Middleware: Easily add middleware to your commands for additional functionality.
* Implement CQRS Effortlessly: Separate your command and query responsibilities with ease.




Whether you're building a small app or a large enterprise solution, laravel-command-bus will help you manage commands more efficiently. Check it out on GitHub and give it a try today! submitted by /u/Crafty-Savings6727
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

30 May, 2024

Recoding an entire data frame using label-value pairs stored in a different dataframe

 Programing Coderfunda     May 30, 2024     No comments   

Suppose I have a dataframe:
df
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Snowflake: How to flatten the ACCESS_HISTORY View

 Programing Coderfunda     May 30, 2024     No comments   

in snowlake.account_usage.access_history DIRECT_OBJECTS_ACCESSED and BASE_OBJECTS_ACCESSED contains the objects that were involved in the query


Although it’s great to have these information, the format however prohibits us from joining this data with another object data to gain more insight about how the objects was used by the query (e.g. which warehouse this query was executed? How long did it take to execute? Was there an error encountered? Who executed it? etc.)


is there a way to flatten it ?


flatten the access_history view
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

AVD users facing issue with Error code: 0x3000047 Extended error code: 0x0

 Programing Coderfunda     May 30, 2024     No comments   

Users get disconnected from AVD machines with error code 0x3000047 Extended error code: 0x0


Here are the logs that we see


[{"Code":-2147467259,"CodeSymbolic":"ConnectionFailedAdTrustedRelationshipFailure","Time":"2024-05-30T12:01:46.7398504Z","Message":"Exception of type 'Microsoft.RDInfra.RDAgent.Service.AddUserToLocalGroupAdTrustedRelationshipFailureException' was thrown.","ServiceError":false,"Source":"RDAgent"}]


Is there a way to resolve/aviod this issue ?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How do I replace `serviceWorkerVersion` with `{{flutter_service_worker_version}}` template token?

 Programing Coderfunda     May 30, 2024     No comments   

In my index.html in my flutter web app, I have a serviceWorker script. Flutter now complaints like this:
[ +3 ms] Warning: In index.html:60: Local variable for "serviceWorkerVersion" is deprecated. Use "{{flutter_service_worker_version}}" template token instead.



The of the index.html is defined like this:




var serviceWorkerVersion = null;
var scriptLoaded = false;
function loadMainDartJs() {
if (scriptLoaded) {
return;
}
scriptLoaded = true;
var scriptTag = document.createElement('script');
scriptTag.src = 'main.dart.js';
scriptTag.type = 'application/javascript';
document.body.append(scriptTag);
}

if ('serviceWorker' in navigator) {
// Service workers are supported. Use them.
window.addEventListener('load', function () {
// Wait for registration to finish before dropping the tag.
// Otherwise, the browser will load the script multiple times,
// potentially different versions.
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
navigator.serviceWorker.register(serviceWorkerUrl)
.then((reg) => {
function waitForActivation(serviceWorker) {
serviceWorker.addEventListener('statechange', () => {
if (serviceWorker.state == 'activated') {
console.log('Installed new service worker.');
loadMainDartJs();
}
});
}
if (!reg.active && (reg.installing || reg.waiting)) {
// No active web worker and we have installed or are installing
// one for the first time. Simply wait for it to activate.
waitForActivation(reg.installing || reg.waiting);
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
// When the app updates the serviceWorkerVersion changes, so we
// need to ask the service worker to update.
console.log('New service worker available.');
reg.update();
waitForActivation(reg.installing);
} else {
// Existing service worker is still good.
console.log('Loading app from service worker.');
loadMainDartJs();
}
});

// If service worker doesn't succeed in a reasonable amount of time,
// fallback to plaint tag.
setTimeout(() => {
if (!scriptLoaded) {
console.warn(
'Failed to load app from service worker. Falling back to plain tag.',
);
loadMainDartJs();
}
}, 4000);
});
} else {
// Service workers not supported. Just drop the tag.
loadMainDartJs();
}





How do I replace serviceWorkerVersion with a {{flutter_service_worker_version}} template instead, as the warning suggests ?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Is GARNET really a drop-in replacement for REDIS?

 Programing Coderfunda     May 30, 2024     No comments   

I am experimenting with ASPIRE and GARNET, the latter replacing REDIS. According to the documentation:



Thus, one can use Garnet with unmodified Redis clients available in
most programming languages, for example, with StackExchange.Redis in
C#.



As far as I know, there is no Garnet library for Aspire, but it can be used by specifying the image:
var builder = DistributedApplication.CreateBuilder(args);

var cache = builder.AddRedis("cache", port: 6379).WithImage("ghcr.io/microsoft/garnet")



When starting from the aspire starter template, I tried to add distributed caching to the "Counter" page:
protected override async Task OnInitializedAsync()
{
var bytes = await cache.GetAsync("counter");
if (bytes != null)
{
currentCount = BitConverter.ToInt32(bytes);
}
}

public async Task IncrementCount()
{
currentCount++;
await cache.SetAsync("counter", BitConverter.GetBytes(currentCount));
}



Works seamlessly with Redis. However, it fails with Garnet:



StackExchange.Redis.RedisServerException: ERR unknown command
at StackExchange.Redis.RedisDatabase.ScriptEvaluateAsync(String script,
RedisKey[] keys, RedisValue[] values, CommandFlags flags) in
/_/src/StackExchange.Redis/RedisDatabase.cs:line 1551
at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.SetAsync(String
key, Byte[] value, DistributedCacheEntryOptions options,
CancellationToken token)
at AspireAppHybridCache.Web.Components.Pages.Counter.IncrementCount() in
D:\Workspace\playground\AspireAppHybridCache\AspireAppHybridCache.Web\Components\Pages\Counter.razor:line
28



Am I missing something essential here?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

29 May, 2024

MissingSchemaError in mongoose

 Programing Coderfunda     May 29, 2024     No comments   

My schemas:


`const facultySchema = new Schema({
title: {
type: String,
required: true
},
groups: [{
type: Schema.Types.ObjectId,
ref: 'Group'
}]
})


export default model('Faculty', facultySchema)`


`const groupSchema = new Schema({
title: {
type: String,
required: true
},
students: [{
type: Schema.Types.ObjectId,
ref: 'Student',
}],
journals: [{
type: Schema.Types.ObjectId,
ref: 'Journal'
}]
})


export default model('Group', groupSchema)`


here is my service whe i have error MissingSchemaError: Schema hasn't been registered for model "Group". This error happend when i try to populate groups


`class FacultyService {
getFaculties = async () => {
const faculties = await Faculty.find().populate('groups')

if(!faculties) return null

return faculties
}



}


export const facultyService = new FacultyService()`


when i add code const gr = await Group.find() to my getFaculties fucction error disappear.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Images getting loaded really slow on github pages

 Programing Coderfunda     May 29, 2024     No comments   

I created HTML/CSS/JavaScript landing page, with a lot of photos (around 300). About 290 photos are displayed with lightgalleryjs for a modal carousel and I added loading="lazy" attribute to each image.


When I view the website on browser via local server it's fine and loads fast but when I upload it to GitHub pages it takes about 10 - 15 seconds to load the images, a background video (without loading lazy) at the header also takes a lot of time to load (it wasn't the case with GitHub pages before I imported the photos for lightgalleryjs).


How do I solve the slow loading of images?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Spring Boot can't autowire @ConfigurationProperties

 Programing Coderfunda     May 29, 2024     No comments   

Here is my FileStorageProperties class:

@Data
@ConfigurationProperties(prefix = "file")
public class FileStorageProperties {
private String uploadDir;
}




This gives me saying : not registered via @enableconfigurationproperties or marked as spring component.



And here is my FileStorageService :

@Service
public class FileStorageService {

private final Path fileStorageLocation;

@Autowired
public FileStorageService(FileStorageProperties fileStorageProperties) {
this.fileStorageLocation = Paths.get(fileStorageProperties.getUploadDir())
.toAbsolutePath().normalize();

try {
Files.createDirectories(this.fileStorageLocation);
} catch (Exception ex) {
throw new FileStorageException("Could not create the directory where the uploaded files will be stored.", ex);
}
}

public String storeFile(MultipartFile file) {
// Normalize file name
String fileName = StringUtils.cleanPath(file.getOriginalFilename());

try {
// Check if the file's name contains invalid characters
if(fileName.contains("..")) {
throw new FileStorageException("Sorry! Filename contains invalid path sequence " + fileName);
}

// Copy file to the target location (Replacing existing file with the same name)
Path targetLocation = this.fileStorageLocation.resolve(fileName);
Files.copy(file.getInputStream(), targetLocation, StandardCopyOption.REPLACE_EXISTING);

return fileName;
} catch (IOException ex) {
throw new FileStorageException("Could not store file " + fileName + ". Please try again!", ex);
}
}

public Resource loadFileAsResource(String fileName) {
try {
Path filePath = this.fileStorageLocation.resolve(fileName).normalize();
Resource resource = new UrlResource(filePath.toUri());
if(resource.exists()) {
return resource;
} else {
throw new MyFileNotFoundException("File not found " + fileName);
}
} catch (MalformedURLException ex) {
throw new MyFileNotFoundException("File not found " + fileName, ex);
}
}
}




This gives me error saying : could not autowire no beans of type found.



And here is my project structure :







And when I try to run it, it gives me :


---




APPLICATION FAILED TO START



Description:



Parameter 0 of constructor in com.mua.cse616.Service.FileStorageService required a bean of type 'com.mua.cse616.Property.FileStorageProperties' that could not be found.



The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)



Action:



Consider defining a bean of type 'com.mua.cse616.Property.FileStorageProperties' in your configuration.


---




How can I resolve this?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How can I diff a directory for only files of a specific type?

 Programing Coderfunda     May 29, 2024     No comments   

I have a question about the diff command
if I want a recursive directory diff but only for a specific file type, how to do that?


I tried using the exclude option but can only use one pattern only:
diff /destination/dir/1 /destination/dir/2 -r -x *.xml



with the command I can only exclude xml file type, even though there are files in the folder image type (png, gif, jpg), txt, php, etc.


How can I diff only certain file types?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Access log file not created in docker container for spring boot aplication

 Programing Coderfunda     May 29, 2024     No comments   

I have a Spring-Boot application that does not create an access log file of the embedded Tomcat server while running inside a docker container. But when run outside of the container it does create a file.


Iam using a custom log configuration:
@Configuration
public class LoggingConfiguration {

@Bean
public WebServerFactoryCustomizer connectorCustomizer(final AccessLogProperties accessLogProperties) {
return tomcat -> {
final JsonAccessLogValve logValve = new JsonAccessLogValve();
logValve.setEnabled(accessLogProperties.isEnabled());
logValve.setBuffered(accessLogProperties.isBuffered());
logValve.setRenameOnRotate(accessLogProperties.isRenameOnRotate());
logValve.setRotatable(accessLogProperties.isRotate());
logValve.setPrefix(accessLogProperties.getPrefix());
logValve.setSuffix(accessLogProperties.getSuffix());
logValve.setPattern(accessLogProperties.getPattern());
tomcat.addContextValves(logValve);
};
}
}



The properties are configured in my application.yml and made available through: AccessLogProperties.class
...
json-access-log:
enabled: true
buffered: false
pattern: "%{yyy-MM-dd'T'hh:mm:ssZ}t %I %l %u %a %r %q %s (%D ms) %{Authorization}i"
rename-on-rotate: true
rotate: true
prefix: chalkup-${ACTIVE_APP_ENVIRONMENT}
suffix: .access
...



locally a file is created in the root of my project under ./logs and there a file chalkup-local.access is created and appended with info.


sofar running in intellij results in the access file I need.


When I run the app in a docker container. No file is created:


docker config:
FROM eclipse-temurin:21-alpine
ADD ./target/chalkup-*.jar chalkup.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/chalkup.jar"]

chalk-up:
container_name: chalk-up
build:
dockerfile: Dockerfile
context: .
environment:
ACTIVE_APP_ENVIRONMENT: test
entrypoint:
- java
- -agentlib:jdwp=transport=dt_socket,address=*:5005,server=y,suspend=n
- -Djava.security.egd=file:/dev/./urandom
- -jar
- /chalkup.jar
- -Dspring.profiles.active=local
volumes:
- /tmp/logs:/logs
ports:
- "8080:8080"
- "5005:5005"
depends_on:
- wiremock



But when I look in the /logs dir in the running container. I only see the regular logfile but NOT the access log file


Changed the basedir, no success
changed read/write permissions in the container. No success
configured the regular access log
server:
tomcat:
basedir: .
accesslog:
enabled: true


But this one also does not appear in the container, while it does when running outside the container
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

10 May, 2024

How can I document types in a multidimensional array to fix type hinting?

 Programing Coderfunda     May 10, 2024     No comments   

I have some template files that have default arguments defined at the top of each file. I can't get type hinting for these values to work correctly; it just says there is no reference. I am including the WordPress core files in Intelephense, so it understands what a WP_Post is, I just can't get it to understanding typing on a multidimensional aray.


I found this GitHub issue which discusses a similar problem, and includes some suggestions on things to try. No matter which method I used, all I can get it to respond with for $args["post"] is `No references found for 'post'".


Eventually, I found this WordPress forums thread discussing a similar issue, and links to this WordPress core file which includes the "WordPress-y" way to do document multidimensional arrays, but even this still results in the same message.


That's how I've gotten to this point, but this doesn't seem to be working correctly either, because the reference pop-up looks quite odd (screenshot below), and doesn't seem to do anything for type hinting.










Also, I understand that perhaps a class structure would be better, and I will look in to that, but that entails retooling our templating system, so that will take time. For now, I'd like to get type hinting working in this use if at all possible.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

If Sail isn't production ready.... why are we using it?

 Programing Coderfunda     May 10, 2024     No comments   

New to Laravel, not new to docker. Been enjoying Sail in local development because it "just worked" but going to deploy to a server I see that it's not production ready.

One of the main selling points of docker is that you have the same infrastructure on all environments, local/qa/prod/whatever. If I have to build a Dockerfile for everything except localhost, why wouldn't I just use that Dockerfile for localhost? Is it supposed to be a tool for that small area of "i just init'ed my project and have not made a first time deployment yet"?

Make it make sense submitted by /u/NBehrends
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to get an actual type object with generic class?

 Programing Coderfunda     May 10, 2024     No comments   

I get an error with Caused by: java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to com.test.QueryOrderInfo


bizContent is a json String, I want to parse it to an QueryOrderInfo object
public static void main(String[] args) {
BaseResponse queryOrderInfoBaseResponse = null;
try {
queryOrderInfoBaseResponse = new ObjectMapper().readValue("{\"returnCode\":\"SUCCESS\",\"biz_content\":\"{\\\"mchReserved\\\":\\\"1\\\",\\\"cmbOrderId\\\":\\\"900119022715203210134445\\\",\\\"dscAmt\\\":\\\"0\\\",\\\"payType\\\":\\\"ZF\\\",\\\"orderId\\\":\\\"9001004180329103417277\\\",\\\"txnTime\\\":\\\"20190227152032\\\",\\\"merId\\\":\\\"3089991701207X7\\\",\\\"currencyCode\\\":\\\"156\\\",\\\"txnAmt\\\":\\\"1\\\",\\\"tradeState\\\":\\\"S\\\"}\",\"sign\":\"kGE7mwX/ubRlPsPZGNydjY3uCjILgGuxD4j1e/inyC/DlHn5o7LkISpmrH0YQvoZT6lyOxtr9uIkKnqVcTMZNYeYIBU+Tz8NRaPZHuFr/qQb0+fUgEgq5j9ovaFczAF8wrnEfIRYBEqp0ERtK7NG+X6eZLIr9nNVy31eKcnFx1tToJ/zPYN91GOKOtTrJaJrKeDY4+r3ctzsDhnD+TO2MX5zfvW0WLoUjvX5geiYLVpt022BiyxSJyOsrDS858RBmZ5FbVlYP0v/WqwX+J8VY1kDSLxvPtSZuPnsluJPXw6ccnYNH8dir0VgrYfrWRvnupctIm2elCmL7ES6KzDTGg==\",\"encoding\":\"UTF-8\",\"version\":\"0.0.1\",\"signMethod\":\"01\",\"respCode\":\"SUCCESS\"}", new TypeReference() {
});
QueryOrderInfo queryOrderInfo = queryOrderInfoBaseResponse.fromJson();
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}



BaseResponse class
@NoArgsConstructor
@Data
public class BaseResponse {

private String returnCode;
@JsonProperty(value = "biz_content")
private String bizContent;
private String sign;
private String encoding;
private String version;
private String signMethod;
private String respCode;

private String errCode;
private String respMsg;

private T data;

public T fromJson() {
try {
return new ObjectMapper().readValue(this.bizContent, new TypeReference() {
});
} catch (JsonProcessingException e) {
return null;
}
}
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Just deployed Laravel Octane + Swoole with Forge. From 70-80% CPU to 30% CPU with 1700 request per minute. We went from 16,000 slow requests (>= 100ms) in the last hour, to only 114 slow request in the last hour.

 Programing Coderfunda     May 10, 2024     No comments   

= 100ms) in the last hour, to only 114 slow request in the last hour. " title="Just deployed Laravel Octane + Swoole with Forge. From 70-80% CPU to 30% CPU with 1700 request per minute. We went from 16,000 slow requests (>= 100ms) in the last hour, to only 114 slow request in the last hour. " />
submitted by /u/Ciberman
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

09 May, 2024

Deploy your Laravel Dockerfile simply with high availability and security

 Programing Coderfunda     May 09, 2024     No comments   

* Sample :
https://github.com/Andrew-Kang-G/docker-blue-green-runner?tab=readme-ov-file#how-to-start-with-a-php-sample-real-https-self-signed-ssl />
*

With your project and its sole Dockerfile, Docker-Blue-Green-Runner manages the remainder of the Continuous Deployment (CD) process with wait-for-it, consul-template and Nginx.
*

On Linux, you only need to have docker, docker-compose and some helping libraries such as git, curl, bash, yq installed.

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

Use Vue or React Components in a Livewire App with MingleJS

 Programing Coderfunda     May 09, 2024     No comments   

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

From Skeptic to Advocate: How I Built My Ideal Laravel Stack – Feedback Appreciated!

 Programing Coderfunda     May 09, 2024     No comments   

Hello r/Laravel!

I've been working with Laravel professionally over my last few projects, and it has surprisingly become my go-to for creating websites, even when I was initially quite skeptical about it (shout out to my coworker for helping me overcome this skepticism!).

To share this journey and the insights I've gained, I've finally launched a tech blog focused on IT Homelabs and software development, with my very first post dedicated to creating what I consider the perfect Laravel stack.

Here’s what I’ve put together for a robust, Laravel environment:

* Vue.js for interactive, reactive components.
* Inertia.js for seamless integration of Vue.js within Laravel, making SPAs more manageable.
* Laravel Sail for a straightforward, Docker-based local development setup.
* TailwindCSS for intuitive and flexible styling.
* VSCode Devcontainer to ensure consistency across development environments.




This guide is the product of my professional experience and aims to help others bootstrap their Laravel projects with a solid foundation and great developer experience. The motivation behind this guide is not only to share it with other developers but also as a reference for myself when setting up new projects.

I'm excited to share this with you and would love to hear your feedback or engage in discussions about Laravel setups and best practices. Your insights would be incredibly valuable and much appreciated!

rasmusgodske.com/posts/setting-up-the-perfect-laravel-stack

Thanks for checking it out—I'm eager to see how it can help others and to learn from your experiences as well! submitted by /u/rasmus-godske
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Pitching the perfect Laracon talk (an interview with Michael Dyrynda, organiser of Laracon Australia)

 Programing Coderfunda     May 09, 2024     No comments   

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

Hiding shipping method from Woocommerce cart page ISSUE

 Programing Coderfunda     May 09, 2024     No comments   

I tried to use different codes to hide shipping method from Woocommerce cart page. The codes work until I delete a product from the cart. Once I delete a product the shipping section returns. After I refresh the page its work again.


One of the codes I tried:
add_filter( 'woocommerce_cart_needs_shipping', 'filter_cart_needs_shipping' );
function filter_cart_needs_shipping( $needs_shipping ) {
if ( is_cart() ) {
$needs_shipping = false;
}
return $needs_shipping;
}



I tried this code also:
function disable_shipping_calc_on_cart( $show_shipping ) {
if( is_cart() ) {
return false;
}
return $show_shipping;
}
add_filter( 'woocommerce_cart_ready_to_calc_shipping', 'disable_shipping_calc_on_cart', 99 );



I put the code in my theme function.php file. The problem is the same for both codes.


I use WordPress 6.5.2, WooCommerce 8.8.3 and Twenty Twenty-Four theme.


How can this problem be solved?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

08 May, 2024

Transaction aware model events/observables.

 Programing Coderfunda     May 08, 2024     No comments   

So, back in the day.. Laravel 5 day there was this issue in which model events and observers didn't respect db transaction logic, basically, model events and observer methods would have run when you interact with a model from inside a transaction and before it was committed which means that the event will process before the model was actually saved, and of course another problem was that the changed made by the events/observers didn't rollback if the you rollback the transaction.

So came laravel-transactional-events package to solve this.

later, Laravel 8.17 introduced a new method DB::afterCommit that allows one to achieve the same of this package. Yet, it lacks transaction-aware behavior support for Eloquent events.

And i wonder, did Laravel 10 solved this issue? i'm aware of ShouldHandleEventsAfterCommit which takes care of the observers, however, how about the model events that is listened to from within the boot method? will those respect it as well? How about any other events? and not queued events? submitted by /u/Independent-Desk-407
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Rule::array() and whereJsonOverlaps() for MySQL in Laravel 11.7

 Programing Coderfunda     May 08, 2024     No comments   

---



This week, the Laravel team released v11.7, with a Rule::array() validation method, a whereJsonOverlaps() method for MySQL, a Slack OpenID provider for Laravel Socialite, and more.


Introduce the Rule::array() Method




Jakub Potocký contributed the Rule::array() method used to validate multiple array keys using the array validation rule. This method enables using this rule with arrays and collections without having the concatenate dynamic values:
use Illuminate\Validation\Rule;

// Before
['array:' . MyBackedEnum::VALUE->value . ',' . MyBackedEnum::VALUE_2->value];

// After examples
Rule::array('key_1', 'key_2', 'key_3');
Rule::array(['key_1', 'key_2', 'key_3']);
Rule::array(collect(['key_1', 'key_2', 'key_3']));
Rule::array([UnitEnum::key_1, UnitEnum::key_2, UnitEnum::key_3]);
Rule::array([BackedEnum::key_1, BackedEnum::key_2, BackedEnum::key_3]);



See Pull Request #51250 for full details.


Stringable Support in blank() and filled() Helpers




Stefan R. contributed support for Stringable values in the blank() and filled() helpers:
// true
filled(str('FooBar '));

// true
blank(str(' '));



Add "whereJsonOverlaps()" for MySQL




Benjamin Ayles contributed support for MySQL's json_overlaps feature that compares two JSON documents:
User::whereJsonOverlaps('languages', ['en', 'fr'])->exists();
User::whereJsonDoesntOverlap('languages', ['en', 'fr'])->exists();



See Pull Request #51288 for more details and discussion.


Add PasswordResetLinkSent Event




Matt Jones contributed a new event called PasswordResetLinkSent which fires when a password reset link is sent. See Pull Request #51253 for more details.


Laravel Socialite Provider for Slack OpenID




Maarten Paauw contributed a separate Slack OpenID provider for Laravel Socialite. See Pull Request #704 for details and links to the Slack documentation.


Release notes




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


v11.7.0






* [11.x] Fix SesV2Transport to use correct EmailTags argument by @Tietew in
https://github.com/laravel/framework/pull/51265 />

* [11.x] Add Databases nightly workflow by @Jubeki in
https://github.com/laravel/framework/pull/51218 />

* [11.x] update "min" and "max" rule comments by @browner12 in
https://github.com/laravel/framework/pull/51274 />

* [11.x] Fix namespace and improvement PSR in ClassMakeCommandTest.php by @saMahmoudzadeh in
https://github.com/laravel/framework/pull/51280 />

* [11.x] improvement test coverage for view components. by @saMahmoudzadeh in
https://github.com/laravel/framework/pull/51271 />

* [11.x] Introduce method Rule::array() by @Jacobs63 in
https://github.com/laravel/framework/pull/51250 />

* [11.x] Fix docblock for collection pluck methods by @SanderMuller in
https://github.com/laravel/framework/pull/51295 />

* [11.x] Add tests for handling non-baked enum and empty string requests by @hrant1020 in
https://github.com/laravel/framework/pull/51289 />

* blank and filled now support stringable by @lava83 in
https://github.com/laravel/framework/pull/51300 />

* [11.x] Fix ratio validation for high ratio images by @ahmedbally in
https://github.com/laravel/framework/pull/51296 />

* [11.x] Add int|float support to e method by @trippo in
https://github.com/laravel/framework/pull/51314 />

* [11.x] Add release notes by @driesvints in
https://github.com/laravel/framework/pull/51310 />

* [11.x] Stringable is also an interface of symfony by @lava83 in
https://github.com/laravel/framework/pull/51309 />

* [11.x] Add some tests and improvement test coverage for Str::camel by @saMahmoudzadeh in
https://github.com/laravel/framework/pull/51308 />

* [11.x] Using the ?? Operator (Null Coalescing Operator) by @saMahmoudzadeh in
https://github.com/laravel/framework/pull/51305 />

* [11.x] Add ability to override the default loading cached Routes for application by @ahmedabdel3al in
https://github.com/laravel/framework/pull/51292 />

* [11.x] Add ->whereJsonOverlaps() for mysql by @parkourben99 in
https://github.com/laravel/framework/pull/51288 />

* [11.x] Add InteractsWithInput methods to ValidatedInput by @aydinfatih in
https://github.com/laravel/framework/pull/51316 />

* [11.x] Adding PasswordResetLinkSent event by @Muffinman in
https://github.com/laravel/framework/pull/51253 />






The post Rule::array() and whereJsonOverlaps() for MySQL in Laravel 11.7 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

Raspberry PI CM4 Gstreamer: Segmentation fault

 Programing Coderfunda     May 08, 2024     No comments   

I have a program developed for Raspberry PI CM4 with Bullseye OS that receives video from RPI NoIR Camera V2 Gstreamer pipeline and uses OpenCV for further processing.
However, after successfully working for some time program crashes with segmentation fault and backtrace shows next:
0x0000007fe0fd8930 in GstLibcameraSrcState::requestCompleted(libcamera::Request*) ()
from /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstlibcamera.so
(gdb) bt full
#0 0x0000007fe0fd8930 in GstLibcameraSrcState::requestCompleted(libcamera::Request*) ()
at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstlibcamera.so
#1 0x0000007fe0ec2750 in libcamera::Camera::requestComplete(libcamera::Request*) ()
at /lib/aarch64-linux-gnu/libcamera.so.0.0
#2 0x0000007fe0ef33d4 in libcamera::PipelineHandler::completeRequest(libcamera::Request*) ()
at /lib/aarch64-linux-gnu/libcamera.so.0.0
#3 0x0000007fe0f2ecd4 in libcamera::RPi::CameraData::checkRequestCompleted() ()
at /lib/aarch64-linux-gnu/libcamera.so.0.0
#4 0x0000007fe0f2ede8 in libcamera::RPi::CameraData::handleState() ()
at /lib/aarch64-linux-gnu/libcamera.so.0.0
#5 0x0000007fe0eaa750 in libcamera::ipa::RPi::IPAProxyRPi::processStatsCompleteThread(libcamera::ipa::RPi::BufferIds const&) () at /lib/aarch64-linux-gnu/libcamera.so.0.0
#6 0x0000007fe0e13088 in libcamera::Object::message(libcamera::Message*) ()
at /lib/aarch64-linux-gnu/libcamera-base.so.0.0
#7 0x0000007fe0e15490 in libcamera::Thread::dispatchMessages(libcamera::Message::Type) ()
at /lib/aarch64-linux-gnu/libcamera-base.so.0.0
#8 0x0000007fe0e0c804 in libcamera::EventDispatcherPoll::processEvents() ()
at /lib/aarch64-linux-gnu/libcamera-base.so.0.0
#9 0x0000007fe0e151b8 in libcamera::Thread::exec() () at /lib/aarch64-linux-gnu/libcamera-base.so.0.0
#10 0x0000007fe0ec6cf0 in libcamera::CameraManager::Private::run() ()
at /lib/aarch64-linux-gnu/libcamera.so.0.0
#11 0x0000007ff760bcac in () at /lib/aarch64-linux-gnu/libstdc++.so.6
#12 0x0000007ff6fdb648 in start_thread (arg=0x7fe0cff740) at pthread_create.c:477



My pipeline for gstreamer looks like this:
string p_line1 = "libcamerasrc ";
string p_line2 = "! video/x-raw, format=RGBx, width=640, height=480, framerate=30/1 ";
string p_line3 = "! videoflip method=rotate-180 ! videoconvert ! video/x-raw, format=(string)BGR ";
string p_line4 = "! appsink";
string pipeline = p_line1 + p_line2 + p_line3 + p_line4;



I followed this tutorial to install gstreamer
https://qengineering.eu/install-gstreamer-1.18-on-raspberry-pi-4.html />

What can be the cause of the problem and how do i fix it? Thanks in advance!
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Accessing composite QWidget

 Programing Coderfunda     May 08, 2024     No comments   

My code creates a composite widget, it is made of a button and a label.

It is part of broader code where this composite widget it is the element of a list.

But now let's focus on my problem that is:

How do I get to know the text in QPushButton?
This is the code:
myList = QListWidget(layout)
...
#this happens within a loop inside a method of the class

item = QtWidgets.QListWidgetItem()
item_widget = QtWidgets.QWidget()
line_push_button = QtWidgets.QPushButton("text I want to get")
line_push_button.clicked.connect(self.clicked)
line_text = QtWidgets.QLabel("some text")

item_layout = QtWidgets.QHBoxLayout()
item_layout.addWidget(line_push_button)
item_layout.addWidget(line_text)

item_widget.setLayout(item_layout)
myList.insertItem(i, item)
myList.setItemWidget(item, item_widget)



At runtime I can access myList, then I need to loop through the items of the list accessing for each of them the text in the button.

Since list element doesn't have a finChild, findChildren method I don't know what to do.

I don't understand how this kind of traversing works in PyQT
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to fitler on text array column with supabase-js

 Programing Coderfunda     May 08, 2024     No comments   

I have a table i Supabase which looks like this:



I want to use supabase-js client library to filter on phone_numbers (which is a text array).

If I do like this:
const { data, error } = await supabaseClient.from('profiles').select('*').contains('phone_numbers', ["123456"])



I get no result back.


If I do this in raw SQL it works (I get the row with id 2 back):
select * from profiles where phone_numbers @> array['123456'];



What am I doing wrong in the javascript filter?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • Write API Integrations in Laravel and PHP Projects with Saloon
    Write API Integrations in Laravel and PHP Projects with Saloon Saloon  is a Laravel/PHP package that allows you to write your API integratio...
  • Features CodeIgniter
    Features CodeIgniter There is a great demand for the CodeIgniter framework in PHP developers because of its features and multiple advan...
  • Laravel Breeze with PrimeVue v4
    This is an follow up to my previous post about a "starter kit" I created with Laravel and PrimeVue components. The project has b...
  • Fast Excel Package for Laravel
      Fast Excel is a Laravel package for importing and exporting spreadsheets. It provides an elegant wrapper around Spout —a PHP package to ...
  • Send message via CANBus
    After some years developing for mobile devices, I've started developing for embedded devices, and I'm finding a new problem now. Th...

Categories

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

Social Media Links

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

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • 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