« first day (1911 days earlier)      last day (3023 days later) » 
00:00 - 18:0018:00 - 00:00

12:01 AM
@MikeAsdf - Yeah, there was a better algorithm. I wrote it the day after lol (it took 3 seconds) But the greedy approach used which took less time to write should have worked just fine.
 
12:27 AM
Guys. Is it possible to do something in MySQL like: UPDATE table SET activated=myId, (user1score = x WHERE user1=myId OR user2score = x WHERE user2=myId) ?
Or do I have to do a SELECT statement first to select if myId is user1 or user2 and create the UPDATE statement based on that?
 
307
A: MySQL - UPDATE query based on SELECT Query

EricYou can actually do this one of two ways: MySQL update join syntax: update tableA a left join tableB b on a.name_a = b.name_b set validation_check = if(start_dts > end_dts, 'VALID', '') ANSI SQL syntax: update tableA set validation_check = (SELECT if(start_DTS > end_DTS,'VALID',...

 
@MikeAsdf Thanks, because I have no idea what I'm doing, I better just do it in two steps. Thanks :-)
 
So yeah I think the syntax you're wanting is UPDATE employees SET Name = (SELECT Name FROM Candidates WHERE herp=derp) WHERE EmployeeId < asdf
performance may depend on what indexes are set up
(e.g. poor indexes could cause the entire Candidates table to be scanned for each Employee record being updated)
 
Well that's not the only part. It is more complex but I showed you a simplified version just to make sure you understood the question.
 
yeah if you're only updating a single record I'd probably pull the relevant stuff into simple variables.
 
12:41 AM
Let me state it a bit different
I have a "match" table with a player and its opponent. player invited opponent. opponent accepts and sets "confirmed" to true. Then they are both allowed to fill in the score, so player, but also opponent. And then you set "completed" to the id of the person who completed it. Then the other person is the only person who should be able to "confirm" the completed. :-D
 
Ah so maybe a CASE statement
 
I just don't like the datastructure hehe
 
UPDATE table SET score = (CASE WHEN user1=myId THEN user1score ELSE user2score END)
 
I will check the docs, thx
Your example is putting the "user1score" into "score" right?
 
right
 
12:48 AM
Because that's not the use case
 
well, conditionally choosing user1score vs. user2score
 
I have a user1, user2, user1score, user2score.
 
OH, you're conditionally choosing what column to even update in the first place?
 
Well, I don't know if my person is user1 or user2
That's basically my problem
Because both players can complete the game (filling in the scores)
 
So you want to update one set of columns in a user1 case, and another set of columns in the user2 case?
 
12:50 AM
The next step (confirming those scores) is not the problem.
 
Either you need two different update statements and you use IF branches (if MySql even has those) to choose one or the other.
Or you could use multiple CASE statements on all columns, and superfluously set the column to itself if you want no change
 
I was confused myself xD
 
As far as I know, a single update statement cannot conditionally target different columns
 
I have 4 variables: matchId (obvious), score, scoreOpponent, myId.

If user1 == myId then user1score = score and user2score = scoreopponent.
If user2 == myId then user2score = score and user1score = scoreopponent.
 
Huh I'm not sure if MySql supports IF as a proper branch thing dev.mysql.com/doc/refman/5.7/en/control-flow-functions.html
 
12:56 AM
In this case, can't I use two of the CASE's you showed me?
 
Huh, maybe you can conditionally target specific columns for updates dev.mysql.com/doc/refman/5.7/en/if.html
 
UPDATE poolmatch SET user1score = (CASE WHEN user1=myId THEN score ELSE opponentscore END), user2score = (CASE WHEN user2=myId THEN score ELSE opponentscore END)
 
seems reasonable
 
And I can also read it :P
And that's quite important for me. Because I'm sometimes programming when I'm almost drunk :D
Mike, thanks alot for your help, explanation and links!
 
 
3 hours later…
4:09 AM
Anyone here?
 
yep
 
You know of a good example for OAuth implementations with WebApi, without that horrible template and all the extra bloat it also loads?
 
4:33 AM
nope
 
Bummer, all the examples use the bloated IdentityFramework / Owin / Katana.
Was hoping to make a more pure approach.
 
5:00 AM
God help me! Status 200, Response: The requested resource is unavailable
 
:/
 
...?
 
thats not a 200 lol
somebody using the wrong status codes
 
This is why working with your friends is difficult
 
Isn't a 200 success?
!!define HTTP Status 200
 
5:04 AM
@Greg My pocket dictionary just isn't good enough for you.
 
200 is OK
 
Ugh, you're useless Caprica.
 
which means, everything went... you know, okay lol
 
@SteveG Success, Okay, same thing.
 
oh yeah
basically, but most of 200's are success,
like 201 is no content
but was a success
 
5:06 AM
Either way, a 200 is valid. I think he is thinking of a 401 or 400
 
!!google 401
 
!!google 401 status code
 
He should have used 404
 
5:07 AM
why is the service unavailable?
 
Yeah, 404
401 is unauthorized and 400 is bad request
 
503 Service Unavailable

The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response.

Note: The existence of the 503 status code does not imply that a
server must use it when becoming overloaded. Some servers may wish
 
The requested resource is
The service is not
I'm testing his stuff
before I use it
It won't integrate with what I'm working with if all it will do is send 200
 
yeah it needs the proper error code
 
5:50 AM
Hello guys
i have one table name as EmployeeMapping with fields empid,courseid
This is my query
This is my method:
public DataTable GetData(int employeeId,int courseId)
{
using (var context = new MyDataContext())
{
var data = context.EmployeeMapping.
.Select
(
t => new
{
//Selecting fields
}
).ToList();

return data;
}
}
Now in this when i would get employeeid and courseid i would like to use this in where condition of my query but without doing like this:
if(employeeId> 0)
{
var data = context.EmployeeMapping.Where(t.Id==employeeId)}
same way for course
i just want to avoid this
 
 
2 hours later…
8:05 AM
elo
my brain uuuuuggggg
 
 
1 hour later…
9:24 AM
Please format your code @Learning
 
 
1 hour later…
10:43 AM
@Amy Phone is here. The Samsung skin is quite Playmobil as usual and the edge effect....well, I don't like it
Maybe error buying the Edge rather than the regular S6
Other than that, good. Very nicely made, fast, excellent display, lighter than it looks
Thin
 
Hello guys this is what i am trying to do :
 
Oh, fingerprint scanner doesn't work
or works rarely
 
i am sending a dummy Get request using fiddler to google.com
after i click execute it says : http request specified an invalid port number
any ideas ?
Never mind ;-) was some typo :P
 
11:02 AM
Nice bit of rubber ducking there.
 
11:13 AM
Erm.
Never mind, deep linking disallowed
 
Hello guys
i have json like this:
{
"_id": ObjectId("5690e517f376f4126445bd68"),
"FirstName": "sanjiv",
"LastName": "rajput",
"City": "navsari",
"Address": "navsari",
"contactNo": "1234567890"
}
This is my class file
public class Data
{
public string _id { get; set; }
public string FirstName { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string contactNo { get; set; }
public string LastName { get; set; }
}
but getting error due to _Id
Unexpected character encountered while parsing value: O. Path '_id', line 1, position 10.
can anybody help me
 
Pretty sure ObjectId("5690e517f376f4126445bd68") isn't a valid json value
> A value can be a string in double quotes, or a number, or true or false or null, or an object or an array. These structures can be nested.
 
yeah problem is because of that only
 
Well, don't do that
 
i have tried it on jsonint:jsonlint.com
but i am getting this data from api so cant do anything with this structure
 
11:21 AM
The API is broken
It's emitting invalid json
Who is the author?
 
this is return by mongo db
i am using mongo db
so this value is return by it
but apart from that i am getting data in form of key value pair too
 
This question looks like the same issue stackoverflow.com/questions/19938239/…
 
exactly
 
Well it looks as though there is a way to fix the json it emits. Try that and it should solve your problem, I think?
 
yeah that would but i am records in the form of this:
key value pair
 
11:31 AM
OK. Why does that matter?
 
Morning all
Does anyone know how proxy generation works in EF?
 
@Learning also, you haven't given any example that indicates any key-value pairs. So what are you talking about?
 
@Learning are you not using the newtonsoft one like everyone else?
var validJson = JsonConvert.SerialiseObject(new Anything { ... });
its a nuget package and 1 line of code
 
@Wardy it's an output from a mongodb driver. That apparently has...weird behaviour when it comes to ID fields
 
ah ok
probably need to reconfigure something or replace its default serialiser or something
I live by that newtonsoft stuff
omg im digging through the EF source on github ... they actually defined an interface called IMagic
 
11:48 AM
jesus, really?
 
looks like its just used for testing
but i thought that was funny
cant seem to find the non static version of ForwardingProxy though
aha got it
A checkin purely to add a unicorn to EF!
lol
 
12:03 PM
productive [x]
Tried the .net cli yesterday
git clone [things]
cd things
dotnet restore
dotnet run
 
neat
whats that do?
run some code from github?
 
yeah, it assumes the new json project model I think
dotnet restore downloads a lot of junk. I'm going to have to look into exactly what's going on there because I don't think I want a billion copies of the BCL on my machine
Has the asp.net team completed a military coup and taken over all of .net, or?
dnx is built on Travis, by the aspnet user
Does anybody else understand almost nothing of what this project's readme is saying? github.com/aspnet/dnx
> The .NET Execution Environment contains the code required to bootstrap and run an application
What does 'bootstrap an application' mean?
> Have the ability to create a cached version of your application's dependencies ("compilation")
What does that have to do with compilation?
> you can create a dev symlink to the built DNX using the build dev-install command.
Why would I want to do that? What does that give me?
> so you can do incremental builds without having to manually copy files around.
What does 'incremental builds' mean?
 
12:29 PM
Anybody here use Xamarin?
For Android?
 
@TomW initialise ... think OWIN or similar (its that part of the app lifecycle)
@TomW roslyn allows you to only pull what you need of the framework, so you don't actually needto install .net on the box
sort of contradicts itself though, because you need .Net installed in order to have the execution environment in the first place
just don't need all versions, only something that supports this method of deployment
@TomW its just an alternative way to reference the location of the DNX stuff
@TomW when you perform a build usually with something like msbuild it can execute a step in the build process to set your build number, this is useful for release management
its also nice not to have to manage that stuff manually
@EvilTak I use unity which is basically doing that under the bonnet ... but never really dealt with android
 
Thanks, but...the point I'm making is really that the readme is bad and they should do a better job of explaining what the point of it is
 
I guess the readme is assuming you know some other .Net related stuff (microsofts new grand scheme of best practise)
its annoying that microsoft works that way
they just assume you follow everything so the context of everything is known
 
Yeah, they've traditionally been better at promoting stuff. This 'new way' though seems to be just letting the devs churn stuff out
They're not interested in documenting stuff, so it doesn't get done
 
they rely on the dev team thats doing the churning to promote their own work how they see fit
frustrating as all hell
now we get this variation from microsoft of really good stuff then really crap stuff
 
12:39 PM
I'm seeing a loss of coherence in their offering, tbh
Azure as well are a nightmare for just changing stuff
 
yeh i've completely ignored that mess
see people complaining about azure all the time
and yet microsoft is putting that right up in everyones junk
im sort of lucky ... where i work we can never use azure
 
I work for an integration gold partner, and we find their churn too much to deal with
 
our clients wont ever allow it because of microsoft being based in the US and the US gov
Your company probably just needs people to focus on the churn and feed in the good bits as they happen
that way you have a filter of only the good and none of the crap
 
It's getting to the point that you can't write something, finish it, and leave it to run. Everything has to be actively managed because they change APIs and service offerings so often
How many webservers are there in basements that have barely been touched for a decade
 
I've not hit that problem yet (a few minor cases) ... well structured code will prevent that hell though
mostly where I touch MS API's I put the code in a common class, if the API changes i write a quick in to that class
fixes for everything
something change identity framework the other day and I changed 1 line of code and fixed 10 apps
annoying that I had too, but at least the overheard was minimal
and TFS handles getting the fix in to production for me
I guess its testers that fuffer the most
1 line of code like that means retesting 10 applications
but with a half decent set of unit tests it should be mostly smoke testing
 
12:55 PM
My last project had a massive team of testers
I never noticed them provide much value
 
yeh good testers are hard to find
every logged bug though ... thats added value
 
close "Not a defect"
close "Duplicate"
 
most game developers rely on the players to find bugs
 
if you have devs that way better than your testers then they arent going to add much value and that will happen a lot
@DarkPh03n1X I do hope you are joking
 
Although a lot of those were because the testers were reading a spec they'd never bothered to give to the devs
 
1:00 PM
that's blatantly not true
@TomW that happens a lot
thats where dev process needs improving
 
@Wardy just have a look at the 'Indi' game developer, with all the "Alpha" Games
 
indie != most game devs
 
Even main stream Devs, Like with Battle Front Had Beta tests before it went public.
 
I'm a hobby game dev ... i unit test my code
 
Public beta tests!!
 
1:03 PM
the game will have already been tested before that though
they are just looking to work out issues with things like larger scale and performance on wider variety of hardware
that's different to "does it work"
 
You testing your code, and someone else checking for bugs is two different things.
 
yeh but right now its just me so i have no choice
a AAA title like battlefront will have already been test team approved before it hits a beta
 
any way , i can guarantee you that there are more indie game devs them main stream
 
if i get to the point of actually building a game off my code there would be more than me working on it
its really bad practice to rely on your customers to test your product
pretty much every developer knows that
however i accept that it happens
but I would argue its not the typical scenario
 
i think fallout 4 devs are relying on the modders to fix the game
 
1:08 PM
Gaming in general though is a bad example of programming in general
the fact that companies like EA even exist says alot
the customer base is clearly happy with shoddy product
otherwise EA would go bust
if every gamer refused to buy a game that was clearly not finished then a lot of game dev companies would go under pretty much overnight
 
i know, if someone like microsoft brings out something shit, then they have a public shitstorm (see windows 98, before se)
 
the problem is the dev studios are buying in to the fact that EA is everywhere and can get their game to everywhere, so they accept bullshit deadlines from EA with the gut feel that if they don't sell out they will never be a success
Microsoft is still getting slapped for a rep they had 20 years ago
I think they generally speaking have seriously cleaned up their act
apple is the new microsoft of the 90's
and yet its ok ... because for some reason "apple is cool"
you couldn't pay me to use an iphone all day
or a mac for that matter
 
see windows 8, not buggy per say, but still missing stuff, it took a open public forum to fix it
now its windows 10
 
the fact that ms opened it up for feedback like that suggests a step in the right direction
they have clearly learned a lot
 
they still rely on public testing...
 
1:15 PM
as a final pass yes ... but its already been tested internally
its all you can do when you have a product that can run on any hardware
they couldn't possible test every scenario internally
so I think thats reasonable under the situation they face
 
same thing with games....
 
yeh but more rushed and less internal testing in some situations
usually where EA is involved
because the devs are rushed to meet EA's release schedules
 
it is probably better to have it tested by a lot of people
 
as a last pass yes ... but not as the only form of testing
 
Wow. This got dragged up on Facebook again.
 
1:20 PM
at my work it gets tested before it goes onto steel, so there is not a lot of third party testing, i have to find the errors before that, so i test it hard
 
One of the guys in it spotted it being laughed at on 4chan
We never did figure out who shared it there
 
ok i have to run off to the store....
 
what got dragged up on fb again?
 
An old and rather ridiculous looking picture of a group of nerds including me
 
oh dear
2
Q: How does EF Generate Proxy classes

WardyI'm toying with building a workflow engine to wrap up my service layer and would like to explore the approach that EF takes to generate transparent proxy classes but I can't seem to figure out from the code on GitHub how it actually works. Could someone point me in the right direction / explain ...

 
1:56 PM
I think EF relies heavily on System.CodeDom for that
just a guess
 
yeh that would be my first guess ... it would generate a new assembly then internally use those types when you query a dbset
I'm just trying to figure out how so I can do the same thing then update the ninject rules to look at my generated proxies instead of the current set of concrete types I have in my service layer
that way I can wrap methods with something simple ...
workflow.RaiseEvent("Before" + serviceMethod.Name, args);
result = serviceMethod.Invoke();
workflow.RaiseEvent("After" + serviceMethod.Name, args);
where the calling code just does ...
var foo = service.Method(args);
 
2:14 PM
if that doesn't work out you can make RaiseEvent static and use conditional compilation attributes
object Method(object[] args)
{
    Workflow.RaiseEvent("Before Method", args);
    Workflow.RaiseEvent("After Method", args);
}

static class WorkFlow
{
    [Conditional("DEBUG")]
    public static void RaiseEvent(string s, object[] args) { ... }
}
something like that
same idea except you have to recompile to enable tracing
and it's more typing :P
are you doing something other than tracing in RaiseEvent?
idk man, converting all your methods to virtual just to add some logging seems like a bad idea
and it completely won't work for private methods
 
2:35 PM
this isn't for logging
im using log4net for that
I'm basically building a mechanism for triggering follow up calls when certain events take place
@StevenLiekens notice how in mine i trigger the actual call in between the before and after events
I'm looking to wrap the actual call using a proxied version of the method
tbh all my services are implementations of IService<T> anyway and the base implementation Service<T> has only virtual methods in it
so i don't see this being an issue
the idea is that in the workflow system users would login and visually build the business process
then when certain things happen the process rules are applied to ensure that certain things happen
for example
when a new invoice is received we may only get half the information we need in the data
I can trigger a step to fill in some of the missing data
then trigger an email to the owner of that invoice to do something
when they do their thing the system would then put that invoice in to the main invoices table
but only when that whole flow is complete would an invoice truely be "in the system"
its about wrapping a series of small atomic operations with some concept of scope in a business process generically
@GregRos whats this COMEFROM thing?
@TomW I was looking at the conversation from that top listed item on the starred list
is this like one of those GOTO type things ? ... totally not needed in modern languages
 
3:00 PM
@Wardy i use to script a lot of things in BATCH scripts ,so i find some uses for the goto command, most recently i used it as a escape if something goes wrong somewhere in a complicated method. just to stop executing the code that follows.
 
surely the keyword return would have the same effect
return WhereIWantToGoTo();
the biggest argument against GOTO was always that encourages poorly written spaghetti code
I think that's a pretty valid argument
that said even without it people write complete balls sometimes
 
true, but i am the spaghetti king, i do not like to call 50 methods to do something
 
I would rather write 50 methods that do 1 thing than write 1 method that does everything
 
1 method, i only use methods that will be used again somewhere in code
 
there are plenty of perfectly good reasons to write a method that only gets called once in the code
if your only reason for writing a method is "will i call this somewhere else" I can imagine a right nightmare trying to debug that
 
3:08 PM
i like too keep the references down to 1 ,or when bug hunting: 'You are Going To Have a Bad Time'
 
or test it for that matter
ouch
thank god i never have to debug your code lol
 
same here...
im currently converting a vb6 project, the guy that wrote it, apparently dose not like to use exceptions, in fact it crashes if you open a file that is 'in use' by a other program.
 
he wrote it in vb6 ... that tells you all you need to know about said code
you'd be better off just starting again
 
don't get me wrong there is error handling, but no master error handler that you can just cancel the operation with.
it is a complicated peace of code, with math that goes over my head, but he wrote it then quit. the people was using it with bugs and all for over 12 years. making the same mistakes!!
 
if the company cant define the formula then whats your acceptance criteria?
 
3:18 PM
that is the only thing i want is for people to say my project is at least not as shit as that thing.
 
@Wardy COMEFROM was a joke implemented in INTERCAL IIRC
by analogy with GOTO
 
ah lol
i did wonder i hadn't ever heard of it
i was never big on iirc
 
What I imagine it does is set the stack frame you exit the current scope into to some arbitrary location, rather than where you actually came from
 
or sends you to stack location -1
always resulting in asn infinite loop
 
You could do that, if you were being boring :)
There are far more interesting logical perversions to be had with COMEFROM, I'm sure
 
3:24 PM
with roslyn someone could implement that as a nuget package im sure lol
 
Probably
System.Compiler.Hell.1.0.0.0
 
lol
to really go banannas you could redefine return to mean something else like "pick random function from current assembly and also run that"
 
I got shouted down in the js room for talking about abusing compilers to have creative notions of 'type'. Just for the lols, really.
Almost all languages have one of two sensible approaches:
- Every object's set of instance functions is set at compile time and can never change (static typing)
- Every object's set of instance functions is an aggregated history of the functions assigned to it (dynamic typing)
You can be much more creative than that.
 
haha
doesn't really help easily solve business cases but you do have a point
 
Permit dispatching to certain methods only during a repeating time interval? Sure! Dispatch to a random member of the inheritance tree for that type? Knock yourself out
 
3:31 PM
that would be neat for a random number gneerator with a deep inheritance tree
lol
 
oh yeah, dicking about with languages isn't useful, it's just for the lols
 
3:55 PM
hey
 
4:26 PM
hmmm that wasn't so bad in the end
0
A: How does EF Generate Proxy classes

WardyOk so after some digging about it looks like its using T4 templates to export the types at compile time then interception to basically replace the request of the original object with the generated proxy type at runtime. Key parts of the code ... T4 templates are here: http://entityframework.c...

took a little digging but it's quite a smart solution
 
what about code first models where there is no T4 template
 
the t4 template is in the EF framework
so there is always a t4 template
basically it just runs the t4 code for a collection of types
 
oh it's a runtime template
 
which it gets from the types in dbsets
no its a compile time thing I believe
unless i misread the code
 
I was confusing it with the templates that the designer generates from a database
or when you use the designer to create a model
 
4:31 PM
oh yeh those are not t4's
those are the actual types from the db
it basically reverse engineers the db in to a bunch of c# classes
 
I'm pretty sure it uses t4 to generate the entities
 
then runs the t4 on those
or goes straight to t4
I'm using a base interface so this should be pretty easy to build a solution from where im at
get a collection of types in the app domain that implement the interface then t4 out some proxies
then in my service factory just replace the real one with the proxy
the factory is called up by ninject too
so i should be able to basically create a derived factory of the existing one then use a config option or some other logic (like another ninject rule) to choose the factory to use
quite elegant i think
 
 
1 hour later…
5:59 PM
pretty much sums up what I see every day
 
00:00 - 18:0018:00 - 00:00

« first day (1911 days earlier)      last day (3023 days later) »