why we have to save the name of CI controller class name by capital letter - codeigniter-2

when we inheriting the class controller in codeignator so why we have to write the class name by capital letter and why we have to save by class name
Blockquote

Related

Quarkus + Panache + Active Record Pattern + Inheritance problem

I can create a Base class that extends PanacheMongoEntity (example below) and the Child class extending Base works as expected. However, if I move the Base class into a separate JAR file (e.g., core.jar), I get an error “java.lang.IllegalStateException: This method is normally automatically overridden in subclasses” when calling Child.listAll().
public class Base extends PanacheMongoEntity {
public String modifiedDate;
}
public class Child extends Base {
public String name;
}
// works
Child.listAll();
As mentioned, if the Base class and Child class are compiled at the same time, it works. But moving Base to a JAR and including as a dependency does not work.
For all external jars to get scanned by Quarkus, you need to add an empty beans.xml in /src/main/resources/META-INF in your external project.
This is described somewhere on Quarkus guides.

spring boot mapping without slash

I'm having a controller mapping as shown below
#RestController
#RequestMapping("/v1/connector")
public class Controller
and the API mapping as below
#GetMapping("2/auth")
when I hit the URL it's giving me the response as request URL not found.
Can anyone tell why I'm getting this?
#GetMapping is a composed annotation that acts as a shortcut for #RequestMapping(method = RequestMethod. GET).
#RequestMapping maps HTTP requests to handler methods of MVC and REST controllers.
When you use a base path on your controller class, all controllers in that class accept URL paths that start with your given base path. In your case:
#RestController
#RequestMapping("/v1/connector")
public class Controller {
...
}
This means all of the controllers inside this class have the base path of /v1/connector and this means is a constant part of your URL and cant be changed.
So when you declare a #GetMapping("2/auth"), Spring will automatically add a / at the beginning of your path if there was no /. And your path will be http://YOUR-HOST-NAME/v1/connector/2/auth instead of http://YOUR-HOST-NAME/v1/connector2/auth.
See here for more clarification.
So If your application has paths like /v1/connector1, /v1/connector2, /v1/connector3, etc. It means the connector{n} is not constant and you must declare it on each of your controllers' methods separately.
#RestController
#RequestMapping("/v1")
public class Controller {
#GetMapping("/connector2/auth")
...
#GetMapping("/connector3/auth")
...
.
.
.
}

Override a vendor class which is not directly called - Laravel

I have two classes namely class A and class B of a package. class B is injected into class A's constructor through dependency injection.
I need to override a function in class B. To do this I have:
Cloned class B to a new Class C and changed that required function.
Bound the new class C to class B in service provider:
$this->app->bind(ClassB::class, function() use ($app){
return $app->make(ClassC::class);
});
I'm now getting the error Class A expects instance of class B only.
Any help would be appreciated.
PS I am trying to implement an insert-ignore function instead of insert in laravel excel package
Thanks

findBy throws error when field name contains underscore

I'm having an Item class with a property named vendor_name as below:
#Entity
#Table(name="item_info")
public class Item {
#Column(name="vendor_name")
protected String vendor_name;
/* Getter/Setter methods */
I'm trying to write a CRUDRepository interface to return Items based on vendor_name:
#Repository
public interface ItemDAO extends CrudRepository<Item, Integer>{
public Item findByVendor__name(#Param("vendor_name") String vendor_name);
}
According to the docs, if there is an underscore in the property name,then we need to escape the underscore in the findBy method by adding an additional underscore. However, I'm still getting an error saying "no property named vendor found for type Item".
I cannot remove the underscore from the property. Is there any other way to solve this?
From Spring Data JPA documentation:
As we treat underscore as a reserved character we strongly advise to follow standard Java naming conventions (i.e. not using underscores in property names but camel case instead).

Flattening hierarchical data with Linq in VB.NET

Given the following structure:
Public Class Vendor
Public Property Accounts As Account()
End Class
Public Class Account
Public Property Services As Service()
End Class
Public Class Service
Public Property Name As String
End Class
How do I get a flat list of all included Services in all accounts given a single Vendor? This is what I've tried so far:
vendor.Accounts.Select(Function(acct) acct.Services) 'Returns a collection of services collections
I know I'm just missing an obvious operator.
You're looking for SelectMany.
vendor.Accounts.SelectMany(Function(acct) acct.Services)
And if you want only the unique ones, slap a .Distinct() on the end.

Resources