rails Fixing common issues when reindexing data on Solr I have recently set up a legacy project which is running on Rails 4 and Solr 5. It uses sunspot_rails gem to interact with Solr server. Because the project is pretty old with deprecated libraries, I decided to use Docker to run it on my local. Everything seems fine
PHP Some tips for doing OAuth Integration with Magento I am not a PHP developer but recently I have been asked to build a Lambda service written in Ruby which calls Magento API via its OAuth Integration. That might sound simple because 3rd-party API integration is not something new and I have done lots of similar tasks before. However,
wordpress Debug a slow Wordpress site A few days ago my colleague asked me to help him figure out why his Wordpress website was running so slow. Everything seemed fine, the CPU was not busy, the memory was not used much. It was not the network issue because its ping time was very fast. The MySQL
mysql Restore data from InnoDB file (idb & frm) using TwinDB toolkit We have been told many times that modifying live database should be done with extreme care, we should always make a backup before doing something big to the database. However, there are countless stories on the Internet about losing data due to various reason, one of them is forgetting to
ruby Doing some work before exiting (Ruby) When running a few programs (like Web server or a script), do you notice that sometimes they print out "Good bye" message before exiting? I was wondering if I could do a similar thing in Ruby and it turned out to be pretty easy. First, I learned that
Removing duplicate entries from a large table in MySQL A few days ago I faced an issue in my Ruby on Rails application. The issue was caused by some duplicate rows in a very large the MySQL table (more than 1,5 million rows). The obvious solution of course is to remove duplicate rows from the table and add
best practices Working with temp files in Ruby Temp files are necessary in cases when you need to store some data before feeding it into another program. In this post, I am going to show you several ways of creating temp files and how to use them in Ruby code. Temp files or temporary files are files created
debugging Install TensorFlow with GPU support on a RedHat (supercluster) I am working on a deep learning model for text summarization and I use TensorFlow as my main framework. It is a great framework and contains many built-in functions to ease the implementation. However, when I trained my model, it was too slow. It took about 7 seconds to train
tools Must-have Chrome extensions for Web Developers As a Web developer, we always look forward to building the best web applications. But things do not always go well with developers. Users nowadays ask for better UI, better UX. An inappropriate color for a link or a wrong position of an image on a website could become annoying
debugging Resolve issue "No Qt bindings could be found" on Git-cola (OSX) I am using OSX and I wanted to install git-cola for manage my Git projects. Unfortunately, after installing python using brew, I could not run it. When typing git cola to terminal, I kept getting the following error message: Traceback (most recent call last): File "/usr/local/bin/git-cola&
css Using "flex" property in CSS to define webpage layout Designing a flexible layout which can scale to different screens on many devices is non-trivial. We often use float, position: absolution or other properties to achieve the desired result. However this process is uncomfortable to developers and we always dream of a better way. Today, I want to introduce to
UNIX commands for daily tasks UNIX is a base OS for many popular OS you are using right now, from Linux to Mac OSX. Those OS share common commands so it is pretty easy to switch from one OS to another. Because it is so important to understand and use UNIX commands, I want to
rails Using PhantomJS to serve HTML content of Single-page App One big drawback of Single-page application is the ability to fully support SEO as traditional sites. The reason is because in a single-page application we often use a technique called lazy-rendering, in which the real content is not rendered from the server but only the basic layout is returned. Many
tricks View printers information on Mac OSX Do you know that there is a hidden feature in Mac OSX which allows you to view information of all printers added on your Mac? Last week I was looking for a way to know the IP address of a network printer which I added a long time ago but
python Install python and pip as local user on shared Linux A few days ago, I was struggling to install python on a Linux machine, in which I had no root permission. That machine was shared with many other users and there was only an old python version already installed on the machine. After a bit of search and trial, I
deployment Common DNS configuration issues DNS is one of the most fundamental parts of a website. No website can run without a proper configuration on DNS. For beginners, it might be a bit difficult for them to understand and resolve DNS-related issues. This post aims to provide a bit more help for those who are
best practices Understanding things inside ~/.ssh We have been using SSH all the time but not all people really understand the files we put inside the ~/.ssh folder on our computer. It was a myth to me when I was first using SSH, but things are pretty clear to me now and I want to share
best practices Funny issue with "grep" The other day I was working on a simple program on CentOS and I met an issue which turned out to be quite funny. At first I didn't think it worth a post here, but later I decided to put it here so that I won't ever make the same
best practices Execute command remotely via SSH Working as a web developer, you will eventually get familiar with server configuration, like how to setting up Nginx or Apache, how to check production logs, how to tune server for better performance, etc. Almost all of those things are done via SSH. In the past, I had to log
Executing shell script from Ruby code Many times when we are developing an application using Ruby, we want to run a shell script to do certain task. For example, imagine that I have a script do_something.py which performs a very complex calculation and returns the result. From the extension, you can easily guess that
git How to create private git server Github, Bitbucket or Gitlab are common git servers you have heard of. But do you know that you can also create your own git server with just a few lines of commands? Today I'm going to show you how to do that. In this post, I am assuming that you
rails Git rebase or Git pull? A few days ago, one member in my lab and I were about to finish a project together. We also used git server for sharing code and collaborate. However, when I used combination of git fetch, git stash, git rebase and git stash apply to fetch new code, he said
rails Tips for debugging your production web app Running the app in development or staging environment is a lot easier than production environment. There are so many unexpected factors which make your application unstable in production, such as a high number of concurrent users, lots of queries to database, etc. And when something go wrong on production app,
rails Understanding Locking in Rails ActiveRecord Data consistency is very important in many applications, especially for application related to finance, banking, etc. A small error could become a tragedy if we do not treat it seriously. This time, I am going to talk a bit about Locking and how you can use it to protect data
rails Useful NGINX configurations for Rails app Nginx is now becoming the favorable choice of many Rails developers when deploying the Rails app. It is lightweight, fast and has almost everything we need. In this post, I am going to introduce a few useful configs which I often use in Rails app. Redirect www to non-www or