I am getting this userFriendlyException when creating the tenant with some numeric , char or space . I tried removing the regex in data annotation but it didn't work.
Tenancy name is a special variable in ASP.NET Boilerplate. In multi tenant configuration tenancy names can be sub-domain. So URL cannot contain invalid characters. Also tenancy names are used in database connection strings when tenant per database option is selected. That's why again tenancy name cannot contain invalid characters for a connection string.
Against those rules, you still insist on removing that rule. You can! Actually there must be two regex expressions both in DTO and Entity itself. Try to remove those and see the result.
Related
I am writing a multi-language dictionary app. When the user selects a language to use data from, that language should apply to every page until they select a different language. Ideally, the language should be part of the URL so that the address for the English word "double" and the French word "double" is different. It should also be possible to specify no language, so that "double" would display both the English and the French word. I will also want to filter the data on multiple fields at the same time, e.g. the word itself and the language.
I'm trying to fit this into the Laravel resource concept. The index view of Word should show all words filtered by the language, or not filtered if no language is specified. create should keep the language from index. store should just use the form data. The language can be included as a hidden field in the create view if it's been specified. show doesn't strict speaking need a language filter, but if the user then goes back to index, the filter will still need to be applied.
I started using routes, but that means I'll have to hard-code a route for every filter. I've also thought of using session data, but that means the URLs wouldn't include the filter. If the filters are appended as a query string how would Laravel access them? Is this a good solution?
I'm using Laravel 5.8. What's the best Laravel way to persist this type of data filter across views?
I have similar issues in many areas of our apps. We occasionally use Session for this, but generally find the most efficient and easiest way to solve this is to attach a database field to the user object.
If you are using any type of auth, Laravel is already going to boot the user object on every page view, thus the filter can be pulled with no extra calls to the database. If no language is specified, the \Auth::user()->current_lang_id will be null, and thus no filter would be applied. We typically use a relationship (e.g. 'currentLang()') which makes it easy for the user to see the language and can automate binding on the form.
The nice part of this, we've found, is that it individualizes it per user, and it 'remembers' the user's preferences between sessions in a simple way - no need to make dozens of routes or a special variable + logic on multiple routes because those routes include your filter. Instead, you can put your logic at the top of a base controller and be done with it.
Lastly - changing the language when it is a db field on the user is just standard, simple CRUD.
HTH
I have a microservice endpoint that gets a list of company details from the DB. The URL pattern looks like this.
GET https://example.com/api/v1/companies
I need to develop another URL that fetches only the company names from DB. I understand I can reuse the same URL, but to fetch only one column i don't want to fetch all columns.
Please guide me how to have the url pattern for this case.
Ex: GET https://example.com/api/v1/companies/companyNames?
We should not increase number of services exposed until it is really needed. I will recommend re-using the same service with format:
GET https://example.com/api/v1/companies?col=name
If col parameter is blank you can assume to return all columns. This will help you re-use the codebase; minimal changes; and lots of flexibility in future; and less confusion for end consumer.
Is there a setting to allow multiple nodes with the same URL?
We've setup a small CMS type system where web content admins can add new pages with content and widgets to the website.
They sometimes make the mistake of adding the same name to multiple pages under the same parent causing 2 nodes to have the same URL. I would rather not showing and ignoring the duplicate than throwing an exception.
The URL (when supplied) is used as a key of a dictionary. By definition, the key of a dictionary must be unique. Even if the duplicate URL check were removed, the dictionary would throw a more cryptic duplicate key exception.
I would suggest sanitizing the data before reading it with IDynamicNodeProvider or ISiteMapNodeProvider.
Options
Add a check to the data entry form to ensure the URL is unique before allowing it to be saved.
Put a unique constraint on the URL field in your database to throw an exception upon data entry instead of when it is read.
Put a distinct filter in your query so only one of the duplicate URL records is considered when adding them to the SiteMap.
Consider using controller, action, and id (from the primary key) when using data-driven URLs. The only thing that really needs to be data-driven are the Routes, and the URLs will be resolved correctly within MvcSiteMapProvider.
Is there any way to allow spaces in user names Name Givenname and characters like ščťžýáíéúô (any UTF-8 characters) in CodeIgniter Tank Auth library?
I was browse code but I do not know hot to allow it? And aloso I need to allow duplicate usernames (need only email to be unique).
EDIT:
When I trying to register new user I get this error.
http://i.stack.imgur.com/jhxEO.png
I don't think Tank Auth places any restrictions on spaces/characters in the username, it's more likely to be the collation on your users table. Tank Auth uses SQL LOWER() functions to compare usernames to input, so SQL LOWER('whatever is in the DB') must equal PHP strtolower('whatever the user entered').
If your users table is not defined with collation UTF8_GENERAL_CI, try changing it to that.
If that doesn't fix it, the code in models/tank_auth/users.php is very simple, so you can easily adapt it to meet your needs.
I have a question concerning spring roo and databases.
I have a field called personName, in oracle to column is create as person_Name
I there a way to avoid the underscore. I suppose naming my column personname would fix this, but can I ask spring not to add the underscore ?
If you need a general solution (instead of "fixing" some single points (abaloghs answer)), you can specify a Naming Strategy for your JPA provider.
For an example see: JPA (Hibernate) and custom table prefixes
Roo by default refers to the JPA implementation to determine column names. You can override the defaults with the --column property:
entity --class Foo
field string --fieldName FooBar --column fooBar
Bonjour,
by the way, I do not think that it is possible to reverse engineer a database with underscores in table names :
the corresponding domain classes will be created and compiled since Java accept undersocres in class names
the tests will be performed without raising any issue
everything will be scaffold for the GUI
you will succesfully deploy it on tomcat and your application page will show up in your browser
You may fill the form to create a new instance of your object
But if you click on SAVE --> internal error
If you have a look at the tomcat log, you will fid the well known exception : javax.servlet.jsp.JspTagException: No message found under code ...
The reason is that your class name has been truncated in the message_xx.properties files.
Everything before the underscore is dropped and thus, no message is found in order to display that your record has been successfully saved.
It would be nice that the ROO shell raise an error when the jpa entity is created and not at runtime ...