teleren/devto huggingface dataset:
Dockerのログ出力先
Tags: japanese, docker
Published: 2020-04-19 18:22:33

---
title: Dockerのログ出力先
published: true
date: 2019-06-22 11:56:01 UTC
tags: japanese,Docker
canonical_url: https://d.nekoruri.jp/entry/2019/06/22/dockerlog
---

ツイートしてて自己完結してしまったので記録のために。

> あーそういや今更だけど、stdoutとstderrはまとめてlogging driverに渡されちゃうのか。どちらなのかはdriverには渡っているのでfluentdに出せばラベル付いてるので、ログのことだけ考えれば仕組み的にはどちらに出しても扱うこと自体には問題が無さそう。
> 
> — Aki (@nekoruri) [June 22, 2019](https://twitter.com/nekoruri/status/1142392757371179008?ref_src=twsrc%5Etfw)

<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

> デーモンアプリケーションで想定外のエラーが出うるのであれば、構造化ログをstdoutという分離は全然ありうると思う。
> 
> — Aki (@nekoruri) [June 22, 2019](https://twitter.com/nekoruri/status/1142392974753423360?ref_src=twsrc%5Etfw)

<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

> でもそうしちゃうとエコシステムから外れちゃうので、やっぱり最大公約数としてはparseableなテキストでstdout/stderrかなあという気がしてきた。やはりDockerにfile descripterの概念が欲しい。チャンネル2個じゃ足りない。
> 
> — Aki (@nekoruri) [June 22, 2019](https://twitter.com/nekoruri/status/1142395299584860160?ref_src=twsrc%5Etfw)

<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

> 理想論はさておき、現実的にはやはりコンソールアプリならstderr、デーモンアプリケーションならstdoutに構造化ログ(JSON)を出してlogging driverで振り分けてparse、stderrは想定外の非構造化エラーログに備える、が万能そう。
> 
> — Aki (@nekoruri) [June 22, 2019](https://twitter.com/nekoruri/status/1142396095525355520?ref_src=twsrc%5Etfw)

<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

> Dockerを使う最大のメリットは、その「踏み込んだ割り切り」という制約によるエコシステムなので、エコシステムから外れた時点で負けなんだよなあ……。Railsで車輪ガン無視しても別にアプリ書けるけどそれRailsじゃなくていいよねって話と同じ。
> 
> — Aki (@nekoruri) [June 22, 2019](https://twitter.com/nekoruri/status/1142396620027265024?ref_src=twsrc%5Etfw)

<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

#### 前提と考察

- Unixの世界では、stdout(標準出力)とstderr(標準エラー出力)という二つの出力チャンネルが標準として提供されている。
- Twelve-Factor Appでは、アプリケーション側はログをイベントストリームとして出力し、実行環境側のほうで開発環境であればstdout、運用環境ならばfluentdなどに送って処理するべきとされている。
- 近年[要出典]のログは、そもそも古臭いNCSA combinedアクセスログのような複雑怪奇な正規表現で取り出すようなテキストではなく、最初からJSONやLTSVなど構造化されたデータとして扱われるべきものである。
- Dockerではコンテナのログをlogging driverという仕組みで処理し、stdoutとstderrを1行1エントリとしてloggin driverに送る。logging driverは標準出力なりFluentdなりAWS CloudWatch Logsなりに送る。
- コンソールアプリでパイプ使う場合は、docker runに-aでstdoutだけ出力できるので、きちんとやる必要があれば出力はstdoutでパイプにつなぎ、ログはstderr経由でloggin driver送り、という使い分けができそう(未確認)

#### 参考リンク

* [Configure logging drivers | Docker Documentation](https://docs.docker.com/config/containers/logging/configure/)
* [Fluentd logging driver | Docker Documentation](https://docs.docker.com/config/containers/logging/fluentd/)
  * sourceでstdoutかstderrか取れる。
* [The Twelve-Factor App （日本語訳）](https://12factor.net/ja/logs)
How to build an app using c++ in android?
Tags: android, cpp, ios
Published: 2019-06-22 11:45:41

How to build an app using c++ in android?

It is a question arises my mind anytime I sit down and do some game development stuff. Till now I am not able to find a solution which just takes the c++ code and compile it for Android or any other handy technique.


Hope you guys can help......
Using and Abusing Netlify's Free Tier
Tags: netlify, javascript
Published: 2019-06-22 11:42:03

---
title: Using and Abusing Netlify's Free Tier
published: true
description: Netlify has a ridiculously generous free tier. My site pushes a large number of static pages up to it, and it's holding out well.
tags: Netlify, JS
---
If you are hosting a website you absolutely have to be concerned about it's speed. How fast is it serving up your page? How long does it take from the user hitting enter to them seeing the complete page rendered?

There are many aspects to creating a fast site, because there are many touchpoints where things can be slow. The first point is the hosting company, plan and methodology that you use.

Many sites are served up dynamically using technologies such as PHP or Ruby on Rails. Sites that need to do this will usually be slower than sites that use static html files, because there is CPU work for the server to do. It needs to compute the contents of the web pages, rather than just serve them up from the hard disk.

If you can do it, moving the static file hosting will make a big difference to speed. (Or alternatively, using caching will make a big difference too).

Static file hosting gives you another speed boost that you many not have thought of. If your site is just a bunch of dumb files, those files can be served from many locations around the world. You could have a server in New York, Brazil and Hong Kong. Servers in different cities, with the closest server to the browser serving up the content.

This will help you overcome an unavoidable constraint in getting content to your visitors fast: the speed of light. If your content is coming from the other side of the world, and not 'as the crow flies' but via many hops through other countries - it will slow things down.

If you have servers near your audience, it will be much faster. This sounds hard to do, and that is why you use a CDN (content delivery network) to do it for you. Netlify is an example of a hosting company providing static file hosting on a CDN. Stick your site there and it will be fast wherever your audience is.

And this matters both for your visitors (so you don't lose them by being too slow!) and SEO - because Google cares about how fast your site is.

Netlify has a generous free tier, and on the site https://dealscombined.com.au we are using it (and abusing it - see below) to host thousands of deals from around Australia. Please take a look and hopefully you agree it is a fast loading site.

I say we are 'abusing' Netlify because we are using it in a much different and more aggressive way than most users. We have [8000 deals pages](https://dealscombined.com.au), and we push them from a server rather than let Netlify get them from Github. The reason for this is that the pages can change each day and so it is no good keeping the source data in a git repo as it will get way too big to be practical.
Alternatives Web development IDE – after Cloud9 moved to AWS Cloud9
Tags: cloudide, webdev, webdevelopmentide
Published: 2019-06-24 09:11:56

---
title: Alternatives Web development IDE – after Cloud9 moved to AWS Cloud9
published: true
tags: Cloud IDE,cloud IDE,web development,Web development IDE
canonical_url: https://kevinhq.com/alternatives-for-cloud9-ide-after-its-moved-to-aws-cloud9/
cover_image: https://i0.wp.com/kevinhq.com/wp-content/uploads/2019/06/Alternatives-for-Cloud9-IDE-after-its-moved-to-AWS-Cloud9.png?resize=930%2C512&ssl=1
---

As we approach the end of the month, the closer we are to the day when we will say goodbye the workspace we love on Cloud9 (c9.io). They will disable our access to the workspace there and we only have one option: download and migrate it somewhere else. But what are our alternatives? AWS Cloud9… 

[Read More »Alternatives Web development IDE – after Cloud9 moved to AWS Cloud9](https://kevinhq.com/alternatives-for-cloud9-ide-after-its-moved-to-aws-cloud9/)
Best practices: Async Reverse Geocoding with Ruby and Geocoder
Tags: rails, geocoding
Published: 2019-06-22 10:05:15

What's up guys? Today I will share with you how I approach reverse geocoding using the Geocoder gem.

As you may know the Ruby gem Geocoder lets you do reverse geocoding "automatically" in the model by doing ```reverse_geocoded_by :latitude, :longitude``` and that is cool, but I found a better way...

First, the Geocoder gem makes a request to the Google maps API, and that takes time making my response a slow. So I decided to do the reverse geocoding in an async process after my record detected a change in my latitude and longitude fields.

**app/models/location.rb**

```ruby
class Location < ApplicationRecord
	
    ...
    after_commit -> { ReverseGeocodingWorker.perform_async(id) }, if: :coordinates_changed?
    
    private
    
    def coordinates_changed?
    	latitude_changed? && longitude_changed?
    end
    ...
end
```

Now, lets see the `ReverseGeocodingWorker` class in charge of updating the location record with the results of the Google Maps API

**app/workers/reverse_geocoding_worker.rb**

```ruby
class ReverseGeocodingWorker
  include Sidekiq::Worker
  sidekiq_options retry: true

  def perform(location_id)
    location = Location.find(location_id)
    results = Geocoder.search([location.latitude, location.longitude])
    if results
      result = result.first
      location.update_attributes(
        street_address: result.street_address,
        city: result.city,
        state: result.state,
        postal_code: result.postal_code
      )
    end
  end
end
```

This is gonna speed up your response time since you are delegating the reverse geocoding process to the worker.

Lastly I want to share one bonus tip for the Geocoder setup which is gonna increase the response time and will also save your Google Maps quota, just by enabling the `cache` option:

**config/initializers/geocoder.rb**

```ruby
Geocoder.configure(
  # Geocoding options
  lookup: :google,
  ip_lookup: :freegeoip,
  use_https: false,
  cache: Redis.new
)
```

Hope you good luck with your reverse geocoding feature.

Please let me know if you have questions or want me to write new posts about best practices for Ruby apps. 

Cheers!
Export Records to CSV Files with Rails
Tags: ruby, rails
Published: 2019-06-22 10:00:18

Learn how to export records into CSV files using Ruby on Rails. Here are the steps.

## Steps:

1. Add a controller and make sure you handle the csv request.
2. Add a route to point to your controller
3. Add a model with the class method to_csv

---

## Lets code it!

### Controller

```ruby
# users_controller.rb

class UsersController < ApplicationController
  def index
    @users = User.all

    respond_to do |format|
      format.html
      format.csv { send_data @users.to_csv, filename: "users-#{Date.today}.csv" }
    end
  end
```

### Routes

```ruby
# routes.rb

...

resources :users, only: :index

...
```

### Model

```ruby
# user.rb

class User < ActiveRecord::Base
  def self.to_csv
    attributes = %w{id email name}

    CSV.generate(headers: true) do |csv|
      csv << attributes

      all.find_each do |user|
        csv << attributes.map{ |attr| user.send(attr) }
      end
    end
  end

  def name
    "#{first_name} #{last_name}"
  end
end
```

## Core custom methods:

`to_csv` will map out the "id, email, name" values of your model collection and then generate a CSV string.

---

## Rails core methods for this feature: 

> `#send_data` Sends the given binary data to the browser. This method is similar to render :text => data, but also allows you to specify whether the browser should display the response as a file attachment (i.e. in a download dialog) or as inline data. You may also set the content type, the apparent file name, and other things. [Source](http://apidock.com/rails/ActionController/Streaming/send_data)
Intro to Java Programming - Java Tutorial for Beginners
Tags: java, tutorial, beginners, webdev
Published: 2019-06-22 08:53:17

A course  for those who are new to JAVA and want to learn the basics. It is a course with hands-on approach to programming and with assignments for the students to do in order to keep practicing. By the end of the course the students are sure to have the required basic knowledge of JAVA.

What you’ll learn
    Introduction
    Simple Terms
    Concepts Of Data Types
    Operators And Expressions
    General Programming and Decision Making in Java
    Iteration through loops
    Conclusion

{% youtube 3OKLJ6DieFc %}

**Thanks for reading** ❤
If you liked this post, share it with all of your programming buddies!
Follow us on **[Facebook](https://www.facebook.com/Javatutorial4u/)** | **[Twitter]( https://twitter.com/moriohdotcom)**
Git: Is branch/merge/release cycle necessary for solo developer projects?
Tags: discuss, github, git, productivity
Published: 2019-06-22 08:50:00

I'm a solo freelance dev who also contributes to open source by maintaining [projects on github](https://github.com/prahladyeri/). Unlike what most other projects follow (branch, merge and release), I follow a simple "tag and release" workflow.

For example, when the new code is ready & tested, I do the following:

1. Increment the version number in `__init__.py`.
2. Create a source distribution package (`.tar.gz`) by running `setup.py`.
3. Release it to [PyPi](https://pypi.org/user/prahladyeri/) and then finally tag the code to the version (such as "1.0.3", etc.).

For example, you can see the project [cfgsaver](https://github.com/prahladyeri/cfgsaver), the latest tag is "1.0.2" which will be updated to "1.0.3" in the next version.

How can I improve the workflow by following a branch/merge/release cycle instead. Which process do you think is better and why?
Why you need to give Firefox a chance
Tags: webdev, javascript, css, chrome
Published: 2019-06-22 08:44:27

We live in the era of browser monopoly. Google occupied the whole web by its Chrome. Chrome has more than 50% of users:
![Browsers top](https://thepracticaldev.s3.amazonaws.com/i/fz6tvstqupgup3ijw9t5.png)
Safari is on the second place just because of macOS popularity.

Now, most of the developers choose between Chrome and Firefox. And in 2017 Mozilla released their updated version of Firefox — Firefox Quantum with new customization settings, better extensions support, privacy and what's more important — speed. 2x faster than old Firefox and faster than Chrome.
![Firefox Quantum vs Chrome](https://thepracticaldev.s3.amazonaws.com/i/oj5ozdji2frqxjg7oebs.png)

Firefox using their own new engine with new Quantum CSS and Quantum DOM rendering. A lot of explanations [here](https://hacks.mozilla.org/2017/11/entering-the-quantum-era-how-firefox-got-fast-again-and-where-its-going-to-get-faster/). And Chrome uses a lot of memory, Firefox — less.

Also, Firefox has a lot of useful features like [showing useless CSS rules](https://twitter.com/nicolaschevobbe/status/1135798960361263104) and supports [prefers-color-scheme: dark](https://hacks.mozilla.org/2019/05/firefox-67-dark-mode-css-webrender/) media rules, that Chrome supports only in beta now.
![](https://thepracticaldev.s3.amazonaws.com/i/mpf3dc4ndob5kiwfc4yo.png)

Do you scare about extensions? Now, most developers write their extensions for both Chrome and Firefox.

And the final reason — stop the monopoly. Give a chance to other companies that smaller and you can see how frontend develops.

Move all your bookmarks in Firefox for one week and try.
DEV Summer Alert! Get 30% Off on Cloudways and Win Exclusive Swags. [Giveaway]
Tags: webdev, discuss, giveaway, devops
Published: 2019-06-22 07:57:49

---
title: DEV Summer Alert! Get 30% Off on Cloudways and Win Exclusive Swags. [Giveaway]
published: true
description: 
tags: webdev, discuss, giveaway, devops 
cover_image: https://www.cloudways.com/blog/wp-content/uploads/Summer-Blog-Banner.jpg
---

As summer time starts and most of the developers fly to enjoy the vacations and take a gap from work and business. [Cloudways decides to give a cool treat](https://www.cloudways.com/blog/summer-discount-offer-on-hosting/) and will take care of your online businesses.

## Brief About Cloudways Platform

Cloudways is a Managed Cloud Hosting platform use by Digital Agencies, Ecommerce, Bloggers and developers to empower their online business with speed and no downtime. At Cloudways, You can launch servers on top cloud providers like DigitalOcean, Linode, Vultr, AWS and GCE. All the server and applications can be completely managed by the platform with few clicks.

Well, Summer is the time when business owners got time to rethink and refresh the mind to take advance steps to flourish business. They can be thinking of switching to the better cloud provider to get the maximum peace of mind.  

Cloudways Completely understands the variety of challenges faced by online business. That's why they provide the complete hosting platform for WordPress websites to Magento stores and [PHP/JS based applications](https://www.cloudways.com/en/php-cloud-hosting.php).

## The Offer

AS People is waiting for the BFCM the biggest online shopping event Cloudways decides to treat people at earliest. If you want to switch to a better cloud server sign up for a new Cloudways and use the Promo Code **SCALEINSUMMER** . For the next two months, you will get a [discount of 30% with a free migration](https://www.cloudways.com/blog/summer-discount-offer-on-hosting/) for your websites.  

## The Swags You Love

Beside the Cloud hosting offer you can also participate in the giveaway cooling the summer vibes and win Cloudways branded SWAG including branded t-shirts, sunglasses, summer hat, can cooler, and much more to 50+ most active participants of our giveaway.

Giveaway is for all you don't need to be a Cloudways customer to win this. Whether you hosting you websites anywhere you can take part in the giveaway and win swags.
Big News! GroupDocs.Redaction has been released for Java platform!
Tags: groupdocs, java, api, documentredaction
Published: 2019-06-22 06:58:58

---
title: Big News! GroupDocs.Redaction has been released for Java platform!
published: true
description: Exclude or hide classified information & metadata from documents, worksheets, presentations, PDF and raster image files using Java API. 
tags: GroupDocs, Java, API, DocumentRedaction 
cover_image: https://i.imgur.com/CHnMOxM.png
---

Do you have to deal with a frequent exchange of the digital documents? Do your documents contain classified and sensitive information that needs to be protected? If they do, how do you process such documents to hide or remove some specific information before sending them outside your company? Well, these questions will definitely pop out the solution that you are currently using for protecting the sensitive content in your document.

What if I tell you that you can automate the process of protecting the classified content in your documents? Wouldn’t it be great when you will be able to do it for a bunch of documents using a single click?

Yes, you can now redact, hide or remove sensitive content & metadata from word processing documents, worksheets, presentations, PDF and raster image files in your Java applications using GroupDocs.Redaction for Java.‎ The API provides a single ‎format-independent interface supporting various redaction types such as text redaction, metadata ‎redaction, annotation redaction, and tabular document redaction. Read more: http://bit.ly/2J4dtDB
What Should I learn During these Summer Vacations?
Tags: discuss
Published: 2019-06-22 07:48:23

---
title: What Should I learn During these Summer Vacations?
published: true
tags: discuss
---

I am currently working on my Final Year Project which is related to Java Development and It contains Spring Boot, Spring MVC, and Hibernate and for front-end I am using the Angular 7 Framework. My aim is to become a good Java Full Stack Developer, so anything that would suggest me to become this. 

Thanks in Advance :)
How to use custorm prettier extension at vscode?
Tags: vscode
Published: 2019-06-22 07:21:09

Hello,
I want to use the prettier extension at vscode. But I want to use this one
https://www.npmjs.com/package/@btmills/prettier
instead of the original one.
Is there any settings at `.prettierrc` file or and vscode settings to do to make it use it to format the code?

👌 What I tried to do to format current opened file and save all files, is to add `macros` extension, then to add next lines at `settings.json`:

```json
  "macros": {
    "prettierAndSaveAll": [
      {
        "command": "workbench.action.terminal.sendSequence",
        "args": {
          "text": "./node_modules/.bin/prettier --write '${file}'\u000D"
        }
      },
      "workbench.action.files.saveAll"
    ]
  }
```
But I have to keep terminal open to make it works, and I feel that it is slow 🙄.
So I'm not happy with this way and looking for better
Weekly Round-up #6
Tags: css
Published: 2019-06-22 01:24:17

#Welcome to the 6th entry of this series!

On vacation with the family!!! Which means not as much coding/learning happening for the things that I have been commissioned by my wife to create for her. hopefully she forgives me if I'm late. :-D I am taking advantage of some quiet time to write this post.

This weeks happenings:

<ul>

<li>Saturday - Got to enjoy spending time with familyand friends after being gone for 2 weeks on military shenanigans. </li>

<li>Sunday - Father's Day! Enjoyed a good church service, and then snuggled on the couch with my girls for most of the afternoon. Couldn't have asked for a better way to spend my day.</li>

<li>Monday thru Wednesday - Worked my regular job and spent time getting ready for vacation. On Tuesday I started refreshing myself on the inner workings of flexbox with a course that was recommended by a friend, and mentor on the <a href="https://lets-code.info/">Let's Code</a> discord server.</li>

><a href="https://mastery.games/p/flexbox-zombies">Flexbox Zombies</a> is just **AWESOME!** The main objective is to learn flexbox, prograssively, while surviving zombie attacks. You should seriously check it out. It's probably my new favorite course for learning flexbox.

<li>Thursday - Headed to Tybee Island, GA for vacation! Gonna be so much fun! Worked through more of that flexbox course, which is pretty awesome.</li>

<li>Friday - Here we are at the end of another Weekly Round-up. I'm still enjoying my vacation, and I'm really starting to nail down flexbox.</li>

Thanks for taking time out of your day to follow along with my journey. I know this Round-up is more like an update on my life in general, which is why I appreciate your views even more. I'm looking forward to getting back into coding more often. Gotta get these apps off the paper and into the code. 

-Jeff

>Special thanks to <em>kayak</em> from <a href="https://lets-code.info/">Let's Code</a> for recommending the awesome <a href="https://mastery.games/p/flexbox-zombies">course</a> that has become my new favorite flexbox course.

>I wanna give a shout-out to the awesome people that have been great to chat with, and get advice from, on a relatively new discord server. If you're looking for a community that's supportive, and still fairly new, check out the <a href="https://discord.gg/jweMCx9">HTML All the Things</a> discord. We look forward to seeing you there.
React context/hooks design inspiration for CRUD w/backend?
Tags: react
Published: 2019-06-22 06:50:06

I'm two months into the adventure that is React. So far I've followed some tutorials, worked on a learning project, and basically gotten to the point that I've decided I need to refactor my app to get a clean design.

One thing that has bothered me in particular is that my API backend is fairly well organised, yet I am duplicating code all over the place in the frontend.

Thus, my attention got drawn to the whole context/hooks feature set of React. It seems a great fit for my needs, although I can't really know before I've tested it thoroughly. So I've started to refactor my app to use context and refactored my class components to functional components. So far so good, especially data fetching (GET) is pretty ok.

Long story short: I'd like to see one or more tutorials or articles on how to communicate with the backend from a centralised datastore or similar. What are some great patterns for handling PUT, POST, and DELETE actions for my app?
Some US prisons are banning books on coding
Tags: news, security
Published: 2019-06-22 03:33:51

# 👉 [Prisons Are Banning Books That Teach Prisoners How to Code](https://www.vice.com/en_us/article/xwnkj3/prisons-are-banning-books-that-teach-prisoners-how-to-code)

> Oregon prisons have banned dozens of books about technology and programming, like 'Microsoft Excel 2016 for Dummies,' citing security reasons. The state isn't alone.

...

> “Not only do we have to think about classic prison escape and riot efforts like digging holes, jumping fences and starting fires, modernity requires that we also protect our prisons and the public against data system breaches and malware,” DOC spokesperson Jennifer Black said in an emailed statement. “It is a Balancing Act we are actively trying to achieve.”

This is laughably ignorant.