Jump to content

trag1c

Member
  • Posts

    2,140
  • Joined

  • Last visited

Everything posted by trag1c

  1. Professional software developer currently but I am upgrading my diploma to degree through night classes. Current desktop is Ryzen 9 5900x with 128GB DDR4 3600MHz, 3080 ti, 2x samsung 980 pro 2TB, Samsung G9 Neo. Runs Windows for gaming, for tinkering Endeavor OS, for software development Ubuntu. Laptop is Lenovo Legion Slim 7i from 2023 that I forget the specs on lol. I7 or i9 with a 4060 or 4070, 16GB ram. Windows + WSL. NAS is 2x Xeon X5650, 48GB DDR3 ECC?? 5x 4TB Nas drives. I use all three in the pursuit of my degree, work and hobbies.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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"
  8. 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.
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. 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.
  16. Surprised the flag for Calgary Alberta doesn't have a pickup truck on it lol.
  17. The developer outlined that they make ~7B requests a month with each user making approximately 10.6k reqs/month. Assuming 660k active users (7B ÷ 10.6k) and that they all paid $1.50/month sub he would still be short like 700k/month. In reality, he probably has less than a 10th of those active users as subscribers. I wouldn't be surprised if the developer, either had to raise the sub to like $15/month or eliminate the free tier and still raise prices a fair bit.
  18. You would be surprised at how much legacy shit is out there. I develop software/firmware for embedded devices (bare-metal MCUs, and Linux systems) and the amount of support calls I get for guys running versions of Windows that are 20-30 years old trying to run our software is astounding. Or my other favorite is companies that only permit Internet Explorer because they have some crusty web system that only works with IE. Mind you these will be modern laptops running Win10 or Win11 but only have IE installed. You can basically count on the entire industrial sector to be affected by any breaking compatibility changes. All of your oil & gas, power generation, factories, utilities, you name it run on systems that are 20 - 40+ years old. I've been on O&G sites where their control systems were a room filled with cabinets that contain relays that perform relay logic (boolean logic with relays) from the 1940s. Not exactly "computer" related (At least not in the modern sense) but it's a damn good example of legacy shit that will never be replaced. Computer systems suffer the same problem. It performs a business-critical function but it is no longer maintained so you can't run it with the latest technologies. The only time any of it is replaced is when it truly gives up the ghost and there is no way to bring it back. I for one welcome getting rid of all of this crusty garbage but it would cause some serious problems for the industries that stop society as we know it from descending into darkness and anarchy.
  19. I usually just use Google image search, with the keywords being resolution, wallpaper, and sometimes topic (Depending on if I am looking for something specific or just want to see wallpapers). E.g. my current wallpaper can be easily found with the search of "5120x1440 star wars wallpaper" (exclude the quotes) and that will find you the following.
  20. Interesting, I just looked up the brand and they do have resellers in Calgary but no major chains. They're only sold in "organic/natural" food type stores here, all of which are at least a solid half-hour drive from home lol.
  21. 237mL, 500mL, 1L, and 2L for cartons, and then 2L or 4L plastic jugs are what we have in the west, can't say I have seen any other packaging besides those. We did have bags out for a time, my parents would have had them, and they were born in the early 60s for reference. edit: 1L plastic jugs also exist.
  22. Good, let it die. A propritory file format that only has marketing hype around it, worse quality, and increased costs for the end consumer from them taking a cut at every point between recording and playback.
  23. You're probably right that clients will have the expectations but I expect it will be a fad like outsourcing, low code and no code. It will temporarily close positions at some businesses but will ultimately reopen those positions with probably higher pay once stakeholders realized they fucked up lol. It's like outsourcing to the those dev sweat shops in India. It looks like great savings on paper till your software doesn't work and then it's hiring a ton of local devs to fix and supervise the work of the outsourcing.
  24. As a programmer, I am not the least bit worried. It ultimately comes down to requirements gathering/analysis. You can often get incomplete, missing, or straight-up wrong requirements for a task. Good luck trying to get an AI to do anything meaningful when it has no idea what to do because you have no idea what it needs to do. The number of times I can be given a task with absolutely no information other than a title is astounding. This is also not a phenomenon that is isolated to my place of work, this happens everywhere, in some places more than others. At least being a human, you can read between the lines and make inferences or question genuinely bad requirements. An AI will never have that opportunity because ultimately at the end of the day, it is a computer, it can only handle very precisely laid out instructions and will maliciously comply with whatever you give it. You give it garbage, it will give you garbage, and in all likelihood, you will give it garbage because you were given garbage. Even if you give it gold, it will still most likely give you garbage as our current and future AI lacks the I in AI. It has no idea if what it's giving you is correct for the task at hand, it only knows that it had a % match against some basic search criteria. You will still have to check that code for validity, which means you still have to know what you're doing. AI will make programmers more productive, not replace them. AIs going to be very helpful for repetitive, monotonous tasks like boilerplate code, beyond that I wouldn't trust it and wouldn't worry about it. The amount of false armageddon that software developers have seen at this point is basically a running joke. dot com bubble, 2008 crash, outsourcing to india, low code, no code, and now finally ChatGPT. It turns out the industry just keeps growing, even with these massive layoffs from FAANG and others in the industry we're still at a net positive for jobs year over year. The aforementioned tools have also had a negligible impact on developers. Take something like a PLC which uses IEC61131-3 low code programming languages, this device was designed so that an electrician could program it. The person who ultimately uses those low-code languages in such a device is a software developer because low code will always be too much code for the vast majority of the population. Then with no code, it never works because it never does what you need it to do so you end up hiring a software developer anyways. Software developers and similar roles are basically irreplaceable because very few people can do it and the alternatives always end up costing more than paying a skilled professional to do the work.
  25. It's probably more so that the specific carrier doesn't want to go through the effort of remotely reprovisioning the sim to allow access for a specific APNs and radio networks / bands. If the networks were specifically for phones it would be a lot simpler, but with IoT and M2M applications carriers will sometimes offer older networks and/or lower data rate networks for cheaper so they have access controls on different radio network technologies. If the carrier doesn't have different plans for different networks you most likely could use the same sim. If they sell access to specific radio networks then they will probably give you a new card. So basically for regular consumers they will just have a stack of pre-provisioned sim cards that just need a phone number and account number associated with them. At my work we design, build, and sell M2M/IIoT devices so we will provision our own SIMs through carrier web portals. When we buy a stack of sims they are automatically associated with our account but lack much in the way of configuration as each one needs a plan or data pool to be selected as well as things like APNs and radio networks. Among other things.
×