TILs - Fueling Curiosity, One Insight at a Time

At Codemancers, we believe every day is an opportunity to grow. This section is where our team shares bite-sized discoveries, technical breakthroughs and fascinating nuggets of wisdom we've stumbled upon in our work.

Published
Author
user-image
Satya
Delivery Order in Odoo is used for sending goods from warehouse to customer and external parties, to transfer between warehouses use Internal Transfers in Odoo.
#inventory-management #wms #odoo
Published
Author
user-image
Gautam
Director
If using Podman (instead of Docker for Mac) and trivy for image scanning, trivy expects DOCKER_HOST env variable to be setup for scanning local images and fails unless DOCKER_HOST is pointing to the podman socket.

Fix:

Code

$ export DOCKER_HOST="unix://$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')"
$ trivy image image_name


#docker #devops
Published
Author
user-image
Sujay
atob() function decodes a string of data which was encoded using Base64 encoding and btoa() method encodes the data
Published
Author
user-image
Giritharan
System Analyst
ActiveSupport::TimeZone.all which likely fetches a list of available time zones supported by the ActiveSupport library in rails.
Date::ABBR_DAYNAMES, which is an array containing abbreviated names of the days of the week (e.g., ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]). This array is provided by Ruby's Date class, making it convenient for developers to access the names of the days without manually typing them out.
Published
Author
user-image
Ashwani Kumar Jha
Senior System Analyst
While exploring a lengthy code file, we often need to see the available properties and methods without diving into their implementation. In VS Code, this is quite easy with "Fold Level 1" functionality. This feature collapses the code to display only the top-level structures, which makes it easier to understand the file's architecture without getting into the details.

To Use Fold Level 1:

1. Open Command Palette: Ctrl+Shift+P (Windows) or Cmd+Shift+P (macOS).
2. Select Fold Level 1: Now, only the main parts of our code will be visible.
#vs-code, #coding
Published
Author
user-image
Soniya Rayabagi
Migration of a Repository from GitLab to GitHub:
1. Clone the GitLab Repository Locally

Code

git clone <GitLab-repository-URL>
cd <repository-name>


2. Add the GitHub Repository as a Remote

Code

git remote add github <GitHub-repository-URL>


3. Resolve any merge conflicts that may arise using rebase after pull

Code

git pull github main


4. Push from your local repository to the GitHub repository

Code

git push github main

Published
Author
user-image
Giritharan
System Analyst

Code

Resolving blocked host:


The Blocked Host is a new feature of Rails 6. To resolve the Blocked Host error in rails, add config.hosts.clear to config/environments/development.rb in your Rails project. This disables the functionality in the development environment, allowing requests from ngrok.
#host-block-issue, #rails
Published
Author
user-image
Sujay
Extract the source code of the gem to a local directory by using the command gem unpack GEMNAME.
Published
Author
user-image
Satya
Setup Tailscale in local device and serve your localhost
1. Intsall tailscale from https://tailscale.com/download for your device.
2. Sign up and follow the steps so that your device gets connected.
3. Open your terminal and download tailscale CLI using brew install tailscale
4. Run tailscale serve 3000 (you might get some warning regarding client and server version mismatch)
5. It will say Serve is not enabled on your tailnet. and ask you to visit https://login.tailscale.com/f/serve?node=<node-id>
6. In that link enable the option , and that's it , it will serve your port 3000 successfully.
#tailscale , #devops
Published
Author
user-image
Satya
While changing a column type from one type to another and running rails db:migrate , it will throw the below error

Code

PG::DatatypeMismatch: ERROR:  column "tags" cannot be cast automatically to type jsonb
HINT:  You might need to specify "USING tags::jsonb".


above error ^ because i was converting tags field from type string to jsonb
so in order to fix this we have to mention the USING tags::jsonb and cast the type.

Code

class ChangeTagsToJsonbInTils < ActiveRecord::Migration[7.0]
  def change
    change_column :tils, :tags, 'jsonb USING CAST(tags AS jsonb)'
  end
end


#migration, #database, #rails

Showing page 29 of 83

Ready to Build Something Amazing?

Codemancers can bring your vision to life and help you achieve your goals