If you are a UNIX lover and fan of Nano text editor then while writing C / C++ code, you would like to put comments using Short-Cut key i.e.
Alt+3. But the problem is, Nano puts the char
# as comment literal instead of
//. This happened because the default literal is
# unless it is defined in configurations.
How to fix?
These days developers go for heavy text-editors and IDEs like InteliJ, PyCharm, RubyMine, Sublime Text with much more extensions, Vim, Emacs, etc. However, in case of the later two they are not memory and processor heavy however they have very steep learning curves.
On the other hand, GNU Nano come as a life saver. It requires a few MB of RAM(say 3-4 MB) and uses very less CPU resource. Nano is a much powerful tool with much more features.
Computer’s primary memory is divided into four segments, namely: data, stack, heap and code.
What is Memory Management?
You are already familiar with the notion that Memory is most expensive resource in the system. Therefore you only use and ask for amount of memory that will suffice. As soon as you are done, you free up the memory so that OS can sell those memory blocks to some other needy software. This practice of using memory wisely is known as Memory Management. Continue reading
Well, there are a number of SSL Certification Authorities but all of them charges yearly fees for certificates they provide. I feel bad because, they are like middle-men do nothing but sign your certificates. But, if you don’t want to pay them you can get signed certificates from letsencrypt.org. Continue reading
It’s okay to make mistakes when you are up to building simple applications. But for mission critical applications like Banking/Payment Processors, you gotta be very careful and keep listening to seniors and experts in critical matters.
Lets say you are working on a feature to update the total amount deposited in a particular account. Simple code will do like
# just after amount is debited from payee's account
update_attribute :total_amount, total + debited_amount
What’s wrong with the code above?
Actually there are various ways to achieve this. Firstly you can use the PostGreSQL’s
copy command. Secondly you can choose to use Ruby to load data.
copy command in PG
Create your table:
CREATE TABLE zip_codes
(ZIP char(5), LATITUDE double precision, LONGITUDE double precision,
CITY varchar, STATE char(2), COUNTY varchar, ZIP_CLASS varchar);
Copy data from your CSV file to the table: Continue reading
Well, slower test suite is a nightmare both in your local machine and in your CI server. If your gem provider has built some Mocking APIs then its cool. But, no mocking API and you are writing Unit Test for your models and controller then beware, do not leave your app making HTTP requests everytime.
What to do?
If you cannot mock your library then mock the damn Internet. Simple enough! you can get going in a couple of minutes. Continue reading