Jump to content

trag1c

Member
  • Posts

    2,139
  • Joined

  • Last visited

Awards

This user doesn't have any awards

3 Followers

About trag1c

  • Birthday Mar 16, 1996

Profile Information

  • Gender
    Male
  • Location
    Calgary Alberta, Canada
  • Interests
    Computer programming (mainly C++).
    Game and game engine programming.
    Classic rock and metal music.
    Electrical engineering.
    Robotics.
  • Occupation
    Mechanic Pre RONA.
  • Member title
    Local Electronics and C++ Programming Metal Head

System

  • CPU
    Intel i7 5820k @ 4.5GHz
  • Motherboard
    MSI X99S Gaming 7
  • RAM
    Corsair DDR4 Vengeance LPX 2666MHz 32GB
  • GPU
    EVGA GTX 1080 FTW
  • Case
    Corsair 900D
  • Storage
    WD 1TB NVMe, Intel 730 series 480GB, 3TB Seagate Barracuda
  • PSU
    Corsair AX860
  • Display(s)
    BenQ XL2730Z 2560x1440 144Hz, BenQ GW2765 2560x1440 x2
  • Cooling
    Corair H80i
  • Keyboard
    Logitech G19
  • Mouse
    Corsair M95
  • Sound
    Sennheiser HD 6XX Headphones
  • Operating System
    Windows 10

Recent Profile Visitors

4,497 profile views
  1. Been a hot minute since I've seen a JSP, but my guess is that your result is null. You may need to add the JSP equivalent of an If or make sure that result is initialized before the page is sent to the user. I could be 100% out to lunch on this though.
  2. Couldn't begin to tell you as it's library dependent and I've used neither of those and I have no idea what those libraries are. If they have windows binaries available then you need to follow what I wrote in my previous reply. if not you have to figure out to build them from source for windows in order to get the libs and dlls. Edit: I would look up Application Binary Interaces (ABI) and linking so that you can understand how these things work in the context of a systems programming language like C, C++, or Rust.
  3. Unlike Linux, User libraries don't have central location that all applications can pull from (This is why just about every application folder you look into has a whole swath of DLLs). DLLs (the equivalent of .so on Linux) have to reside next your executable or in some known path (set at compile time of your application). So the process of installing shared libraries is simply build them and place them next to your executable. Additionally, you need to instruct your build system how to link to the library. Essentially you're going to set an include directory for the headers so that you can write your code using those libraries, and finally you will set a link directory pointed to the windows version of a static library (.lib) that defines an import library which allows for your executable to link with the DLL at run time. The .libs are generated by the build process for the libraries. TL;DR; Build library DLL and place next your executable Build library .lib and set your link directory/dependencies to this location. Add include directory to the libraries headers.
  4. Not just NASA, pretty much every single embedded, safety critical, or hard real time application will be written this way regardless if they run on a platform with an MMU or not.
  5. This more or less comes down to typing... or lack there of it. void* ptr = (void*)somePtr is perfectly valid because you're assigning the pointer to memory address. However, trying to access it as a pointer + offset won't work because the compiler has no idea what the stride (sizeof(void) which doesn't exist) is. However by declaring array pointer to pointer you can now address elements because it's data type is better defined as void pointer to void pointer which does exist as sizeof(void*) which is just the size of standard pointer. So if you declare your array as void** the compiler will now see its pointer to pointer and as such you can address it as pointer + offset to retrieve a pointer to an element.
  6. This will ultimately depend on your compiler. A compiler may choose to optimize much of your code away since you're only assigning to 'a' and not accessing, essentially see's it as a superfluous call that has no net effect on the outcome. GCC from -O0 to -O3 for optimization will keep the malloc call but using the same flags on clang show a much different story where the malloc disappears. See the assembly below and you can see. This with printf() commented out. GCC 13 with -O3 main: push {r4, lr} movs r0, #0 bl time bl srand .L2: movs r0, #8 bl malloc # YOUR MALLOC CALL mov r4, r0 bl rand str r0, [r4] asrs r0, r0, #31 str r0, [r4, #4] b .L2 Clang with 17 with -O3 with no Malloc main: # @main push rax xor edi, edi call time@PLT mov edi, eax call srand@PLT .LBB0_1: # =>This Inner Loop Header: Depth=1 call rand@PLT jmp .LBB0_1 Even with the printf() call uncommented Clang still does not generate the call to malloc while GCC does. If optimization is turned off Clang will happily generate the malloc call as you would expect. main: # @main push rbp mov rbp, rsp sub rsp, 32 mov dword ptr [rbp - 4], 0 xor eax, eax mov edi, eax call time@PLT mov edi, eax call srand@PLT mov qword ptr [rbp - 16], 0 .LBB0_1: # =>This Inner Loop Header: Depth=1 cmp qword ptr [rbp - 16], -1 ja .LBB0_4 mov edi, 8 call malloc@PLT mov qword ptr [rbp - 24], rax call rand@PLT movsxd rcx, eax mov rax, qword ptr [rbp - 24] mov qword ptr [rax], rcx mov rax, qword ptr [rbp - 24] mov rsi, qword ptr [rax] lea rdi, [rip + .L.str] mov al, 0 call printf@PLT mov rax, qword ptr [rbp - 16] add rax, 1 mov qword ptr [rbp - 16], rax jmp .LBB0_1 .LBB0_4: mov eax, dword ptr [rbp - 4] add rsp, 32 pop rbp ret .L.str: .asciz "%p\n"
  7. The problem is your mathematical function is not recursive or iterative, at least in this form. if you want the sum of 5 consecutive terms, you would substitute n = 5 so it would be x = n(n+1)/2 x = (5)(5+1)/2 x = 15 There is no recursion or iteration when using that formula. If you want to calculate the sum recursively for positive integers you would do the following: #include <cstdio> int sum(int n); int main(){ int n = 0; printf("Enter a number to calculate the sum of all the number from your input: "); scanf("%d", &n); printf("sum of %d terms is, %d\n", n, sum(n)); return 0; } int sum(int n){ if(n < 2 && n >= 0) { // sum of 1 or sum of 0 terms is 1 or 0 respectively return n; } else if (n < 0) { // positive ints only return 0; } return n + sum(n - 1); } edit: I would also add that your original code should segfault (attempt to write an illegal memory address) due to the fact that there is no exit condition that breaks the recursion. As such your stack will just keep on growing with every stack frame of the recursive function. Linux should report this, no idea about any other platform.
  8. Once you dive a little deeper, you'll see that it covers far more than that. Even building supplies are covered by Energy Star, I just had new Windows installed and they have ratings. See the spoiler for said window sticker. This is for Canada but Energy Star Canada is an international partner organization/rating. Additionally, here's an excerpt from the ECO declaration from Lenovo on the Legion Slim 7i Gen 8 that I just bought. It's pretty useless for many consumer products, but Energy Star definitely covers a lot more than appliances.
  9. I would also add that even if that other graph is correct (which I am not saying it is as it's a terrible graph), there have been a lot of societal/cultural shifts in that time. Cell phones were significantly less addictive back in the early 00s compared to the smartphones that we have now. The availability of these devices is also significantly higher. I am sure that the uptick in the USA in your graph could be correlated (at least partially) to that since in NA, people are particularly selfish/self-absorbed with no care or regard for others, which anecdotally seems to get worse by the day. Then you also have a large shift in the head units in cars which are also causing distracted driving, you've gone from a basic radio with buttons and knobs to a full touchscreen infotainment system even in base model vehicles. My 23 WRX has almost no physical buttons so even adjusting things like climate controls I have to use the touchscreen which takes a lot more focus away from the road than if I had physical buttons with tactile feedback. This same distracted behavior also applies to pedestrians as well since I have seen numerous people wander out into traffic while looking down at their phones.
  10. I've used them a fair bit for 2 or 4-layer PCBs and stencils. Excellent service, super cheap, quality definitely isn't the best I've seen but good enough for most applications. But for super high quality you will also pay a ludicrous amount of money.
  11. I seen that a lot of laptops are coming in 16in form factors now. That seems to be a nice compromise between a full size 17in laptop and the 15in laptop. I would probably avoid 14in unless a strong argument can be made for it. I also saw 16:10 is making a come back which would be nice to have for productivity. I'll be mostly driving to and from campus since it's evenings or weekend classes. So portability is not super high on my list. I'll also edit my post to include this information.
  12. Currency: CAD Country: Canada Budget: 1500 - 2500 CAD Desired OS: Dual Boot Windows/Ubuntu Desired IO: 2x USB Type A, RJ45 Ethernet, HDMI. (Could be done through a dock as well) Primary use cases: Schoolwork, software development Secondary use cases: occasional CAD work, and light gaming Prefered Display: 16in 16:10 Hi all, I just got accepted into a post-diploma bachelor of science, computer science program and its in-person evening classes, as such, I need a laptop as my old one is getting close to a decade old. However, I am not sure entirely which one to pick. Since I am working full-time at my developer job during this I will need this laptop for approximately 3 years, so build quality is a must. With the laptop, I will be primarily using Ubuntu, although I will dual boot with a copy of Windows for specific programs. I would like to do some light gaming on it when I am out of town, nothing crazy, some indie games or older titles. I also utilize MCAD and ECAD software so this would be another task where it's nice to have a discrete GPU. The GPU doesn't have to be exceptional, just basic RTX xx50 or xx60. Doesn't have to be crazy powerful, I have my primary desktop for that but I would like to be able to do things on the go. My classes are approximately 4 hours long, I presume I have a power plugin, but I am not entirely sure. So enough battery capacity for 5 hours of battery life in programming and other office-like tasks, I don't care about battery life for more intensive tasks like CAD or gaming. It would also be nice to have upgradeable RAM and M.2 NVMe drive as some of my projects can get quite RAM and disk intensive. I am open to pretty much everything, except for Dell as my last laptop from them was a lemon, their customer service is dog shit, and their repair personnel are inept. edit: For the display I am seeing 16in as a new form factor in laptops which seems like a nice size. Although I will consider other laptop sizes. I will be mostly commuting to campus by driving so portability is not a big concern.
  13. You most certainly can, Direct3D12 and Vulkan both support this use case but it's up to developers to implement. However, no one actually targets this use case since 99.9% of the target market will not use such a feature and it creates a lot of gotcha's for development and users. It's also a ton of work since you would have to perform all of the synchronization and resource management (copying resources between each card) between the cards. Neither of those are easy tasks.
  14. If the LEDs themselves are addressable then look at how many pins they utilize. If it's a 3-pin interface then they're most likely going to be WS2812b LEDs (or some variant) which utilize a fairly trivial timing-based protocol to encode bits or they're going to be APA102C LEDS (or some variant) if they're 4 wire. The APA102Cs simply utilize a signal and clock which can be served by any SPI port (although that port can be used as a part of a larger bus because the APA102Cs don't utilize chip selects.) This obviously involves taking the cooler apart and directly tapping into the LEDs and bypassing the cooler's control circuitry. As far as utilizing the USB as is...bust out Wireshark and start reverse-engineering their protocol by looking at the USB frame data.
  15. Surprised the flag for Calgary Alberta doesn't have a pickup truck on it lol.
×