« first day (1475 days earlier)      last day (3472 days later) » 

3:05 PM
You know, it would be SO much easier if everyone in the world had a unique name.
(I'm currently having an identity crisis)
 
Hello
 
Hello @xDaevax
 
Does anyone do any WebApi?
 
Hello
 
sure
views based on membership? use a filter (if your talking mvc4/5)
 
3:10 PM
WebAPI dev here. What's up?
 
@xDaevax was there a question?
 
If I make two partial classes, how can I access the vars from the one side of the partial class from the other?
 
So, I've been doing MVC for a long time. Relatively new to WebAPI. I'm frustrated by the differences.
 
@Sippy my preferd solution is to never use partial classes ;)
 
@xa
@xDaevax Why?
 
3:11 PM
@xDaevax they are not competing products, two different uses
 
@Squiggle cri, I have to, circular dependency in n-tier :(
BLL needs model classes
 
solve the circular first
 
I want to add methods to model classes
So I can do User.IsInGroup
 
e gad with the bll thing again
 
Rather than helper.userisingroup(user, group)
Not my fault
I wouldn't use BLLs
 
3:12 PM
@Sippy isnt there a User.Groups property collection?
 
Yeah
 
BLL's isnt a thing
 
In MVC, I have a setup, where I have a controller that accepts a base (abstract) type as a parameter. I then use a custom model binder to create a concrete derived type based on the posted request data. Farther down the stream in my BLL, their are overloaded methods that are selected based on the type of the instance created by the ModelBinder. This works beautifully and I get to avoid messy if/else type switching nonsense.
 
But it's two collections and I don't want to loop both of them.
 
another BLL!
 
3:13 PM
In trying to adapt this for WebApi, I've learned many things.
 
listen folks, if you have BLL anywhere in your .net code, your living in 1999 and it wants its anti-patterns back
 
I don't have a choiiiiiice
Get raped at review if I don't use them
 
If else type checking is an ANTI-PATTERN... if you have it, your code is broken
 
So, BLL was a poor choice, how about "Where I would put my EF mappings if I didn't loathe EF".
;)
Either way.
 
@xDaevax inheritance in WebAPI controllers is still perfectly possible. What routing are you using?
 
3:15 PM
Assuming you have a project that is for your models, then a project for your datacontext, which you should... they go in the datacontext project since they are a datacontext related thing
 
In WebApi, I want to create different types of models based on particular information posted in a form. When I implement this in a Custom Model Binder (which now implements System.Web.Http.ModelBinding.IModelBinder instead of System.Web.Mvc.IModelBinder), I don't have access to the form as a value provider.
This is presumably because WebApi uses MediaTypeFormatters for Body elements.
But I can't write a custom MediaTypeFormatter, because the posted data is JSON, and there is already an adequate MediaTypeFormatter.
 
@CharlieBrown If I have a defined model for my application user class, what would you do to determine whether the user belongs to groups? Where would you place the method used to determine that?
 
you would write your own mediatypeformatter
 
What I don't understand, is how a MediaTypeFormatter is different (or more useful) than a ValueProvider.
 
It makes sense to me to use User.IsInGroup(group)
 
3:17 PM
@xDaevax I would question your approach to RESTfulness.
 
@Sippy i agree
 
So the problem is BLL is creating a circular dependency BECAUSE it is an anti-pattern?
 
you're exposing a single resource (url), right? Good practice is to ensure that data posted to that URL conforms to a single schema.
 
If not, where would I define the method that can make reference to the BLL whilst belonging to the model class?
 
MediaTypeFormatters are typically bidirectional
@Sippy im not following why you have a circ... you have a group class and a user class corrreect?
 
3:19 PM
anybody got any good resources for OS development that u would recommend? (not books - just online stuff)
 
which are both defined in your models assembly
 
@CharlieBrown I do have a group class.
I am not using it. That's a good point.
 
And you have a relationship, Group ->* users
And you have User -> Group
 
Group * -> * Users
 
many to many?
that makes sense
 
3:21 PM
Users can have more than one group
Groups can have more than one user.
It's active directory.
And I did not design that bit.
 
So the User object already has a public IEnumerable<Group> Groups {get; set;}?
 
Yeah
And I have a list of authorised groups for each activity.
 
So on User, you just public bool IsInGroup(Group g){ return this.Groups.Contains(g); }
 
I need to go redesign.
This is just fucking shit.
I hate BLLs.
And I have done something wrong, the user groups list is a string list
Because the groups are just container names
 
BLL's are the result of dumbing down good design patterns so much that they become anti-pattersn
 
3:23 PM
But the groups they're allowed in are just group names, not container names.
So that's my fault.
I don't think I'd have done it without reason
 
@CharlieBrown you're a proponent of DDD, amirite?
 
But can't remember what it was.
 
@Squiggle If I had to pick, I would say XP, but often my projects end up close to DDD
 
:)
 
Here is my philosphy... if the code seems confusing or hard to write... your doing it wrong.
 
3:25 PM
you're*
 
exactly. english sucks
 
:D
 
And its the only language I know.
 
it's*
 
lol, 35 years and I still can't get it right
 
3:26 PM
year's*
 
trolololol
 
Anyone know how to fix an error with Just-In-Time Debugger exception?
 
some more anti-patterns in the style of Jeff Foxworthy...
if you have 25 classes that all end in the name <something>Repository, you're probably doing it wrong
 
Lol
 
3:28 PM
If you have DTO's to map objects between the database and your domain model, you're probably doing it wrong
If you serialize your classes to xml to validate them against xsdl, you're really doing it wrong
If you send your domain objects across the wire as-is, you're doing it wrong
IF YOUR WROTE YOUR OWN ORM because <insert popular ORM framework> is too <slow, bad, doesnt work for your company>... then you are an idiot
2
 
Amen to that.
We had a project canned once because the Chief Architect had written his own ORM and wanted us to use it.
70% of the cost was us finding bugs, and waiting for them to be fixed.
(not an exaggeration - we had a really good scrum process that allowed us to actually calculate that figure)
 
@Squiggle Chief Architect sacked?
 
nah, I think he's still there. I moved on to better things.
This was 2007-2008.
 
3:43 PM
Figured out what my issue is
I stopped using a Group object collection
 
\o/
 
And instead just used a single property collection
Like a fucking idiot
Wonder what the damage of that is.
 
hey @Sippy can u help me with something?
 
i need to outsource some of this work
 
@jay_t55 wassat
 
3:54 PM
I want to install MikeOS (an operating system; mikeos.sourceforge.net) onto my external hard drive, but I don't know what to do with the OS files I downloaded. How should I "put" them on the drive so that it can be booted from?
 
the instructions are right on the home page
 
You need to make the drive bootable.
afaik.
 
yeah but when I try to boot from the drive, nothing happens and then the pc just reboots :/ so I figured I just missed something
 
Probably because you haven't made it a bootable drive.
 
just burn the iso to a cd and boot from the drive
 
3:57 PM
It's not as simple as copying files over.
 
kk thanks @Sippy
omg @CharlieBrown I totally didn't see that link lol. thank you!
 
another one... if your interfaces are in the same assembly, your probably doing it wrong
 
Hello people
 
@CharlieBrown instead of foreach to loop through two arrays
Is there an inbuilt way to compare two arrays and determine whether they have any equal values?
 
4:00 PM
not simply
 
Alright.
 
well, i take that back
 
There's shorthand in linq
 
there is a way... what type is in the array? string?
 
yes.
 
4:00 PM
arr1.intersect(arr2)
 
Will that be key dependent?
As in equal values at equal keys??
Keys don't matter in my instance.
 
it uses the default comparer
so string == string
returns the matching set
 
okay so if arr1 has value at key1 and arr2 has value at key2 it'll still match and return true?
 
there are no keys
use it like this
function bool IsAuthorized(IEnumerable<Groups> g){ return this.Groups.Intersect(g).Length > 0; }
works with String[] groups
 
Okey dokey thank you :)
 
4:04 PM
Guys, is there a way to print exceptions in a file so that when a problem occur, the customer sends me the file and i can debug it easily ?
 
log the stack trace and have them send you the log file
 
with Trace class ?
 
easier to use a logging framework, i recommend NLog, others might suggest Log4net
NLog.Log("Ahhh! What the F happened!!!", exception);
the frameworks will parse the call stack for you, if you use trace you will have t do it yourself
 
will try , thanks
 
I get on well with Log4Net. What's the difference/benefit of NLog?
 
4:15 PM
i like the config better personally
its easier to do cascade targets, like in debug mode i send all logs to console, error and up to file. thats difficult in log4net
 
hi everybody
 
I use This.Log to hide the implementation on the code (this.log works with any logger)
 
404 Requested URL: /Views/Home/Index.cshtml
This is annoying me
Every time I launch the debugger with the Index page open it points to that URL
 
You can't access cshtml directly
 
Can you disable that?
 
4:18 PM
Yes you can
 
Project Settings -> Web tab
 
Go to project se... what @CharlieBrown said.
 
is this the right place for some advice about entity framework and co?
 
ok should i use one logger instance in the whole project or every time i want to use it i instanciate it ?
 
4:19 PM
Both
 
great
 
Some people like 1 for simplicity, some do one per type... but if you do one per type, you should be caching it
 
is it possible to instanciate it from a class library ?
 
i try to develop an application that has to talk do different databases. what's the best approach for testing if i don't want / can't connect to my real data?
i read on SO a bit and it seems there are some conflicting views on this
 
yes, but your better using the methods NLog or Log4Net provide or wrap them into your own
@Thaoden fairly straightfoward
 
4:22 PM
woot just won my first gold badge!
 
@Thaoden are you using Model First or Code First development?
 
thanks charlie, you're awesome :)
 
@Skullomania Cool what for?
 
Code First against an existing database
 
@Thaoden oh great, even easier
 
4:23 PM
question getting 10,000 views
 
So you want to hide your dbcontext behind an interface, which is good b/c you should do it anyway
let me shoot you a sample, i write this very often
 
dang badges are hard to get!...lol...I feel my rep is lacking though. I feel should have at least 1k rep to have a gold badge.
 
@CharlieBrown having a look...
 
Then you just develop against the interface, and inject the DataContext
 
@ton.yeung i started messin around with node.js a bit
ok...im still in the newb phase
 
4:28 PM
ha, f5
 
lolz
 
I am curious though and I am sure I will learn the answer soon but... in order to run the page you have to run through the command node file.js...so how would I go about creating a websites or more importantly web apps for others to use with node.js
 
i do the querystring method, build server appends it during build/release
@Skullomania same as any other, deploy it to a node supported web server
 
@CharlieBrown so it has nothing to do with using a mocking framework?
 
@Thaoden yes/no
@ton.yeung correct, i update the index pages reference/script tag on build
@Thaoden you can choose 1 of two ways
either build a fake class and implement the interface and just return fake data in it, ur you could go with some fancy mocking framework... but honestly its overkill
@ton.yeung my builds are full redploys
like, make the browser auto refresh itself?
cant they just f5?
the index page isnt usually cached, but if it is, yeah thats tough
 
4:35 PM
@ton.yeung ok...so I did an example on nodetuts.com and they walk you through a hello world example. Before the tutor navigated to localhost to test the program he had to go through the terminal(he was on a mac) and typed in node server.js. this in turn compiled the Javascript in order for him to open the page on localhost. So this prompted the question that charlie answered in chat
 
can you write a directive that does my work for me too? k. thanks.
owin is like pr0n for the future of .net web
 
@CharlieBrown so the DataContext implementation you linked is the real implementation and there is some other class implementing IDataContext handling its own data in memory...?
 
@Thaoden exacto
 
O.o that just kicked my ass
 
4:39 PM
when I think of a web server I think of hardware and some OS running on top of that
or possibly a VM
@ton.yeung are you saying that server.js replaces the need for these?
 
ok... i think... and i simply write an interface for each db i'm getting data from
 
no server.js is the js equivalant of c# main.cs
 
and the corresponding fake implementation
 
@Thaoden correct
 
4:41 PM
ok. slowly getting there
 
Does anyone have any experience with windows tiles design?
 
this is a project you could clone to see how its setup, its a test for it. github.com/carbonrobot/officeAvenger
 
I'll have a look at it. Thanks for your help!
g2g. Have a nice day!
 
where can i find the log4net connfig file ?
 
Anyone know where do they put the XAML code please?
 
4:53 PM
where who puts what XAML code
 
and whats XAML code? you must mean markup.
and it's basic XAML.
 
@NETscape Thank you for this reference. Have you ever been creating tiles before?
 
its pretty simple... i'm pretty sure anyone thats touched XAML has created a "tile" before
because a tile is whatever you want it to be
 
I am currently not sure how to design the application tiles. My iconic tiles got basic image from WPAppManifest. Now I would like to insert some Titles to those tiles. I do not now if I have to create new tile for that or I can update existing?
I know how to changed the Title of current tile. But I would like to add much more data on Middle tile and customize it (e.g. add tile to the top and some information to middle of the tile)
I only see people using the TileData that only contains few properties such as Tile, Count, WideDesc1.2.3
 
5:04 PM
you probably need to open the project in Expression blend and edit a copy of the style of the original tiles.
 
oww never used it before. I will give it a try.
Do you have some reference how to change that tile properties please?
 
In Log4Net , what the detailled message that i can write in a file ?
for now i use log.error, is there a more detailled error message that i can displaY ?
 
that steps you through creating the tiles... there is even a sample
 
app tiles are specific to windows apps
*
@User1 you configure the detail in the log4net.config or web.config file by using the log pattern
 
@NETscape I know how to create tile. I know how to update it. But I need to customize it a way that I could have some description in the middle of the tile. Which Title property does not allw.
 
5:23 PM
charlie thank you again :D
 
5:36 PM
Ahh dammit. Where is everyone?
Who has experience with threading.timers?
 
Eh, so Roel got a happy bday and I didn't :'(
@KendallFrey Is that a yes?
 
Happy birthday Lews Therin!
6
@LewsTherin yes
 
@KendallFrey Ha ha. I was kidding! It was 5 days ago -_-
 
have a happy birthday anyway
 
5:39 PM
@KendallFrey Ok, brilliant. I'm not able to find out documentation on this. Do you know if Timeout.Infinite stops the timer before the callback is fired?
@KendallFrey Thanks lulz
So let's say I have:
 
@LewsTherin not sure what you mean. Timeout.Infinite is just a value, it doesn't do anything
 
Anyone encounter an issue with Visual Studio where it won't let you debug? It constantly flags an issue with the Jit not having proper permission for W3WP.exe. Only in this one project though-
 
timer  = new Timer(callback, null, Xperiod, Timeout.Infinite) //I expect the timer to run just once.
callback executes // is the timer disabled before the callback executes?
Basically I'm trying to figure out if the code callback is still reentrant after stopping the timer based on the period
I should probably ask this on main SO to get a wider perspective
@Greg Sorry, haven't.
 
Sigh-
 
Any reason you're not using Timers.Timer?
That's the one I know better
 
5:46 PM
76
A: System.Timers.Timer vs System.Threading.Timer

HeroIn his book "CLR Via C#", Jeff Ritcher discourages using System.Timers.Timer, this timer is derived from System.ComponentModel.Component, allowing it to be used in design surface of Visual Studio. So that it would be only useful if you want a timer on a design surface. He prefers to use System.T...

 
Where should i call log4net.Config.XmlConfigurator.Configure();
 
To answer your question...
 
i need to use it in a class library, calling it on every method is a bit incorrect i think
 
> If period is zero (0) or negative one (-1) milliseconds and dueTime is positive, callback is invoked once; the periodic behavior of the timer is disabled
Timeout.Infinite is -1
 
guys please halp ,
 
5:49 PM
> The method specified for callback should be reentrant, because it is called on ThreadPool threads. The method can be executed simultaneously on two thread pool threads if the timer interval is less than the time required to execute the method, or if all thread pool threads are in use and the method is queued multiple times.
Dang, but that doesn't say if that is the case if the timer is disabled
That's why I need to know if the timer is disabled before the callback fires
 
Because it's fucking awesome.
 
@LewsTherin what do you mean by disabled?
 
This:
> If period is zero (0) or negative one (-1) milliseconds and dueTime is positive, callback is invoked once; the periodic behavior of the timer is disabled
 
if the periodic behaviour is disabled, it will never fire more than once
(Until you call Change)
 
Yes, but is that condition cleared after the timer fires or before?
 
5:53 PM
what condition?
 
The one I quote earlier lol
For example, the timer could very well do this:
 
> If period is zero (0) or negative one (-1) milliseconds
this applies in the context that period applies
i.e. on initialization
 
@RoelvanUden no
 
@RyanTernier You're so negative. I think it's incredibly impressive. :-)
 
Now this, video. It's epicly awesome
 
5:56 PM
GetThreadFromPool()
Thread.Start(x=>{
					while(!conditionsCleared())
						raiseCallback();
						MayDisableTimer();
			    })
Sorry about the stupid tabs
 
@RyanTernier Choreography and a resulting one-shot music video recorded with drones trumps it all.
 
!!youtube epic saxophone guy 10 hours
 
@KendallFrey But if it disables timer in conditionsCleared() then that's fine.
 
Then you have the classic "5 4 3 1 OFF BLAST"
 
5:57 PM
@LewsTherin The timer doesn't have a "disabled" state
The period timeout exists from the moment you pass it
To cut to the chase, it will never execute twice
 
Hey guys, i'm using the Log4Net in a class library, i use log4net.Config.XmlConfigurator.Configure(); to get configuration from xml file, but i need to use this in every method and it's a little bit incorrect i think, any suggestions ?
 
@KendallFrey I'm aware of that. But it must do a check somewhere or at some point to determine whether to fire the callback again.
Depending on where it does it, the callback maybe reentrant.
 

« first day (1475 days earlier)      last day (3472 days later) »