Comandos git do dia a dia

Ĉ¿

#Criando um projeto do zero
echo "# UBBOAT_App" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/seulogin/xxxxxx.git
git push -u origin main


#Adicionado um projeto remoto na pasta local 

git remote add origin https://github.com/login/xxxxx.git
git branch -M main
git push -u origin main

Removendo pasta local do servidor remoto
#lista os vinculados 
git remote -v
#exemplo
origin  https://github.com/login/xxxx-app.git (fetch)
origin  https://github.com/login/xxxx-app.git (push)

#comando para remover
git remote rm origin

react-select default value

Ĉ¿
Abaixo exemplo em ReactJs para consumir uma API REST, alimentar um drolist e definir o valor default 

Exemplo de retorno da API https://localhost:44385/api/Tipos/

[{"id":1,"tP_Conta":"Débito"},{"id":2,"tP_Conta":"Crédito"}]

import React, { Component } from "react";
import Select from 'react-select'
import axios from 'axios'

export class Tipo extends Component {
constructor(props) {
super(props);
this.state = { title: "", loading: true, selectOptions: []};

}

async getOptions() {
const res = await axios.get('/api/Tipos') //[{"id":1,"tP_Conta":"Débito"},{"id":2,"tP_Conta":"Crédito"}]
const data = res.data

const options = data.map(d => ({
"value": d.id,
"label": d.tP_Conta
}))

this.setState({ selectOptions: options })

}

componentDidMount() {
this.getOptions()
}

render() {
console.log(this.state.selectOptions)
return (
<div>
<Select options={this.state.selectOptions} onChange={this.handleChange.bind(this)} defaultValue={{ label: "Débito", value:" 1"}}/>
</div>


)
}

}


Google Maps SDK for iOS crashes if CFBundleExecutable contains non-English characters

Ĉ¿ Ao compilar meu projeto no Xcode, apresentou o erro abaixo? 

Google Maps SDK for iOS crashes if CFBundleExecutable contains non-English characters




Existe duas opções para corrigir o problema no config.xml
Alterando a tag  

<name>Usar nome sem acentos</name>

Ou usando tag de nome curto
<name short="(non-english app name)">(english app name)</name>

Após isso remova e adicione a plataforma novamente 

cordova platform rm ios  

cordova platform add ios 

Feito :D 




Erro ao adicionar a plataforma IOS IONIC

Ĉ¿ cordova platform add  ios
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "ios" as it does not contain a package.json file.

Pode ser que tenha utilizado o Capacitor, e precisa excluir a IOS na raiz do projeto


Encontrar o tamanho das colunas da tabela SQL SERVER

Ĉ¿

SELECT cNmColuna = C.name
    ,cTpColuna = UPPER(TYPE_NAME(C.user_type_id))
    ,iMaxDigit = CASE
                    WHEN T.precision = 0
                    THEN C.max_length
                    ELSE T.precision
                 END
FROM sys.all_columns C WITH(NOLOCK)
    INNER JOIN sys.types T WITH(NOLOCK) ON T.user_type_id = C.user_type_id
    WHERE C.object_id = Object_Id('Nome da Tabela')



Ref: https://pt.stackoverflow.com/questions/12549/como-pegar-o-tamanho-total-de-caracteres-de-uma-coluna-sql

DeadLock listar as sessões ocorrendo no banco SQL Server

Ĉ¿ 

Para listar os deadlocks di log , execute o comando abaixo


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
DECLARE @TimeZone INT = DATEDIFF(HOUR, GETUTCDATE(), GETDATE())
 
SELECT
    DATEADD(HOUR, @TimeZone, xed.value('@timestamp', 'datetime2(3)')) AS CreationDate,
    xed.query('.') AS XEvent
FROM
(
    SELECT
        CAST(st.[target_data] AS XML) AS TargetData
    FROM
        sys.dm_xe_session_targets AS st
        INNER JOIN sys.dm_xe_sessions AS s ON s.[address] = st.event_session_address
    WHERE
        s.[name] = N'system_health'
        AND st.target_name = N'ring_buffer'
) AS [Data]
CROSS APPLY TargetData.nodes('RingBufferTarget/event[@name="xml_deadlock_report"]') AS XEventData (xed)
ORDER BY
    CreationDate DESC







fonte: https://www.dirceuresende.com/blog/sql-server-como-gerar-um-monitoramento-de-historico-de-deadlocks-para-analise-de-falhas-em-rotinas/

Comandos git do dia a dia

Ĉ¿ #Criando um projeto do zero echo "# UBBOAT_App" >> README.md git init git add README.md git commit -m "first commi...