• 开源镜像
  • 开源沙龙
  • 媛宝
  • 猿帅
  • 注册
  • 登录
  • 息壤开源生活方式平台
  • 加入我们

开源日报

  • 开源日报第866期:《数据分析 PyMiner》

    16 8 月, 2020
    开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
    今日推荐开源项目:《数据分析 PyMiner》
    今日推荐英文原文:《The Lazy Mindset of an Effective Programmer》

    今日推荐开源项目:《数据分析 PyMiner》传送门:项目链接
    推荐理由:PyMiner 是一个开源的数据处理、分析、建模、评估软件。开发者希望该项目能够成为国产的开源的MATLAB,并希望更多 MATLAB\PyQt\Python 大牛参与设计。详见:http://www.py2cn.com/
    今日推荐英文原文:《The Lazy Mindset of an Effective Programmer》作者:Szymon Adamiak
    原文链接:https://medium.com/better-programming/the-lazy-mindset-of-an-effective-programmer-68f4b70e3aac
    推荐理由:其实就是避免重复造意义不大的轮子,而把精力用在更有价值的地方。

    The Lazy Mindset of an Effective Programmer

    What does it mean to be a lazy programmer?

    Bill Gates supposedly said:
    I will always choose a lazy person to do a difficult job because a lazy person will find an easy way to do it.
    In reality, the quote probably came from Frank B. Gilbreth Sr. and concerned bricklayers, not software developers. Nevertheless, it’s a great quote that makes us think about the nature of good work.

    So what does it mean to be a lazy programmer? And should you be one?

    Shouldn’t I Work Hard?

    You probably think you need to work hard to become a programmer, let alone a good programmer. You’re right. Programming is an intricate craft; it takes thousands of hours of deliberate practice to become competent at it.

    So don’t let anyone fool you. Wherever you are on your career path, you’ll struggle a lot, and you need to be ready for the hurdles. You cannot allow yourself to be lazy; on the contrary, you should work as hard as you can.

    But you want to choose your battles wisely. Working smart is as important as working hard. And to work hard on some things, you have to be lazy in other areas.

    The hardest part of being a software developer is thinking. You don’t want to be lazy in that department; in fact, you should actively seek new challenges. You need your laziness somewhere else.

    What Does It Mean to Be a Lazy Programmer?

    A lazy programmer doesn’t want to do repetitive and mundane tasks. She gets bored quickly and seeks new adventures. She focuses on being productive, not hardworking. She achieves that by looking for patterns and automating everything to create maintainable and straightforward code.

    A lazy programmer knows every new line of code is expensive to write and maintain. Hence, she wants to write as little code as possible and avoids unnecessary frameworks and libraries. She doesn’t reinvent the wheel but uses already existing tools.

    A lazy programmer likes safety and knows she is error-prone. She understands machine errors are easier to find than human errors.

    A lazy programmer values her and her client’s time, so she focuses on the vital work, not on the number of hours. She devotes her time to the tasks that provide value for the client.

    In short — a lazy programmer leverages all the tools at her disposal to create the most value from the least time and code.

    Examples of Lazy Programmers

    Here are some lazy programmers’ achievements from the past. We should be endlessly grateful to them. They created tools to make theirs and our jobs more comfortable. So take a moment to praise our unsung heroes.

    Lazy programmers didn’t want to waste time on code formatting, so they created Prettier.

    Lazy programmers wanted to automate the tedious and error-prone deployment process, so they proposed Continuous Integration and Continuous Deployment.

    Lazy programmers were tired of typing this same code over and over again, so they created Emmet.

    Lazy programmers created all developer tools we are using because they wanted to make life easier. Be a lazy programmer; change the world for the better.

    How Can You Become a Lazier Programmer

    Imagine being able to do your days’ work with one click. Feeling useless? Well, your job is to make it happen. The best way to avoid making mistakes is not to do anything. So you need to automate and simplify your work as much as possible.

    To become a lazy programmer, use the tools others provided. I mentioned some earlier (Prettier, Emmet, CI/CD tools), but you can find tons of others. Look for code snippets and extensions for your IDE that will help you find bugs and enable autocompletion. Use linters to analyze your code and addons to autoclose brackets.

    Remember, you can write your shell scripts for repetitive commands. Always look for patterns in your daily job. If you have to do something several times a day or a week, try to automate it. Even if it takes just a few minutes each time, that automation will be worth it.

    Document your solutions. When you struggled for hours and solved a hard problem, you may feel you’ll remember that glorious fight forever. But you won’t. And you’ll reencounter this same bug. Wouldn’t it be nice to have a solution documented?

    Have you ever heard about testing? Everyone says it’s excellent, and everyone’s right. But how many of us write tests? Tests seem to take the time from the “real work.” But they save you the time you’d spend on debugging. So be a lazy programmer and write tests.

    Don’t automatically assume that every task you get should be done. Be brave enough to think if it’s necessary and brings real value. Challenge your superiors if you believe it’s not. We often work on autopilot, taking the next task on the list. By challenging others, we may learn that the task isn’t necessary, and you’ll have less work. Or maybe the task is crucial, and you’ll have a chance to learn why. Either way, you win.

    The time you devote to streamlining your work and making it easier is the most productive time of the day. So, make it a priority.

    Isn’t It Dangerous?

    You may wonder: isn’t it dangerous to automate your job away. If someone can do your job with one click, aren’t you obsolete? No, you’re not.

    You’re someone who can automate your job, so you’re skilled enough to have more demanding tasks. You provide real value to your client or employer, so finding a new job or a position will be a breeze.

    You’re not employed because you can do mindless assignments or code some trivial algorithms. Your job is to solve problems, and by automating your work, you prove you’re great at it. Problem solvers don’t need to worry about their careers. The employers fight for them.

    The real danger is someone else automating your job. If that happens, you’re in trouble. So dodge the bullet, and automate it first. After all, you know your job best.


    下载开源日报APP:https://opensourcedaily.org/2579/
    加入我们:https://opensourcedaily.org/about/join/
    关注我们:https://opensourcedaily.org/about/love/
  • 开源日报第865期:《遁入黑暗 halfmoon》

    15 8 月, 2020
    开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
    今日推荐开源项目:《遁入黑暗 halfmoon》
    今日推荐英文原文:《When DRY Doesn’t Work, Go WET》

    今日推荐开源项目:《遁入黑暗 halfmoon》传送门:项目链接
    推荐理由:这是一个类似于 BootStrap 的框架项目——通过 CSS 提供了各种常用页面组件,同时提供 JS 库作为附赠品,甚至连类名这些都和 BootStrap 差不到哪去,如果有过 BootStrap 使用经验的话很快就能上手。这个项目最大的亮点在于提供了简便的黑暗模式,只需简单的调用附加 JS 库中的一个函数,就能使页面自动切换到黑暗模式,从而更满足夜晚熄灯之后的使用需要。
    今日推荐英文原文:《When DRY Doesn’t Work, Go WET》作者:? Nick Bull JS
    原文链接:https://medium.com/better-programming/when-dry-doesnt-work-go-wet-6befda0444bf
    推荐理由:重复不可耻而且有用

    When DRY Doesn’t Work, Go WET

    It’s okay if you repeat yourself

    I’ve seen this mistake many times, and I’ve made it myself. When you first read about the DRY programming concept, you probably misunderstood it.

    What was going on in your head was this:

    Wikipedia: DRY stands for not repeating the same code twice.
    You: Hmm, ok I’ll replace all my duplications with abstraction.

    And it seems like a good solution, but it’s not. Your abstraction is often wrong.

    Here is why:
    1. You see duplication.
    2. You extract duplication into a new abstraction (method, class).
    3. You replace the duplication with the new abstraction.
    4. You think your code is perfect.
    5. Time passes.
    6. The product manager has new requirements. Your abstraction is almost perfect for them.
    7. You start to implement the new requirements.
    8. And here’s the little but:
    9. Your abstraction is almost perfect. Why? The new requirements affect only 95% of the old code you extracted into abstraction. The other 5% is not affected. And instead of creating a new abstraction with 95% copied code from the current one, you decide to change the code of your abstraction.
    10. You add a conditional statement, if..else for example, and pass a parameter, so your abstraction can perform different actions for different decisions.
    11. Now your abstraction behaves differently for different cases.
    12. Another new requirement arrives. Another additional parameter. Another new conditional. (Loop until code becomes very difficult to understand and maintain.)
    13. Congrats, you’ve created a wrong abstraction.
    The code no longer represents a single, common abstraction. It becomes a condition-laden procedure. It’s hard to understand and easy to break. Adding new features is incredibly hard and every new feature complicates the code even more.

    It’s an infinite loop.

    So what to do?

    Write Everything Twice.

    WET

    WET (Write Everything Twice) is the opposite concept to DRY. When you start to develop a new system you don’t know all the future requirements. So don’t rush into abstractions.

    You need to remember: Duplication is far cheaper than the wrong abstraction.

    For example, you are building a web app and don’t have a UI design for all pages right now. But you also have many buttons, and they’re similar on every page. You decide to move them to a component called Button and reuse it on every page. Seems logical.

    “Hey, hey!” the new page design came from the product manager. You look at it and find a new, fancy button at the bottom of the page.

    It looks like the old buttons, but it has this “one little thing.” To implement it, you need to rewrite 10% of your Button component, and add conditional statements and new parameters.

    Now you have a dilemma:
    • Change Button. Rewrite 10% of the abstraction code (add logical conditions to support new fancy button logic).
    • Create two abstractions: FancyButton and Button. Copy 90% code from Button to FancyButton.
    I know you want to choose the first option. You think that you can handle it. You’re not going to build the wrong abstraction.

    But the sad truth is, you will (except if you are an experienced programmer and know what you’re doing).

    Copy that code. Don’t be afraid.

    After a while, you will know what your buttons will look like in the future. Then you can analyze the current codebase, find duplicated code in the button components, and move them to the good abstraction.

    If It’s Too Late

    If you find that it’s too late to deal with a wrong abstraction, the fastest way to move forward is back.

    Do the following:
    1. Move the abstracted code back.
    2. Delete the unused parameter that’s passed to the abstraction to perform different actions for different decisions.
    3. Delete unused logic.
    This removes the abstraction and conditional statements for each caller.

    In the End…

    If you find yourself passing parameters and adding conditional statements through shared code, your abstraction is wrong.

    Prefer duplication over the wrong abstraction.

    Thanks for reading!
    下载开源日报APP:https://opensourcedaily.org/2579/
    加入我们:https://opensourcedaily.org/about/join/
    关注我们:https://opensourcedaily.org/about/love/
  • 开源日报第864期:《datasets》

    14 8 月, 2020
    开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
    今日推荐开源项目:《datasets》
    今日推荐英文原文:《US, UK employees working at least one extra week each month during COVID-19》

    今日推荐开源项目:《datasets》传送门:项目链接
    推荐理由:该数据集由全球多名摄影师贡献而成, 并且它的数据来自无限次的使用和亿万次的搜索, 这使得该数据集成为机器学习研究者极好的素材.
    今日推荐英文原文:《US, UK employees working at least one extra week each month during COVID-19》作者:Abrar Al-Heeti
    原文链接:https://www.cnet.com/health/employees-in-the-us-uk-work-an-extra-week-per-month-during-covid-19-report-says/
    推荐理由:疫情期间对全国的经济冲击都十分剧烈, 因此, 虽然疫情扔在蔓延, 但是还是不能停止人们复工的步伐. 中国有中国的996, 于此同时, 欧美国家的打工者们也面临增加工作时长的压力与挑战.

    US, UK employees working at least one extra week each month during COVID-19

    Americans have been putting in three extra hours per workday since the COVID-19 pandemic began, and UK employees have been adding two hours to each workday, according to a new report from business VPN provider NordVPN Teams. That amounts to at least an extra week of work each month compared with pre-pandemic times.

    In the US, the average workweek has increased by around 40% since April, with an extra 15 hours on the job, making it the largest increase globally, NordVPN Teams said Wednesday. Four months since that increase, US employees continue to spend three hours more on business VPNs each day, and UK employees continue to work two hours longer than usual.

    Other countries, including Canada and European nations like France and Spain, have returned to pre-pandemic work schedules, even though they’d also shown a two-hour increase in working hours in previous data. Throughout Europe, employees have started returning to their offices as businesses and offices reopen, which could contribute to the stabilization in their schedules.

    “The data has also revealed that the UK seems to start work an hour later than before the quarantine, but both the US and UK tend to work late,” Juta Gurinaviciute, chief technology officer for NordVPN Teams, said in a statement. “We also see that there is no significant drop in the usage of business VPNs during lunch time, which might suggest that lunch breaks have become shorter.”

    Use of business VPNs spiked in April, along with a reported increase in use of home networks and devices, many of which may not have proper protection for secure remote work, NordVPN said. This becomes critical as some companies plan to have employees continue to work remotely more regularly, even after the pandemic ends. Spending on cloud security is expected to jump by 33% this year, making it a $585 million market, according to market analyst Gartner.
    下载开源日报APP:https://opensourcedaily.org/2579/
    加入我们:https://opensourcedaily.org/about/join/
    关注我们:https://opensourcedaily.org/about/love/
  • 开源日报第863期:《网易云高仿 desktop-nicemusic》

    13 8 月, 2020
    开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
    今日推荐开源项目:《网易云高仿 desktop-nicemusic》
    今日推荐英文原文:《Can We Touch the Sun?》

    今日推荐开源项目:《网易云高仿 desktop-nicemusic》传送门:GitHub链接
    推荐理由:网抑云梗突然泛滥,但是我们最初的目的只是听歌啊。一款不一样的音乐播放器或许能满足你的要求,其音源和其他资源都是来自网易云(所以没有版权的歌还是放不了)。
    今日推荐英文原文:《Can We Touch the Sun?》作者:Alastair Isaacs
    原文链接:https://medium.com/illumination/can-we-touch-the-sun-621a59bdee97
    推荐理由:宇宙遥远却具有神秘的魅力,引发地表上的人们无数暇想。赋予地球生机的太阳却离我们如此遥远,而我们能接近太阳到什么程度?

    Can We Touch the Sun?

    If we want to get close to the Sun — and for the sake of this question we do — we’re going to need something that can withstand a lot of heat. There are plenty of known materials, and presumably even more unknown ones, that make good candidates for this. But let’s keep things simple, and go with tungsten.

    On the face of it, tungsten is unremarkable. Like many metals, it has a silvery appearance. It is pretty rare on Earth — yet useful enough to be found in everyday life, for example, in light bulbs or in electronics. But in one way tungsten stands apart. Of all the elements, tungsten has the highest melting point, staying solid until 6192°F (3422°C).

    (Thanks to its high melting point, Tungsten is ideal for use in light bulbs, like this one. Photo by Callum Shaw on Unsplash)
    So let’s build a spacecraft entirely from tungsten, and ignore all the impracticalities that come with doing that. Our probe will simply be a solid sphere of metal measuring two meters across (roughly six feet, the height of a tall man). We’ll build several of them, and they’ll launch together, before heading into different orbits around the Sun.

    Our first probe will settle into a comfortable circular orbit twenty-five million miles from our star. Here, close to the innermost planet Mercury, the Sun starts to heat up the tungsten sphere. Metals are shiny, which helps, as two-thirds of the heat is immediately reflected away. And, as the spacecraft warms up, it starts emitting heat of its own. The hotter it gets, the more heat it radiates away. At some point, if it doesn’t melt first, it will radiate away exactly as much heat as it receives from the Sun. We’ll call this the sphere’s equilibrium temperature, and it represents the greatest temperature the Sun can heat our spacecraft to.

    At Mercury, the equilibrium temperature will be 310°F (155°C). The spacecraft would be hot to touch, but nowhere near melting yet. We can definitely get closer.

    The second probe does that, this time settling ten million miles from our star. The Sun feels hotter here, but, at a temperature of 760°F (405°C), our tungsten sphere is still not even close to melting. It might not yet be a problem for tungsten, but it is for the expensive electronics that power most satellites. If we wanted to send a probe this close to the Sun, we’d need some sophisticated cooling systems to keep them running.

    (An artists impression of the Parker Solar Probe. The spacecraft is protected from the Sun’s heat by a specially designed shield. Image credit to NASA.)
    The Parker Solar Probe, launched by NASA, will make its closest approach to the Sun on December 24th, 2024. On that day the spacecraft will be just four million miles from the star, the closest any man-made object has ever been. Closest, that is, until our third probe reaches its destination. We’re going to beat the Parker Solar Probe by a fraction, and orbit 3.9 million miles from the Sun.

    This probe is going to get scorching hot, reaching 1500°F (815°C). It’s lucky we don’t have any sensors or computers on board, because at this temperature they would fail in seconds. The Parker Solar Probe will face similar temperatures, but it won’t spend stay close to the Sun for long. Its orbit has been designed so that the probe whips around the Sun at high speed (travelling more than 120 miles every second), before heading to more temperate regions close to Venus. This, together with a heat-resistant shield and high-tech cooling systems, help the probe survive such torrid temperatures.

    But our tungsten probe is just a metal sphere, and has no expensive electronics to worry about. We can go closer, and we will. But, as we get nearer to the Sun, there’s another issue we need to consider. The Sun itself has a diameter of 860,000 miles, and at four million miles, we’re still pretty far from the surface. But surrounding the Sun, and extending out into space for millions of miles, is the stellar corona, a region of plasma that reaches extreme temperatures.

    (The Solar Corona is normally only visible during eclipses. The pink ring around the Moon is the Chromosphere, the outer layer of the Sun.)
    What makes the corona so hot is still not fully understood. Scientists believe that the intense magnetic fields around the Sun have something to do it. What that is, though, is an area of active research. The Parker Solar Probe, which will pass through the solar corona, hopes to shed some light on this mystery.

    The Sun follows an eleven year cycle, during which the strength of the corona rises and falls. During quiet years the extent of the corona is limited, but it returns with a vengeance during active years. Even during quiet years, the Sun occasionally hurls vast quantities of superhot plasma into space. The energy and radiation contained in one of these bursts would almost certainly be fatal for any spacecraft.

    We want to get as close to the Sun as possible, so let’s pick a quiet year for our mission. For now we’ll stick with a circular orbit, but we’ll orientate it so that it passes over the poles of the Sun, where the corona is much weaker. We’ll also take advantage of the low density of the stellar corona — even though it is extremely hot, the particles that carry that heat are widely spread out. This means our probe will heat up more slowly that you might expect.

    After all this, our spacecraft, at a distance of one million miles from the Sun, heats up to over 3,000°F (1700°C). That’s hot enough to melt lead, but not yet enough to destroy our plucky tungsten sphere. With clever engineering, we could design a heat shield and enough cooling to send a real probe to this distance, even if only for a short time.

    (ESA’s Solar Orbiter captured these closeup views of the photosphere and corona, the outer layers of the Sun. Image credit:Solar Orbiter/EUI Team/ESA & NASA; CSL, IAS, MPS, PMOD/WRC, ROB, UCL/MSSL)
    To go closer, we’ll need to skim the surface of the Sun. Our next probe will fly to just above the photosphere, the outer layer of the star. Getting so close to the Sun creates many problems. Heat is a big, and obvious, one. At this point the high temperatures will prove too much even for tungsten to endure for long. But another is the high amount of radiation coming from the Sun —which will be deadly for any electronics onboard.

    But let’s head there anyway, and see what happens. It’s hard to judge exactly how hot our probe will get, but it’s probably in the region of 10,000°F (5,000°C). This is more than enough to melt the sphere, and almost certainly enough to vaporise what’s left. Even if we managed to magically cool our probe to absolute zero before arrival, it would survive no more than fifteen minutes.

    It’s a safe bet to say that the limit on how close we can get to the Sun is somewhere around a million miles, at least based on modern technology. It may be that future engineers come up with exotic solutions that allow travel to extreme places, to the very surface or even inside the Sun. But for now, although we may not be able to quite touch the Sun, we can still get pretty close.


    下载开源日报APP:https://opensourcedaily.org/2579/
    加入我们:https://opensourcedaily.org/about/join/
    关注我们:https://opensourcedaily.org/about/love/
←上一页
1 … 42 43 44 45 46 … 262
下一页→

Proudly powered by WordPress