Page 1 of 1 1
Topic Options
#98467 - 2003-02-17 10:50 PM Cold, 18+ inches of snow.. perfect coding day
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
As the topic shows, I've been snowed in - in front of the computer - so I decided to get busy with a function library. 1030 lines later, plus 300+ lines of test & example code.. well.. is this too much to post here?

I was inspired by Jens' ScheduleTask UDF and, faced with a need to remotely deploy scheduled tasks on a few hundred servers, wrote a library of UDFs to interface with the task scheduler. 12 functions (and lots of coffee) later, I can create, edit, or delete any type of task, and query the server for information about existing tasks.

Any interest in seeing it? If so, what about guidelines or suggestions for posting such a large block of code? I also have Word docs for the JT.exe tool and the function library (yes, it's been a LOOONG weekend!).

Regards,

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#98468 - 2003-02-17 10:55 PM Re: Cold, 18+ inches of snow.. perfect coding day
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Give them a common naming scheme like:
quote:
DBCommand
DBConnClose
DBConnOpen
DBExecuteSQL
DBGetRecordset
DBRecordsetClose
DBRecordsetOpen

Post individual UDFs to the UDF library. See the format there.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#98469 - 2003-02-17 11:00 PM Re: Cold, 18+ inches of snow.. perfect coding day
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Also, if possible, provide both a local and remote query tool. You could go like this:
TaskListTasks()
TaskScheduleTask()
TaskRemoveTask()
TaskAddTask()

I would not use the abbreviation TS as this might get confused with Terminal Server.

You might also want to copy the UDF header style that I and some others are using. See e.g. the DBCommand() UDF.
_________________________
There are two types of vessels, submarines and targets.

Top
#98470 - 2003-02-17 11:01 PM Re: Cold, 18+ inches of snow.. perfect coding day
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Use Code Tags for the code [Wink]

or try this : PostPrep 1.0.1 (with WordWrap on maybe ?)

J.
_________________________



Top
#98471 - 2003-02-17 11:10 PM Re: Cold, 18+ inches of snow.. perfect coding day
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
OK - they already do. I guess that it's important to note that as a "library", there are a few "global" definitions that are shared by all functions, so they can't really be used one at a time. I can certainly post them that way, and it would make it easy to discuss each function..

Before I get beat up about "globals".. I decided on a global var to route the output of the shell commands to a common place so it would be easy to debug - or dump to the bit-bucket - universally. Also, four functions share a pair of text strings - a Global Constant would have been better, but.. next release.

So, that said, I suppose I can post the header and global/constant definitions, then post the remaining functions, and finally the code samples.

It's still snowing fast & furious - I'll post some after dinner, after maybe a chance to get and digest some other feedback.

Glenn

Code tags? You want me to make this easy for you? [Big Grin]

[ 17. February 2003, 23:53: Message edited by: Glenn Barnas ]
_________________________
Actually I am a Rocket Scientist! \:D

Top
#98472 - 2003-02-18 01:51 AM Re: Cold, 18+ inches of snow.. perfect coding day
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Sheesh! [Eek!] Thanks a lot, Howard.. Put them in separate posts, you say... I'm gonna make you explain that to the rest of the guys! They're telling me that the 16 UDFs should be combined into one! Ya gotta help me outta this, pal!

[Wink]

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#98473 - 2003-02-18 02:07 AM Re: Cold, 18+ inches of snow.. perfect coding day
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
The last time I spoke with anyone the rule was to only post a single UDF per thread. I think that rule still exists.

I think that lonkero would like to to see all 16 pieces of code combine into one UDF not one post of 16 UDFs.

If I can put works in his mouth, he is thinking that there should be one function to manipulate TaskScheduler. Not sure if it is doable since I have not read through your code yet.

I know that Sealeopard has 7 DB related UDFs that are NOT combined into one. Not sure why Lonkero has such strong feelings at this time.

Lonkero, correct me if I spoke incorrectly.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#98474 - 2003-02-18 02:16 AM Re: Cold, 18+ inches of snow.. perfect coding day
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Personally, it's a tough call.

Yes, they were designed to be loaded from a single file:
"call \usr\lib\tscontrol.udf"

But - with over 1000 lines, separate posts makes it easier to digest and review the individual functions.

I guess we need to discuss the difference between a UDF and a UDF-Library of many related UDFs.

Thanks..

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#98475 - 2003-02-18 02:23 AM Re: Cold, 18+ inches of snow.. perfect coding day
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hoby, you are not wrong... not at all.

and I would make a udf of 100 lines covering these all but no-one pays me for that... so will not do it.

basically the UDFs are accepted as they don't violate the rules but me thinks they are the [Eek!] of all time when presented in 16 threads.

they will do ok, but improvement is a wish of mine.
_________________________
!

download KiXnet

Top
#98476 - 2003-02-18 02:26 AM Re: Cold, 18+ inches of snow.. perfect coding day
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
With regards to the DB UDFs. There's one all-encompassing UDF, which is DBCOMMAND().

However, sometimes you want to execute multiple database actions, thus you need to open the database, execute a SQL statement, retrieve a recordset based on the previous actions, and then you need to close the database connection. Therefore, the UDF collection provides you with the ability to interact on multiple (actually three) levels, depending on yoru requirements.

It might be possible to condense the task scheduler UDFs by functionality, e.g. one to add/modify/delete a task, one to add/modify/delete a trigger,...

[ 18. February 2003, 02:27: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#98477 - 2003-02-18 02:52 AM Re: Cold, 18+ inches of snow.. perfect coding day
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
the concept is the matter.

you can have (basically) your separate funcs.
but you can't call db-close before open, can you?

these should be constructed together either by way of functioning or way of calling.
the latter is the one is the way I wish.

then, there is 2 ways to do this.
use argument to do this (either number [15] for close or literal ["close"] for close) or use functions calling functions and make them functions inside functions.

the latter one is not fully working as kix does not support it at all but it can be worked around thus making you a UDF of DB:
db.open()
db.close()
db.write()

as discussed somewhere at betaforum... or was it suggestions...
_________________________
!

download KiXnet

Top
#98478 - 2003-02-18 03:06 AM Re: Cold, 18+ inches of snow.. perfect coding day
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Yes, we discussed the object-like coding of UDFs. However, we came to the conclusion that KiXtart currently does not support this type of coding.

Unfortunately [Frown]

It would be my big wish-list item for KiXtart 4.50
_________________________
There are two types of vessels, submarines and targets.

Top
#98479 - 2003-02-18 03:16 AM Re: Cold, 18+ inches of snow.. perfect coding day
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it is workable allthough not supported...

don't remember the last stages of my expirement but it was close to real library.
basically there is sort of "support" for this, it just lacks some 1-2 elements to work fully.
_________________________
!

download KiXnet

Top
#98480 - 2003-02-18 03:16 AM Re: Cold, 18+ inches of snow.. perfect coding day
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it is workable allthough not supported...

don't remember the last stages of my expirement but it was close to real library.
basically there is sort of "support" for this, it just lacks some 1-2 elements to work fully.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1607 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.081 seconds in which 0.036 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org