Jump to content

Setting up a Queuing System


Recommended Posts

There is a similar potential issue with _Array* functions. Since the array can't be shared across processes, the typical setup will be to use an asynchronous (AdLib) function to write to the array and the main flow processing stuff.

No _Array* function is atomic enough to protect against data loss. But in the case of a all-in-one process simple code can protect against conflicts.

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)

Link to comment
Share on other sites

Zeerti,

I appreciate the mention of your programming level.

What I have shown by that example is working with a 1D (1 dimensional) array and using Standard UDFs to modify the array.

To use an ini file is to use IniReadSection and IniWriteSection to handle the queue and that is 2D array with differculty increased. You will still need to manage the queue in the array. You could possibly do it with IniRead and Iniwrite using perhaps a 1D array to keep the data uniform though the pushing of the queue would still be a challenge for you. As for a single variable to hold a queue is IMO not a good idea to try.

Something to consider with the options being shown. You are going to need to learn with what ever option you choose. The database idea would also be included as a challenge. So, be wise on the choice of your challenge as you have been now informed of what is involved. :)

Edit:

@jchd, only one process needed. Someone else mentioned 2 processes which I consider as not needed.

Edited by MHz
Link to comment
Share on other sites

Hi MHz,

Even with only one process: what if AbLib invokes _ArrayAdd while the main program is in the midst of _ArrayPush? Or reversely, or with another couple of _Array* functions. Either not have Ablib function and perform all tasks sequentially in the main loop or protect against concurrent changes of the array but it's not as simple as it sounds.

Edited by jchd

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)

Link to comment
Share on other sites

Hi jchd,

I had to search this topic for Adlib as I fail to see it in the script posted as topic. So I am at a loss to understand why the array modification cannot be in the loop that already exists without any Adlib to handle it and yet have a concurrent issue as you seem to suggest.

Link to comment
Share on other sites

I don't especially refer to the original post. Since adlib or multiple processes have been mentionned several times it's only a warning that concurrency is no more guaranteed with _Array* functions than it is with Ini* functions. It's easy to overlook this caveat.

That's why I wrote "Either not have Ablib function and perform all tasks sequentially in the main loop or protect against concurrent changes of the array"

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)

Link to comment
Share on other sites

Zeerti,

I appreciate the mention of your programming level.

What I have shown by that example is working with a 1D (1 dimensional) array and using Standard UDFs to modify the array.

To use an ini file is to use IniReadSection and IniWriteSection to handle the queue and that is 2D array with differculty increased. You will still need to manage the queue in the array. You could possibly do it with IniRead and Iniwrite using perhaps a 1D array to keep the data uniform though the pushing of the queue would still be a challenge for you. As for a single variable to hold a queue is IMO not a good idea to try.

Something to consider with the options being shown. You are going to need to learn with what ever option you choose. The database idea would also be included as a challenge. So, be wise on the choice of your challenge as you have been now informed of what is involved. :)

Edit:

@jchd, only one process needed. Someone else mentioned 2 processes which I consider as not needed.

 

I figured it would help me and you ultimately if you knew that I am by no means an expert.

The way the program is currently written 'works' but it ends up missing most of the requests as it is already running one.  I did dabble in having it save and push the requests into a 1D array, but I kept having a lot of issues with it pulling the proper ones or it even saving them properly.

Technically the only thing it needs is the account # to run the script, but with the Regular Expression I used it pulls all three things, 'GSLU' 'Account #' and 'Health'

I don't know a whole lot about how regular expressions work, so if there is a way to have it locate GSLU and then only pull the account # and then also recognize health without pulling it into the array that might make things easier ultimately. 

It's a rather crude mock-up and there are several snags with the website that I have no idea how to even get around without forcing mouse enumerations.  This leads me to the next issue with the script.

with the current iteration of it, it can only run one instance at a time and one look up at a time. It currently takes ~40 seconds to do a look-up and relay the information to the chat room. I haven't the slightest clue as to how to get around this as I have  tried using the _IE commands and they only work up until a specific point. When looking up an account it pulls up a JScript window within the website its self and for w/e reason the _IE does not recognize it, not to mention ControlClick/Send() also clicks/types behind the window instead of on it. Here is an image of it. IaNdvWL.png

 

Now the website does have API calls that I have not been privileged enough to know as the parent company is EXTREMELY picky about giving these out to anyone but a small group. Is there a simple way to figure out what the API calls are or would that be a guess and check type situation? Some of the software we use does run API calls, would it be possible to capture the packet that is being sent to the server and edit it with the information that we are needing and then on transit back decode it? I realize all of this is WAY above my level of understanding, but it's something I was curious about.

Hi Zeerti, would you mind showing us a few lines (messages) from the chat room?

Here are a few lines from the chat room. I've got the script to run when it finds the following within the line of text "GSLU 123456789 Health"

 

(8/8/2013 2:05:55 PM) R: team assignments are  out
(8/8/2013 2:06:21 PM) T: Ha Ha Ha Really 
(8/8/2013 2:06:32 PM) T: Look at some of the old movies and tell me that's not true
(8/8/2013 2:06:49 PM) T: also find out whose playing the voiceover for some of the characters
(8/8/2013 2:07:31 PM) T: My 15 year old daughter pointed this out to me and it struck me as true
(8/8/2013 2:07:32 PM) T: http://www.cracked.com/article_15677_the-9-most-racist-disney-characters.html
(8/8/2013 2:07:46 PM) T: there was a documentary done on it

 

Here are a few lines with a few things edited to preserve my job.

Link to comment
Share on other sites

I have to go along with jchd on the concurrency issue.  I have personally hit on the concurrent INI file writes issue, as well as other concurrency issues in the past.  That was why I wrote the cooperative semaphore UDF.  If you are going to have two processes (which I don't see a good way around given the original OP post) you need to implement file locking or semaphores.

Link to comment
Share on other sites

Not surprising.

BTW, there is officially no file locking associated with Ini* functions up to the latest beta [source: Jon].

Aftermath: my "guess" was correct and INI files are not a reliable mean to implement what the OP looks for and my "overkill" solution is one of the simplest possibility and certainly the most reliable and flexible.

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)

Link to comment
Share on other sites

Not surprising.

BTW, there is officially no file locking associated with Ini* functions up to the latest beta [source: Jon].

Aftermath: my "guess" was correct and INI files are not a reliable mean to implement what the OP looks for and my "overkill" solution is one of the simplest possibility and certainly the most reliable and flexible.

 

So then where do I even go to begin to look into the SQL related stuff?

Link to comment
Share on other sites

SQLite UDF in helpfile is a good start.

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)

Link to comment
Share on other sites

In a first step split the job in two programs: one monitors the log file or otherwise captures input, filters meaningless data out and writes actual GSLU commands to a SQLite DB. The other is essentially you current program which picks new commands from the DB and process them.

If you need help for designing the schema of your DB or other point in updating or querying it, just ask.

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)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...