Tablet stuck in erasing loop after failed factory reset

I tried to do factory reset on my Lenovo Yoga tablet but I turned it off while it was erasing. After that when I start the tablet it automaticly shows lenovo logo(as it should) but then it starts erasing data for like a minute, reboots itself and starts again. I’m able to access recovery menu and move the selection so its not bricked. Will I have to reinstall the Android?

How to efficiently loop through paragraphs and make simple changes with Word VBA

This is regarding my answer with SO post How to remove paragraph marks with different format in MS-Word. My primary question, is there any way performance of the code could be improved to operate on document as intended by OP (2.2 MB and has 2.1K pages, 871K words, 4,6M characters including spaces)?
On Secondary, is there a simple way or workaround that I am missing (and making things unnecessary complicated) to perform the sane task efficiently?

Here I reproduce my code after adding some futile measures to improve performance of the code with file of the size specified by the OP.

    Option Explicit     Sub ReplacePara()     Dim Para As Paragraph, Xstr As String, Rng As Range     Dim i As Long, ln As Long, tm As Double, PrCnt As Long     Dim PrvChrSize As Integer, NextChrSize  As Integer     Dim PrvChrFont As String, NextChrFont  As String     Dim PrvChrItalic As Boolean, NextChrItalic As Boolean     tm = Timer  ‘Following measures added to improve performance ‘but on the contrary it’s found instead of increasing time taken     Application.ScreenUpdating = False         With Options         .Pagination = False         .CheckSpellingAsYouType = False         .CheckGrammarAsYouType = False         End With           With ActiveDocument         PrCnt = .Paragraphs.Count         Debug.Print PrCnt         For i = .Paragraphs.Count To 1 Step -1         Set Para = .Paragraphs(i)         ln = Para.Range.Characters.Count              If ln > 1 Then                 With Para.Range.Characters(ln - 1).Font                 PrvChrSize = .Size                 PrvChrFont = .Name                 PrvChrItalic = .Italic                 End With                  If i < .Paragraphs.Count Then                     With .Paragraphs(i + 1).Range.Characters(1).Font                     NextChrSize = .Size                     NextChrFont = .Name                     NextChrItalic = .Italic                     End With                 Else                 NextChrSize = 0                 NextChrFont = ""                 NextChrItalic = False                 End If             End If              'Debug.Print i, PrvChrSize, PrvChrFont, NextChrSize, NextChrFont             If (PrvChrSize = 15 And (PrvChrFont = "Arial" Or PrvChrItalic = True)) _             And (NextChrSize = 15 And (NextChrFont = "Arial" Or NextChrItalic)) Then             Para.Range.Characters(ln).Text = " "             End If         .UndoClear         'If PrCnt < 1000 Then Debug.Print i & "/" & PrCnt         Next       End With          With Options         .Pagination = True         .CheckSpellingAsYouType = True         .CheckGrammarAsYouType = True         End With     Application.ScreenUpdating = True     Debug.Print " Seconds taken:" & Timer - tm     End Sub 

The added measures actually found to increase time taken (from 3 odd minutes to 4 odd minutes) with documents of 124 pages. I haven’t ventured far to go for LockWindowUpdate API.

Though the code tested Ok with documents of 100 pages around. I could not finish the task with a makeshift giant file of around 2.4 K pages. It is virtually crashing Word (not recovering from ‘Not responding mode’). I ceated the file with a simple code stub with the sample file linked by OP in the SO post. Code stub was also produced for ease is testing.

Sub makebig() Dim Rng As Range, MyRange As Range Dim Wd As Document Dim i  As Long Set Wd = ThisDocument Set Rng = Wd.Content Rng.Copy      For x = 1 To 2000     Set MyRange = Wd.Content     MyRange.EndOf Unit:=wdStory, Extend:=wdMove     MyRange.Paste     Next End Sub 

Running the code with sample file twice (1st time with For x = 1 To 2000 and second time with For x = 1 To 1) will produce a file about 2.4 K pages. For getting a file of 124 pages from the sample file 200 loops are sufficient.

How to display 3 Bootstrap Card titles in same row using forach loop

I have view where I need to display 3 card tiles in a same row. But at present it displays one after the other. How Do I display 3 card tiles in same row?

Index.cshtml –

@model List<JobPortal.Models.MyDB> @{    ViewBag.Title = "Current List"; }  <div class="row">  @foreach (var list in Model)  {         <div class="flexcontainer">           @Html.Partial("_MySharedView", list)        </div>  } </div> 

Shared view –

@model JobPortal.Models.MyDB @if (Model.JDetails.Count > 0) {      <div class="card" style="width: 18rem;">        <img class="card-img-top" src="..." alt="Card image cap">       <div class="card-body">       <p class="card-text">Model.details</p>      </div>   </div>  } 

Unable to loop through the worksheets in an Excel workbook

I am trying to learn Python and trying to generate a .sql file from a mapping given to me in an excel file. But I am able to go through the rows and columns of the first sheet but unable to move forward to the next sheets. I am using Python 3.7. Each sheet would contain two columns

This is what the excel sheet columns look like

TABLE1                      TABLE2 ----------------------------------- VERSION                      NULL VALID_FROM                   USG_DT USERNAME                     MIG UD_GEPART_ID                 NULL UD_SEPART_ID                 NULL 

There can be multiple worksheets in one workbook.

Below is what I have tried so far. Please can someone point me out where I am going wrong in the code as I am not able to move to the next sheet:

import openpyxl as xl wb = xl.load_workbook("C:\New folder\MAPPING.xlsx") ws = wb.sheetnames sheet_obj = wb.active  #sheets = [wb.sheetnames] statement_a = "INSERT /*+ APPEND */ INTO " statement_b = "SELECT /*+ PARALLEL(64) */ "   for i, ws in enumerate(sheets):     stat_c = statement_b      stat_d = statement_b + ws[1+i] + " ( "  for sh in wb.sheetnames:     for col_cells in sheet_obj.iter_cols(min_row= 2, min_col= 2, max_col=2):         for cell in col_cells:             stat_c = stat_c + str(cell.value) + ", "     stat_c = stat_c.rstrip(", ")  +" FROM " + ws[1+i] + ";"     #print(stat_c)     #print("-------------------------------------------------")     for col_cellr in sheet_obj.iter_cols(max_row = 1,min_col= 2, max_col =2):         for cell in col_cellr:             stat_a = statement_a + cell.value + " ( "     for col_celli in sheet_obj.iter_cols(min_row= 2, min_col= 1, max_col=1):         for cell in col_celli:             stat_a = stat_a + str(cell.value) + ", "     stat_a = stat_a.rstrip(", ") + " )"     #print("\n")     #print(stat_a) 

Windows batch for loop refer to array with global variable as counter

I have problem with this for loop:

@echo off setlocal enableDelayedExpansion  set /a ID=1  for /f "delims=" %%G in ('dir *.jpg /b') do (     set filename[!ID!]=%%~G     set /a ID+=1 )  set /a ID-=1  set /a NEXT=2  FOR /L %%G IN (1,1,%ID%) DO (      echo "convert !filename[%%G]! !filename[!NEXT!]! -delay 20 -morph 10 %%G_morph.jpg"     set /a NEXT+=1  )   endlocal 

Question is how may I get array with global variable ( which is increasing ) working?

I tried lots of configurations like %%filename[%%NEXT%%]%% etc…

First one !filename[%%G]! works great but how may I get next array value?

A delivery loop was detected which causes this email to be undeliverable when using a domain alias with Google Apps

This is a follow-on to the question “How can I add an email alias to a domain alias in Google Apps?”

A primary domain has been successfully set-up with Google Apps (not G Suite) e.g. domain1.com

A secondary domain alias to the primary domain has also been setup. It has been verified e.g. domain2.com.

Although I successfully receive an email that is sent to bill@domain1.com, the error message “A delivery loop was detected which causes this email to be undeliverable” is received when an email is sent to bill@domain2.com.

It has been 24 hours since the domain alias was added.

Is there any additional step that must be completed?

add sum Specific value In Swift using for loop how it achieve using higher order function in swift

** i want to find sum of particular element in array. this is my code which is working find but i want achieve this using Higher order function in Swift how i can get **

 let arrData = [2,5,7,6,9,-9,10]     let arr = arrData.sorted { $  0>$  1     }     for i in 0...arr.count-1{         for j in 1..<arr.count-1{             if arr[i] + arr[j] == 17{                  print(arr[i] + arr[j])                 return             }          }     } 

!feof não funciona- loop infinito- C

void opcao7 (){ system(“cls”); pessoa P; int ano=0; int dia=0; int mes=0; int total=0; float primeiro=0; float segundo=0; float terceiro=0; float quarto=0; float quinto=0; float sexto=0; float m=0; float f=0; char validacao; char linha1 [MAX_TAM], linha2 [MAX_TAM], linha3 [MAX_TAM], linha4 [MAX_TAM], linha5 [MAX_TAM], linha6 [MAX_TAM];

printf("\n    ***OPÇÃO 7 SELECIONADA***\n");  // ARQUIVOS FILE*arquivo3; arquivo3=fopen("pessoa.txt", "a+t"); #ifdef DEBUG     if (arquivo3==NULL){         printf("ARQUIVO NAO FUNCIONOU\n");     }     #endif  fflush(stdin);  printf("Digite a data de hoje "); scanf("%d/%d/%d \n", & P.dia, &P.mes, &P.ano); do{     // validando a data     validacao=0;     if ((P.mes==4 || P.mes==6 || P.mes==9 || P.mes==11)&& P.dia<=30) {         validacao=1;     }else if ((P.mes==1 || P.mes==3 || P.mes==5 || P.mes==7 || P.mes==8 || P.mes==10 || P.mes==12) && P.dia<=31) {         validacao=1;     }else if (P.mes==2 && P.dia<=28){         validacao=1;     }else if (P.mes==2 && P.ano%4==0  && P.dia<=29){         validacao=1;     }else{         validacao=0;         printf("Data inválida \n ");     } }while (validacao==0);  while (!feof(arquivo3)){     #ifdef DEBUG     printf("ABRIU ");     #endif // DEBUG     fgets(linha1,MAX_TAM, arquivo3);     fgets(linha2,MAX_TAM, arquivo3);     fgets(linha3,MAX_TAM, arquivo3);     fgets(linha4,MAX_TAM, arquivo3);     fgets(linha5,MAX_TAM, arquivo3);     fgets(linha6,MAX_TAM, arquivo3);     // CONVERTENDO STRING PARA INTEIRO     ano=atoi(linha5);     mes=atoi(linha4);     dia=atoi(linha3);      printf("%d\n",P.mes-1);       //printf("%d\n",mes-1);       //printf("%d\n",dia-1);     #ifdef DEBUG         printf("FOI ");     #endif // DEBUG      // DEFININDO A DATA DE NASCIMENTO REAL     if ((mes==P.mes) && (dia>=P.dia)){         ano=P.ano-ano;         #ifdef DEBUG         printf("mes normal");         #endif // DEBUG     }else if (mes<P.mes){              ano=(P.ano-ano)-1;         #ifdef DEBUG         printf("mes normal 2");         #endif // DEBUG     }     total++; // USO PARA O PERCENTUAL DE IDADE         #ifdef DEBUG         printf(" H");         #endif // DEBUG      if(ano<=5){         primeiro++;     }else if (ano>=6 && ano<=10){         segundo++;     }else if (ano>=11 && ano<=20){         terceiro++;     }else if (ano>=21 && ano<=40){         quarto++;     }else if (ano>=41 && ano<=60){         quinto++;     }else if (ano<=61){         sexto++;     }     //USO PARA PERCENTUAL SEXO     //if (linha5=='M'){         m++;     //}else if (linha5=='F'){         f++;     //} }         #ifdef DEBUG         printf(" J");         #endif // DEBUG     fclose(arquivo3);      //  CALCULANDO A PERCENTAGEM IDADE E IMPRIMINDO     primeiro=((100 * primeiro)/total);     segundo=((100 * segundo)/total);     terceiro=((100 * terceiro)/total);     quarto=((100 * quarto)/total);     quinto=((100 * quinto)/total);     sexto=((100 * sexto)/total);         #ifdef DEBUG         printf(" LINDA");         #endif // DEBUG     printf("Percentual de pessoas em cada faixa etária");     printf("0 a 5 anos:%.2f",primeiro);     printf("6 a 10 anos: %.2f",segundo);     printf("11 a 20 anos: %.2f",terceiro);     printf("21 a 40 anos: %.2f",quarto);     printf("41 a 60 anos: %.2f",quinto);     printf("Acima de 60 anos: %.2f",sexto);      // CALCULANDO A PERCENTAGEM IDADE E IMPRIMINDO     m=(100 * m)/total;     f=(100 * f)/total;     printf(" \n Percentual de pessoas por sexo: ");     //printf("Masculino: &.2f",m);   //  printf("Feminino: &.2f",f);     fclose(arquivo3);     system("cls"); 

}

Loop sobrescrevendo na listagem

Olá pessoal tudo bem? Eu estou com o seguinte problema: eu quero fazer um relatório de produtos vendidos, mas quando vai printar na tela, o loop sobrescreve(ex: o ultimo componente do array aparece sobre os outros). Eu vi alguns casos parecidos mas nenhum deles me ajudou a arrumar isso. Eu sou iniciante em JAVA e se alguém puder me ajudar a evitar essa sobrescrição, eu agradeço.

Segue o main:

package sistema.telas; import static sistema.es.EntradaESaida.*; import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import sistema.sgbd.BancoDeDados; import sistema.entidade.RelatorioVenda;      public class RelatorioVendas {         //chama a classe BancoDeDados para fazer conexao com o banco         static Connection con = new BancoDeDados().getConnection();          public static void relatorio() throws IOException{             List<RelatorioVenda> relatorio = getLista();             String colunas[] = {"Nome", "Preço", "Quantidade", "Preço Total"};             String linhas[][] = new String[relatorio.size()][4];             for (int linha = 0; linha < linhas.length; linha++){                 for (RelatorioVenda relatorioVenda : relatorio) {                     linhas[linha][0] = relatorioVenda.getNomeProduto();                     linhas[linha][1] ="R$  " + relatorioVenda.getPreco();                     linhas[linha][2] = relatorioVenda.getQuantidade()+ "un";                     linhas[linha][3] ="R$  " + relatorioVenda.getPrecoTotal();                 }              }             exibirTabela("Relatorio de Vendas", linhas, colunas, 150, 750);          public static List<RelatorioVenda> getLista() {              try {                  List<RelatorioVenda> relatorioVendas = new ArrayList<RelatorioVenda>();                   PreparedStatement stmt = con.prepareStatement("SELECT produto.nome, produto.preco, venda.quantidade_vendida, (venda.quantidade_vendida*produto.preco) as multiplicacao FROM produto,  venda WHERE produto.codigo = venda.codigo_produto;");                  ResultSet rs = stmt.executeQuery();                   while (rs.next()) {                      // criando o objeto venda                      RelatorioVenda venda = new RelatorioVenda();                       venda.setNomeProduto(rs.getString("nome"));                      venda.setPreco(rs.getFloat("preco"));                      venda.setQuantidade(rs.getInt("quantidade_vendida"));                      venda.setPrecoTotal(rs.getFloat("multiplicacao"));                       // adicionando o objeto à lista                       relatorioVendas.add(venda);                  }                  rs.close();                  stmt.close();                  return relatorioVendas;              } catch (SQLException e) {                  msgErro("Erro ao carregar as tabelas venda e produto. ", "Relatorio de Vendas");                  throw new RuntimeException(e);              }            }} 

Construtor:

package sistema.entidade;  /**  * Classe usada para representar um Relátorio de Venda.  * @author Matheus William  */ public class RelatorioVenda {     private String nomeProduto;     private float preco;     private int quantidade;     private float precoTotal;      public RelatorioVenda() {     }      public RelatorioVenda(String nomeProduto, float preco, int quantidade,             float precoTotal) {         this();         this.nomeProduto = nomeProduto;         this.preco = preco;         this.quantidade = quantidade;         this.precoTotal = precoTotal;     }      public String getNomeProduto() {         return nomeProduto;     }      public void setNomeProduto(String nomeProduto) {         this.nomeProduto = nomeProduto;     }      public float getPreco() {         return preco;     }      public void setPreco(float preco) {         this.preco = preco;     }      public int getQuantidade() {         return quantidade;     }      public void setQuantidade(int quantidade) {         this.quantidade = quantidade;     }      public float getPrecoTotal() {         return precoTotal;     }      public void setPrecoTotal(float precoTotal) {         this.precoTotal = precoTotal;     }      @Override     public String toString() {         return String.format("%s - %.2f - %d - %.2f", nomeProduto,preco,quantidade,precoTotal);     } } 

bootloader boot loop

I got a new Pixel 2 and wanted to load an TWRP backup from my previous Pixel 2 (with stock ROM) onto it, instead of setting it up freshly. So I

  • booted the new device
  • clicked through the settings
  • entered developer mode and oem unlock
  • rebooted
  • unlocked the bootloader
  • booted into TWRP (using fastboot boot)
  • copied my old /sdcard contents to the device using adb
  • used TWRP to restore the old backup (partitions boot, system and data.

At that point I hoped I was done, and could just boot into my system. But unfortunately, it always just boots into the bootloader.

What did I do wrong?

And what do I do now?

  • I tried to do a factory reset by using fastboot flashing lock, and it claimed it would reset the phone, but it doesn’t.
  • I tried to enter recovery from the bootloader, but it just boots into the bootloader.
  • I tried to flash an official image from https://developers.google.com/android/images#walleye using ./flash-all.sh but it fails to update the bootloader:

    Sending 'bootloader_a' (38692 KB)                  OKAY [0.155s] Writing 'bootloader_a'                             (bootloader) Updating: partition:0   @00002000 sz=0000B000 FAILED (remote: 'Command Flash Error') fastboot: error: Command failed 

    and then fails do do more:

    -------------------------------------------- Bootloader Version...: mw8998-002.0059.00 Baseband Version.....: g8998-00008-1902121845 Serial Number........: … -------------------------------------------- extracting android-info.txt (0 MB) to RAM... Checking 'product'                                 OKAY [0.000s] Checking 'version-bootloader'                      FAILED  Device version-bootloader is 'mw8998-002.0059.00'. Update requires 'mw8998-002.0076.00'.  fastboot: error: requirements not met! 
  • I tried to boot twrp again, but that does not work:

    $   fastboot boot twrp-3.3.0-0-walleye.img  downloading 'boot.img'... OKAY [  0.115s] booting... FAILED (remote: Failed to load/authenticate boot image: Load Error) 

What else should I try?