@error Oh, the bot works for both now? Great, I'm off to fail to take goo out of a tube or something.
Best posts made by Maciejasjmj
-
RE: TDWTF Plays Sorcerer
-
RE: Potential Null Pointer Access
@boomzilla said in Potential Null Pointer Access:
The null related annotations don't cover this case.
Hm. Back in C# land, Resharper has
ContractAnnotation
s which let you specify contracts on your methods:[ContractAnnotation("null => false; notnull => true")] private bool IsNonNull(string foo) { return foo != null; } //... string foo = null; if (IsNonNull(foo)) { foo.ToString(); //look ma, no warning! }
I haven't found anything equivalent for Eclipse, but perhaps there is some sort of extension that does that?
-
RE: Entity Framework, Code First and relational data
@RaceProUK said in Entity Framework, Code First and relational data:
Yes: use the collection returned by EF i.e. don't call ToList().
Or use
Include("model")
(I think you pass a property name?) -
RE: Entity Framework, Code First and relational data
@Jaloopa said in Entity Framework, Code First and relational data:
The Create() and Edit() POST methods have that in the signature: public ActionResult Edit([Bind(Include = "Id,model,Name")] Model2 model2). Should that be somewhere else as well?
Oh, no, that's for something else.
You'd include your
Include
when performing the query, so it would be something likedb.Model2s.Include("model").ToList()
to give you aList<T>
ofModel2
s which have themodel
property filled. -
RE: PBP Paranoia?
@Weng *waves* Sign me in! This time for real.
I wonder if a straight pen-and-paper RPG won't be too demanding in a forum environment, but we'll see.
-
RE: Entity Framework, Code First and relational data
@AlexMedia said in Entity Framework, Code First and relational data:
They spare you the boring work but still give you the freedom to write your own SQL queries and tables, unlike "frameworks" such as EF which force their way of working upon you.
EF lets you execute a stored procedure if you need to, and if you don't keep your SQL bits in sprocs but pepper them in strings throughout your codebase then you're .
It also lets you code the table up with indices, hints and whatever you need and hook the EF model to that. If you need it. And it also lets you comfortably whip your table up code-first if you don't. So that's more choice, not less.
-
AppDomain woes
So I'm writing a thing (in .NET, like God intended). This thing is supposed to support plugins - looks like a natural fit for MEF, but I also want the plugins to have limited access to the system and run in separate AppDomains.
Currently, I have three projects - the main project which will call the various plugins, the SDK-ish project with all the necessary interfaces, and the plugin project. Both the main project and the plugin project reference the SDK, but not each other, and they live in separate directories. And that seems to be a bit of a problem.
In my main project, I want to find a type in the DLL which implements a particular interface from the SDK, instantiate that type and call a method on the instance. I assume the assembly might be malicious, so I don't want to execute any code from it in my own
AppDomain
(which might run with high permissions), but spin off a separate one.So far, here's the code I have:
public class CrossAppDomainCallbackWrapper : MarshalByRefObject { public Type DiscoveredType; public AssemblyName AssemblyName; public void DoCallback() { var assembly = Assembly.Load(AssemblyName); var types = assembly.GetTypes().Where(y => typeof(ITsptPlugin).IsAssignableFrom(y)).ToList(); if (types.Count > 1) throw new MultiplePluginsException(AssemblyName.FullName); if (types.Count == 0) throw new NoPluginException(AssemblyName.FullName); DiscoveredType = types.First(); } } public static Plugin DiscoverPlugin(string dllPath) { var directory = Path.GetDirectoryName(dllPath); var setup = new AppDomainSetup() { ApplicationBase = AppDomain.CurrentDomain.BaseDirectory, PrivateBinPath = directory + ";" + AppDomain.CurrentDomain.BaseDirectory }; var loadingSetup = new AppDomainSetup() { ApplicationBase = directory, PrivateBinPath = directory + ";" + AppDomain.CurrentDomain.BaseDirectory }; //todo set permissions properly var domain = AppDomain.CreateDomain(dllPath, AppDomain.CurrentDomain.Evidence, setup); var loadingDomain = AppDomain.CreateDomain(dllPath, AppDomain.CurrentDomain.Evidence, loadingSetup); var name = AssemblyName.GetAssemblyName(dllPath); var wrapper = new CrossAppDomainCallbackWrapper(); wrapper.AssemblyName = name; domain.DoCallBack(new CrossAppDomainDelegate(wrapper.DoCallback)); var instance = (ITsptPlugin)loadingDomain.CreateInstanceAndUnwrap(name.FullName, wrapper.DiscoveredType.FullName); var manifest = instance.GetManifest(); return new Plugin { PluginName = manifest.PluginName, TypeName = wrapper.DiscoveredType.FullName, DllPath = dllPath, HandledVerbs = manifest.HandledVerbs, Version = manifest.Version }; }
The major problem is that apparently .NET doesn't give a flying fuck about the
PrivateBinPath
and I haven't found a good way to avoid spinning up two separateAppDomains
. If I use the one withApplicationBase
set to DLL's directory, it crashes onDoCallback
because it can't find the .exe with the callback wrapper. If I use the other one, it crashes onCreateInstanceAndUnwrap
because it can't find the concrete plugin type.I tried some tricks with
ReflectionOnlyLoad
/ReflectionOnlyLoadFrom
, but that crashes due to the DLL referencing the SDK. Is there a better way than discovering the type within oneAppDomain
and instantiating it in another? Or am I just too paranoid and there's no wayAssembly.Load()
into my ownAppDomain
could do anything malicious if I only use it to discover types? -
RE: AppDomain woes
@BrisingrAerowing said in AppDomain woes:
Maybe the stuff at this page will help? I have toyed with that before and it seems to work.
Almost, but it seems like I don't get the chance to specify the security permissions for the domains, it just protects me from an unhandled exception bringing the app down?
-
RE: Lastpass or Keepass (or something else?)
90 days
Lucky bastard, our domain passwords have 30 day expiration date. And I don't think you can even use KeePass for that...
I should start using the thing, but I dunno. I'm not too comfortable with locking myself out of my accounts on any device where I can't use it for some reason.
-
RE: In Which @Captain asks C# Beginner Questions
@fwd said in In Which @Captain asks C# Beginner Questions:
ternary within ternary is usually red flag.
Eh, for a terse switch-case it's okay. Of course then are things like:
a == 0 ? (b == 0 ? c : (d ? e : f)) : (d == f ? a : (b == 0 ? c : d))
(only usually with less parentheses to boot, because that would make things somewhat readable, and we'll have readable over our dead bodies).
-
RE: Someone back me up here-- Bethesda changing price of Fallout 4 Season Pass
Personally I don't like Season Passes and raising your Season Pass price because you add more DLC feels like bad planning on Bethesda's side.
Eh, Season Pass are wares like any other, if their prices can go down they can go up as well. But it really makes you think what the game companies mean by "season pass" these days, since their whole point is that they're sort of a guarantee to the players.
Also makes you wonder if they haven't caught on to this:
The whole thing will be available as a $5 GOTY edition in a Steam few years down the road
and want people who would otherwise wait to rush into buying the game before the price hike.
-
RE: Video game spotlight thread
I mean it's pretty silly in principle, since it's totally turn based, so it's not like aiming the attack is a difficulty factor. Either I can pull off that attack so that it hits two critters, or I can't, making me slowly maneuver the stick because there's just exaaaactly one position where it would work is just sadism.
-
RE: Obsolete Plaid
Yeah he only does it to annoy people with broken notifications that require extra effort to mark as read.
Jeffing in Discourse is just plain broken. Not only does it mark a thread as totally new and all the posts in it as unread, so if you're OCD like me you need to go through the discussion again, but the Jeffing notifications point you in the totally wrong place.
Yes, cool, you ripped my posts out from this thread. WHERE ARE THEY NOW?!
-
RE: Video game spotlight thread
##Hyperdimension Neptunia Re;Birth1
" ... I'm sorry for not talking you out of it" - anonymous.
Mivexil: three minutes in, already insulting each other's breast size, this is gonna be good
Mivexil: also, Phoenix Wright was an action game compared to this
Mivexil: http://i.imgur.com/74tp4qW.png
http://i.imgur.com/74tp4qW.png
Mivexil: off to a good start
Mivexil: oh hey, apparently there's a "skip absolutely everything" button
Mivexil: I mean, I pressed something, and it just fast-forwarded through like 5 more minutes of talk
Mivexil: not sure if I should be pissed or relieved
Mivexil: also, I guess voice-acting anything but the first scene was out of budget
Mivexil: same feeling, though
Mivexil: well, I'm finally doing battles
Mivexil: they're in 3D!
Mivexil: but still turn-based, so that's kinda pointless
Mivexil: you can run around and have to get close to the enemies to hit them
Mivexil: but they just stand in place until it's their turn
Mivexil: also, you can run diagonally, but can't stand diagonally
Mivexil: so overall, 7 euro already well spent
Mivexil: oh, yes
Mivexil: I think it's a panty shot per battle
Mivexil: okay, turns out the 3d perspective has a point
Mivexil: to make sure you're unable to aim the attack at more than one enemy at once
Mivexil: it kinda looks like you can, then you let go of the stick slightly and it snaps you back to cardinal directions
Mivexil: well, there should be a new dungeon somewhere but there isn't, so screw that game for today
Mivexil: review summary, it's not very good
Mivexil: played worse though, I guess -
RE: What is this ungoogleable operator called?
@masonwheeler said in What is this ungoogleable operator called?:
This is like a concrete Anonymous Type that you can actually do useful things with, such as return from functions or pass to functions as a parameter.
The massively wrong things, you mean.
That's the point, anonymous types are a kludge, but they're a localized kludge. Your implementation might be shit because you're too lazy to write a class, but at least that's confined to the single method implementation. With the tuples, you're leaking it to your interface, And That's Terrible.
-
RE: The Official Status Thread
Because normal people don't pay money to give free advertising to someone else
I don't know, I've been advertising quite a few rock bands on myself.
And since I might not be the best example of a normal person, I also know a lot of normal people who do.
-
RE: Converting an OWIN token to an OWIN cookie...
@Tsaukpaetra said in Converting an OWIN token to an OWIN cookie...:
But.... this doesn't actually sign them in, so... Yay!
Doesn't it? The middleware code should run before MVC in the pipeline, so MVC should only see the header already filled and treat it as if it was always there.
-
RE: No 'Access-Control-Allow-Origin' header is present on the requested resource.
@Zecc said in No 'Access-Control-Allow-Origin' header is present on the requested resource.:
But yeah... empty response.
But it's not if you access the URL directly. Are you sure
no-cors
works like you say? Isn't the entire point of an opaque response that you can't access the body?By the way, found this:
-
RE: The Official Status Thread
Status:
//convert the BaseColumnSetup method (with an irrelevant generic parameter) to a delegate Action<GridView, bool, bool> expr = UIHelper.BaseColumnSetup<BusinessLogicObject>; //get the BaseColumnSetup method's generic definition from the Action delegate, then use it to construct a method for the proper generic type var minfo = expr.Method.GetGenericMethodDefinition().MakeGenericMethod(_currentMapping.ReturnType); //call the method minfo.Invoke(null, new object[] { mainGrid.GetView(), true, false });
Someday, this fuckery will probably bite me in the ass. But today is not that day.
-
RE: Earnestly thinking NULL is a mistake is a symptom
Apparently you wouldn't be allowed to call methods on a nullable outside the checked block.
Which seems awfully pedantic to me. And let's say you have an object with a bunch of properties, and they can either all be null or all be not null. So what, you're going to wrap your code in twenty null checks?
And five dollars say people would just get pissed off that the compiler doesn't let them write code, because as much as we've advanced the static analysis tools, they still can't read minds and infer that, say, the outside system's contract specifies that the value can only be null on Tuesdays, so
if(GetDayOfWeek() == DaysOfWeek.Tuesday)
is a null check. -
RE: The Official Status Thread
Well, Ben, think about the subtle way the meaning changes if you say "eat your cake and have it too", and consider how much more sense that wording makes.
It is perfectly possible both to have your cake and eat it too, and to eat your cake and have it too, since the sentences as such do not strictly imply a temporal order, and both situations happening at some unspecified period on time are not only allowed, but generally speaking necessary (you can't eat your cake without having it previously for some period of time). Compare a sentence like "you can't buy bread and buy eggs too" - there's no requirement on the order of the actions, just that buying one article makes buying the other one impossible.
In fact, even if we were to imply one, it's ambiguous anyway - one interpretation is that you can't (have, eat) your cake and (have, eat) it too at the same time, which is incorrect both ways (the ownership doesn't cease until the object ceases to exist, which is after it's been eaten). Compare a sentence like "you can't own bread and own eggs too" - where two states can occur independently (and intermittently), but not at the same time.
It's only the other interpretation (you can't eat your cake, then have it too) when the order is a factor in parsing the sentence. But that's not the only parse, and not even the most obvious to me personally.
-
RE: Anti-idle the game
Only at +5, because I've been farming bucketloads of crystals with Gem of Constancy and was like "meh, I'll ascend later". And I try to get 9k1 each time too.
-
RE: Earnestly thinking NULL is a mistake is a symptom
Why are those other fields stored in the first place?
Well the point of smart properties is that they're not, they're calculated from
BirthDate
.As to why you'd want someone's Zodiac sign, gee I dunno, you're a wizard and are offering your services via a web application. Point is, in most programs there are invariants like "if A is null, B is null, otherwise B is never null" that @Gaska's solution can't express, and it forces you to code around them.
-
New post indicator
https://www.dropbox.com/s/ty46j23q9qo3i2q/Screenshot_2015-09-24-12-59-43.png
Filing under Bug, because I refuse to believe it's a design decision.
-
RE: Brungles
I thought you use that to get women into your apartment and not for media consumption ...
And what, have my $8.99 a month go to waste? Sod off woman, I've got 2 seasons of CSI left!
Filed under: and next time you invite me for coffee, I expect you to make fucking coffee
-
RE: NULL: the worst mistake of computer science
For instance I have an enum of strategies.
Make the strategies into objects with a common interface. Why would you stick it in an enum?
Hell, in C#, you can then decorate an enum with types of said objects, so if you really want to switch on strategies for some reason, then you can do
public enum Strategy { [StrategyImplementation(typeof(ZergRush))] ZergRush, [StrategyImplementation(typeof(Turtling))] Turtling }
and get your strategies from that.
-
RE: Question on Source Control and Alternatives-Testing Code
@zecc said in Question on Source Control and Alternatives-Testing Code:
Create a gist — which is a form of source control I guess — and put a link to it in a comment in your code.
Or that, although I'm personally wary of putting links to random places in my code due to link rot.
-
RE: What's the deal with Prolog?
Thing is, I don't remember much, but I remember we used it for a lot of things that would take two lines in an imperative (and probably functional) language, but ended up being insanely brain-bending puzzles in Prolog.
-
RE: The Official Status Thread
Where does one go these days for articles to forward to the boss to prove that we're doing something wrong and/or that he should treat the devs better
The Daily WTF?
Seriously though, I don't know any people with blogs who could act as role models. I'd say Raymond Chen, but he doesn't do much on management and processes.
-
RE: 🎤 Song of the day 👂
The raw fiber is yellowish, thus "flaxen-haired" means blond.
https://www.youtube.com/watch?v=YEITVTcGbzc
(a.k.a. "that song that spams my Windows Media Player playlist")
-
RE: Question on Source Control and Alternatives-Testing Code
@dreikin said in Question on Source Control and Alternatives-Testing Code:
In that vein, I decided to do what I should have done in the first place:
It looks like a good place to use a nullable type, if we're going with code reviews. Make sure the performance doesn't suffer due to boxing, but it shouldn't.
As for
Distinct
, I usually end up either writing my ownDistinctBy
method or pulling in MoreLinq. I can understand why LINQ folks didn't want to include that, as depending on the collection it's not defined which object you'll get if a duplicate shows up, and in case of generated enumerables it might not even be the same object twice.Also, LINQ deprecates Predicate
Do use the new LINQ types “Func<>” and “Expression<>” instead of custom delegates and predicates, when defining new APIs.
-
RE: Meta.d is sad
So he essentially wants to present two blank boxes to the user and let them figure Markdown out?
This is just retarded. Okay, we're devs, we can kinda figure out markup languages. But for like 99% of people on the Internet it's a totally foreign concept.
And once again, I DON'T WANT TO READ A MANUAL TO USE YOUR FORUM. And no, Markdown isn't any more "intuitive" than any other markup unless you spent the best years of your life on IRC channels.
-
RE: Video game spotlight thread
Where's Euro-Steam?
Oh right, Europeans just sit on their fat asses and wait for Americans to solve all their problems. Then bitch about our solutions. Then eat crepes. Fucking crepes.
We gave you the Witcher, you give us the GTAs.
Also apparently it was a price error or something and actually no one get's a discount, so at least we're all fucked together.
endless fallout 3 rants.
It was a good game, properly upped in scale, the main story was rather meh, but then again so it was in the first two ones.
Also, apparently the dailies now carry over to the next day or something? I thought I missed the Metro bundle since Steam put up new dailies, but it's at the same price even now.
-
RE: There goes my productivity
Did anyone really care about points since, well, Atari 2600?
-
RE: Video game spotlight thread
That's actually pretty cool... I wished for something like that back when I was playing DDR a lot.
It's a bit hit-and-miss. What's good is that instead of ramping up the whole song, you level individual parts - so you can still have a somewhat easier solo while playing the riff as it was intended to be. The problem is that it's a bit too easy to put the song difficulty above your actual skill level, and AFAIK you can't really bring it down (except for score attack or working around via the Riff Repeater).
Also: note that I've seen the game for sale on Steam, I think for pretty cheap.
Yep, that happens quite often. The cable, however, pretty much never does - and for that matter, neither do the DLC, which are a bit on the expensive side.
Yeah I'm normally against piracy
Is it really piracy? Granted, it's Ubisoft, so you probably break the EULA in 20 different ways just by playing the thing, but from the moral point of view I hardly see the issue.
It's not even a dongle in that not having one doesn't actually make your copy illegal, since you can pick the game up legally without the cable. It's an accessory, except the game doesn't start without it without workarounds.
I mean come on. Even Guitar Hero let you map the keyboard if you wanted to play it FoF-style.
-
RE: Game Deals Thread
Radeon X1950 XTX
I miss my GeForce 2.
There, have a deal - Antichamber for 1,50 euro. Portal was too easy? Have a go with that.
-
RE: Question on Source Control and Alternatives-Testing Code
@masonwheeler said in Question on Source Control and Alternatives-Testing Code:
There's no good reason why it can't treat two delegate types of identical signatures as exactly equivalent and interchangeable.
I always figured they wanted to do something similar to
typedef
s, only nobody asked for it and eventually they just gave up and decided to useFunc
everywhere. Kind of like C# 7 is now trying to deprecate structs in favor of tuples. -
RE: Azure -- is there an equivalent to Amazon S3?
Those might be helpful, though if you want detailed access logs then a low-tier web app with Application Insights hooked to it could be better.
If it's just serving content, I'd go for a blob storage.
-
RE: Game Deals Thread
It only has the first game's DLCs, though. Be aware that if you want the full story, you're going to be bleeding money anyway.