« first day (2140 days earlier)      last day (2802 days later) » 

3:02 PM
Hi
 
whole enum
 
I would find attribute value of XElement by binary search. But I don't know how implement binary search on attribute name value on List<XElement> sorted by attribute value. gist.github.com/Kyochi/6dd8de17dd6975d7e1e3a5e1b9c3c377
Anyone can help me ?
 
3:28 PM
why binary search?
using System.Xml.XPath;
...
var match = doc.XPathEvaluate("//*[name='CJ10080T']");
or something
 
Is it ok to post a link for a Telegram .NET group here? I'd like more people to participate it, but I don't know other places where .NET programmers hang around...
 
Telegram?
where are you based, @WashingtonA.Ramos?
 
Yes, the messaging service...
@Squiggle, I'm from Brazil, but the group got people from Europe, India...
 
oh that Twitter thing
eh. Not sure why that would be an good platform for C# chat. I generally just loiter here and go to local usergroups.
 
It's actually closer to WhatsApp, LINE, etc
 
3:35 PM
yeah
doesn't sound like a platform I would use for that purpose
 
Thank you anyway, I guess :^)
 
sorry :-/
 
A SQL Server question: if you've truncated all tables that are in FK relationship, why would you still get this from the parent table when trying to truncate? Cannot truncate table 'TableName' because it is being referenced by a FOREIGN KEY constraint.
 
....because it's being referenced by a foreign key constraint?
It's not about the data
 
Never mind... when the parent has any FK's defined on it, it won't allow truncate, even if children are empty
@mikeTheLiar You're right
 
3:50 PM
delete from Table
I know I'm right
 
I kept thinking it was about the data
:)
 
Squiggle if I have few thousand of "XElement", is "XPath" has performance good ?
 
are you sure, @Alex?
 
Well, according to this: stackoverflow.com/questions/253849/…
 
@Neyoh it's far more performant than anything you're likely to write yourself
 
3:52 PM
Got around the issue using this cheat, which is NOT good on production system; creates a transaction for each delete...
DELETE FROM TABLENAME
DBCC CHECKIDENT ('DATABASENAME.dbo.TABLENAME',RESEED, 0)
 
@Alex ah, fair enough. Yeah - when you script stuff in SQL Server it drops the constraint, truncates, then recreates the constraint again.
 
Needed the IDENTITY column reset
 
I've never seen reseeding done IRL
 
Yeah, new to me :)
But I kept thinking the constraint had to do with data. So if you cleared the children, then you could easily truncate the parent.
Nope
Lesson learned!
 
@Squiggle Ok I trust you
 
3:58 PM
@Neyoh also it's really easy to maintain
and super-simple to cod
 
War
@KalaJ so you want to bind a field to multiple values
I think the only answer to that is more cowbell
omfg
let the rant continue
 
ah there you are @JonButler
it's easier to use pastebin.com to post code.
@JonButler is see your code, if i were you i'd change the types for any of your variables used in the calculations to decimal.
1325
Q: Difference between decimal, float and double in .NET?

TomWhat is the difference between decimal, float and double in .NET? When would someone use one of these?

 
4:25 PM
@Squiggle I tried for 355 string item searched in 5000 XElement attribute by name, this is instantaneous. And is so easy to code, I had forgotten the XPath query method. Thanks
 
5:10 PM
jfc look what I found
myDecimal = (decimal)0d;
 
I have a web question :S
I have a dropdownlist and I am removing and add a class based on a bool... I'm adding/removing a hidden class
But the strange thing is, the display: none or hidden property is displayed for a native dropdownlist
and not the dropdownlist I created
So there ends up being two dropdown lists
 
5:32 PM
Whelp a PSA for everyone, the SO Python chat room is apparently toxic. They are a special blend of unhelpful and condescending.
 
wow that's news to me
 
user5671675
5:59 PM
hello, is there someone who could help me with ASP.NET Core Identity ? I'm using basic template for testing project with login/password (code first db) after I've run migrations basic db was created with tables. Next I've added some model classes with and DBsets in DbContext for updating DB. One of table will hold AspNetUser ID but how can I code relations between AspNetUser and model class ?
 
@mikeTheLiar why? what happened?
@TravisJ, I have a noob .net mvc question
 
6:18 PM
0
Q: Show or hide the razor dropdownlist depending on conditional

Kala JI have this change function that removes or adds the hidden class to a razor dropdownlist. This checks if a value in one of the dropdowns is that string, then on change, either remove or add the class based on that selection. $('#PType').change(function () { if($('#PType').val() == ...

 
@KalaJ - Can you show the rendered <select> element from your razor call?
 
What do you mean? sorry
Haven't done web in a while
Do you mean what the select element property is?
One thing I noticed however is that on page load, the elements are shown and not hidden
even though I set them as hidden
and the change event does not even work
for that specific dropdown
 
@KalaJ tl;dr I have a weird Python problem that doesn't make sense. Asked for help and got derision and condescending attitude instead (and kick-muted for my trouble).
Although to be honest the kick probably was a good idea because I was pretty frustrated at that point.
Doesn't change the fact that they treated me worse that we treated Mr. Toxy
 
6:36 PM
@KalaJ - So.. using a razor helper will make a call to produce a string. That string is the drop down in your case. And then the entire view composed string is written to the response and that is what the browser gets as the response. The browser then takes the markup and renders it into a webpage. ta daaa. The rendered page has all of the html elements on it in the DOM, and if you inspect the dropdown element in the rendered page you can then look at the rendered html from your razor call.
 
@KalaJ have you tried using $(this).val() instead of $("#PType')
I'm wondering if Javascript isn't picking up the latest value as your'e still on the leave event.

so:
$('#PType').change(function () {
        if($(this).val() == "Locked")
        {
 
@RyanTernier - That wont diff tho
 
Having some minor issues with chrome dev tools, getting firebug to debug now lol
 
?
 
so that I can step through the js
chrome is being mean :(
 
6:44 PM
it might not be executing that part of the js?
 
you don't need to step thru the js
 
Travis I have a question
I have the change event inside
(function() {
$(document)
.ready(function() {} These tags
 
okay, so, the reason I asked you this is to help you in the future
 
When the document loads, when I select the dropdown again to get the Locked value from the dropdown
 
If you had looked at your rendered element you would notice that the id is incorrect
 
6:44 PM
and the change event is never hit/called
 
you would see <select id="PIDs">
And that isn't what your jquery is targeting
As your jquery is linked to id=PType
 
wait let me check hmmm
select is PIds
from inspect element
 
Isn't that where you tried to attach your change event?
Or do you have a separate select element as well?
 
Oh travis sorry, I think I might have confused you or anyone else
There are two dropdownlists
 
Ah, is the other one properly id'd?
 
6:48 PM
1) PType is the conditional dropdownlist
It's the one I want to apply the change event on
e.g. on selection changed
 
are there errors in your console?
@KalaJ - Are you sure the value is "Locked" and not the text?
<option value="1">Locked</option>
<option value="Locked">Locked</option>
is it the first or second version?
@KalaJ - I was unable to reproduce your problem: dotnetfiddle.net/FQNWSl
It must be with the html render.
 
7:04 PM
One sec, I'll give it a try, sorry for the delay.
Thanks for your help
I remember the value is locked
because I did that check id.val() inside console
and it gave me Locked
 
ah
I found it
 
hm?
 
@KalaJ - Your call to the razor helper is incorrect I believe. It is producing <select htmlattributes="{ multiple = True, data_placeholder = Select PIds, id = PIds, class = form-control hidden }" id="PIds" name="PIds"> because you use , new { htmlAttributes = new { @multiple = true, @data_placeholder = "Select PIds", @id = "PIds", @class = "form-control hidden"}}
but the first new is erroneous and should simply be , htmlAttributes = new { @multiple = true, @data_placeholder = "Select PIds", @id = "PIds", @class = "form-control hidden"}
 
Btw, why is Locked (real) generating another box?
 
oh, hm, maybe that isn't entirely accurate
the overloads are funky though
@KalaJ - The locked (real) was to show that the value is separated there from the text
@KalaJ - And it isn't generating another box, that is the result of your code removing the hidden class
 
7:11 PM
oh opps you're right
lol
Is it to do with the overloads?
should I try to remove new?
 
I tried that but it didn't use the right overload
ah, ok
So htmlAttributes is an optional parameter in the overload and you need to specify that with the : syntax
@Html.DropDownList("PIds", PIds, htmlAttributes : new { @multiple = true, @data_placeholder = "Select PIds", @id = "PIds", @class = "form-control hidden"})
@KalaJ ^
 
so I don't need the new
 
To use the optional parameter you need a :, there was an extra new you were using. This should properly produce the dropdown.
 
user47589
o/
 
user47589
mirror mirror on the wall, who's the poniest of them all?
 
7:19 PM
I am neither mirror nor wall.
can has wave tho o/
 
^-- poniest.
 
user47589
thank you mirror
 
user47589
tosses a quarter into @MichaelEdenfield's hat
 
@KalaJ - Did that have any impact? Or are you still having the same issue?
 
one sec, running it now
I'm worried because it's not just that issue but it seems like the change event doesn't work :S
Is it because the change event is on document ready?
The reason I saw that weird double dropdownlist addition and now it works is because I manually changed the .hidden class in the inspector window
I toggled it on and off and it showed me double
When I toggle PType, nothing happens in itself
 
7:26 PM
"showed me double"? Do you have two elements of the same id?
 
no I don't
at least I shouldn't
that's why I was confused
But one of the dropdownlists is a native dropdown
and not the dropdown I want it applied to
Maybe I should just start from scratch LOL
and someone tell me the best approach to hide and show a field on selection of another dropdown?
 
console.log($("[id=PIds]").length);
console.log($("[id=PType]").length);
do you get 1 1?
 
The html attribute change you told me to do broke my dropdownlist?
Now it doesn't show up
SyntaxError: missing ; before statement
when I try your console.log
lol the dropdown I want this to be applied to is called "FType_chosen"?
why?
I think I found my issue
testing now
Looks like it was a jquery thing
It appends _chosen to the end of the id name
 
8:22 PM
I'm using Entity Framework 6 and wondering if the following LINQ query can be made case insensitive. In other words, the searchValue will be compared to the string on the database without caring if it's upper/lower. So the user can search on 'joe' and get back 'Joe'
var paramEmployee = Expression.Parameter(typeof(Employee), "e");

var comparison = Expression.Lambda<Func<Employee, bool>>(
	Expression.Equal(
		Expression.Property(paramEmployee, selectedColumn),
		Expression.Constant(searchValue)),
		paramEmployee).Compile();

using (var context = new MyEntities())
{
	var query = (from e in context.Employees
		.Where(comparison)
		select new EmployeeViewModel
		{
			// Set the VM fields with data from EF fields
		}
});
 
9:01 PM
Anyone have a second to explain a simple problem i have? :)

I have to configure a custom DbContext class that takes a connection string build using user secrets.
If i make the constructor take DbContextOptions<TContext> i cant do migrations due to the context class not having a parameterless constructor.

Cananoy point me in a direction? :)
 
@KalaJ - eww, library with side effects
@Alex - Use tolower on the search term and on the field in the db and compare there then use the actual db field in the result
@Frey - That seems rather custom
 
@TravisJ All i am trying to do is to add a dbContext to a empty project... I am prety used to MVC, but i have always used projects with EF identy enabled in the past.
@TravisJ If i add a empty constructor no provider would have been configured..
 
@TravisJ Sorry travis, actually that's not it
I ran the code snippet I have in console with alerts and it works fine
I think it's the placement in my js script tag?
like as a standalone script, it works
 
@KalaJ - You are wrapping it in document.ready so there should be no issues, unless that part of the view is loaded from an ajax call.
 
9:16 PM
What if that's the case?
I think that might be the case
 
hmmm
have you guys ever used kernell
WriteProcessMemory
?
because i've got some question
why writting over than 255
to an address it kind of spoils variable
(depending on what it is)
ohh su much help
so much comprehension
 
10:30 PM
C# Linq: Does the .Take() permanently take away the items from the list?
 
No, take returns an IEnumerable that will only choose the amount indicated
 
@wafers Nothing in LINQ affects the original list
 
(AddRange)
 
I asked aquestion yesterday, stackoverflow.com/questions/39119720/… .... the solution is not working accurately
...It skips the 10 items, in the next iteration from the original list
 
@TravisJ I did say LINQ, didn't I? Yes, I did, it's right there.
 
10:38 PM
... if I don't use the solution and only use... Rows = _Buffer.Where(x => x.TimeInSec >= StartTime && x.TimeInSec <= EndTime).ToList(); then the _Buffer works as expected
 
@KendallFrey - Close enough
 
no such thing. this is programming
 
c# Linq: when I use .Take(5), has the pointer also moved 5 items forward, in order to read the 2nd item, is there any way to get back?
 
No there is no "pointer" per say after the take call, you are building a pattern to use when iterating
@KendallFrey - What is your definition of linq?
 
@TravisJ Mainly the extension methods in System.Linq.Enumerable and System.Linq.Queryable. Certainly nothing outside of System.Linq.
 
10:46 PM
IEnumerable<T> is not in the linq namespace
Does that make it not linq?
@wafers - Option 2 seems to work fine to me from the answer on your question.
 
Why would IEnumerable<T> be LINQ? I'm pretty sure it existed before LINQ.
 
@TravisJ yep it works for one iteration, and then it skips 10 values
 
@wafers - Can you expand on how you are iterating over that code?
 
@GrantHill - To say they are tightly coupled would be an understatement.
 
10:54 PM
@TravisJ I have two data files, one contains times (start time and end time) the other one contains data and timestamps... using the first file, slicing the data from the second file. BUT, I need to get 10 more rows where the "where" condition meets
@TravisJ ... for the two iterations it somehow works, then it skips 10 rows for the rest of the iterations...
 
@mikeTheLiar - No warning?
@mikeTheLiar - That is insanity.
Wow.
@mikeTheLiar - They, uh, didn't realize how dangerous that is in their post.
 
11:13 PM
@TravisJ it makes it more exciting that way
But yeah the potential for shenanigans is pretty high
 
@mikeTheLiar - It is intense! Omg so bad.
 
@TravisJ I am waiting for your reply :-)
 
@wafers - bigger fish to fry :P
 
noticed
 
@TravisJ Of course.
@TravisJ IEnumerable isn't coupled to LINQ in any way. The dependency is only one-way.
 
11:21 PM
Good luck with that :)
@wafers - It is hard without a full example to determine the nuance of the situation you are describing.
 
@TravisJ yeah I understand, if you want I can share the data files with you, but I don't wanna push this much.... however, is there any alternative for that solution:Option2
 
It should work, perhaps try using a ToList() on it to ensure that you do not get overlapping sets?
 
yep, did try! but thanks Travis!
 
11:38 PM
@mikeTheLiar - Hopefully that site didn't steal any information from anyone clicking that link.
 
user6438653
Who here is on windows?
 
me
 
user6438653
cool.
 
user6438653
Um in task manager
 
user6438653
the system interrupts "process"
 
user6438653
11:43 PM
What is it averaging on your pc?
 
user6438653
I have read that it's meant to be quite low, like 1.5% CPU.
 
user6438653
But mines about 27%
 
36%
But then again, I have like 11 open windows, and 6 open Chrome tabs
 
user6438653
The other processes don't really effect it.
 
user6438653
It's to do with hardware.
 
user6438653
11:49 PM
I read that if it's over 10% a piece of hardware is failing. Dangit.
 
Oh, A specific process you mean?
 
user6438653
Yeah System interrupts.
 
~0.5% or so
Between 0.2 and 0.7
 
user6438653
Shite my pc must have some problems
 
lel rip
 
user6438653
11:51 PM
it's at 30%
 
@shad0wk - It is probably compiling a windows update
 
user6438653
@TravisJ it's been around 30% for a while now.
 
user6438653
Like the last few months
 
wow
and which process is using that much?
 
user6438653
But when i restart me pc, it's a 0%?!?!?!?!
 
user6438653
11:52 PM
System interrupts
 
user6438653
It's not really a process.
 
user6438653
It's to do with hardware.
 
What is the "Image Name"?
 
user6438653
System interrupts
 
user6438653
You can't open file location.
 
11:54 PM
I see
Apparently that is from an incompatible driver
 
user6438653
I think i may have a harware problem.
 
@TravisJ maybe SO should fix their links
 
@mikeTheLiar - They are "working on it"
@mikeTheLiar - I am not clicking anything in chat anymore for a while lol
 
Six to eight weeks
 
11:57 PM
haha
@shad0wk - Are you on a laptop?
 
user6438653
@TravisJ yep.
 
@shad0wk - Apparently a bad battery can cause the system to excessively poll for information.
I have to go tho, its 5.
o/
 
user6438653
Bye.
 
user6438653
\o
 
user6438653
Hmmmm......
 

« first day (2140 days earlier)      last day (2802 days later) »