Learn Programming
- visualstudiomagazine.com Open Source 'Eclipse Theia IDE' Exits Beta to Challenge Visual Studio Code -- Visual Studio Magazine
Some seven years in the making, the Eclipse Foundation's Theia IDE project is now generally available, emerging from beta to challenge Microsoft's similar Visual Studio Code editor, with which it shares much tech.
Looks just like VS Code and I think it's still built on electron so take that as you will.
-
How do I learn to optimize my code better?
I'm trying to make minesweeper using rust and bevy, but it feels that my code is bloated (a lot of for loops, segments that seem to be repeating themselves, etc.)
When I look at other people's code, they are using functions that I don't really understand (map, zip, etc.) that seem to make their code faster and cleaner.
I know that I should look up the functions that I don't understand, but I was wondering where you would learn stuff like that in the first place. I want to learn how to find functions that would be useful for optimizing my code.
-
X11 + OpenGL window resizing issues
When resizing an X11 window with OpenGL content, the image becomes garbled and certain parts of the window, usually at the parts that wasn't originally part of the initial framebuffer.
I couldn't find any documentation on if I supposed to call some extra functions when the window is being resized or not. I otherwise process that even as a system event, so it can be further processed by the program using my API.
-
Value of "encrypted at rest" data
I'm writing a specification for a web app that will store sensitive user data, and the stakeholder asked that I consider a number of fairly standard security practices, but also including that the data be "encrypted at rest", i.e. so that if someone gains physical access to the hard disk at some later date the user data can't be retrieved.
The app is to be Node/Express on a VPS (probably against sqlite3), so since I would be doing that using an environmental variable stored in a file on that same computing instance, is that really providing any extra security?
I guess cloud big boys would be using key management systems to move the key off the local instance, and I could replicate that by using (Hashicorp Vault?) or building a service to keep the key elsewhere, but then I'd need secure access to that service, which once again would involve a key being stored locally.
What's your thoughts, experience, or usual practice around this?
-
Weird behavior in python (tkinter) [SOLVED]
I'm working on a little gui app that will eventually (hopefully) add a watermark to a photo. But right now I'm focused on just messing around with tkinter and trying to get some basic functionality down.
I've managed to display an image. Now I want to change the image to whatever is in the Entry widget (ideally, the user would put an absolute path to an image and nothing else). When I click the button, it makes the image disappear. I made it also create a plain text label to see if that would show up. It did.
Okay, time to break out the big guns. Add a breakpoint.
py -m pdb main.py
. it works. wtf?python def change_image(): new_image = Image.open(image_path.get()).resize((480, 270)) new_tk_image = ImageTk.PhotoImage(new_image) test_image_label.configure(image=new_tk_image) breakpoint()
with the breakpoint, the button that calls change_image works as expected. But without the breakpoint, it just makes the original image disappear. Please help me understand what is happening!
edit: all the code
```python import io import tkinter as tk from pathlib import Path from tkinter import ttk
from PIL import ImageTk from PIL import Image
from LocalImage import Localimage from Layout import Layout
class State: def init(self) -> None: self.chosen_image_path = ""
def update_image_path(self): self.chosen_image_path = image_path.get()
def change_image(): new_image = Image.open(image_path.get()).resize((480, 270)) new_tk_image = ImageTk.PhotoImage(new_image) test_image_label.configure(image=new_tk_image) breakpoint()
TEST_PHOTO_PATH = "/home/me/bg/space.png" PIL_TEST_PHOTO_PATH = "/home/me/bg/cyberpunkcity.jpg" pil_test_img = Image.open(PIL_TEST_PHOTO_PATH).resize((480,270))
why does the resize method call behave differently when i inline it
instead of doing pil_test_img.resize() on a separate line?
root = tk.Tk()
root.title("Watermark Me") mainframe = ttk.Frame(root, padding="3 3 12 12") mainframe.grid(column=0, row=0, sticky="NWES")
layout = Layout(mainframe)
image_path = tk.StringVar() tk_image = ImageTk.PhotoImage(pil_test_img) test_image_label = ttk.Label(image=tk_image)
entry_label = ttk.Label(mainframe, text="Choose an image to watermark:") image_path_entry = ttk.Entry(mainframe, textvariable=image_path) select_button = ttk.Button(mainframe, text="Select", command=change_image) hide_button = ttk.Button(mainframe, text="Hide", command= lambda x=test_image_label: layout.hide_image(x)) test_text_label = ttk.Label(mainframe, text="here i am") empty_label = ttk.Label(mainframe, text="")
for child in mainframe.winfo_children(): child.grid_configure(padx=5, pady=5)
entry_label.grid(column=0, row=0) image_path_entry.grid(column=1, row=0) hide_button.grid(column=0, row=3) select_button.grid(column=0, row=4) test_image_label.grid(column=0, row=5) empty_label.grid(column=0, row=6)
image_path_entry.insert(0,TEST_PHOTO_PATH) image_path_entry.focus() breakpoint()
root.mainloop() ```
-
Predict the output of the following javascript code
app.withcodeexample.com Predict the output of the following javascript code - 04hivg0osqsqo8pptoIn this code, a `for` loop is used to create three instances of a `setTimeout` function. Each instance logs the value of `i` after a delay of 100 millisecond...
-
JavaScript Daily Quiz and Code Snippets
app.withcodeexample.com Daily Quiz | With Code ExampleChallenge your mind daily with our engaging quizzes! Put your knowledge to the test with a new quiz every day, covering various topics.
I have created this app for javascript beginners. Users can attempt daily quiz and see the explanation after each answer. Also providing the frequently used code snippets, you can download beautiful images of code snippets and quiz. Please provide your feedback.
-
Can I learn android development in a non-javscript IDE? DAE find electron/javascript IDEs confusing?
Does anyone else find javascript/electron-based code editors confusing? I can never understand the organization/hierarchies of menus, buttons, windows, tabs. All my time is spent hunting through the interface. My kingdom for a normal dialogue box!
I've tried and failed to use VSCodium on a bunch of occasions for this reason. And a couple other ones. It's like the UI got left in the InstaPot waaaay too long and now it's just a soggy stewy mess.
Today I finally thought I'd take the first step toward android development. Completing a very simple hello world tutorial is proving to be challenging just because the window I see doesn't precisely correspond to the screenshots. Trying to find the buttons/menus/tools is very slow as I am constantly getting lost. I only ever have this in applications with javascript-based UIs
Questions:
-
Am I the only one who faces this challenge?
-
Do I have to use Android Studio or it there some kind of native linux alternative?
edited to reflect correction that Android Studio is not electron
-
- javascript.withcodeexample.com Node Authentication With Passport.Js
Take your Node development to new heights by mastering passport.js authentication. Your apps deserve nothing but the best security measures.
-
How to efficiently package CLI application on linux
Hi, I'm looking to open-source a small CLI application I wrote and I'm struggling with how to provide the built app since just providing the binary will not work. I had a friend test it and he had to compile from source due to glibc version differences.
My first thought was providing it as a flatpak but that isn't really suitable for CLI software.
I've googled around a bit and most guides I find just mention packaging separately for multiple package managers/formats (rpm, apt etc.). This seems really inefficient/hard to maintain. What is the industry standard for packaging a Linux software for multi-distro use?
-
What's best suited for low-tech
Hi everyone,
TL;DR Completely new to coding and programming, but I want to learn enough to be able to run a home server, my own website and tinker a bit with Arduino. Is there any programming language or path that you could recommend?
I don't know if those things are related or not. I've been looking at books a bout Arduino, but it's just following instructions to do xyz, but not explanation of the basics.
About the server and website, I've wanted to try it out since I stumbled upon the Low tech magazine. Many of the projects there and the philosophy behind it speak to me, so I would like to be more knowledgeable about it and be able to do some stuff myself.
EDIT. You guys are awesome! Thank you so much for the replies. It’s so cool to see Lemmy populated with cool people willing to chat and put knowledge in common :) I might be updating this post when I get to do something about… well all the resources you gave me!
-
Ownership in match statements on multiple variables [RUST]
cross-posted from: https://lemmy.ml/post/13353225
> Quick little confusion or even foot-gun I ran into (while working on the challenge I posed earlier). > > ### TLDR > > My understanding of what I ran into here: > > * Matching on multiple variables simultaneously requires assigning them to a tuple (?), > * which happens more or less implicitly (?), > * and which takes ownership of said variables. > * This ownership doesn't occur when matching against a single variable (?) > * Depending on the variables and what's happening in the match arms this difference can be the difference between compiling and not. > > Anyone got insights they're willing to share?? > > ### Intro > > I had some logic that entailed matching on two variables. Instead of having two match statements, one nested in the other, I figured it'd be more elegant to match on both simultaneously. > > An inline tuple seemed the obvious way to do so and it works, but it seems that the tuple creates some ownership problems I didn't anticipate, mostly because I was thinking of it as essentially syntax and not an actual tuple variable. > > As you'll see below, the same logic with nested match statements each on a single variable doesn't suffer from the same issues. > > ### Demo Code > >
rust > fn main() { > > // # Data structures > enum Kind { > A, > B > } > struct Data { > kind: Kind > } > > // # Implementation > let data = vec![Data{kind: Kind::A}]; > > // ## Basic idea: process two adjacent data points > let prev_data = data.last().unwrap(); > let new_data = Data{kind: Kind::B}; > > // --- MATCH STATEMENTS --- > > // ## This works: match on one then the other > let next_data = match prev_data.kind { > Kind::A => match new_data.kind { > Kind::A => 1, > Kind::B => 2, > }, > Kind::B => match new_data.kind { > Kind::A => 3, > Kind::B => 4, > }, > }; > > // ## This does NOT work: match on both > let next_data2 = match (prev_data.kind, new_data.kind) { > (Kind::A, Kind::A) => 1, > (Kind::A, Kind::B) => 2, > (Kind::B, Kind::A) => 3, > (Kind::B, Kind::B) => 4, > }; > } >
> > ### The Error > > The error is on the linelet next_data = match (prev_data.kind, new_data.kind)
, specifically the tuple and its first elementprev_data.kind
, with the error: > >> error[E0507]: cannot move out of `prev_data.kind` which is behind a shared reference > > move occurs because `prev_data.kind` has type `Kind`, which does not implement the `Copy` trait >
> > ### The Confusion > > Soprev_data.kind
needs to be moved. That's ok. Borrowing it with(&prev_data.kind, ...)
fixes the problem just fine, though that can cause issues if I then want to move the variable within the match statement, which was generally the idea of the logic I was trying to write. > > What got me was that the same logic but with nested match statements works just fine. > > I'm still not clear on this, but it seems that the inline tuple in the second tuple-based approach is a variable that takes ownership of the variables assigned to it. Which makes perfect sense ... my simple mind just thought of it as syntax for interleaving multiple match statements I suppose. In the case of nested match statements however, I'm guessing that each match statement is its own scope. > > The main thing I haven't been able to clarify is what are the ownership dynamics/behaviours of match statements?? It seems that there's maybe a bit happening implicitly here?? I haven't looked super hard but it does seem like something that's readily glossed over in the materials I've seen thus far?? > > ### General Implications > > AFAICT: > * if you want to match on two or more variables simultaneously, you'll probably need borrow them in the match statement if they're anything but directly owned variables. > * If you want to then use or move them in the match arms you may have to wrangle with ownership or just use nested match statements instead (or refactor your logic/implementation). > * So probably don't do multi-variable matching unless the tuple of variables is a variable native to the logic? -
No match from simple regex in python
hello guys. i am trying to match one or more digit from end of string ``` import re
print(re.match(r'\d+$', "hello001")) print(re.match(r'[0-9]+$', "hello001")) ``` output None from both print statement. I've tried my regex on regex101.com and it seems working probably.
-
Rust Atomics and Locks by Mara Bos | Resource Not Made For Beginners
marabos.nl Rust Atomics and Locks by Mara BosLow-level Concurrency in Practice. This practical book helps Rust programmers of all levels gain a clear understanding of low-level concurrency. You'll learn everything about atomics and …
cross-posted from: https://discuss.online/post/5803977
> > # About this Book > > > > The Rust programming language is extremely well suited for concurrency, and its ecosystem has many libraries that include lots of concurrent data structures, locks, and more. But implementing those structures correctly can be difficult. Even in the most well-used libraries, memory ordering bugs are not uncommon. > > > > In this practical book, Mara Bos, team lead of the Rust library team, helps Rust programmers of all levels gain a clear understanding of low-level concurrency. You’ll learn everything about atomics and memory ordering and how they're combined with basic operating system APIs to build common primitives like mutexes and condition variables. Once you’re done, you’ll have a firm grasp of how Rust’s memory model, the processor, and the role of the operating system all fit together. > > > > With this guide, you’ll learn: > > > > - How Rust's type system works exceptionally well for programming concurrency correctly > > - All about mutexes, condition variables, atomics, and memory ordering > > - What happens in practice with atomic operations on Intel and ARM processors > > - How locks are implemented with support from the operating system > > - How to write correct code that includes concurrency, atomics, and locks > > - How to build your own locking and synchronization primitives correctly > > Available free of charge. But I doubt I'll ever read it. Never enough time and energy for everything. >
-
Data Structures in Rust
What are some tips and tricks and best practices with rust?
Also, I'm used to clearly defined classes and implementation files with C++. Are there any tips and tricks on that with Rust? I haven't found any decent commentary/ documentation on figuring this out correctly with Rust. Yes, I know Rust is not an oop language, but I'm having issues creating clear separation of files so they don't become a scrolling dungeon.
-
Rust for Lemmings Reading Club - Alternate Slot (18:00 UTC+1)
See [email protected] for future updates.
cross-posted from: https://jlai.lu/post/4802347
> Hi all! > > # What? > > I will be starting a secondary slot/sessions for the Reading Club, also on "The Book" ("The Rust Programming Language"). We will, also, very likely use the Brown University online edition (that has some added quizzes & interactive elements). > > # Why? > > This slot is primarily to offer an alternative to the main reading club's streams that caters to a different set of time zone preferences and/or availability. > > # When ? > > Currently, I intend to start at 18:00 UTC+1 (aka 6pm Central European Time). Effectively, this is 6 hours "earlier in the day" than when the main sessions start, as of writing this post. > > The first stream will happen on the coming Monday (2023-03-04). > > Please comment if you are interested in joining because you can't make the main sessions but would prefer a different start time (and include a time that works best for you in your comment!). Caveat: I live in central/western Europe; I can't myself cater to absolutely any preference. > > # How ? > > We will start from the beginning of "The Book". > > There are 2 options: > 1. mirror the main sessions' pace (once every week), remaining ~4 sessions "behind" them in terms of progression through "The Book" > 2. attempt to catch up to the main sessions' progression > > I am personally interested in trying out 2 sessions each week, until we are caught up. This should effectively result in 2-3 weeks of biweekly sessions before we slow back down. I'm not doing this just for me, however, so if most people joining these sessions prefer the first option I'm happy to oblige. > > I will be hosting the session from my own twitch channel, https://www.twitch.tv/jayjader . I'll be recording the session as well; this post should be edited to contain the url for the recording, once I have uploaded it. > > # Who ? > > You! (if you're interested). And, of course, me.
-
Learning how to build integrations
I want to learn how to build integrations, such as how to connect two systems made by different companies that have different structures.
For example: To cut down on redundant data entry, I want to build an integration where the data is pushed from one software to another software. The integration would put the data from the source software into the correct fields in the destination software.
How do I go about learning how to build integrations? What classes to even start with?
I appreciate any guidance you can provide.
Edit: Thanks a bunch for the suggestions. I'm checking out those tools suggested in the comments and looking up classes to learn the skills needed.
-
In Postman, is there an easy way to change the athorisation of all request in a collection?
I get postman exports from students which I use to check their work. The authorisation of those requests now often contain hardcoded jwt tokens that are invalid by the time I get to checking them and I have to change every individual request with a global variable.
I do instruct my students to use variables, but there's always a couple who just don't, but that's a whole different issue.
Right now I'm using a regex find and replace to remove the Request authorization header in the json export file (which than defaults to 'inherit from parent'). This sort of works, but isn't ideal.
Do any of you know if postman offers an easier solution for this?
-
What's the current way of programming Windows?
I'm a seasoned programmer on Mac/Linux/iOS, and want to get into Windows application programming. Problem is, every time I try, Microsoft comes in a week later and discontinues the current framework in favor of something else. Because I need to use a C++ library, I started with C++/CX, just to be told C++/WinRT was the way to go etc.
I've lost track of what the current one is now and what has been discontinued, and can't for the life of me find recent information on the web.
Anyone here know where I can find info on what's the current one? It seems C# is still the main language, but what UI framework does one use? It used to be UWP, but now it seems WPF is back ... ?
My constraints are: I'm making Windows desktop applications, I need to be able to call into C++, and I want it to look like a modern application. I also need to create my UI from code (based on files provided by the user), not from XAML files.
-
Rust For Lemmings - Code Together | "The Rust Programming Language" book club meeting on twitch
cross-posted from: https://sh.itjust.works/post/13993219
> ## The concept > A streamed reading club focused on rusts The Book and becoming reasonably good rust developers through community collaboration. If you're interested, please comment so we know this's something you'd like to join in on. > > ## A Begining > To begin, I'll be setting up a twitch stream where we read through the book together and solve some problems together related to the concepts provided. We'll be able to collaborate in chat, and talk about it here after each stream. This way, we'll be able to lean on each other or just hang out while we learn the language Lemmy uses for it's backend. Other hosts will be welcome as the end goal is to create a group of people whose goal is to support our collective growth as developers > > Anybodies welcome of any skill set, whether or not they want to continue on once we get to lemmys code base. If you're completely new to rust this is a great place to start and if you already know the language we'd love to have you all the more. At the very least it's a good networking opportunity but you'll likely learn more than you thought. > > ## Timing > Please comment your availability so we can find the best time and day to do this. As a stand-in and default though, 6:30pm EST (New York Time) on tuesday will be the start time. I'd be available on most days myself after 5pm Eastern Time (new york) though so don't hesitate to suggest another time/date. > > ## Where? > For now, I'll be streaming this on a twitch channel I created a bit ago but never used. The link is here: https://www.twitch.tv/deerfromsmoke > > Thank you @[email protected] for the idea.
-
New community for learning rust and the lemmy codebase together
lemmy.ml Learning Rust and Lemmy - Lemmy# Welcome A collaborative space for people to work together on learning Rust, learning about the Lemmy code base, discussing whatever confusions or difficulties we’re having in these endeavours, and solving problems, including, hopefully, some contributions back to the Lemmy code base. Rules TL;DR: ...
cross-posted from: https://lemmy.ml/post/11456831
> Hi all, > > We've started a new community for learning rust and/or the lemmy codebase together. > > Come join in: [email protected] > > The idea is that there are probably a good amount of people interested in learning rust, or, interested in contributing to or using the lemmy codebase, but find it difficult to get started ... so basically why not start a sort of study group or reading group or support channel style of community? Here's where the idea was originally suggested: https://lemmy.ml/post/11232276 > > We're just putting the place together and sorting out how it could work, but all kinds of inputs and levels of expertise are welcome!
-
Julia Programming Tutorial | An effective tutorial for science and engineering
www.matecdev.com Julia Programming TutorialThis introductory tutorial about Julia focuses on its use in Science and Engineering.
cross-posted from: https://programming.dev/post/9470319
> Martin D. Maas writes: > > > Julia is an is a general-purpose, open-source, dynamic, and high-performance language. By leveraging a clever design around a just in time (JIT) compiler, Julia manages to combine the speed of languages like C or Fortran, with the ease of use of Matlab or Python. > > > This is a hands-on tutorial series, which focuses on understanding the most important aspects of the language from a practical point of view, and focusing on the needs of scientists and engineers. > > > > In particular, we won’t be introducing much more syntax or language features than what is required to solve the different problems we will be tackling. > > > > As a quick reference, and if you have experience with Python or Matlab, it might be worth to check out the Matlab-Python-Julia Cheatsheet. > > Read Julia Programming Tutorial > Total: 37 posts > Last updated: November 13, 2023
-
Advice on where to begin with GUI programming?
I realize this is a very broad question, so to help I'll mention that my primary experience with any programming language is Python. I've looked into C and C++ as well, but I haven't written much in them; in part because they're more involved, and in part because I get lost in the IDE weeds with'em (whether choosing an IDE or getting it configured to even get started tbh, but that's mostly a different topic).
In Python I know there's an option in Tkinter, and I've worked with it to some extent but never got entirely comfortable with it. Maybe it would be best to try making some more stuff with it instead of bouncing around different things, but would that be advisable over something that may be better suited to the task?
If it would be better to stick with it, what might be some things you wish you'd known starting out with GUI programming (whether particular to Python or generally applicable)?
-
[Question] What is the proper way to implement a pure-backend oauth security in SpringBoot?
I know how to implement basic oauth. My problem is that if I make a simple security filter like:
` @Bean
public SecurityFilterChain configure(HttpSecurity http) throws Exception { http .authorizeHttpRequests(authorize -> authorize .anyRequest().authenticated() ) .oauth2Login(withDefaults()); return http.build(); }`
Than I can adress @GetMappings in my browser and get prompted a oauth login screen and login there, but I can't adress a PostMapping or GetMapping in postman, because it doesn't redirect to a login screen (you get the html for the login screen as the ResponseBody in postman)
I can get a valid acces token from auth0 via 'https://{yourDomain}/oauth/token', but if I simply pass that jwt along as a "Bearer token" in postman, it doesn't work. It still shows me the login-screen-html in the response body.
It seems to me there's two things I can do:
- Make sure postman bypasses the login screen. I maybe don't really want to do that, since I want my backend and frontend to communicate their security through jwt. Or else I have to convince other people (from a different department) to change the way they implement frontend security, which is a pain for everyone. (If it needs to happen, it needs to happen though)
- Make sure the backend parses the jwt somehow. Maybe an extra Filter that checks the jwt's validity with the provider? I'm not sure how to tackle this.
-
Can I email or text myself through Python or bash?
cross-posted from: https://beehaw.org/post/10863052
> Noob question incoming, thanks in advance for any help with this! > > I have a specific use case in which I want to send an automated email or text to myself once a day (the message is different each time--otherwise I would just set an alarm, lol!). I'm running Pop_OS on an old desktop computer. Where I'm stuck is getting an email to successfully send from the command line. I'm looking for easy-to-follow instructions that would help me do that, and none of the articles or videos I've come across thus far have helped. > > I'm aware of Twilio and other services that send SMS messages, but I'm looking for something free. Especially since I only need to text one person (myself), and infrequently at that. > > Below is my attempt to send an email with the telnet command. Nothing ever came through... > >
> XXXXXXXX@pop-os:~$ telnet localhost smtp > Trying ::1... > Connected to localhost. > Escape character is '^]'. > 220 pop-os ESMTP Exim 4.95 Ubuntu Sun, 07 Jan 2024 15:12:28 -0500 > HELO gmail.com > 250 pop-os Hello localhost [::1] > mail from: [email protected] > 250 OK > rcpt to: [email protected] > 250 Accepted > data > 354 Enter message, ending with "." on a line by itself > Subject: Test > Body: Is this working? > . > 250 OK id=1rMZW4-0002dj-Uy > quit >
> -
New RISC-V emulator for Computer Science education | GitHub - gboncoffee/egg: Emulador Genérico do Gabriel
github.com GitHub - gboncoffee/egg: Emulador Genérico do GabrielEmulador Genérico do Gabriel. Contribute to gboncoffee/egg development by creating an account on GitHub.
cross-posted from: https://programming.dev/post/8298023
> More Discussion on Hacker News: > > New RISC-V emulator for Computer Science education (github.com/gboncoffee) > > Just released EGG, an emulator created for teaching Assembly and microprocessors (designed to suit the needs of the Microprocessors classes, at Universidade Federal do Paraná, Brazil). The emulator will support multiple architetures in the future, but currently only RISC-V is implemented. > > The
egg
package itself provides only an interface for interacting with machines, thus supporting different architeture backends. Currently, the only backend implemented is egg/riscv, which implements a RISC-V IM 32 bits machine. A MIPS backend is coming soon. > >egg/assembler
also provides a small library for creating assemblers, and the support for EGG's debugger. > -
React Js vs. React Native
javascript.withcodeexample.com ReactJS vs. React NativeThis comprehensive guide dissects the differences between the two powerful frameworks ReactJS vs. React Native, shedding light on their unique characteristics, use cases, and considerations for developers.
-
Anyone uses IRC? Why?
I was exploring an obscure Linux distro when I noticed they're contact page had an IRC client. You can connect to the IRC via Matrix, but the people there prefer pure IRC.
My question is do other programmers use IRC? Also why?
-
#100DaysOfCode Challenge for 2024 – freeCodeCamp Discord Edition
www.freecodecamp.org #100DaysOfCode Challenge for 2024 – Discord EditionfreeCodeCamp always gets a huge rush of ambitious learners on New Year's Day. And each year, I try to create challenge that will help people stick with their learning. In the past, we've had cloud certification challenges, gamedev challenges, and back end development challenges. This year, we're goi...
-
Stick with kotlin?
I decided to go for kotlin as my first language because I had ideas for a mobile app. I quickly learned that android dev isn't the best starting point, and I'm not a fan of the lack of choice I have for editors with it. I only really know some basics, I used to know some javascript but forgot it
-
AoC Input fetch tool (Rust)
cross-posted from: https://lemmy.world/post/9117180
> If you're writing Advent of Code solutions in Rust, then I've written a crate that can fetch the user input data directly from the main website. > > Long story short, you provide it a login token copied from your browser cookies, and it can fetch the input data by year and day. Inputs are cached locally, so it'll only download it once for a given problem. This was heavily inspired by the PyPi advent-of-code-data package. > > Unlike other AoC-centric Rust crates, that's all it does. The other crates I've seen all want the code structured in a specific way to add timing benchmarks, unit testing, and other features. I wanted something lightweight where you just call a function to get the input; no more and no less. > > To use the crate: > * Follow the AoCD instructions to set the AOC_SESSION environment variable.\ > This key is used for authentication and should not be shared with anyone. > * Add the
aocfetch
crate to your Cargo.toml[dependencies]
section:\ >aocfetch = { git = "https://github.com/ooterness/AdventOfCode.git" }
> * Import the crate and callaocfetch::get_data(year, day)
to fetch your input data. > > An example: >> use aocfetch; > > fn main() { > let input = aocfetch::get_data(2023, 1).unwrap(); > println!("My input data: {}", input); > println!("Part 1 solution: 42"); // TODO > println!("Part 2 solution: 42"); // TODO > } >
> > If this goes well I will submit it to crates.io, but I wanted to open this up for beta-testing first. -
Big O notation is about what matters when the numbers get big.
It's about asking, "how does this algorithm behave when the number of elements is significantly large compared to when the number of elements is orders of magnitude larger?"
Big O notation is useless for smaller sets of data. Sometimes it's worse than useless, it's misguiding. This is because Big O is only an estimate of asymptotic behavior. An algorithm that is O(n^2) can be faster than one that's O(n log n) for smaller sets of data (which contradicts the table below) if the O(n log n) algorithm has significant computational overhead and doesn't start behaving as estimated by its Big O classification until after that overhead is consumed.
#computerscience
Image Alt Text:
"A graph of Big O notation time complexity functions with Number of Elements on the x-axis and Operations(Time) on the y-axis.
Lines on the graph represent Big O functions which are are overplayed onto color coded regions where colors represent quality from Excellent to Horrible
Functions on the graph: O(1): constant - Excellent/Best - Green O(log n): logarithmic - Good/Excellent - Green O(n): linear time - Fair - Yellow O(n * log n): log linear - Bad - Orange O(n^2): quadratic - Horrible - Red O(n^3): cubic - Horrible (Not shown) O(2^n): exponential - Horrible - Red O(n!): factorial - Horrible/Worst - Red"
- realpython.com Single and Double Underscores in Python Names – Real Python
In this tutorial, you'll learn a few Python naming conventions involving single and double underscores (_). You'll learn how to use this character to differentiate between public and non-public names in APIs, write safe classes for subclassing purposes, avoid name clashes, and more.
-
The Hitchhiker’s Guide to Python! - Code Style
cross-posted from: https://programming.dev/post/6591042
> I'm pretty new to Python and discovered the nicely presented PEP8 coding style guide linked in the post. Stumbling onto The Hitchhiker’s Guide to Python! has been a very helpful compliment to the official Python Documentaion > > Hopefully this post will help others getting familiar with Python.
-
Learn Python from interactively @ futurecoder.io
futurecoder.io futurecoder: Learn to code from scratch100% free and interactive Python course for beginners
This looks like a great starting point for people with little to no experience with programming to learn to program using Python.
Everything taught by futurecoder.io can be used locally on your own computer. But futurecoder.io doesn't show you how to install Python on your machine but you can fill in that gap with the information provided @ https://wiki.python.org/moin/BeginnersGuide/Download
Other resources are provided on the python.org Beginners Guide if needed.
-
Arduino for Everybody - freeCodeCamp.org YouTube Video Course
www.freecodecamp.org Arduino for EverybodyArduino is an open-source electronics platform that allows you to create interactive devices with sensors and outputs. With Arduino, you can build DIY electronics projects with minimal technical knowledge. We just published a comprehensive Arduino course on the freeCodeCamp.org YouTube channel. The ...
This looks like a good entry point for people that want to get into embedded software with a course on Arduino hardware fundamentals.
It's a 10 hour course that includes 14 hands on projects.
-
Learning SQL
cross-posted from: https://lemmy.zip/post/5296302
please make suggestions on the original post to help the original poster
> I’ve started to take an intro SQL class but I want to find more places to practice. > Do any of you have recommendations for sites that I can use to practice creating queries based on pieces of information someone is looking for? > > Any other advice to give to a brand new SQL learner? > > Thanks in advance for any guidance.
-
I'm posting a daily Dart solution to last year's Advent of Code challenges
lemmy.world Nadvent of Code - 2022 Day 1 - Lemmy.WorldAs 2023 Advent of Code is approaching fast, I thought I’d revisit my 2022 entries, and I realised a good focus would be to post one a day during November. No guarantees as to the quality of the algorithms used, but hopefully people will find the code readable and interesting. If anyone has questions...
cross-posted from: https://lemmy.world/post/7820165
> Hi all, > > Advent of Code is an annual programming challenge that runs from 1st to 25th December each year where each day a new puzzle is published for you to solve. The puzzles ramp up in difficulty during the month and can test your familiarity with core computer science principles and algorithms. > > As the title says, I'm currently going through my entries to last year's challenge and rewriting them to run easily in DartPad. I'll be posting one a day until 25th November to the Advent of Code community, so if you're interested in seeing how they all turn out, please follow the link above and subscribe. > > Cheers, Michael
- javascript.withcodeexample.com Mastering Event Delegation in Javascript
Discover the power of event delegation, a crucial concept in web development, and learn how it simplifies event handling, improves code efficiency, and enhances the user experience.