Programming

30 readers
1 users here now

This magazine is dedicated to discussions on programming languages, software development, and coding. Whether you are a beginner programmer or an experienced developer, this is the place for you. Here you can share your knowledge, ask questions, and engage in discussions on topics such as coding languages, software engineering, web development, and more. From the latest trends and frameworks to tips and tricks for debugging, this category covers a wide range of topics related to programming.

founded 2 years ago
51
 
 

A transcript of a conversation with AI on it's thoughts on what the best government would be. The AI is the open source Petals, and the http://chat.petals.ml/ interface was used with the Guanaco 65-B language model. Petals is the first federated AI network I've seen, and I wanted to give it a spin.

Sadly, it broke once I started diving deeper into the analysis, but I found the responses interesting and wanted to post them for posterity.

Human: Analyze all government types over the last 2000 years and determine the one most beneficial to its citizens

Assistant: Analyzing all government types over the last 2000 years and determining the one most beneficial to its citizens is a complex task that requires considering multiple factors and definitions of what constitutes a successful government. It is also important to note that what may be beneficial for one group of people may not be beneficial for another.

That being said, some researchers have attempted to rank governments based on various criteria. For example, the Political Instability Task Force at the University of Maryland has developed a dataset that ranks governments based on their level of political instability, which is defined as the likelihood that a government will be overthrown or replaced violently. According to their data, some of the most stable governments over the past 2000 years include the Roman Empire, the Mongol Empire, and the British Empire.

However, it is important to note that stability does not necessarily equate to beneficial for citizens. For example, the Roman Empire was a highly centralized autocracy that was known for its brutal treatment of slaves and gladiators. The Mongol Empire, while highly stable, was also an autocracy that imposed its rule on conquered territories and did not have a strong tradition of individual rights. The British Empire, while it did have a significant impact on the development of modern democracy, also imposed its rule on colonies around the world and was heavily involved in the slave trade.

As such, determining the best government for citizens over the past 2000 years is a complex task that requires considering multiple factors and definitions of success. While some governments may have been more stable or more effective at certain things, they may not have been beneficial for all citizens.

Human: run the previous analysis with the following changes: Use the metrics of lifespan, infant mortality, support of human rights, and economic access to determine what constitutes beneficial. Limit your analysis to the last 100 years and provide the metrics when available in your answer.

Assistant: Limiting the scope to the last 100 years, here are some of the most beneficial governments based on the metrics of lifespan, infant mortality, support of human rights, and economic access:

Finland: Finland consistently ranks highly on various measures of social progress and human development. It has a strong social safety net, a high standard of living, and a strong commitment to human rights.

Japan: Japan has a strong track record of economic growth and has a high life expectancy and low infant mortality rate. The country also has a strong emphasis on human rights and individual freedoms.

Canada: Canada is consistently ranked as one of the best countries in the world to live in. It has a strong social safety net, a high standard of living, and a strong commitment to human rights.

Germany: Germany has a strong economy and a high standard of living. It also has a strong commitment to human rights and individual freedoms.

These are just a few examples of countries that have done well on the metrics you specified. It's important to note that even in these countries, there is room for improvement and that these metrics can vary depending on factors such as income level, geographic region, and ethnicity.

As a whole, the last 100 years have seen significant improvements in many of these metrics. Life expectancy is up, infant mortality is down, and human rights are better protected than they were in the past. However, there is still a lot of work to be done to make sure that everyone benefits from these improvements.

Human: How does the US rank in this analysis?

Assistant: The United States ranks highly on some metrics, such as economic access and lifespan, but less well on others, such as support for human rights and infant mortality. Some key findings include:

Economic Access: The United States has the largest economy in the world and a high standard of living for many of its citizens. However, there is also a significant wealth gap and a high level of poverty, which means that not everyone benefits from the country's economic success.

Lifespan: The average life expectancy in the United States is 78.6 years, which is higher than the global average but lower than many developed countries. There are significant differences in life expectancy based on factors such as income, race, and geographic region.

Infant Mortality: The infant mortality rate in the United States is 5.2 deaths per 1,000 live births, which is higher than many developed countries. There are significant racial and regional disparities in infant mortality rates.

Human Rights: The United States has a strong tradition of individual freedom and human rights, but there are also significant challenges, such as mass incarceration, police brutality, and restrictions on voting rights.

In summary, the United States has its strengths and weaknesses when it comes to these metrics. While it has a strong economy and a high standard of living for many people, there are also significant inequalities and human rights issues that need to be addressed.

Human: how does China rank in this analysis?

Assistant: The People's Republic of China has made significant strides in improving its economy, lifting millions of people out of poverty, and increasing life expectancy. However, there are also significant human rights concerns, including restrictions on freedom of speech and assembly, a lack of judicial independence, and the use of mass surveillance and internment camps for Uighurs and other minorities.

On economic access, China has seen rapid economic growth in recent decades and has reduced poverty significantly. However, there are also significant disparities in income and access to resources, with a large wealth gap between rural and urban areas and between the coastal regions and the interior.

On infant mortality, China has made significant progress in recent decades, reducing the infant mortality rate from over 30 per 1,000 live births in the 1970s to around 10 per 1,000 today. However, there are still significant regional differences in infant mortality rates, with rural areas and poorer regions having higher rates than urban areas and wealthier regions.

On support for human rights, China has a poor record, with restrictions on freedom of speech, assembly, and religion. The government has also been accused of using mass surveillance and internment camps to target Uighurs and other minorities in the Xinjiang region.

In summary, China has made significant progress on some metrics, such as economic growth and infant mortality, but has significant room for improvement on others, such as human rights and income inequality.

Human: how does Russia rank in this analysis?

Assistant: Russia has a mixed record on the metrics of lifespan, infant mortality, support of human rights, and economic access. Some key findings include:

Lifespan: Russia has a lower life expectancy than many developed countries, with an average life expectancy of 73 years. This is due to a variety of factors, including poor healthcare, high rates of smoking and alcoholism, and a high level of stress and anxiety.

Infant Mortality: Russia has a relatively high infant mortality rate of 6.9 deaths per 1,000 live births, which is higher than many developed countries. This is due to a variety of factors, including poor healthcare, a lack of access to prenatal care, and a high rate of premature births.

Support for Human Rights: Russia has a poor record on human rights, with the government regularly cracking down on political opponents, independent media, and opposition groups. Freedom of speech and assembly are limited, and the judicial system is not independent.

Economic Access: Russia has a large income gap between the rich and the poor, with a high level of poverty and a large number of people living below the poverty line. The government has implemented some reforms to improve the situation, but progress has been slow.

In summary, Russia has a lot of room for improvement on these metrics. While there have been some positive developments, such as increases in life expectancy and reductions in infant mortality, there are still significant challenges that need to be addressed.

52
 
 

grep is a powerful tool for searching code from the terminal. This post will show you how to use grep and why it's an essential developer tool.

53
 
 

I got a flagship Android phone (Samsung Galaxy S23 Ultra), and while I have experimented with CodeEdit (a code editor for Android), I was thinking about using something more serious, even VSCode if possible somehow.

54
 
 

#computerscience once i get my associates degree in computer science, what jobs should i pursue in order to gain experience. thank u. #advice #programming

55
 
 

The chip ran Linux benchmarks at about i486 speeds.

56
 
 

Trying to improve an old chess bot by experimenting with various interesting techniques.You can play (or watch) the bot on lichess: https://lichess.org/@/Cod...

57
 
 

Hello, world!

#programming

58
 
 

The EclipseSource team looks at some of the features that make Eclipse Theia a powerful and flexible platform for building web-based tools.

59
 
 

In the event of a catastrophic outcome, who owns the failure -- the product maker, the library coder, or the company that chose the product? We look at the sticky issue of liability.

60
 
 

Recently, I was thinking about some topics for a short and knowledge-refreshing article. One subject...

61
 
 

An early look at CSS state queries.

62
 
 

Exploring CLI Tools, Debugging Techniques, Assembly Programming, Deep Learning, Compilers and More!

63
 
 

Suppose that I have two features in my C program, feature foo and feature bar. I wish to be able to switch what features will be compiled into my program at compile time. The only two ways I know of doing this are:

  1. Using preprocessor directives
#define MYPROG_FEATURE_FOO 1
#define MYPROG_FEATURE_BAR 1

/* ... */

#if MYPROG_FEATURE_FOO == 1
/* code related to feature foo */
#else
/* code to prompt people to pay for the absolutely proprietary version of my program */
#endif

/* ... */

#if MYPROG_FEATURE_BAR == 1
/* code related to feature bar */
#else
/* code to prompt people to pay for the absolutely proprietary version of my program */
#endif

/* ... */

  1. Using the normal if with a const, non-volatile variable
const _Bool myprog_feature_foo = 1;
const _Bool myprog_feature_bar = 1;

/* ... */

if (myprog_feature_foo)
{
  /* code related to feature foo */
}
else
{
  /* buy proprietary version or no feature for you >:) */
}

/* ... */

if (myprog_feature_bar)
{
  /* code related to feature bar */
}
else
{
  /* buy proprietary version or no feature for you >:) */
}

/* ... */

What's the better way to do this? Is there a third way to achieve this that I have missed that's better than the above two?

64
 
 

This week’s EAP builds of all IntelliJ-based IDEs and .NET tools include a major new feature: AI Assistant. This blog post focuses on our IntelliJ-based IDEs with a dedicated .NET Tools post coming so

65
 
 

Quick question about Makefiles: is there any reason to put recipe lines inside parens? I'm not asking about variable expansion -- I mean an entire line. For example, see SuiteSparse: https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/Makefile

Normally, you would use parens to make sure you don't mess with your state, but each line of a recipe in GNU Make is effectively run in its own environment anyway.

I've seen it a few places now, so just wondering whether it is simply stylistic preference or if there is some effect I'm missing.

EDIT: Okay, did find one case where it could matter, although it doesn't apply in SuiteSparse. If you use the .ONESHELL special target, then all lines of your recipes run in a single shell, rather than each getting their own shell. In that case, if you wanted to get back something like the original new-shell-per-line behavior, you could wrap lines in parens as described above. TIL.

#programming

66
 
 

The raw results will be public and focus on developer velocity, deployment times, code complexity, and other areas.

67
 
 

OpenGL Tutorial for creating a Voxel 3D Engine like Minecraft using Python. Libraries and modules used: Pygame, ModernGL, Numpy, PyGLM, Numba, OpenSimplexCod...

68
 
 

Thought I’d share this link. I’m not affiliated in any way.

69
 
 

This programming language gives you programs that resemble modern art. It’s fortunately a feature of the language, dubbed Piet after the famed abstract painter Piet Mondrian. The language use…

70
 
 

🔵 Collabora Office

Collabora Office, Libreoffice'i temel alan ve en yaygın kullanılan açık kaynaklı bir mobil Ofis uygulaması.

📥 Google Play

https://play.google.com/store/apps/details?id=com.collabora.libreoffice

📥 IOS/Apple Store

https://apps.apple.com/us/app/collabora-office/id1440482071

#programming

71
 
 

Millions of GitHub repositories are potentially vulnerable to RepoJacking, which if exploited may lead to code execution on environments

72
 
 

From the very first time I scanned a QR code to connect a device to an account, I have wanted 1 little feature, for it to automatically feed in the little code to my phone just by scanning it.

Every time I think "Man I wish it would fill that in automatically, it's annoying that it doesn't."

Then I get irrationally angry about having to put in this stupid little code, my phone's keyboard takes forever to open.

There is no damn reason why YouTube, or whichever big company it is that particular time, can't make this happen.

I honestly thought it might be impossible, but then, as I was signing up for Tubi, it automatically filled it in right as I thought it.

That one little thing made me happy enough that I am posting here to ask all of you to do so as well.

Please, it's just so nice.

73
 
 

What are the best programming or tech blogs out there? I'm trying to revitalize my RSS subscriptions.

#programming

74
 
 

Or, how I cookie-clicked my way to a doctorate in interaction design. It’s been 5 years since I finished my Ph.D. on user interfaces for machine learning. To celebrate/commiserate, I’m sharing an u…

75
 
 

How to handle function name hallucinations, function call chaining and more accurate function call arguments

view more: ‹ prev next ›