Sign in to follow this  
Followers 0
ArxBzFhblxphS

..

8 posts in this topic

#1 ·  Posted (edited)

Posted Image Edited by Thanubis

Share this post


Link to post
Share on other sites



Hi again,

I believe this is kind of continuation of my last (new) reply to the other thread.

Here's a game: you are promoted to play the role of the interpreter. Then explain (in precise plain words) when you exit the loop in both codes?

Indeed, there is a difference!


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Looking again at your first post.

In the first code the timer is armed after a non-empty string is received

and the loop exited (thru ExitLoop) on receipt of an empty string and if 3s have elapsed after being armed last.

In english, you ExitLoop on receiving an empty string 3s or more after the last receipt of non-empty data.

In the second code the timer is made inactive after a non-empty string is received

it is made active and armed at receipt of an empty string

and the loop exited (thru ExitLoop) on receipt of an empty string and if 3s have elapsed after being armed last.

In english, you ExitLoop on receiving an empty string 3s or more after the last receipt of the first empty string following the receipt of non-empty data.

Whatever that works or not in your case, I don't see both the same.

Now, given what TCPRecv dose (after looking at the help file), I bet that neither code is foulproof. The timer variable should be initialized.

I haven't tried it but I suspect that if a single (or 2, dunno) 0x00 is/are received, then your comparison with "" is going to work, albeit you _have_ received something.

So even the code standing for "emtpy string" is questionnable. Again, I have not tried it.

As for your second post, you sort of cheated by removing the variable input :D


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

Looking at that code, I dont see how timerdiff comes into it really

If $blah1 then

$Blah2 = TimerInit()

Else

$Blah3 = Timerdiff($blah2)

Endif

This is _inside_ a loop, which also receive varying inputs successively. If at some time condition "blah1 is met, thenthe timer is armed. After that, if ever condition blak1 is not met anymore, then the timerdiff is computed. Do you see that? That's pretty standard.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

This is _inside_ a loop, which also receive varying inputs successively. If at some time condition "blah1 is met, thenthe timer is armed. After that, if ever condition blak1 is not met anymore, then the timerdiff is computed. Do you see that? That's pretty standard.

Yup !

Well I do now anyway.

Cheers.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

@Thanubis,

Again, I'm not posting "against you" to make you as an idiot, nor to show how smart I am. Trust me, I've made terrible mistakes and I keep on doing so at times, like everyone.

I found it a nice example of showing you and all future reader some subttle differences and illustrate that even if AutoIt is a simple to use language, it nonetheless _is_ a computer language which (like any oher language) doesn't read your mind but instead very strictly what you wrote, intended or not.

On this basis, you (and me) need to be very precise in what we write. Do so is generally difficult but can be made a little easier when using rigid principles and good habits.

Cheers


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0