« first day (1776 days earlier)      last day (2542 days later) » 

7:36 AM
morning fellas.
@War http://stackoverflow.com/questions/43087175/mvc-dynamic-menu-populating-plain-text

hope you see it and answer it before other does :P
 
8:11 AM
morning guys
 
morning man
 
War
@ARr0w looking at it now
 
morning guys
 
sup, anky d.
 
War
8:32 AM
@ARr0w ows that
straight out my front end codebase and on to your question
@ARr0w thinking about it, my answer may not be exactly what you asked for but I was going for something that was configurable so I could use it in more than one scenario in the future since this same code serves all my menus and can even handle things like site maps.
 
8:50 AM
@war you're great man! :)
 
War
?
 
thanks.
It helped me :)
 
War
c# ... that's my domain dude :)
if its simple web apps stuff like this i'm generally all over it
my solution is probably overkill for you but at least you can see the various "extension points" from it
 
yes, i can and that's the best part.
 
War
I build pretty much everything like this
extract it out in to its smallest parts
it does however mean that I end up with a lot of parts ... and usually after a long period of time once a feature has settled I tend to optimise a bit
i'm looking in to the possibility of using .net core on the front end soon ... that will allow async menu loading from the view
@await Html.Action("", args)
not quite got that far yet though
 
9:06 AM
but i know you will bro.
 
War
9:32 AM
eventually ... go so much on my plate atm its hard to finish anything ... luckily though I am now able to throw a tea mat it at least
 
 
1 hour later…
10:53 AM
I need to answer questions, I want to reach 2k points
 
@AndyK v.specific number, why's that?
 
*looks in the future*

andy k at 2k points.

Andy K: I need to answer questions, i want to reach 4k points.

Shaneis: @AndyK v.specific number, why's that?

ARr0w: *looks in the future again*
 
bahahaha @ARr0w
 
War
11:12 AM
@ARr0w lol ... yup ... i'm basically Andy in the future ... i need more points to hit 5k rep
 
11:39 AM
Hi all
 
hey @Alex
 
Hey Shaneis
 
gotta say @Alex, you're doing great on the evenings here
massive congrats
 
Thanks, Shaneis
If I could actually solve the problems, that would be something
 
no worries there, a lot of the problems are coming in with Java/Php/C#/Postgres/MySQL/Oracle and so on and so on
you can't fully know them all!
 
11:55 AM
:)
 
12:06 PM
hey @Alex
 
Hey Andy
 
 
2 hours later…
War
1:47 PM
@Alex are we getting a lot of visitors overnight UK / eastern europe time that you want me to dip in and help with?
I can try and dip in if ya like
 
@War good point @War , I can hop in from time to time as well @Alex , just ping me if you need
 
War
yeh if i'm about ... ping me too don't mind jumping in to help if I can
I do often crash on my sofa and chat on here
 
Yeah, if you guys are available, folks need help and some of the questions are gnarly
Thanks :)
 
War
2:08 PM
I think i'm a bit lacking with the sql ones lol
more so when the question is stuff like "I did something funky in some framework built on top of php and now my MySQL db doesn't do the right thing"
i'm like ... Eh? wtf?
 
Yeah, when the app tech gets into SQL, it just adds another level of complexity
 
@Alex COMPLETE opposite to me :(
 
Well, with C#, I can use LINQ and it makes sense. But PHP, nah, not so much
 
@Alex yeah I said SQL not PHP
PHP = ain't nobody got time for that
 
Yeah, PHP is good for some things. And SQL is a lang you can use with all apps everywhere :)
 
2:16 PM
@Alex now you're speaking my language :D
 
War
I find that "common practice" in PHP is to manually build SQL strings in your front end code
I have huge gripes with that
 
Oooh, that's asking for trouble. SQL injection is just one issue
 
War
In my web stack the app that serves up web pages doesn't even have a connection string to a db / reference to any db client in any of the code
it's literally just not possible to even get a hook to something that talks to a db in my front end code
I don't get where this mentality has come from that the Db is some of tool that can be consumed by UI code
 
 
1 hour later…
3:24 PM
damn
tough to have an intern
they can check what you're doing
 
War
how is that tough?
 
@AndyK that doesn't seem like a problem?
 
War
interns should be operating way below your level
 
ok tough actually, not really tough
just moaning for the sake of moaning
good kid actually
brit - french
 
War
its that feling of being watched
 
3:26 PM
yeah, @War
 
War
they will be watching you ... that;s how they learn ... but its creepy lol
 
just that feeling
ha ha ha
#lmao man
 
@War Brit/French!!! did you get the WTF France guy????!!!
 
nah @Shaneis
the dude is from Surrey
 
War
haha ... that guy was on it!!!
 
3:27 PM
he was born there but bred here
I wish I had Paul Taylor, it would be laughing on and on and on e.g all the time
anyway, the guy is asking question I would not tought of
common question but still very interesting
 
@AndyK think that's supposed to make you more of an expert because you go off and find the answer to things
 
why's that? why's this?
I am
 
@AndyK Yes, you are an expert. I agree :)
 
Not sure if I'm an expert but I know more things than he does
that's for sure
anyway, it is really interesting to have someone who is asking you question and you're trying to show bits and pieces
anyway, got to drive to town center. catch you tonight
 
Worked with interns at the uni where I worked
 
War
3:31 PM
I normally respond with "perfectly valid, feel free to propose a solution around that"
 
@AndyK I got massive amounts of respect for you right now @AndyK. It's tough but appreciated getting an intern and helping him along
 
Surprised how little they knew about databases
 
@AndyK see ya @AndyK
 
Had to go over basic principles with them
 
War
then I put myself in a situation where if they really know something you don't they come to you with an example of ewhat they know that you don't
 
3:32 PM
It should be reciprocal but it's one way a lot of times
 
War
to some extent that's almost a good thing yif the guy working for you knows something you don't ... it means you can offload stuff he's better than you at him
also means you could actually learn something from him too
 
People don't want to share knowledge, fearful it'll make someone better than them
But it never works that way
The more we give, the more we receive
 
War
@Alex uh I don't often want to share stuff ... but not for that reason
 
Well, I mean the knowledge we share here
 
War
last time I "shared knowledge" I showed my line manager how I could reduce a block of 1200 lines of code to just 30 and he pulled me up on a disciplinary (I don't work for him no more thank god) but I later found out the reason was I offended him by providing a solution that was better than the code he wrote 6 months before (the 1200 lines)
 
3:35 PM
Ahhh
 
@War petty assholes
 
War
for that reason I always try to make sure I know something that no-one else in the business knows
 
Yes, jealousy
Yep, in that situation, you don't want to share anything
 
War
that way i it comes down to it ... I can say ... fine you know better ... i quit ... see how it goes!
 
Worked in an org where a guy started as a regular dev, but he was a b.s. artist
 
War
3:36 PM
In my current position its my job to have the bigger picture of the architecture so there's undoubtedly a lot that others don't know ... i spend most my time training my underlings
 
He'd leave wreckage behind him, awful stuff that others would have to maintain as he moved up
 
War
yeh that's the problem I hit @Alex
My job was to plug in a legacy system to his 6 month old "legacy" API
 
Some people are like that. They know how to b.s. even though they're close to clueless
 
War
this was the guy talking baout how it would soon be a requirement that everyone knew more stuff like python
 
And if we point out their garbage, they'll come after us because now they've moved up
 
War
3:38 PM
because he wanted everyone to know it so he could use it
and I was like ... WTF ... whats the business case for that?
 
Ohh
Wow
 
War
our entire codebase written in C# and now everyone must know python
I was like ... fuck off!
 
No cure yet for stupid
 
War
he didn't take to that too well
 
But what's worse is the higher-ups buy into the b.s. and think the guy's a genius
 
War
3:39 PM
funny thing though ... recently that same company did a webinar through pluralsight on cloud stuff
it was all bullshit and no substance
I was not suprised but dipped in to see if they had actually learned anything
 
Yup. If you know your stuff, you know they're spewing so much crap, you'll need a bulldozer to clean it up
 
War
that same company likes to bang on about how it was almost dead then came back ... its a wonder what a huge cash injection and buying "working companies" can do for a parent company!
I couldn't wait to get out of there tbh after facing that crap
 
If you wanna watch something funny, look up George Carlin's bit on b.s.
 
War
the funny thing is, on my way out the door I told the HR director of thentire group that my team would exist inside a year
it doesn't
 
The world is swimming in it
 
War
3:41 PM
they all left
 
One place I worked, we started quitting a few years ago. Now it's all out sourced
 
War
they thought I was talking out my ass when I left ... laughed at me ... now they have a ton of legacy code and a ton of bullshit "middle manager" types, and that's it
And they own brands like IGN, Speedtest.net (ookla), ect
big names
 
Yup, same at the old org I worked. No one left to maintain or write anything. Only people left were managers and hardware people
When we're young, we don't know about phony people. Then we wise up
We can spot 'em a mile away
 
3:54 PM
heading off guys, tty tomorrow
 
See ya, Shaneis
 
War
later @Shaneis
 
4:56 PM
@Alex the dude he is not even a db guy, he's a mini statistician
doing inferential stats
I told him about ACID and he was like 'whaaaaaat?'
 
Wow
 
 
1 hour later…
6:05 PM
Hey @Alex
 
Hey Jamie
 
Found out the answer
 
Which question?
 
Join to static values
Instead of doing an insert and an update statement
 
Nice. Did you post an SO question?
 
6:06 PM
No
I was just looking for another question, and happened upon the answer
 
What does the SQL look like?
 
INSERT INTO @users (peopleID, firstName, age)
SELECT peopleID, firstName, age
FROM (VALUES
('Marisa', 21),
('Steven', 34),
('Abigail' 22),
('Nolan', 30)
) u (firstName, age)
JOIN people p
ON p.firstName = u.firstName
It's using the VALUES clause
 
Ahh, nice!
Good job
 
Never seen it used outside of an insert statement though
 
Interesting, it's creating a named set
Like a temp table with values inside the SELECT
 
6:14 PM
Yep
 
That is very cool, Jamie!
 
I saw a neat example
 
I've only used VALUES in an INSERT
 
For a table of 3-tuples (a, b, c), you can use VALUES to get the max value in the tuple
for example:
INSERT INTO tuples (a, b, c) VALUES (2,4,6), (9,6,3), (7,9,5)
SELECT *
FROM tuples t
CROSS APPLY (
SELECT MAX(val) FROM (VALUES (t.a),(t.b),(t.c)) s (val)
)
Whoops formatting failed on me
How do I block format?
 
Paste/type it all in
Then hit Ctrl-K
 
6:25 PM
SELECT *
FROM tuples t
CROSS APPLY (
    SELECT MAX(val) FROM (VALUES (t.a),(t.b),(t.c)) s (val)
) m (maximum)
DECLARE @tuples table (a int, b int, c int)
INSERT INTO @tuples (a, b, c) VALUES (2,4,6), (9,6,3), (7,9,5)
SELECT *
FROM @tuples t
CROSS APPLY (
	SELECT MAX(val) FROM (VALUES (t.a),(t.b),(t.c)) s (val)
) m (maximum)
The last one is fully runnable
 
6:38 PM
That's some nifty code to have
 
1pa
6:55 PM
Hello guys! I have one table with a column with unique values, and i want to insert all the data from another table into this one but only if the values of the second table not exists in the first one. The problem is that i have millions of rows. How to do this faster?
I'm using postgres
 
1pa
i was looking at this stackoverflow.com/questions/19363481/…, any guess what approaches are best?
 
Try the NOT EXISTS
Another option: INSERT ... ON CONFLICT DO NOTHING/UPDATE
Postgres 9.5
 
1pa
7:13 PM
Nice! Thank you very much @Alex :)
 
You're welcome!
 
 
2 hours later…
8:55 PM
VALUES is handy :)
 
Indeed
 
 
1 hour later…
10:13 PM
Hi guys.
 
hey @ChristopherJ.Grace
 
I have a bugger of a tsql problem.
If you've got a sec I'll build a sample.
 
Go for it
 
I have a dataset with running totals. The total can only be incremented every so often. The rows in between must be filled in with the last total.
 
ouch, a bugger is a nice statement for it
 
10:23 PM
This solution almost works, but it relies on an integer Id column.
--drop table LastValueTest
go
Create table LastValueTest
(
Id int,
[Value] varchar(10)
)

insert into LastValueTest
select 1 , null union all
select 2 , 'x' union all
select 3 , Null union all
select 4 , Null union all
select 5 , 'y' union all
select 6 , Null union all
select 7 , Null union all
select 8 , 'z'
GO
select * from LastValueTest

SELECT Id,
COALESCE(t.[Value], m.[Value]) AS [Value]
FROM dbo.LastValueTest t
OUTER APPLY
(
SELECT TOP 1 t2.[Value]
FROM LastValueTest t2
WHERE t2.Id > t.Id
first_value would be great, but it does not handle nulls like I expected.
 
did you take a look at LEAD?
you should be able to substitute a value for NULL there
 
The offset is unknown. It needs to look ahead until it finds the value.
 
so your results are like this currently
what are you looking for exactly?
 
That's the goal, but not the current reality. I will adjust the sample.
 
10:47 PM
The current state of the data is more like this.
--drop table LastValueTest
go
Create table LastValueTest
(
OuterGroup varchar(10),
InnerGroup varchar(10),
[Value] int,
RunningTotal int
)

insert into LastValueTest
select 'A', 'A.M' ,0, null union all
select 'A', 'A.N' ,5, 5 union all
select 'A', 'A.O' ,null, null union all
select 'A', 'A.P' ,1, 6 union all
select 'A', 'A.P' ,6, 12 union all
select 'A', 'A.P' ,null, null union all
select 'A', 'A.P' ,10, 22 union all
select 'A', 'A.Q' ,null, Null union all
select 'A', 'A.R' ,20, 42 union all
The InnerGroup may just complicate the sample. The issue is filling in the Nulls in the RunningTotal with the following running total within the OuterGroup.
Actually it needs to come out like this
drop table LastValueTest
go
Create table LastValueTest
(
OuterGroup varchar(10),
InnerGroup varchar(10),
[Value] int,
RunningTotal int
)

insert into LastValueTest
select 'A', 'A.M' ,0, 0 union all
select 'A', 'A.N' ,5, 5 union all
select 'A', 'A.O' ,null, 5 union all
select 'A', 'A.P' ,1, 6 union all
select 'A', 'A.P' ,6, 12 union all
select 'A', 'A.P' ,null, 12 union all
select 'A', 'A.P' ,10, 22 union all
select 'A', 'A.Q' ,null, 22 union all
select 'A', 'A.R' ,20, 42 union all
select 'A', 'B.S' ,null, 42 union all
 
Like this?
SELECT *
, SUM(Value) OVER (partition by OuterGroup ORDER BY (SELECT NULL) ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
FROM dbo.LastValueTest
 
That's mind boggling.
What does the select null do?
 
11:02 PM
@ChristopherJ.Grace haha yeah sorry, hi I'm Shane, I do that :(
it's basically a way of telling the SQL optimizer that I don't care about the ordering
90% of the time that means I get to keep the order it was going to have
not sure if this is what you are looking for though
 
Many of the columns are created in a cte. [Value] is actually the difference between two meter readings that are taken sporadically. The underlying table just has the meter readings.
 
hmmm don't see that being a problem, a CTE gets inlined into the query in the end...
unless you're getting an error?
 
I am going to try it on a 100k rows and see. Thanks so much Shane. That was slick :)
 
no worries, hope it works
I'll be on for another 5 mins then I'm off
it's midnight here and I'm up in 5 hours
 
k
Sounds like UK time.
 
11:09 PM
exactly ;)
 
It is hard to fathom how people deliver so much value here, and how that works with reciprocation.
 
well tbh at this time only really @Alex is on here, and maybe @JamieLester
 
Or without reciprocation as the case may be
 
the rest is on during the day UK time
not sure for the others but it's good practice for me
plus it exposes me to questions I'd never think myself
 
That's a great point. There is real power in community that way.
 
11:14 PM
we're no Gordon Linoff or srutsky :)
 
It just may be the fastest way to get as close as possible though.
 
haha yeah potentially!
alright sorry @ChristopherJ.Grace but I'm falling asleep here
hope that helps, if not, raise it here or ask a question
 
Thanks Shane. Goodnight
 
but I'm going to bed
Best o'luck!
 

« first day (1776 days earlier)      last day (2542 days later) »