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
Iffyuva
In order to disable pager in postgresql, just use this command \pset pager off. This command is useful for seeing data from tables with huge jsonb data
Published
Author
Ashwani Kumar Jha
Senior System Analyst
JSON serialization in API responses omits fields with undefined value to follow the JSON specification. According to the JSON standard, properties with undefined values are not allowed in JSON objects, these are the allowed JSON values: object, array, number, string, true, false, or null.
We need to be mindful while handling the missing data. On the backend, use null or defaults for missing data. On the frontend, ensure data is present before accessing it.
Published
Author
Ashwani Kumar Jha
Senior System Analyst
Image Sprites
• Technique to reduce server requests for loading multiple images. • Combine several small images into a single, larger image called a sprite sheet. • Instead of loading multiple individual images separately, we can load a single sprite sheet. • We can refer to individual images within the sprite sheet using CSS background positioning.
Code
// let's say we want to show logos of our client.logo { background-image: url('client-logos-sprite.png'); background-repeat: no-repeat;}.client1 { background-position: 0 0;}.client2 { background-position: -100px 0;}
Published
Author
Rishav Raj
System Analyst
How to fetch and test those API endpoints which is accessible after login into the applications.
1. Launch the browser navigate to the login page using playwright 2. Enter the login credentials and submit the form to login. 3. After successful login, use playwright API to access the API endpoints. 4. Make API requests and assert the response to validate the functionality Example of fetching API after login :
Monkey patching in Ruby is dynamic modification of class. It means overwriting existing methods at runtime eg:
Ruby
class String def reverse 'Reverse op blocked' endend'Hello'.reverse>> 'Reverse op blocked'
Published
Author
Rishav Raj
System Analyst
how to automate the OTP for cypress test
There is a package called gmail-tester which help use to retrieve mail from the gmail, its have lots of option like from, to, subject, mail_body etc
Package link :https://github.com/levz0r/gmail-tester
If you get the able to get the mail then you are good to go to extract OTP from the mail body after extracting otp from the mail you will able to automate the gmail OTP.
Thanks
Published
Author
Syed Sibtain
System Analyst
Error Monitoring in Bugsnag works similar to Sentry and the commonly used method is bugsnag.notify() . It also takes an error object and captures it as an event. And we can set it up for different environments by using ENV (similar to sentry) or manually configure it as well. FYI: Sentry has a broader approval by developers.
EG:
JavaScript
try { // Some code here} catch (error) { bugsnag.notify( new Error(`Error ${error} while sending Standup popup`) );}
Published
Author
Syed Sibtain
System Analyst
In Sentry we have two methods available, captureException() and captureMessage(). 1. captureException() method is used to explicitly report errors and exceptions. We can pass an Error object to captureException() to capture it as an event in Sentry. 2. captureMessage() method is used to capture a simple message for debugging purposes. Typically, messages captured with captureMessage() are not emitted as events. We can additionally add severity level to this. Available levels are "fatal", "error", "warning", "log", "info", and "debug".
Published
Author
Vaibhav Yadav
Senior System Analyst
Local storage does not work right off the bat when we render a web page within an App. App Dev will have to ensure that DOM storage is enable for it to work.
Published
Author
Syed Sibtain
System Analyst
Mocking useSWR directly in test cases is a little complicated and even not recommended at some places. So the ideal way to do it is using a library Mock Service Worker. Here are the steps that helped me solve this. 1. Create a mock server using setupServer from msw/node: