no more lib in packages.json except for above.
packages.json...
"dependencies": {
"react": "17.0.2",
"react-native": "0.68.0",
"react-native-image-picker": "^4.7.3"
},
I had installed project with 'npx react-native init [myProjectName] --template react-native-template-typescript'
had lauched on xcode. But it has occured security problem.
attached security problem log...
Details
Could not launch “complicore”
Domain: IDEDebugSessionErrorDomain
Code: 3
Failure Reason: Security
User Info: {
DVTErrorCreationDateKey = "2022-04-12 23:39:40 +0000";
DVTRadarComponentKey = 855031;
IDERunOperationFailingWorker = DBGLLDBLauncher;
RawUnderlyingErrorMessage = Security;
}
--
Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : {
"device_isWireless" = 1;
"device_model" = "iPhone10,4";
"device_osBuild" = "13.3 (17C54)";
"device_platform" = "com.apple.platform.iphoneos";
"launchSession_schemeCommand" = Run;
"launchSession_state" = 1;
"launchSession_targetArch" = arm64;
"operation_duration_ms" = 34146;
"operation_errorCode" = 3;
"operation_errorDomain" = IDEDebugSessionErrorDomain;
"operation_errorWorker" = DBGLLDBLauncher;
"operation_name" = IDEiPhoneRunOperationWorkerGroup;
"param_consoleMode" = 0;
"param_debugger_attachToExtensions" = 0;
"param_debugger_attachToXPC" = 1;
"param_debugger_type" = 5;
"param_destination_isProxy" = 0;
"param_destination_platform" = "com.apple.platform.iphoneos";
"param_diag_MainThreadChecker_stopOnIssue" = 0;
"param_diag_MallocStackLogging_enableDuringAttach" = 0;
"param_diag_MallocStackLogging_enableForXPC" = 1;
"param_diag_allowLocationSimulation" = 1;
"param_diag_gpu_frameCapture_enable" = 0;
"param_diag_gpu_shaderValidation_enable" = 0;
"param_diag_gpu_validation_enable" = 0;
"param_diag_memoryGraphOnResourceException" = 0;
"param_diag_queueDebugging_enable" = 1;
"param_diag_runtimeProfile_generate" = 0;
"param_diag_sanitizer_asan_enable" = 0;
"param_diag_sanitizer_tsan_enable" = 0;
"param_diag_sanitizer_tsan_stopOnIssue" = 0;
"param_diag_sanitizer_ubsan_stopOnIssue" = 0;
"param_diag_showNonLocalizedStrings" = 0;
"param_diag_viewDebugging_enabled" = 1;
"param_diag_viewDebugging_insertDylibOnLaunch" = 1;
"param_install_style" = 0;
"param_launcher_UID" = 2;
"param_launcher_allowDeviceSensorReplayData" = 0;
"param_launcher_kind" = 0;
"param_launcher_style" = 0;
"param_launcher_substyle" = 0;
"param_runnable_appExtensionHostRunMode" = 0;
"param_runnable_productType" = "com.apple.product-type.application";
"param_runnable_swiftVersion" = "5.5.2";
"param_runnable_type" = 2;
"param_testing_launchedForTesting" = 0;
"param_testing_suppressSimulatorApp" = 0;
"param_testing_usingCLI" = 0;
"sdk_canonicalName" = "iphoneos15.2";
"sdk_osVersion" = "15.2";
"sdk_variant" = iphoneos;
}
Related
each time my for loop saves a value and then replaces it with the next one
I expect to be able to collect all the values without being replaced by the next one, and all of them can be collected in one variable
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = Integer.parseInt(scanner.nextLine());
int priceForTon = 0;
int sumTones = 0;
int allTons = 0;
int priceForAllTones = 0;
double average = 0;
for (int i = 1; i <= n; i++) {
int tonsOfCar = Integer.parseInt(scanner.nextLine());
if (tonsOfCar <= 3) {
priceForTon = 200;
sumTones = priceForTon * tonsOfCar;
} else if (tonsOfCar >= 4 && tonsOfCar <=11) {
priceForTon = 175;
sumTones = priceForTon * tonsOfCar;
}else {
priceForTon = 120;
sumTones = priceForTon * tonsOfCar;
}
allTons += tonsOfCar;
}
priceForAllTones = sumTones;
System.out.printf("%.2f", average);
I'm trying to use for loop inside for loop but it doesn't working i also tried while loop but...
int[] numArray = new int[10] {1,2,2,3,3,4,4,5,5,9};
List<Int32> uNum = new List<Int32>();
/*Random rnd = new Random();
for (int i = 0; i < numArray.Length; i++)
{
int randomNumber = rnd.Next(0, 10);
numArray[i] = randomNumber;
}*/
for (int i = 0; i < numArray.Length; i++)
{
if (numArray[i] != numArray[i])
{
for (int j = 0; j < numArray.Length-1; j++)
{
if (numArray[i] != numArray[j])
{
uNum.Add(numArray[i]);
}
}
}
}
You have an error in this line:
if (numArray[i] != numArray[i])
This condition will always return False because a number is always equal to itself.
Do something like this:
for (int i=0; i<numArray.Length; i++)
{
int j;
for (j=0; i<numArray.Length; j++){
if (i != j){
if (numArray[i] != numArray[j])
{
uNum.Add(numArray[i]);
}
}
}
}
int[] numArray = new int[10];
List<Int32> uNum = new List<Int32>();
Random rnd = new Random();
for (int i = 0; i < numArray.Length; i++)
{
int randomNumber = rnd.Next(0, 10);
numArray[i] = randomNumber;
}
for (int i = 0; i < numArray.Length; i++)
{
int num = numArray[i];
int count = 0;
for (int j = 0; j < numArray.Length; j++)
{
if (numArray[j] == num)
{
count++;
}
}
if (count == 1)
{
uNum.Add(num);
}
}
I have been trying to solve the problem for a month with googling.
But Now I have to ask for help here.
I want to render using ffmpeg decoded frame.
and using frame(it converted to RGB32 format), I try to render frame with DX2D texture.
ZeroMemory(&TextureDesc, sizeof(TextureDesc));
TextureDesc.Height = pFrame->height;
TextureDesc.Width = pFrame->width;
TextureDesc.MipLevels = 1;
TextureDesc.ArraySize = 1;
TextureDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; //size 16
TextureDesc.SampleDesc.Count = 1;
TextureDesc.SampleDesc.Quality = 0;
TextureDesc.Usage = D3D11_USAGE_DYNAMIC;
TextureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
TextureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
TextureDesc.MiscFlags = 0;
result = m_device->CreateTexture2D(&TextureDesc, NULL, &m_2DTex);
if (FAILED(result)) return false;
ShaderResourceViewDesc.Format = TextureDesc.Format;
ShaderResourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
ShaderResourceViewDesc.Texture2D.MostDetailedMip = 0;
ShaderResourceViewDesc.Texture2D.MipLevels = 1;
D3D11_MAPPED_SUBRESOURCE S_mappedResource_tt = { 0, };
ZeroMemory(&S_mappedResource_tt, sizeof(D3D11_MAPPED_SUBRESOURCE));
result = m_deviceContext->Map(m_2DTex, 0, D3D11_MAP_WRITE_DISCARD, 0, &S_mappedResource_tt);
if (FAILED(result)) return false;
BYTE* mappedData = reinterpret_cast<BYTE *>(S_mappedResource_tt.pData);
for (auto i = 0; i < pFrame->height; ++i) {
memcpy(mappedData, pFrame->data, pFrame->linesize[0]);
mappedData += S_mappedResource_tt.RowPitch;
pFrame->data[0] += pFrame->linesize[0];
}
m_deviceContext->Unmap(m_2DTex, 0);
result = m_device->CreateShaderResourceView(m_2DTex, &ShaderResourceViewDesc, &m_ShaderResourceView);
if (FAILED(result)) return false;
m_deviceContext->PSSetShaderResources(0, 1, &m_ShaderResourceView);
but it shows me just black screen(nothing render).
I guess it's wrong memcpy size.
The biggest problem is that I don't know what is the problem.
Question 1 :
It has any problem creating 2D texture for mapping?
Question 2 :
What size of the memcpy parameters should I enter (related to formatting)?
I based on the link below.
[1]https://www.gamedev.net/forums/topic/667097-copy-2d-array-into-texture2d/
[2]https://www.gamedev.net/forums/topic/645514-directx-11-maping-id3d11texture2d/
[3]https://www.gamedev.net/forums/topic/606100-solved-dx11-updating-texture-data/
Thank U for watching, Please reply.
Nobody reply. I solved my issue.
I have modified some code and I'm not sure if it solves the problem. The problem with the black screen Reason is my matrix.
D3D11_TEXTURE2D_DESC TextureDesc;
D3D11_RENDER_TARGET_VIEW_DESC RenderTargetViewDesc;
D3D11_SHADER_RESOURCE_VIEW_DESC ShaderResourceViewDesc;
ZeroMemory(&TextureDesc, sizeof(TextureDesc));
TextureDesc.Height = pFrame->height;
TextureDesc.Width = pFrame->width;
TextureDesc.MipLevels = 1;
TextureDesc.ArraySize = 1;
TextureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;/*DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;*/ //size 32bit
TextureDesc.SampleDesc.Count = 1;
TextureDesc.SampleDesc.Quality = 0;
TextureDesc.Usage = D3D11_USAGE_DYNAMIC;
TextureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
TextureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
TextureDesc.MiscFlags = 0;
DWORD* pInitImage = new DWORD[pFrame->width*pFrame->height];
memset(pInitImage, 0, sizeof(DWORD)*pFrame->width*pFrame->height);
D3D11_SUBRESOURCE_DATA InitData;
InitData.pSysMem = pInitImage;
InitData.SysMemPitch = pFrame->width*sizeof(DWORD);
InitData.SysMemSlicePitch = 0;
result = m_device->CreateTexture2D(&TextureDesc, &InitData, &m_2DTex);
if (FAILED(result)) return false;
ShaderResourceViewDesc.Format = TextureDesc.Format;
ShaderResourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
ShaderResourceViewDesc.Texture2D.MostDetailedMip = 0;
ShaderResourceViewDesc.Texture2D.MipLevels = 1;
result = m_device->CreateShaderResourceView(m_2DTex, &ShaderResourceViewDesc, &m_ShaderResourceView);
if (FAILED(result)) return false;
D3D11_MAPPED_SUBRESOURCE S_mappedResource_tt;
ZeroMemory(&S_mappedResource_tt, sizeof(S_mappedResource_tt));
DWORD Stride = pFrame->linesize[0];
result = m_deviceContext->Map(m_2DTex, 0, D3D11_MAP_WRITE_DISCARD, 0, &S_mappedResource_tt);
if (FAILED(result)) return false;
BYTE * pFrameData = pFrame->data[0]; // now we have a pointer that points to begin of the destination buffer
BYTE* mappedData = (BYTE *)S_mappedResource_tt.pData;// +S_mappedResource_tt.RowPitch;
for (auto i = 0; i < pFrame->height; i++) {
memcpy(mappedData, pFrameData, Stride);
mappedData += S_mappedResource_tt.RowPitch;
pFrameData += Stride;
}
m_deviceContext->Unmap(m_2DTex, 0);
It works vell. I hope that it will be helpful to those who are doing the same thing with me.
Having an issue in my neural network where the error on the inputs gets enormously small (in the negative thousands). The network can learn one training set (ie 1+3=4) and will output four with inputs 1 and 3 but cant learn the generel pattern from larger datasets. My friend has taken a look at it and can't see the issue. Any help appreciated.
for (int j = 0; j <3000; j++)
{
for (int i = 0; i < tr_inp.Length; i++)
{
nn.inputs = tr_inp[i];
nn.desired = tr_out[i];
nn.FeedForward(tr_inp[i]);
nn.Backpropagate(tr_out[i]);
}
training loop,
public void FeedForward(double[] inputs)
{
this.inputs = inputs;
//set inputs outputs to the input weight,
for (int i = 0; i < nodes[0].Count; i++)
{
nodes[0][i].output = nodes[0][i].weights[0];
}
//set hidden layers outputs to dot product
for (int i = 0; i < nodes[1].Count; i++)
{
double sum = 0;
for (int j = 0; j < nodes[1][i].weights.Length; j++)
{
sum += nodes[1][i].weights[j] * nodes[0][j].output;
}
nodes[1][i].output = Normalization.Logistic(sum);
}
for (int i = 0; i < output; i++)
{
double sum = 0;
for (int j = 0; j < hidden; j++)
{
sum += nodes[2][i].weights[j] * nodes[1][j].output;
}
nodes[2][i].output = Normalization.Logistic(sum);
}
}
public void initilizeError()
{
for (int j = 0; j < hidden; j++)
{
nodes[1][j].error = 0;
}
for (int j = 0; j < input; j++)
{
nodes[0][j].error = 0;
}
}
public void Backpropagate(double[] desired)
{
#region error calculations
this.desired = desired;
for (int j = 0; j < output; j++)
{
nodes[2][j].error = (desired[j] - nodes[2][j].output);
}
for (int j = 0; j < hidden; j++)
{
// nodes[1][j].error = 0;
}
for (int i = 0; i < output; i++)
{
for (int j = 0; j < hidden; j++)
{
nodes[1][j].error += nodes[2][i].weights[j] * nodes[2][i].error;
}
}
for (int j = 0; j < input; j++)
{
// nodes[0][j].error = 0;
}
for (int i = 0; i < hidden; i++)
{
for (int j = 0; j < input; j++)
{
nodes[0][j].error += nodes[1][i].weights[j] * nodes[1][i].error;
}
}
#endregion
#region Backpropagation
for (int i = 0; i < input; i++)
{
var Dx = Normalization.Dx_Logistic(nodes[0][i].output);
for (int j = 0; j < input; j++)
{
nodes[0][i].weights[0] += nodes[0][i].error * inputs[j]*Dx;
}
}
for (int i = 0; i < hidden; i++)
{
var Dx = Normalization.Dx_Logistic(nodes[1][i].output);
for (int j = 0; j < input; j++)
{
nodes[1][i].weights[j] += nodes[1][i].error * nodes[0][j].output * Dx;
}
}
for (int i = 0; i < output; i++)
{
var Dx = Normalization.Dx_Logistic(nodes[2][i].output);
for (int j = 0; j < hidden; j++)
{
nodes[2][i].weights[j] += nodes[2][i].error * nodes[1][j].output * Dx;
}
}
#endregion
}
}
I can't realize, why my code doesn't work properly? Here is this simple code:
void main() {
TRISB = 0;
TRISD = 0;
while(1)
{
LATD.RB6 = 1;
Delay_ms(1000);
LATD.RB6 = 0;
Delay_ms(1000);
LATD.RD0 = 1;
Delay_ms(1000);
LATD.RD0 = 0;
Delay_ms(1000);
}
}
The effect of the code is that the LED on RD0 is flashing, and the LED on RD1 is permanently turned on! On RB6 there is nothing happening.
Note, that I'm using a development board, with Tiny Bootloader.
There is a typo - Latch D does not have pin B6! Change LATD.RB6 to LATB.RB6 and it should work.
If you do not want RD1 to be on, you can just do LATD.RD1 = 0
Fixed code:
void main() {
TRISB = 0;
TRISD = 0;
LATD.RD1 = 0;
while(1){
LATB.RB6 = 1;
Delay_ms(1000);
LATB.RB6 = 0;
Delay_ms(1000);
LATD.RD0 = 1;
Delay_ms(1000);
LATD.RD0 = 0;
Delay_ms(1000);
}
}
Hope this helps!