RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-294713

HideME's questions

Martin Hope
HideME
Asked: 2022-05-05 18:29:10 +0000 UTC

Delphi中的错误E2029

  • 0
procedure eraseSubstr(const pos:vector; var text:string; const pattern:string);
var
  len, iter, end_, endPos:Integer;
  t:string;
begin
  t:=text;

  len:=Length(pattern);
  if (Length(pos) < 2) then
  begin
    Delete(t, pos[0], length);
  end;

end;

错误发生在函数上Delete。

错误 -[dcc32 Error] Functions.pas(58): E2029 '(' expected but ')' found 有没有人经历过这个?请帮忙。

delphi
  • 1 个回答
  • 10 Views
Martin Hope
HideME
Asked: 2022-06-22 13:33:20 +0000 UTC

每 10 秒崩溃一次

  • 0

手机每隔十秒就死机一次,我什么都做不了,我不能在手机上工作,救命在此处输入图像描述 在此处输入图像描述

android
  • 1 个回答
  • 10 Views
Martin Hope
HideME
Asked: 2022-03-30 22:41:55 +0000 UTC

匹配比例或匹配 w

  • 0

我绘制了两个不同比例的图表,但我无法将它们沿 w 轴组合。需要根据 0 = -pi 的原理将 L(w) 和 -Fi(w) 结合起来。我在 python + matplotlib 中绘图。

import matplotlib.pyplot as plt
import numpy as np

def W(w):
    return 36.69487 / (0.00008214*(1j*w)**4 + 0.017538*(1j*w)**3  + 26.440677*(1j*w)**2 + (1j*w))

def A(w):
    resW = W(w)
    return np.sqrt(resW.real**2 + resW.imag**2)

def L(w):
    return 20*np.log10(A(w))

def Fi(w):
    resW = W(w)
    U, V = resW.real, resW.imag
    return np.arctan(V/U)

w = np.linspace(0.01, 1000, 1000)
wzero = np.zeros(w.shape)


fig, ax = plt.subplots()
ax1 = ax.twinx()
ax.plot(w, L(w),color='r')
ax1.plot(w,-Fi(w)-np.pi,color='b')
plt.xscale('log')
plt.xlim([0.01,100])
ax.set_ylabel('L(w)')
ax1.set_ylabel('-Fi(w)')

日程

python
  • 1 个回答
  • 10 Views
Martin Hope
HideME
Asked: 2021-11-30 02:08:48 +0000 UTC

使用汇编程序时 Debug/Release 操作的区别

  • 0

我从汇编模块导入一个函数,在调试中一切正常,但在发布中一切都停止工作。我不明白为什么。主程序用C++(Visual Studio 2019)编写,汇编模块由MASM编译。

主程序(C++)

#include <iostream>

void print(short** arr, const short m, const short n);
void print_vec(short* v, const int n);
extern "C" void __cdecl mat_vec_mul(short** mat, short* vec, short* vec_res, const short m, const short n);

int main()
{
    const short M = 3;
    const short N = 2;

    short** matrix = new short* [M];
    short* vec = new short [N];

    for (short i = 0; i < N; i++)
    {
        vec[i] = i + 1;
    }

    short* vec_res = new short [M];

    for (short i = 0, el = 1; i < M; i++)
    {
        matrix[i] = new short[N];
        for (short j = 0; j < N; j++, el++)
        {
            matrix[i][j] = el;
        }
    }

    std::cout << "Source matrix" << std::endl;
    print(matrix, M, N);
    std::cout << "\nSource vector" << std::endl;
    print_vec(vec, N);

    //prototype of mul in c++
    //for (short i = 0; i < M; i++)
    //{
    //  vec_res[i] = 0;
    //  for (short j = 0; j < N; j++)
    //  {
    //      vec_res[i] += matrix[i][j] * vec[j];
    //  }
    //}

    mat_vec_mul(matrix, vec, vec_res, M, N);

    std::cout << "\n\nResult vector" << std::endl;
    print_vec(vec_res, M);



    delete[]vec;
    delete[]vec_res;

    for (short i = 0; i < M; i++)
    {
        delete[]matrix[i];
    }
    delete[]matrix;


    std::cin.get();
    std::cin.get();
    return 0;
}

void print(short** arr, const short m, const short n)
{
    for (short i = 0; i < m; i++)
    {
        for (short j = 0; j < n; j++)
        {
            std::cout << arr[i][j];
            if (j != n - 1)
                std::cout << " ";
        }
        std::cout << std::endl;
    }
}

void print_vec(short* v, const int n)
{
    for (short i = 0; i < n; i++)
    {
        std::cout << v[i];
        if (i != n - 1)
            std::cout << " ";
    }

}

连接文件mat_vec_mul.asm的代码

.686P
.model flat, C

.data
    small_size = 2
    ptr_size = 4
    msize dw 0
    nsize dw 0
.data?
    i dw ?
.code
public mat_vec_mul 
mat_vec_mul proc near
    push ebp
    mov ebp, esp

    mat equ dword ptr [ebp+8]
    vec equ dword ptr [ebp+12]
    vec_r equ dword ptr [ebp+16]
    m equ dword ptr [ebp+20]
    n equ dword ptr [ebp+24]

    xor ecx, ecx
    xor eax, eax

    mov eax, m
    mov ecx, dword ptr ptr_size
    imul ecx
    mov dword ptr msize, eax
    xor eax, eax

    mov eax, n
    mov ecx, dword ptr small_size
    imul ecx
    mov dword ptr nsize, eax
    xor eax, eax
    xor ecx, ecx

    ;mov ecx, m

    xor ebx, ebx
    mov ebx, mat

    xor esi, esi
    mov esi, vec_r

    ;xor edi, edi
    ;mov edi, vec


    .repeat 
        mov dword ptr i, ecx
        ;mov eax, dword ptr [esi]
        mov word ptr [esi], 0

        xor edi, edi
        mov edi, vec

        xor ecx, ecx
        .while (ecx < dword ptr nsize)
            
            ;ebx=i;ecx=j
            mov eax, dword ptr [ebx]
            mov ax, word ptr [eax+ecx]
            mov dx, word ptr [edi]
            ;mov dx, word ptr [edx]
            imul dx;dx:ax = mul

            xor edx, edx
            ;mov edx, dword ptr [esi]
            ;mov [edx], ax

            add word ptr [esi], ax

            
            add ecx, small_size
            add edi, small_size
            
        .endw 


        mov ecx, dword ptr i
        add ecx, ptr_size

        ;mov eax, dword ptr ptr_size
        add esi, small_size
        add ebx, ptr_size
        xor eax, eax
        
    .until (cx >= word ptr msize)

exit:
    xor esi, esi
    xor edi, edi
    xor ecx, ecx
    xor ebx, ebx
    pop ebp
    ret
mat_vec_mul endp
end

调试

在 Release 的第 86 行,抛出了一个 nullptr 异常。vec_res 是空的,但一切都在调试中工作。

c++
  • 1 个回答
  • 10 Views
Martin Hope
HideME
Asked: 2021-10-15 03:41:38 +0000 UTC

从 kernel32 调用 winapi 函数

  • 0

没有找到如何调用 QueryPerformanceCounter 函数。像这样试过。给出错误,不知道 BOOL 和 LARGE_INTEGER 是什么。

import core.sys.windows.windows;
import core.sys.windows.w32api;
import core.sys.windows.winbase;
pragma(lib, "kernel32");
extern (Windows)
{
    BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount);
}
void main()
{}
winapi
  • 1 个回答
  • 10 Views
Martin Hope
HideME
Asked: 2020-03-13 05:55:55 +0000 UTC

添加重复项

  • 1

有重复的行。例如,

A 1
B 2
A 3
C 8
B 4

您需要添加重复项的值。那些

A 4 
B 6 
C 8
python
  • 1 个回答
  • 10 Views
Martin Hope
HideME
Asked: 2020-02-14 00:24:34 +0000 UTC

在 .dll (c#) 中找不到函数

  • 0

在我包含的 .dll 中找不到函数(funcPtr == 0)。我假设函数的名称在内部以某种方式被编码或更改,但我自己还无法弄清楚。

程序:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace Lab1Dynamic
{
    class Program
    {
        [DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)]
        static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string lpFileName);

        [DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
        static extern IntPtr GetProcAddress(IntPtr hModule, string procName);

        [DllImport("kernel32", SetLastError = true, EntryPoint = "GetProcAddress")]
        static extern IntPtr GetProcAddressOrdinal(IntPtr hModule, IntPtr procName);

        private delegate double fDelegate(double x, double y);
        static void Main(string[] args)
        {
            var dllPath = "MyLibrary.dll";
            IntPtr dllInstance = LoadLibrary(dllPath);
            while (dllInstance == IntPtr.Zero)
            {    
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Can't load DLL " + dllPath);

                Console.ForegroundColor = ConsoleColor.Gray;
                Console.WriteLine("Write the path below...");
                dllPath = Console.ReadLine();
                dllInstance = LoadLibrary(dllPath);
            }

            string fname = "f";
            IntPtr funcPtr = GetProcAddress(dllInstance, fname);
            fDelegate fd = (fDelegate)Marshal.GetDelegateForFunctionPointer(funcPtr,
                typeof(fDelegate));
            var y = fd(1.0, 2.0);
        }
    }
}

dll:

using System;

namespace MyProj
{
    public class MyLibrary
    {
        public static double f(double x, double y) => 3 * Math.Sin(x) + 2 * Math.Cos(y);
    }
}

DLL(C++,VS2019):MyLib.h:

#pragma once
extern "C" __declspec(dllexport) double f(const double x, const double y);

MyLib.cpp:

#include "MyLib.h"
#include "pch.h"
#include <cmath>
double f(const double x, const double y)
{
    return 3 * sin(x) + 2 * cos(y);
}

PS根据MDSN的指南here

c#
  • 1 个回答
  • 10 Views
Martin Hope
HideME
Asked: 2020-03-21 00:05:33 +0000 UTC

符号显示不正确

  • 2

我从 Yandex 编写了一个简单的天气解析器,但如果温度为负,那么它会显示一个问号。尝试了很多东西,但到目前为止没有任何帮助。请帮忙。在此处输入图像描述

代码(Python 3.7)

import urllib
from bs4 import BeautifulSoup


def ParseWeatherYandex(city):
    url = 'https://yandex.ru/pogoda/' + city
    page = urllib.request.urlopen(url).read()
    soup = BeautifulSoup(page, 'html.parser')

    #getting time now, temperature and condition
    day = soup.find('time', 'fact__time').contents
    temperature = soup.find('span', 'temp__value').contents
    weather_type = soup.find('div', 'link__condition day-anchor i-bem').contents

    #parsing feeling temperature
    t = soup.find('dl', 'term term_orient_h fact__feels-like')
    t = ((t.div).span).contents


    #joining lists in one
    feels = list(soup.find('dt', 'term__label').contents) + t


    print(day[0] + '\n' + 'Температура сейчас: '+ (temperature[0]).center(3), end='\n')
    print('Погода: %s' %weather_type[0], end=', ')
    print('%s %s' %(feels[0].lower(), feels[1]))



ParseWeatherYandex(input())

input()
input()
python
  • 1 个回答
  • 10 Views
Martin Hope
HideME
Asked: 2020-01-09 04:53:02 +0000 UTC

泰勒级数,展开,一般术语

  • 0

我正在尝试将系列 1/sqrt(x+1) 扩展为泰勒级数。Wiki 说 sqrt(1+x) 的公式公式

因为 1/sqrt(x+1) = (sqrt(x+1))^-1,然后我试着把图中的分数翻转过来,数一下数列的项,结果发现公式是错误的。告诉我出了什么事。

математика
  • 2 个回答
  • 10 Views
Martin Hope
HideME
Asked: 2020-12-22 05:20:56 +0000 UTC

通过智能指针进行动态内存分配

  • -1

需要动态分配120个对象,然后存储一个指向它们的指针向量。有没有人知道如何比现在做得更好(ps代码不能循环工作)?

int main()
{
    std::vector<Customer*> customerList(120,nullptr);

    std::shared_ptr<std::vector<Customer>> customers(new std::vector<Customer>(120));

    for (auto i = 0;i<customers->size();i++)
    {
        customerList.push_back(&(customers->[i]));
    }

    //cout << customers->at(0);
    return 0;
}
c++
  • 2 个回答
  • 10 Views
Martin Hope
HideME
Asked: 2020-11-04 23:58:59 +0000 UTC

如何从第二个向量中包含的 vector<int> 元素中删除?

  • 1

我们有一个向量vector<int> first,我们也有第二个向量vector<int> second。

有必要从第一个向量中删除第二个向量中包含的所有元素。我知道可以用2个周期在额头上解决它,但是如果您有任何想法,请提供帮助。

如何才能做到这一点?

c++
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5