pascal

How can I access a delphi control from outside the form's unit?

本小妞迷上赌 提交于 2019-12-06 08:27:18
问题 I'm trying to call the Enabled property of a Timer from a procedure defined like this: procedure Slide(Form: TForm; Show: Boolean); and not with a fixed form name (like: Form2.Timer... ) After putting the form's unit in the uses list, this works: Form2.Timer1.Enabled := True; but the following is not working: Form.Timer1.Enabled := True; (where Form is the form passed as parameter to the procedure. How to get access to the Timer component on my form? Thanks in advance. 回答1: You cannot access

How do you get the current sample rate of Windows audio playback?

陌路散爱 提交于 2019-12-06 08:20:41
问题 I am using the Windows waveOut API (aka MME or Multimedia Extension) mmsystem.h. Some programs change the audio playback sample rate (eg. from 44.1kHz to 48kHz), and it would be very useful for my program to detect the current playback sample rate, so it can warn users that Windows will be resampling the program's output. According to this documentation http://msdn.microsoft.com/en-us/library/aa909811.aspx, waveOutGetPlaybackRate returns the resampling % that the device is currently

How can I detect elapsed time in Pascal?

拥有回忆 提交于 2019-12-06 06:09:47
问题 I'm trying to create a simple game in Pascal. It uses the console. The goal in the game is to collect as many 'apples' as you can in 60 seconds. The game structure is a simple infinite loop. Each iteration, you can make one move. And here's the problem — before you make the move ( readKey ), time can pass as much as it wants. For example, the user can press a key after 10 seconds! Is there any way to count time? I need the program to know when user plays (before and after a key is pressed),

Parsing Project and Package files using Gold Parser --help needed with 'IdList'

痴心易碎 提交于 2019-12-06 02:38:57
I am dabbling with the Object Pascal Engine (by Rob van den Brink) and it seems (except for a few minor and easily correctable errors) it works for Delphi unit files. However, it has problems parsing Project ( .dpr) and Package ( .dpk) files; and the issue basically boils down to the differences between the stuff that 'uses' can have in units and projects (as well as what 'contains' clause can have in packages). Let me give simple examples: In a unit (.pas) file, the 'uses' clause can be something like this uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs

Specially debugging line by line

允我心安 提交于 2019-12-06 00:31:20
I have a script written in Pascal. I would to debug it in this way: stop at every line, dump values of all variables in memory and go to the next line. Is it possible to do it with gdb or some other open-source tool for Linux? Compile file with option -g : fpc/gpc -g file.pas Run gdb for this file: gdb file Set all of needed variables: display first_var display second_var ... Start debugging: start By pressing s you can continue to the next line. I'll present a proof-of-concept that steps through a (single threaded) program, dumping all variables by using GDB's Python API: # Usage: gdb -x dump

Object Pascal 运算符,常量,变量

爱⌒轻易说出口 提交于 2019-12-05 19:43:02
不区分大小写 赋值运算符 := (Java里是=) 例如 var I:Integer; I:=30; 比较运算符 =,<>,<,>,<=,>= 特别注意: 判等 是=(Java里是==) 判不等 是<>(Java里是!=) 逻辑运算符 and or not 算术运算符 +,-,*, /(浮点数), div(整数), mod(取模) 位运算符: and,not,or,xor,shl(左移),shr(右移) 特殊运算符 in (集合类型) (子界类型) 集合的+,-运算 is,as进行对象类型转换 @取地址, ^取得指针对应的数据或声明指针类型 函数Addr作用与@相同,例如PI:=Addr(I); Inc和Dec Inc和Dec可以用于指针 无类型常量 有类型常量 const I:Integer=5; 全局变量可以被指定初始值和局部变量则不可以. 在声明常量,变量和类型时,可以使用编译时函数: Ord,Chr, Trunc,Round, High,Low, SizeOf 来源: oschina 链接: https://my.oschina.net/u/195841/blog/51863

目标检测_1

早过忘川 提交于 2019-12-05 12:14:54
Keywords :Ubuntu,VOC,Object_detection 1,环境搭建 ​ 使用anaconda3, 先安装 ​ 换源,若不然会非常慢 方式参考 https://www.cnblogs.com/Dean0731/p/11560371.html ​ export PATH="/usr/local/anaconda3/bin:$PATH" ​ 新建虚拟环境 本例python=3.5 ​ 进入环境本例安装的tensorflow=1.14.0 ​ 安装其他依赖包,pillow,lxml 等,亦可以等待报错时安装相应模块 2,下载数据 models: https://github.com/tensorflow/models.git 使用git下载 或直接下载zip VOC2012:链接: https://pan.baidu.com/s/12IP4iyL9hN5Dohzkm8wi7A 提取码: q31q 也可到官网下载,比较慢 visual object classes 2012 一共20类别,一共5个文件夹 JPEGImages存放图片; Annotation存放对图片的标注信息(XML文件),即外包边框bounding box的位置信息; SegmentationClass和SegmentationObject存放了图片的分割前景。 ImageSets是对图片集合的描述

string to integer conversion in Pascal, How to do it?

徘徊边缘 提交于 2019-12-05 08:52:11
How to convert a number printed in a string into integer? Thank you. The is procedure Val: procedure Val(S; var V; var Code: Integer); This procedure operate on decimal and real numbers. Parmeters: S char sequence; for proper conversion it has to contain ‘+’, ‘-‘, ‘,’, ’.’, ’0’..’9’. V The result of conversion. If result going to be an Integer then S can't contain ‘,’, ’.’. C Return the position of the character from S, that interrupt the conversion. Use cases: Var Value :Integer; Val('1234', Value, Code); // Value = 1234, Code = 0 Val('1.234', Value, Code); // Value = 0, Code = 2 Val('abcd',

机器人10大流行编程语言

自作多情 提交于 2019-12-05 06:45:35
  世界上有1500多种编程语言,都要学的话是太多了。目前,在机器人学中有这10种最流行的编程语言——如果你喜欢的不在这里,请在留言区告诉大家。对于机器人学,每种编程语言有不同的优点。我只是部分地按照重要程度从低到高对它们进行了排序。    10.BASIC/Pascal   BASIC和Pascal是我最早学过的两种编程语言。不过这并不是我把它们列在这里的原因。对于几种 工业机器人 语言,它们是基础,下面说明一下。BASIC是为初学者设计的(BASIC是缩写,BeginnersAll-PurposeSymbolicInstructionCode),它让初学者可以从一种非常简单的编程语言开始学习。Pascal旨在鼓励好的编程习惯,还引入了结构,例如指针,这让Pascal成为从BASIC到更复杂语言的一块“敲门砖”。如今,这两种语言如果要说是好的“日常使用”程序语言,那是有点过时了。不过如果你准备做很多底层编码或是想要熟悉一下其它工业机器人编程语言,学习一下还是有用的。    9.工业机器人编程语言   几乎每一个机器人制造商都开发了他们自己专有的机器人编程语言,这成了工业机器人行业中的一个问题。通过学习Pascal,你会熟悉它们中的一部分。但是每次开始使用新的机器人时,你还得学习一种新的编程语言。   最近几年,ROS行业已经开始提供更标准化的替代语言给程序员

Are Pascal comments supposed to nest?

久未见 提交于 2019-12-05 04:09:56
I have a compiler homework question that wants me to draw a DFA for Pascal comments, but I have never (and probably never will) use Pascal. The question does not specify if we should use ANSI Pascal or Turbo Pascal, so I was going to do one for both. Some Google searches showed me that Turbo Pascal allows nested comments as long as the same delimiter is not used, so {(*comment*)} is ok and so is (*{comment}*) , but {{comment}} or (*(*comment*)*) are not ok. My question here is if a comment like {(*{comment}*)} or (*{(*comment*)}*) is ok since the same delimiters are not used in a row. I also