Connecting lenskit 3.0 data access model to jdbc - lenskit

I am building a recommender engine for our ecommerce application. The easiest way is to deploy the recommender system to java web server and implement a REST API for it.
I am trying to get the data from the database directly, but I didn't find any documentation that can help me to connect lenskit 3.0 to JDBC.
Can anyone please explain how to connect the lenskit to database and how to customize Rating.class, User.class and Item.class so it can contain the user country and city, and show whether the item is in stock or not ?

In LensKit 3, the way to work with custom data is to directly use Entity objects. Users, items, and ratings, are just entities; the User, Item, and Rating classes are view classes that provide convenience access to common attributes, but the base Entity interface allows you to use arbitrary attributes. The data model is documented at https://lenskit.gitbooks.io/lenskit-manual/basics/data-model.html; it is also possible to create your own view classes, but this is not currently documented.
To use JDBC, you will need to reimplement the DataAccessObject interface on top of JDBC. Building a reference implementation of this functionality is on the TODO list, but has not yet been done.

Related

Implementing Feature Managment in AspNetBoilerplate

I am trying to figure out the 'appropriate' way to implement Feature Management in aspnetboilerplate ABP/(actually AspNetZero)
Here is my specific business situation: I want to limit through Features/Editions, the number of Organizational Units a tenant is able to create.
Im not sure where this should be implemented. In the Application layer? My research in the code, for example ABPZero implements a IUserPolicy/UserPolicy to manage users creation. This is implemented in the Core project. But Im embarassed to say that I can't find and OrganizationUnit.cs class in order to implement this correctly.
Any help is appreciated.
--Dave

Spring Boot Rest Multilanguage

I have an application, that uses Angular 2 for UI and Spring Boot Rest as a microservice. As a database, I have PostgreSQL.
I want this project to support multi-languages.
I heard that spring has something called i18n, but I don't know how to implement it.
One of my microservice is called categories, and what it does is CRUD operations. The default language is English, but I want to add french. So, if a call is like this:
get: http://localhost:8080/categories?lang=fr
I will get all the categories, where lang = 'fr'
Also, probably I will add a table called static_texts, where I will add words to translate, like: contact, menu, testimonials, etc. And for these words, when a user entered for the first time on site, angular will make a call to java to get all the static words, to save in a session, and to add those into the template.
Like this I see the multilanguage system, but, I don't understand how to implement it into my project. Do you have an example, because I couldn't find anything for what I need?
Thanks!
Spring Boot can manage any number of locales in an application flawlessly. Internationalization is a great way to increase users on a product so there are no limits in terms of how users use your product.
The first and simple solution is to implement a LocaleResolver and LocaleChangeInterceptor for managing some resource files for different languages. you can see this tutorial.
However, this approach depends on the access to the application’s resource files when adding a new supported language or modify the existing message files. In case an end-user is responsible for this job and obviously, this is not an optimal approach.
Hence, the second method shows how to move all of our localized messages to a database. This enables the end-user to add a new language or update existing localized messages at runtime with the help of i18n. In this tutorial you'll see how to use your table for translated texts

Is there a Joomla (3.x) development API for creating and managing custom user groups?

I just started with Joomla 3.x and I'm writing a component for Joomla v3 which is supposed to create new usergroups for creating 'groups'- the design requirements being:
An organisation may set up a group to offer access to some set of services -including communication but also also other types of services - to their members
(the other services is the reason why I believe the community and forum joomla extensions are not suitable- they mostly focus at fora and social media services, not the services I will implement.)
Other persons/members of the organisation may register to this group, which allow him/her to access these services
ps: it is also possible for person to set up a personal account and get access to the set of services. This person may also join one or more groups at a later stage
How to do code the creating of new usergroups? I noticed a possible suggested solution at How to create custom User Group Programmatically in Joomla 3.x, but I struggle to understand how to use the suggested JTableUsergroup class because of the limited documentation at http://docs.joomla.org/API17:JTableUsergroup(?) Does creating an instance of JTableUsergroup results in the creation of a new customer user group?
Another question: how to add users to a customer usergroup? The only hint I found was at http://api.joomla.org/cms-3/classes/JUserHelper.html - using the method addUserToGroup of class JUserHelper.
Many of the Joomla development concepts are well document but I could not find one for managing custom user groups...
Appreciate your help;-)
First, overall, the best consistent documentation of Joomla APIs is in the docblocks for the classes. Then to be honest what I do a lot of times is to search for where in the core the API is used. There are some great pieces of narrative documentation in the wiki, but on the whole I always start with the docblocks which are very complete. However in this case it's pretty simple.
You need to do something along the lines of
$newrow = JTable::getInstance('Usergroup');
//code to add your data
$newtable->save(); // Shortcut for check, bind, store
However, if I were you I would look carefully at UsersModelGroup because there are a lot of other things that should normally happen in this process such as running the user plugins. So I might include and extend that model (which manages the table class) rather than going to the table class directly. In fact your whole component might even be able to extend almost all of the users component or it might also be possible that you could do what you want with plugins rather than reinventing the whole thing.
In terms of assigning users to groups that is trickier because of some legacy things in the code. I think the setter followed by a $user->save() ($user being a JUser instance) is probably the way to go when adding to groups. What I probably would do is to write a custom JFormField that would manage opt-in groups because the core usergroup field includes everything. You could extend that and exclude the groups that you want to have only managed by admin.

Prism DAL when / where to access

General question, when do people access their DAL in a prism application?
That is to say, if a module requires data do you query the DAL on the module load (I've currently been using OnImportsSatisfiedandINavigationAware.OnNavigatedTo` (passing in a parameter from the previous view).
Obviously I wouldn't want different modules to be tightly coupled but for an example where I have multiple views in a module would it be better from the UI responsiveness point of view to retrieve the data up front and pass it into the new view?
Anyone got any thoughts on this that they could share? Thanks.
In my current project we build the application this way that all view models asynchronouls query their data from one wcf service proxy after their own initialization. The proxy itself queries them from the server and caches it internally. Thus you have to think about a caching strategy.
But this leads to the following behaviour: The user interface is build up by the region manager. At the beginning it is empty. After a short time the data arrives from the server, the view models get their model, read the data from it, the data context of the view (which is the view model) is filled up and so the view is populated.
The answer to your question is: The view model queries the DAL (in my case the wcf service proxy) after it's creation in asynchronous way.

Creating Joomla Accounts outside of a web interface

Is it possible to create a Joomla account outside the web interface. I want to create one from my Java application. If so can you give me an idea about the best way to do this?
These are my thoughts so far:
1. Create a php page that inserts the data directly into the database (but is there more to an account than simply the users table).
2. Posting the data to the register page (but will it then detect that I am not using the web interface)
Yes, it's possible. You can:
Use php to achieve it, inheriting from JUser class like explained in this thread;
Create a component using JUser in you Joomla installation, and use xml-rpc to register users using this component by calling a service from you Java application.

Resources