アプリ関連ニュース

Laravel Date Filtering

I would like to talk about the date filtering process I am using in laravel today.

If we want to select records that is created today. We can normally use raw queries or without raw queries like this.

In fact, we can do more neat and eloquent way in laravel like this.

We can also use Carbon function instead of date(), result will still the same.

If you want to filter just not with full date, it’s totally fine. You can filter with day, month and year like this.

There is also another method called whereBetween if you want to filter by date range.

By Yuuma



ラズベリーパイOSをPC上で動かしてみました

PCにインストール可能なRaspberryPi用のOS(Raspberry Pi Desktop for PC)があります。
今回はこのOSを VirtualBox上の仮想PC にインストールしてみます。

続きを読む

Dry code

Today I would like to make a short introduction about dry code.

What is dry code

There is a principle in programming called DRY, or Don’t Repeat Yourself. It usually means refactoring your code by taking something done multiple times and turning it into a loop or a function. The DRY code is easy to change, because you only have to make any changes in one place.

Advantages of DRY

Maintainability

The biggest benefit of using DRY is ease of maintenance. If the logic of checking permissions was repeated throughout the code, it is difficult to troubleshoot problems that occur in the repeated code. When you fix a problem in one, you can easily forget to fix the problem in other cases. Also, if you have to modify the logic, you have to copy and paste everywhere. By having non-repeating code, you just have to keep the code in one place. New bug and logic fixes can be made in one place instead of many. This leads to robust and reliable software.

Readability

Most of the time, the DRY code is more readable. This is not due to the DRY principle itself, but rather the extra effort that the developer put into the code to make it follow certain principles like DRY.

Re-use

DRY inherently promotes code reuse because we are merging 2 or more instances of repeating code into a single code block. Reusable code pays off in the long run as it speeds up development time.

Cost

If management needs to be convinced to spend more time improving code quality, this is it. More code costs more. More code requires more time to maintain and fix bugs. More time to develop and more mistakes leads to a very unhappy customer.

Tests

We are talking about unit testing and integration testing here, not manual testing. The more routes and functions you have to cover with the tests, the more code you will have to write for the tests. If your code doesn’t repeat, you just have to test one parent path.

By Yuuma.



AndroidのカメラサポートライブラリのCameraXを使ってみました

Androidのカメラ制御は
カメラが対応している解像度の取得や
プレビュー解像度の設定、画面回転など
いくつか面倒なステップを踏む必要がありますが
それらを吸収してくれる公式ライブラリがCameraXです。

ライブラリの使用方法はGoogleのCameraXのドキュメントに記載されていますが、
実際に動かしてみたコードを以下に記載します。
MainActivityにカメラプレビューを表示するだけの機能を持つアプリです。

Kotlinで書いているのもありますが、
ライブラリを使用しない時と比べて、ぐっと必要なコード量が減っています。

画像の撮影や、画像分析もライブラリに含まれているようです。

水曜担当:Tanaka



Pseudocode

Pseudocode is an informal form of programming description that does not require any strict programming language syntax or underlying technology considerations. Used to create an outline or draft of a program. Pseudocode summarizes the flow of a program, but excludes the underlying details. Systems designers write pseudocode to ensure that programmers understand the requirements of a software project and align the code accordingly.

A Pseudocode is a prototype sample, model, or early release of a product created for the purpose of testing concepts and for learning purposes. They help us learn without fully implementing our solutions. When developing user interfaces for our applications, we have several prototypes before the final interface. Some examples of these are wire frames, graphic designs, and mockups.

This is the way how to write pseudo code.

  • Organize your task sequence and write your pseudocode accordingly.
  • Start with the declaration of a pseudocode that states the main goal or goal.

We have to know there are some KEYWORDS to be used in pseudo code.
These are for start and end of a program
BEGIN, END

These are for condition statements.
IF, ELSE, ENDIF, DO, WHILE, ENDWHILE, REPEAT, UNTIL, CASE

These are for user inputs.
INPUT, GET, READ , SET

These are for displaying results.
PRINT, SHOW

Here is some sample pseudo codes.

There are still more keywords and syntax structures of writing pseudo codes but I think you will get the idea by reading this blog.

By Yuuma



アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム