/r/ProgrammerTIL
Learn something new? Wanna share? Post here along with the language/framework you learned it in.
This is a great place for novice and advanced programmers alike to come and discover all the interesting things they could learn tomorrow ;)
Learn something new? Wanna share? Post here along with the language/framework you learned it in.
This is a great place for novice and advanced programmers alike to come and discover all the interesting things they could learn tomorrow
Sort by language C# Java Javascript PHP .NET C++ Python C Objective-C R Swift VBA Visual Basic Matlab Ruby Perl ScalaDelphi lua SQL Other Languages Other
Learn something about technology? Post it on r/technologytil
Learn something about real life or something not programming? Post it on the original /r/todayilearned
Rules
TIL posts should be made in the following format:
[programming language] TIL rest of post...
If you don't you'll need to flair your post manually.
Refrain from putting two languages in between the brackets in the title.
Don't post suggestion threads, message the moderators instead.
This isn't an AskProgrammers sub, ask questions on /r/learnprogramming
Don't use the code as the title.
Guidelines
Try not to post vague titles, if possible, provide the name of the feature in the title so people aren't clicking on your post because of "this fast and clever way to do x" that they already knew but didn't realize it's what you where going to show.
Don't criticize posts because they're "too obvious", not everyone here is a level 100 master champion Assembly programmer that made their own OS from scratch.
General programming TILs should be tagged with [General].
Be nice to your fellow programmers. :)
/r/ProgrammerTIL
This maybe isn't a TIL so much as (just the other day) I implemented.
It's possible in NodeJS, with a little black magic, to author new code (files, dependencies, variables, executable lines, everything) within the current executing context, in typescript, with just a few tools. ts-node, nodejs customization hook (for import cache busting), { type: module } to support dynamic imports, and a lambda eval statement in the desired context to make the local scope available.
It's really magical.
I used this to create an automated test recorder that you can build up your testing model and REPL build up the test along the way. It all just sits at an `await` statement while monitoring. No process restart, all context is kept. Just keeps pulling in the new stuff, and does some sleight of hand to execute newly detected blocks of code, and track variables.
I have a video showing this, but, eh, then this might get flagged for self-promotion.
I’m building a community-driven list of Awesome European Tech, browsers, productivity tools, FinTech, and more. that focus on privacy, sustainability, and innovation.
The goal is to support European startups and companies (from the EU and EFTA) that choose to stay in Europe, helping to strengthen the European tech ecosystem. This list will highlight GDPR-compliant tools, eco-friendly platforms, and innovative solutions as alternatives to U.S.-based tech, showcasing the best Europe has to offer.
I’ve already put together a small draft list, inspired by the great work of European Alternatives. Now, I want to make this a collaborative, living resource where anyone can contribute and help keep it up to date. check it and let me know please ! Awesome European Tech
Hi Redditors,
I need some urgent guidance as I’m transitioning in my career and actively looking for a job. For the past 2.3 years, I’ve been working as a Python Django Developer cum Trainer. Most of my experience has been focused on teaching students and helping them with academic projects. While this has given me excellent communication skills and a solid grasp of Django concepts, I lack hands-on experience with live projects or working in a team environment.
I’ve always dreamed of becoming a full-time developer, but teaching commitments held me back from pursuing that goal earlier. Recently, I decided to quit my job to focus on upskilling and finding a developer role as soon as possible. I’ve started exploring Django Rest Framework, React, and building projects to strengthen my profile. I’m also doing freelance teaching to stay financially stable during this transition.
I have a few questions:
I’d love to hear from anyone who has gone through a similar transition or has advice for someone in my situation. Your help and insights would mean the world to me. Thank you!
Original article: https://hive.blog/python/@geekgirl/openpyxl-vs-xlsxwriter-the-ultimate-showdown-for-excel-automation
Everybody loves spreadsheets! As much as I am not fond of Microsoft, I should admit one good thing they have done long time ago and kept up delivering on is their MS Excel. My preferred operating system is Mac, yet I never use Numbers or any other MS Office alternatives. There are alternatives for MS Excel like Google spreadsheets, LibreOffice, etc. In my opinion, nothing is better than Excel. It has been kept so simple, while also maintaining it as very powerful software. Users from all levels of skillsets can take advantage of what Excel offers. I use spreadsheets all the time both working on spreadsheets manually and also programmatically. Automating excel spreadsheets is what I like the best. As usual I utilize python for automation scripts.
My main library for spreadsheet automation is Openpyxl. It is a very powerful framework just like Excel itself. It gives an ability to read, create, write, edit spreadsheets programatically. Over the years I have written many scripts that work with various spreadsheets and openpyxl is definitely the best library to use. Cool thing about python is there are always alternatives and additional tools we can use. For spreadsheet automation there are other modules available as well. Among them I decide to add to my toolkit next is XlsxWriter. There are very important difference between the two modules. I will still go to openpyxl as my first pick to anything spreadsheet related. However, there are thing openpyxl cannot do, but xlsxwriter does with ease. At the same time there are things xlsxwriter cannot do what openpyxl does like a champ.
I wouldn't even look at other alternative tools, if openpyxl could do one thing I needed for a project. Openpyxl is good with styling cells and values. What it absolutely cannot do is apply different styles to the section of the value within a cell. For example, let's say we have three lines of text in one cell and we want to make each of them different colors, sizes, fonts. Openpyxl cannot do this. But xlsxwrite can definitely perform these operations. This is reason why xlsxwriter caught my attention. Useful tools like this are always go too have in our toolbox.
I should emphasize that both are powerful tools and are awesome. But they serve different purposes and excel in different scenarios. While Openpyxl is designed to read, write, and modify Excel spreadsheets, XlsxWriter focuses exclusively on creating and writing Excel spreadsheet files. Openpyxl has functionality is broad and can do many things including formulas, charts, styles and even macros. XlsxWriter however, is best for creating richly formatted and visually appealing Excel files. While it cannot read excel files, and is write only, it is optimized for creating large Excel files quickly.
Let's take a look at an example code:
from
openpyxl
import
Workbook
# Create a new workbook
wb = Workbook()
sheet = wb.active
# Add data
sheet['A1'] = 'Hello, Openpyxl!'
sheet['B1'] = 42
# Save the workbook
wb.save('example.xlsx')
Very easy, very simple, and gets job done.
import
xlsxwriter
# Create a new workbook and add a worksheet
workbook = xlsxwriter.Workbook('example.xlsx')
worksheet = workbook.add_worksheet()
# Write data with formatting
worksheet.write('A1', 'Hello, XlsxWriter!')
worksheet.write('B1', 42)
# Add a chart
chart = workbook.add_chart({'type': 'line'})
chart.add_series({'values': '=Sheet1!$B$1:$B$1'})
worksheet.insert_chart('C1', chart)
workbook.close()
This isn't too complicated either. With very few lines of codes we get started working with spreadsheets programmatically. Isn't that awesome? While you can already see both take slightly different approach in how to create sheets and assign values to cells, both are self explanatory and easy to get started with. Xlxswriter has an excellent support for adding charts, images, and other visual elements.
If there is no need for rich formatting, and often there isn't. Let's say if we are dealing with large amount of spreadsheets and main focus is in the actual data, data manipulation, data analysis then openpyxl would be the right choice. However, if our project involves data visualization and presentation of data then better choice will be xlsxwriter. The beauty of accomplishing goals programmatically is that we can use all the tools that we have. We don't need to limit ourselves to one solution, but perhaps it is even better to utilize two or three more tools and each would be used in the areas they are best at.
I will continue using Openpyxl for most of my projects, because they involve both reading existing files and creating new ones. However, I will definitely start using XlsxWriter if there is a need for advanced formatting, charts, visuals, and efficiency. I already know what I will be using XlsxWriter for one of my existing projects that requires formatting sections of the cell values. I am sure I will find a lot more use for it too. If you use spreadsheets programatically, don't forget we have really good options when it comes to python libraries. Openpyxl and XlsxWriter are definitely the ones I would recommend to get familiar with. By understanding the strengths and limitations of each library, we can select the right tool for the projects we are working on.
🚀 Glad to introduce my shared ESLint & Prettier config package for Next.js 14! 🎉
Writing a clean, consistent codebase is now easier ⚡️
Try it out and share your feedback! 🙌
A follow up on the previous post on Playwright framework
https://peakd.com/python/@geekgirl/playwright-has-compatibility-issues-in-windows-environment
I learn and then i create videos, i learnt about stop words in NLP and created content in easy to understand language with real life examples.
Do checkout
Remembered an old argument about Vim against IDE, and how it died out on a definition of IDE. So, to break your stereotypes about IDE-s I decided to throw this one into the wild)
Linux Shell is an IDE
Let's start from definition. IDE, or Integrated Development Environment is a software application that provides comprehensive facilities for software development, according to Wikipedia. Most commonly it inclides a source/text editor, build automation tools and a debugger.
Now what do we have in shell?)
We have a tonn of editors, from nano to emack-s and vim-s, not counting graphical ones you could also launch and configure from shell. We also have make and its derivatives, Autotools, meson, etc, so build automation is covered too. And gdb covers the debugging part, on par with a bunch of engines for checking scripting languages with shell itself included.
On top of that, we have an extensive "plugin system" where all you need to do is to add you new thing to PATH, and it will become another utility in the arsenal. You also have an automation built in, because you can use shell itself as a programming language to orchestrate different utilities into cohesive logic systems. We have "window management" with screen, tmux, etc; every single thing you can think of for working with remote servers (even bash by itself has sockets); file management for project organisation; git for version control; project access control with regular linux premissions; extensive instruments for string searching and manipulation useful for data analysis - the list goes on. If we would rate IDE-s on the number of features, linux shell would be in the lead with a big margin :D
There is one word in the definition that we need to return to - "integrated". This is where one could start to break down my arguments, as linux shell is quite a wild west of styles and interfaces, even just --help option is enough of a headache. I will use a bit of a trick to answer that and travel back in time to UNIX days)
At that time the set of utilities was quite a bit smaller and more focused on both a single language (Yep, that's why I claimed bash to be a C IDE) and a single standard/library for interfacing with humans. If you look at those older utilities, they do have a lot of integration and similarity, so, I would argue that checks out. And heck, shell also supports C syntax, so integration with C is quite apparent)
Lastly, I would like to remind you that this was exactly how it was used in the days of mainframes and physical TTY-s. Way before the term IDE was created) The whole OS was your IDE at that time. With Basic at home and C at the universities.
Now, I'm not saying it is a great IDE nowadays. Most of you think otherwise, and seeing how neglected it has been I must agree with you. But the next time you are arguing about IDE-s or installing a thousand-first plugin, I want you to remember this little rant of mine and open your mind to the idea that IDE is not bound by the window border ;)
Hello, this is my first post here, I hope I'm doing it right: some considerations, tests and thoughts on the switch between those 2 frameworks
so i've recently learnt about gsoc and hacktoberfest randomly through some youtube video. i mean gsoc is very popular heard it from multiple youtubers, but hacktober fest- only heard it from a vlog where someone was preparing for gsoc, our college is tier 3 so honestly we don't get any info about these things. Is there a way / websites that can help to find things like this?? can anybody help
The article discusses technical debt, its various types and effective management strategies. It also outlines methods for measuring technical debt, including the use of code quality tools, maintaining a technical debt backlog, and employing metrics: Top Types of Technical Debt and Effective Solutions
This guide will help a programmer understand how to setup a simple load balancer to demonstrate the basic principal whilst coding.
System Design Part 1: Setup a Simple Load Balancer using Python
The technologies to demonstrate are:
The guide below explores end-to-end (E2E) software testing, emphasizing its importance in validating the complete code functionality and integration - how E2E testing simulates real-world user scenarios, contrasting it with unit and integration testing, which focus on isolated parts of the code: End-to-End Software Testing: Overcoming Challenges
The testing pyramid emphasizes the balance between unit tests, integration tests, and end-to-end tests. The guide below explores how this structure helps teams focus their testing efforts on the most impactful areas: Implementing the Testing Pyramid in Your Development Workflows
The article discusses prominent software testing communities to enhance tester's professional journey: 15 Online Communities for Testers You Must Join
Example, Company Goal: Migrate data warehouse to public cloud to enhance scalability, reduce infrastructure costs, and improve analytics capabilities
Map DevOps Goals to Company Objectives:
How many people use ChatGPT, Claude.ai, and Cursor to generate boilerplate in DevOps?
Example: write a sample pipeline and then modify it; write a sample terraform module and then modify it, etc.
How many people use ChatGPT, Claudi.ai, to write articles (at least boilerplate) and then modify them to demonstrate their ideas?
Hey all, I’m curious about your experiences working with software agencies. What’s worked well? What hasn’t? How do you manage communication, team alignment, and project expectations? Any red flags you’ve noticed or tips for a smoother partnership?
Howdy Reddit!!
i made my spotify recommendations system which is a huggingface spaces app allowing you to generate recommendations based on the music taste you have, steps on how to use it :-
https://huggingface.co/spaces/krishnendughosh/Spotify-Recommendations-System (heres the link)
a)first you need to login to your spotify account after which you will get a callback url which you need to copy paste in the interface to initiate the app
b)you get 5 songs on which u can base the generations off, minimum songs you can add is 1 maximum is 5
c)after this step you can choose on how many songs generated playlist you want, the default or minimum is set to 5 songs
c)then you click the generate recommendations button creating the playlist which will be shown first to you where you can overview all the songs (generated+added) in the form of spotify preview letting you listen to all the songs for a amount of time.
d) you can name it a designated playlist name you want which will form a spotify playlist whose link will be provided after all the above steps
e) enjoy your musical adventure
i have also provided a video demo which you can view on youtube the link is given on this (ps: the choosing number of recommendations feature is yet not added in the video meanwhile it is present now)
https://youtu.be/OAxsvKLg0BM?si=QnznFqE8dIGyjUUn
drop down suggestions and queries in comments
hmu if you guys are interested in my newsletter containing weekly updates about this and more stuff
here's my github profile if you wanna see it
https://github.com/6069krish
The guide below provides a software testing podcast collection, providing expert insights to stay up to date on the latest trends on different aspects of testing: Best 10 Software Testing Podcasts in 2024
The comparison below discusses the best coding AI copilots for 2024 - as advanced tools that assist developers throughout the software development lifecycle by providing real-time code suggestions and completions (which distinguishes them from regular coding AI assistants that may only offer task-specific support): 4 Best Coding AI Copilots for 2024
It explains the key benefits of these copilots as increased efficiency, error reduction, consistent code quality, and natural language processing.
The article discusses best practices and various aspects of software testing, to provide a comprehensive checklist to ensure effective testing processes: Software Testing Best Practices Checklist
Join the Pujo Atlas Project: Calling Flutter, Django, and Web Developers!
At r/kolkata, we’re building Pujo Atlas—an app that will be a go-to resource for Pujo enthusiasts and pandal hoppers. This app will guide users to notable Durga Puja pandals across the city, helping them explore Kolkata's rich cultural heritage during the festivities.
While we’ve made significant progress on the UI/UX front, our frontend and backend development is lagging due to a lack of dedicated developers. We need contributors with expertise in Flutter (frontend) and Django (backend) to help push the project forward.
Backend (Django, Python):
Frontend (Flutter/Dart):
DevOps (AWS):
UI/UX:
Web Development (React & TypeScript):
Pujo Atlas is an FOSS project, so while we cannot provide monetary compensation, we will offer recognition and credits for your contributions. In the future, we hope to distribute physical tokens to contributors, which can be showcased in various social settings to acknowledge your affiliation with the project.
GitHub Repo: Pujo Atlas Frontend
If this project resonates with you and you’d like to be part of this journey, feel free to DM me for an invite link! Also, if you have any questions, don’t hesitate to ask in the comments.
Signing off,
u/suspicious-tooth-93
Hey everyone!
I’m excited to introduce FetchPHP, a lightweight and open source HTTP library for PHP, directly inspired by JavaScript’s fetch
API. It simplifies making HTTP requests in PHP while providing both synchronous and asynchronous support, making it perfect for API requests, file uploads, and more.
fetch
ok()
, isClientError()
, and isServerError()
Check it out on GitHub! I’d love your feedback and suggestions. If you find it useful, consider giving the project a ⭐️ to support further development. 🙌
🔗 GitHub Repository: Link to the project
Thanks for reading 😊
This article provides an overview of various tools that can help developers improve their testing processes - it covers eight different automation tools, each with its own strengths and use cases: Python Automation Tools for Testing Compared - Guide
The article discusses strategies to improve software testing methodologies by adopting modern testing practices, integrating automation, and utilizing advanced tools to enhance efficiency and accuracy in the testing process. It also highlights the ways for collaboration among development and testing teams, as well as the significance of continuous testing in agile environments: Enhancing Software Testing Methodologies for Optimal Results
The functional and non-functional testing methods analysed include the following:
The article below discusses the differences between alpha testing and beta testing - the goals, processes, and importance of both testing phases in ensuring software quality. It explains how alpha testing is typically conducted by internal teams to identify bugs before the product is released to external users, while beta testing involves a limited release to external users to gather feedback and identify any remaining issues: Alpha Testing vs. Beta Testing: Understanding Key Differences and Benefits
It's pretty simple actually. You can basically transform any website into a Progressive Web App that can later be distributed on App Store and Google Play. It's awesome, you can send push notifications, pre cache assets, fetch data in the background and hook into native APIs of the devices. Here is a Laravel tutorial that can be applied in any stack: https://youtu.be/xA9B2hwA1-w?si=qv8rmQDUGtiN8Dtt