读取输入直到完成的最简单,最有效的方法?我有没有遗漏您认为的内容? [英] Simplest and most effective way to read input until it complets? did I leave anything out you think?

查看:75
本文介绍了读取输入直到完成的最简单,最有效的方法?我有没有遗漏您认为的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之所以发布此信息,是因为我希望以最简单的方式提出意见,因为我似乎过于复杂了...

I'm posting this because I would like opinions on the simplest way to go about this, because I seem to be over complicating it...

 

我有一个文本框,所需的操作是将读卡器中的文本发送给它,就像我在其中键入内容一样...

I have a text box, and the desired operation is the text from a card reader is sent to it just as if I was typing it in...

然后,在插入所有文本后,文本框将自动在数据库中搜索已征募的用户卡,然后打开门,并使用日期时间和所有内容记录事件...

Then when all the text is inserted, the text box will automatically search the database for the enlisted users card, then open the door, and log the event with the date time and all that...

但是如果有该文本框,则在计算机启动时,它将自动启动该程序.然后它将光标设置到准备输入的文本框...

But with the text box thats there, when the computer starts up, it will auto start this program. Then it will have the curser already set to the textbox ready for input...

就这样...

但是该程序需要知道何时从读卡器接收数据,因为没有发送验证信号,它只是停止发送...

But the program needs to know when it is done receiving the data from the card reader as there is no verification signal sent, it just stops sending...

并且读卡ID的长度也将是随机的,并且可以使用标准英语键盘键入任何字符...

And card ID's read will also have random lengths and any character possible to type with a standard English keyboard...

所以,我在想,每个字符输入(我测试的最慢的速度是在200 MHz计算机上,在Windows 98 OS上的写字板中,每个字符大约需要1秒,这是因为该计算机毫无理由地非常懒惰...大声笑

So, I was thinking, that with every character entry (the slowest I have tested this to be on a 200 MHz Computer into word-pad on a windows 98 OS, was about 1 second per character, that's because that computer was extremely lagy for not reason...lol

我假设每次输入字符时都可以启动一个2-3秒计时器,如果在该时间内输入了下一个字符,它将取消计时器并重新开始计时,然后对输入的每个字符重复一次. ..

I am assuming that with every character entry I can have it start a 2-3 second timer and if the next character is entered within the time, it cancels the timer and starts timing again, then it repeats for each character entered...

然后在最后一次租船中运行3秒钟,然后确认已完成接收,然后进行数据库索引搜索或检查匹配卡条目的操作,然后允许/拒绝从那里进行访问...

Then on last charter it runs the 3 seconds, then confirms its done receiving then does a database indexing search or whatever to check for the matching card entry then allow/deny access from there...

我正在尝试使其具有读取和检查卡号的时间,同时又要足够快,以至于门口的人不会因为浪费时间而浪费一秒钟.

I'm trying to make it so it has the time to read and check for the cards numbers, while being fast enough that the person at the door does not have a cow over wasting a few extra seconds of their life...

这有效吗?我只有一些基本的代码可供执行,但我想提出意见.首先是一种更有效的方法...

Is this effective? I have just some basic code that is ready for this to be implemented, but I wanted opinions  first on a more effective way to do this...

我想来回回想尝试并尽可能地优化它...我现在将在上面开始尝试,但是我有什么打算! :)

I'd like to toss ideas back and forth to try and optimize this as much as possible... I'll start trying this above now, but I'm up for anything! :)

感谢您的帮助,这是我自愿为大学的IEEE小组免费提供的一个项目,因为主访问系统的安装测试费用约为3,000,等等.在Microsoft中进行的访问速度很慢,并且 一直在打扰...大声笑

Thanks for the help, Its a project for the IEEE group at the university that I volunteered to do for free because the main access system costs about 3,000 to install test, etc... And an old setup they have now that was made in Microsoft access is slow and breaks all the time...lol

推荐答案

我还想到了一种自动循环中的背景暂停类型,它将每次检查任何类型的更改.

I was also thinking of a type of background pause in an automated loop that will check each time for any type of changes...

就像文本框为NULL并且其中没有任何内容一样,它会停止计数并关闭,直到输入事件触发它再次打开...

Like if the textbox is NULL and nothing is in it, it stops counting and turns off, until an input event triggers it to turn on again...

然后,当它打开时,它得到一个输入,它存储该输入,并将先前的输入与下一个输入进行比较,然后继续检查是否再次更改,然后再计算2之后是否计数没有变化.算作安全检查,然后搜索 数据库?

Then when it is on, and it gets an input, it stores the input, and compares previous input to the next input, then keep rechecking if it changed again, then if it counted that it did not change after lets say 2 counts as a safety check, then it searches the database?

然后将所有内容清除掉,包括文本框在内的内存中的NULL,然后等待下一个初始字符输入?

then it clears everything out back to NULL in memory including the textbox, then waits for the next initial charcter input?

听起来更好吗?还是有更好的东西了?

Does this sound better? or is there something better yet?

在允许文本框仍然接受数据的同时,我应该使循环停止再次读取和比较的平均时间(以毫秒为单位)是什么?

What average time in milliseconds should I stall the loop from reading and comparing again while allowing the textbox to still accept data?

我现在将尝试使用600 MS的值...

I'm going to try for a value of 600 MS for now...


这篇关于读取输入直到完成的最简单,最有效的方法?我有没有遗漏您认为的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆