Systems | Development | Analytics | API | Testing

Latest Posts

What is Migration in Rails?

Migration in Rails is a tool that allows the developer to use Ruby to change an application's database schema. Instead of using SQL scripts, we use Ruby code, which is database independent, so it is easy to move the application to a completely new platform. We define these database changes in domain-specific language (DSL), and these migrations can be rolled back and managed along with the application source code.

How to Use errors. WithMessage() in Golang

In Golang, the WithMessage() method allows you to annotate errors with an additional message. Often, error values by themselves don’t give enough context to be useful in debugging. Take, for example, Golang’s basic error handling technique: In Golang, errors are treated as values, so err contains the error value. In this situation, a developer could make use of the error package to add context to the code along with the failure path without destroying the original value of the error.

How to Fix E_WARNING: strpos(): Empty needle in PHP

The PHP strpos($haystack, $needle, $offset) function is used to find the numeric position of the first occurrence of a substring in a string. The haystack parameter is the string to search in, and needle is the substring being searched for. The E_WARNING: strpos(): Empty needle warning is issued if the needle substring is empty when calling the strpos() function.

How to Handle an ActionController:: RoutingError in Ruby on Rails

The ActionController::RoutingError is the most common error faced when working on a Ruby on Rails project - it’s equivalent to the classic 404 error in web applications. The ActionController::RoutingError indicates that there isn't a route in the application for the URL entered by the user in the browser.

How to Wrap and Unwrap Errors in Golang

In Golang, wrapping errors means adding more contextual information to the error which has been returned. For example, the additional information could be the type of error, the cause of the error, or the name of the function where the error is raised. Wrapping is very useful for debugging since you can precisely and quickly locate the source of the problem.