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.
Sep 30, 2025
To understand network sockets locally, you can try this simple demo with two terminal tabs:
1. In the first tab run
2. In the second tab run
Now type text in one terminal and press
#sockets
1. In the first tab run
ns -l 1234
: This starts a small server process that listens for TCP connections on your computer’s address (localhost / 127.0.0.1) at port 1234.2. In the second tab run
ns localhost 1234
: This connects a client to the server on 127.0.0.1:1234
, creating a TCP connection between the two processes.Now type text in one terminal and press
Enter
you’ll see the same text appear in the other terminal and vice-versa. 🚀#sockets
Satya
Sep 24, 2025
Filtering API logs with path params in OpenSearch
When querying logs in OpenSearch Dashboards, paths with dynamic segments (like IDs) often don’t match with the usual search bar syntax because the field is mapped as
Problem:
• Queries like
return no results.
•
Solution:
Use Query DSL with a
✅ Wildcard query (matches any value in the middle):
✅ Regex query (restricts the middle part to numbers):
#opensearch #logs
When querying logs in OpenSearch Dashboards, paths with dynamic segments (like IDs) often don’t match with the usual search bar syntax because the field is mapped as
text
instead of keyword
.Problem:
• Queries like
json.req.url: "/api/bankAccounts/*/debit"
return no results.
•
.keyword
may not exist (json.req.url.keyword
) if the field wasn’t mapped that way at ingestion.Solution:
Use Query DSL with a
wildcard
or regexp
query.✅ Wildcard query (matches any value in the middle):
{
"query": {
"wildcard": {
"json.req.url": {
"value": "/api/bankAccounts*/debit"
}
}
}
}
✅ Regex query (restricts the middle part to numbers):
{
"query": {
"regexp": {
"json.req.url": "/api/bankAccounts/[0-9]+/debit"
}
}
}
#opensearch #logs
Ashwani Kumar Jha
Senior System Analyst
Sep 24, 2025
You can mark methods as deprecated in Rails using
💡 Might be especially useful in larger codebases, where many developers might be using the same method and you want to safely signal that it will be removed without breaking things immediately.
#Rails
ActiveSupport::Deprecation
. This warns developers that a method will be removed in future versions.
class User < ApplicationRecord
def full_name
"#{first_name} #{last_name}"
end
# Mark full_name as deprecated
deprecate :full_name, deprecator: ActiveSupport::Deprecation.new("2.0", "MyApp")
end
DEPRECATION WARNING: full_name is deprecated and will be removed from MyApp 2.0
💡 Might be especially useful in larger codebases, where many developers might be using the same method and you want to safely signal that it will be removed without breaking things immediately.
#Rails
Mohammad hussain
System Analyst
Sep 19, 2025
In Prisma, there’s a big difference between directly setting a foreign key and using
• Direct assignment just writes the raw foreign key value — Prisma doesn’t check if the user actually exists.
•
#prisma
connect
when creating related records.
// ❌ Directly setting the foreign key
users: {
create: {
userId: testUser.id,
},
}
// ✅ Using relation API
users: {
create: {
user: {
connect: { id: testUser.id },
},
},
}
• Direct assignment just writes the raw foreign key value — Prisma doesn’t check if the user actually exists.
•
connect
uses Prisma’s relation API, validates that the record exists, and safely links them.#prisma
Nived Hari
System Analyst
Sep 17, 2025
Nx has a built-in command to remove libraries
Nx provides the
The command:
What it does automatically:
• Deletes the library folder and all its files
• Removes the project from nx.json and workspace configuration
• Checks for dependencies and warns if other projects still use it
We can use
#nx #monorepo
Nx provides the
@nx/workspace:remove
generator that can remove a library from our workspace.The command:
npx nx g @nx/workspace:remove
What it does automatically:
• Deletes the library folder and all its files
• Removes the project from nx.json and workspace configuration
• Checks for dependencies and warns if other projects still use it
We can use
--forceRemove
flag if we want to remove a library even when other projects depend on it (though this can break the build).#nx #monorepo
Ashwani Kumar Jha
Senior System Analyst
Sep 2, 2025
WITH (NOLOCK)
is often used to speed up queries by avoiding shared locks, which means the query won’t block other reads or writes. This can improve performance on busy systems, but it comes at the cost of data accuracy.When using
NOLOCK
, SQL Server may:• Read uncommitted (dirty) data that could later be rolled back.
• Return missing or duplicate rows due to page splits and concurrent writes.
• Show inconsistent values within the same row if columns are updated mid-read.
In short:
NOLOCK
trades reliability for speed. It’s fine for dashboards, reports, or monitoring where approximate numbers are acceptable, but it should be avoided for financial or critical business logic where accuracy is essential.#sql
Nived Hari
System Analyst
Sep 2, 2025
Prisma
Creates a migration file with the SQL changes but does not apply them to the database.
Why this is useful:
✅ Safe inspection – lets you review the generated SQL before running it, especially helpful for destructive operations like drops or PK changes.
✅ Manual adjustments – you can tweak the SQL (e.g., add a USING clause for type casting or backfill data before dropping a column).
✅ Separation of responsibilities – you can generate migrations while DBAs/ops review and apply them in controlled environments.
Key takeaway:
👉
#postgres
--create-only
npx prisma migrate dev --create-only --name <migration_name>
Creates a migration file with the SQL changes but does not apply them to the database.
Why this is useful:
✅ Safe inspection – lets you review the generated SQL before running it, especially helpful for destructive operations like drops or PK changes.
✅ Manual adjustments – you can tweak the SQL (e.g., add a USING clause for type casting or backfill data before dropping a column).
✅ Separation of responsibilities – you can generate migrations while DBAs/ops review and apply them in controlled environments.
Key takeaway:
👉
--create-only
is like a dry run for migration generation – you get the recipe, but the dish isn't cooked yet 🍳.#postgres
Sudeep Hipparge
Sep 1, 2025
Rails has a built-in way to reduce repetition in associations—
When multiple
Using with_options, you can group them under one block:
This makes the intent clearer—all these associations share the same rule.
It's easier to read, less error-prone, and keeps your model DRY ✨
#Rails
with_options
.When multiple
has_many
relationships share the same option (like dependent: :destroy
), repeating it clutters your model:
class Account < ApplicationRecord
has_many :customers, dependent: :destroy
has_many :products, dependent: :destroy
has_many :invoices, dependent: :destroy
has_many :expenses, dependent: :destroy
end
Using with_options, you can group them under one block:
class Account < ApplicationRecord
with_options dependent: :destroy do
has_many :customers
has_many :products
has_many :invoices
has_many :expenses
end
end
This makes the intent clearer—all these associations share the same rule.
It's easier to read, less error-prone, and keeps your model DRY ✨
#Rails
Mohammad hussain
System Analyst
Aug 22, 2025
Next.js Typed Routes
Next.js now provides TypeScript support for route parameters and navigation, helping catch routing errors at compile time rather than runtime.
Next.js automatically generates route types based on our file structure in the
For example, if we have:
The generated types will understand routes like
#nextjs #typescript
Next.js now provides TypeScript support for route parameters and navigation, helping catch routing errors at compile time rather than runtime.
Next.js automatically generates route types based on our file structure in the
app
directory.For example, if we have:
app/
users/
[id]/
page.tsx
posts/
[slug]/
page.tsx
The generated types will understand routes like
/users/123
and /posts/my-post-slug
.
import { useRouter } from 'next/navigation'
import Link from 'next/link'
// TypeScript knows about our routes
const router = useRouter()
router.push('/users/123') // ✅ Valid
router.push('/invalid-route') // ❌ TypeScript error
// Link component is also typed
<Link href="/posts/my-slug">My Post</Link> // ✅ Valid
<Link href="/wrong-path">Invalid</Link> // ❌ TypeScript error
#nextjs #typescript
Ashwani Kumar Jha
Senior System Analyst
Jul 30, 2025
How LLM's temperature affects AI output:
LLM models use a parameter called
Tip: Use lower temperatures when you need reliable, consistent responses, and higher temperatures for creative or exploratory tasks.
#llm
LLM models use a parameter called
temperature
to control randomness in generated responses.temperature: 0
→ deterministic output (same input = same output)temperature: 1
→ default setting, balanced creativitytemperature > 1
→ more random, creative, but less reliableTip: Use lower temperatures when you need reliable, consistent responses, and higher temperatures for creative or exploratory tasks.
#llm
Adithya Hebbar
System Analyst
Showing 2 to 5 of 82 results
Ready to Build Something Amazing?
Codemancers can bring your vision to life and help you achieve your goals
- Address
2nd Floor, Zee Plaza,
No. 1678, 27th Main Rd,
Sector 2, HSR Layout,
Bengaluru, Karnataka 560102 - Contact
hello@codemancers.com
+91-9731601276