android – How do I set an item from a list view?

I have the following fragment with a custom list view. When this fragment is displayed, the item 0 ($ 2,000.00) must be selected with a credible background. When the fragment is displayed, nothing is selected. Here I leave what I have done so far:

Enter the description of the image here

FragmentPanelDinero.java

public class FragmentPanelDinero extends fragment {

private ListView listView;
private string[] money_ items;

@Nullable
@Override
public View onCreateView (@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

View rootView = inflater.inflate (R.layout.fragment_panel_money, container, false);

listView = rootView.findViewById (R.id.listViewDownLogger);

return rootView;
}

@Override
public void onActivityCreated (@Nullable Bundle savedInstanceState) {
super.onActivityCreated (savedInstanceState);

start Money Arrangement ();

AdapterFragmentPanelDinero adapter = new AdapterFragmentPanelDinero (getContext (), items_money);

listView.setAdapter (adapter);

View item = listView.getAdapter (). GetView (0, null, listView);
item.setSelected (true);
}}

Hintergrundelement_ausgewählt




    
        
    



    
        
    



    
        
    

How do I set up a cloudflare failover without having control of the DNS?

I'm trying to use the Cloudflare failover system, but I can not transfer the domain's DNS to Cloudflare. The owner of the domain has offered to set up a CNAME, but I do not know how that would help because the site is hosted under the root domain and not under a subdomain.

I will host the site on an AWS server and plan to save a copy of it on a backup VPS with another vendor like Vultr. I want Cloudflare to be able to perform DNS failover according to its offer. Can I do that if I can not embed the DNS in a Cloudflare account? Are there any other good ways to set up a failover mechanism without having direct access to the DNS?

Many Thanks

python – To create a matrix from a generator set

I'm trying to make a matrix with a generator, some v1, v2, v3. I want the code to use the vectors in the set and create a matrix with the null vector, each of the row vectors and the combinations v1 + v2, v1 + v3, v2 + v3 and v1 + v2 + v3, ie. all possible linear combinations with 0 and 1 as coefficients. This is my first encoding and I think that should be feasible, but I can not figure it out.

I tried using for loops, but there are repetitions. I also did it by doing each of the operations, but this is not possible to generate sets with many vectors.

Entity Framework – Set updated reference in IdentityDbContext.SaveChanges ()

My app should be filled Updated by Field for all entities. Updated by should refer I would from AuthUser which extends Identity Role,
Updated by is set in IdentityDbContext.SaveChanges (), The problem is, that IdentityDbContext must keep a reference User Manager to solve I would the current user. This leads to a circular dependency: User Manager need IdentityDbContext which needs User Manager, What would be the most elegant solution to this problem?

I could try different things:

  • After initialization, set UserManager to IdentityDbContext
  • Resolve the user ID by filtering DbSet for fields in ClaimsPrincipal
  • Created by saving to the database as a name and not as an ID
  • Make the IdentityDbContext clients responsible for setting the CreatedBy field

The problem is that none of these solutions look elegant to me. I'm curious what the common pattern of such functionality is.

Javascript – How to set relationships between tables in ORM Bookshelf.js (and query with Related)?

After the Bookshelf.js documentation (https://bookshelfjs.org), I made my connection to the mysql database as follows:

const knex = require ("knex") ({
client: "mysql",
Connection: {
Host: "localhost",
User: "root",
Password: "keydb",
Database: "desenrola_app",
Character set: "utf8"
}
});

const bookshelf = require ("bookshelf") (knex);

module.exports = bookshelf;

Shortly thereafter, I defined two instances of tables that were created (and related by FK, where customer_person_id the table customer points to id the table person,

Follow the models:

const db = require ("./ db");
const Customer = require ("./ customer");

const Person = db.Model.extend ({
tableName: "person",
Customer () {
return this.hasOne (Customer, "customer_person_id", "id");
}
});

module.exports = person;

and

const db = require ("./ db");
const Person = require ("./ person");

const Customer = db.Model.extend ({
Table name: "Customer",
Person () {
return this.belongsTo (person, "customer_person_id", "id");
}
});

module.exports = customer;

In the control where I export the findOne function to my routes (this part is fine, falls into the function's CATCH, or simply returns empty JSON to Postman), I execute the following query:

const Customer = require ("../ models / customer");

exports.findOne = async (req, res, next) => {
const id = req.body.id;

expect new customers ({customer_person_id: id})
.fetch ({withRelated: ["person"] })
.then (function (client) {
res.send (client.related ("person"). toJson ());
})
.catch (err => res.json (err));
};

I'd like to know if I'm doing the one-to-one relationship wrong or sinning by a rule. Well, I do not even know why this query does not return something to me because in my database in the customer table I filled the FK with the same ID value in the People table.

Set Associative Cache Exercise – Computer Science Stack Exchange

I am new to the cache and trying to figure out how to solve this problem. Can someone please provide me some materials to help me solve these kinds of questions? I've tried googling Set Associative Cache, but I have not found many sources on the subject.

Can someone guide me how to solve this question?

2 Set the associative cache

Accept the following contents of a cache in which all blocks are valid. The two-way cache (m = 2) is byte-oriented with a block size of 16 bytes.

Determine the contents of the 8-bit data bus if the processor is reading and the value B70A appears on the 16-bit address bus. If the requested data is not in the cache memory, swipe any previous data in this memory that will be overwritten when new values ​​are saved.

In this case, write the letter on the data bus and set new values ​​for LRU and KEY.
(Note: Numbering of the data columns: 0 … left column, 1 … right column.)

Needed information:

  • Data Content:
  • New value of the LRU:
  • New value of the LRU in raw no:
  • New value of Key:
  • New value of key in column no.:

Enter image description here

Transactions – How low can nPowTargetTimespan be set?

I'm working on a private peer-to-peer cryptocurrency by forking Litecoin. I can see many suggestions

consensus.nPowTargetTimespan = 3.5 * 24 * 60 * 60;
consensus.nPowTargetSpacing = 2.5 * 60;

should be set lower for faster transactions. If you change these variables, you must always change other hard-coded variables that I know.

However, I wanted to ask if the given variables are set lower than them. Would this lead to a shorter time before all blocks are dismantled?

Using the example of Litecoin with 84 million cryptocurrencies as a total offer and with consensus.nSubsidyHalvingInterval = 840000;If nPowTargetTimespan and nPowTargetSpacing are set to 0.5 * 24 * 60 * 60 and 0.1 * 60, what is the direct effect?
If the blockchain blocks break down faster, what formula can we use to calculate the time needed to clear all blocks?