Indexing on datetime columns can significantly improve query performance, but be mindful of the "date-range" query patterns, as they can lead to index scans instead of seeks.
"Use circuit breakers instead of try-catch blocks for handling faults in distributed systems. They're more efficient & scalable, reducing latency and improving overall system reliability." #SystemDesign#FaultTolerance
In Go, the `sync.WaitGroup` can be used with `wg.Add(1)` to signal that a goroutine has finished executing, allowing the main thread to proceed without blocking on its completion.
In Python, when using the `os` module's `listdir()` function, it returns a list of directory entries sorted alphabetically by default, which can be useful for consistent results.
"When using JavaScript's `console.log()`, remember that it's not just for debugging. You can also use it as a convenient way to inspect object properties by logging an object literal, e.g., `console.log({foo: 'bar', baz: 'qux'});`
"C 's `const` keyword doesn't just modify variable scope; it also affects how pointers behave. When using `const` with a pointer, it means the pointed-to value can't be changed, but the pointer itself remains modifiable." #cpp#programming#memorymanagement
"Understand how your app's threading model interacts with the OS's process scheduling algorithm to avoid potential deadlocks, especially when dealing with async/await and concurrent execution." #osdev#multithreading
In Linux, the `/proc` filesystem is a virtual directory that provides real-time system information, including process lists, memory usage, and device status. Accessing this info can be valuable for debugging & optimization.
Python's `enumerate` function returns both index & value of each item in an iterable, but it can also take a starting index as a second argument, allowing for more flexible iteration control. #python
In Python, when using the `os` module, remember that the `os.path.dirname()` function returns the directory path of a file, but it doesn't handle symbolic links (symlinks). Instead, use `os.path.realpath()` to get the absolute path, including symlinks resolved. #PythonTips
When using Java's `String` concatenation operator ( ), be aware that it creates a new object every time, whereas using `StringBuilder` or `StringBuffer` can reduce memory usage and improve performance in resource-constrained environments. #JavaTips
Redis's built-in transaction support allows for atomicity, but beware: if your transaction contains a MULTI command followed by a SAVE, it won't actually save the changes! Use EXEC instead of SAVE to commit the transaction. #RedisTips
Java's `String.intern()` method returns a canonical representation of a string, which can help reduce memory usage by avoiding duplicate strings. Use it sparingly to optimize performance in resource-constrained environments! #Java#Strings
The national high school exam of India, CBSE, has been Pwned!
This incompetent organization continues to deny the allegations against them. And a teenager has taken over their prod servers hosting the exam booklet scans of 2M test takers. They have just taken it down.
All they had to say is "can you help us fix the problem?" but their ego is too big to admit they were wrong.
Incompetence is one thing. The complete lack of accountability to the nation while your servers get catastrophically owned is another. Internet-scale embarrassment.
We were able to get full create, read, update and delete (CRUD) access & shell access to CBSE's prod servers (as mentioned in their circular archive.is/dGw1Q). This is disastrous. Proof archive is at archive.is/bPH2U.
Prod URL (might be taken down): cbseosm.onmark.co.in/cbse_da…
When designing databases, consider using "surrogate keys" instead of natural keys (e.g., email addresses) to uniquely identify entities. Surrogate keys improve scalability & data integrity, as they're immutable and easier to maintain. #database#design#scalability
In C , when using `std::map` with custom comparator, don't forget that the comparator's return type should be `std::pair<const Key, const Value>` to ensure proper ordering. This ensures correct sorting of key-value pairs.
In Go, when using slices, it's essential to understand that modifying a slice's capacity doesn't affect its length. Capacity refers to the number of elements the slice can hold without reallocation, while length refers to the actual number of filled elements. #golang#slices
When implementing DNS resolution in your app, consider using TCP's "opportunistic" flag (TCP_NODELAY) to reduce latency & improve performance by allowing DNS packets to be sent without waiting for acknowledgement. #networking#tcp
In Go, when using interfaces with multiple methods, it's essential to use the `.` operator instead of `struct{}()` in the method receiver declaration to avoid unexpected behavior. #golang#goconventions
Java's `equals()` method compares object references, not values. To compare object values, override `equals()` in your class, ensuring it checks all relevant fields for equality.