Syed Aslam

Thoughts, Stories, and Ideas

Working with Files in Ruby

by Syed Aslam in Ruby · 10 min read

The built-in class File provides the facilities for manipulating files in Ruby. Let us explore the basic file operations, including opening, reading, writing along with querying file objects to get information about the file itself.


Recover MySQL root Password

by Syed Aslam in Mysql · 1 min read

Its easy and quite common to forget a database's password. However, this doesn't mean the end of the world. Let's see how we can recover MySQL database server password following five easy steps.


Centering a Fixed-Sized Element with CSS

by Syed Aslam in Css · 1 min read

Here is one way to center a fixed-width/fixed-height div at the center of its container. This could be adapted to centering text, images, etc. within their containers. Essentially, we do a bit of arithmetic to get the fixed-sized element centered using absolute positioning and margins. Note that the parent container must have a `position: relative` property for this to work.


Re-initializing table sequence in postgresql

by Syed Aslam in Postgresql · 1 min read

Re-initializing a table sequence is quite normal and required in some cases. I had to do that recently. If the table has data and needs to be preserved, then temporarily you have to move the data, delete the data in original table and re-initialize the sequence and copy the original data again. Let's see how to re-initialize table sequence in PostgreSQL.

postgresql sequence