How can I check how many times my iPhone or iPad has been charged?

On my Macbook Pro, I can see in the “About this Mac”->System Report->Power link how many times the laptop has been charged. It lists the condition (currently as “Normal”) on my laptop. I’ve seen it say something like “Needs Attention” or “Service Battery” when the laptop has over 500 cycle counts.

Is there an app that shows me that same information on my iPhone or iPad? I would like to know this information for the future if I buy a used iPhone or iPad. I don’t want to buy one where there’s over 1000 cycle counts and the battery doesn’t hold a charge longer than 30 min.

I’ve tried a couple battery life apps on my phone but it doesn’t tell me the cycle count. It just tells me the wear level and a percentage, which isn’t exactly what I’m looking for.

Repeat a row of dataframe n number of times in a list of dataframes

How can I repeat and bind a row of a dataframe n number of times in each dataframe of a list? So, for example with this list:

[[1]]   x z y  1 2 3  [[2]]   x z y  4 5 6 

this is the desired output if n is 1:

[[1]]   x z y  1 2 3  1 2 3 [[2]]   x z y  4 5 6  4 5 6 


list1 <- data.frame("x" = 1, "z" = 2, "y" = 3)    list2 <- data.frame("x" = 4, "z" = 5, "y" = 6)     list <- list(list1, list2)    

Count how many times day was present in in overlapping ranges

Let’s say I have some arbitrary number of date ranges in columns A and B (which can overlap), say:

     A         B 1    27.02.19  15.03.19 2    03.03.19  05.03.19 3    01.04.19  05.04.19 

What I want to do is given a specific date, say 04.03.19, count how many times that date was contained in the ranges. In this case, the answer would be 2, because that date was contained within the ranges in rows 1 and 2.

What formula can I use in Google Spreadsheets to calculate that? I realize COUNTIF is one part of this puzzle, but I need to 1) check all ranges in multiple rows and 2) check if the date is within the range, and I’m not sure how to do that.

Dealing with data arriving at a different times

I have a load balanced service that needs two data inputs to correctly give a result.

One of these inputs comes from a queue, the other comes from user input.

Most of the time the data that comes from the queue arrives long before the user input. This data from the queue is saved to a database and when the user input arrives it is used to create the result.

But about 10% of the time the user input happens first. When that happens I need to wait (meaning block the process) for the queue data to arrive prior to giving a response to the user.

The problem with the 10% scenario is knowing when the queue data has arrived so I can continue. I could keep querying the database, asking “are you there?”, “are you there now?”, “How about now?” But I don’t like that for many reasons.

(I also considered using process to process communication, but that does not work because my service is load balanced.)

Is there some way that other applications deal with this kind of thing? Something that does not have me pinging the database asking over and over till the data is there?

Find a number field whose unit group is isomorphic to $\mathbb{Z}/4\mathbb{Z} \times \mathbb{Z}$

Find a number field whose unit group is isomorphic to $ \mathbb{Z}/4\mathbb{Z} \times \mathbb{Z}.$

I’m trying to use Dirichlet’s Unit Theorem to solve this problem. It states that if $ K$ is a number field of signature $ (r,s)$ and $ \mu_K$ is the set of roots of unity in $ K$ , then the unit group $ \mathcal{O}_K^{\times}$ of the ring of integers is isomorphic to $ \mu_K \times \mathbb{Z}^{r+s−1}$ as an abelian group. So I suppose I want $ r+s-1=1,$ or $ r+s=2$ . This forces $ (r,s)=(0,2)$ because if there’s at least one real embedding then $ \mu_K$ is just $ \{\pm 1\}$ so not $ \mathbb{Z}/4\mathbb{Z}$ .

Therefore I need a number field of degree $ 4$ with four complex embeddings and whose set of roots of unity is isomorphic to $ \mathbb{Z}/4\mathbb{Z}$ . The cyclotomic field $ \mathbb{Q}(\zeta_5)$ doesn’t work because it has more than $ 4$ elements in its set of roots of unity (and $ \mathbb{Q}(\zeta_4)$ doesn’t work because it doesn’t have degree $ 4$ ). I suppose it will have to be $ \mathbb{Q}(\alpha)$ where the minimal polynomial of $ \alpha$ has degree $ 4$ but I haven’t been able to find an example. Hints would be appreciated.

Storing answers of a form builder where question sections may be repeated N times

I built a form builder with which administrators of the system I work on can build forms (or blueprints as we call them). The structure of these blueprints are as follows:

  • blueprint X
    • section 1
      • question 1 (Text)
      • question 2 (LongText)
      • question 3 (File)
    • section 2
      • question 1 (Text)
      • question 2 (Dropdown)
    • section 3
      • question 1 (Signature)

These blueprints can then be instantiated by users in the application (we call that a (filled in) ‘form’), after which the answers get stored in the database. That storage is very simple:

  • (filled in) forms

    • blueprint_id
  • answers

    • form_id
    • question_id
    • answer

So every form has a set of question => answer pairs. When a form is opened, the blueprint questions are rendered and their respective answers are loaded from the database.

The problem I face now is that new functionality requires a section to be repeated N times. That N is external input and could be anywhere between 1 and 20. The repeated rendering applies only to certain sections, so the blueprint above could look like this when N = 2.

  • blueprint X
    • section 1
      • question 1 (Text)
      • question 2 (LongText)
      • question 3 (File)
    • section 2 (N1)
      • question 1 (Text)
      • question 2 (Dropdown)
    • section 2 (N2)
      • question 1 (Text)
      • question 2 (Dropdown)
    • section 3
      • question 1 (Signature)

That adds a whole layer of complexity to the storage of answers, because for questions 2.1 and 2.2 there will be 2 separate answers instead of 1.

The solution I’m working on now would just cumulate these answers into JSON objects, where an answer record would look like this:

question_id    answer 1              ["first answer","second answer"] 

Or a little more verbose:

question_id    answer 1              {"N1":"first answer","N2":"second answer"} 

Where N1 and N2 are section identifiers.

Would this be a valid way of storing this? Are there other ways?

I travelled on a visit visa to the USA but then have been rejected 5 times

I was first denied the B1/B2 visa. On my second attempt, I was given the visa for 3 months with an annotation “CPA EXAM – Maryland.” I took the exam and, out of two parts, I passed one part. But, in the same interview, the officer had told me you have to attempt all four parts and I am giving you one chance.

I returned within the stipulated time. Since then, I have reapplied five more times for a visa (on average once a month) and I have not been given the visa.

One more thing: after coming back, I told the officer that I would like to stay for 5 months as I want to pass my remaining exams during the stay. Also, the officer misunderstood my results and he recorded as if I had failed the two parts.

In my last interrview, the visa officer told me to “try to change your circustances and apply after a long time.

What should I do?