viernes, 21 de octubre de 2022

Sync Commit diff Repository

Sync Commit diff Repository

  • Clonar repo1 “proyect-1”
  • Clonar repo2 “proyect-2”

Ubicarse en el “proyect-1” y agregar el repo remoto

  • git remote add origin2 URL-GIT-REPO-PROYECT-2

Traer todas las ramas y commit del repo2

  • git fetch repo2

Para traer commit del otro repo

  • git cherry-pick -m 1 3be6f0b<has-del-commit>

—aceptar todos los commit (especial)

  • git commit --allow-empty

Cancelar el merge cuando hay conflicto

  • git cherry-pick --abort

Tambien se puede ir directamente a un commit con

  • git checkout 9a162e2 <hash del commit>

Other command

======cmd git checkout eb8a5d8 renombrar el readme.md git restore README.md comitear y luego crear rama git switch -c restore-pwa


Note: switching to '9a162e2'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example:

git switch -c <new-branch-name>

Or undo this operation with:

git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 9a162e2 bugfix/TO-22 * Agregado precios en ENV-global


martes, 9 de agosto de 2022

Manejar Espacios en blanco

 Eliminar espacios en blanco:

 https://stackoverflow.com/questions/10800355/remove-whitespaces-inside-a-string-in-javascript


function removeWhitespaces(string, i = 0, res = "") {
  if (i >= string.length)
    return res
  else
  if (string[i] == " ")
    return removeWhitespaces(string, i + 1, res)
  else
    return removeWhitespaces(string, i + 1, res += string[i])
}

console.log(removeWhitespaces(" Hello World,   how is it going ? "))
resp: HelloWorld,howisitgoing?


Verificar si existe espacios en blanco:

function hasMoreThanOneWhitespace(
  string: string,
  i = 0,
  res = '',
  result = false
): boolean {
  if (i >= string.length || result) {
    return result;
  } else {
    if (string[i] == ' ') {
      if (string[i + 1] == ' ')
        return hasMoreThanOneWhitespace(string, i + 1, res, true);
      else
        return hasMoreThanOneWhitespace(
          string,
          i + 1,
          (res += string[i]),
          false
        );
    } else {
      return hasMoreThanOneWhitespace(string, i + 1, (res += string[i]), false);
    }
  }
}


  static oneSpacePerWord(): ValidatorFn {
    return (control: AbstractControl): { [key: string]: any } | null => {
      if (!isEmptyInputValue(control.value) && control.value.length > 1) {
        const value = control.value as string;
        if (hasMoreThanOneWhitespace(value)) {
          return {
            predicate: 'No debe contener más de un espacio por palabra.',
          };
        }
        return null;
      }
      return null;
    };
  }


martes, 3 de mayo de 2022

Mandar a imprimir documento



  printDocument(documentId:string): void{
    this.uiService.isLoading.next(true);
    this.printDocumentService
        .getDocumentPDFBase64( this.solicitud.solicitudId + "", this.solicitud.solicitudId )
        .subscribe(
          (response: any)=>{
            const pdf = response.datos;  
            this.sendPrintPDF(pdf);    
            this.uiService.isLoading.next(false);    
          },
          (error)=>{
            console.log(error);            
            this.uiService.isLoading.next(false);    
          }
          );
  }
 

  sendPrintPDF(pdfBase64:string) {    
    const url = window.URL.createObjectURL(this.getBlobUrl(pdfBase64))
    var iframe = document.createElement('iframe');
    iframe.src = url;
    iframe.title = "PrintDocument"
    iframe.style.display = 'none';
    document.body.appendChild(iframe);
    iframe.onload = function() {
      setTimeout(function() {
        iframe.focus();
        iframe.contentWindow.print();
      }, 1);
    };
  }

  private getBlobUrl(pdfBase64:string):Blob{
    const byteArray = new Uint8Array(atob(pdfBase64).split('').map(char => char.charCodeAt(0)));
    var blob = new Blob([byteArray], {type: 'application/pdf'});
    return blob;
  }

 

sábado, 19 de febrero de 2022

Flutter

 Introducción a fluter:

DOCUMENTACIÓN OFICIAL:
https://docs.flutter.dev/get-started/install
https://dart.dev/samples


Flutter: Curso de Flutter - Instalaciones recomendadas
https://gist.github.com/Klerith/67058c9ad01e32214901fab5f664ec4f

DART

https://dartpad.dartlang.org/?

mixis: 

https://medium.com/flutter-community/dart-what-are-mixins-3a72344011f3


celular: https://www.udemy.com/course/flutter-primeros-pasos/learn/lecture/16816248#overview


error de version de kotlin cuando no compila por version




Para no tener erro en el punto 2 (android toolchain), debe instalar todos los sdk