« first day (997 days earlier)      last day (2183 days later) » 

12:00 AM
RELOAD!
[Cardshifter/Cardshifter] 4 commits. 42 additions. 14 deletions.
[rubberduck-vba/Rubberduck] 1 opened issue. 6 issue comments.
 
1:54 AM
> I set up the infrastructure for saving module to module references on the ModuleStates and added the handling to the ParseCoodinator. This will be used later on to enable selective reference resolving only for those modules for which the references might have changed. I would appreciate any featback on this PR before I go on and implement the selective resolving. In the implementation I opted to add the module to module references after all references have been resolved. I did this...
[rubberduck-vba/Rubberduck] build for commit 5f86fa8e on unknown branch: AppVeyor build failed
BUILD FAILURE!
 
 
2 hours later…
3:45 AM
It's getting to the point where searching this chat's transcript for VBE information is faster and easier than going via Google.
4
 
It's also getting to the point where searching on Google for VBE information is turning up this chat transcript.
3
 
4:44 AM
> That's awesome @MDoerner - the parser is now this close to being smart enough to not completely reprocess a module that doesn't need to be reprocessed! ...okay at module granularity, but still.. that's huge!
3
 
@Comintern yeah... you think the CIA Microsoft noticed? :-)
 
If Microsoft is searching Google for VBE information, we're all screwed.
3
 
LOL!!
I'm pretty sure this transcript contains VBE bugs they never knew about
 
Is the refresh button supposed to be disabled while the parser is loading references? I can't tell if I messed it up or not.
 
MS allowing the ending a Property with End Sub is actually harder to make work than not?!?!?
 
@Comintern it should, but somehow it wasn't - you didn't break it, it was wrongly enabled already
 
Good deal (I think). PR on the way.
 
@ThunderFrame with a formal grammar, yeah - I think VBA's parser was hand-crafted
 
^ LOL Starred on April 28 2016, Forked on Feb 27 2017
 
Might be a 1.4.3 user that recently upgraded to 2.0 and went woah
 
4:53 AM
@Mat'sMug I think it might have been foot crafted. Maybe elbow crafted or forehead crafted.
 
@Comintern LOL!! Forehead crafted sounds like it!!
bangs head on keyboard - woah I just wrote a BrainFuck interpreter!
 
hand-crafted == prodded and poked into something that didn't crash unless you used Toolwindows
 
@Duga nice!
 
It also resolves Declarations for the UserForms and Controls. That was pending implementation before.
Might need a small tweak to defer event dispatching while the parser isn't in a good state for resolving declarations, but IIR that isn't anything new.
 
Possibly the menus and commandbars could be regrouped into a specialized class and then one more ctor parameter could be removed.
 
I shouldn't have put the version check there... that was sloppy of me
 
The menus and commandbars probably need to be dependencies.
My aim is to turn App into a repository of references that need special handling on shut down. That lets us tear things down from a single location without waiting for the kernel to dispose everything.
 
5:33 AM
right
TTGTB
 
 
4 hours later…
 
1 hour later…
11:13 AM
> While typing some code, I inadvertently made the following typo while copying and pasting.

```vb
If Right$(prp.Name <> "EmMacro", 7) Then
```

When I meant to type:
```vb
If Right$(prp.Name,7) <> "EmMacro" Then
```

And `Right$(prp.Name <> "EmMacro", 7) ` will always resolve to either "True" or "False", and those strings will implicitly cast to Boolean values of `True` and `False`.

If RD had an inspection to check for boolean expressions passed as string arguments, I'd have spo
> That "implicit cast" there is the root of the problem. Rubberduck should actually already be smart enough to detect type mismatches between Parameters and Arguments, but it's not implemented yet ...
 
11:46 AM
Re the use of this and the private type, I pinched the idea from @Mat'sMug (most of his posts here on CR use the approach, such as codereview.stackexchange.com/questions/32618/… - As with all classes I write, I start with declaring a Private Type that defines what the class encapsulates, and then I make a private instance of that type which I call this and in the rest of the code I refer to thisThunderFrame 2 mins ago
 
12:38 PM
@ThunderFrame Wow, thanks! I've been AFK all weekend - lots of family time plus I needed a break.
 
1:15 PM
@PeterMTaylor So... this seems to indicate that .NET is no longer used to create "Modern Desktop" apps? Or does that convert the interface only, simplifying the conversion to "the one interface to rule them all"?
And when the heck will MS realize that the interface that works great on a 5" touch screen is useless on a 27" non-touch screen?
 
1:54 PM
Any objections to a new Ducky.ico?
user image
2
 
@Comintern - looks nice. Btw, do you plan making a simple video of your screen how the rubberduck functions? It would be useful and I would watch it! :)
 
@Vityata TBH, I'd be horrible at that. :-D
 
2:24 PM
@Comintern not really.. I whipped that one up in 5 minutes off a resized .xaml ducky.. LMK when it's up, I'll update the website's favicon too
@Vityata I made my first YouTube comment the other day with the RD account.... which means I now have a YT channel.. I might eventually do that =)
@Comintern hey wait that's the new one?
love it!
 
@Comintern I like it, too, though I'd eliminate the red arrow. They're cool, but there's a certain... something that takes the overall effect down a notch. :/
:D
 
Kaz
3:52 PM
The OP finally added more code/screenshots to This Question. Rewarding them with appropriate upvotes would be good, I think.
 
@Kaz HOLY MOTHER OF Set STATEMENTS
 
470 undeclared object variables. lovely.
 
"My best guess of how to tighten up the code would be to move the 470 lines of set variable as range into a separate procedure". Extract method. You're doing it wrong.
 
the mere fact that you have 470 object variables doesn't light anything up eh
 
3:58 PM
Yikes!
 
is Selection just as toxic in winword as it is in Excel?
@Pookye might be because you're working off the Selection - again I'm not all that familiar with MS-Word, but in Excel the Selection can be literally anything and coding against it is terrible practice that makes terribly frail code. — Mat's Mug 1 min ago
 
@Mat'sMug Arguably more.
 
took a while to refresh :(
 
4:16 PM
 
@Mat'sMug It should have taken longer. We should really be running the variable naming inspections against undeclared variables. This line is a damned good argument for that:
 
YES
 
Set r249 = Sheets("Issue List").Range("D10") '<--Oh! So THAT'S what r249 means.
"That should have been obvious by the name 'r249'."
 
@Pookye BTW get yourself familiarized with the immediate toolwindow - it's your best friend when debugging. Debug.Print statements print to that window, and you can break anywhere and execute code against the current debugging context in that toolwindow. Learning to use the immediate pane should be your first priority once you know how to place a breakpoint. — Mat's Mug just now
 
4:53 PM
when a review boils down to "scrap it all, it's useless"
> For example, r440.Value is r220.Value, so the formula in 'Issue List'!Y11 could simply be ='Priority Table'!G39, and so on, for everything; the worksheet would keep itself up-to-date without involving any VBA code.
 
Support incident wants to be a class. Badly.
 
Yeah, ...except when you look at what the code actually does, ...it's basically doing =SomeSheet!A1
everywhere
400 times
just put referencing formulas in your tables, and if you need a copy without formulas, make a copy and pastespecial/values to distribute the copy.
 
Yep. There are several elephants in that room.
 
5:45 PM
@Vogel612 I changed the WP theme on RD News, now the side bar is automatically shown when the display is wide enough :)
 
@Mat'sMug nice :)
 
6:10 PM
@AlexRitter monitoring the VBA tag on SO for 24 hours straight will show you just how many problems unqualified Range calls cause, and how often that and other implicit ActiveSheet references bite people in the %$$. My Rubberduck add-in has an inspection that locates them for you (among other common issues). — Mat's Mug 3 mins ago
 
6:33 PM
@Mat'sMug Looks mucho bettero!
yes, that's real Spanglish! My wife teaches Spanish and she says, "When in doubt, add an 'o' to the English word"!
 
lol
 
@FreeMan LOLo
3
 
[rubberduck-vba/Rubberduck] build for commit d10ff37a on unknown branch: AppVeyor build failed
BUILD FAILURE!
 
You don't need GoTo statements. You need an On Error statement - On Error GoTo is just the mechanics that jump execution into what would be the "catch" block - the error-handling subroutine. FWIW VBA predates C# by at least a decade, and didn't undergo the rewrite Python had. — Mat's Mug 8 mins ago
"In C# or Python blablabla"
 
6:48 PM
[rubberduck-vba/Rubberduck] build for commit ee893d23 on unknown branch: AppVeyor build failed
BUILD FAILURE!
 
@Comintern Yup, you've got it!
 
@FreeMan :inserts RubberduckUI.es.resx:
 
7:19 PM
@Comintern there's a few more, actually ...
 
For reading a file into memory with VBA, does FSO have a max file size? My favored method breaks at large enough sizes. Someone just asked me to split a 1GB csv, and I'm willing to use FSO if it doesn't have the same problem.
I believe Excel is memory capped so it may be that no method can handle a file that large.
 
stream it
 
Excel 2013, Win 7 Enterprise, not sure yet if 64 bit
 
@Vogel612 Crap. I should just make them load dynamically from a single resource file.
 
okay, I think I know what you're talking about - let me read and come back.
 
7:26 PM
@puzzlepiece87 FSO has a TextStream, but it's only good with text. If you need to read binary, there's a binary stream reader in ADO.
 
@Comintern they used to be 1 bigass resource file, we split it up because the VS designer for .resx files was starting to get non-responsive because there were too many keys
 
actually, the ADO stream can handle binary or text
 
@ThunderFrame Thanks, I was thinking of FSO TextStream, so I appreciate the pointer in the right direction.
 
I benchmarked them once - IIRC, ADO stream was slightly faster
 
That makes sense for WPF resourses, but the WinForms are being built by FooDialog.Designer.cs anyway: this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
 
7:31 PM
Access events are proving harder to collect than I anticipated....
0
Q: Where is the Form/Report `Menu` event (that relates to OnMenu) defined in Access?

ThunderFrameAccess Forms and Reports support an OnMenu property, that follows the naming convention and behavior of other Form/Report event properties like OnLoad (where assigning the OnLoad property a value of [Event Procedure] will cause the Load event to be handled by the code-behind with signature Privat...

 
@ThunderFrame @Mat'sMug This is the example I'm getting ready to adapt: stackoverflow.com/questions/15151128/…
 
@ThunderFrame guts say that's leftovers from a dropped old feature
@puzzlepiece87 yep, that should do it
 
@puzzlepiece87 How are you intending to "split" the file? Are you doing any data processing or just getting more manageable chunks?
 
@Comintern Just getting more manageable chunks. My coworker requested that a file with <1.5M lines be split into three worksheets that each have <500k lines
(~1.5M lines being about .5M more than Excel can display at once)
 
7:46 PM
DATABASE!!!!
use Access SQL Server
 
Sure, as soon as IT security approves that capability for all of us lol
I'm the team's rover with my fingers in every pie and I still have limited capacity to do that :P
 
@puzzlepiece87 security is infinitely easier to manage on SQL Server vs Access desktop db
(and much more flexible too)
 
Good point. Let me see what I can make happen with SQL Server
Did I do it wrong? :P SQL Server --> Open File --> "System.OutofMemoryException"
 
@puzzlepiece87 Are there any embedded line endings in the text fields? If not, I'd just open it in binary mode and seek for the 500Kth carriage return.
 
If I'm understanding your question correctly, yes, I think it's comma delimited.
 
7:52 PM
@puzzlepiece87 any editor is going to have a problem reading/loading/displaying a 1GB file
 
I'm not surprised, even UltraEdit chokes up. Did I not follow @ThunderFrame's advice accurately or does his advice not apply to me?
 
I meant inside individual fields. For example, this is valid csv:
item1,item2,"this is item 3
but it has
line feeds",item4
 
@Comintern Ah thank you, no issues there.
@Comintern Googling how to best open files in binary mode.
 
IIRC it's something like Open path For Binary As #fn
 
Hopefully this is not what you mean because this is my preferred method I use all the time: Open Variant1(Loop1) For Binary As #Int1
 
7:55 PM
Yeah, that's it.
 
Yes, so maybe I just need to tweak it then. The line that it actually breaks on comes after: strText = Space$(LOF(Int1))
Which proceeds these lines:
`Get #Int1, , strText`
`Close #Int1`
`strLines() = Split(strText, strNewLineCharacter)`
 
Yep - that's because you're trying to read the entire file. You need to scan it looking for a byte offset to chop it up at.
 
Thanks, I will read up on how to scan it! I appreciate all of your help!
 
 
1 hour later…
9:02 PM
The Unload Me is at the very beginning of the search so that it "clears" the form and goes back default. The next step, Print does not have Unload anywhere. I wish I knew enough to do object oriented but I'm piecing this together. — Travis 1 min ago
ugh
 
@puzzlepiece87 Most hex editors can open files of near infinite size. The HxD editor can open files up to 8 EXABYTES.
 
@ThunderFrame Back now after reading through many threads, but I'm not much closer to understanding how to scan through the file without loading it into memory.
 
I wonder how he tested the 8EB claim..
2
 
Were you trying to point me towards using ADO stream to read line by line and then count the delimiters manually - is that what you meant by scan? Did you mean to use a hex editor program and not use vba? I'm a little lost.
 
@puzzlepiece87 Personally, if your data is text and your line-breaks are well-formed, I'd open the stream as a text file rather than binary, and let the Stream deal with line breaks. If you avoid using the stream objects, and use the Open x For Binary Access Read syntax, you can read bytes into a buffer array of say 4096 bytes, then scan that buffer for the line-break, build your line, rinse, repeat.
The buffer would ideally be a multiple of 4096, in order to take advantage of typical Windows I/O buffers.
 
9:16 PM
Thanks a lot! No, I'm not opposed to using Stream objects, I'm flexible. I understand better what I should be doing now. Thanks for clarifying.
 
9:30 PM
@FreeMan perhaps. Remember that Microsoft is heading towards their Universal Windows Platform (UWP) strategy anyway. docs.microsoft.com/en-us/windows/uwp/get-started/whats-a-uwp One device, many options. Rubberduck would inherit this I be
...I believe I meant to add. :)
 
Will reflection let me read a COM property by a property name specified in a string? I imagine it can, but the performance would be worse than early-binding the property read?
plusone for the self-defeating title. If Me.undone Then WoeIsMeThunderFrame 18 secs ago
 
@ThunderFrame - Pretty sure you can do that, and the performance would probably be similar to any other call using reflection. IIR, you're using reflection on the RCW and all of the method information had already been collected. Could be mistaken about that though.
 
9:48 PM
@PeterMTaylor Yeesh. (that's for MS, not you)
 
10:12 PM
[rubberduck-vba/Rubberduck] comintern pushed commit 57abcf57 to next: Freshen up Ducky.ico using the same image source as the About dialog.
 
@Comintern I have about 27 different object types to read properties from, and I need to read an average of 10 properties from each object type. Controls on a Form/Report can be any of those 27 types. I was considering creating string arrays or lists of the specific property names for each object type (or creating a UNION list of all of the property names), then using reflection to read the properties in a loop...
but IDK if it might be better to just create readers for each object type, and early-bind the property accessors.
 
> I don't have push access to your fork so I can't fix the merge conflict from here, but it should be a pretty simple one to fix :smiley:

Let me know when you're ready to merge the PR!
[rubberduck-vba/Rubberduck] build for commit 4ad4e255 on next: AppVeyor build failed
BUILD FAILURE!
 
@ThunderFrame You can cut down on the overhead by using a MethodInfo cache (for example on ModernFolderBrowser), but TBH the majority of the performance hit is probably going to be in the marshaling.
 
> Yes - the conflicts are straight forward - locally I've already resolved them. Yet to add the code to use the Moq framework. Hoping to have time to do it later today. Thanks.
 
10:32 PM
@Comintern hmm, so make a generic AccessControlPropertyCache class that has a super-set of static MethodInfo properties, then use Linq to return the properties have a string value assigned?
 
10:42 PM
@ThunderFrame It appears that the .LineSeparator property for ADODB.Stream only works for vb.net and not vba. How will Stream know how the lines of the file are delimited?
 
@ThunderFrame If you know them at compile time, sure. If you don't, you can always toss the MethodInfos into a lookup container, and then use the existing one if you've already reflected it.
@puzzlepiece87 - Just pull the whole chunk and use InStrRev to find the last vbLf in the chunk. Then pull the next chunk starting 1 byte after that. There's no need to go row by row.
 
@puzzlepiece87 it seems ADO stream doesn't have a ReadLine member, so the line separator is only useful on using WriteText (which has an optional argument that allows you to write lines).
you can set it, on reading, but it's of no use
  Dim strm As ADODB.Stream
  Set strm = New ADODB.Stream
  strm.LineSeparator = adLF
  strm.Open
  strm.LoadFromFile ("C:\Temp\form1111.txt")
  Dim x As String
  x = strm.ReadText(4096)
actually, you can use Skipline, but that doesn't help you read lines.
 
10:58 PM
Thank you. I'm going to try this, but I think it's going to break on the .LoadFromFile line unless I'm misunderstanding something.
 
@Duga Did I do that with the Ducky.ico update?
 
@ThunderFrame Thank you for reminding me to set my objects specifically and to not use As New, btw.
 
actually, it can read lines, and it does honor the LineSeparator property.
 
0
Q: how to optimize vba looping code using variables?

user132196Sub Testingloop() Dim endrown As String Dim ex As String Dim ez As String Dim eh As String Dim eg As String Dim el As String Dim ee As String Dim es As String Dim ef As String Dim ei As String Dim i As Integer Dim LastRowColumnA As Long: LastRowColumnA = Sheets("looping").Cells(Rows.Count, 1).End...

 
  Dim strm As ADODB.Stream
  Set strm = New ADODB.Stream
  strm.LineSeparator = adLF
  strm.Open
  strm.LoadFromFile ("C:\Temp\form1111.txt")
  Dim x As String
  x = strm.ReadText(adReadLine)
 
11:01 PM
@ThunderFrame Where are you learning this from? I'm happy to read the documentation too so I have fewer questions :)
 
that ReadFromText method takes an enum of adReadLine which has a value of -2
@puzzlepiece87 I remember struggling with the ADO stream - it doesn't seem logical to open a stream then LoadFromFile, but that's the way it works.
 
I was just wrapping my head around that too, and trying to figure out which parameters go before and after both .open and .loadfromfile
Thanks for the link!
 
@puzzlepiece87 It's a hard habit to break
@puzzlepiece87 You typically need to set the properties of the stream before you open it
 
This is what I have so far, where Variant1(Loop1) is my file:
    Set objStream = New ADODB.Stream
    With objStream
        .Open
        .Type = 2 'text
        .LoadFromFile Variant1(Loop1)
        .Position = 0
        .lineseparator = adCrLf
        Do Until objStream.EOF
            ReDim Preserve strLines(UBound(strLines) + 1)
            strLines(UBound(strLines)) = objStream.Readtext(adReadline)
        Loop
    End With
Going to give it a spin and see what happens
 
you're reading a stream, but you're loading it all into an array?
You'll still have memory issues
and those Redims will be expensive - just create an array large enough for your required number of lines (for each sheet), then redim down to the final number required
you'll then need some logic to fill an array, say up to 500K lines, then dump to a sheet, then read the next 500K lines, then dump... until you reach EOF
 
11:12 PM
Yes, I figured I would need to read to an array to prevent needing 1.5M rows of spreadsheet writes
Good suggestion to just set the maximum at 500k instead of redimming, thanks
 
@puzzlepiece87 Why do you need to write to a spreadsheet? It would be a lot more efficient to just chop up the csv files as text, then open the results in Excel if you need to do more work with them.
 
@Comintern I probably don't - I'm probably guilty of having a hammer and seeing everything as a nail. Let me double-check with my teammate and also see if there are any easier ways to split it up than VBA.
 
You can still do the split with VBA, just write the result to a file instead of to the workbook you're running the code from.
 
Oh right, thanks. Yes, just confirmed that they don't need actual worksheets, just part 1, part 2, part 3 files.
 
yep, reading lines is slow. Reading bytes in 4096 byte chinks is fast. Just read a chunk you expect to have about 500K lines, then find the last vbCRLF, then write to a file, then repeat.
 
11:23 PM
^^
 
Following this advice now
    With objStream
        .Open
        .Type = 2 'text
        .LoadFromFile Variant1(Loop1)
        .Position = 0
        .lineseparator = adCrLf
        Long1 = 1
        Do Until objStream.EOF
            Int1 = FreeFile()
            Open Variant1(Loop1) & " Fixed " & Long1 & ".txt" For Output As #Int1
            strText = objStream.ReadText(368640)
            Print #Int1, strText
            Close #Int1
            Long1 = Long1 + 1
        Loop
    End With
(What I'm about to try)
368640 = 90 * 4096.
File is 1,087,330 KB
1087330 / 4096 / 3 is about 90.
Am I messing up my math there between KB and 4096 bytes?
Do I need to multiply the 368640 * 1000 for it to be right?
 
1024
 
> Rubberduck.Setup.2.0.11.0.exe (5.53 MiB) - Downloaded 1091 times.
Last updated on 2017-01-06
> Total Downloads 9,775
 
Personally, I'd read 96*4096 chunks
 
Ah, why?
And I will multiply it by 1024
 
11:34 PM
Powers of 2.
 
the chunk cache is aligned to OS and Disk capabilities. so it might be a multiple of 4096. That multiple is likely to be a power of 2, so 96 would be better than 90, but 128 would be better than 96.
 
Okay, will use 128
 
it's really hard to test, as there's caching all the way down to the metal. so as long as you're using a multiple of 4096, you should be OK
 
I have to run, thank you both very much for the help.
I will probably be in tomorrow
@Mat'sMug Are those good stats?
 
I suppose :-)
I think it's the fastest-downloading Rubberduck release yet
 
11:40 PM
Probably better than Windows Vista, and we don't even come pre-installed on new computers.
2
 
LOL
More downloads than the nuclear launch codes
Jan 25 at 1:30, by Mat's Mug
@ThunderFrame that would be massive.. but by June isn't impossible
10K by March is a done deal
 
11:53 PM
250 downloads tomorrow??
 
inclusive :-)
 

« first day (997 days earlier)      last day (2183 days later) »