191
I will send you newest post from subreddit /r/programming
The importance of data when making decisions in the engineering industry
https://www.reddit.com/r/programming/comments/1g8nti6/the_importance_of_data_when_making_decisions_in/
submitted by /u/albeXL (https://www.reddit.com/user/albeXL)
[link] (https://albexl.substack.com/cp/149888672) [comments] (https://www.reddit.com/r/programming/comments/1g8nti6/the_importance_of_data_when_making_decisions_in/)
Was the Snowflake World Tour London 2024 Just AI Hype?
https://www.reddit.com/r/programming/comments/1g8lj4a/was_the_snowflake_world_tour_london_2024_just_ai/
submitted by /u/TomBaileyCourses (https://www.reddit.com/user/TomBaileyCourses)
[link] (tom.bailey.courses/was-the-snowflake-world-tour-london-2024-just-ai-hype-169a0d1c2b02" rel="nofollow">https://medium.com/@tom.bailey.courses/was-the-snowflake-world-tour-london-2024-just-ai-hype-169a0d1c2b02) [comments] (https://www.reddit.com/r/programming/comments/1g8lj4a/was_the_snowflake_world_tour_london_2024_just_ai/)
Help - eigenvalue problem optimization
https://www.reddit.com/r/programming/comments/1g8l9a3/help_eigenvalue_problem_optimization/
<!-- SC_OFF -->Hi all, I’m a student in civil engineering and I would appreciate if anyone could help me with this problem I’m trying to solve on matlab. I want to determine my k values (k1,k2 and k3) such that I get the T1,T2 and T3 values. Note that [K] - ω²[M] = 0 and ω is fcn of period, ωi=2pi/Ti. However the difference is significant. I was wondering if you have any suggestions on how I can optimize my code to get close for all the 3 periods. % Given data m1 = 33317; m2 = 20226; m3 = 19025; M = diag([m1, m2, m3]); % Mass matrix (3x3) T1_wanted = 5.2; T2_wanted = 4.0; T3_wanted = 1.17; T_wanted = [T1_wanted; T2_wanted; T3_wanted]; % Target periods tolerance = 0.02; % Desired tolerance for period difference % Number of random initial guesses to try num_guesses = 1000; % Set bounds for k1, k2, k3 to limit search space k1_lb = 100; k1_ub = 1e8; % Increased upper bounds for k1 k2_lb = 100; k2_ub = 1e8; % Increased upper bounds for k2 k3_lb = 100; k3_ub = 1e8; % Increased upper bounds for k3 % Set optimization options for fmincon (use more precise tolerances) options = optimoptions('fmincon', 'Algorithm', 'sqp', 'Display', 'off', ... 'TolFun', 1e-10, 'TolX', 1e-10, ... 'MaxIterations', 500, 'MaxFunctionEvaluations', 1000); % Call the optimize_stiffness_values function to find the optimal k1, k2, k3 [k_opt_values, opt_fun_values] = optimize_stiffness_values(num_guesses, M, T_wanted, ... k1_lb, k1_ub, k2_lb, k2_ub, k3_lb, k3_ub, options, tolerance); % Find the optimal set of stiffness values that minimizes the objective function [~, min_idx] = min(opt_fun_values); k1_opt = k_opt_values(min_idx, 1); k2_opt = k_opt_values(min_idx, 2); k3_opt = k_opt_values(min_idx, 3); % Display the optimized stiffness values disp(['Optimized stiffness k1: ', num2str(k1_opt)]); disp(['Optimized stiffness k2: ', num2str(k2_opt)]); disp(['Optimized stiffness k3: ', num2str(k3_opt)]); % Calculate the final periods with optimized stiffness values K_opt = stiffness_matrix(k1_opt, k2_opt, k3_opt); % Debugging: Check the dimensions of K_opt and M disp('Dimensions of K_opt:'); disp(size(K_opt)); % Should be 3x3 disp('Dimensions of M:'); disp(size(M)); % Should be 3x3 % Ensure K_opt and M are square and have the same dimensions assert(isequal(size(K_opt), size(M)), 'K and M must be square and have the same dimensions.'); % Solve the generalized eigenvalue problem [~, eigenvalues_opt] = eig(K_opt, M); % Solve K * phi = lambda * M * phi % Compute natural frequencies from eigenvalues omega_opt = sqrt(diag(eigenvalues_opt)); % Calculate periods T_final = 2 * pi ./ omega_opt; % Display the final periods and their difference from the target values disp('Final periods:'); disp(T_final); disp('Difference between calculated and wanted periods:'); disp(abs(T_final - T_wanted)); % ------------ Optimizing Stiffness Values Function ----------------- function [k_opt_values, opt_fun_values] = optimize_stiffness_values(num_guesses, M, T_wanted, ... k1_lb, k1_ub, k2_lb, k2_ub, k3_lb, k3_ub, options, tolerance) % Preallocate array to store the optimized stiffness values and objective function values k_opt_values = zeros(num_guesses, 3); opt_fun_values = zeros(num_guesses, 1); % Solve the optimization for multiple random initial guesses for i = 1:num_guesses % Generate random initial guesses within bounds (using rand to generate floats) k1_init = k1_lb + (k1_ub - k1_lb) * rand; % Random float between k1_lb and k1_ub k2_init = k2_lb + (k2_ub - k2_lb) * rand; % Random float between k2_lb and k2_ub k3_init = k3_lb + (k3_ub - k3_lb) * rand; % Random float between k3_lb and k3_ub % Initial guess vector k_init = [k1_init, k2_init, k3_init]; % Define the inequality constraint matrix to enforce k1 >= k2 >= k3 A = [-1 1 0; 0 -1 1]; % Matrix for k1 >= k2 >= k3 b = [0; 0]; % Right-hand side for inequality constraints % Solve the constrained optimization
OOP is not that bad, actually
https://www.reddit.com/r/programming/comments/1g8ghsj/oop_is_not_that_bad_actually/
submitted by /u/sionescu (https://www.reddit.com/user/sionescu)
[link] (https://osa1.net/posts/2024-10-09-oop-good.html) [comments] (https://www.reddit.com/r/programming/comments/1g8ghsj/oop_is_not_that_bad_actually/)
Easy Coin Detection with Python and OpenCV
https://www.reddit.com/r/programming/comments/1g86uxo/easy_coin_detection_with_python_and_opencv/
submitted by /u/Feitgemel (https://www.reddit.com/user/Feitgemel)
[link] (https://eranfeit.net/easy-coin-detection-with-python-and-opencv/) [comments] (https://www.reddit.com/r/programming/comments/1g86uxo/easy_coin_detection_with_python_and_opencv/)
Summary of the AJAX frameworks comparison
https://www.reddit.com/r/programming/comments/1g85ume/summary_of_the_ajax_frameworks_comparison/
submitted by /u/nfrankel (https://www.reddit.com/user/nfrankel)
[link] (https://blog.frankel.ch/ajax-ssr/7/) [comments] (https://www.reddit.com/r/programming/comments/1g85ume/summary_of_the_ajax_frameworks_comparison/)
This week's JavaScript news: JS might split into 2 languages, Node.js 23, Next.js 15 RC2, and more.
https://www.reddit.com/r/programming/comments/1g83j79/this_weeks_javascript_news_js_might_split_into_2/
submitted by /u/ThisWeekinJavaScript (https://www.reddit.com/user/ThisWeekinJavaScript)
[link] (https://thisweekinjavascript.com/p/javascript-js0jssugar-proposals-nodejs) [comments] (https://www.reddit.com/r/programming/comments/1g83j79/this_weeks_javascript_news_js_might_split_into_2/)
Meta's Llama 3.2: The AI That Does It All!
https://www.reddit.com/r/programming/comments/1g7ywwp/metas_llama_32_the_ai_that_does_it_all/
submitted by /u/Wise-Assignment1478 (https://www.reddit.com/user/Wise-Assignment1478)
[link] (https://youtu.be/iGMUOWH0fmY) [comments] (https://www.reddit.com/r/programming/comments/1g7ywwp/metas_llama_32_the_ai_that_does_it_all/)
How to Learn Python the Lazy Way - KDnuggets
https://www.reddit.com/r/programming/comments/1g7y7o4/how_to_learn_python_the_lazy_way_kdnuggets/
submitted by /u/kingabzpro (https://www.reddit.com/user/kingabzpro)
[link] (https://www.kdnuggets.com/how-to-learn-python-the-lazy-way) [comments] (https://www.reddit.com/r/programming/comments/1g7y7o4/how_to_learn_python_the_lazy_way_kdnuggets/)
8 effective debugging strategies to find and fix bugs like a pro
https://www.reddit.com/r/programming/comments/1g7xhhz/8_effective_debugging_strategies_to_find_and_fix/
submitted by /u/pepincho (https://www.reddit.com/user/pepincho)
[link] (https://thetshaped.dev/p/8-effective-debugging-strategies) [comments] (https://www.reddit.com/r/programming/comments/1g7xhhz/8_effective_debugging_strategies_to_find_and_fix/)
Add AI to Your App with Cloudflare Workers – No Headaches!
https://www.reddit.com/r/programming/comments/1g7wmom/add_ai_to_your_app_with_cloudflare_workers_no/
submitted by /u/Wise-Assignment1478 (https://www.reddit.com/user/Wise-Assignment1478)
[link] (https://youtu.be/YsLDFuifH8Y) [comments] (https://www.reddit.com/r/programming/comments/1g7wmom/add_ai_to_your_app_with_cloudflare_workers_no/)
Searching for and navigating Git commits
https://www.reddit.com/r/programming/comments/1g7vkkr/searching_for_and_navigating_git_commits/
submitted by /u/XLEX97 (https://www.reddit.com/user/XLEX97)
[link] (https://alexharri.com/blog/searching-and-navigating-git-commits) [comments] (https://www.reddit.com/r/programming/comments/1g7vkkr/searching_for_and_navigating_git_commits/)
Desktop version 2024.10.0 is no longer free software
https://www.reddit.com/r/programming/comments/1g7uwu7/desktop_version_2024100_is_no_longer_free_software/
submitted by /u/pigage145 (https://www.reddit.com/user/pigage145)
[link] (https://github.com/bitwarden/clients/issues/11611) [comments] (https://www.reddit.com/r/programming/comments/1g7uwu7/desktop_version_2024100_is_no_longer_free_software/)
Are LLMs Any Good at Ranking People?
https://www.reddit.com/r/programming/comments/1g7s8rl/are_llms_any_good_at_ranking_people/
submitted by /u/wilsoniumite (https://www.reddit.com/user/wilsoniumite)
[link] (https://wilsoniumite.com/2024/10/18/are-llms-any-good-at-ranking-people/) [comments] (https://www.reddit.com/r/programming/comments/1g7s8rl/are_llms_any_good_at_ranking_people/)
Low Down & Dirty Web Developers - Learn Webassembly, the low level language made just for Web Devs
https://www.reddit.com/r/programming/comments/1g7oxrp/low_down_dirty_web_developers_learn_webassembly/
submitted by /u/Late_Bowl_9505 (https://www.reddit.com/user/Late_Bowl_9505)
[link] (https://youtu.be/2_x1WsGanAo) [comments] (https://www.reddit.com/r/programming/comments/1g7oxrp/low_down_dirty_web_developers_learn_webassembly/)
Repopack: Pack Your Entire Repository Into A Single File
https://www.reddit.com/r/programming/comments/1g8nsf1/repopack_pack_your_entire_repository_into_a/
submitted by /u/suckaturdnow (https://www.reddit.com/user/suckaturdnow)
[link] (https://www.trevorlasn.com/blog/repopack) [comments] (https://www.reddit.com/r/programming/comments/1g8nsf1/repopack_pack_your_entire_repository_into_a/)
using fmincon [k_opt, fval] = fmincon(@(k) calc_diff(k, M, T_wanted, tolerance), k_init, A, b, [], [], ... [k1_lb, k2_lb, k3_lb], [k1_ub, k2_ub, k3_ub], [], options); % Store the optimized values and the objective function value k_opt_values(i, :) = k_opt; opt_fun_values(i) = fval; % Store the minimized difference % Early stopping condition if the difference is within tolerance if fval <= tolerance disp(['Early stopping at iteration ', num2str(i), ' with error: ', num2str(fval)]); k_opt_values = k_opt_values(1:i, :); opt_fun_values = opt_fun_values(1:i); break; end end end % Function to calculate the difference (objective function) function diff = calc_diff(k_vals, M, T_wanted, tolerance) % Extract stiffness values k1 = k_vals(1); k2 = k_vals(2); k3 = k_vals(3); % Construct the stiffness matrix K = stiffness_matrix(k1, k2, k3); % Solve the eigenvalue problem [~, eigenvalues] = eig(K, M); omega = sqrt(diag(eigenvalues)); % Calculate the periods T_calculated = 2 * pi ./ omega; % Calculate the difference between calculated and wanted periods diff = sum((T_calculated - T_wanted).^2); % Use square of differences % Early stopping if tolerance is met max_diff = max(abs(T_calculated - T_wanted)); if max_diff <= tolerance diff = 0; % Stop further evaluations if the tolerance is met end end % Function to create stiffness matrix function K = stiffness_matrix(k1, k2, k3) K = [k1+k2, -k2, 0; -k2, k2+k3, -k3; 0, -k3, k3]; end <!-- SC_ON --> submitted by /u/Warm_Supermarket_765 (https://www.reddit.com/user/Warm_Supermarket_765)
[link] (https://rotorlab.tamu.edu/me617/HD%207%20Modal%20Analysis%20Undamped%20MDOF.pdf) [comments] (https://www.reddit.com/r/programming/comments/1g8l9a3/help_eigenvalue_problem_optimization/)
Futexes in TLA+
https://www.reddit.com/r/programming/comments/1g8gjsp/futexes_in_tla/
submitted by /u/sionescu (https://www.reddit.com/user/sionescu)
[link] (https://surfingcomplexity.blog/2024/10/05/futexes-in-tla/) [comments] (https://www.reddit.com/r/programming/comments/1g8gjsp/futexes_in_tla/)
Introducing AI Assistance in Chrome DevTools
https://www.reddit.com/r/programming/comments/1g870tv/introducing_ai_assistance_in_chrome_devtools/
submitted by /u/feross (https://www.reddit.com/user/feross)
[link] (https://addyosmani.com/blog/ai-assistance/) [comments] (https://www.reddit.com/r/programming/comments/1g870tv/introducing_ai_assistance_in_chrome_devtools/)
The empire of C++ strikes back with Safe C++ blueprint: « After two years of being beaten with the memory-safety stick, the C++ community has published a proposal to help developers write less vulnerable code. »
https://www.reddit.com/r/programming/comments/1g85xbs/the_empire_of_c_strikes_back_with_safe_c/
submitted by /u/fchung (https://www.reddit.com/user/fchung)
[link] (https://www.theregister.com/2024/09/16/safe_c_plusplus/) [comments] (https://www.reddit.com/r/programming/comments/1g85xbs/the_empire_of_c_strikes_back_with_safe_c/)
Don’t Start Coding Yet: The best software engineers learn first about Parkinson's law, artificial deadlines and working backward plans
https://www.reddit.com/r/programming/comments/1g85i32/dont_start_coding_yet_the_best_software_engineers/
submitted by /u/strategizeyourcareer (https://www.reddit.com/user/strategizeyourcareer)
[link] (https://strategizeyourcareer.com/p/dont-start-coding-yet-heres-what-great-engineers-do-first) [comments] (https://www.reddit.com/r/programming/comments/1g85i32/dont_start_coding_yet_the_best_software_engineers/)
SMURF: Beyond the Test Pyramid
https://www.reddit.com/r/programming/comments/1g7z90g/smurf_beyond_the_test_pyramid/
submitted by /u/codingindoc (https://www.reddit.com/user/codingindoc)
[link] (https://testing.googleblog.com/2024/10/smurf-beyond-test-pyramid.html) [comments] (https://www.reddit.com/r/programming/comments/1g7z90g/smurf_beyond_the_test_pyramid/)
REST APIs Turn 25: How They Came To Be and What Could Be Next
https://www.reddit.com/r/programming/comments/1g7yi6i/rest_apis_turn_25_how_they_came_to_be_and_what/
submitted by /u/shrsv (https://www.reddit.com/user/shrsv)
[link] (https://journal.hexmos.com/rest-turns-25/) [comments] (https://www.reddit.com/r/programming/comments/1g7yi6i/rest_apis_turn_25_how_they_came_to_be_and_what/)
How to Represent Single-Variable Functions Using Functional Graphs
https://www.reddit.com/r/programming/comments/1g7y127/how_to_represent_singlevariable_functions_using/
submitted by /u/albeXL (https://www.reddit.com/user/albeXL)
[link] (https://albexl.substack.com/p/functional-graphs) [comments] (https://www.reddit.com/r/programming/comments/1g7y127/how_to_represent_singlevariable_functions_using/)
C preprocessor in Python
https://www.reddit.com/r/programming/comments/1g7x2ak/c_preprocessor_in_python/
<!-- SC_OFF -->Hi. I've made a C language preprocessor in Python. It's nothing too fancy, but it can be useful if you work with C and need to expand macros in a controlled manner for some special purposes. The main highlight is that the expanded macros retain the original formatting, i.e., the whitespaces are preserved (well, mostly...). Feel free to use it if you want. <!-- SC_ON --> submitted by /u/solitary_black_sheep (https://www.reddit.com/user/solitary_black_sheep)
[link] (https://github.com/lubomilko/pycpp) [comments] (https://www.reddit.com/r/programming/comments/1g7x2ak/c_preprocessor_in_python/)
QUIC is not Quick Enough over Fast Internet
https://www.reddit.com/r/programming/comments/1g7vv66/quic_is_not_quick_enough_over_fast_internet/
submitted by /u/MissionToAfrica (https://www.reddit.com/user/MissionToAfrica)
[link] (https://arxiv.org/abs/2310.09423) [comments] (https://www.reddit.com/r/programming/comments/1g7vv66/quic_is_not_quick_enough_over_fast_internet/)
When and Where to Use Pointers in Go
https://www.reddit.com/r/programming/comments/1g7v2p3/when_and_where_to_use_pointers_in_go/
submitted by /u/stackoverflooooooow (https://www.reddit.com/user/stackoverflooooooow)
[link] (https://www.pixelstech.net/article/1651389580-When-and-Where-to-Use-Pointers-in-Go) [comments] (https://www.reddit.com/r/programming/comments/1g7v2p3/when_and_where_to_use_pointers_in_go/)
Top JavaScript Tools for Developers
https://www.reddit.com/r/programming/comments/1g7tvot/top_javascript_tools_for_developers/
submitted by /u/Latter-Dust8587 (https://www.reddit.com/user/Latter-Dust8587)
[link] (https://makemychance.com/top-javascript-tools-for-developers/) [comments] (https://www.reddit.com/r/programming/comments/1g7tvot/top_javascript_tools_for_developers/)
Mastering Time Management as a Staff SWE
https://www.reddit.com/r/programming/comments/1g7qu62/mastering_time_management_as_a_staff_swe/
submitted by /u/musskk (https://www.reddit.com/user/musskk)
[link] (https://open.substack.com/pub/thehustlingengineer/p/mastering-time-management-by-a-staff?r=yznlc&utm_medium=ios) [comments] (https://www.reddit.com/r/programming/comments/1g7qu62/mastering_time_management_as_a_staff_swe/)
Bare metal raycaster in x86 assembly by stillwwater -- boots from floppy image
https://www.reddit.com/r/programming/comments/1g7niq9/bare_metal_raycaster_in_x86_assembly_by/
submitted by /u/r_retrohacking_mod2 (https://www.reddit.com/user/r_retrohacking_mod2)
[link] (https://github.com/stillwwater/raycaster) [comments] (https://www.reddit.com/r/programming/comments/1g7niq9/bare_metal_raycaster_in_x86_assembly_by/)