Categories
Travelling

Killarney, Ireland

I visited Killarney for the long weekend from Dublin. It is about 4 hours and 30 minutes from Dublin by Bus. The town is small and people seem to be very happy with life.

Categories
Travelling

Dingle, Ireland

I traveled to Dingle. It was a very¬†sunny day so everything looked really great. Dingle town is also a small nice place. ūüôā

 

Categories
Programming

Opening Right-click Menu / Context menu with Selenium WebDriver

Selenium WebDriver providesActionBuilder to perform complex user interactions with a web page. It allows chaining multiple actions together to perform a complex action.

You can create a complex action and execute the action (perform) it in the following manner. (Ruby)

driver.action.key_down(:shift).
              click(element).
              click(second_element).
              key_up(:shift).
              drag_and_drop(element, third_element).
              perform

 

The action to open the context menu is context_click() .

driver.action.context_click(webdriver_element).perform

By default, it will click on the middle of the element if you provide one.  Otherwise, it will click where the mouse pointer is at.

If you want to move the pointer to a specific location of the page before clicking, use methodmove_to.

 

If you want to select an item from the context menu use arrow keys and enter then perform the action. You can also further pinpoint the cursor position by using  custom position from your element reference

page.driver.browser.action.move_to(webdriver_element, 5, 10)
 .context_click
  .send_key(:arrow_down)
 .send_keys(:enter)
 .perform

 

Ref: http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/ActionBuilder

Categories
Programming

How to ignore PostgreSQL tables when restoring a database

At my current workplace, we use a copy of the backup database which is created by pg_dump to restore in our development machines. Since the database has a lot of audit tables which adds up a lot of space, I needed an easier way to ignore these tables when restoring the database.

Apparently pg_restore can generate a list of tables in the dump file archive. The advantage is that we can use the same list to specify what content we need to restore.

pg_restore options

Here are the pg_restore options we are going to use for this.

-l --list
List the contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l, they will restrict the items listed.

-L list-file --use-list=list-file
Restore only those archive elements that are listed in list-file, and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L, they will further restrict the items restored.

list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon (;) at the start of the line. See below for examples.

Steps

Let’s generate the list while ignoreing the content for the tables we don’t need. Note that I use an inverse grep statement to ignore the content of the tables where the table names that ending with _audits¬†and create the output in restore.list¬†file.

pg_restore -l <dump_file.data> | grep -v 'TABLE DATA public .*_audits' > restore.list

Then simply use -L to tell pg_restore to use the restore.list file.

pg_restore -U #{USERNAME} -O -L restore.list -v -c -d atlas_development PostgreSQL.sql

Ref
pg restore options: https://www.postgresql.org/docs/10/static/app-pgrestore.html

Categories
Travelling

Wexford, Ireland

I traveled to Wexford with my office colleague on the weekend. IT was a nice county and we traveled to a number of places.

Categories
Blog Ideas

Improving online gaming experience over IEEE 802.11ac WiFi

This article is how to get a great online gaming experience with a stable and fast WiFi connection over IEEE 802.11ac. This article only focuses on IEEE 802.11ac because it is the best wifi standard we have right now for a great wifi experience that can sometimes be equivalent to Ethernet cables if not better for the daily average user. If you want to go beyond you can try 802.11ad but there are drawbacks for the average user(see below).

The Hardware Devices

In the market to identify the best WiFi router and adapter (USB or PCI) you can buy, there is a naming convention you can follow. The technology supported by the router or adapter is indicated by ACXXXX (where XXX is a number). Higher the XXX number the better meaning that the AC1300 will give more speed (Mbps) over AC1200.  Some example devises TP-Link AC5400 WiFi Router, TP-Link AC1900 Wireless High Gain Dual Band USB Adapter.

  • The more antennas the device has the better.
  • A WiFi adapter that supports IEEE 802.11ac at least needs USB 3.0 connection. So make sure your computer has a USB 3.0 or 3.1  / USB-C connector if you need a USB adapter.

Recommended WiFi Router

AC5400 Wireless Tri-Band MU-MIMO Gigabit Router

Recommended WiFi USB adapter

TP-Link AC1900 Wireless High Gain Dual Band USB Adapter

Configuring WiFi Adapter

In Windows, once you have installed the adapter, you should see the device under network devices.

Then:

  • Right-click the wireless adapter and click Properties.
  • Click the Advanced tab to configure the advanced settings.

Now you should see multiple options where you can set to update configuration for wifi connectivity.  Following are the settings I get for my TP-Link AC1900 USB adapter.  See below on how to change these options get the best results.  Also, certain properties may not appear depending on the type of wireless adapter, driver version, or operating system installed. Please kindly let me know if you know more properties and preferred values. One important thing is to select only VHT options, not VHT/HT together, for a relevant property.  Because

  • VHT = Very High Throughput = 802.11ac
  • HT = High Throughput = 802.11n

Another thing is, please take a note of the current values for the properties before changing as depending on your wifi interference, the network might stop working altogether.

 

 

Property What is it? How to choose the best value
AMfactor Need information  
BeamCap Beamforming / for stable and fast connection Only VHT
EnableAdaptivity Will try change frequency if it detects WiFi noise  Disable it, if you are relatively closer to the router OR if there are not many WiFi networks around
HLDiffForAdaptibity Probably relates to adaptivity behavior Disable it if you have disabled EnableAdaptivity
L2HForAdaptivity  Probably relates to adaptivity behavior Disable it if you have disabled EnableAdaptivity
LDpcCap For correction error  Disable it for faster connection
QoS Support Helps to prioritize data depending on the service  Enable it
StbcCap Space-Time Block Coding  Disable it for faster connection
USB RF SELECT Need information  
USB SF Mode Need information  
VHT 2.4G If you need 2.4GHz mode for long range (slow speed) Keep ‚Äėenabled‚Äô for better reliability.
VHT 2.4G IOT If you need 2.4GHz mode for long range (slow speed) Keep ‚Äėenabled‚Äô for better reliability.
Wifi Config Need information  
Wireless Mode What WiFi standard to use. I.E. for best, 802.11ac. Basically only 802.11ac
     
     
     
     
     

What about 802.11ad?

The 802.11ad protocol supports 60GHz for more(more) speed. However the signal cannot go through walls, So you need to have a line-of-sight with the Router and Adapter.

I am not going to write about this more, as I don’t have any experience.

Categories
Travelling

Belfast, Ireland

Belfast is the capital of Northern Ireland. It is also popular as the place where Titanic was built.

Categories
Programming

Vagrant – Running Rails server in the background

Let’s say when you boot up or restart your virtual machine, you want to run the Rails server in the background for your Rails application.

It is pretty easy. First, let’s create a function for the script block. Put following code on the top of the Vagrant file.

def start_rails_server
<<-SHELL
cd /vagrant
# start rails server as a daemon
# to kill: sudo kill `cat tmp/pids/server.pid`
rails s -d
SHELL
end

Now in the Vagrantfile configuration block, use the script function and set it to run always. 

Vagrant.configure("2") do |config|
...
config.vm.provision "shell", inline: start_rails_server, run: 'always'
...
end
Categories
Programming

Setting up Ruby SDK for RubyMine with Vagrant

This article is about how you can configure to use the Ruby SDK in your Vagrant image with RubyMine.

For this, I have used the  joshfng/railsbox Vagrant image because I was using that image for a Rails project. 

First you have to find where is your Ruby interpreter located for your project. Let’s assume your project lies in the same folder where you have Vagrantfile. In this case, by default the /vagrant folder in the vagrant image will contain your code.

To find the ruby path, here type `which ruby`. Then it will spit out the location. You have to remember this location. In my it was ‘/home/vagrant/.rbenv/shims/ruby’.

Now, to link to the vagrant ruby interpreter, you have to open the preferences dialogue and then select  Languages & Frameworks > Ruby SDK and Gems.

Then click on + and select remote location as the location and select vagrant.

For the Vagrant path, give the folder where your Vagrantfile is located. For the Ruby interpreter path, give the path you found before.

Click Ok.

Now Rubymine should load up the necessary gems to itself which will take some time. But after that, you should be good to go!

Categories
Travelling

Londonderry, Northern Ireland