Verbot Player with SQL Console (new approach to data)

Tips and questions about scripting your Verbot®.

Moderator: Staff

Verbot Player with SQL Console (new approach to data)

Postby MikeA » Fri Jan 27, 2012 2:54 pm

I'm putting together a console / Windows form app that can access an SQL database, that hopefully will allow to and from communication with Verbot, as an alternative idea to CSV databases.

So, to kick of with reply to JonC from CSV thread.

JonC wrote:As for SQL - I know nothing.


For sure you know more than you think. Everything we have been doing with CSV is to emulate the SQL data approach using tables, rows and columns (whether you realised that or not).

JonC wrote:All I was meaning was that the Verbot can read and write to a csv file somewhere.


Exactly. But what I realised was, that if an external programme was dealing with this connection, it could use SQL instead (or both). An SQL database, when the data is viewed looks just like Excel would dipslay a CSV file. But when beign manipulated, there is no need to be splitting strings, etc to get to one piece of data.

JonC wrote:The Verbot can read-write to a "csv-type" file, what I was suggesting was that we could use a console type program to "condition" the data for the Verbot from the data output of a third program.
The only Verbot commands to do external things are the Run command. Inherently this can run a number of programs on your PC (Notepad etc.) and we can now get an external program to "force" data into the Verbot (see http://www.verbots.com/forums/viewtopic.php?f=7&t=3202.
Thus in principle, if we can also supply the external program with data (equivalent of Verbot5.exe --input "blah blah") then the Verbot can interact with another program, both "forcing" it and being "forced" to, take note of the communication between the programs.

...

Thus (hypothetically), you could have the Verbot send a line to your console program saying (e.g.) "get me data on XXXX".
This goes to your "interface console" (resident on your website) which reads this data and then processes that info and makes the requisite web-page access requests to your SQL DB or whatever, gets the data back, conditions it for the Verbot and re-presents it in "csvtype" form, either outputting this to another web-page that the Verbot reads (we've already got that one working btw), or (and don't ask me how) forcing the Verbot to take note with the Verbot5.exe etc. command.

My reason for thinking this way is that it gets past the limitation of Verbot C# (we may not have access to all C# libraries) and even allows you to use a different language for the "interface" if you wish.


Right. That looks like it can work then. I've got the external programme receiving parameters put after the file name. All I need to do is get it to send back text to Verbot (which would be the data obtained).

One thing I should add. What I'm working on is a Windows app, not an online helper. So the idea is it would be a local program that perhaps is run directly from Verbot when data actions need to be done.

JonC wrote:Now, for Online Verbots, we would have the problem of "addressing" the server hosted program ... back to the problem above!


Might not be a problem if the local one works. What I've done so far is only looking at desktop Verbot player, not online. But if it works for desktop I try to make a web version to do the same thing.

JonC wrote:The difficult part, AFAIK is actually getting the Verbot to write to a Webpage - this is what has had me and Sylvain stumped for a while, but as I said, Bluespace may have got this to work now, but I haven't had time to check out his code yet.
Trust me, I'd be delighted if you could help out here, I'm just to busy to give it the time it needs right now!Feel free to take this one on.


What do you mean here? You mean the desktop player accessing a web page, or actually editing a web page?
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Verbot Player with SQL Console (new approach to data)

Postby MikeA » Fri Jan 27, 2012 6:28 pm

Ok..... to add.... my first issue here is how to run applications from Verbot.

I have tried running my new app from both the Command space and using <run c:\#####.exe>. However, neither works. Perhaps this is not possible? I've never tried it before. If it's not possible then that makes what I want to do difficult.

I know notepad works, but perhaps it has to be one from a list of pre-selected applications?


EDIT: Forget what I just said. The problem was the interface between the outside world and Verbot............... (me, in other words)
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Verbot Player with SQL Console (new approach to data)

Postby JonC » Sat Jan 28, 2012 8:26 am

Okay, Mike - my bad.
Let me be specific.
As we both know, you can't (or at least couldn't - before the advent of remote hosting) use csv files with Verbots Online because the only thing you can upload is a ckb.
We tried to "fool" the system in a variety of ways, but the only thing that was a constant was failure (or did you manage it in the end?)
What Sy 'n' I were trying to work on was getting the Verbot to read and write (therefore edit) a webpage. This would mean that the Verbot Online was using a webpage the way a Standalone uses the HDD to store data.
Reading proved easy enough with a "tweak" to Matt's RSS feed vcm.
Therefore we could use get the VerbotOnline to read csv or txt data from a webpage - thus we have "read only" data access.
What we wanted to do was to also be able to write that data - and that proved harder than we thought in our naivety.
I spoke to a computer whizz friend of mine (as well as to Matt here) and all said that I'd need to use SQL and PHP.
Frankly I baulked a little - I have enough "interesting times" with C# that learning two new programming languages was not at the top of my agenda shall we say.
We also contacted Bluespace on this, (he hosts Sy's stuff on his servers).
At the last update (and, as said I've been too busy with other stuff recently to check out what he did) Bluespace thought he'd cracked it - hence my suggestion for you to contact him.
So what we have is a half-way house. We can read, but not write.
What I was thinking was that an external program designed to interface with the Verbot and handle the webpage interface might be easier to "address" than a webpage itself, at least it's another approach worth investigating.
JonC
SupremeBot
SupremeBot
 
Posts: 665
Joined: Wed Apr 02, 2008 6:34 am
Location: Leicestershire, Great Britain

Re: Verbot Player with SQL Console (new approach to data)

Postby MikeA » Sat Jan 28, 2012 10:19 am

JonC wrote:Therefore we could use get the VerbotOnline to read csv or txt data from a webpage - thus we have "read only" data access.
What we wanted to do was to also be able to write that data - and that proved harder than we thought in our naivety.
I spoke to a computer whizz friend of mine (as well as to Matt here) and all said that I'd need to use SQL and PHP.
Frankly I baulked a little - I have enough "interesting times" with C# that learning two new programming languages was not at the top of my agenda shall we say..


Ah ok. I had no idea there was any discussion on this. I'm sorry to say that this is relatively easy (in relation to a lot of oter things we have discussed / tried). Well, let me add that web pages are my profession, so that helps.

Before I started messing with SDK, I would have said SQL and PHP as well. PHP is my thing. I learned c# by 'translating' PHP (mostly using Google for that). However, now I've made this Windows SQL Reader / Writer, I see no reason why that couldn't do the same thing using the same C# functions I've already created.

I would guess that the problem you might have had is the various methods used to create / store content on a webpage, as some websites are static (content is in the code itself) some dynamic (using SQL databases). For sure there are other types as well, but I don't work with them. What you would want is a dynamic page, because that way all text can be stored as data in SQL table(s). Exactly as you might if it were CSV - one column would contain one area of text.

This may some weird - so much text (sometimes a whole page) in one column of a db, but SQL handles this no problem.

Doing what you wanted would mean Verbot talking to the database (rather than the webpage), with the webpage pulling from the database. Therefore changes to the database change the web page instantly (hence why they are called dynamic).

Although it is not yet online, that's pretty much what my new Windows program does - it talks to an SQL database. And I've got Verbot talking to it, using the <run > command, with parameters after the program name.
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Verbot Player with SQL Console (new approach to data)

Postby MikeA » Sat Jan 28, 2012 12:11 pm

Until my download gets approved, I've put it here:
Code: Select all
http://talarti.com/downloads/winform.zip


Do you want to test it?

Instructions:

Once knowledgebase is loaded, enter 'sql', then see the options for what data commands you can use.

It's al a bit clunky at the moment, and it isn't yet talking back to Verbot(fixed). So, once you've entered the command, you should get a popup or the program loading. Then, you should see the return value appear in the Verbot output (this is the rule firing that recognises the input from the other program).

For example, if you do a 'readrow' then you'll get a popup with the row found that contains the data you were looking for. Then Verbot will show the row. Then the application will open (for testing only).

'readvalue' is similar, except you tell it which column you want returned, and you get that value.

At present, you need to close the application before each command is entered.

The text boxes and buttons on the application itself also work, and are there for testing purposes (the final version would be a much lighter program that only returned the info). I'm hoping it works on other machines, and there's no other dependencies that I haven't included.

EDIT: Thanks to Mapestone's External Feeds work, I was able to use the input parameters approach for this. New version uploaded (to website link above).

EDIT 2: There are now 2 Windows applications -> VerbotSQL.exe is the file used by Verbot to get the data. WindowsFormApplication1.exe is a program to view the database and make manual changes.

EDIT 3: Ignore 'EDIT 2'. To show the real power of SQL (compared to other data approaches), I've made some major changes. The system now uses the universal SQLite database format, rather than Microsoft SQL. This means a simple freeware editor can be used to make database changes.

Also There is now no Windows Application to view the database, just the program to communicate with Verbot. But, in the zip download, I've included an SQLite Editor. This, hopefully, will demonstrate the ease of using SQL compared to Excel.
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Verbot Player with SQL Console (new approach to data)

Postby MikeA » Tue Jan 31, 2012 6:19 pm

New update.

I've found something cool in c# - now the data is sent back to Verbot directly, not via program parameters (so there is no need to run Verbot, which creates and then closes a new instance of it).

The data is sent straight to the input box and entered, and this activates a new rule to show what data was received.

Feedback very welcome.
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Verbot Player with SQL Console (new approach to data)

Postby JonC » Tue Feb 21, 2012 2:35 pm

Does this mean you have updated the download files?
JonC
SupremeBot
SupremeBot
 
Posts: 665
Joined: Wed Apr 02, 2008 6:34 am
Location: Leicestershire, Great Britain

Re: Verbot Player with SQL Console (new approach to data)

Postby MikeA » Tue Feb 21, 2012 8:41 pm

It wasn't, but it is now. (ver 1.2)

Verbot to SQL Console 1.2

I've also put a new sql admin programme to edit the database that is better than previous one.
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Verbot Player with SQL Console (new approach to data)

Postby dave2012 » Wed May 02, 2012 10:19 pm

Hi,
I have been working with CSV for a while and really struggled this is a welcomed addition!!
What version of windows are you running? I am having issues with win 7 the app crashes when it trys to launch it. :cry:

Thanks
dave2012
ShyBot
ShyBot
 
Posts: 8
Joined: Sun Nov 27, 2011 10:22 pm

Re: Verbot Player with SQL Console (new approach to data)

Postby MikeA » Thu May 03, 2012 9:19 am

I have Vista (SP 1) on the pc I tested it on.

Any indication from the error as to what is going wrong? Could it be different versions of .NET?

I'm not a windows application developer, so my knowledge is limited to what Visual Studio gives me. But given it's compiled in VS, it should be compatible. So I suspect it's about versions.
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests

cron