Feeds
Python Morsels: Assignment vs. Mutation in Python
In Python, "change" can mean two different things. Assignment changes which object a variable points to. Mutation, changes the object itself.
Table of contents
- Remember: variables are pointers
- Mutating a list
- Mutation
- Assignment
- Assignments versus mutations
- Changing variables and changing objects
When talking about Python code, if I say we changed X, there are two different things that I might mean.
Let's say we have two variables that point to the same value:
>>> a = [2, 1, 3, 4] >>> b = aRemember that variables in Python are pointers. That means that two variables can point to the same object. That's actually what we've done here.
Let's change the object that the variable b points to.
Mutating a listIf we append a number …
Read the full article: https://www.pythonmorsels.com/assignment-versus-mutation/Address formatting in QML
KDE’s KContacts framework provides API for locale-aware address formatting and address format metadata since quite some time, with an upcoming change this will all also be available for QML code directly.
Country-specific address formattingAddresses are generally formatted differently depending on the country they are in. Such differences can be whether the state or region is relevant/included, how different parts are ordered or how different parts are joined in the local language/script.
If we have address information in a somewhat structured form, ie. broken up into individual parts (street, postal code, city, country, etc), displaying that correctly requires knowledge of those formatting rules. As this is not an uncommon problem, the KContacts framework provides C++ API for this. Using that from QML without custom glue code is now also becoming possible.
pragma ValueTypeBehavior: Addressable import org.kde.contacts import QtQuick.Controls Label { text: { const addr = { country: "DE", region: "BE", locality: "Berlin", postalCode: "10969", street: "Prinzenstraße 85 F" } as address; return addr.formatted(KContacts.AddressFormatStyle.MultiLineInternational, "KDE e.V."); } }Different formatting styles are supported (single- or multi-line, international or domestic, for display or for postal mail labels).
Address format metadataAdditionally, the metadata necessary for formatting addresses can also be queried. This is useful for example for:
- Showing only the input fields in an address edit form actually relevant for a specific country.
- Input validation of postal codes, as shown in the code example below.
- Ordering input fields in the canonical order in a given country.
More elaborate examples can be found e.g. in Itinerary’s address/location editor.
What’s still missingReview and approval of this MR.
Russell Coker: Kogan 5120*2160 40″ Monitor
I’ve just got a new Kogan 5120*2160 40″ curved monitor. It cost $599 including shipping etc which is much cheaper than the Dell monitor with similar specs selling for about $2500. For monitors with better than 4K resolution (by which I don’t mean 5K*1440) this is the cheapest option. The nearest competitors are the 27″ monitors that do 5120*2880 from Apple and some companies copying Apple’s specs. While 5120*2880 is a significantly better resolution than what I got it’s probably not going to help me at 27″ size.
I’ve had a Dell 32″ 4K monitor since the 1st of July 2022 [1]. It is a really good monitor and I had no complaints at all about it. It was clearer than the Samsung 27″ 4K monitor I used before it and I’m not sure how much of that is due to better display technology (the Samsung was from 2017) and how much was due to larger size. But larger size was definitely a significant factor.
I briefly owned a Phillips 43″ 4K monitor [2] and determined that a 43″ flat screen was definitely too big. At the time I thought that about 35″ would have been ideal but after a couple of years using a flat 32″ screen I think that 32″ is about the upper limit for a flat screen. This is the first curved monitor I’ve used but I’m already thinking that maybe 40″ is too big for a 21:9 aspect ratio even with a curved screen. Maybe if it was 4:4 or even 16:9 that would be ok. Otherwise the ideal for a curved screen for me would be something between about 36″ and 38″. Also 43″ is awkward to move around my desk. But this is still quite close to ideal.
The first system I tested this on was a work laptop, a Dell Latitude 7400 2in1. On the Dell dock that did 4K resolution and on a HDMI cable it did 1440p which was a disappointment as that laptop has talked to many 4K monitors at native resolution on the HDMI port with the same cable. This isn’t an impossible problem, as I work in the IT department I can just go through all the laptops in the store room until I find one that supports it. But the 2in1 is a very nice laptop, so I might even just keep using it in 4K resolution when WFH. The laptop in question is deemed an “executive” laptop so I have to wait another 2 years for the executives to get new laptops before I can get a newer 2in1.
On my regular desktop I had the problem of the display going off for a few seconds every minute or so and also occasionally giving a white flicker. That was using 5120*2160 with a DisplayPort switch as described in the blog post about the Dell 32″ monitor. When I ran it in 4K resolution with the DisplayPort switch from my desktop it was fine. I then used the DisplayPort cable that came with the monitor directly connecting the video card to the display and it was fine at 5120*2160 with 75Hz.
The monitor has the joystick thing that seems to have become some sort of standard for controlling modern monitors. It’s annoying that pressing it in powers it off. I think there should be a separate button for that. Also the UI in general made me wonder if one of the vendors of expensive monitors had paid whoever designed it to make the UI suck.
The monitor had a single dead pixel in the center of the screen about 1/4 the way down from the top when I started writing this post. Now it’s gone away which is a concern as I don’t know which pixels might have problems next or if the number of stuck pixels will increase. Also it would be good if there was a “dark mode” for the WordPress editor. I use dark mode wherever possible so I didn’t notice the dead pixel for several hours until I started writing this blog post.
I watched a movie on Netflix and it took the entire screen area, I don’t know if they are storing movies in 64:27 ratio or if the clipped the top and bottom, it was probably clipped but still looked OK. The monitor has different screen modes which make it look different, I can’t see much benefit to the different modes. The “standard” mode is what I usually use and it’s brighter and the “movie” mode seems OK for the one movie I’ve watched so far.
In other news BenQ has just announced a 3840*2560 28″ monitor specifically designed for programming [3]. This is the first time I’ve heard of a monitor with 3:2 ratio with modern resolution, we still aren’t at the 4:3 type ratio that we were used to when 640*480 was high resolution but it’s a definite step in the right direction. It’s also the only time I recall ever seeing a monitor advertised as being designed for programming. In the 80s there were home computers advertised as being computers for kids to program, but at that time it was either TV sets for monitors or monitors sold with computers. It was only after the IBM PC compatible market took off that having a choice of different monitors for one computer was a thing. In recent years monitors advertised as being for office use (meaning bright and expensive) have become common as are monitors designed for gamer use (meaning high refresh rate). But BenQ seems to be the first to advertise a monitor for the purpose of programming. They have a “desktop partition” feature (which could be software or hardware – the article doesn’t make it clear) to give some of the benefits of a tiled window manager to people who use OSs that don’t support such things. The BenQ monitor is a bit small for my taste, I don’t know if my vision is good enough to take advantage of 3840*2560 in a 28″ monitor nowadays. I think at least 32″ would be better. Google seems to be really into buying good monitors for their programmers, if every Google programmer got one of those BenQ monitors then that would be enough sales to make it worth-while for them.
I had hoped that we would have 6K monitors become affordable this year and 8K become less expensive than most cars. Maybe that won’t happen and we will instead have a wider range of products like the ultra wide monitor I just bought and the BenQ programmer’s monitor. If so I don’t think that will be a bad result.
Now the question is whether I can use this monitor for 2 years before finding something else that makes me want to upgrade. I can afford to spend the equivalent of a bit under $1/day on monitor upgrades.
- [1] https://etbe.coker.com.au/2023/06/06/dell-32-4k-displayport-switch/
- [2] https://etbe.coker.com.au/2022/06/29/philips-438p1-43-4k/
- [3] https://www.benq.com/en-us/monitor/programming/rd280u.html
Related posts:
- Dell 32″ 4K Monitor and DisplayPort Switch After determining that the Philips 43″ monitor was too large...
- Philips 438P1 43″ 4K Monitor I have just returned a Philips 438P1 43″ 4K Monitor...
- cheap big TFT monitor I just received the latest Dell advert, they are offering...
This week in KDE: all about those apps
A few weeks ago, some of us discovered that KDE apps just looked terrible when run in GNOME. A lengthy discussion on icon theming ensued, with various improvements made on both sides. The KDE effort was spearheaded by Christoph Cullmann, as already described in his post on the subject. In a nutshell, KDE apps opting into the new system that are run outside of Plasma will always have the Breeze style and icons available, unless overridden by the system or the user. Apps opting in so far include Kate, Konsole, and Dolphin. Feel free to help opt more apps in by using those commits as inspiration!
Dolphin itself also received a lot of special attention this week, in addition to other cool stuff:
New FeaturesDolphin now gives you the option to enable previews for folders on remote locations. Be aware that this can cause slowdowns, and the UI tells you that, too (Sergey Katunin, Dolphin 24.08. Link):
Discover now handles the case where one of your Flatpak apps has been marked as “end of life” and replaced with another one; it gives you the opportunity to switch to the new one, or cancel and keep using the old one anyway (Harald Sitter, Plasma 6.1. Link):
Eagle-eyed readers have noticed this isn’t using the new dialog style. It hasn’t been ported yet. There are a lot of instances like this where Kirigami.OverlaySheet is inappropriately used as a confirmation dialog that need porting. UI ImprovementsDolphin’s ability to let you change things as root when kio-admin is installed has received a big upgrade: now it shows you a warning telling you what bad things you can do if you’re not careful, and also keeps a banner visible while you’re in root mode (Felix Ernst, Dolphin 24.08. Link):
Dolphin has received a number of UI improvements and better handling for viewing read-only folders (Jin Liu, Dolphin 24.08. Link)
Switched Spectacle over to using the common style for immutable toolview tabs in Kirigami apps (me: Nate Graham, Spectacle 24.08. Link):
KMenuEdit no longer annoyingly prompts you for confirmation when you delete a group (Kenny Hui, Plasma 6.1. Link)
The icons shown in our dialogs no longer themselves depict dialogs for mega dialog-ception; now they’re just normal colored icons (me: Nate Graham, Frameworks 6.3. Link):
Bug FixesAttempting to open multiple “New Folder” dialogs on a slow network location no longer causes Dolphin to crash (Akseli Lahtinen, Dolphin 24.08. Link)
Very small SVG images are now displayed properly in thumbnail previews (Méven Car, kio-extras 24.08. Link)
Fixed a case where our authentication system could crash and leave apps unable to request authentication (me: Nate Graham, Plasma 6.0.5. Link)
Turning on HDR mode no longer makes the screen colors wrong when using Night Color (Xaver Hugl, Plasma 6.0.5. Link)
Screens using fractional scale factors no longer get a weird row of pixels on the bottom edge that are held to the color of previously opened windows (Xaver Hugl, Plasma 6.0.5. Link)
Fixed several Plasma crashes that were introduced by porting some custom drag-and-drop code to the upstream Qt thing, but turns out to not be suitable for our purposes. Reverting to our custom code fixes the crashes (Kai Uwe Broulik, Plasma 6.1, Link 1 and link 2)
When Chromium-based browsers are running in native Wayland mode, dragging and dropping files into websites no longer makes them freeze and crash. This was a complicated bug largely caused by Chromium doing something unusual, but KWin now handles it properly (David Edmundson, Plasma 6.1. Link)
Visiting System Settings’ File Search page no longer sometimes causes a long hang when the file indexer is under heavy load (Janet Blackquill, Frameworks 6.3. Link)
If for some reason you want to use the Kickoff application launcher to search for a single character, close Kickoff, and then do the same thing again, the second search will now show results as expected (Alexander Lohnau, Frameworks 6.3. Link)
KSvg items and Kirigami.Icon used in Plasma now re-color re-colorable SVG images in the expected way when they’re displayed in Plasma irrespective of color scheme. This makes the CatWalk cat look correct while using a mixed light/dark global theme like Breeze Twilight (Marco Martin, Frameworks 6.3. Link):
Other bug information of note:
- 3 Very high priority Plasma bugs (same as last week). Current list of bugs
- 39 15-minute Plasma bugs (up from 38 last week). Current list of bugs
- 106 KDE bugs of all kinds fixed over the last week Full list of bugs
This blog only covers the tip of the iceberg! If you’re hungry for more, check out https://planet.kde.org, where you can find more news from other KDE contributors.
How You Can HelpThe KDE organization has become important in the world, and your time and labor have helped to bring it there! But as we grow, it’s going to be equally important that this stream of labor be made sustainable, which primarily means paying for it. Right now the vast majority of KDE runs on labor not paid for by KDE e.V. (the nonprofit foundation behind KDE, of which I am a board member), and that’s a problem. We’ve taken steps to change this with paid technical contractors—but those steps are small due to growing but still limited financial resources. If you’d like to help change that, consider donating today!
Otherwise, visit https://community.kde.org/Get_Involved to discover other ways to be part of a project that really matters. Each contributor makes a huge difference in KDE; you are not a number or a cog in a machine! You don’t have to already be a programmer, either. I wasn’t when I got started. Try it, you’ll like it! We don’t bite!
James Morrison: Goodbye Firefox
I've been on Chromebooks for a while. However, since I had to recently try a Mac, I figured it was time to give Firefox a try again. After two weeks of trying, I've given up. At least for myself, I figured I'd write down the reasons I've given up.
Reasons:
- There is no way from the tab context menu to move a tab between windows. I typically try to keep no more than 3 windows open at a time. Ideally one, but maybe a second. Without the ability to through the context menu to move a tab, I need a very large screen (not a laptop screen) to move tabs between windows.
- I couldn't find a way to take a URL and turn it into a custom search. This really is a critical feature as it allows me to use short names to access specific searches. E.g. search code (cs), show a calendar (c), etc.
Debian Brasil: MiniDebConf Belo Horizonte 2024 - um breve relato
De 27 a 30 de abril de 2024 foi realizada a MiniDebConf Belo Horizonte 2024 no Campus Pampulha da UFMG - Universidade Federal de Minas Gerais, em Belo Horizonte - MG.
Esta foi a quinta vez que uma MiniDebConf (como um evento presencial exclusivo sobre Debian) aconteceu no Brasil. As edições anteriores foram em Curitiba (2016, 2017, e 2018), e em Brasília 2023. Tivemos outras edições de MiniDebConfs realizadas dentro de eventos de Software Livre como o FISL e a Latinoware, e outros eventos online. Veja o nosso histórico de eventos.
Paralelamente à MiniDebConf, no dia 27 (sábado) aconteceu o FLISOL - Festival Latino-americano de Instalação de Software Livre, maior evento da América Latina de divulgação de Software Livre realizado desde o ano de 2005 simultaneamente em várias cidades.
A MiniDebConf Belo Horizonte 2024 foi um sucesso (assim como as edições anteriores) graças à participação de todos(as), independentemente do nível de conhecimento sobre o Debian. Valorizamos a presença tanto dos(as) usuários(as) iniciantes que estão se familiarizando com o sistema quanto dos(as) desenvolvedores(as) oficiais do projeto. O espírito de acolhimento e colaboração esteve presente em todos os momentos.
Números da edição 2024Durante os quatro dias de evento aconteceram diversas atividades para todos os níveis de usuários(as) e colaboradores(as) do projeto Debian. A programação oficial foi composta de:
- 06 salas em paralelo no sábado;
- 02 auditórios em paralelo na segunda e terça-feira;
- 30 palestras/BoFs de todos os níveis;
- 05 oficinas para atividades do tipo mão na massa;
- 09 lightning talks sobre temas diversos;
- 01 performance Live Eletronics com Software Livre;
- Install fest para instalar Debian nos notebook dos(as) participantes;
- BSP (Bug Squashing Party - Festa de Caça à Bugs);
- Uploads de pacotes novos ou atualizados.
Os números finais da MiniDebConf Belo Horizonte 2024 monstram que tivemos um recorde!
- Total de pessoas inscritas: 399
- Total de pessoas presentes: 224
Dos 224 participantes, 15 eram contribuidores(as) oficiais brasileiros sendo 10 DDs (Debian Developers) e 05 (Debian Maintainers), além de diversos(as) contribuidores(as) não oficiais.
A organização foi realizada por 14 pessoas que começaram a trabalhar ainda no final de 2023, entre elas o Loïc Cerf do Departamento de Computação que viabilizou o evento na UFMG, e 37 voluntários(as) que ajudaram durante o evento.
Como a MiniDebConf foi realizado nas instalações da UFMG, tivemos a ajuda de mais de 10 funcionários da Universidade.
Veja a lista com os nomes das pessoas que ajudaram de alguma forma na realização da MiniDebConf Belo Horizonte 2024.
A diferença entre o número de pessoas inscritas e o número de pessoas presentes provavelmente se explica pelo fato de não haver cobrança de inscrição, então se a pessoa desistir de ir ao evento ela não terá prejuízo financeiro.
A edição 2024 da MiniDebconf Curitiba foi realmente grandiosa e mostra o resultado dos constantes esforços realizados ao longo dos últimos anos para atrair mais colaboradores(as) para a comunidade Debian no Brasil. A cada edição os números só aumentam, com mais participantes, mais atividades, mais salas, e mais patrocinadores/apoiadores.
AtividadesA programação da MiniDebConf foi intensa e diversificada. Nos dias 27, 29 e 30 (sábado, segunda e terça-feira) tivemos palestras, debates, oficinas e muitas atividades práticas. Já no dia 28 (domingo), ocorreu o Day Trip, um dia dedicado a passeios pela cidade. Pela manhã saímos do hotel e fomos, em um ônibus fretado, para o Mercado Central de Belo Horizonte. O pessoal aproveitou para comprar várias coisas como queijos, doces, e lembrancinhas, além de experimentar algumas comidas locais.
Depois de 2 horas de passeio pelo Mercado, voltamos para o ônibus e pegamos a estrada para almoçarmos em um restaurante de comida típica mineira.
Com todos bem alimentados, voltamos para Belo Horizonte para visitarmos o principal ponto turístico da cidade: a Lagoa da Pampulha e a Capela São Francisco de Assis, mais conhecida como Igrejinha da Pampulha.
Voltamos para o hotel e o dia terminou no hacker space que montamos na sala de eventos para o pessoal conversar, empacotar, e comer umas pizzas.
Bolsas para participantesem breve
Financiamento coletivoPela segunda vez, fizemos uma vaquinha e conseguimos recursos para pagar algumas coisas (café da manhã, local, imprensa, crachá, cordões). A meta do crowdfunding era de R$ 3.000,00 e conseguimos R$ 3.940,00, recebemos de 62 doadores do Brasil e de outros países.
Cada participante recebeu: crachá, cordão personalizado, flyer com dicas "como contribuir com o Projeto Debian" e flyers de nossos patrocinadores.
Fotos e vídeosVocê pode assistir as gravações das palestras nos links abaixo:
E ver as fotos feitas por vários(as) colaboradores(as) nos links abaixo:
AgradecimentosGostaríamos de agradecer a todos(as) os(as) participantes, organizadores(as), voluntários(as), patrocinadores(as) e apoiadores(as) que contribuíram para o sucesso da MiniDebConf Belo Horizonte 2024.
PatrocinadoresOuro:
Prata:
Bronze:
Apoiadores Organização