Debug & Helpers Library

Discuss any general programming issues here
User avatar
Allanon
Posts: 645
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Debug & Helpers Library

Post 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).
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

User avatar
Clyde
Posts: 327
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Debug & Helpers Library

Post by Clyde »

Groovy! Thanks a lot for your work. Especially the debug library looks superb. Keep it coming. :-)

Greetings
Currently using: Hollywood 8 with Visual Studio Code and hw4vsc

User avatar
Clyde
Posts: 327
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Debug & Helpers Library

Post 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!
Currently using: Hollywood 8 with Visual Studio Code and hw4vsc

User avatar
Allanon
Posts: 645
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Debug & Helpers Library

Post by Allanon »

Yes, you are right, at least I should make a note on the first lines of code :D
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

User avatar
Clyde
Posts: 327
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Debug & Helpers Library

Post 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!
Currently using: Hollywood 8 with Visual Studio Code and hw4vsc

User avatar
Allanon
Posts: 645
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Debug & Helpers Library

Post 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
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

User avatar
Clyde
Posts: 327
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Debug & Helpers Library

Post 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!
Currently using: Hollywood 8 with Visual Studio Code and hw4vsc

User avatar
Allanon
Posts: 645
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Debug & Helpers Library

Post 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
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

ArtBlink
Posts: 484
Joined: Mon Nov 01, 2010 10:37 am
Location: Albert - France
Contact:

Re: Debug & Helpers Library

Post by ArtBlink »

It's excellent, you are a good hollywood coder ;-)

Great

User avatar
Allanon
Posts: 645
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Debug & Helpers Library

Post 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)
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

Post Reply