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

02 September, 2024

Angular: how to call router.navigate() relative to target route in a RouteGuard?

 Programing Coderfunda     September 02, 2024     No comments   

I have an existing project developed with Angular 4. I need to control the access to a particular route based on user-rights. The simplified route configuration looks like this:

[
{ path: '', redirectTo: '/myApp/home(secondary:xyz)', pathMatch: 'full' },
{ path: 'myApp'
children: [
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', ... },
...
{ path: 'product'
children: [
{ path: '', redirectTo: 'categoryA', pathMatch: 'full' },
{ path: 'categoryA', component: CategoryAComponent, canActivate: [CategoryACanActivateGuard]},
{ path: 'categoryB', component: CategoryBComponent},
...
]
},
...
]
},
...
]




Now, I want to control the access to www.myWeb.com/myApp/product/categoryA. If the user doesn't have enough permission, he/she will be redirected to ... /product/CategoryB. I have written a CanActivate RouteGuard to do this, the guard class looks like this:

import { Injectable } from '@angular/core';
import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot, ActivatedRoute } from '@angular/router';
import { MyService } from '... my-service.service';

@Injectable()
export class CategoryACanActivateGuard implements CanActivate {
constructor(private myService: MyService, private router: Router) { }

canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise {
return this.myService.checkPermission()
.then(result => {
if (!result.hasAccess) {
//redirect here

this.router.navigate(['./myApp/product/categoryB']);
//works, but I want to remove hardcoding 'myApp'

//this.router.navigate(['../../categoryB']);
//doesn't work, redirects to home page

//this.router.navigate(['./categoryB'], { relativeTo: this.route});
//do not have this.route object. Injecting Activated route in the constructor did not solve the problem

}
return result.hasAccess;
});
}
}




Everything works fine, but I want redirect relative to the target route like the following:

this.router.navigate(['/product/categoryB'], { relativeTo: });
// or
this.router.navigate(['/categoryB'], { relativeTo: });




Unfortunately, relativeTo accepts only ActivatedRoute objects and all I have is ActivatedRouteSnapshot and RouterStateSnapshot. Is there a way to navigate relative to the target route (in this case categoryA)? Any help will be really appreciated.



Note:




* I can not change the route configuration other than adding some route-guards.

* I am not looking looking for this.router.navigateByUrl using state.url. I want to use router.navigate([...], { relativeTo: this-is-what-need}).
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Control user to login from only specific device that provided to the user

 Programing Coderfunda     September 02, 2024     No comments   

UPDATE as of Sept-2024:
as per @Joundill In reality, it won't be possible for you to securely restrict access to individual devices through the web. We have made some extra level of authentications in our software to authenticate the users (Added client side certificate on each devices and based on that the user can't access the site from other devices: i.e: how to use client certificates to access website) now it's resolved.


Original Question


I am trying to develop the software for college students, we will provide device to the students (tab/laptops) they must need to log in their credentials using the device that we provided to the student. E.g. If student 1 tried to log in from student 2's tab/laptop, then it needs to be rejected.


Is there any way available to get the MAC address of the client's PC using PHP, and JavaScript?


We developed web applications using PHP 5.3 with jQuery and JS, also another is Laravel with PHP 8.1.


Is there any best way available to restrict the user to login from only the device specified?


I have tried by controlling the user via MAC address using this answer but it's not working in our case.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Is there a way to calculate "suggestedMaxPriorityFeePerGas and suggestedMaxFeePerGas", same way the INFURA Gas API do for BNB Network

 Programing Coderfunda     September 02, 2024     No comments   

The Infura Gas API response for bnb net :
{
"low": {
"suggestedMaxPriorityFeePerGas": "4.7",
"suggestedMaxFeePerGas": "4.7",
"minWaitTimeEstimate": 15000,
"maxWaitTimeEstimate": 60000
},
"medium": {
"suggestedMaxPriorityFeePerGas": "4.85",
"suggestedMaxFeePerGas": "4.85",
"minWaitTimeEstimate": 15000,
"maxWaitTimeEstimate": 45000
},
"high": {
"suggestedMaxPriorityFeePerGas": "4.9",
"suggestedMaxFeePerGas": "4.9",
"minWaitTimeEstimate": 15000,
"maxWaitTimeEstimate": 30000
},
"estimatedBaseFee": "0.0",
"networkCongestion": 0,
"latestPriorityFeeRange": [
"4.85",
"4.85"
],
"historicalPriorityFeeRange": [
"4.85",
"5"
],
"historicalBaseFeeRange": [
"0",
"0"
],
"priorityFeeTrend": "down",
"baseFeeTrend": "down",
"version": "0.0.1"
}



suggestedMaxPriorityFeePerGas returned by API for low, medium and high are not static.

My question is how can I calculate the suggestedMaxFeePerGas when suggestedMaxPriorityFeePerGas is dynamic and the baseFee is zero too (not just in this case. it's always zero, for BNB).


I'm a beginner and what I know is that the

MaxFeePerGas = BaseFeePerGas + MaxPriorityFeePerGas


But in this case baseFeePerGas is 0 & MaxPriorityFeePerGas is dynamic (which I can't figure out, how to calculate)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to cast an HTMLElement to a React element?

 Programing Coderfunda     September 02, 2024     No comments   

I am working on a React application that uses an external library in Vanilla JS that creates DOM elements using document.createElement(...). Some of this data I want to insert into my React elements. If I have a simple application:
let sub = React.createElement('p', null, 'Made with React'),
main = React.createElement('div', null, [sub])

React.render(main, document.getElementById('app'));



It renders with the content

Made with React. If I try it with document.createElement instead, nothing is rendered.
let sub = document.createElement('p');
sub.innerText = 'Not React';
let main = React.createElement('div', null, [sub])

React.render(main, document.getElementById('app'));



I have currently found a workaround using dangerouslySetInnerHTML.
let sub = document.createElement('p');
sub.innerText = 'Not React';
let main = React.createElement('div', {dangerouslySetInnerHTML: {__html: sub.outerHTML}});

React.render(main, document.getElementById('app'));



This renders but doesn't seem safe. What is the proper way to append HTMLElement as React child elements?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Let's build a Twitter clone with Livewire 3 & Laravel Reverb | 5 - Styling Tweet

 Programing Coderfunda     September 02, 2024     No comments   

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

01 September, 2024

How to generate a parse error after exactly one expression

 Programing Coderfunda     September 01, 2024     No comments   

I have following ANTLR grammar:
start :
expression
;

expression
:
| dateOperatorExpression
| numberOperatorExpression
| stringOperatorExpression
| methodBooleanExpression
| doubleMethodOperatorExpression
| numberInExpression
| stringInExpression
| bracketExpression
| andExpression
| orExpression
| notExpression
;

numberInExpression:
| WS? METHOD WS? IN WS? '{' WS? NUMBER (WS? ',' WS? NUMBER)* '}' WS?
;

stringInExpression:
| WS? METHOD WS? IN WS? '{' WS? STRING (WS? ',' WS? STRING)* '}' WS?
;

dateOperatorExpression:
| WS? DATE WS? OPERATOR WS? DATE WS?
| WS? DATE WS? OPERATOR WS? METHOD WS?
| WS? METHOD WS? OPERATOR WS? DATE WS?
| WS? DATE WS? OPERATOR WS? NULLVALUE WS?
| WS? NULLVALUE WS? OPERATOR WS? DATE WS?
;
numberOperatorExpression:
| WS? NUMBER WS? OPERATOR WS? NUMBER WS?
| WS? NUMBER WS? OPERATOR WS? METHOD WS?
| WS? METHOD WS? OPERATOR WS? NUMBER WS?
| WS? NUMBER WS? OPERATOR WS? NULLVALUE WS?
| WS? NULLVALUE WS? OPERATOR WS? NUMBER WS?
;
stringOperatorExpression:
| WS? STRING WS? OPERATOR WS? STRING WS?
| WS? STRING WS? OPERATOR WS? METHOD WS?
| WS? METHOD WS? OPERATOR WS? STRING WS?
| WS? STRING WS? OPERATOR WS? NULLVALUE WS?
| WS? NULLVALUE WS? OPERATOR WS? STRING WS?
;
doubleMethodOperatorExpression:
| WS? METHOD WS? OPERATOR WS? METHOD WS?
| WS? METHOD WS? OPERATOR WS? NULLVALUE WS?
| WS? NULLVALUE WS? OPERATOR WS? METHOD WS?
;
methodBooleanExpression:
| WS? METHOD WS? OPERATOR WS? BOOLEAN WS?
| WS? BOOLEAN WS? OPERATOR WS? METHOD WS?
;

bracketExpression:
| '(' WS? expression WS? ')'
;
andExpression
:
| AND WS? '(' expression (',' expression)* WS? ')'
;
orExpression
:
| OR WS? '(' expression (',' expression)* WS? ')'
;
notExpression
:
| NOT WS? expression
;

WS: (' ' | '\t' | '\r' | '\n')+ -> skip;
AND: 'AND' | 'and';
OR: 'OR' | 'or';
NOT: 'NOT' | 'not' | '!';
IN: 'IN' | 'in';

OPERATOR: '==' | '!=' | '>' | '=' | '= 25), not(father.address.street != null)), firstName in {"John", "Pete"})



The parser only takes and((retired == true)) and ignores the rest. So, I thought about simply changing the grammar as follows, and then printing a warning of multiple expressions were parsed:
start :
(expression)+
;



But this gives the error: "rule start contains a closure with at least one alternative that can match an empty string". Why is that? How can (expression)+ match an empty string, if expression can't?


How can I achieve what I want?
Thanks,
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Patented Private Label Seller in Amazon [closed]

 Programing Coderfunda     September 01, 2024     No comments   

We are going to launch a private label product and there are many other sellers. But nowadays appeared one patented seller. Can they leave out of this market by complaining to Amazon?


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

Must-Know Tips for Efficient Laravel Apps (Not just selecting only needed columns, eager loading instead of lazy loading, caching queries, using queues, indexes, and more)

 Programing Coderfunda     September 01, 2024     No comments   

Hey everyone! 👋

I recently wrote an article on some essential tips for making your Laravel apps more efficient. But this isn’t just the typical like selecting only needed columns, eager loading, caching, or using indexes. I dive into some lesser-discussed but highly impactful strategies that can really make a difference in your app’s performance.

If you’re looking to optimize your Laravel projects beyond the usual tips, check it out!

👉 Must-Know Tips for Efficient Laravel Apps

Would love to hear your thoughts and any additional tips you might have! submitted by /u/summonshr
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to put a header file curses.h/ncurses.h for work in vscode? [duplicate]

 Programing Coderfunda     September 01, 2024     No comments   

I am learning programming in C, and on the Internet I came across an interesting header file ncurses, with which you can create many interesting things. But I ran into a problem, I did not find a normal explanation of how to install this file for the Windows operating system (not a single method worked). Please tell me, is it possible to install this file in Windows?


I tried to install it using some popular methods (linking), but nothing worked.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to set the shutter time but leave the ISO (sensitivity) on auto on android

 Programing Coderfunda     September 01, 2024     No comments   

I am building an Android app with the Camera2 API that uses short shutter times, 1/1000 and 1/2000.
I can set the SENSOR_EXPOSURE_TIME without any problem. But I want to keep the ISO (SENSOR_SENSITIVITY) on auto mode.


To set the shutter speed I use the following code:
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_OFF);
mPreviewRequestBuilder.set(CaptureRequest.SENSOR_EXPOSURE_TIME, EXPOSURE);
mCaptureSession.setRepeatingRequest(mPreviewRequestBuilder.build(), null, surfaceView.getmBackgroundHandler());



This code works OK, but because the CONTROL_AE_MODE is set to CONTROL_AE_MODE_OFF the ISO (SENSOR_SENSITIVITY) has to be set manually also. And this is what I don't want, I want to keep the ISO on auto.


Is there any way to accomplish this or is there a workaround?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

11 August, 2024

Minimum number that can fit in a box [closed]

 Programing Coderfunda     August 11, 2024     No comments   

There is a box variable containing up to 4 balls and variables called balls A and B. There must be at least one ball A and B in the box. I would like to get the Java code for this.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Securing Patient Health Data in Laravel: HIPAA-Compliant Encryption and Decryption

 Programing Coderfunda     August 11, 2024     No comments   

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

10 August, 2024

Instaloader stopped downloading at 12th posts

 Programing Coderfunda     August 10, 2024     No comments   

Instaloader newest version 4.12.1 on Python 3.11.5 stopped downloading at the 12th post without raising any exception even though the user has 48 downloadable posts.
L = instaloader.Instaloader(
download_videos=False,
download_video_thumbnails=False,
save_metadata=False,
user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36',
)
# L.login("USER", "PASS")
full_directory_path = os.path.join(root, username)
if not os.path.exists(full_directory_path):
os.makedirs(full_directory_path)
L.dirname_pattern = full_directory_path
L.download_profile(username,profile_pic=False)
print(Fore.GREEN + Style.BRIGHT + "\n* Download complete\n.")



This is my code, I have tried to download with an account logged in as well but it does not even download a single post (no exception was raised).



profile thuwu_ could also be downloaded anonymously. Retrieving posts
from profile thuwu_.



* Download complete .






Process finished with exit code 0



The problem here was it used to run flawlessly, I don't know what the problem here. And I tried to change my IP also but that does not work either.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Find the folderID from a shared fileID [duplicate]

 Programing Coderfunda     August 10, 2024     No comments   

how I can analyse the folderID from a file with is shared with me an i know the fileID?


Is there any way About Google-Scripting?


Greetings


I have done the following so far without success:




*

I search about the WEB-Interface - here I see only "Shared with me"


*

I checked it wit the API-Explorer:
https://developers.google.com/drive/api/reference/rest/v3?hl=de
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Build Your Own Assistant with Laravel Livewire — using your Data and Streamed Content

 Programing Coderfunda     August 10, 2024     No comments   

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

InputStream and Reader subclass hierarchy difference [closed]

 Programing Coderfunda     August 10, 2024     No comments   

The InputStream abstract class has FileInputStream and FilterInputStream as a direct subclass. FileInputStream has all necessary code to establish an input connection from a file, whereas FilterInputStream is created as a wrapper which acts as a decorator and facilitates other classes extending it to provide a specific and specialized operation on InputStream, hence BufferedInputStream is a subclass of it and provide buffering capabilities by introducing an in-memory byte-array which acts as a storage for reducing System input calls directly to the file-system. This complete hierarchy makes sense.


pictorial representation -
InputStream ---> FileInputStream
|
|
---> FilterInputStream ---> BufferedInputStream



But then the Reader abstract class has FilterReader as a direct subclass but FileReader is not a direct subclass, FileReader extends InputStreamReader, and BufferedReader is a direct subclass of Reader and not of FilterReader, again why this decision is taken.


pictorial representation of this as well
Reader ---> InputStreamReader ---> FileReader
|
---> FilterReader
|
---> BufferedReader



Let me summarize all my queries in bullet pointers for easy answering -



* Why BufferedReader is a direct subclass of Reader and not extend FilterReader, as in the InputStream hierarchy.

* Why does FileReader extend InputStreamReader and not directly a subclass of Reader ?

* What capabilities were given to InputStreamReader because of which FileReader was kept a subclass of it?

* Why are those capabilities of InputStreamReader not given to FilterReader? If it was done that way, maybe the Reader abstract class might have the same hierarchy as InputStream.

* FilterReader might have been designed such that InputStreamReader can extend it and then provide an extra specialised wrapper on Reader for input-stream-specific purposes, which then can be further utilized. Why keep it a direct subclass instead?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

09 August, 2024

C++ Templates - Guarantee A Type Definition Has a Particular Constructor Signature?

 Programing Coderfunda     August 09, 2024     No comments   

#include
#include
#include

struct AppleMakeInfo {};

template class Apple {
static_assert(std::is_base_of::value, "T must be derived from AppleMakeInfo");

public:
std::function deleteFunc;

~Apple() { deleteFunc(); }

Apple(T* aMI) {};
};

template class AppleManager
{
static_assert(std::is_base_of::value, "T must be derived from AppleMakeInfo");
static_assert(std::is_base_of::value, "U must be derived from Apple");

public:

static U* MakeApple(T* aMI, std::function dF)
{
U* ret = new U(aMI);
ret->deleteFunc = dF;
All.push_back(ret);
return ret;
}

private:
AppleManager() {};

static std::vector All;
};

struct GrannySmithMakeInfo :public AppleMakeInfo {};

class GrannySmith :public Apple {};

class GrannySmithManager :public AppleManager {};



The above code block mostly compiles, however I am having trouble with one line causing a compile error:


U* ret = new U(aMI)


This line, during compilation, will show the following error in my IDE (compile error C2665):


'GrannySmith::GrannySmith': no overloaded function could convert all the argument types


To me, this reads like the typename U of the AppleManager template class does not have a constructor with a signature that matches new U(aMI) because nothing in my source indicates a guarantee/contract between AppleManager and whatever Type is provided for typename U for a constructor with the new U(aMI) signature to exist in the definition of the typename U Type. I'd use the where keyword in C# to get this kind of contract, but the closest there is for this in C++ is static_assert() which isn't actually a contract (AFAIK) but just acts the way a contract would at compile.


Assuming I'm understanding correctly and the code won't compile because there's no compiler guarantee that the type provided for typename U will have a constructor with a signature matching new U(aMI), what am I to do to provide this kind of guarantee to the compiler?


Many thanks for any help I get! I'm not so experienced with C++ so apologies if the code block above is embarrassingly amateur.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

cgi-bin on google search

 Programing Coderfunda     August 09, 2024     No comments   

I'm facing an issue with my website bpraj.online. Instead of displaying the homepage, it shows a directory listing with the following information:


mathematica
Copy code
Name Last Modified Size
Directory cgi-bin 2024-08-05 04:23 -
And below it says: "Proudly Served by LiteSpeed Web Server at www.bpraj.online Port 443."


I've already checked that the index.php file is present in the root directory, and I've ensured the server is set to point to this file. Despite this, the directory listing keeps appearing.


I've also added rules to block directory listing in my .htaccess file and updated my robots.txt to prevent indexing. Additionally, I've tried removing the URL from Google Search Console, but the issue persists.


Has anyone faced a similar issue or knows how to resolve this? Any guidance or suggestions would be greatly appreciated.


Thank you in advance for your help!


I've tried the following steps to resolve the issue:


.htaccess and robots.txt: I added rules to block directory listing in my .htaccess file and updated my robots.txt to prevent indexing, expecting it to stop showing the directory contents and display the homepage instead.


Google Search Console: I edited settings in Google Search Console and attempted to remove the indexed URL, hoping it would refresh Google's view and remove the directory listing from search results.


Favicon/Icon Issue: Additionally, my site icon is not appearing in Google search results. I've added the appropriate meta tags and linked the favicon, but it still doesn't show.


Despite these efforts, the problems persist.


Has anyone faced a similar issue or knows how to resolve this? Any guidance or suggestions would be greatly appreciated.


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

Spyder console: Avoid empty lines in REPL output

 Programing Coderfunda     August 09, 2024     No comments   

I am using Anaconda's Spyder. In the console, I want to see more of the historical output, including warnings/errors. Since the Spyder uses IPython, I found from here that avoid the vertical white space by putting the following into the IPython config files: c.InteractiveShell.separate_in = ''. From here, I found that the config file is c:/Users/User.Name/.ipython/profile_default/ipython_config.py. It didn't exist, so I created it with the one line above. The Spyder console output still contains too much vertical white space. What else can I try?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Mapping json to class/model

 Programing Coderfunda     August 09, 2024     No comments   

Hello, I've looked into this few times, but decided to ask here if someone has found better solution.

I'm looking for some kind of package/or built in function, that can map JSON to Class/Model, similar to how you can map JSON to Struct in Go.

I found few small libraries but they are either too old or does not do exactly this.

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

How to implement something like an SDK? [closed]

 Programing Coderfunda     August 09, 2024     No comments   

I'm developing a Rust application, with some feature to be implemeted in Python. I plan to expose some Python function API to users, so that users can write their own Python code with these functions imported. Then they put their code in a directory, and my application can run the script.


I'm not quite clear how to implement this.
1)In what format should I provide my method code to user, should it be in form of DLL or .whl, or just Python scource?
2)If the application run user script with pyo3, how to process my method code called in the script?


Update: To be more forcused.
My application would also run a client side, it would include user written script to accomplish some feature.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

08 August, 2024

How to use return value from method in Java?

 Programing Coderfunda     August 08, 2024     No comments   

I want to use the return value from a member function by storing it into a variable and then using it. For example:

public int give_value(int x,int y) {
int a=0,b=0,c;
c=a+b;
return c;
}

public int sum(int c){
System.out.println("sum="+c);
}

public static void main(String[] args){
obj1.give_value(5,6);
obj2.sum(..??..); //what to write here so that i can use value of return c
//in obj2.sum
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Opinions on this Laravel Actions package?

 Programing Coderfunda     August 08, 2024     No comments   


https://www.laravelactions.com/

Has anyone used it and stopped using it? What were your reasons?

Anyone loving it and use it for everything? submitted by /u/Fluffy-Bus4822
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Real World Laravel - Adding user events to my SaaS app

 Programing Coderfunda     August 08, 2024     No comments   

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

Fully automated API documentation generation for Laravel with Scramble

 Programing Coderfunda     August 08, 2024     No comments   

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

07 August, 2024

Yet another repository pattern post... Developers that don't use repository pattern and think it's redundant and over-engineering, where do you leave the complex queries of your project at?

 Programing Coderfunda     August 07, 2024     No comments   

Just for context first, I'm rewriting an old application that used Laravel 8 and many things went wrong due to the lack of experience in the dev team (juniors and even seniors that had never used Laravel before). A lot of repeated functions, gigantic methods, bad practices, etc. You got the idea.

So now I'm rewriting it, while trying to make it follow some patterns and also follow some guidelines for a better and cleaner code, for improved readability and maintenance later on.

With all that said, I spent this week reading a lot about the use of Service and Repository Patterns in Laravel, and I started doing it using both but now I get why some people said that it's over-engineering because for like 85% of the Models in the old project (there are more than 150 models), the respective repositories class will only have basic Eloquent methods. The repository will have method create() that has one line that is just calling the same model with $model->create(). So for a good chunk of the project the repositories will be kinda useless.

The problem is the other 15% of the Models and data in general... a lot of the pages in our system shows statistics charts (line, pie, bar, polar, radar, etc) using ChartJS, and most of the queries for generating those charts are very complex and not using Eloquent, and just plain SQL as this is easier to write when you are dealing with a SQL with 80 lines or more, some even use database stored procedures and db functions calls.

Because of those queries, I wanted to go for the repository pattern but now I'm not so sure as there is so much redundancy for a good part of the code like I said before.

I spent some time searching, and for getting more inputs from other Laravel developers, I wanted to ask to you guys that work in complex projects, where do you store very complex queries? Specially those that are not even using Eloquent methods to be generated?

I saw some people leaving those complex, DB raw plain SQL queries at the Controller itself, others on a Service class, some people left them directly inside the Models as a method to be called like $user->getComplexChartData() after using a User::find($id), some create an Utils class, other guy made a class called UserCharts class inside a new directory called Charts...

The thing is, none of the solutions I saw looked like the "perfect match" for me.

How do you guys handle those?

edit: just adding that the queries result have to obviosuly be manipulated by the PHP for adding/treating some data, so that's why its planned to be on a method for each submitted by /u/Cthulhu-Cultist
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Eloquent copy-on-write: automatically copy all model changes

 Programing Coderfunda     August 07, 2024     No comments   


https://github.com/inmanturbo/ecow

I made a package which uses event sourcing and eloquent wildcard creating*, updating*, and deleting* events to automatically record all changes to all eloquent models. Unlike most similiar packages, it doesn't require adding a trait to your models to use it. And unlike most event sourcing packages it's very simple to use and it requires no setup aside from running a migration.

Rather than manually fire events and store them to be used by aggregates and projectors, then writing logic to adapt and project them out into models, it uses laravel's native events that are already fired for you and stores and projects them into the model automatically using eloquent and active record. Events are stored in a format that can be replayed or retrieved later and aggregated into something with a broader scope than just the model itself, or to be used for auditing, analytics and writing future businesses logic. submitted by /u/Gloomy_Ad_9120
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

As a developer, how may I add userfields on form in "Sales UOM and Package Types" and let the matrix controls?

 Programing Coderfunda     August 07, 2024     No comments   

How can I add userfields on form in "Sales UOM and Package Types" and let the matrix controls it like it does with "Qty per pakage" ?


I'm using C# to create fields. This form has FormType 1470000010 and I aber to create event and controller classes and add fields binded with ITM4, only get the first register and bind to it (I tryed to set value in dbdatasource "ITM4", passing offset, but seems I cannot change not user defined data source.


Here the screen below as example (forget the title form, my focus is on Sales UOM and Package Types, that is the same form). When select a Package type, the default fields works fine and saves temporary tha values after update in "Sales UOM and Package Types"





What's is the ideal way to add it and link to?
I tryed too to create 2 userdatasources, and listen to matrix click and edittext Lost focus to update the values using dbdatasource with "ITM4" and get value passing offset as nextselectrow of matrix. It works, but just for the moment, I''ll need to create a datatable in this scren or Master Data Item, not sure what is best, to save the result and after update document, update the user fields (this could solution, but I'm not sure if i'm losing a more simple way).
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

From Idea to Merged Laravel Pull Request ✅

 Programing Coderfunda     August 07, 2024     No comments   

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

How to Sign a JSON Using USB DSC Hardware

 Programing Coderfunda     August 07, 2024     No comments   

I am working on a project where I need to sign a JSON object using a Digital Signature Certificate (DSC) stored on a USB token.


I understand that the private key is not directly extractable from the hardware for security reasons. Instead, the signing operation should be performed by the DSC hardware itself.


Here’s what I need help with:


Accessing the DSC Hardware:


What tools or libraries are needed to interact with USB DSC hardware? How can I communicate with the USB token to perform signing?


I tried using C# code to sign JSON with a USB DSC hardware, but it didn’t work
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...
  • 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...
  • C++ in Hindi Introduction
    C ++ का परिचय C ++ एक ऑब्जेक्ट ओरिएंटेड प्रोग्रामिंग लैंग्वेज है। C ++ को Bjarne Stroustrup द्वारा विकसित किया गया था। C ++ में आने से पह...
  • 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