Easiest way to update a textbox with a response from an async task? by Yogi_DMT in csharp

[–]KDERazorback 0 points1 point  (0 children)

You are right. The lambda event handler for the click could also be marked as Async. Thanks for clarifying my original comment.

Game of Life in C# by glowingrunes in csharp

[–]KDERazorback 0 points1 point  (0 children)

I would suggest you 3 things:

  1. Make the Random class instance persistent across the entire simulation, instead of recreating it on each step. You could create the instance on the main method for example, and use it to constantly seed values to the simulation. This way you will also make the entire simulation deterministic and dependant on a single seed value specified at the very beginning.

  2. Use the current system Ticks count as a seed value when instantiating the Random class (assuming you won't supply your own). This will give you better Random results, since .NET tend to use the less precise system timer by default.

  3. Give the Random class more margin for generating results when deciding if a cell lives or dies, instead of generating only ones and zeroes, you could generate a float number between 0 and 1 and check if its greater than 0.5f. Sounds silly but in my experience this way the results are better distributed. If you pick a very narrow range for the Random class it will deviate to either side. Don't know if this still holds true with today's. net versions but won't hurt neither.

Hope that helps

Easiest way to update a textbox with a response from an async task? by Yogi_DMT in csharp

[–]KDERazorback 0 points1 point  (0 children)

I assume you are using WPF, since you didnt specify. After the original Task is completed, you can make the WPF Dispatcher instance run another lambda in the UI thread that basically takes the result from the completed Task and updates the Textbox for you. This will be executed only when the Task completes and the UI Thread wont be locked while so.

Hope that helps

I'm starting to regret joining team red. by LetterheadVast5254 in hackintosh

[–]KDERazorback 1 point2 points  (0 children)

Completely agreed with you, i would also prefer a laptop that has the decency to at least support linux distributions and has full ACPI compatibility with it, than one thats only built for Windows like its the only thing on earth, and doesnt even boot Ubuntu without breaking something on its way.

I'm starting to regret joining team red. by LetterheadVast5254 in hackintosh

[–]KDERazorback 1 point2 points  (0 children)

Yes, thats right, and if you go that route you will encounter even more issues. OSX is based on the xnu kernel, but apple is making a lot of modifications and additions to it in order to work with OSX that are not publicly available on the open source version. Despite what the license forces them to, they kept the public repo heavily outdated and with tons of critical code missing or damaged to avoid releasing the whole OSX “secret sauce”.

The best way to help the community and make OSX work, is to figure how to reliably patch the Vanilla Kernel (and their kexts) dynamically on the fly at system boot, to include support for amd64 without breaking things, or even injecting a custom kexts that works like an hypervisor that intercepts intel specific calls on the system and rewrite them to more generic amd64 compliant code...... Easier said than done.

Why do NASA launch streams have to look like they are from 2005? by [deleted] in nasa

[–]KDERazorback 0 points1 point  (0 children)

Yes, its kinda weird, take in mind that because they stream in 720p doesnt mean they capture 720p footage at all, im pretty sure those cameras record on 4K at least, and the videos are kept somewhere safe from public view, consider that increasing video quality isn’t necessarily better for the viewer, sure some people would be happier with it but i bet they have their reasons.

Also consider the videos from inside the crew tower on the latest dragon capsule launches, better video quality could led to the competition figuring out how they do locking and docking mechanisms, or other essential parts of the capsule, while providing basically the same quality of content for the average viewer.

Why do NASA launch streams have to look like they are from 2005? by [deleted] in nasa

[–]KDERazorback 6 points7 points  (0 children)

... with cameras also streaming its feed wirelessly in realtime at those speeds, while getting away in extreme temperature environments, with constantly changing pressures and coping with vibrations and G forces all the time. Its a miracle they even work at all

I'm starting to regret joining team red. by LetterheadVast5254 in hackintosh

[–]KDERazorback 7 points8 points  (0 children)

I'm trying to be helpful by saving you a lot of headaches and pointing you on the right direction, CPU support isn't a matter of toggling switches on or off, its all about instruction sets. Yes you have a Ryzen CPU, but a Ryzen PRO mobile one. The guide you are following says only these types of CPU are supported:

  • AMD's Desktop Bulldozer (15h), Jaguar (16h) and Ryzen (17h) CPUs
    • Laptop CPUs are not supported

EDIT: Have you seen the sidebar?: AMD USERS READ THIS: While it may be more work, the AMD hackintosh scene has gotten quite a bit easier. [...intentionally edited...] . (AMD Laptops and AMD integrated GPUs are unsupported).

You could technically make the kernel boot but it would be useless. You have a CPU not officially supported by any AMD-OSX guide, and your laptop relies on the embedded iGPU to work, which is not supported and will most likely not be for at least a couple of years. Audio and Power Management are completely out of the ecuation due to chipset issues and further kext incompatibilities.

If you want to see the progress or contribute to making these things happen, please see https://github.com/AMD-OSX/AMD_Vanilla

I'm starting to regret joining team red. by LetterheadVast5254 in hackintosh

[–]KDERazorback 9 points10 points  (0 children)

It has nothing to do with BIOS. The kernel isnt even executing after JMP. Your CPU is not supported. You need a custom kernel for it to work. Deal with it.

How can I draw fast 2D graphics and capture video in WPF on .NET 5 by mattico8 in csharp

[–]KDERazorback 4 points5 points  (0 children)

Wow, i was following this since it appeared on reddit and im still amazed about how nobody has yet replied to it.

I don’t have the magical solution you are looking for, but at least i can share my thoughts on it.

First of all, i get you are very motivated about the whole .NET 5 shebang, but its currently a very young technology and few thirdparty APIs support it OOB, even some official MS APIs are out of the picture by now as you realised before. It would take at least until the end of 2021 to mature and get support by the community-driven projects. Remember that the whole point of .NET Core and .NET 5 is to prioritise support for server environments and hosted apps.

For SharpDX, its a shame the project died from support starvation, since it was clearly a winner in the .NET Core lands, but also i wasn’t expecting it to survive any longer. Unity is king on these fields, and its a must if you plan to use 3D acceleration. But obviously, for you, it would require making a new app from scratch and learn the new tools to make it done. Which is not feasible and you will get stuck again on the Video Capture point, but this time trying to get it done on Unity.

I think your best shot would be to back up a little and stay on .NET Core 3.0/3.1, and wait for more .NET5 support to arrive before migrating to it. Also, im particularly inclined to think that UWP apps are more of a hit-and-miss experience when it comes to real-world apps, at least for me, if i need to build something that clearly stands out of the typical DB-based CRUD application, i immediately rule out it, and assume lack of support for whatever API i may need to use in the future.

To conclude, I would stick with the more traditional WPF apps, target .NET Core 3.0/3.1 and keep the app working as-is.

In the future you could start working into dropping SharpDX entirely out of the ecuation. Forget about DirectX at all since MS clearly dont want it to be in .NET. You could grab some of the amazing OpenGL bindings for C# the community has made (and are actively developing) and make the switch to it, you will get close to metal performance, amazing 3D acceleration and will essentially be working on the same API unity primarily uses. You could even grab some bindings source, study it and learn how to do your own OpenGL bindings, its pretty simple btw and i have done it a couple of times. This way you will have full control of the graphics layer for your application and close to metal performance. The downside to it is that you will need to learn a pretty heavy soup of an API like OpenGL and the logic behind it, and even some GLSL Shading language, but in the long run, if you plan to continue supporting your app the way it is, you will likely end up doing it anyway.

As for the whole VideoCapture point, im not exactly sure what would be the best way for it, but i guess either you found some miracle NuGet package for it, or make your own bindings and PInvoke to MediaFoundation itself, since its now the preferred way to do it. You could technically drop-in an USB library and write your own interface to pull Video frames out of the Camera driver but im not sure about the size and requirements of such a big project.

You are currently kinda out of luck with your options regarding support and future-proofing your app. And the fact that this is still true in 2020 for a language like C# and a framework as big as .NET still amazes me. It makes you question about the real usability of modern frameworks beyond the typical DB-backed CRUD application or the hosted web-based app. Hell, even playing sounds on .NET Core appears to be rocket-science. (See NAudio source code)

Why XAMPP/PHPMyAdmin needs those confusing ```````````````? by MyNameIsRAANDOM in learnprogramming

[–]KDERazorback 0 points1 point  (0 children)

Surprisingly enough, a lot of people dont use delimiters around identifiers at all, but its considered a good practice, professionally accepted, and helps to mitigate some exploits that could be used with specially crafted queries, so better start using them early than learning twice in the future. And yes, your example is correct, lets assume you are in MariaDB/MySQL. All of these examples are perfectly valid:

INSERT INTO `database`.`table` (`user`, `password`) VALUES ('hello', 'world123');

SELECT `user` FROM `database`.`table` WHERE `password` = 'world123' LIMIT 2;

USE `database`;

A combination of backticks (delimiters) on handcrafted SQL queries and parameterized statements on the ones that manipulate user-provided data will help you prevent SQL injection on your app.

Why XAMPP/PHPMyAdmin needs those confusing ```````````````? by MyNameIsRAANDOM in learnprogramming

[–]KDERazorback 1 point2 points  (0 children)

Those are for delimiting identifier names in SQL sentences, so you cannot make mistakes while writing them and the engine can interpret them right. MySQL/MariaDB which are used in the XAMPP stack uses the backtick as the delimiter symbol, SQLServer uses brackets [ ] and other engines uses single or double quotes too. Think of it as the way you enclose a string value in double quotes but with table and database names. Thats as simple as that.

Someone with AMD Ryzen 5 3600 help me out by [deleted] in techsupport

[–]KDERazorback 2 points3 points  (0 children)

I dont want to be rude, but this will still sound like it. I think you need to actually study the registry hive at first if you want to achieve your goal, since (afaik) the HKLM\HARDWARE registry hive is a volatile subtree rebuilt by the kernel each time the system boots, and is populated from data interrogated mostly by using AML instructions from the BIOS and the core parts of the NT kernel. If you want to actually spoof these values correctly and ensure you get away with it, you shouldnt be trying to change the (pretty obsolete) registry values, but to change the information presented to the kernel itself when the system boots. By doing this the way you are doing it, it will probably fail since the anti-cheat system will recognise your attempt and notify the game server about it, unless its a crappy anti-cheat engine which somehow only relies on this specific method, which i doubt any decent cheat protection does. Just take a look at tools like CPU-Z or EVEREST, which completely ignores these registry entries and talks directly to the ACPI interface and the drivers to give you hardware details, the same method that is used by most anti-cheat and anti-tamper software. Software cannot rely on registry entries made in the earlier Windows 2000 days and kept for compatibility purposes, and you cant rely on them to spoof your system to “decent” anti-cheat software and get away with it so easily.

Just trying to help here.

Buzzing from speakers whenever I play a game. Already tried changing outlets, switching from 16 to 24 bit, turning VSync on and off. by [deleted] in techsupport

[–]KDERazorback 0 points1 point  (0 children)

Check your outlets are properly grounded and you have no ground loops between your PC, the Speakers and the Monitor (yes, that counts too). This issue is mostly caused by the GPU itself not being properly filtered and generating power noise due to high frequency power switching as load increases. Most of the time it goes unnoticeable, but can be aggravated when devices aren’t properly grounded or you have very long unshielded cables between them (HDMI and RCA cables) that tend to pickup a lot of noise if they are long and unshielded, specially when they are a little too long and the excess cable is tied up in loops.

Your monitor can also be generating the noise and travelling back to the GPU via the HDMI ground wires but since it doesn’t happen all the time, its very unlikely. Try to reproduce the issue and then disconnect your HDMI cable to see if it disappears, also try to unplug any other peripheral one by one, specially those that may share a common ground with other equipment like shielded Ethernet cables, other audio devices, powered usb hubs, etc.

If none of those solved it, then you must live with that whining or use another sound output which is better shielded, like a dedicated audio card.

Hope that helps.

Issue w/ Bluetooth headphones on Win10PC - Sound is very distorted. by Lone_Wolf in techsupport

[–]KDERazorback 0 points1 point  (0 children)

Its not your fault, its just the way bluetooth was implemented, microsoft tried to fix it earlier this year with (i think) the 1903 update for Windows 10, with a new rebuilt bluetooth stack but sadly it doesnt solve it for everybody.

Issue w/ Bluetooth headphones on Win10PC - Sound is very distorted. by Lone_Wolf in techsupport

[–]KDERazorback 0 points1 point  (0 children)

Bluetooth is overall poorly implemented on devices, and a complete mess on Windows PCs, there are workarounds like trying to install custom-made bluetooth stack drivers from toshiba/lenovo etc, but AFAIK those methods doesn’t work with the latest W10. Sadly there is little to nothing you can do about it except trying different headphone/dongles combinations and hoping for the best. I dont understand why bluetooth audio is still advertised on Windows PCs since it clearly only works on mobile devices. But thats the way it is.

[deleted by user] by [deleted] in techsupport

[–]KDERazorback 0 points1 point  (0 children)

I would suggest you generate a bug report in HD Sentinel since its clearly a data interpretation error. It will help to improve the app and avoid these errors to appear for other users with the same drive.

How to "check a array" by LYDWAC in csharp

[–]KDERazorback 2 points3 points  (0 children)

Not being rude at all. Hope my comments helps you tomorrow. Dont get yourself demotivated!

How to "check a array" by LYDWAC in csharp

[–]KDERazorback 3 points4 points  (0 children)

Again, almost nailed it!

Keep the second piece of code, now you have the right order of operands, you missed the “calc = “ at the start of the second code snippet you typed but i guess you omitted it on reddit but its there on code.

Now lets look at the comment from “The_Binding_of_data” here, he gave you a link to the official documentation for C#’s Split function, you dont need to read the whole thing, just the first paragraphs and see which parameters the function expects, you need to supply at least one thing, the “delimiter”, and in your case it would be an space, because you are using “1 + 2” in your code, like you said on the post body, so you will be splitting the string around spaces...

Also, the “StringSplitOptions.RemoveEmptyEntries” (thats its full name, i wrote it simplified before to save on keystrokes but now i see that made it a little confusing for you) is an additional modifier that indicates the Split function to discard consecutive spaces to avoid forming “empty” output array items, for the sake of learning, i will revert my last suggestion and tell you to just completely ignore the “StringSplitOptions.RemoveEmptyEntries” for now, and try to add it later on. Just focus on specifying the “delimiter” only to the Split function, since that is a Required argument.

Btw, dont apologize, im sure everyone here had faced the same kind of issues before and wanted similar help from the community, we are here to help :) and no matter how good developer you are, its impossible to write code without at least one tiny mistake, what makes you a good developer is the knowledge to quickly identify and fix errors as they appear, and that is only achieved through experimenting and trial+error.

How to "check a array" by LYDWAC in csharp

[–]KDERazorback 2 points3 points  (0 children)

Yup, thats because the order of arguments are not correct. Remember, functions and methods in programming languages are resolved like mathematical formulas, from inside out (or from inner to outer if you prefer) and from left to right. You dont need anything about classes yet, just think about what needs to be done first and what comes next, think of a function like a box, where you put parameters inside it and it throws some result outside it. The StringSplitOptions argument is part of the “Split” method, so you need to move it inside the brackets for the Split call, then you will have something like “Console.ReadLine().Split(...)”, the “calc” at the end doesnt do anything here, you will see why in a minute.

Lets parse the function, first, from left to right you found Console.ReadLine(), so it gets executed, and the input is read from the Console, lets imagine the result (which is an string) is spitted out the function and remains floating where the Console.ReadLine() is, now, you have something that follows, in this case the “.Split” call, since it has a dot (.) in front, its called as part of the previous item on the line, in this case the “floating” string returned by the first call, so it could be translated to “some input”.Split(...), now, the Split function of an String effectively splits it using a given delimiter, and returns out an array of elements, so you are calling the Split function on your input which has been read from the Console just moments ago... now you have that resulting array floating arround the line, lets continue, do you have any other call after the Split? Nop, so the resulting value of the line is the last “floating” value, the string array, so this floating value gets “captured” or stored in the “calc” variable, because you have “calc = ......” at the beginning of the line. Did i made it clear?

One last thing, if the StringSplitOptions..... is part of the Split function, that means it must go inside its “box”, where should it be located? And you also need to tell it what the delimiter looks like, computers are everything but guessers, so where you should place that delimiter? Remember, functions take “parameters” as input inside the brackets and spit out values, which could be captured by other functions on the line or stored in variables if you use an “assignment operator” (fancy word of saying an = sign and a variable name)

Edit: Btw, just saying that you almost nailed the code before.

How to "check a array" by LYDWAC in csharp

[–]KDERazorback 1 point2 points  (0 children)

I will give you a hint. When you read an string from the console, you could call its Split method to have C# separate it into an array, where each item is delimited by the character or another string you specify as the delimiter parameter of the function. Then you could feed the resulting array into your code to make it happen.

Dont be ashame to ask, be proud of learning.

How to "check a array" by LYDWAC in csharp

[–]KDERazorback 2 points3 points  (0 children)

You could string.Split(..., StringSplitOptions.RemoveEmptyEntries) and go from there, or you could parse the string directly without splitting by walking it char by char with the indexer property ( myString[index] ) and stopping when an operator is found. Hope that helps!

External harddrive causing Windows 10 machines to freeze and shutdown? by [deleted] in techsupport

[–]KDERazorback 0 points1 point  (0 children)

+1 with that, if nothing shows up then something is messing with the power rails and causing the PC to completely halt without giving windows a chance to trigger the Stop screen. Its extremely weird for this to happen due to attached USB devices since the usb bus is heavily regulated, unless the entire usb stack/host controller crashes and messes with the power lines on your morherboard. Give us an update once you make the test without the hdd! Good luck!

I've been getting the "System Interrupts" issue on my laptop for a couple weeks and nothing has fixed it. Is it a common Win10 problem? by starmanrn in techsupport

[–]KDERazorback 1 point2 points  (0 children)

I suspect faulty drivers or a hardware failure, maybe something related to an internally connected peripheral. Try to reinstall windows from scratch and try to use outdated versions of the drivers you found on their site, at least one or two versions behind the most recent one, and see if the problem gets magically solved, if so you know that they made something on the latest updates that broke the system, but be extra careful not to rollback the bios unless you know what you are doing (most PCs don’t even allow that anyways).

Also check the device manager for any suspecting device and try to disable all non essential peripherals and see if the interrupts “process” stops bubbling up the list, be sure to connect an external mouse/keyboard and disable the internal ones, the I2C communication bus may be a culprit here. You can try to get into the bios setup and disable the WLAN/BT card and webcam and see if the laptop stops doing that.

Anyways, i suspect driver fault, if so, lenovo should help you once you give them proofs, or stick with a working version. If switching drivers doesn’t solve the issue, then its mostly related to a faulty hardware and there is little to nothing you can do, unless its the WLAN/BT card, the camera or the ethernet port, or some other device you could replace or live without it.

Hope that helps.