carapace, to golang
@carapace@mastodon.social avatar

Is this a bug in Go's regexp package? This program should print false instead it prints true:

package main

import (
"fmt"
"regexp"
)

func main() {
r := regexp.MustCompile("^1|0$")
fmt.Printf("%v\n", r.MatchString("00"))
}

I checked against Python's re module and it works as expected:

>>> import re
>>> r = re.compile('^1|0$')
>>> print(r.match('00'))
None

#go #golang #google

nurkiewicz, to random
@nurkiewicz@fosstodon.org avatar

So I'm watching this premium #Go tutorial. The expert shows how fetching 3 URLs sequentially takes 2.1s, whereas running concurrently takes only... 400ms. Both "tests" in the same process. I'm pretty sure connection pooling, DNS caching, HTTP caching and so on contributed much more than #goroutines... And I thought using float32 for money, a few chapters back, was bad

Wisesnail, to goodomens
@Wisesnail@mastodon.social avatar

I've got a few artworks that I forgot to share after I painted them, so have one while I can't paint because I'm enjoying Japan 💙

I hope you like it!

wloczykij, to linux Polish

Ten post głównie zainteresuje adminów linuksowych, ale inni użytkownicy Linuksa także będą zadowoleni.

Wczoraj odkryłem ciekawy program, którego szukałem od lat :). Mowa o programie . Z wyglądu i funkcjonalności przypomina program na desktopa o nazwie .

Z opisu wynika, że obsługuje także inne platformy:

Written in - for , , *BSD, (termux) and

Ja mam odhaczone wszystkie 3 punkty z ich listy, czemu warto używać tego programu :)

  • You're debugging on a remote machine and need to study a pcap.
  • You don't want to copy it back to your desktop.
  • You're familiar with Wireshark. 😃

Poniżej link do strony:
https://termshark.io/

Co do pakietów, na ubuntu 22.04 jest dostępna wersja w repo, choć stara, bo wersja z 2021 roku.

@linux_pl





















galdor, to random
@galdor@emacs.ch avatar

In #Go, you cannot call the String method on a literal URL struct ("cannot call pointer method String on url.URL") because the String method has a pointer receiver. String does not modify the object, but it uses a pointer receiver to avoid copying the object for each call.

This is what you get when 1/ you design a language with pointers (why would you do that in 2009?) and 2/ you do not have "const".

Just bad design.

kellogh, to random
@kellogh@hachyderm.io avatar

the #gpt4o news is cool, but now i want to see an embedding model that i can use with a streaming interruptible conversation

kellogh,
@kellogh@hachyderm.io avatar

also, now with #gpt4o, latency is going to be critical if you’re doing streaming audio/video, so #python may start looking less appealing. what’s the new #LLM language? #rust? #go? #cpp? #fortran?

#rustlang #golang

thejapantimes, to business
@thejapantimes@mastodon.social avatar

Ride-hailing services have been used more frequently in Tokyo than traditional taxis so far, a transport ministry report has shown. https://www.japantimes.co.jp/business/2024/05/11/ride-hailing-more-taxis-tokyo/

bentsukun, to random
@bentsukun@mastodon.sdf.org avatar

Two new versions released with security fixes, 1.22.3 and 1.21.10. Already available in HEAD!

Wisesnail, to goodomens
@Wisesnail@mastodon.social avatar
TehPenguin, to rust
@TehPenguin@hachyderm.io avatar

When posting your programming language comparison article, can you please include the context of your comparison?

"Rust vs Python, which is better? "
"Sir, this is a kernel"

"Why I switched from C++ to Go"
Taps sign: "No GC or green threads in the kernel"

Sincerely, a systems dev who'd like to remind you that APIs existed before REST...

hynek, to random
@hynek@mastodon.social avatar
sirber, to Laravel
@sirber@fosstodon.org avatar

#Laravel / Eloquent looks way easier than #nestjs / typeorm and #go / #gin / #gorm 😅

#php #webdev

leanpub, to ComputerScience
@leanpub@mastodon.social avatar

Build Your Own Database From Scratch by build-your-own.org is on sale on Leanpub! Its suggested price is $29.00; get it for $19.75 with this coupon: https://leanpub.com/sh/GVNwqXYy #ComputerProgramming #Databases #Go #SoftwareArchitecture #ComputerScience

EricMesa, to golang

A few thoughts on Programming languages

Just a few thoughts on programming languages that have been rattling around in my head this week, but which don’t each merit a full blog post. The main theme is that the culture behind each programming language leads to some interesting choices, as is the case with spoken languages.

This week I started learning how to program in Rust. Even though I’m using the project-based Command-Line Rust to learn, the author still went with the traditional “Hello, world!” project for the first intro to the language. I was also working on a Go project last week and so it immediately stood out to me that (at least as taught by this author) Rust has the print! macro that allows you to succinctly print to the command line. By contrast, Go requires importing fmt before you can print. This was the first topic that was swirling around in my head this week. What makes language designers choose whether printing output (one of the most basic things a program can do) is built-in or requires an import. I even remember back when I was learning Java in undergrad (I think it was Java 1.8, but I don’t remember) we had to use the savitch library just to get program input (another very basic computer program concept). As I thought about it, I wondered if it has to do with thoughts around compilation and whether the language designers think you’re mostly making user-interactive programs or libraries? It makes sense to me that scripting languages like Python, Ruby, and Perl would have print built-in since you always have to have the interpreter along with you, so all the basics should be there. (The original Batteries Included Python promise, for example) But perhaps the Go developers thought you wouldn’t always be printing to the command line so a more efficient binary could be compiled by forcing you to import the functionality? I’m not entirely sure.

The next thing I started thinking about, again due to learning Rust, was the mutability of variables. In most languages I’ve come across (I think all, except Haskell) all variables are mutable by default. It almost seems pointless to have a non-mutable variable. I understand why many languages have the concept of a “contanst” modifier/keyword. Unlike normal variables, THIS ONE does not change. But the opposite seems so weird since most of what we often do in programming involves changing the value in a variable. Perhaps as I learn more about Rust, I’ll understand their reasoning, but this seems completely backwards to me.

Both Rust and Golang use structs to organize variables where Ruby, Python, and Java use objects. But when both Go and Rust allow you to “attach” methods/functions to structs – is there a true distinction between object-oriented programming and struct-based programming? It seems like it’s just semantics (in the generic sense of the word) – at least at the level at which I program. The only difference I can see is that structs don’t have inheritance, although Go’s “types” solve some of the same problems.

Today’s (the day I’m writing this, not the day it’s going to be posted) shower thought was about programming language versions. On one end you have Java (I think now on version 22) and C# (now at version 12). On the other you have Python and Ruby (both at version 3). Perl essentially stopped at 5 with Perl 6 evolving into Raku. I don’t know what Java is up to. But I think C# is actually using the versions correctly – I’ve heard that each version introduces completely different ways of doing things and that the way you program C# depends strongly on when you jumped in. This is why Python is probably never moving to v4 unless they need to make some kind of huge change. Rust is an outlier with year-based versions. I guess that’s fine, but doesn’t tell you anything like a proper semantic versioning could.

Finally, I know that Rust is the newest of all the programming languages I’ve learned, but I really love how new projects are started. Python isn’t horrible, but it’s currently suffering from a lots of ideas, none of which has complete market share. You could do a simple virtual environment or you could do a more complex virtual environment/lock file situation with Poetry. (And there are about another half dozen variations on these two themes) But Rust….Rust deserves a chef’s kiss. When you start a new project with “cargo new project-name”, not only does it set up your directory structure, but it does a whole bunch of great setup tasks. It creates your Cargo.toml file (with Python, which only really started supporting toml files at the project level a few years ago, you need to look at documentation to figure out what goes in there) so that you have all the basics in there already. But it doesn’t stop there! It also, in a nod to modern programming, creates a git repository AND a gitignore file. It’s a thing of beauty. I would absolutely love for Python to move in this direction officially (not through a random user choice) for their defaults. Even “go mod init” could benefit from setting up a git repo and a git ignore (since the toml is not how Go works – I think they would probably best set up a README.md since Go’s default packaging is through git repos).

https://wp.me/p5cs3g-4HT

leanpub, to devops
@leanpub@mastodon.social avatar

Network Automation Crash Course https://leanpub.com/b/networkautomationcrashcourse by GitforGits | Asian Publishing House is the featured bundle on the Leanpub homepage! https://leanpub.com #Go #Networking #Docker #Devops #CloudComputing #Apis #Python #DistributedSystems

stefano, to golang
@stefano@bsd.cafe avatar

Interesting reading: Go performance from version 1.0 to 1.22

https://benhoyt.com/writings/go-version-performance-2024/

#go #golang #programming #performance

kowalabearhugs, to rust
@kowalabearhugs@mstdn.social avatar

Calling all #Solidity #Rust #Go #PHP #TypeScript hackers, apply for the 1st ever #Monero Hackathon.. https://monerokon.devfolio.co

  • Free entry to #MoneroKon2024 🎟️
  • Free food & drinks 🥪🍻☕️
  • Hackers can crash overnight @ Paralelni Polis 😴
  • $6k+ in prizes & bounties 🏆 including a 2000 USD paid in XMR award from the MAGIC Monero Fund (subject to increase)
  • max: 100 ppl.

https://monerokon.devfolio.co/

leanpub, to ComputerScience
@leanpub@mastodon.social avatar

Build Your Own Database From Scratch by build-your-own.org is on sale on Leanpub! Its suggested price is $29.00; get it for $19.75 with this coupon: https://leanpub.com/sh/BjexLW1x

dusnm, to random
@dusnm@fosstodon.org avatar

People complain too much about error handling in #Go. Like it or not, go treats errors like any other value. Since the compiler forces you to use all return values of functions, unless you specifically discard the error, you're always aware of which functions can error and that goes a long way to improve the reliability of your software.

Java has checked exceptions, JavaScript trusts you to know that a function 20 slots down the call stack has an unhandled error.

#ErrorHandling

83r71n, to Cybersecurity
@83r71n@ioc.exchange avatar

A critical vulnerability, named BatBadBut, was discovered in the Rust programming language, affecting not just Rust but also Erlang, Go, Python, Ruby, and potentially others. This vulnerability, with a severity score of 10/10, could allow attackers to execute arbitrary commands on Windows systems by exploiting how Rust handles batch files. The issue arises from Rust's standard library improperly escaping arguments when invoking batch files on Windows, leading to potential command injection. The vulnerability has been addressed with a fix in Rust version 1.77.2, which developers are urged to update to. Other programming languages and systems, including Node.js, PHP, and Java, are also affected and are working on patches.

https://flatt.tech/research/posts/batbadbut-you-cant-securely-execute-commands-on-windows/

https://blog.rust-lang.org/2024/04/09/cve-2024-24576.html

#cybersecurity #rust #batbadbut #vulnerability #erlang #go #python #ruby #nodejs #php #java #windows #commandinjection #RyotaK #Grub4K #flattsecurity

cuddle, to random
@cuddle@bsd.cafe avatar

There are just too many "problems" with C++. I wish modern C++ was something back in the day, so we won't have to suffer.

Libraries still uses iostream to display in stdout/stderr and it's certainly not my favorite. It's slow, bloated, and isn't even describable.

e.g.
std::cout << a.x << " " << a.y << " " << a.z << '\n';
vs
std::println("{} {} {}", a.x, a.y, a.z);

And here we come, standard of string

why:
std::string a = "Hello world";
if (a.find('r') != std::string::npos)
fmt::println("{}", pos);
else
fmt::println("not found");

and why not:
std::string a = "Hello world";
if (a.contains('r')) // Do member function overloading in the class
fmt::println("{}", pos);
else
fmt::println("not found");

why standard doesn't implement trimming functions for white spaces? why do I always have to rely on iterators for such things... (it's just feels like I've to type too much for a basic functionality)

and there's more but let's keep this post small.

jhx,
@jhx@bsd.cafe avatar

@cuddle
Sometimes when I need a break I go over and code something small with #Go
It is quite relaxing to do something in much less lines of code.
I love C in generel - the simplicity is divine.
Just sometimes one needs a break 🙂
I lack C++ experience... the small things I do on C++ does not make me competent to give any kind of experience.

Chewing away on code can be daunting, that is for sure.

Maybe you need a break from C++ @cuddle ? 🙂

thejapantimes, to business
@thejapantimes@mastodon.social avatar

Private drivers with their own vehicles can now be hailed for rides in Tokyo, marking the first time in Japan that ride-hailing has been put into practice after the system was introduced on April 1. https://www.japantimes.co.jp/business/2024/04/08/tech/tokyo-ride-hailing/ #business #tech #ridehailing #uber #didi #go #sride #apps #sharingeconomy #driving #jobs

leanpub, to ComputerScience
@leanpub@mastodon.social avatar

Build Your Own Database From Scratch: Persistence, Indexing, Concurrency https://leanpub.com/build_your_own_database_from_scratch by build-your-own.org is the featured book on the Leanpub homepage! https://leanpub.com #ComputerProgramming #Databases #Go #SoftwareArchitecture #ComputerScience

purelinux, to golang German
@purelinux@social.tchncs.de avatar

Whats your favorite ? And why?

Wisesnail, to goodomens
@Wisesnail@mastodon.social avatar

I can relate, #Crowley... I really can! 🙈

I hope you like it 💙

#AnthonyJCrowley #DavidTennant #GoodOmens #GoodOmens2 #GO #GO2 #Wisesnail #Portrait

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • magazineikmin
  • Youngstown
  • osvaldo12
  • khanakhh
  • slotface
  • tacticalgear
  • InstantRegret
  • ngwrru68w68
  • kavyap
  • DreamBathrooms
  • thenastyranch
  • everett
  • rosin
  • provamag3
  • Durango
  • GTA5RPClips
  • ethstaker
  • modclub
  • mdbf
  • cisconetworking
  • anitta
  • Leos
  • cubers
  • normalnudes
  • tester
  • megavids
  • lostlight
  • All magazines