Page 1 of 2

Debug & Helpers Library

Posted: Sun Feb 13, 2011 11:51 pm
by Allanon
Hi all,
As I previously said I would like to share with you some libraries I've made during the ScuiLib & AMC development because I think they are really usefull during application development.

In this first release I'd like to share the two simpliest libraries, just because I've found some time to comment and document the code :D

HELPERS Library
Dependancies: None
Download link: http://a-mc.biz/HWLibs/Helpers.zip

Functions
  • • HL.IsNil() --> Check is the given value is nil
    • HL.ParseArgs() --> Parse the command line arguments
    • HL.SafeNil() --> Returns the string 'NIL' if the given value is NIL
DEBUG Library
Dependancies: HELPERS
Download link: http://a-mc.biz/HWLibs/Debug.zip

Functions
  • • DBG.Console.Enable() --> Enable the debug output to the console
    • DBG.Console.Out() --> Send a debug message to the console
    • DBG.Console.Disable() --> Disable the debug output to the console
    • DBG.Log.Enable() --> Enable the debug output to a log file
    • DBG.Log.Out() --> Send a debug message to the log file
    • DBG.Log.Disable() --> Disable the debug out to the log file
    • DBG.DumpTable() --> Dump to the console or to the log file the given table
The documentation is embedded in the code, in each function, in english.
If you find bugs please let me know!

As soon as I find some more time I will release the other libraries I've done so far (FileSystem, DateTime, ASyncFX, Graphics and Tables).

Re: Debug & Helpers Library

Posted: Wed Feb 16, 2011 10:11 pm
by Clyde
Groovy! Thanks a lot for your work. Especially the debug library looks superb. Keep it coming. :-)

Greetings

Re: Debug & Helpers Library

Posted: Thu Feb 17, 2011 12:42 am
by Clyde
Well, it is not a real bug, but in Debug.hws you @include the helpers.hws through this path: "Sdb:Scui/Libs/Helpers.hws". This is quite special and probably your machines configuration. Unless you don't release an installer (which makes the assing etc.) I think it would be better to do just this path:

Code: Select all

@INCLUDE "Helpers.hws"
And Debug.hws and Helpers.hws has to be in the same directory (you could mention that in the manual). Just my thoughts ...

Besides that, this libs are very helpful, thanks a lot!

Re: Debug & Helpers Library

Posted: Thu Feb 17, 2011 8:58 am
by Allanon
Yes, you are right, at least I should make a note on the first lines of code :D

Re: Debug & Helpers Library

Posted: Sat Feb 26, 2011 12:18 am
by Clyde
One question regarding DBG.DumpTable():

Let's assume I have the following table definition:

Code: Select all

table = {1,2,3,4}
The output of DumpTable is:

Code: Select all

[1] = (NUM) 2
[2] = (NUM) 3
[3] = (NUM) 4
[0] = (NUM) 1
As you can see, the first element (index 0) is always printed at last, while the other elements are printed in correct order. Is it possible to fix your code? :-) DumpTable is very helpful to me right know, but it makes me mad to think in such a strange way ("... first element always at bottom, rest just normal ..."), especially for more complex tables. That would save my day! :-D

Thanks a lot!

Cheers and good night!

Re: Debug & Helpers Library

Posted: Sat Feb 26, 2011 9:13 am
by Allanon
Hi Clyde :)
The order is not set by my routine, instead the items are in the order that <NextItem> get them.
But I can add a new flag or better I can make a new func (let's say DBG.DumpSortedTable) that will output... sorted tables :)
For big tables it could make a bit more time to print out the table contents due to the needed sorting

Re: Debug & Helpers Library

Posted: Sun Feb 27, 2011 1:58 pm
by Clyde
Thanks a lot for your explanation. But I really wonder why NextItem() or the table implementation in HW works that way!? :-/
Allanon wrote: But I can add a new flag or better I can make a new func (let's say DBG.DumpSortedTable) that will output... sorted tables :)
THAT would be great! :-)
Allanon wrote:For big tables it could make a bit more time to print out the table contents due to the needed sorting
That's no real problem as debug outputs are not time critical (to me).

Thanks a lot!

Re: Debug & Helpers Library

Posted: Sun Apr 10, 2011 12:10 am
by Allanon
UPDATE 09.04.2011! :D
-------------------------------------
PLEASE ADJUST THE @INCLUDE DEPENDING ON WHERE YOU SAVE THE LIBRARIES!

HELPERS Library
Dependancies: None
Download link: http://a-mc.biz/HWLibs/Helpers.zip

Functions
• HL.IsNil() --> Check is the given value is nil
• HL.ParseArgs() --> Parse the command line arguments
• HL.SafeNil() --> Returns the string 'NIL' if the given value is NIL
• HL.Swap() --> Swap two given values (NEW FUNCTION)

DEBUG Library
Dependancies: HELPERS, TABLES
Download link:http://a-mc.biz/HWLibs/Debug.zip

Functions
• DBG.Console.Enable() --> Enable the debug output to the console
• DBG.Console.Out() --> Send a debug message to the console
• DBG.Console.Disable() --> Disable the debug output to the console
• DBG.Log.Enable() --> Enable the debug output to a log file
• DBG.Log.Out() --> Send a debug message to the log file
• DBG.Log.Disable() --> Disable the debug out to the log file
• DBG.DumpTable() --> Dump to the console or to the log file the given table (UPDATED! now can sort the output)

TABLE Library
Dependancies: HELPERS
Download link:http://a-mc.biz/HWLibs/Tables.zip

Functions
• TB.Item.IsNil() --> Check if a given item is defined in a table
• TB.Count() --> Returns how many items are stored in a table
• TB.Merge() --> Merges two tables
• TB.Compare() --> Compare two records (tables) and returns the comparison result based on one or more columns (item/key)
• TB.Sort() --> Sort a table with multiple sorting level. Sorting can be done on one or more column (item/key) name
• TB.Find() --> Find a given value inside a table
• TB.CleanSpaces() --> For each table entry will be removed trailing a heading spaces
• TB.Item.Remove() --> Search a given value and remove it from a table
• TB.Set() --> NOT YET COMPLETED

Re: Debug & Helpers Library

Posted: Sun Apr 10, 2011 7:47 am
by ArtBlink
It's excellent, you are a good hollywood coder ;-)

Great

Re: Debug & Helpers Library

Posted: Wed Mar 26, 2014 10:21 am
by Allanon
Hello guys, here is an updated version of the Helpers library, at this link you can access a Dropbox folder with the releases in 7z and zip archives.

Version : 1.2
Release Date : 25/03/2014
Dependancies : None
Contents :
  • Helpers Library Applet (Helpers.hwa) with the following functions:
    • HL.Convert.BytesTo()
    • HL.GetRndName()
    • HL.IsNil()
    • HL.IsNotNil()
    • HL.ParseRunArgs()
    • HL.Safe()
    • HL.SizeString()
    • HL.Value2Perc()
    • HL.WaitForAction()
  • 9 Examples, one for each library function (hws)
  • A document with the library documentation(pdf)