How to set image for android object - android-studio

I'm having trouble trying to add an image inside the object
This is my Category entity
#PrimaryKey
private int categoryId;
#ColumnInfo
private String categoryName;
#ColumnInfo
private String categoryImage;
and then I tried adding image by this
db = Room.databaseBuilder(activity.getApplicationContext(),
AppDatabase.class, "foodOrder").allowMainThreadQueries().build();
Category category = new Category
(2, "Drink", "D:\\SourceCode\\Android\\PRM\\app\\src\\main\\res\\drawable-xxxhdpi\\pizza.jpg");
db.categoryService().insertAll(category);
but it didn't show the image. So what should I do ?

You have coded a path (D:\SourceCode\Android\PRM\app\src\main\res\drawable-xxxhdpi\pizza.jpg) that is on the computer that you are developing the App on. Your computer is not available to the device/emulator at run time.
You need to save the resource name and use that to retrieve the resource.
Perhaps refer to https://developer.android.com/reference/android/content/res/Resources

Related

Playwright JAVA selector - recording vs regular

New to playwright, creating some sample stuff to find out how to use the tool.
From the image above, the getByRole works fine (while I recorded in playwright) but to get the xpath for this element it becomes like button/div and then using contains.
Question: How to use this getByRole directly in the page object model.
Currently I'm using like this:
private String txtEmail = "input[id=\"signinEmail\"]";
private String txtPwd = "input[id=\"signinPassword\"]";
private String btnLogin = "//button/div[contains(.,\"Log In\")]";

SSRS 2016 Report - Populate table from string parameter

Let's assume I have the following C# object:
public class BusinessDetails
{
public string Name { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
}
Long story short my solution [A] sends a serialised (JSON) List<BusinessDetails> to another external solution [B] that in turn feeds the RDL in question with this and other provided parameters (strings); therefore, on the RDL level I am limited to strings and strings only.
This is all good for simple, one value string parameters but I am interested in dynamically populating table from (JSON 'flattened'/string) List<BusinessDetails> in the mentioned RDL.
I see the available parameter types are:
Text
Boolean
Date/Time
Integer
Float
I guess my question is - can I use the Text/string param to dynamically populate a table in RDL?
Thanks.
short anser NO!
long answer: you dont need that, using the report viewer control you can use the list directly as datasource, when using rdlc instead of rdl you can even consume the class in the reportdesigner, you dont have to come up with ways to align your data source mapping with the data you are recieving
read this for further info: Creating a PDF from a RDLC Report in the Background

Orchard - how to access taxonomy field of a custom content type programmatically

I have a custom content type called Store, which has a Brands taxonomy field. A Store can have multiple Brands associated with it.
I have been tasked with building an import/export routine that allows the user to upload a CSV file containing new Stores and their associated Brands.
I can create the Stores other fields OK, but can't work out how to set the taxonomy field?
Can anyone tell me how I access the Taxonomy field for my custom content type?
Thanks in advance.
OK so (as Bertrand suggested), using the Import/Export feature might be a better way to go, but as a relative noob on Orchard I don't have the time to spend looking at it and couldn't find a good tutorial.
Below is an alternative approach, using the TaxonomyService to programatically assign Terms to a ContentItem.
First of all, inject the ContentManager and TaxonomyService into the constructor...
private ITaxonomyService _taxonomyService;
private IContentManager _contentManager;
public MyAdminController(IContentManager contentManager, ITaxonomyService taxonomyService)
{
_contentManager = contentManager;
_taxonomyService = taxonomyService;
}
Create your ContentItem & set the title
var item = _contentManager.New("MyContentType");
item.As<TitlePart>().Title = "My New Item";
_contentManager.Create(item);
Now we have a ContentItem to work with. Time to get your taxonomy & find your term(s)...
var taxonomy = _taxonomyService.GetTaxonomyByName("Taxonomy Name");
var termPart = _taxonomyService.GetTermByName(taxonomy.Id, "Term Name");
Add the terms to a List of type TermPart...
List<TermPart> terms = new List<TermPart>();
terms.Add(termPart);
Finally, call UpdateTerms, passing in the ContentItem, terms to assign and the name of the field on the ContentItem you want to update...
_taxonomyService.UpdateTerms(item, terms.AsEnumerable<TermPart>(), "My Field");
Hope this helps someone. Probably me next time round! : )

ARM - non continuous subaccount

According to the list of new/updated features in acumatica it mentions the following: "Specify multiple, non-continuous ranges in the data source for accounts, subaccounts,and branches in the general ledger engine."
However from what I'm seeing, this doesn't seem to apply to subaccounts.
For example in my situation, the first segment of the subaccount defines the "region".
When defining my Unit sets what I need to do is the following:
Central Region - (subacct segment AB and DE)
- Sub1 (AB)
- Sub2 (DE)
North Region (subacct segment BC)
In the Data Source, I can only specify a single "Start" and "End" subaccount which uses all in between.
Is it possible to have the "Central Region" be a summary of all the child nodes OR can I specify i want ONLY subaccts AB, DE for "Central Region"
In FRx you can do this where the "Folder" or "Parent" is a summary of the children items underneath it.
It is indeed possible, but by default the user interface will not allow you to enter the string in such a way, due to the segmented nature of the subaccount field. You can, however, customize the field so that it no longer behaves as a segmented editor. To do that, you need to create a PXCacheExtension on RMDataSourceGL which will override the StartSub/EndSub attributes. The class looks like that:
using System;
using PX.Data;
using PX.Objects.GL;
using PX.CS;
namespace PX.Objects.CS
{
[Serializable]
public partial class RMDataSourceGL : PXCacheExtension<RMDataSource>
{
[PXDBString(255, IsUnicode = true)]
[PXUIField(DisplayName = "Start Sub.")]
public virtual string StartSub { get; set; }
[PXDBString(255, IsUnicode = true)]
[PXUIField(DisplayName = "End Sub.")]
public virtual string EndSub { get; set; }
}
}
Once the customization is in place, you can put non-contiguous ranges in the StartSub/EndSub fields. Please note that the segmented key separator (usually it's '-') should not be part of the ranges. For example, assuming you want to include all subaccounts between US-00-00-00-000 and US-99-99-99-999 AND all the CA- accounts, you would put the following in the StartSub field: US?????????,CA?????????. You could also express it differently: US000000000-US999999999,CA000000000-CA999999999. The syntax is documented in the 5.0 release notes, and is the same for accounts.
As a secondary Comment for those who might be reading this, I also found that it is possible to make a Parent folder summarize the children. For Example:
CE - Central Region
AB - Sub1
DE - Sub2
Instead of specifying a Data Source for "CE", specify a Value of
=#AB+#DE

Manager Bean do not returns when the project is online

I have a JSF project working with JPA, I do this : retrive some data from mysql database then plot the data in a chart.
Locally works pretty fine, as you can see here:
So I deploy the project in my GlassFish 3 Open Source, which is running in a EC2 instance, then I try to make the same operation again but it seems the ManagedBean do not returns to the page correctly:
This is my ManageBean :
#ManagedBean(name="reportc")
#SessionScoped
public class ReportControl implements Serializable {
private static final long serialVersionUID = 3269125738504434502L;
#EJB LogEAO logEAO;
private int quantity;
#NotNull(message="informe um intervalo")
private String time;
#NotNull(message="informe um ponto")
private String point;
private Map<String, Object> data = new HashMap<String, Object>();
#PostConstruct
public void init(){
quantity = 1;
}
public String getDataAsJson() {
return new Gson().toJson(data);
}
public String generateReport(){
this.setTitles();
this.getValues(getLog());
return "/showroom/report.xhtml?faces-redirect=true";
}
.. methods and get's and set's
I already look in into my server.log to see if there's something wron but it seems everything is alright.
[#|2012-03-31T14:30:06.594+0000|WARNING|glassfish3.1.1|javax.enterprise.resource.webcontainer.jsf.application|_ThreadID=25;_ThreadName=Thread-2;|JSF1064: Unable to find or serve resource, image/structure/pic-1.gif.|#]
[#|2012-03-31T14:30:15.558+0000|FINE|glassfish3.1.1|org.eclipse.persistence.session.file:/home/ec2-user/usr/local/glassfish3/glassfish3/glassfish/domains/domain1/applications/BrainSet/WEB-INF/classes/_BrainSet.sql|_ThreadID=24;_ThreadName=Thread-2;ClassName=null;MethodName=null;|SELECT ID, TIME, VALUE, id_point FROM log WHERE (((id_point = ?) AND (TIME >= ?)) AND (TIME <= ?))
bind => [3 parameters bound]|#]
[#|2012-03-31T14:30:15.585+0000|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=24;_ThreadName=Thread-2;|EXECUTION TIME:0:0|#]
[#|2012-03-31T14:30:15.585+0000|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=24;_ThreadName=Thread-2;|LOGS SIZE : 0|#]
[#|2012-03-31T14:30:16.690+0000|WARNING|glassfish3.1.1|javax.enterprise.resource.webcontainer.jsf.application|_ThreadID=24;_ThreadName=Thread-2;|JSF1064: Unable to find or serve resource, image/structure/pic-1.gif.|#]
[#|2012-03-31T14:35:53.578+0000|FINE|glassfish3.1.1|org.eclipse.persistence.session.file:/home/ec2-user/usr/local/glassfish3/glassfish3/glassfish/domains/domain1/applications/BrainSet/WEB-INF/classes/_BrainSet.sql|_ThreadID=28;_ThreadName=Thread-2;ClassName=null;MethodName=null;|SELECT ID, TIME, VALUE, id_point FROM log WHERE (((id_point = ?) AND (TIME >= ?)) AND (TIME <= ?))
bind => [3 parameters bound]|#]
[#|2012-03-31T14:35:53.605+0000|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=28;_ThreadName=Thread-2;|EXECUTION TIME:0:0|#]
[#|2012-03-31T14:35:53.605+0000|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=28;_ThreadName=Thread-2;|LOGS SIZE : 0|#]
I really don't know why this is happening, besides is my first time trying to deploy a project which use JPA and JSF together.
What could be doing this ?
EDIT:
Just one more thing, in local mode when I click to generate the report it takes some seconds to go to the database, make the maths and return to my page, but when it's in production mode when I click to generate the report it just refresh the page, why is that happening ?
I really need to know why ... help me out guys, please.
EDIT 2:
You guys can see it online here:
http://50.19.242.172:8080/BrainSet/showroom/report.xhtml
Just played with the chart again...
I do get charts properly... could it be that you had no data gathered in the production in the beginning...? Cause now there is
Also i'm getting alerts saying
serverError: class javax.faces.el.EvaluationException For input string: "true"
check you EL expressions related to the "drop downs" of the chart....
b.t.w here another successful screenshot :
So it seems like working... you might need to redefine your question...
The solution was :
I had to give permissions to some user in MySQL, enable the remote connection in MySQL, put JDBC driver in glassfish_installation\glassfish\modules\ and restart it, initialize the logEAO and put the annotation #Table(name="table_name") because it depends of each file system in operationals system as can be seen here:
JPA: MySQL says table don't exist, but it exist actually.
Did you try Ctrl + F5 in the browser to force reload page ?

Resources