« first day (2843 days earlier)      last day (2109 days later) » 

4:08 AM
helllo please help
   var longs = this.DataList.Where(x => x.StockDataList.Where(y => y.STOCKNAME == stockName) && x.P2DataList.Where(z => z.STOCKNAME == stockName) && x.BarDataList.Where(a => a.STOCKNAME == stockName));
i want to filter 'DataList' and only grab values where each list's stockname == stockname
im biting more than i can chew
 
4:23 AM
 public List<Data> DataList = new List<Data>();

        public class Data
        {

            public List<StockDataTable> StockDataList { get; set; }

            public List<P2Table> P2DataList { get; set; }
            public List<BarTable> BarDataList { get; set; }

        }
 
idk C#
 
ah ok
 
@AdanRamirez So DataList is an multi dimensional array? And you want to find values of DataList where stockname = stockname?
 
yes
it's an object list of object lists
 
3 mins ago, by Adan Ramirez
ah ok
what about a for statement?
go through every object of DataList and if its value is stockname then set it to x
@AdanRamirez
 
4:30 AM
theres a better way
i just forgot
 
ik this is for JS but most languages are the same
60
A: Get values from an object in JavaScript

cfsTo access the properties of an object without knowing the names of those properties you can use a for ... in loop: for(key in data) { if(data.hasOwnProperty(key)) { var value = data[key]; //do something with value; } }

just different syntax
or maybe more like this?
27
A: Get values from an object in JavaScript

trincotIn ES2017 you can use Object.values(): Object.values(data) At the time of writing support is limited (FireFox and Chrome).All major browsers except IE support this now. In ES2015 you can use this: Object.keys(data).map(k => data[k])

 
nah those dont work
 
@AdanRamirez Can you tell me anything more about what you did to do it before? I'm a pretty decent lmgtfyer.
 
 
3 hours later…
7:17 AM
Good morning.
My computer is annoying me. Everything's CPU usage is up.
Visual Studio. Firefox. Chrome. Freaking process explorer.
 
8:04 AM
My CPU benchmarks are abyssmal. Something is rotten.
CPU temp seems to revolve around 70-73C. That seems too hot.
Perhaps my fans are the problem.
On the other hand, if hte CPU is constantly at 50%, it stands to reason it will run hot.
Cause/effect. Unclear.
 
8:22 AM
Intel's tuneup utility confirms that Thermal Throttling is on. This is annoying.
 
How can I upcast my Action<MyClass> (that implements IMyInterface) to Action<IMyInterface>? Safe cast gives me null
 
What happens if someone passes in MyOtherClass to your action?
Let's say, you have an Action<string> and you want to upcast it to Action<object> - what happens if someone passes in an int, which is a valid object but not a valid string?
You can't safely upcast it, which is why it doesn't let you upcast it. You can wrap it:
Action<IMyInterface> upcast = (IMyInterface obj) => { if (obj is MyClass) downcast(obj as MyClass) };
 
var longs = DataList.StockDataList.Where(x => x.STOCKNAME == stockName && x.OPENLOW - x.DIPLOW < x.PEAKHIGH - x.OPENHIGH).Select(x => Math.Abs(x.DIPLOW / x.OPENLOW - 1)).ToList();
where can i add 'orderby'?
i try to put it by replacing 'select' on (x => math.abs,....) but it doesent work
 
8:39 AM
Add it wherever you want. Ideally before ToList() fetches the data itself.
 
cant
 
If you're sorting by the result of the Select, naturally, put it after the Select.
I don't know what "doesn't work" means, or what "can't" means.
If there's an error, say what it is. If you can't do someting, say why. I can't guess what your problem is.
 
var longs = DataList.StockDataList.Where(x => x.STOCKNAME == stockName && x.OPENLOW - x.DIPLOW < x.PEAKHIGH - x.OPENHIGH).Select(x => Math.Abs(x.DIPLOW / x.OPENLOW - 1)).OrderBy().ToList();
'no overload takes 0 arguments'
 
Well, the error is pretty clear.
You're not sorting by anything.
 
yup
i replaced 'select' and it returns 'x list'
i replace 'where' and it sorts it by different parameters
not the values
 
8:42 AM
What did you expect it to return?
 
orderby of x=> math.abs(x.diplow,...
 
No, that's not a return value.
What should longs contain, in the end?
 
longs should be a list of values from the 'select'
then orderedBy
 
Right. You're taking a list of StockData and extracting a long from it, right?
 
8:44 AM
But if you don't have a SELECT, you're returning a list of StockDatas. Because nothing in what you're written tells it to return anything but StockDatas.
So you need the Select to project each StockData into the calculated values.
 
****
i see what you mean, the statement in the 'select' is wrong
 
it's not prejecting each stockdata into the calculated values
that's why orderby(x) isnt working
 
No, that's not it.
It's converting each StockData into a number calculated as the absolute value of DIPLOW/OPENLOW-1
 
               var longs = DataList.StockDataList.Where(x => x.STOCKNAME == stockName && x.OPENLOW - x.DIPLOW < x.PEAKHIGH - x.OPENHIGH).Select(x => Math.Abs(x.DIPLOW / x.OPENLOW - 1)).ToList();
this works, but the values are not ordered
 
8:46 AM
Right. That's how LINQ works. Each function is another step.
 
should i place orderby inside the select?
 
So now you have to add OrderBy after the Select, to return the list sorted.
 
i have no idea, i'd be a game of chairs
 
No, after. Each function is another step.
Think of it in logical steps:
 
but i get 'no overload takes 0 arguments'
i tried that already
 
8:47 AM
1. Take the list of StockDatas.
2. Filter our those that don't match the criteria.
3. From the filtered list, calculate the value.
4. For the calculated values, sort.
Yes, because you're simply not reading the error message.
 
yes im trying to do #4
 
What does "no overload takes 0 arguments" mean?
 
orderby(x => x)?
 
Try it. Does it work?
 
hmm not sure
50%
gime 1 sec
yes it works
@AvnerShahar-Kashtan thank you very much sir
 
8:57 AM
Errors like "no overload takes 0 arguments" mean you need to go to the method's documentation to see what parameters it expects.
List.Sort() takes no arguments and attempts to sort by the items' default sorting, but OrderBy doesn't, and requires you to specify the sort explicitly. It's clear to see when you check out the method signature and docs.
Sure, x => x seems a bit pointless, but it's clearly a subset of x => <whatever>, which is a common scenario.
 
yea
makes sense
 
Good morning all
My car didn't start this morning
 
@LeeButler Too hot for it?
 
It's raining like mad. Apparently the battery is flat. Which is interesting because it had >100mi range left yesterday, and as far as I know it hasn't taken itself for a wander
 
9:21 AM
What do you know. My laptop is one of the models that have overheating issues. Pissed off now.
 
What laptop?
Maybe you should have got the surface etc
 
Thinkpad X1 Carbon.
 
omg the huge bottom bezel
Otherwise, it looks decent but I would be surprised if it didn't have some sort of thermal related issues
 
9:48 AM
There were a couple of series that were affected by the design failure, between May and October 2017. Naturally, mine is one. :-\
Opened a service call now. Will wait for a tech to get back to me.
 
In laptop related news, Apple have fucked up
They released a patch for the new Macbooks and their serious thermal throttling issues to calm the power management system whioch was going a bit crazy. This improved performance in most video production software. Except Apple's own Final Cut Pro, which now actually performs worse
 
Everybody hates the new Macbooks, huh? The touch-bar, the keyboard, the CPU throttling. Seems like they've got a really bad batch of computers.
 
They keyboards have been bad for a few years
People would be less angry if they weren't suggesting the (largely underpowered) systems with stupid features like the touch bar weren't targeted at professionals
 
Ok, Lenovo service got back to me. Seems the fix is simple - either fasten the unruly screw that's messing up the battery, or (if it's already damaged the battery), replacing the battery. Free, of course, since it's a recall. Means there's no need to back up everything.
Problem is, because I bought it in the US, my warranty doesn't include client-site support, so I have to drive over to their lab to fix it.
 
Are you sending it back to them, because if you are I'd backup anyway
 
10:00 AM
Not too far.
I'm going to their lab, gonna sit there until they fix it (which should take, barring waiting for other repairs, 1.7 minutes).
I'm going to make sure my documents are synced to Dropbox and my code is all pushed to the git origin, and that's basically all I care about.
 
I don't have many important documents when I'm not at work, so if I have issues I can usually survive because everything is in the cloud somewhere
I'm spending today doing the great documentation
IE Documenting everything in active projects which isn't documented (read; almost everything)
 
10:21 AM
ooo activity
 
No it's sunday, there's no activity
 
"Activity" here was mostly me ranting by myself for a couple of hours.
Then other people popped up with their dead cars and bad laptop keyboard and Linq queries.
 
bad laptop keyboards?
qwertb?
azertp?
 
Macbook
Hmpf. I'm resizing a window using UI Automation, but it seems like Window insists on keeping a couple of pixels from me.
 
10:37 AM
Windows 10?
 
Yeah.
I have a 1920x1080 display. Working area is 1920x1040 (because of the taskbar). I give this value to the Resize operation, and it comes out as 1029 pixels, not 1040.
 
I've noticed there's a bug where the "bounds" of the window are slightly further out than the real edge. Imagine if the window had the border that Windows 7/8 had around the edge
DWM still things the border is that big, just with a single pixel width drawn and the rest empty.
I'm not sure it applies to maximised windows though
 
That might be it. There an invisible 11-pixel border around my window.
I can't maximize, unfortunately.
 
11px sounds about right
 
(I simplified matters - it's not 1920x1080, it's 3 monitors in a row, and I'm "maximizing" to 5760x1040)
 
10:39 AM
Try resizing your application's canvas instead of the window
Wait I didn't realise you weren't on about your window
 
on a side note, someone dropped this in the Jaba room, but since it is the same in C-harp, I'll just drop this here
 
I have to do it externally - UWP doesn't give you the option of determining the Window's size or position, so I have to pass the window handle to an external process and do it there.
 
here is a fiddle with the C-harp code
 
@Wietlol Yeah that sounds about right. "Character" is a simply concept when you're doing ASCII-compatible Latin characters only.
@LeeButler I'm getting 11 lost pixels vertically, and 22 horizontally - 11 from each end. Strange that it does reposition properly to the top.
 
The top border hasn't changed, thats why
 
10:43 AM
I'm trying to reposition to X:-11, Y:0, Width:totalWidth+22, Height:totalHeight+11.
Let's see how it works.
Yes, I know it's a fragile hack. Just checking if it's even possible.
 
It's fragile but it should work. I think they left it for compatibility reasons, because if the bounds changed, windows that looked right in 7 & 8 would look weird in 10
 
Hmm. Seems to work. Now let's see if I can get the invisible border size from a system setting somewhere, instead of hardcoding it.
Computer\HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics doesn't seem to contain the "11" value I'm looking for.
 
You might have to do some weird API hacks to work it out
Possibly compare the results of GetClientRect and GetWindowRect
Both User32 functions
 
11:00 AM
how do i 'min' again?
filteredList.Min()
i get the minimum of the list, how do i get the second minimum?
filteredList.Min(1)?
 
filteredList.OrderBy(...).Skip(1).First()
@LeeButler I'm checking out System.Windows.Forms.VisualStyle.VisualStyleInformation. If that doesn't pan out, I'll try the Win32 calls. I have plenty of those already in this class.
 
is firstordefault better in this situation?
 
> System.Windows.Forms
shudder
 
would skip(0) not skip anything?
 
@AdanRamirez If you don't necessarily have any items, yes.
 
11:02 AM
because the code is under a for loop
was thinking of skip(i)
 
@AdanRamirez Probably.
 
thanks :D
 
In fairness, that's a bit hypocritical of me to say
All of the ones with a red line use winforms libraries in some way
 
11:16 AM
yay back from lunch... but for me it was breakfast
 
I wish I could go out for lunch. My car didn't start so I got dropped off
 
@AvnerShahar-Kashtan C# and Jaba use UTF-16 though
 
Holy fuck there is some seriously bad code here
 
I think you could easily solve the problem though
Java solved the problem internally in Java8
they didnt change the api though
so for the time being, you still have to build your own wrapper or write this manually
 
@LeeButler System.Windows.Forms.Screen.AllScreens remains the best API to get information on number and size of screens, unfortunately. :-\
 
11:19 AM
You could always just call windows APIs yourself
But I'm not sure if that's worse
 
It's mainly a lot more work.
 
@LeeButler what are all of those?
 
GetWindowPlacement for the DesktopWindow gives me the full 5760x1080 size without any padding.
 
to me, it looks like a collection of random programming-related words
 
@Wietlol They're all active projects which depend on the "Framework" project, which I'm currently refactoring
That project contains the first 2 years of me learning how to code in an Object oriented way. As a result, it's full of a lot of undocumented and horrific code
It's also incredibly business critical, but it also performs like crap
 
11:26 AM
It's good that it performs like crap.
That gives you a legitimate business reason to rework it.
 
I know. I started working on improving our main inventory control software last week while waiting for somebody to do something, optimised a few bits here and there and knocked out most of the delays, and did 50%+ performance improvements across the board
Some areas got improvements up to 95%
There's a lot of poorly written code still in there, but I couldn't find a way of making it better, so some parts of the application I'm gonna have to start new, but I've been having so much fun doing it
Mainly laughing at my own old idiocy
 
@LeeButler GetClientRect vs. GetWindowRect gives me a 33/39 pixel difference in width/height. Not what I'm looking for.
 
Like for instance, I've just found a notificon in the framework library which fires up every time somebody uses a skucollection (an essential feature of out system) and doesn't even show up
Skucollections are used a lot, and in some instances hundreds of times per seconf
 
11:43 AM
> //Do not run this on the main thread. It is only public for testing purposes
lol
 
11:56 AM
var left = leftScreen.Left - Windows10InvisibleBorderSize;
var top = leftScreen.Top;
var width = rightScreen.Right - leftScreen.Left + Windows10InvisibleBorderSize * 2;
var height = rightScreen.Bottom - leftScreen.Top + Windows10InvisibleBorderSize;
Not proud of that.
 
12:38 PM
what if it is not windows 10?
 
12:53 PM
Then the borders are fine anyway
ANyone here used sandcastle?
 
 
2 hours later…
3:16 PM
> //09/02/2016 - Temporarily use <pemission> until the real one is ready
"Temporarily"
 
4:08 PM
everything in computer science is temporary
it sometimes just takes a few decades until we find out we did it wrong all this time
then it will take a few more decades to actually completely fix it
 
4:54 PM
@Wietlol Windows 10 Fall Creator's Update is our minimum OS requirement.
 
 
4 hours later…
8:51 PM
Why C# interactive window prints: 0.20000000000000018 for 4.2%1,
while console window prints just 0.2
?
And both are of type double
 
9:42 PM
because reasons?
 

« first day (2843 days earlier)      last day (2109 days later) »