c.haslam Posted July 18, 2015 Share Posted July 18, 2015 guinness,You wrote in the thread on Number():... as the help file is a community project, even though a few of us have access to svn. It's just the same as if we were to host it on github, only a couple of us would be able to merge the pull requests. I agree completely.You also wrote in Ticket 3080:Instinctively one thinks geometrically: horizontal (X) axis and then vertical (Y) axis. This is not, however, the case with a 2D array, rows come first and then columns.You are correct, however ...The function is:_ArraySwap ( ByRef $aArray, $iIndex_1, $iIndex_2 [, $bCol = False [, $iStart = -1 [, $iEnd = -1]]] )Consider swapping 2 columns in rows of a 2D array. $iIndex_1 and $iIndex_2 are row indexes. $iStart and $iEnd are columns indexes. To me, it would be clearer (and would give me more confidence in the function) if the description of $iStart and $iEnd said column/row rather than row/column. Also, when coding, it would remind me to call the function with row indexes for $iIndex_1 and $iIndex_2, and column indexes for $iStart and $iEnd..So there are good reasons to write column/row for the last 2 parameters.I also note that the defaults for $iStart and $iEnd are not mentioned in Parameters. Perhaps the following should be added to Remarks:For 2D arrays, $iStart defaults to 0 and $iEnd defaults to the highest column/row index in $aArray.I discovered these point when, in a recent project, I needed to swap two columns in all rows. As a user, I am cautious about using someone else's function; _ArraySwap() didn't look friendly, so I need to establish whether it is trustworthy. I started to look at the source code, to check whether $iIndex_1 and $iIndex_2 were reversed with $iStart and $iEnd, met the first few lines of code and saw that I would need to dig through array indexes; made a mental note to suggest improvements in the doc, and decided that understanding the code would delay progress on the project, so wrote my own function.I remember now that I also glanced at the example. Perhaps I would have gained confidence in _ArraySwap if the last part of the example had looked like this:$aArray = $aArray_Base _ArraySwap($aArray, 3, 7) _ArrayDisplay($aArray, "Swapped rows 3 and 7 in all columns", Default, 8) $aArray = $aArray_Base _ArraySwap($aArray, 3, 7, False, 2, 5) _ArrayDisplay($aArray, "Swapped Rows 3 and 7 in Cols 2 to 5", Default, 8) $aArray = $aArray_Base _ArraySwap($aArray, 3, 7, True) _ArrayDisplay($aArray, "Swapped Cols 3 and 7 in all rows", Default, 8) $aArray = $aArray_Base _ArraySwap($aArray, 3, 7, True, 2, 5) _ArrayDisplay($aArray, "Swapped Cols 3 and 7 in Rows 2 to 5", Default, 8)As always, these suggestions are yours to accept or reject. Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 18, 2015 Moderators Share Posted July 18, 2015 (edited) c.haslam,I wrote _ArraySwap and the associated Help file page, so I hope Guinness will forgive me if I answer in his place.----------------------Firstly, thanks for the compliments - very much appreciated:_ArraySwap() didn't look friendly, so I need to establish whether it is trustworthy(and would give me more confidence in the function)Perhaps I would have gained confidence in _ArraySwapPretty much an object lesson in how NOT to write a request for a change to something.----------------------Passing quickly to the points you wish to make: - 1.it would be clearer [...] if the description of $iStart and $iEnd said column/row rather than row/columnI do not agree. The parameter list makes it quite clear whether the user is swapping a row or column with "$iIndex_1/$iIndex_2":$bCol: [optional] If True then for 2D array above parameters refer to rows; if False (default) above parameters refer to columnsIf the user cannot remember whether a row or column was used for "$iIndex_1/$iIndex_2" then I do not feel that altering the order of "row/column" in the parameter remarks for "$iStart/$iEnd" will have any effect, or even be noticed. In fact, I would suggest that having mix of "row/column" and "column/row" on the same page is likely to lead to even more confusion that already appears to be the case for you (although no-one else to date).- 2: I will certainly adjust the comments on the examples along the lines that you suggest.----------------------Anyway as you say you:wrote my own function I suggest you stick with that and let others who have fewer problems in understanding 25 lines of code use the library function.M23Edit: Altered example comments committed. Edited July 18, 2015 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
guinness Posted July 18, 2015 Share Posted July 18, 2015 I wrote _ArraySwap and the associated Help file page, so I hope Guinness will forgive me if I answer in his place.I have no issue. I missed this post the first time around anyway. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Developers Jos Posted July 18, 2015 Developers Share Posted July 18, 2015 (edited) It is quite remarkable how people think they can come here and make these firm judgements about the work done by others and then assuming they will bend over or something.Anybody that has put in this much effort to help building autoit3 to the level it is today, will for sure have an initial reaction of " Screw you too" and rightly so.It is fine to have suggestions and even criticism, but @c.haslam, it is not justified to write the way I have seen you do quite regularly now.I must say both guinness and Melba23 have responded very mildly as I would have simply ignored all your stuff by now.First just reflect on this for a while before posting any emotional reaction!Jos Edited July 18, 2015 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
c.haslam Posted July 18, 2015 Author Share Posted July 18, 2015 Noted Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
c.haslam Posted July 20, 2015 Author Share Posted July 20, 2015 Understood Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now