« first day (1021 days earlier)      last day (2159 days later) » 
00:00 - 18:0018:00 - 00:00

6:00 PM
unless i can develop a shellextension i don't want to go for now
 
@Jelly - What are you intending to use for inter-process communication?
Or is that the question?
 
i want to pass the args from one instance to another
heres the situation pretty simple
i have an winform app
i want to launch from via a explorer's context menu for a particular extension
the first problem is that the context menu of explorer does not support multiple selection files by default
 
You mean Windows' File Explorer?
 
if you select multiple files and you click onthe context menu item then multiple instances are launched
Yes
win explorer
 
And you select the files and click "Open"?
Things are beginning to make more sense.
 
6:08 PM
now i select the file and click on a context menu item i added from the registry
the context menu launch the winforms app with %1 as arg
i m on skype if you want to take a look
 
I'd stick with a mutex in that case. You'll run into race conditions if you try to pass arguments between opening windows because you have no idea what order the loads are going to complete in.
 
Well, suppose on startup, you check whether your app is already running?
Then, you can expose an API to "AddFile", and just call that and shut the new instance down?
Ah, @Comintern busts my theory.
 
yes
i tried using system watcher
and write multiple selected files into a txt
the first instance will watch that
 
As far as detecting multiple selections, just use FindWindowEx et.al. to just ask the explorer responsible for the launch if there were multiple selections.
 
the txt
but for some reason it keeps missing some files
 
6:10 PM
Except, wait a sec. What if you had a flag on one instance that it was the default instance?
Probably best to just use a mutex, though.
 
@Hosch250 You check the mutex on loading. AFAIK it should be thread safe on the kernel level.
 
guys my problemo is not having one instance
 
Well, I'm probably not the best to consult over this. GTG for lunch, anyway.
 
i already have that with mutex
tring mutexName = "e50cf829-f6b9-471e-8d9f-67eac3699f09";
bool grantedOwnership;
//we prefix the mutexName with "Local\\" to allow this to run under terminal services.
//The "Local\\" prefix forces this into local user space.
//If we want to forbid this in TS, use the "Global\\" prefix.
Mutex singleInstanceMutex = new Mutex(true, "Global\\" + mutexName, out grantedOwnership);

try
{

if (!grantedOwnership)
{

Application.Exit();


}
Application.Exit will kill any secondary instances
 
Well you probably don't want to try IPC - pretty much anything is going to be asynchronous.
 
6:14 PM
i think i found a better way to do via system watcher
 
I'm thinking the best route would be to just have the surviving instance check the state of the selection in the window.
 
state of the selection the window?
 
Yeah. Find its window handle and ask it what's selected.
 
what's selected in windows explorer?
 
Yeah.
 
6:16 PM
what winapi function do i use?
 
FindWindowEx and company to find the actual window, and then you'll need to get an IAccessible from the hWnd, then just use that interface to examine it.
BTW, be really careful that you don't have any code paths that don't release the mutex if you crash - otherwise it's lights out until next reboot.
Oh wait - you're using a managed Mutex. NVM.
 
I found a fix
system watcher file
 
4
A: How to Pass MULTIPLE filenames to a Context Menu Shell Command?

W4ldiYou can use Send To for this. It supports multiple files.

 
:D
ive seen that before
 
Don't like Send To?
 
6:23 PM
off to eat bbl
its not an open
sendto defeats having a custom context menu
 
It is if you respond by opening an application.
 
ill be back after dinner
 
6:38 PM
How else did you think it was going to work, @Mat'sMug?
 
VB.NET and C# are mostly just wrappers over the .NET Framework. String interpolation is purely done in C#, so the actual runtime execution isn't going to change.
 
@Hosch250 there's concatenation happening before and after the instruction I commented on
How interpolation is implemented is irrelevant, basically
 
I'm not saying it wouldn't be better with interpolation.
And content, for example, is almost certainly being done with StringBuilder.
IIRC, when Jeroen examined this, it would switch to `StringBuilder after about 3-4 concatenations.
 
Sure. So we're looking at 3 builders being instanciated, with their respective outputs ultimately concatenated (using yet another builder?) - my point is that it's abusive...
 
6:48 PM
Oh, no, it is internally using string.Concat.
It is string.Join that uses a stringbuilder.
In this case, it appears to be creating an array of strings and passing them all to string.Concat, then building the final one in one blow.
But, to support thread safety, it is deep-copying the local strings before passing them to string.Concat.
One way or another, it isn't likely to affect performance to a noticeable extent.
 
It bloats gen1 without needing to
+            var content = Tokens.Dim + " " + localIdentifier + " " + Tokens.As + " " + _target.AsTypeName + Environment.NewLine;
 +            string assignmentFormat = "{0} = {1}";
 +            if (RequiresSetAssignment(_target))
 +            {
 +                assignmentFormat = "Set {0} = {1}";
 +            }

 +            content = content + string.Format(assignmentFormat, localIdentifier, _target.IdentifierName);
              rewriter.InsertBefore(((ParserRuleContext)_target.Context.Parent).Stop.TokenIndex + 1, "\r\n" + content);
 
boy my stomach is full
 
content and assignmentFormat, the content re-assignment` and then the +"\r\n"
 
And string.Concat internally checks the length of each string, creates a single string instance, and loads the data into it.
So, one way or another, there will be approximately the same amount of objects being created.
 
the re-assignment of content can't be optimized away
 
6:58 PM
True, but that is one instruction.
 
and then the last +"\r\n" either
 
Or, probably a load and set, but close enough.
 
it just doesn't look right
 
No, it can be improved.
 
compile that in .net 2.0 and you get a mess
 
6:59 PM
@Mat'sMug Odds are, it is.
content is never used before the second assignment.
The compiler isn't that stupid.
And we aren't compiling to .NET 2.0, anyway.
 
kids these days...
2
 
I'm not saying it can't be improved, I'm saying that you shouldn't invoke the runtime as a reason to be improved in this instance.
 
whatever
3 mins ago, by Mat's Mug
it just doesn't look right
 
@Mat'sMug I agree.
 
"When I was your age, we used to build our strings in registers with only ones and zeros."
 
7:03 PM
@Comintern Oh, I think you probably at least used punch cards.
Maybe even a Commodore 64, or whatever it is called.
 
didn't have fancypants garbage collection back then. you wrote to an address, and it stayed there until you switched off the computer.
 
I never had a C64. Wanted one as a kid, but we got a TRS80 IV instead. Probably worked out for the best, because I had to learn BASIC to program stuff because there were like 2 games for it.
 
@Mat'sMug You mean you could only use an address once between reboots? :O
 
kids these days!!!!
 
@Hosch250 lol, of course not
 
7:06 PM
But you said it stayed there until you switched off the computer.
 
if nothing else wrote to that spot, you could PEEK the memory address and retrieve it
 
Well, garbage collection doesn't rewrite the data--it just says that somebody else can.
 
yeah that's what I'm talking about - C64 didn't even have "somebody else"
 
Well, the data still stays until you shut down the computer if it isn't rewritten.
 
except now you get an AccessViolation if you're not reading somewhere the OS allows you to read
 
7:10 PM
Which is probably a good thing.
 
haha tell Excel
 
Better than BSOD? I miss BSOD.
 
@Comintern Uninstall one of the critical drivers, then.
 
Or run TeamViewer in a Windows VM on Linux.
 
LOL
 
7:12 PM
Does it count if I run TeamViewer in a Linux VM on Windows?
I should try that.
 
IIRC there were 2 files you could delete and brick Windows back then... system.sys and another...
 
MACAU in china actually pays its citizens dividends from the budget surplus
 
@Jelly Citizens of Alaska get free college and a dividend from the oil profits.
 
good for alaska
 
@Jelly I hope the US doesn't switch to that strategy.
 
7:14 PM
yeah
 
We'd get a negative dividend.
 
i mean no
hey @Comintern
 
lol, the day the US goes full-on communist is the day they walk hand in hand with Pyong Yang hahaha
 
i added a system.file.watcher
 
@Mat'sMug They won't do that on my watch.
 
7:15 PM
or Trump's
you got yourself a Watcher on the Wall there
 
and whenever a new instance got launched i'd watch the a directory where the args are getting saved with the system watcher object
that solves my problem
 
I hope they bust the drug/insurance companies up, like Roosevelt busted railroad, oil, and a couple other industries, but capitalism, with all its faults, is good enough for me.
 
@Mat'sMug is Ulaval is good uni?
 
probably
 
where did ya go to school?
 
7:18 PM
I didn't go to university
dropped out of college
 
oh. sorry
 
I'm going to an accredited school, and it isn't as good as my personal education efforts over that time period would have been.
 
0
Q: Speed up Excel VBA

Tim EckmannI am working on a script to write an array formula to a large number of cells. I have a code that works, but is very slow. Any thoughts on how to speed it up? Here is a small amount of the code as it is written now. It repeats itself down to row 17. Sub make_sheet() Dim m As Integer Dim h As In...

 
@Hosch250 There was an interesting proposal I heard the other day to just have the government buy drug companies. It turns out it's cheaper at current market caps to buy them than it is to pick up medicare\medicade and cover emergency services for the indigent.
 
I can practically get A's blindfolded.
@Comintern They are ripping people off because they know people value it that much.
 
7:20 PM
^
It's inelastic demand.
 
Like we learned in economics, if A owns the only water source in town, he can charge what he wants, because B, C, and D all need it to live.
Of course, it doesn't cost him anything, so he shouldn't charge that much, but he can.
 
We talking about Nestlé?
 
and when B, C and D die of thirst, A gets to drown
 
I don't think the gov should by the drug industry or the insurance industry, but I think they need to sic the regulators on them.
@Mat'sMug Oh, he won't charge that much, because then he loses his source of income.
Especially if one of them brings in money from other regions by exporting, or something.
 
The problem is that at some point you need to decide if health care is a public utility or a commodity.
 
7:23 PM
@Comintern That's a hard decision, because it is both.
If you want to go to the hospital for a hangnail, it is a commodity.
If you go for ebola, it is a public utility.
 
@Comintern heathcare is a human right that must be provided by the state
 
@Comintern Funny thing, but I didn't learn about Nestle until I had case studies on them in college. We just drink water.
 
look at the rest of the world
 
^
US thinks they ARE the world
 
Meh, the rest of the world thinks they are the US.
 
7:28 PM
uh-huh. tell Afghanistan
 
Even their criminals wonder why they don't get read the Miranda rights.
 
Big Pharma benefits from an IP system that is heavily in their favor, and then abusing it.
 
anyway we're waaaaaaaay of-topic now
 
let me bring back on topic
 
QUACK!!
 
7:29 PM
Can you think of any properties/functions that return a Null in VBA (excluding ADO/DAO fields)?
 
Quack? Isn't that a medical term?
 
@ThunderFrame you mean Nothing? Or straight-up Null?
because no, I can't think of anything that returns a Null
 
let's put this way -- everyone thinks they are the center of their existence
 
straight up Null
 
nope
I don't even know what Null is good for in VBA anyway
except for confusing the reader, perhaps
 
7:33 PM
null is nothing good
 
because it seems a ListBox with 0 or multiple selections returns Null for ListBox.Value and Listbox.BoundValue
 
FML
 
take it easy @Mat'sMug
 
@ThunderFrame What else would it return?
Oh, it would return Nothing?
 
an Empty variant would be more obvious
 
7:34 PM
^ I dont' think it could return nothing. Isn't Value a value type?
 
must be a Variant if it's allowed to be Null
 
BoundValue a Variant member of IControl
 
so yeah, MS messed up again
so you can't test with IsEmpty because it's Null, but Null has no meaning whatsoever anywhere in VBA
who the hell thought having Empty, Null and Nothing would make things simpler?
"VBA is easy for beginners to grasp" - yeah, right
"easy for beginners to think they know what they're doing" perhaps
 
well, at least this works?
?typename(null)
Null
^ and just in case you thought it was returning Null as opposed to returning "Null"...
?typename(null)+typename(null)
NullNull
 
typename returns a string...
 
7:42 PM
IKR - but the immediate window makes that hard to tell
?Null + Null
Null
 
@Mat'sMug We're #2! We're #2!
@Mat'sMug @Comintern @ThunderFrame Stuff keeps clicking for me. Even though I still have Sub MakeThingsPretty and lngResponsesinFile, my reusable variable names are disappearing and I am comfortable enough with methods that I already know how I will use RD's fake folders.
Thanks everyone
 
8:02 PM
@puzzlepiece87 Soon you'll be throwing interfaces around with without reckless abandon
 
I'm almost there
I have a bunch of interface links open at the moment
I was about to use them for updating my programs but then I got pulled onto a high priority bugfix that might need them might not
 
@puzzlepiece87 huh, what? where?
 
8:46 PM
@Mat'sMug don't forget to add the how? Question
 
or when? :)
 
:)
So the constant available is vbNull vbEmpty any good?
 
@Mat'sMug In the most hated languages vote :)
 
Null is returned from excel range object. I'm not at a pc now but I think .mergearea is one if there is a mix of merged and not. Also found in ado recordsets. So we test for isnull.
 
wouldn't ADO stuff return DBNull?
 
9:01 PM
I don't know. I'll check tomorrow when I find some code that uses null type.
 
if you mean the result of e.g. SELECT Test=NULL then yeah, that would be DBNull ;-)
also, ...my deepest sympathies for doing this in C++... is C# or .NET (heck, or VBA) not an option? — Mat's Mug 11 secs ago
 
Why anyone would automate Office with C++ is beyond me...
 
9:27 PM
They teach C++ in high school :P
 
huh, was VB6 VB4 in my days
did some Turbo Pascal in sec. III too
 
Only one I remember was Logo in middle school.
 
Oooh and LogoWriter too!!
 
Logo, Pascal and Hypercard
 
Back when I kept hiding the Duke3d demo copied from a floppy onto the 386 hard drive, and spent my courses shooting aliens... good times...
3
TTGH
 
9:39 PM
I ran a Macintosh emulator on an Amiga, which let me create larger windows than a Macintosh could display. Saving Pascal work would also save window coordinates, so the window was then off the screen on the Macintosh with no way of resizing it.
 
9:51 PM
I have another "What's the proper way to do this?" question
So I've been sorting my methods by level of abstraction, I guess. I have my god macro, and then it calls methods, and sometimes those methods call their own methods.
If I have a variable (an array, in this case) that needs to be used in multiple lower level methods, should I store the variable in a higher level method and pass it to each lower level function, even if it has little to do with the higher level method stuff?
I know storing a separate copy in each lower level method is wrong because then if you need to change the variable you have to change each copy of it.
But is there a better practice I should be considering?
 
@puzzlepiece87 It starts wit one variable, and then pretty soon it's 2, and 3, and so on. Whether you have 1 variable that is reused by other methods, or 5000, those variables constitute your model. Create a model class, assign the model the properties and state it needs, and then pass the model to your functions.
 
Okay thank you! I both probably should have thought of that and was miles away from thinking of that.
I will make that change.
 
10:37 PM
@puzzlepiece87 You presumably already do something like that when you have a reference to an Excel.Range or Excel.Worksheet. If you pass a Range reference to a function, to tidy column widths, you're already passing a model, but that model just happens to be one defined by Microsoft.
 
Kaz
11:02 PM
#1 Reason RubberDuck is such an important project:
Remy's Law of Requirements Gathering: no matter what the actual requirements, what your users really want is for you to implement Excel.
 
LOL
Pssst: it's "Rubberduck" ;-)
 
Kaz
@Mat'sMug I can never remember which one is which ^^
Speaking of, how is @RubberDuck these days?
 
Good question!
 
Duckless.
He doesn't have Office.
 
11:21 PM
OK, is this evil?
        [StructLayout(LayoutKind.Explicit)]
        public struct Variant
        {
            [FieldOffset(0)]
            public readonly ushort vt;
            [FieldOffset(2)]
            private readonly ushort wReserved1;
            [FieldOffset(4)]
            private readonly ushort wReserved2;
            [FieldOffset(6)]
            private readonly ushort wReserved3;
            [FieldOffset(8)]
            public readonly int data01;
            [FieldOffset(12)]
            public readonly int data02;
Other than the scroll, that is...
 
I'm missing the joke... Overloading ctors is evil?
 
I'm overloading the struct addressing.
 
Ooooh
Clever
Can it backfire?
 
I'm about to find out. :-D
The problem is trying to get an IUnknown, IDispatch, or BSTR pointer that gets pinned long enough to get copied by the marshaller.
Grrr... GetSetting returns a *VARIANT Returning a VARIANT crashes the stack.
 
00:00 - 18:0018:00 - 00:00

« first day (1021 days earlier)      last day (2159 days later) »