« first day (1572 days earlier)      last day (1608 days later) » 
00:00 - 19:0019:00 - 00:00

12:00 AM
RELOAD!
[bruglesco/FleetCommand] 3 commits. 3 opened issues. 282 additions. 53 deletions.
[rubberduck-vba/Rubberduck] 3 issue comments.
 
Open source 💻 Community 👯‍♀️ T-shirts 👕 Oh my! Year 5 of Hacktoberfest is rolling around again; get involved, whether it’s your first time or fifth: https://blog.github.com/2018-09-24-hacktoberfest-is-back-and-celebrating-its-fifth-year/
 
12:30 AM
@this No, accessing a code module does not open a code pane window.
The reason for my question is that I want to make reinstating the selection (as much as possible) after a rewrite part of the rewriting process instead of doing it everywhere but sometimes forget to actually do it.
However, doing that only really makes sense for modules with open code pane windows.
I could go through the code panes collection and see whether I find the code pane of the module, but that is really slow and requires creating and disposing of a ton of COM wrappers.
 
12:55 AM
Hm, maybe I can simply always reinstate the selection.
 
 
2 hours later…
2:43 AM
@M.Doerner That was more or less what I meant by doing it blindly. If it's faster to do so, that might be better than trying to match up to an open pane. Besides wouldn't it need to go into VBE's undo stack as well?
 
3:07 AM
I did not consider the undo stack so far.
Do selection changes even go in there?
 
3:24 AM
So changes in the fast cycle for excel 365 for formulas may affect VBA arrays. Interesting Bill Jensen explains down the page that the immediate windows will not show the array type. mrexcel.com/excel-tips/…
Pardon me..to clarify formula arrays for calculation.
 
3:39 AM
@PeterMTaylor Every function is now an array function... Um ok.
That was a bit of a surprise.
 
 
4 hours later…
7:13 AM
I do welcome the advent of the Unique function. And in general these changes/extensions seem to make sense in the context of an array-based (spreadsheet) application.
 
7:23 AM
If that change allows me to apply arbitrary conditions on elements, e.g. sin(x) > 1/2, in a conditional aggragate like SUMIFS I am all for it, unless it slows down calculations.
 
 
4 hours later…
11:18 AM
@MathieuGuindon That's awesome news! I dream of git integration in the VBE!!
 
11:43 AM
@FreeMan I don't mean to be the party-pooper but the way Mat's put that seems to me like saying "when Easter falls on a Christmas sunday while the full moon is eclipsing both Sun and Mars".
 
I also think that's what he meant, but I choose to believe a different interpretation!
;)
 
12:01 PM
@Inarion (And yes, I know Mars is further out than the Earth/Moon system...)
@FreeMan I like that approach. :)
 
0
A: Duplicate records when running a DAO recordset

FreeManInstead of looping through all your records counting them and setting the values individually, do it all in one shot. An RDBMS (even Access) is designed for this kind of bulk update. Public Sub OpenRecMassUpdate() On Error GoTo ErrorHandler Dim tempStat As String tempStat = "Idle" Dim ...

For starters, get rid of On Error Resume Next. That's a handy way to not have an ugly error message pop up, but it's also a really handy way to have all your errors swept under the carpet. There are very, very few places where OERN is useful when wrapping 1 or 2 lines of code. This isn't one of those cases. Odds are, that OREN is hiding the error message that would tell you exactly what's wrong with your code. — FreeMan 32 secs ago
on a roll!
If only I was making this kind of progress on my own work...
 
12:27 PM
> FYI there's a typo: "Rubberduck reduces this tedium by allowing you to export all modules from your probject"
 
12:50 PM
@Duga if you read it fast enough you won't hear it though =)
 
1:15 PM
@PeterMTaylor If I follow correctly, these are only for the Office 365 version of Excel, not the full-install desktop Excel 2016?
If so, that sucks because I think I could make use of most of those functions yesterday!
 
1:40 PM
@Inarion If Mars is on the far side of the orbit, Moon can fall between Earth and Sun & Mars, so it's conceivable that moon can eclipse both Sun and Mars, though Mars might be eclipsed by Sun first, or be overshadowed by Sun since it has to be close to the Sun and Moon has only just the right size/distance to eclipse the Sun completely, so Mars would have to be at the Sun's edge. Easter falling on a Christmas, however is a more impressing concern.
To think of it, I'm not sure if Mars and Moon are on the same plane. That might complicate the eclipsing math, though.
 
@this Yes, I considered that as well, but to me it would be the Sun eclipsing Mars then, not the Moon.
 
Hence my comment about Mars at the edge of Sun.
 
One thing I'm sure of: I don't want to do the math on this. :D
I think generally in our solar system most planet's orbits are in roughly the same plane, but I might be dreaming up things.
 
that's what I understood, too. What I can't remember is that Moon isn't on the same plane
which is also why we don't have a regular cycle of eclipses
since Moon must align with the Sun at correct intersection of their planes
but if both Sun and Mars are on the same plane, then I guess it's only a matter of having the Moon between Mars and Earth.
 
Son, I say Son! Ya missed the point, boy!
 
1:52 PM
It appears that, except for Mercure (and Pluto), all planets' have an inclination of less than 3°. Mars' orbit only has 0.7° inclination.
Hm. Wrong, that was a different planet. Mars has 1.85° inclination.
With 1 AU = 150E9 m and sun's radius of approx. 0.75E9 m it will (if I mathed correctly here) only cover inclinations of up to 0.29° which is considerably less than Mars' maximum inclination. In that light @this, Mars could actually be "seen" behind the sun. Were it not for being completely outshone by the sun.
 
He's not new to SO, why's he do the work for him?
0
A: Read data in column and run a specific macro based on value

JNevillHere's a very lightweight total guess at something you might be after. It's iterating through the rows in your sheet and calling functions or subroutines based on the values in Column B: Sub DoActionsInColumnA() 'Iterate through all of the rows that have data Dim rngCell As Range Dim...

 
@FreeMan Son, yer gotta learn the meaning of "nerdsnipe"!
 
mornin
 
Besides, I did note that the Easter falling on Christmas is sufficient to make it an impossible. Ain't gonna weasel our way out of that one!
 
@FreeMan There are some high-rep members on SO who seem to do this on a regular basis. (Answering low-quality or duplicate questions, that is.) Apparently one can gain easy rep by repeatedly answering the same question...
 
2:04 PM
@Duga My mistake... Ai aattempted tu profreed.
 
@this Weasel my way out of my double-hyperbole? Why would I do that? :D
 
@Inarion haz sadz...
 
I was just trying to do a rhethorical equivalent of infinity + 1 (less possible than impossible?)
 
I think that's actually impossible
 
:D
 
2:07 PM
there's a rule about being unable to reach infinity in a finite number of steps.
 
I know
Maybe I should stop. It ain't gonna get better.
 
:D
But nerdsniping is fun!
 
I guess - if you're not the nerd in question? :D
 
maybe because i'm a masochist, it works both ways for me. At least as long there's no semi involved.
 
Hm, on the other hand, I bet Mat had some initial fun when he started developing the AC feature.
Maybe the "pain" of getting sniped comes afterwards - when you realize that the "tiny" deviation you took to solve that (completely tangential) problem actually cost you a whole workday. ;)
 
2:12 PM
like this?
'Automating' comes from the roots 'auto-' meaning 'self-', and 'mating', meaning 'screwing'.
5
 
2:22 PM
Well, yeah. Self-screwing all the way!
Self-screw all the things!
(In the context of my previous two mentions of "to screw" I'd advise to understand it as in "to screw up", not as in "to mate". Otherwise, things get messy...)
 
Messy as in the government is suing you.
 
I feel happy!
If you took the tour. You'd write an MCVE. Check the help center. — FreeMan 13 secs ago
 
2:45 PM
@FreeMan Does this mean that I can put "published poet" on my resume?
 
indeed!
 
Woot!
I guess the corollary to that is that you can put "publisher" on yours.
HTH does this warrant 3 answers?
I'm completely lost as to what you're trying to do here. The HTMLBody should be HTML, which means that line breaks need to be <br> or similar. HTML rendering cares nothing about your vbCrLfs... — Comintern 41 secs ago
 
@Inarion yes, yes I did. "oh I know how to do this, this is going to be fun & easy". yeah.
 
@MathieuGuindon Opinion on having a dedicated "architect" role, please?
And, there should be one, what should it comprise.
(No, not trying to change work here, just thinking about if I ever build a team in the far future.)
 
3:03 PM
@Hosch250 I don't know what an "architect" does, TBH. but sure why not?
 
@Comintern I'm giving up...
 
@this you around?
 
They design the codebase. You would be an architect for Rubberduck.
I think it's a reasonable position, but on the other hand, if everyone is an architect, you have to hire good programmers all around, which improves things.
 
fancy words for "programming" then
2
 
OTOH, you get lots of cooks in the kitchen.
Yeah, basically.
You have the "architect" who designs the structure of the system.
And the "software engineers" who are the keyboard monkeys.
 
3:05 PM
why aren't the engineers part of the architecting brainstorming?
 
Because it's beneath their paygrade.
 
I call that BS
 
And they have to be kept at their paygrade. They can't be getting uppity.
:P
 
if you can write any non-trivial program from scratch, you can be an "architect"
so, if your checkers game is anywhere near fun & easy to extend, congratulations, you're already one.
 
I would think it is :)
So, yesterday, the organization restructured.
 
3:08 PM
the design is never right the first time around. never.
 
The architects are off in their own team.
 
@Hosch250 That sounds like a recipe for disaster!
 
^ seconded
 
The devs are in their own team.
 
it's a false hierarchy IMO
 
3:10 PM
I don't think it can get worse.
I mean, worse than it already was.
 
It can always get worse.
 
nothing like silos for inefficiency, lack of communication and basically bringing progress to a grinding halt
 
Sounds like a software architect is just a glorified product manager.
 
The managers are good people for it, and they aren't just managers, but they still work.
@Comintern No, we have those too, and they are in their own team.
 
Thus the "glorified". We have something similar here, but we don't let them design anything except UX. They just write the feature requests and so forth.
 
3:13 PM
Oh my gosh.
Nobody here knows UX except one person.
 
and they work directly with programming.
 
Yes.
We have people who think it's OK, and even standard procedure, to put text in images.
But that's neither here nor there, they just use the massive WYSIWYG that we wrote.
 
WTH? Web software?
 
Yes.
And people who don't realize that tabs vs windows is a browser setting that the programmers can't control.
"It's got to open in a new window. It can't be a tab."
 
@Comintern that's the single thing I'm most petrified of becoming
 
3:15 PM
Wow. Tell them that if they Google "text in images" they won't get results.
 
for RD anyway
 
Seriously? I see little to no danger of that.
 
@Comintern IKR? fewer mug-bugs for you guys to fix haha
that said I got the CodeString | pipe thing fixed; "production" code paths don't involve any pipe character handling; "test" code paths explicitly use a TestCodeString that does
 
I saw that. <3 the solution.
 
So, I had an epiphany last night.
Hang on while I write a couple examples.
 
public class Foo
{
    public string Value1 {get;set;}
    public string Value2 {get;set;}
    public string Concat() => return Value1 + Value2;
}
public class Foo
{
    public string Concat(string value1, string value2) => return value1 + value2;
}
In the first (OOP), the properties are implicit parameters.
 
and this is captured
 
In the second (FP) the are explicit.
So, as long as you remember that, you can write good code in either.
 
I wouldn't call that OOP vs FP though
 
No.
It isn't 100%.
Just bringing attention that OOP likes implicit parameters held by a parent object.
 
3:25 PM
R# impersonation: Concat can be static.
 
They are parameters. Just implicit.
 
@Comintern Yes. Every pure function can be static.
 
@Hosch250 yes, as in this is implicitly captured :)
 
^
On a deep-technical level, all functions are static.
 
3:26 PM
I really wish I had the brain energy to write an FP language in typical OOP styles, instead of the crazy mathematical operators that confuse people.
 
Although I'm up in the air as to how to classify self modifying code.
 
I wonder how well it would work?
@Comintern LOL.
That's an "AI" :P
 
@MathieuGuindon Don't worry about drifting too far from writing code. I still need a steady trail of breadcrumbs.
 
Not necessarily. I would think it would depend on the level of determinism.
 
3:28 PM
@Comintern Hence the quotes.
 
does RD currently register for VB6?
 
Does it? That's a big feature!
 
someone on Twitter is asking
 
@MathieuGuindon It used to. I'm pretty certain I had to clean some VB6 entries from the registry on my home machine.
 
It wasn't doing too bad last time I ran it from VB6.
No clue what the installer does though - I was running under the debug build.
 
3:39 PM
> The team has no idea, but last report is it works pretty OK on VB6.
 
@MarkCoffman It hasn't been officially announced yet - I *think* it currently only registers for VB6 in debug builds; you'd probably just need to add the keys in the registry for it to show up in Visual Studio 6.0 😀
 
^ He forked, so he should just need to follow the dev build instructions.
 
FYI, senior QA position (7+ years :P) open in our company ATM.
 
If I ever spend 7+ years working in QA, please shoot me.
4
 
3:52 PM
@Comintern 7 years, 7 months, 7 days, 7 minutes... whatever
Found this suggestion for launching SSIS packages via VBA:
> insert a row into a table from Excel, that indicates you want the SSIS package to run, like a work request. You can then using a SQL Agent job that runs on a regular basis and checks if the table has an outstanding work request and runs the SSIS package.
Located here. Seems like a reasonable idea to me. Anyone see any major drawbacks to doing something like that?
Would be even better if I could pass a parameter into the SSIS package to indicate which file I'd like to have loaded. I could see something like this:
> Insert work request File "X"
> Insert work request File "Y"
> Insert work request File "Z"
> Program loops waiting for all jobs to be marked "Complete"
 
I'm thinking about switching to the test team here, TBH.
 
Then you have a log of everything that's been loaded and when.
 
I'm bored as a dev, and the testers report to my old boss still :)
 
Can something like that be done?
 
@FreeMan Seems reasonable to me too, although I'd use a synchronous shell so I could determine if it succeeded.
 
3:58 PM
The worst part about that process is I only load the data monthly so it seems silly to have the Agent running all month for work that would take place in a ~30 minute time span.
Occasionally, I might need to load data mid-month, but the hysteria about numbers has died down a bit...
@Comintern by "Synchronous shell" you mean waiting for each individual job to complete before moving on?
 
Yes.
You could get somewhat more complex and build a full featured event driven system, but that seems like overkill.
 
Most of my data is DL'd from the web, so that would take some time to complete. If the Agent ran every 5 minutes, I might get most of the files downloaded between times it checked, or I might get only 1 or 2 DL'd.
 
The main thing that I would want to do running that executable would be capturing the output though.
 
I'm envisioning that after the DLs all complete, I'd pop up a watchdog that would show how many tasks remain to complete.
"that executable" is that the Agent, my VBA code or something else I'm missing?
 
The SSIS package.
I'd want to see the output of dtexec.exe.
 
4:02 PM
gotcha! If I'm outputting error to a log of some sort would that be sufficient, you think?
 
Assuming that everything in each file is atomic, that works too. Like pipe the output to a text file.
 
To be fair, at this point, I'm logging error output on my 1 and only (ever) SSIS package and I'm getting rows of error numbers, but no indication of the data that triggered it, so it's not particularly helpful at the moment
Pipe then parse (manually for now), that makes sense.
 
I'm generally too lazy to go read log files.
 
when I run the package from within VS (Ctrl-F5) it pauses at the end of execution waiting for me to hit a key. Does it do that if I call dtexec.exe directly?
 
I would doubt it.
 
4:05 PM
one would hope not!
 
If it does, then you're back to using an interactive shell through VBA (super easy BTW).
 
I kinda like the work request method. I'll do some digging into that. Thanks for the confirmation that it's not too crazy an idea! :)
 
OK, she said I'd get a pay cut if I got the position :(
But she said I can help them write automated tests in Selenium once we get that set up.
 
Doesn't sound too surprising. Does your QA department code unit tests?
Ours is old school. I.e. spending hours dragging and dropping things from screen to screen trying to replicate a bug...
 
@Comintern Oh gosh, no.
Not yet.
The young guy wants to do it.
The old guy just left last week.
He was the one who refused to do it.
It's required in the job description for the open position.
 
4:20 PM
Was the older previous employee forced out or voluntarily left?
 
do you guys know of a way to do parameterized queries in reports without binding the parameters to form controls?
Or leaving the parameters open where you have to type in the values
 
4:43 PM
Can anyone else confirm unit tests in RD aren't actually grouping by outcome when that option is selected. Failed tests aren't being grouped together.
 
can't ATM
 
@IvenBach No idea.
 
@IvenBach C# unit tests or VBA unit tests?
 
VBA unit tests from within Excel
 
Still "no", but I wanted to clarify. ;)
I'd actually have to write some in order to test them. runs and hides
 
5:01 PM
> As title indicates.
![untitled](https://user-images.githubusercontent.com/26076874/46030051-ec398a00-c0a9-11e8-8959-242bc3f8bc3e.png)


The ability to navigate to tests by double clicking on the result has also stopped.
 
5:20 PM
You know, I really love JavaScript.
If I have object:
{
    id: 1,
    description: 'test'
}
I can add more public fields to it simply by assigning them.
obj.foo = "foo";
 
@Comintern Wouldn't you want us to shoot you before it happens? :D
 
@puzzlepiece87 Most likely. I'm guessing I'd be completely feral by about 6 months in.
 
@Comintern Same or fired for not doing the work.
 
Shadow of Silicon is back!
Oh, I'd do the work.
I'd spend all day reading the code, contriving insane test cases, and sending bugs in :)
The devs would want my head.
 
^ that.
 
5:24 PM
So what happens if I pull this string, then this one, then the first one again?
 
Oops, for some reason I read that as customer service, not Q&A.
 
"Hmm.... how can I exploit this potential buffer overflow..."
 
I'd get sarcastic and fired for being rude in CS.
 
Though to be fair, professional QA services are rigorous and patterned, right? They're not really "try to break this however you want", correct?
 
@Hosch250 You'd be surprised.
 
5:25 PM
@puzzlepiece87 Hopefully not!
You mean I'd not get fired for saying "RTFM"?
 
@puzzlepiece87 I would adopt a rigorous pattern of trying to break it however I wanted.
 
And then, "oh wait, there isn't a manual"...
 
Punish the code in every possible way.
 
Professional QA is catch the bug before the client does.
 
@Hosch250 I would as well.
 
5:27 PM
If clients catch more bugs than QA then I'd say someones failing, and it's not the client.
 
@Comintern Hahahaha I can imagine. "This wasn't in our testing plan, @Comintern"
 
Meta QA. QA the testing plan.
 
@puzzlepiece87 QA writes the test plan.
A script can execute it mostly.
 
Between Comintern and Thunderframe coders would be scared to mention any update.
 
Given feature A is set as X and control Y is displaying it, does control Y display element E.
That kind of stuff.
 
5:29 PM
@Hosch250 Oooooh, that's what I get for having helped with QA in a government job (where their dumb pay structure means no good IT people). They had people doing the script work.
 
Same here.
We hope to change that.
 
Good luck! Mat would approve.
 
A couple of us devs actually sent the request to the top managers in the company.
They approved it.
 
@Hosch250 Yes, good news at work!
I'm happy to hear that :)
I'm sure it will raise multiple people's job happiness to get out of that drudgery
 
5:45 PM
I'm just glad we got Git.
 
so uh, I'm doing my own SQL-injection engine... the inline values are set from XML configuration (read-only at run-time, but theoretically editable by users.. won't happen though), and [RemoteKey] custom attributes on some classes. Is this acceptable?
        protected IEnumerable<string> GetRemoteKeyValues(RemoteKeyAttribute attribute)
        {
            var sql = $"select {attribute.ColumnName} from {Properties.Settings.Default.SageServer}.{Properties.Settings.Default.SageDb}.dbo.{attribute.TableName}";
            if (!string.IsNullOrEmpty(attribute.FilterColumn) && !string.IsNullOrEmpty(attribute.FilterValue))
            {
                sql += $" where {attribute.FilterColumn} = '{attribute.FilterValue}'";
            }

        }
 
My current manager is/was the one most opposed to switching.
@MathieuGuindon No. Use Linq-to-Entities.
 
:(
 
and won't
EF is too Fn slow
 
5:46 PM
That automatically escapes things, so you don't have to worry about SQL Injection.
 
    public class Collection : EntityBase
    {
        [RemoteKey("COLLECTION")]
        public string Code { get; set; }
        public string Description { get; set; }
        public bool EnableFits { get; set; }
        public int ModelCodeLength { get; set; }
    }
^ the Code property needs to be validated against CSOPTFD.VALUE in the Sage db
    public RemoteKeyAttribute(string optFieldName)
        : this("CSOPTFD", "VALUE", "OPTFIELD", optFieldName)
    { }
this is well beyond EF capabilities
esp. with the Sage db being on a configurable linked server, and the db name itself needing to be configurable too
 
Isn't that what you use connection strings for?
 
I have a connection string
to my SageExt database
but SageExt extends the sage db, it doesn't replace it
 
So you put that in a secure place as a named variable.
 
5:49 PM
Then, when the DB name changes, you change the value there.
And your code doesn't need to change at all.
 
well, I am using configuration/settings for that
 
Good.
 
var sql = $"select {attribute.ColumnName} from {Properties.Settings.Default.SageServer}.{Properties.Settings.Default.SageDb}.dbo.{attribute.TableName}";
 
Sounds like you are doing things reasonably well.
But I still don't like SQL Injection engines.
 
the alternative would be to have a mapping table instead of these custom attributes
 
5:51 PM
Just be glad I don't work in non-IT for your company, because I'd probably exploit it.
 
you'd have to recompile my work :p
 
Oh no I wouldn't.
I'd just have to crack open the IL :)
 
or edit the xml configuration to inject malicious SQL in the SageServer or SageDb config keys
 
Change some of those stored strings.
 
meh. nothing is secure then.
 
5:52 PM
No, it isn't.
Unless you sign your DLL.
 
yeah, F it
 
Right?
 
it's internal tooling, not NASA
 
LOL.
 
I theory you could validate the input for SageServer and SageDb without using a DB connection.
 
5:53 PM
@Comintern actually, I will.
 
Can't you just test to see if there's a server running with that address? I.e., a connection succeeds?
If it does, and you can use those two things to inject SQL, you seriously need to change the server name...
 
all I need to do is check if there's a linked server by that name
lol
 
Columns are the same way. You can validate that by pulling the table schema before you pass the query.
Overall, I'd say you can make that perfectly safe.
 
columns I'm not really worried about - I'd need to have malicious attribute properties in my own source... or some @Hosch250 altering the IL
 
attribute.ColumnName = * FROM trashtable; DELETE
 
5:58 PM
makes a note to quote these identifiers
var sql = $"select [{attribute.ColumnName}] from [{Properties.Settings.Default.SageServer}].[{Properties.Settings.Default.SageDb}].[dbo].[{attribute.TableName}]";
there :)
 
I'd catch ColumnName too...
That's the dangerous one.
 
tks
hmm, I can easily replace the '{attribute.FilterValue}' part with an actual parameter
everything else is essentially dynamic-sql
@Comintern thanks for the dupe-hunt there
 
6:21 PM
NP
 
@Comintern - this would have been a perfect opportunity for you to post your Haiku. Then you could say you were self-published!
 
        private RemoteKeyAttribute RemoteKey(TEntity entity, string propertyName)
        {
            var property = entity.GetType().GetProperties().SingleOrDefault(p => p.Name == propertyName);
            if (property == null)
            {
                return null;
            }

            return property.GetCustomAttributes(typeof(RemoteKeyAttribute), true).SingleOrDefault() as RemoteKeyAttribute;
        }

        protected IEnumerable<string> GetRemoteKeyValues(TEntity entity, string propertyName)
^ @Hosch250
oh, he's gone
 
error ninty-one
seen that one many times before
close it as a dup
 
@Comintern well, there you go!
 
to this date I've still no idea how a Haiku is constructed. it just seems completely random to me
 
6:35 PM
@MathieuGuindon You'd be amazed depressed at how things get done there.
 
ok, this needs to change. no way I'm going to run entity.GetType().GetProperties() here and in EntityBase to get the property names
it's close though
        public IDictionary<string, RemoteKeyAttribute> RemoteKeys => GetType()
            .GetProperties()
            .Select(p => new {
                Name = p.Name,
                RemoteKey = p.GetCustomAttributes(typeof(RemoteKeyAttribute), true).SingleOrDefault() as RemoteKeyAttribute
            }).Where(k => k.RemoteKey != null)
            .ToDictionary(k => k.Name, k => k.RemoteKey);
more like it - just needs to be lazified now
I think I like reflection a bit too much
 
@MathieuGuindon If that's liking reflection too much, I must have a serious obsession with it.
 
so whats teh whole => thing
some special smiley face? :p
but seriously, what is it
 
the lambda operator?
 
6:47 PM
oh
 
.Select(p => ...
 
just shoving stuff into stuff all over the place huh?
 
bingo
    public abstract class EntityBase
    {
        private Lazy<IDictionary<string, RemoteKeyAttribute>> _remoteKeys;

        protected EntityBase()
        {
            _remoteKeys = new Lazy<IDictionary<string, RemoteKeyAttribute>>(() => GetType()
                .GetProperties()
                .Select(p => new
                    {
                        Name = p.Name,
                        RemoteKey = p.GetCustomAttributes(typeof(RemoteKeyAttribute), true).SingleOrDefault() as RemoteKeyAttribute
I love this stuff
 
=> is the evil smile operator. ()=> is the shovel operator.
@MathieuGuindon IKR?
        private static readonly Dictionary<Type, object> TypeLogs = new Dictionary<Type, object>();

        public static object GetClassLogger(this Type type)
        {
            if (!TypeLogs.ContainsKey(type))
            {
                TypeLogs.Add(type, Activator.CreateInstance(typeof(ILogger<>).MakeGenericType(type)));
            }
            return TypeLogs[type];
        }

        public static ILogger<T> GetClassLogger<T>()
        {
            if (!TypeLogs.ContainsKey(typeof(T)))
It's even more fun with generics.
 
@Comintern I should dig up the EntityStateTracker code I wrote for that LINQ-to-Sage provider I wrote a while back :)
I now know enough about LINQ providers to know that I 100% never want to write one ever again.
 
6:56 PM
I'm not sure I'd want to try.
I'm still trying to figure out how to write tests for some of this stuff.
 
arguably would be a bit cleaner now, with C# 6+ and nameof
7
Q: LINQ Provider: Supporting Projections

Mathieu GuindonUp until recently, my LINQ-to-Sage provider didn't support projections, so the client code had to explicitly "transfer" to LINQ-to-Objects, like this: var vendorCodes = context.Vendors.ToList().Select(e => e.Code); Now, with a bit of help from Stack Overflow, I was able to modify my IQueryPr...

 
00:00 - 19:0019:00 - 00:00

« first day (1572 days earlier)      last day (1608 days later) »