gil900

Idea for arrays

35 posts in this topic

#1 ·  Posted (edited)

I think it is good idea to make this possible:

 

Untitled.thumb.png.360c1d5c78c9f89251c8f

 

Such a an array allows you to hold information in a more convenient and efficient way.

Example:

Screenshot_7.thumb.png.6bc491ab40a84b859
This is a simple example. It does not have to be only TRUE / FALSE . it can be more of
course.
 

Edited by gil900

Share this post


Link to post
Share on other sites



gil900,

And why do you see this as a good idea? Can you share a situation where it would be useful to have negative array indices?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

gil900,

And why do you see this as a good idea? Can you share a situation where it would be useful to have negative array indices?

M23

It is difficult for me at the moment to describe the situation in general and also explain arguments why it is good.
I will try to explain later

Share this post


Link to post
Share on other sites

gil900,

I will try and contain my impatience.....

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Build it yourself and don't rely on others to do it for you. The fact you can't come up with a use case, means this is just a feature for you only.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Suppose you have a main array.

And in that main array you need to store this kind of array:

 

In this array the the only information that can continue without end is Item X
 

Other information needs to be stored in array is regular information - information that needs only one slot such as: how many Items the array contains, variable that  represents a specific setting for all Items and more.
 
The problem is - you have one slot for it. In this it is the 0x0 slot. If I want to write in it more then one value directly (I want directly. don't want to create in it new array)
Then this is not possible.
 
Why I don't want to create new array in it?
If your code need to use some variable
Intensively then you may want to save the process of loading /reading other array Every 10/5 ms just to read one value.
 
I will continue later

Share this post


Link to post
Share on other sites

Can you describe that in code?  The wording is tough to decipher.

1 person likes this

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

Can you describe that in code?  The wording is tough to decipher.

Which is why I did not try to start explaining before.. sorry.
It is much more the idea of organizing data more efficiently

 

Be patient. I'm working on a image that will show when it can be very useful (efficient data organization)..

Share this post


Link to post
Share on other sites

iamtheky,

As I understand it, the OP wants to have arrays that start at the [1] index with an unlimited number of prior indices ([0], [-1], [-2], etc) which can hold metadata such as the "count in [0]" so common in AutoIt arrays.

My response would be:

  • Have as many such elements as you need and then start the array "proper" at the index which holds the first "data" rather then "metadata" - For...To...Next does not care which values you pass as limits and calculating "index - x" will not cost much.
  • Use an array in the [0] element to hold all the metadata. You suggest that it would seriously slow the script - I would argue the contrary. Look at my GUIListViewEx UDF - there are many occasions where I set Local variables to the content of elements of an "array in array" so that there is not the repeated reading of these embedded values.

But let us wait to see what this promised image brings - perhaps I am completely wrong, and not for the first time!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

 I made this picture:
Screenshot_5.thumb.png.3869fae31ccfcc616
Hope this helps you understand the concept.

This opens up the possibility of creating a more complicated information and store it more efficiently. This example i have in my head of such data organization

 

Untitled.png

Edited by gil900

Share this post


Link to post
Share on other sites

just use a map, then you can call the indices whatever you want?

1 person likes this

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

This opens up the possibility of creating a more complicated information and store it more efficiently. This example i have in my head of such data organization

This opens up the possibility of creating more complicated information and storing it more efficiently. This is an example I have in my head of such data organization.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

then fake it :)

 


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

just use a map, then you can call the indices whatever you want?

Can I store Map variable inside array?

Share this post


Link to post
Share on other sites

definitely read the thread, if you start getting fancy and throwing dictionaries in the dictionary then the way I am retrieving data would have to be adjusted.  I would be happy to play along if you run into issues.


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

iamtheky,

As I understand it, the OP wants to have arrays that start at the [1] index with an unlimited number of prior indices ([0], [-1], [-2], etc) which can hold metadata such as the "count in [0]" so common in AutoIt arrays.

My response would be:

  • Have as many such elements as you need and then start the array "proper" at the index which holds the first "data" rather then "metadata" - For...To...Next does not care which values you pass as limits and calculating "index - x" will not cost much.
  • Use an array in the [0] element to hold all the metadata. You suggest that it would seriously slow the script - I would argue the contrary. Look at my GUIListViewEx UDF - there are many occasions where I set Local variables to the content of elements of an "array in array" so that there is not the repeated reading of these embedded values.

But let us wait to see what this promised image brings - perhaps I am completely wrong, and not for the first time!

M23

 

Have as many such elements as you need and then start the array "proper" at the index which holds the first "data" rather then "metadata" - For...To...Next does not care which values you pass as limits and calculating "index - x" will not cost much.

I hate to code this way.. it is mess. and I never did it
I don't want loop that start check from number that is > 1 just because I need to use the first indexes for the metadata (thanks for this word).
I see it wrong to write code like this even if it seems that it is the best option for the machine.

 

Use an array in the [0] element to hold all the metadata. You suggest that it would seriously slow the script - I would argue the contrary. Look at my GUIListViewEx UDF - there are many occasions where I set Local variables to the content of elements of an "array in array" so that there is not the repeated reading of these embedded values.

I didn't looked at it but I know what you did. you just  reducing the number of times of reading information from array in array..
But If you have array like I
suggested then the "array in array" 
requirement is reduced significantly and this is better. not only for performance but also (perhaps especially) for much cleaner code.

 

By the way,
I was wrong about the last picture I sent.
I should organize the data in this way:

 

This is how it may look with real data (Non-variable names)
Screenshot_7.thumb.png.6bc491ab40a84b859
This is simple example. It does not have to be only TRUE / FALSE . it can be more then that
of course.

I added this image to the first post

 

 

 

 

Screenshot_6.png

Edited by gil900

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Having negative array indices offers no advantage that I can see. What the images above are meant to demonstrate is also unclear. Looking at the code in the example I see... While Sleep(10). I don't like this loop syntax: . It is not a good idea to rely on the return value of a function which is documented as not having one. Using such a return value may seem clever, but it makes the code more difficult to understand.

Edited by czardas

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Having negative array indices offers no advantage that I can see. What the images above are meant to demonstrate is also unclear. Looking at the code in the example I see... While Sleep(10). I don't like this loop syntax: . It is not a good idea to rely on the return value of a function which is documented as not having one. Using such a return value may seem clever, but it makes the code more difficult to understand.

Having negative array indices offers no advantage that I can see.

 

The ability to store more info such as count ("metadata") without the need to create more space in dimension 2 (Which it is expensive as long the array grows) or use indexes greater than 1 (Which is very uncomfortable to code loop that checking from index 4 for example)

You have almost unlimited space for "metadata" (such as count and more) and this space is cheaper ( In terms of performance & memory and convenience)

In terms of convenience:
You can have as many "metadata" in the array while still using For $i = 1 to $Array[0]  because most/all of it exists  behind the the 0.

In terms of performance  and memory:
You don't have to create new Array inside the Array just to store the "metadata". You saving the need of Extracting new array every time the code needs to reed some value.
In less words: This data is more
accessible for the code. important thing when you want to get the maximum from Autoit.

 

 

Edited by gil900

Share this post


Link to post
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