rust编译程序时间真慢长

正在gi945小主机上安装了rust, 但rust编译程序时间真慢长, 而且非常占用空间,这个是我最不喜欢的,比golang编译时间长很多。

最近继续学习rust,昨天用rust编写了一个actix_web的程序,执行外部的C语言程序,纯粹就是为了学习rust而写的,如果用python编写,估计很快搞定,以后估计会很少用 rust,我的工作环境不需要搞这么复杂,其实就用python和 golang就可以了.

发表在 一般生活 | 留下评论

rust的reqwest在actix_web中使用要注意的

rust的reqwest在actix_web中使用要注意的, 最近折腾着rust语言这些东西,学习下rust语言, 所以记录一下

在项目文件中,即是Cargo.toml文件中:

[dependencies]

reqwest = “=0.9.24” # 使用0.10.0以上版本都不行, 在不是actix_web

具体好像跟tokio这模块由关。

发表在 技术生活 | 留下评论

树莓派一代的gpio针脚记录

树莓派一代的gpio针脚记录, 最近在用这个树莓派搞红外通信,用来控制格力空调,所以从网上找来了图片,记录一下。

发表在 技术生活 | 留下评论

不知不觉的来到夏天

不知不觉的来到夏天, 就是上来的写几句,最近天气开始热起来了,前三天开始开空调睡觉了,又是短袖衣服的日子开始。

废话一下,最近的油价去到9.39元一升,95号油的。

然后生活还是这样,继续是开工,回家,两点一线的日子。

废话完毕。

发表在 一般生活 | 留下评论

lazarus的Console控制台程序编译记录

lazarus的控制台Console程序编译记录备忘, 其实不是lazarus, 是CodeTyphon64 , 编写正常有界面的程序就不用注意,但编写控制台程序时要主要,既是New Project 选择program,是一个控台程序,Console ,在uses里无法添加例如IdHTTP时,要在菜单Project => Project inspector => Required Package鼠标右键Add

这样添加以后,才能在uses哪里引用。

发表在 delphi | 留下评论

delphi版的 selenium测试

python的selenium模块非常好用,用在内部web网页系统获取数据和自动操作非常方便,于是在想delphi有没有selenium可用,找了一下,在github真的发现有.

网址: https://github.com/Ericwang1104/WebDriver4D

下载下来了后,加入delphi的搜索路径就可以用.

在delphi 10.4的操作就是打开菜单 tools => option => language => delphi => library => library path , 加WebDriver4D目录就可以了,默认是win32bit版本的,其它win64bit也要这样添加,然后就代码里引用库就可以了, WebDriver4D里边有例子.

以下是操作代码,是一个控制台程序.

program liulanqi2;

{$APPTYPE CONSOLE}

{$R *.res}

uses
System.SysUtils,WD_http ,WebDriver4D,wd_httpDelphi;
var
//bmp2:Tbitmap; uses Vcl.Graphics
WD: TWebDriver;
Ele, Ele1: TWebElement;
Ele2: TWebElements;
xxx:string;
//FCMD: TDelphiCommand;
begin
WD := TChromeDriver.Create(nil);
//bmp2:= Tbitmap.Create;
//WD := TPhantomjs.Create(nil);
//FCMD:= TDelphiCommand.Create(nil);;
try
try

      WD.Address := 'localhost';
      //WD.Port := 7777;

      //Webdriver4D.pas   chrome --headless 无头模式  ,大概1476行
      // +'"args": []}}},'   //正常模式
      //+ ' "args": ["--headless","--disable-gpu"]}}},' // hidden mode



      WD.StartDriver('D:/Anaconda3/chromedriver.exe');//路径正确
      //WD.StartDriver('D:/tools/delphi/WebDriver4D-master/WebDriver/phantomjs.exe');//路径正确
      //WD.Path :='';
      //WD.Cmd:= FCMD;
      //WD.Canshu:= '--headless';
      Sleep(500);
      WD.NewSession;
      WD.GetURL('https://www.lpfrx.com');
      //WD.SwitchToFrame('x-URS-iframe');


      Sleep(3000);
      Ele := WD.FindElementByXPath('//*[@id="s"]');


      //Sleep(5000);
      //定位搜索框,滚动画面   document.evaluat  可以用xpath定位
      WD.ExecuteScript('document.evaluate("//*[@id=''s'']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.scrollIntoView();');
      Ele.Click;
      //WD.ExecuteScript('document.getElementsByTagName("input")[0].scrollIntoView();');

      Sleep(1000);
      Ele.SendKey('delphi');

      Ele1 := WD.FindElementByXPath('//*[@id="searchsubmit"]');
      WD.ExecuteScript('document.evaluate("//*[@id=''searchsubmit'']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.scrollIntoView();');

      Sleep(2000);
      Ele1.Click;
      Writeln('hello world');   //输出一句话
      Sleep(1200);
      // html title
      //xxx := WD.ExecuteScript('return document.title');
      // 截图
      WD.ScreenShot('./s.bmp');
      // html body text
      xxx := WD.ExecuteScript('return document.body.innerText');
      Writeln(xxx);
      Ele2 := WD.FindElementsByXPath('//*[@id="s"]');
      Writeln('Ele2 搜索框数量:'+ inttostr(Ele2.Count));
      //Writeln(wd.ExecuteScript('return document.title'));
      Sleep(5000);
      wd.Quit;
  finally
      FreeAndNil(WD);
      //FreeAndNil(FCMD);
      //bmp2.Free;
  end;
{ TODO -oUser -cConsole Main : Insert code here }

except
on E: Exception do
Writeln(E.ClassName, ‘: ‘, E.Message);
end;
end.

整体跟python版操作差不多, 其实说到底seleium操作原理就是程序发送http json到chromedriver.exe程序操作,可以网上去看看selenium操作原理.

发表在 delphi | 留下评论