Google Chrome's dark mode for the web coming to desktop - 9to5Google



Google Chrome's dark mode for the web coming to desktop - 9to5Google

For a few months now, it's been possible to enable a flag on Chrome for Android that goes beyond giving the browser UI a dark mode to actually make web pages you browse darker. According to a newly discovered code change, this Android-specific flag is being replaced with one for all platforms.

Force Dark Mode for Web Contents

Automatically render all web contents using a dark theme.

#enable-force-dark

As it exists today, Chrome's dark mode for the web is not ready for the spotlight — or perhaps the blacklight in this case — as there's only one option for darkening which sometimes makes pages illegible. With the "cross-platform" version of the flag, Google is offering five prospective dark modes to choose from.

  • simple HSL-based inversion
  • simple CIELAB-based inversion
  • selective image inversion
  • selective inversion of non-image elements
  • selective inversion of everything

The first two options describe using HSL and CIELAB, which are, in rough terms, two different ways of mathematically describing a color. In both acronyms, the "L" stands for "lightness," which simplifies the process of darkening or brightening a given color. CIELAB is the more advanced of the two models, meaning it should produce more accurate and visually pleasing results. That being the case, all three of the "selective inversion" options are based on CIELAB.


Read full article from Google Chrome's dark mode for the web coming to desktop - 9to5Google


Recommended IntelliJ IDEA settings



Recommended IntelliJ IDEA settings

These are my must-have settings tweaks for IntelliJ IDEA, mixed with some useful tips.
However, I recommend going through all the preferences in the Settings Dialog yourself. You probably don't even know about some problems the IDE can solve for you if adjusted correctly.

Check out my config-files for more IDEA settings.

Table of Contents

  1. How to change settings
  2. Show current IDEA memory usage in the status bar
  3. Adjust for widescreen
  4. Zoom with the mouse wheel
  5. Show line numbers on the editor gutter
  6. Wrap long lines
  7. Improve tab appearance
  8. Sort debugger fields alphabetically
  9. Improve Java imports
  10. Remove unused sidebar panels
  11. Use a custom terminal shell

How to change settings

There are several ways to change settings in IntelliJ IDEA.

To open the Settings Dialog, select File → Settings... or use the Ctrl + Alt + S shortcut. You can then navigate through the settings in the left panel. Speed up the search by using quick find - simply type part of the setting name.


Read full article from Recommended IntelliJ IDEA settings


Mastering IntelliJ IDEA keyboard shortcuts - Help | IntelliJ IDEA



Mastering IntelliJ IDEA keyboard shortcuts - Help | IntelliJ IDEA

You can further improve your productivity with the following useful features:

  • Quick Lists

    If there is a group of actions that you often use, create a quick list to access them using a custom shortcut. For example, you can try using the following predefined quick lists:

    • Refactor this Ctrl+Shift+Alt+T
    • VCS Operations Alt+`
  • Smart Keys

    IntelliJ IDEA provides various aids, such as automatically adding paired tags and quotes, and detecting CamelHump words.

  • Speed search

    When the focus is on a tool window with a tree, list, or table, start typing to see matching items.

  • Press twice

    Many actions in IntelliJ IDEA provide more results when you execute them multiple times. For example, when you invoke basic code completion with Ctrl+Space on a part of a field, parameter, or variable declaration, it suggests names depending on the item type within the current scope. If you invoke it again, it will include classes available through module dependencies. When invoked for the third time in a row, the list of suggestions will include the whole project.

  • Resize tool windows

    You can adjust the size of tool windows without a mouse:

    • To resize a vertical tool window, use Ctrl+Shift+Left and Ctrl+Shift+Right

    • To resize a horizontal tool window, use Ctrl+Shift+Up and Ctrl+Shift+Down


Read full article from Mastering IntelliJ IDEA keyboard shortcuts - Help | IntelliJ IDEA


Guice Stories — Part 1 - Andrus Adamchik - Medium



Guice Stories — Part 1 - Andrus Adamchik - Medium

I've always been a fan of Google Guice. More so lately, as Guice became an indispensable part of Bootique.io project, responsible for Bootique's dependency injection (DI) and modularity. Guice is a simple, fun and powerful DI engine with a number of advantages over the industry status quo, yet there's not a lot of guidance out there on its proper use compared to, say, Spring. To partially fill this gap I wrote a few of "stories", each describing a coding or a design task, then going through Guice solutions, from the most obvious to the most optimal. Hope this will be useful to developers who use either Guice or Bootique. This post starts with two stories. More will follow.


Read full article from Guice Stories — Part 1 - Andrus Adamchik - Medium


Google Guice Just-in-time Bindings



Google Guice Just-in-time Bindings

As bindings are defined in Binding Module, Guice uses them whenever it needs to inject dependencies. In case bindings are not present, it can attempt to create just-in-time bindings. Bindings present in binding module are called explicit bindings and are of higher precedence whereas just-in-time bindings are called implicit bindings. If both type of bindings are present, explicit bindings are considered for mapping.

Following are the examples of three types of Just-in-time bindings.


Read full article from Google Guice Just-in-time Bindings


Chrome Browser - Keyboard shortcut to correct spelling of word? - Super User



Chrome Browser - Keyboard shortcut to correct spelling of word? - Super User

The answer is: Shift-F10, down arrow, Enter.

I just tested this in Chrome. Sadly, when text is highlighted, it appears that the text isn't spell checked. A "context menu" is properly brought up, and it even includes an option to search for the [text which is highlighted], but no spell check option is provided. If you right-click, a spell check option is provided. I would call this a violation of the standard for modern Microsoft Windows, which is for Shift-F10 to do the same thing as if you right-clicked on [where the keyboard cursor is]/[whatever is selected].

However, if you make a typo, and press the space bar (so the "word" is spell checked and the red underline appears), and then get your keyboard cursor back into that word, without using Shift-arrow to highlight text, then Shift-F10 will spell check the word. Down arrow will select the top proposed correction, and Enter will choose it.


Read full article from Chrome Browser - Keyboard shortcut to correct spelling of word? - Super User


List of Google Chrome Keyboard Shortcuts - Disabled World



List of Google Chrome Keyboard Shortcuts - Disabled World

As Chrome is currently the most popular of the many different available Internet browsers we have put together a list of shortcut keys and mouse/keyboard combination shortcuts to make using the Google Chrome browser both quicker and easier - especially for the elderly and people with disabilities.

Google Chrome, or the common shortcut word "Chrome", is a cross-platform web browser developed by Google. As of Feb. 2019, the website StatCounter.com estimated Chrome has a 62 percent worldwide browser user-base across all computer and mobile device platforms.

Photo of a section of blue illuminated computer keyboard keys.
Photo of a section of blue illuminated computer keyboard keys.

Google Chrome has a reputation for strong browser performance and features a minimalistic user interface including the merging of the address bar and the search box into what's known as the Chrome Omnibox.

Besides being easy to use, and one of the fastest Internet browsers, Chrome also has a handy feature that allows users to synchronize bookmarks, history, and settings etc. across all their devices that the Google Chrome browser is installed on by sending and receiving data through their Google Account.

Chrome also allows users of the browser to make local desktop shortcuts that can open web applications in the browser. The browser - when opened in this way - contains none of the regular interface except for the title bar, so as not to "interrupt anything the user is trying to do". This allows web applications to run alongside local computer software.


Read full article from List of Google Chrome Keyboard Shortcuts - Disabled World


“Fix Doc Comment” Action is Available | IntelliJ IDEA Blog



"Fix Doc Comment" Action is Available | IntelliJ IDEA Blog

A new action for code documentation maniacs, called Fix doc comment, has just been cooked at the JetBrains' oven.

Please follow the recipe:

  • Find or create a stub doc comment.
  • Fix documentation problems quickly whenever you wish.


The first case, when you may need the new action, is rather simple. Call it, when a caret is somewhere within a class, field or method, which does not have a doc comment. A doc comment stub will be added, and the caret will be moved to proper position for entering a comment.


Read full article from "Fix Doc Comment" Action is Available | IntelliJ IDEA Blog


12 IntelliJ IDEA Keyboard Shortcuts You Should Know About - Modus Create



12 IntelliJ IDEA Keyboard Shortcuts You Should Know About - Modus Create

When we need to get productive, we often invest money in new gadgets, software, or even a new computer. Another way to boost productivity is learning how to use the assets we already own, such as IntelliJ IDEA. I can't say I'm a shortcut junky, but knowing a few make my life a whole lot easier.

In 2012 I spent quite some time giving other IDEs a chance. All impressed me with their own unique features. Even more so, I was so close to ditching IDEA (or rather Web Storm) for Sublime Text 2 due to the cool features available through its plugin mechanism. Weeks, or even months later, I came back to IDEA, realizing that it has virtually all features found elsewhere, and it felt a bit more robust.

Visiting other options opened my eyes for new features to look for. Features that could easily boost my productivity in a piece of software I spend so much time with. I'm sharing my 12 most useful with you.


Read full article from 12 IntelliJ IDEA Keyboard Shortcuts You Should Know About - Modus Create


Top 30 Eclipse Keyboard Shortcuts for Java Programmers



Top 30 Eclipse Keyboard Shortcuts for Java Programmers

Here is my list of 30 chosen Eclipse IDE keyboard shortcuts for Java developers. It's useful for both core Java developer and Java web application developer using Eclipse IDE for web development.

1)      Ctrl + Shift + T for finding a class even from a JAR file
This keyboard shortcut in Eclipse is my most used and favorite shortcut. While working with a high-speed trading system which has a complex code, I often need to find classes with the just blink of the eye and this Eclipse keyboard shortcut is just made for that. No matter whether you have a class in your application or inside any JAR in the workspace, this shortcut will find it.


2)      Ctrl + Shift + R for finding any resource (file) including config xml files
This is similar to above Eclipse shortcut with the only difference that it can find out not only Java files but any files including XML, configs, and many others, but this eclipse shortcut only finds files from your workspace and doesn't dig at the JAR level.


3)      Ctrl + 1 for quick fix
This is another beautiful Eclipse shortcut which can fix up any error for you in Eclipse. Whether it's missing declaration, missing semi-colon, or any import related error this eclipse shortcut will help you to quickly sort that out.


4)      Ctrl + Shift + o for organize imports
Another Eclipse keyboard shortcut for fixing missing imports. Particularly helpful if you copy some code from other file and what to import all dependencies. 

Read full article from Top 30 Eclipse Keyboard Shortcuts for Java Programmers


IntelliJ IDEA and Eclipse Shortcuts | Catalysts



IntelliJ IDEA and Eclipse Shortcuts | Catalysts

After around seven years of exclusively using Eclipse for Java development I recently got the chance to work on a project where IntelliJ IDEA is the standard editor. All of a sudden my tried and tested Eclipse keyboard shortcuts didn't work any more. I'm still in the process of learning the IntelliJ Shortcuts but here are my favourites up to now (with equivalent Eclipse shortcuts).  This may be of help to anyone else switching over from Eclipse to IntelliJ.  Of course, there is an IntelliJ Plugin available which makes IntelliJ IDEA behave like Eclipse (same shortcuts and compiler behaviour) but why do that?


Read full article from IntelliJ IDEA and Eclipse Shortcuts | Catalysts


Maven to Bazel Preparation - JunctionBox.ca



Maven to Bazel Preparation - JunctionBox.ca

Works best with monorepos

Bazel can be used with a number of project structures but it is most efficient when employed in a monorepo. It uses a file named WORKSPACE to indicate the project root and load dependencies like language plugins. While it is possible to stitch together traditional repos in a multi-workspace configuration it becomes cumbersome resolving and manage third-party dependencies across repos. Multirepos also bring additional overhead as it abandons the maven concept of manually versioned modules. Instead it expects repos to be in the master/HEAD position with changes being committed atomically across the project


Read full article from Maven to Bazel Preparation - JunctionBox.ca


Tweak System Settings & Activate Hidden Features in Yosemite with TinkerTool « Mac Tips :: Gadget Hacks



Tweak System Settings & Activate Hidden Features in Yosemite with TinkerTool « Mac Tips :: Gadget Hacks

Most diehard Mac users have used TinkerTool at some time or another, and if you haven't, it's time to start. Whether it's to change your system's font or to disable UI animations, it seems like anything you could ever think about tweaking in Mac OS X is doable through TinkerTool. And now, developer Marcel Bresink has updated his app to work with Yosemite, so let's see what it can do now.


Read full article from Tweak System Settings & Activate Hidden Features in Yosemite with TinkerTool « Mac Tips :: Gadget Hacks


OS X: 5 Settings to Tweak for Newbies – The Mac Observer



OS X: 5 Settings to Tweak for Newbies – The Mac Observer

Whenever you're configuring a computer for someone who's new to the Mac (or someone who's coming from an older version of OS X), you might need to tweak a few things to make the transition easier for him or her. Below, I've outlined a few of the changes I usually make. Now, while I've found that these settings in particular can often confuse people, this doesn't mean that I'm implying that I know better than Apple how things should be configured. Nope. What I am saying, though, is that avoiding late-night phone calls from your Uncle Eugene is ideal, and I want to help with that.


Read full article from OS X: 5 Settings to Tweak for Newbies – The Mac Observer


How to Enable Tap To Click on Mac Trackpads with Mac OS X



How to Enable Tap To Click on Mac Trackpads with Mac OS X

The tap-to-click ability is enabled by default on most PC laptops, while on the Mac side of things it's usually disabled by default. For the unfamiliar, tap-to-click means that a single tap or touch on the MacBook trackpad or Magic Trackpad is registered as a click, thereby preventing the need to actually press down the trackpad to click on a screen item.

Many users really like the touch-tap feature for it's ease and low intensity, but it's certainly not everyones cup of tea and others users find it annoying. Because it's turned off by default in Mac OS X, you'll need to adjust the setting manually, which we'll show you how to do easily through System Preferences. The feature works on most trackpads built into relatively new MacBook Pro and Air models, including any with multitouch support


Read full article from How to Enable Tap To Click on Mac Trackpads with Mac OS X


Bazel Cookbook



Bazel Cookbook

Bazel is Google's own build tool, now publicly available in Beta. Bazel has built-in support for building both client and server software - http://bazel.io

Bazel query cookbook

Graph dependencies

This will require graphviz. Either brew install graphviz or apt-get install graphviz

bazel query --noimplicit_deps --nohost_deps 'deps(//you-project:your-target)' --output graph > graph.in  dot -Tpng < graph.in > graph.png  


Read full article from Bazel Cookbook


Bazel构建 - 简书



Bazel构建 - 简书

Bazel是一个类似于Make,Maven和Gradle的开源构建和测试工具。Bazel支持多种语言混编的项目并且可以根据不同的平台输出不同的构建结果。

优势:

  • 加快构建和测试速度:Bazel只重建必要的东西,借助缓存,优化依赖关系分析和并行执行,可以获得快速的和增量的构建。
  • 支持多种语言:支持Java, C++, Android, iOS, Go和各种其他语言,可以运行在Windows,macOS和Linux上。
  • 可扩展:可以扩展Bazel以支持您选择的语言

基本概念

工作区

一个工作空间是你的文件系统,它包含了源文件、符号链接以及输出目录。每个工作空间都有一个名为WORKSPACE的文本文件,该文件可能为空,或者包含对外部依赖引用


Read full article from Bazel构建 - 简书


Bazel is the Worst Build System, Except for All the Others



Bazel is the Worst Build System, Except for All the Others

  1. Bazel is a pain to integrate in open source projects


Read full article from Bazel is the Worst Build System, Except for All the Others


Building Android Apps with Bazel



Building Android Apps with Bazel

Bazel is an open-source build and test tool similar to Make, Maven, and Gradle. The Google-internal version of Bazel, Blaze, is used to build major apps such as Google Maps and YouTube. Bazel uses a human-readable, high-level build language that supports multiple languages and platforms. There is virtually no limit on the size of the codebase or the number of uses that Bazel supports. See the product roadmap to learn about the path toward a stable 1.0 release.

Note that Bazel is currently in Beta - it is not yet covered by a deprecation policy, may be subject to backward-incompatible changes, and may be missing some features.

Why should I use Bazel?

  • High-level build language. Bazel uses an abstract, human-readable language to describe the build properties of your project at a high semantical level. Unlike other tools, Bazel is declarative. Rather than defining individual build steps for your project, your tell Bazel about your project and it creates the build actions behind the scenes. This shields you from the complexity of writing individual calls to tools such as compilers and linkers.
  • Bazel is fast and reliable. Bazel caches all previously done work and tracks changes to both file content and build commands. This way, Bazel knows when something needs to be rebuilt, and rebuilds only that. To further speed up your builds, you can set up your project to build in a highly parallel and incremental fashion.

Read full article from Building Android Apps with Bazel


5 Simple Tweaks To Make Cinnamon Desktop Rock on Ubuntu



5 Simple Tweaks To Make Cinnamon Desktop Rock on Ubuntu

Add Panel Applets

weather applet

Cinnamon embraces extensibility with the same gusto as GNOME Shell. A wealth of community add-ons and applets offering extra features and functionality, such as weather, system monitors and window management tools, are available to browse, install and enable straight form the desktop.

Right click on the panel you wish to add an applet to and select '…Add Applets to the Panel'. Some notable applets to check out:

  • Weather – does what it forecasts (ho ho)
  • Stark Menu – Clone of the Windows 7 Start Menu
  • Screenshot — Easy way to grab screenshots with delays


Read full article from 5 Simple Tweaks To Make Cinnamon Desktop Rock on Ubuntu


How to Customize the Cinnamon Desktop Environment



How to Customize the Cinnamon Desktop Environment

The Cinnamon Desktop Environment is relatively new when compared to KDE and Gnome and therefore there aren't quite as many customizable features.

This guide will show you the sort of things you can do to enhance the Cinnamon desktop including:

  • Changing the desktop wallpaper
  • Adding panels
  • Adding applets to panels
  • Adding Desklets
  • Customizing the login screen

Linux Mint is being used for the purposes of this guide, but these instructions should work for Cinnamon on all Linux distributions.


Read full article from How to Customize the Cinnamon Desktop Environment


Totally awesome Cinnamon 'Spices' you need, now - gHacks Tech News



Totally awesome Cinnamon 'Spices' you need, now - gHacks Tech News

I've touched on Cinnamon quite a few times now, as it has become my personal choice of desktop environment, but I thought I'd share some of Cinnamons own tweaks that are system independent, you should check out.

All of these can be installed from their respective section of the System Settings application in the Cinnamon environment, such as "Applets" and "Extensions" and "Themes."

Tip: You can browse the official addons repository on the Linux Mint website.

What are Spices?

Some people find little use or desire to theme or tweak their systems, where as I on the other hand, absolutely love to customize my system.

Spices, are what the Cinnamon devs have decided to call addons, extensions, and tweaks for the environment; anything eye candy related basically.


Read full article from Totally awesome Cinnamon 'Spices' you need, now - gHacks Tech News


Console Violations - Chrome DevTools - Dev Tips



Console Violations - Chrome DevTools - Dev Tips

A benefit of using this feature is: there's no need to run a Performance Profile, or to run an Audit, since violations are shown as the offending code executes (e.g. on page load).

To view Console Violations:

  1. Click the 'Default levels' dropdown in the Console Panel and select 'Verbose'
  2. Type in violation in the Console Panel filter box

Violations can provide valuable performance insight into your code, such as:

  • JavaScript which forced a reflow
  • JavaScript which used document.write
  • Slow executing setTimeout handlers
  • Inefficient event listeners
  • And many other violations

Read full article from Console Violations - Chrome DevTools - Dev Tips


A list of cool Chrome DevTools Tips and Tricks



A list of cool Chrome DevTools Tips and Tricks


Read full article from A list of cool Chrome DevTools Tips and Tricks


Twelve Fancy Chrome DevTools Tips - By



Twelve Fancy Chrome DevTools Tips - By

Breakpoints in JavaScript. Inspecting HTML and CSS and updating them live. Profiling performance… That's right, this week's post is all about the developer tools in IE8.

[What's that? Really? Are you sure? I see, thank you. Goodbye. No no, that won't be necessary.]

Folks I've just been informed that no one else is fond of IE8 quite like I am, so this week's post will instead be about Chrome's DevTools. Specifically, I use Chrome Canary and so should you. Not just because it's a reference to the cute little birds that willingly sacrificed their lives so that we could have fresh coal.


Read full article from Twelve Fancy Chrome DevTools Tips - By


16.10 - Shortcut to Preferences - Ask Ubuntu



16.10 - Shortcut to Preferences - Ask Ubuntu

On Macs, there's a nice command + , to open prefs in any app. For example, in Firefox right now, preferences is in the Edit menu (WTF, but that's a different bug), and no shortcut keys to press it.

How does one universally set a shortcut to open preferences?

P.S. / Extra Credit: Is there a way and a place to productively lodge a complaint about preferences being in the Edit menu that might help it get changed?


Read full article from 16.10 - Shortcut to Preferences - Ask Ubuntu


Disable icons in VS Code - Ubuntu 16.04 · Issue #28616 · microsoft/vscode · GitHub



Disable icons in VS Code - Ubuntu 16.04 · Issue #28616 · microsoft/vscode · GitHub

Oh, if you want to disable the file icons altogether, you can change the file icon theme.
Run the command Preferences: File Icon Theme and choose either None or Minimal (Visual Studio Code.


Read full article from Disable icons in VS Code - Ubuntu 16.04 · Issue #28616 · microsoft/vscode · GitHub


How to edit settings.json in Visual Studio Code?



How to edit settings.json in Visual Studio Code?

I got stuck yesterday when I was trying to change the settings.json in Visual Studio Code becuase of not understanding there are different ways for different situations.

As I figured out, there are three ways to edit settings.json

  1. in User Preferences (Global)
  2. in Folder
  3. in Workspace

in User Preferences (Global)

You can change the settings.json from your user preferences. This changes are global. Therefore it will affect all of your projects. Here are 2 ways to reach that global settings.json file.

  • File -> Preferences -> Settings -> Extensions -> Scroll down and find "Edit in settings.json"
  • Or in these paths in your OS
    • Windows %APPDATA%\Code\User\settings.json
    • macOS $HOME/Library/Application Support/Code/User/settings.json
    • Linux $HOME/.config/Code/User/settings.json


Read full article from How to edit settings.json in Visual Studio Code?


[JDK-8176402] parameter name switcharoo in ConcurrentHashMap - Java Bug System



[JDK-8176402] parameter name switcharoo in ConcurrentHashMap - Java Bug System

As discovered by a new errorprone check (by examining corresponding constructor parameter names) that the order of constructor parameters in some CHM classes was inadvertently switched. But this mistake was benign, because the using classes simply called super with the wrong order - here 2 wrongs made a right. But needs fixing anyways.

    Attachments


      Read full article from [JDK-8176402] parameter name switcharoo in ConcurrentHashMap - Java Bug System


      Google在构建静态代码分析工具方面的经验教训 - FreeBuf专栏·李瑞的信息安全专栏



      Google在构建静态代码分析工具方面的经验教训 - FreeBuf专栏·李瑞的信息安全专栏

      软件bug耗费开发者和软件公司大量的时间和金钱。 以2014年为例,被广泛使用的SSL协议实现中的一个("goto fail")bug导致可接受无效的SSL证书,另外一个与日期格式化相关的bug导致Twitter的大范围服务中断。此类错误通常可以被静态分析检测,其实事实上在阅读代码或文档阶段均可以快速识别,可以最终现实是情况仍然在生产环境实施发生。

      之前的工作已经完善报道将bug检测工具应用于软件开发的经验。但虽然开发人员使用静态分析工具方面有如此多的成功案例,仍有以下原因导致工程师并不总情愿使用静态分析工具或主动忽略工具产生的告警信息:

      • 未合理整合。工具未集成到开发人员的工作流程中或者是程序运行时间太长;

      • 无效的告警。告警信息可行性性差;

      • 不值得信赖。用户因为误报而不再信任结果;

      • 缺陷实际利用场景不清晰。报告的bug在理论上是可行的,但缺陷在实际利用场景下并不清晰;

      • 修复成本过高。修复已检测到的代码缺陷的成本太高或有其他方面的风险;

      • 告警不易理解。使用者并不了解告警信息的的具体信息和原理。

      接下来本文描述了我们如何吸取Google在先前使用FindBug进行java语言分析方面以及学术文献中的得到的经验和教训,最终在Google公司成功构建了软件工程师日常使用的静态分析基础设施架构。借助吸收于工程师的意见建议,Google的工具可以在有问题的代码被合入到公司级别的代码仓库之前检测到每天工程师所修复的数千个问题。

      在工具作用范围方面,我们专注于将静态分析融入为Google核心开发流程的一部分,并服务于大部分Google开发人员。许多静态代码分析工具在部署于google的20亿行代码级别下将相形见绌,因此大规模场景下运行复杂分析的技术的优先级并不高。

      当然必须要考量到Google外部开发人员在专业领域(例如航空航天和医学设备领域)工作的可能会使用特定的静态分析工具和工作流程。同样开发项目涉及特定类型(例如内核代码和设备驱动程序)的开发人员可能需要进行特定的分析方法。静态分析方面已经有很多卓越的工作成果,我们并不认为我们所反馈的经验和心得是独一无二的,但我们坚信整理和分享我们在提高google的代码质量和改善开发体验方面的工作是有所裨益的。

      术语定义。我们使用以下术语定义:分析工具对源代码运行一个或多种"检查器",并识别出可能呈现出软件故障的"缺陷"。如果开发人员在看到问题后没有采取积极行动,如果开发人员遇到识别出的缺陷并未采取适当的修复方式,我们将其视为"实际误报"。如果静态分析并未准确的识别报告到某项缺陷,但开发人员主动采取措施修改此处代码以提高可读性和可维护性,那么这就不算是有效的"误报"。如果一个分析报告了实际的代码错误,但是开发人员因未理解这处代码问题因而没有采取任何行动,就视为这是一个"实际误报"。我们使用这种概念区别强调了研发角度的重要性。开发人员而不是工具作者对感知并直接影响到工具的误报率。


      Read full article from Google在构建静态代码分析工具方面的经验教训 - FreeBuf专栏·李瑞的信息安全专栏


      Mockito best practices – test behavior not implementation - Mockito Cookbook



      Mockito best practices – test behavior not implementation - Mockito Cookbook

      Once you start testing with Mockito you might be tempted to start mocking everything that gets in your way. What is more, you may have heard that you have to mock all of the collaborators of the class and then verify whether those test doubles executed the desired methods. Of course, you can code like that, but since it is best to be a pragmatic programmer, you should ask yourself the question whether you would be interested in changing the test code each time someone changes the production code, even though the application does the same things.

      It's worth going back to distinguishing stubs from mocks. Remember that, if you create a mock, it's for the sake of the verification of its method execution. If you are only interested in the behavior of your test double—if it behaves as you tell it to—then you have a stub. In the vast majority of cases, you shouldn't be interested in whether your test double has executed a particular method; you should be more interested in whether your application does what it is supposed to do. Also, remember that there are cases where it makes no sense to create a stub of an external dependency—it all depends on how you define the system under test.


      Read full article from Mockito best practices – test behavior not implementation - Mockito Cookbook


      Switching User Profiles In Chrome Via Keyboard Shortcuts



      Switching User Profiles In Chrome Via Keyboard Shortcuts

      First we need to access Chrome profile switcher options; the default keyboard shortcut for this is "Ctrl + Shift + M." Just press "Ctrl + Shift + M" on any active window in Chrome, and the profile switcher should drop down from the top-right corner. Here press the "Down" key once to highlight the "Switch person" option and then press Enter.


      Read full article from Switching User Profiles In Chrome Via Keyboard Shortcuts


      Functional Java by Example | Part 7 – Treat Failures as Data Too – Ted Vinke's Blog



      Functional Java by Example | Part 7 – Treat Failures as Data Too – Ted Vinke's Blog

      The example I'm evolving in each part of the series is some kind of "feed handler" which processes documents. We've already dealt with exceptional situations before, but we're going to take care of them, more ehm,…functionally — as data.

      If you came for the first time, it's best to start reading from the beginning. It helps to understand where we started and how we moved forward throughout the series.


      Read full article from Functional Java by Example | Part 7 – Treat Failures as Data Too – Ted Vinke's Blog


      Mockito: Why You Should Not Use InjectMocks Annotation to Autowire Fields – Ted Vinke's Blog



      Mockito: Why You Should Not Use InjectMocks Annotation to Autowire Fields – Ted Vinke's Blog

      People like the way how Mockito is able to mock Spring's auto-wired fields with the @InjectMocks annotation. When I read this post of Lubos Krnac last week, I thought I should explain why I think the use of InjectMocks is a bad signal and how you should avoid it. Hint: it's about visibility.

      Let's say we have a PlannerServiceImpl which delegates to a PlannerClient. Uses Spring for auto-wiring all together; there's no constructor, but Spring is able to use field injection.


      Read full article from Mockito: Why You Should Not Use InjectMocks Annotation to Autowire Fields – Ted Vinke's Blog


      《xUnit Test Patterns》学习笔记6 - Test Double - CoderZh - 博客园



      《xUnit Test Patterns》学习笔记6 - Test Double - CoderZh - 博客园

      我不知道Test Double翻译成中文是什么,测试替身?Test Double就像是陈龙大哥电影里的替身,起到以假乱真的作用。在单元测试时,使用Test Double减少对被测对象的依赖,使得测试更加单一,同时,让测试案例执行的时间更短,运行更加稳定,同时能对SUT内部的输入输出进行验证,让测试更加彻底深入。但是,Test Double也不是万能的,Test Double不能被过度使用,因为实际交付的产品是使用实际对象的,过度使用Test Double会让测试变得越来越脱离实际。

      我感觉,Test Double这玩意比较适合在Java,C#等完全面向对象的语言中使用。并且需要很好的使用依赖注入(Dependency injection)设计。如果被测系统是使用C或C++开发,使用Test Double将是一个非常困难和痛苦的事情。

      要理解Test Double,必须非常清楚以下几个东西的关系,本文的重点也是说明一下他们之间的关系。他们分别是:


      Read full article from 《xUnit Test Patterns》学习笔记6 - Test Double - CoderZh - 博客园


      Stephen Colebourne's blog: User-defined literals in Java?



      Stephen Colebourne's blog: User-defined literals in Java?

      Java has a number of literals for creating values, but wouldn't it be nice if we had more?

      Current literals

      These are some of the literals we can write in Java today:

      • integer - 123, 12s, 1234L, 0xB8E817, 077, 0b1011_1010
      • floating point - 45.6f, 56.7d, 7.656e6
      • string - "Hello world"
      • char - 'a'
      • boolean - true, false
      • null - null

      Project Amber is also considering adding multi-line and/or raw string literals.

      But there are many other data types that would benefit from literals, such as dates, regex and URIs.

      User-defined literals

      In my ideal future, I'd like to see Java extended to support some form of user-defined literals. This would allow the author of a class to provide a mechanism to convert a sequence of characters into an instance of that class. It may be clearer to see some examples using one possible syntax (using backticks):


      Read full article from Stephen Colebourne's blog: User-defined literals in Java?


      Stephen Colebourne's blog: Java SE 8 Optional, a pragmatic approach



      Stephen Colebourne's blog: Java SE 8 Optional, a pragmatic approach

      Java SE 8 Optional, a pragmatic approach

      The Optional classs in Java 8 is a useful tool to help developers manage data. But advice on how to use it varies. This is my take on one good approach to using Optional in Java 8.

      Note that this article assumes you know what Optional is and how it works. See my previous article and other tutorials for more info. Also, be aware that Optional is a heavily argued topic, with some commentators liable to get rather too excited about its importance.

      A pragmatic approach to Optional in Java 8

      What follows is a specific approach to using Optional in Java 8 that I have found very useful. It should be considered that the approach has been developed in terms of writing a new application, rather than maintaining an existing one. There are five basic points:

      1. Do not declare any instance variable of type Optional.
      2. Use null to indicate optional data within the private scope of a class.
      3. Use Optional for getters that access the optional field.
      4. Do not use Optional in setters or constructors.
      5. Use Optional as a return type for any other business logic methods that have an optional result.


      Read full article from Stephen Colebourne's blog: Java SE 8 Optional, a pragmatic approach


      Java 8 Top Tips | IntelliJ IDEA Blog



      Java 8 Top Tips | IntelliJ IDEA Blog

      I've been working a lot with Java 8 code over the last couple of years, for both new applications and migrating existing ones, and it feels like the right time to write down some of the "best practices" I've found useful. I personally dislike the term "best practices" as it implies a "one size fits all" solution, and of course coding doesn't work that way – it's down to us as developers to figure out what will work in our situation. But I have discovered I have particular preferences for Java 8 code that I find makes my life a little easier, and I thought I'd start a discussion on this topic.

      Optional

      Optional is a highly underrated feature, and one that has the potential to remove a lot of those NullPointerExceptions that can plague us. It's particularly useful at the boundaries of code (either APIs you're using or APIs you're exposing) as it allows you and your calling code to reason about what to expect.


      Read full article from Java 8 Top Tips | IntelliJ IDEA Blog


      Java 8 Optional - Replace your get() calls | Reverse Coding



      Java 8 Optional - Replace your get() calls | Reverse Coding

      Optional class were introduced in order to prevent NullPointerException, but method get() used to retrieve the value inside the Optional might still throw a NoSuchElementException.

      Different name, same issue?

      Calling get() without checking that the value is actually present it's a problem. So we should always write something like this in order to use get().


      Read full article from Java 8 Optional - Replace your get() calls | Reverse Coding


      Understanding, Accepting and Leveraging Optional in Java



      Understanding, Accepting and Leveraging Optional in Java

      One of the most interesting features that Java 8 introduces to the language is the new Optional class. The main issue this class is intended to tackle is the infamous NullPointerException that every Java programmer knows only too well.

      Essentially, this is a wrapper class that contains an optional value, meaning it can either contain an object or it can simply be empty.

      Optional comes along with a strong move towards functional programming in Java and is meant to help in that paradigm, but definitely also outside of that.

      Let's start with a simple use-case. Before Java 8, any number of operations involving accessing an object's methods or properties could result in a NullPointerException:

      String isocode = user.getAddress().getCountry().getIsocode().toUpperCase();

      If we wanted to make sure we won't hit the exception in this short example, we would need to do explicit checks for every value before accessing it:


      Read full article from Understanding, Accepting and Leveraging Optional in Java


      How to Reset Chromebook



      How to Reset Chromebook

      Factory Reset Chromebook

      These steps will wipe data from your device. Since most of your data such as calendar, browser passwords, and email sync with your Google Account. You can sync that data back to your device if desired.

      To factory reset your Chromebook, perform either of these two options.

      Option 1 – From Login Screen

      1. If you are not logged out, select the picture in the lower-right corner, then select the "Sign out".
      2. Hold "CTRL" + "ALT" + "SHIFT", then press "R".
      3. Select "Restart".
      4. Once the Chromebook restarts, select "Reset" or "Powerwash".


      Read full article from How to Reset Chromebook


      How to fix Google Pixel 3 XL Black Screen issue



      How to fix Google Pixel 3 XL Black Screen issue

      Solutions to fix Google Pixel 3 XL Black Screen issue

      Oftentimes, there's no obvious reason why an Android device may freeze. A user needs to do a set of troubleshooting steps in order to narrow down the factors. If you are not sure what may have caused a Black Screen issue on your Google Pixel 3 XL, the following troubleshooting steps should help you figure it out.

      Force reboot

      If your Pixel was not dropped or exposed to liquid and was working normally before experiencing the problem, the cause is most likely a minor OS bug. Try fixing it by rebooting the device. Simply press and hold the Power button for about 10 seconds. Afterwards, wait for your phone to complete the reboot sequence and see what happens.


      Read full article from How to fix Google Pixel 3 XL Black Screen issue


      Alt+Tab sucks; here's a solution — Exploits of a Programmer | Vicky Chijwani



      Alt+Tab sucks; here's a solution — Exploits of a Programmer | Vicky Chijwani

      The thing that's always ticked me off about the standard desktop metaphor is the inefficiency of Alt+Tab (at any point of time, you cannot be sure of where a particular application is, in the most-recently-used order). For so fundamental an operation as switching applications, which users perform many hundreds of times a day, making them tediously scan a (constantly-changing) list sorted by recently-used order seems like an awful idea to me, in many cases. Sure, toggling between two windows is dead simple, but when you have to switch to some other task, you're left with no choice but to go window-hunting.

      The problem is especially chronic, for example, when I'm working on some web development stuff. I have 3 or more applications open (editor, browser, command line, at the very least, often with another browser for looking up documentation), and I have to switch among them very often. In such a situation, Alt+Tab is plain frustrating.


      Read full article from Alt+Tab sucks; here's a solution — Exploits of a Programmer | Vicky Chijwani


      How to print multiple line string on bash | ThoughtWorkshop



      How to print multiple line string on bash | ThoughtWorkshop

      To display some pre-formatted text onto screen, we need the following 2 capabilities:

      Construct Multiple Text

      There are 2 ways to construct multiple line strings:

      • String literal


      Read full article from How to print multiple line string on bash | ThoughtWorkshop


      Is there any Blogger (blogspot) not mobile conditional format - Stack Overflow



      Is there any Blogger (blogspot) not mobile conditional format - Stack Overflow

      To be honest, the term isMobile is too broad and may not be able to enable you to deliver expected result for all screen sizes -- this could be the limitation of Blogger in handling mobile responsiveness at the moment. To make your javascript conditionally work like CSS @media query, use this example:

      <script type="text/javascript">          if (window.matchMedia('(max-width: 950px)').matches) {               // Do something for screen sizes not wider than 950px.          }          else {                // Do something for screen sizes wider than 950px,               // which is pretty much what you're looking for,               // that is (Not isMobile) equivalent.          }    </script>  

      For my case, I disabled Blogger mobile template entirely and apply the following approach:

      1. Put the existing viewport meta tag outside the isMobile condition.
      2. Use CSS @media query to detect various screen sizes.
      3. Use the above javascript for various screen sizes.


      Read full article from Is there any Blogger (blogspot) not mobile conditional format - Stack Overflow


      7 Tips - Tuning Command Line History in Bash - ShellHacks



      7 Tips - Tuning Command Line History in Bash - ShellHacks

      1. Add Date and Time to Bash History

      Sometimes it would be very nice to know when some command got executed.

      Set HISTTIMEFORMAT to print the time stamps associated with each history entry.

      Append the following line to ~/.bashrc file:

      export HISTTIMEFORMAT="%h %d %H:%M:%S "

      Now, when you type history, it will show something like:

      113  Jun 08 16:31:06 sudo ifconfig  114  Jun 08 16:31:10 top  115  Jun 08 16:31:19 ping 8.8.8.8  116  Jun 08 16:31:22 history  

      2. Increase Bash History Size

      Increase HISTSIZE – the number of commands to remember in the command history (the default value is 500).

      export HISTSIZE=10000

      Increase HISTFILESIZE – the maximum number of lines contained in the history file (the default value is 500).

      export HISTFILESIZE=10000

      3. Append Bash Commands to History File

      Bash overwrites .bash_history file?

      To append commands to the history file, rather than overwrite it, add the following line to ~/.bashrc:


      Read full article from 7 Tips - Tuning Command Line History in Bash - ShellHacks


      Bash hostname completion | Arabesque



      Bash hostname completion | Arabesque

      As part of its programmable completion suite, Bash includes hostname completion. This completion mode reads hostnames from a file in hosts(5) format to find possible completions matching the current word. On Unix-like operating systems, it defaults to reading the file in its usual path at /etc/hosts.

      For example, given the following hosts(5) file in place at /etc/hosts:

      127.0.0.1      localhost  192.0.2.1      web.example.com www  198.51.100.10  mail.example.com mx  203.0.113.52   radius.example.com rad  

      An appropriate call to compgen would yield this output:

      $ compgen -A hostname  localhost  web.example.com  www  mail.example.com  mx  radius.example.com  rad  

      We could then use this to complete hostnames for network diagnostic tools like ping(8):

      $ complete -A hostname ping  

      Typing ping we and then pressing Tab would then complete to ping web.example.com. If the shopt option hostcomplete is on, which it is by default, Bash will also attempt host completion if completing any word with an @ character in it. This can be useful for email address completion or for SSH username@hostname completion.

      We could also trigger hostname completion in any other Bash command line (regardless of complete settings) with the Readline shortcut Alt+@ (i.e. Alt+Shift+2). This works even if hostcomplete is turned off.

      However, with DNS so widely deployed, and with system /etc/hosts files normally so brief on internet-connected systems, this may not seem terribly useful; you'd just end up completing localhost, and (somewhat erroneously) a few IPv6 addresses that don't begin with a digit. It may seem even less useful if you have your own set of hosts in which you're interested, since they may not correspond to the hosts in the system's /etc/hosts file, and you probably really do want them looked up via DNS each time, rather than maintaining static addresses for them.

      There's a simple way to make host completion much more useful by defining the HOSTFILE variable in ~/.bashrc to point to any other file containing a list of hostnames. You could, for example, create a simple file ~/.hosts in your home directory, and then include this in your ~/.bashrc:

      # Use a private mock hosts(5) file for completion  HOSTFILE=$HOME/.hosts  

      You could then populate the ~/.hosts file with a list of hostnames in which you're interested, which will allow you to influence hostname completion usefully without messing with your system's DNS resolution process at all. Because of the way the Bash HOSTFILE parsing works, you don't even have to fake an IP address as the first field; it simply scans the file for any word that doesn't start with a digit:

      # Comments with leading hashes will be excluded  external.example.com  router.example.com router  github.com  google.com  ...  

      You can even include other files from it with an $include directive!

      $include /home/tom/.hosts.home  $include /home/tom/.hosts.work  


      Read full article from Bash hostname completion | Arabesque


      Better Bash history | Arabesque



      Better Bash history | Arabesque

      By default, the Bash shell keeps the history of your most recent session in the .bash_history file, and the commands you've issued in your current session are also available with a history call. These defaults are useful for keeping track of what you've been up to in the shell on any given machine, but with disks much larger and faster than they were when Bash was designed, a little tweaking in your .bashrc file can record history more permanently, consistently, and usefully.

      Append history instead of rewriting it

      You should start by setting the histappend option, which will mean that when you close a session, your history will be appended to the .bash_history file rather than overwriting what's in there.

      shopt -s histappend  

      Allow a larger history file

      The default maximum number of commands saved into the .bash_history file is a rather meager 500. If you want to keep history further back than a few weeks or so, you may as well bump this up by explicitly setting $HISTSIZE to a much larger number in your .bashrc. We can do the same thing with the $HISTFILESIZE variable.


      Read full article from Better Bash history | Arabesque


      EnvironmentVariables - Debian Wiki



      EnvironmentVariables - Debian Wiki

      Environment variables are named strings available to all applications. Variables are used to adapt each application's behavior to the environment it is running in. You might define paths for files, language options, and so on. You can see each application's manual to see what variables are used by that application.

      That said, there are several standard variables in Linux environments:

      • PATH = Colon separated list of directories to search for commands.
      • HOME = Current user's home directory.
      • LOGNAME = Current user's name.
      • SHELL = The user's preferred shell.
      • EDITOR = The user's preferred text editor.
      • MAIL = The user's electronic mail inbox location.


      Read full article from EnvironmentVariables - Debian Wiki


      A Gentle Introduction to netcat - Zheng Hao Tan - Medium



      A Gentle Introduction to netcat - Zheng Hao Tan - Medium

      Netcat can be regarded as the Swiss Army knife of TCP/IP tools. It allows you to send/receive TCP/UDP packets to diagnose networking issues in your machine.

      netcat is also widely available and comes preinstalled on most UNIX based operating systems, including MacOS and popular Linux distros like Ubuntu.

      There are many tips and tricks out there to use netcat well, but I'm going to do my best to try to summarize it's core use case below.

      There are two main ways to use netcat: invoking it with the netcat command or its alias, nc.

      Sending TCP packets

      $ echo '<YOUR MESSAGE HERE>' | nc <HOST> <PORT>

      Example:

      # Sending 'hello world!' to localhost on port 12345.
      $ echo 'hello world' | nc localhost 12345

      Listening to incoming TCP packets

      $ nc -l <PORT>

      Example:

      $ nc -l 12345 # Tell netcat to listen to port 12345 for TCP packets

      With this two basic features, here are some creative use cases:

      Let's say we have a file named example-netcat.txt that contains the a message "hi there, netcat!":

      $ cat example-netcat.txt
      hi there, netcat! # contents of example-netcat.txt

      Since it can establish and perform two way transfer of data packets, we could easily pipe files from source to destination host like this:

      Sender:

      nc localhost 12345 < example-netcat.txt

      Receiver:

      nc -l 12345 > example-netcat2.txt

      If this executes successfully, example-netcat2.txt will contain the same contents as example-netcat.txt .

      $ cat example-netcat2.txt
      hi there, netcat! # which is the same as in the original file.

      You can also choose to see packets being transferred by netcat in real time by firing up programs like WireShark or tcpdump.

      nmap is a great tool for port scanning, but you can also use netcat to do basic port scanning tasks.

      $ nc -z <HOST> <PORT RANGE>

      Example:

      # Scan 'host.example.com' with ports ranging from 10 to 50.
      $ nc -z host.example.com 10–50

      The -z flag basically tells netcat to report open ports only and to not establish connections.

      Note that this can take a while, and the time spent here is linearly proportial to the size of the port range being searched.


      Read full article from A Gentle Introduction to netcat - Zheng Hao Tan - Medium


      Protocol Buffers in Bazel - Bazel



      Protocol Buffers in Bazel - Bazel

      Bazel currently provides built-in rules for Java, JavaLite and C++.

      proto_library is a language-agnostic rule that describes relations between .proto files.

      java_proto_library, java_lite_proto_library and cc_proto_library are rules that "attach" to proto_library and generate language-specific bindings.

      By making a java_library (resp. cc_library) depend on java_proto_library (resp. cc_proto_library) your code gains access to the generated code.


      Read full article from Protocol Buffers in Bazel - Bazel


      Flip Cinnamon panel to top of desktop | LinuxBSDos.com



      Flip Cinnamon panel to top of desktop | LinuxBSDos.com

      Advancement is supposed to make stuff easier to use, but that has not been the case on free software desktop environments. Tasks that used to take one or two mouse clicks, now takes several. Ones that are usually accomplished in one or two phases, now takes three.

      GNOME 3 is a perfect example, but it is not the only one. I could cite many examples from the K Desktop Environment too. Even Cinnamon, a desktop environment that was created out of dissatisfaction with the stock GNOME 3 interface, has it share of one-too-many-mouse-clickers.

      Take the panel, for example, which on Cinnamon is on the bottom edge of the desktop by default. In MATE/GNOME 2, to move the panel to the top of the desktop you would click on the panel, then select Settings. From the Settings window shown below, choosing Top from the Orientation menu will move the panel to the top of the desktop. Nothing more.


      Read full article from Flip Cinnamon panel to top of desktop | LinuxBSDos.com


      An Introduction to Useful Bash Aliases and Functions | DigitalOcean



      An Introduction to Useful Bash Aliases and Functions | DigitalOcean

      The more you operate on the command line, the more you will find that the majority of the commands you use are a very small subset of the available commands. Most tasks are habitual and you may run these the same way every day.

      While the makers of many of the most common command utilities have attempted to eliminate extraneous typing by using shortened names (think of how many keystrokes you save daily by typing "ls" instead of "list" and "cd" instead of "change-directory"), these are not ubiquitous. Additionally, many people always run commands with the same few options enabled every time.

      Luckily, bash allows us to create our own shortcuts and time-savers through the use of aliases and shell functions. In this guide, we'll discuss how to make use of these and give you some useful examples to get you started in the right direction.

      How To Declare a Bash Alias

      Declaring aliases in bash is very straight forward. It's so easy that you should try it now.

      You can declare aliases that will last as long as your shell session by simply typing these into the command line. The syntax looks like this:

      alias alias_name="command_to_run"  

      Note that there is no spacing between between the neighbor elements and the equal sign. This is not optional. Spaces here will break the command.

      Let's create a common bash alias now. One idiomatic command phrase that many people use frequently is ls -lha or ls -lhA (the second omits the current and parent directory listing). We can create a shortcut that can be called as ll by typing:


      Read full article from An Introduction to Useful Bash Aliases and Functions | DigitalOcean


      In Bash, when to alias, when to script, and when to write a function? - Unix & Linux Stack Exchange



      In Bash, when to alias, when to script, and when to write a function? - Unix & Linux Stack Exchange

      The other answers provide some soft general guidelines based on personal taste, but ignore many pertinent facts that one should consider when deciding between scripts, functions, or aliases.

      Aliases and Functions ¹

      • The entire contents of aliases and functions are stored in the shell's memory.
      • A natural consequence of this is aliases and functions can only be used by the current shell, and not by any other programs you may invoke from the shell like text editors, scripts, or even child instances of the same shell.
      • Aliases and functions are executed by the current shell, i.e. they run within and affect the shell's current environment.² No separate process is necessary to run an alias or function.

      Scripts

      • Shells do not keep scripts in memory. Instead, scripts are read from the files where they are stored every time they are needed. If the script is found via a $PATH search, many shells store a hash of its path name in memory to save time on future $PATH look-ups, but that is the extent of a script's memory footprint when not in use.
      • Scripts can be invoked in more ways than functions and aliases can. They can be passed as an argument to an interpreter, like sh script, or invoked directly as an executable, in which case the interpreter in the shebang line (e.g. #!/bin/sh) is invoked to run it. In both cases, the script is run by a separate interpreter process with its own environment separate from that of your shell, whose environment the script cannot affect in any way. Indeed, the interpreter shell does not even have to match the invoking shell. Because scripts invoked this way appear to behave like any ordinary executable, they can be used by any program.

        Finally, a script can be read and run by the current shell with ., or in some shells, source. In this case, the script behaves much like a function that is read on-demand instead of being constantly kept in memory.

      Application

      Given the above, we can come up with some general guidelines for whether to make something a script or function / alias.

      • Do other programs besides your shell need to be able to use it? If so, it has to be a script.

      • Do you only want it to be available from an interactive shell? It's common to want to change the default behavior of many commands when run interactively without affecting external commands / scripts. For this case, use an alias / function set in the shell's "interactive-mode-only" rc file (for bash this is .bashrc).

      • Does it need to change the shell's environment? Both a function / alias or a sourced script are possible choices.

      • Is it something you use frequently? It's probably more efficient to keep it in memory, so make it a function / alias if possible.

      • Conversely, is it something you use only rarely? In that case, there's no sense having it hog memory when you don't need it, so make it a script.


      Read full article from In Bash, when to alias, when to script, and when to write a function? - Unix & Linux Stack Exchange


      How To Use Pbcopy And Pbpaste Commands On Linux - OSTechNix



      How To Use Pbcopy And Pbpaste Commands On Linux - OSTechNix

      Install Xclip / Xsel

      Like I already said, Pbcopy and Pbpaste commands are not available in Linux. However, we can replicate the functionality of pbcopy and pbpaste commands using Xclip and/or Xsel commands via shell aliasing. Both Xclip and Xsel packages available in the default repositories of most Linux distributions. Please note that you need not to install both utilities. Just install any one of the above utilities.

      To install them on Arch Linux and its derivatives, run:

      $ sudo pacman xclip xsel

      On Fedora:

      $ sudo dnf xclip xsel

      On Debian, Ubuntu, Linux Mint:

      $ sudo apt install xclip xsel

      Once installed, you need create aliases for pbcopy and pbpaste commands. To do so, edit your ~/.bashrc file:

      $ vi ~/.bashrc

      If you want to use Xclip, paste the following lines:

      alias pbcopy='xclip -selection clipboard'  alias pbpaste='xclip -selection clipboard -o'  


      Read full article from How To Use Pbcopy And Pbpaste Commands On Linux - OSTechNix


      Tech Blogs that I Follow



      Tech Blogs that I Follow

      A lot of times I think and reflect about what kinds of skills I wish I could've compounded earlier on in my software engineering career. Tech communities like Reddit and Hacker News (HN) led me to believe that, on aggregate, the marginal cost of acquiring information is now nearly zero, as just about anything can be looked up online at any time by most folks. But it was hard to tell signal from noise. My first year was just me reading and believing everything written online but not having a strong mental model to absorb/refute certain points.

      Here's a list of sites/newsletters that I've compiled over the years and still visit regularly in trying to better understand tech topics. I can only wish to have this early on, but still fortunate that it was late than never. With that said, software engineering is a broad (and getting broader!) field, so what I have here might not be of interest to you. YMMV.

      Engineering

      Dan Luu

      The man writes really interesting systems software related articles. Good, insightful writeups on modern computer performance benchmarks.

      Julia Evans

      She also has really good art/drawing skills. Her zines are pretty cool!

      Jessie Frazelle

      I first heard of her in a 2015 LinuxCon tech talk she put together to describe her Docker workflow, and the room was PACKED. Looked up her technical writings, and I wasn't disappointed.

      Chris Wellons

      Lots of good coverage on C and C++ material.

      Herb Sutter

      Yay more C++ material!

      Robert Heaton

      I first stumbled upon his blog via HN postings and found his HTTPS writeups really interesting.

      Brendan Gregg

      Very cool low level, system performance content. I've learned a ton from his blogs as well as from his Systems Performance book.

      Bruce Schneier

      Great articles on computer security. Some are highly technical, others linger on a higher level regarding ethics and computer security policies.

      Ciro S. Costa

      Good engineering writeups. I liked the "Month of /proc" posts the most.


      Read full article from Tech Blogs that I Follow


      Labels

      Algorithm (219) Lucene (130) LeetCode (97) Database (36) Data Structure (33) text mining (28) Solr (27) java (27) Mathematical Algorithm (26) Difficult Algorithm (25) Logic Thinking (23) Puzzles (23) Bit Algorithms (22) Math (21) List (20) Dynamic Programming (19) Linux (19) Tree (18) Machine Learning (15) EPI (11) Queue (11) Smart Algorithm (11) Operating System (9) Java Basic (8) Recursive Algorithm (8) Stack (8) Eclipse (7) Scala (7) Tika (7) J2EE (6) Monitoring (6) Trie (6) Concurrency (5) Geometry Algorithm (5) Greedy Algorithm (5) Mahout (5) MySQL (5) xpost (5) C (4) Interview (4) Vi (4) regular expression (4) to-do (4) C++ (3) Chrome (3) Divide and Conquer (3) Graph Algorithm (3) Permutation (3) Powershell (3) Random (3) Segment Tree (3) UIMA (3) Union-Find (3) Video (3) Virtualization (3) Windows (3) XML (3) Advanced Data Structure (2) Android (2) Bash (2) Classic Algorithm (2) Debugging (2) Design Pattern (2) Google (2) Hadoop (2) Java Collections (2) Markov Chains (2) Probabilities (2) Shell (2) Site (2) Web Development (2) Workplace (2) angularjs (2) .Net (1) Amazon Interview (1) Android Studio (1) Array (1) Boilerpipe (1) Book Notes (1) ChromeOS (1) Chromebook (1) Codility (1) Desgin (1) Design (1) Divide and Conqure (1) GAE (1) Google Interview (1) Great Stuff (1) Hash (1) High Tech Companies (1) Improving (1) LifeTips (1) Maven (1) Network (1) Performance (1) Programming (1) Resources (1) Sampling (1) Sed (1) Smart Thinking (1) Sort (1) Spark (1) Stanford NLP (1) System Design (1) Trove (1) VIP (1) tools (1)

      Popular Posts