« first day (1374 days earlier)      last day (3575 days later) » 

12:18 AM
Any EF Code First coders here?
 
 
6 hours later…
6:24 AM
posted on July 21, 2014 by Scott Hanselman

The wife and the boys and I are often in the car for 30 minutes or more, heading off to various activities or events. We live pretty far outside of town, and when we need to head into the city, it's almost an hour. While we have lots of music, discussions, and what not, the boys aren't quite ready to listen to the unfiltered news. My wife, out of nowhere: "Is Dagobah in Rivendell?&qu

 
6:43 AM
hi
 
7:17 AM
Bazinga!
 
7:53 AM
Anyone know about LINQ queries
 
I've heard about them. They're so hot right now, right?
 
hi guys
 
Hello, anyone knows how to work with .svc file in URL?
I mean that should be some kind of WS but how do I add reference to that address in console application, anyone knows?
 
8:11 AM
@Marek Add Service Reference -> Right Click -> Add New Service Reference
Morning guys./
 
@RoelvanUden I tried it but with address vrep1.cssz.cz/VREP/ws/public.svc it founds nothing :/
 
@Marek You need to feed it the wsdl. What are you using, wcf?
 
Ya buddy Simon
 
@RoelvanUden sorry, Iam quiet beginner in this field. I would like to consume govt. WebService. This should be the address to their WebService: vrep1.cssz.cz/VREP/ws/public.svc. I use Console Application - c#, I tried WSDL.EXE with this command Wsdl /namespace:KomunikaceCSSZ vrep1.cssz.cz/VREP/ws/public.svc but it found nothing.
 
8:20 AM
@Marek I can't check out the web service because its HTTPS certificate is invalid. Are you sure that's the valid one you want to use?
@Neo84 If you have a Linq Q, just ask ;)
@JohanLarsson Johan are there a plural sight videos for new stuff and cross-platform (vnext and linux/mac osx/mobile dev for ios/android)?
 
The average is high from what I have seen.
searching is probably easiest, then browse by tags from the result
 
Hmm.. I see. There appears to be some, but nothing on vNext for example.
 
I think they add courses frequently.
give the trial a spin imo
 
8:43 AM
@RoelvanUden it is the one that Govt has on their website :/
 
9:01 AM
Thanks Roel, I think I found the answer. I was about using methods in the select new {} clause. Found that I can use AsEnumerable () and another select clause and it works.
 
For a WCF service, am I able to prevent the basichttpbinding from appearing
I only want my service to work over SSL (https)
 
@Neo84 I'm guessing you're using EF, and in that case you are correct. AsEnumerable ensures that EF processes the query tree before that point, and fires that as a query. Then, everything following that AsEnumerable happens on the .NET side again. That's the reason behind it so it makes sense :)
 
@r
@RoelvanUden Thanks ... Maybe you can help me with this last part I need. So from that, I am trying to convert byte[] which is an ip address, to a read-able string. Any ideas. In words, I want the IP address again not the byte form.
 
user1804599
@JohanLarsson buzzwords.
 
9:17 AM
@Neo84 A question before that; why did you store IP address in a byte[]?
But you can just string.Format("{0}.{1}.{2}.{3}", ip[0], ip[1], ip[2], ip[3])
Storing an IP as an Int64 makes more sense though.
 
@RoelvanUden Its an implementation that someone did in the db before me. Otherwise I would have left it as a simpler type to deal with.
 
@rightfold Not exactly. It's the new redesign of ASP.NET, which was designed to run on more devices and OS's, which makes it a valuable thing to learn about. EF7, MVC6 and vNext, if executed properly, can be of really huge influence.
 
@RoelvanUden ahhh your a genius that worked perfectly.
 
@Neo84 :-) Be sure to check if the byte[] does have 4 bytes in the array. E.g. if someone wrote two bytes to the database, that code will crash.
 
@RoelvanUden Ya it binary(4)
 
9:28 AM
Ahh ok. :)
 
 
3 hours later…
12:54 PM
hey guys
anyone know how to fix my web templates in vs 2013
i dont have the options I should have
0
Q: VS 2013 templates

WardyAll the msdn documents say I should have the following template options (see image below) when trying to create a new asp.net application but for some reason the only options I have are Empty, Web Forms, and Azure Mobile Service. Does anyone know how I might go about restoring the missing option...

 
1:13 PM
ok am a beginner and was using this tutorial
asp.net/mvc/tutorials/…
problem is
[HttpPost]
public ActionResult Create(Movie newMovie)
{
if (ModelState.IsValid)
{
db.AddToMovies(newMovie);
db.SaveChanges();

return RedirectToAction("Index");
}
else
{
return View(newMovie);
}
}
I dont find a method like db.AddToMovies
in comments I saw someone explain db.AddTo"tablename here" so I used my tablename there but getting an error
 
user3799134
The author is using Entity Framework. Did you complete the steps here ?
http://www.asp.net/mvc/tutorials/older-versions/getting-started-with-mvc/getting-started-with-mvc-part4
 
1:31 PM
In WPF, is there some sort of CheckBox.IsCheckedChanged event, or do I need to subscribe to Checked and Unchecked?
 
Hi guys
not too many people here
 
Quality over quantity @Riva :P
@KendallFrey Just bind to Checked
 
You can just look at Event list in VS for that ;)
IMHO there is Checked, Unchecked, Undetermined(?) and Click event
@RoelvanUden Good to hear :)
 
@RoelvanUden I can't bind to something arbitrary
 
@KendallFrey The whole point of WPF is to make use of the binding capabilities. The View should bind to your property and when it switches, your property is set. That's your 'event', without using an actual event. Vice versa, to update the view from your bound class, just raise the NotifyPropertyChanged with the property name.
 
1:37 PM
This project isn't worth the complexity to do databinding
 
@KendallFrey I what way is IsChecked arbitrary for you ?
 
It's just a front end for a commandline tool
@Riva I'd have to bind the other end to something arbitrary.
 
@KendallFrey You mean you really just want to catch change of the button
 
To avoid a discussion, yes
 
(No, Im asking honestly. Maybe my head is slow today)
 
1:40 PM
Databinding is not complex. It's literally 1 line:
`view.DataContext = myClassInstance;`
Where myClassInstance has a property :P
 
@RoelvanUden And you have to set the actual binding. And implement INotifyPropertyChanged, which is 15 lines extra right there
 
You dont need to implement INotifyPropertyChanged
That's only to make the view update from the code-behind
You can also just use the name reference and set it if you're feeling lazy.
 
yeah, i suppose that wouldn't be strictly necessary here
 
@RoelvanUden if he wants 2way binding he kind of does
@KendallFrey You can of course expand the TButton class. (But I understand its again not worth)
 
good god no
 
1:43 PM
:)
 
This app will never be used anyway
it doesn't need to be fancy
 
Well those are your options
BTW does anybody know a good tutorial for implementing (secure) login logic ? With remember login/pass etc.
Im googling hi and low, and only finding stuff where some guy is explaining how to create gui with 2 textboxes :[
 
Protip: NEVER remember a password
use a one-way hash to store it
 
@Riva Use a strong, one-way hash on your SSL secured received plain password (PBKDF2 for example), and match against stored value (100k iterations, with a salt). If valid, generate access token and link token to user. Return token. Let token expire after x time. That's it.
 
Of course. (good tip) I did that much so far.
But I need to store the pass anyway, in some 2way encryption (in a way I can retrieve it in original form) to use it for DB connect. Cant wrap my head around it right now :(
 
1:52 PM
um, why?
Why would you need the user's password to log in to the DB?
 
@KendallFrey Secure DB.
 
Then why would you use a user's password on it?
 
What point would it be to have a login system if anybody can connect to the DB.
 
Your server should be the one logging in to the DB
 
1way hashing is pretty standard for that purpose
 
1:55 PM
your server should have access to the DB, and grant it selectively to users
 
I think I really need a baby steps tutorial for it. Maybe Im thinking wrongly about the whole thing. (1st time I dug into that stuff)
any tut you can recommend ?
@KendallFrey There is no Server really. Just app with embedded DB.
 
Anyone have an idea, I'm trying to parse a part of the URL Query String, to find an "a href" that holds the same value, before it performs a task.
 
in HTML / CSS / WebDesign, 42 mins ago, by Obi Wan Wesabi
@rlemon honey need some help again xD does it exist a complete visual guide to winapi/wpf components? screenshots of buttons, selectboxes, listviews and so on?
if anyone knows and can help him. thanks :P
also, fun new script for the chat (just paste it into your console)
gist.github.com/rlemon/960e0f0e996b16e7d201 selects a random imgur image and sets it as your background - changes once a minute
 
user652649
@rlemon you are so kind xD
 
possible NSFW
 
user652649
2:07 PM
hello everyone
 
Anyone really good with jQuery?
 
@Riva That's bad design. Inherently insecure.
 
@Greg I'm good with Javascript ;)
 
You must have a server of some sort. One that you control.
 
@RoelvanUden whych part of it ? The embedded db ?
 
2:09 PM
@rlemon I have this Javascript.
    $(document).ready(function () {

        var content = window.location.href;
        $("a").each(function () {
            if (content.indexOf($(this).attr("href")) != -1) {
                $(this).css({ fontWeight: "bold", fontColor: "Red" });
            }
        });
 
protip: $(this).attr or $(this).prop is almost never needed
this.href will suffice
 
It matches: http://localhost/Course.aspx?id=4 when the URL actually is http://localhost/Course.aspx?id=44
@rlemon That change doesn't find anything.
 
@Greg because the one is contained in the other.
 
@RoelvanUden I am really aiming for offline server-less solution. It should be a standalone package.
 
what you should be doing is matching the entire string
or just the parts that you care about
 
2:11 PM
@rlemon ??? Isn't that what it is doing?
 
nope
"abcd".indexOf("abc")
 
user652649
content.match(new RegEx("/^" + this.href + "$/"))
 
will match
ew, don't use regexp
 
user652649
just a simple == ?
 
well it depends
 
user652649
2:12 PM
.href will return always the absolute url @Greg
 
(not if he's grabbing the attribute in a silly way ;))
 
Well, I'm only trying to ensure that it grabs the query string.
Well, what should I do.
I'm trying to compare the URL to the <a href> so I can modify the class.
So that I can add a bread crumb.
 
user652649
        if (content == this.href) {
 
(function() {
  "use strict";
  var url = window.location.href;
  for( var i = 0, l = document.links.length; i < l; i++ ) {
    if( document.links[i].href === url ) {
        document.links[i].style.color = 'red';
        document.links[i].style.fontWeight = 'bold';
    }
  }
}());
 
@ObiWanWesabi That actually worked.
 
2:14 PM
does this work?
@ObiWanWesabi this isn't php, don't ==
always === and !==
 
user652649
@rlemon you're definitely on your period xD
 
no, I'm trying to ensure people don't advocate shitty js ;)
== in js should be ===, and == (as it is) shouldn't exist.
 
user652649
only thing you will have to care about is the order of querystring parameters @Greg
"blah.aspx?id=44&page=2" !== "blah.aspx?page=2&id=44"
 
@ObiWanWesabi I control the order.
 
@Riva Then what is the user login for?
 
2:17 PM
In the this can I grab the <a> text?
 
this.textContent
 
@RoelvanUden So I can still secure the data in the DB from unapproved access.
Im amking a small app, but my users are all IT. I want to prevent them from fiddling with the DB file. Mainly. Since they all know how to use some DB inspect tools ;)
 
@Riva You can't. It's not possible to create an application that runs locally, and stores information locally, without anyone slightly capable being able to read the information, as well.
 
I planned to use encrypted DB file with embedded db (SQLite so far) and login system in the app.
Does it make sense like that ?
 
@Riva I understand what you want, but even that encryption requires a decryption key prior to accessing the database. This key is stored in your application. Reversing your application is trivial, we can basically read your code and get the decryption key. It's not protected at all. It's just an illusion of protection.
 
2:23 PM
@RoelvanUden Well I wanted to use the users login & password as a key for that
 
function parseURI() {
	var uri = location.href.split(location.pathname)[1];
	if( uri.charAt(0) === '?' ) {
		uri = uri.slice(1);
	}
	return uri.split('&').map(function(tvar) {
		var parts = tvar.split('='),
			ret = {};
		ret[parts[0]] = parts[1];
		return ret;
	});
}
id=44&page=2
would return
[{id:44},{page:2}]
@Greg
might be useful
 
and yes, it might end up being just an illusion of protection. Im kind of aware of that. It might at the end be enough, since the uers are not advanced enough to be able to revert/decompile/snoop memory of .net app
 
It's a distributable windows application?
also hello, all
 
@Squiggle Hi. thats at me ?
 
@Riva Oh you can then just use the username as salt, and the password as password and generate a hash which is used as a 128-bit AES encryption key to encrypt/decrypt the database. It's still an illusion :)
 
2:29 PM
yeah sorry @Riva :)
@RoelvanUden just so long as their password doesn't change...
 
@RoelvanUden "illusion" - what are the dangers then ?
@Squiggle well not mass-distributed. Total of +-5 people will use it and it will be portable. =not even install package ;)
 
@Riva Dumping the db in its decrypted state. Dumping your exe and reversing the logic is another. There are tons. And as @Squiggle points out, password lost is db lost.
 
@Riva consider which is more secure - an unwatched door with a padlock, or an open door with three security guards stood there at all times.
A distributable app is like a locked door; anyone can get in if they have enough time and a lockpick.
Client-server is like you have a software gatekeeper there. But security there is only as good as the doormen.
 
I see.
password lost is data lost - well thats always the case with protected .. anything, right ;)
@Squiggle Understood. Well the app has to be offline. I can't think of any much better solution.
 
@rlemon I'll take a look....
@rlemon Right now I'm trying to prepend an image to the front of the <a> and it isn't playing nice.
It modified my arrow into a square.
 $(this).css({ fontWeight: "bold" }).prepend("<span aria-hidden='true' class='icon icon-arrow-right2'>").append('</span>');
Any ideas why that won't add the image/
 
2:41 PM
@s.hemond you there?
 
@Greg well when you prepend it reads the string and makes a complete element
<a href="#"></a>
$('a').prepend('<span>');
<span></span><a href="#"></a>
you want .wrap
if I'm reading the code correctly
 
Instead of .prepend?
 
.prepend("<span aria-hidden='true' class='icon icon-arrow-right2'>").append('</span>');
what do you intend this to do?
wrap the a in a span?
 
@rlemon Yeah.
 
yea it won't
use jQuery.fn.wrap
 
2:43 PM
So .wrap?
 
yea
 
I need to make sure it actually puts them on the same line.
hmm.
 
check that
when you pass a string to $() it checks to see if it is an element. you don't have to close them either.
so prepend isn't going to work.
 
@rlemon Thanks, that is good to go off of.
@rlemon See here is the issue:
 
3:12 PM
you can fix that with css
white-space: nowrap;
on the span.
and make sure your a element isn't display: block;
@Greg
 
@rlemon I'll give that a whirl.
 
Hi greg
 
3:30 PM
@Greg talking to yourself again? @Greg lol
 
Apparently.
@Greg Hello.
 
Why do Java programmers wear glasses?
 
@triforceofcourage I know this one mmmmk.
 
-- Because they don't see sharp! (C#)
 
3:39 PM
Anyone have an example of taking a <a href> text and putting it in a h3?
Somewhere else on the page?
 
using jQuery still?
.detach() and .append()
var tmp = $a.detach();
// do something to it maybe?
newContainer.append(tmp);
ohh just the text... nvm
 
@rlemon What does that do ?
Yeah, I just want the text.
 
$('a').on('click', function( ) {
  $('#myH3').text(this.textContent);
});
something like this?
 
I tried that, didn't work...
Hm...
That did work
I had a typo when I tried it :(
 
lol
could be worse
 
3:43 PM
Hello,i have asp.net mvc5 application and i need to build search .Search is for dates in database,how can i compare it to string from search(string format yyyy-mm-dd hh:mm)
 
@pauliustack cast them both to DateTime and use DateTime.Compare()
@ton.yeung lol
 
@ton.yeung almost
@KoBE thanks
 
As someone who is new to architecture concepts, does code-first Entity Framework support the idea of Domain-Driven design?
 
@pauliustack Looking at your question now, maybe I read it wrong. Do you have two dates you are wanting to compare? Or you're wanting to query your data?
 
@ton.yeung Whereas database-first would support data-centric design. What would you say model-first supports? Perhaps a hybrid?
 
3:49 PM
@KoBE i want to query my data from database
 
@pauliustack Ok, depending on how you're querying your database, you could still use .Compare(). .Compare() returns an int, if the int == 0 then you know they are equal.
 
I did it in another way,is it good? DateTime date = Convert.ToDateTime(searchdate);
rides = rides.Where(r => r.DepTime == date);
 
Can I get some feedback, what would be the best approach to add a hover on / off div element?
One where it won't have the layout move and tweak itself.
 
@pauliustack That should work.
 
@ton.yeung Not a bad idea.
 
3:58 PM
@ton.yeung mongodb looks interesting. I've never toyed with the idea of a NoSQL db. Might be perfect for some of the small apps I develop.
 
I got a lot of mileage out of NodeJS (the .net interface). It is really slick when your data is boring, but the relationships are interesting
oops, mistyped. Neo4J
NoSQL database. very cool. It is a graph database
 
@ton.yeung Most of my projects have used SQL Server Compact Edition, and I've never used transactions. I'm thinking this may be perfect. Probably less dependencies for the client machine too.
 
quick question. I have a heterogenous list of objects, all derived from a common type. I need to sort it, but different objects in the tree need to have different sorting rules. The objects are standard roguelike object stuff. so,
for example, potions sort by name if known, by description otherwise. light sources sort by name, then by turns of light left. Weapons sort by name weapon type, then name, then attack/damage rating, but un-ided weapons sort by type only, and before id ones, etc. And all item first save by category. Clear as mud?
 
@rlemon You there?
 
I am struggling to figure out how to implement IComparable on this. Or do I need to hand sort stuff to handle this level of complexity
 
4:12 PM
What are you attempting to compare @DreadPiratePeter ?
 
it would be nice to have a virtual method that can walk down the tree comparing and short circuiting out when at the level it finds a difference
actually, I think I could write that, I may have just solved my own problem. Nothing like explaining a problem to someone else to clarify it in your own head
 
You should be able to implement IComprable with an assortment of filters for that.
The Microsoft Developer Network has a simple example, with that approach.
 
@ton.yeung I have not used mongo
If you are looking for a great overview of NoSQL databases try: [amazon.com/Seven-Databases-Weeks-Modern-Movement/dp/1934356921/…
"Seven Databases in Seven Weeks", six are NoSQl (other is postgres). A good overview on different types of databases and when you would use them
 
Using code-first EF, what would you classify as your data access layer? Once you create your classes and DbContext, does that classify as the DAL? Would you need classes that do things such as GetCarById() to classify as DAL, or would that be leaning towards a service layer (assuming you skip the repository and unit of work pattern)?
 
posted on July 21, 2014 by ericlippert

Continuing with my series of answers to questions that were asked during my webcast last week… Do the “checkers” (algorithms that find specific defect patterns) find defects in unit testing code? If you want them to, yes. First off, as … Continue reading →

 
4:22 PM
Fabulous!
 
@ton.yeung So your suggestion would be that after creating POCOs and a DbContext, you would need a layer on top of that to perform the actual CRUD operations?
@ton.yeung Nah, not yet.
@ton.yeung I'm only a few years into development (and a few months into enterprise development). Didn't start studying architecture until I recognized the need for it.
 
is it possible for an ajax call to not execute because the page redirect happened too fast?
 
@AmmarAhmed yep
 
what is the workaround for this?
 
if you are using jquery, you could wait for the ajax result to finish, like this:
$.get('url', data, function(response) {
window.location.href = 'redirecturl';
})
 
4:34 PM
It is as simple as ajax().done(window.location = "../Home"). I tried the .success() and it did not help
 
@ton.yeung Wasn't trying to suggest I don't need the book. I aim to buy it (reading through clean code atm).
 
@ton.yeung haha that is quick fix
@Rovak thanks man
 
you could make the ajax request synchronous which blocks the page for a few milliseconds
it works but i do not like that solution
 
@Greg am now
 
yeah it doesn't seem like the best way to fix this tbh. thx again
 
4:37 PM
@rlemon I've got this structure:
    <div class="Training-Container">
        <div class="Content-Summary"><%# Eval("ShortDescription") %><a href="#" class="Description-Expand">&nbsp; Show More...</a></div>
        <div class="Content-Description"><%# Eval("CourseDescription") %></div>
    </div>
 
as a js'er my eyes pop when I see 'eval'
 
eval
 
I'm trying to write jQuery now, that if I click .Description-Expand I want the next element, .Content-Description to animate / show. It doesn't want to do that.
 
Why would you write jQuery? It's already written.
 
@KendallFrey Because it is a long description, it should be hidden until you select Show More.
 
4:40 PM
$('.description-expand').click(function(){
$(this).next('.content-description').slideToggle()
});
 
$('.Description-Expand').on('click', function() {
  $(this.parentNode).next().fadeToggle();
});
please use .on over the alias methods
 
yep, forgot about that
 
.click has stupid overloads, and internally calls .on
 
@Greg My point is that jQuery isn't a language, so you can't write in it.
!!live
 
she isn't in the room
now she is
normally when I start her I hit 'rejoin all' and I have a handful stared
guess I forgot today
if she isn't you can bug @KendallFrey to summon her here
 
4:43 PM
or summon her yourself
 
isn't there permission restriction on summon?
(I assumed there was)
 
I assumed there wasn't
 
!!help
 
@rlemon Information on interacting with me can be found at this page
 
@ton.yeung try it, see what happens
 
4:44 PM
bot.addCommand( bot.CommunityCommand({
	name : 'summon',
	fun : summon,
	permissions : {
		del : 'NONE',
		use : 'OWNER'
	},
	description : 'Say boopidi bee and in the room I shall be. '+
		'`/summon roomid`'
}));
looks like owner only
 
welp
 
@ton.yeung do you have a reference for the "blue book"? not familiar with that nickname. curious as to what book you are referencing
 
I'll give that a whirl.
 
@ton.yeung Registered; need 1 more to execute
 
!!dog
 
4:46 PM
@Breems That didn't make much sense. Maybe you meant: doge
        wow
                          so @Breems
very  bot
             such  fail
                          much  haha
many  dog...
 
@rlemon @Rovak Yeah, it sisn't work. Hm.
 
(sorry other greg)
Rovak's wouldn't work iirc because .next doesn't jump parents
you need to explicitly move to the parent node first then call next
 
@rlemon Ah, makes sense.
Is there a way to make the second click hide if visible? Am I going to have to check is('visible') or something?
 
you can force states
1 sec I forget the api
 
Have you ever seen a UI that looks like someone put effort into making it look terrible?
 
4:55 PM
@Greg ahh yea, the API already does that
hence the toggle
or, what? maybe I'm not understanding the question
 
I wasn't requesting one...
 
@KendallFrey kendallfrey.com
 
i hate you with love
 
@rlemon After it shows it, then after you click it. It shows the text, if you click it again it hides.
 
@Greg yea, the fiddle I sent you does that ;)
 
4:58 PM
@rlemon It isn't working for me hm.
 
lol
Sometimes seeing chat flags can be amusing
 
@rlemon I know why
 
Other times it can be disturbing.
 
@TravisJ Who do you think flagged that? :P
 
being able to see who flagged what makes things more interesting
 
4:59 PM
@KendallFrey - Lol I am not entirely sure. Perhaps it was @zigi
 
ya think?
 

« first day (1374 days earlier)      last day (3575 days later) »