Wednesday, October 5, 2016

Ubuntu Troubleshoot: Fixing missing and flickering mouse cursor

After fresh install Ubuntu I found that sometimes my mouse cursor is missing and flickering so much. In order to solve this problem we need to disable unknown displays settings as explained below.

1. Open Displays settings from Ubuntu Start Menu.

Open Displays Settings

2. If you are lucky you will see two rectangles shape in the Displays window (red and green). Click on the green colored rectangle with "Unknown Display" on it, as seen below.

Displays Settings "Unknown Display"

3. As you can see in previous image, the Unknown Display is turned on. Click on the switch to turn it off. Then click on "Apply" button.

Turned off Unknown display

That's how I fixed my problem with the mouse cursor. If you find this tips helpful, please leave a comment below. Thank you :)


Ubuntu Tips: Startup Application - Case study enabling touchpad edge scrolling and two fingers scrolling

Today, I want to share a really handy feature in Ubuntu, Startup Application. Startup Application allows you to run additional script or program during the operating system startup. The use case that it can help you are numerous. From mount your drives or devices, startup your development web server, or maybe more complex repetitive tasks that you need to run manually every time you sign into your Ubuntu.

I will show a use case that I personally use in my Ubuntu and this is will be very helpful if you fresh install Ubuntu in your laptop. The use case is to enable edge scrolling and two finger scrolling on your laptop's Synaptics Touchpad. To enable those two features you need to run following commands in your terminal (to open your terminal press ctrl + alt + t):

$ synclient VertEdgeScroll=1 
$ synclient VertTwoFingerScroll=1

If you run those commands you can see that they work perfectly enabled your edge scrolling and two finger scrolling. But the problem is the effect of those commands will wear off every time you restart/shutdown your computer so you need to run those commands again and again. This is the time for Startup Application will help you!

Ok, here is how I use Startup Application:

First Step:
1. Create a bash script called scrolling inside /bin/ directory by running following command in your terminal:

$ sudo gedit /bin/scrolling

2. That command will open a text editor and you need to copy this as its content:

#!/bin/bash 
synclient VertEdgeScroll=1 
synclient VertTwoFingerScroll=1

3. Save and close that file.

Second Step:
Make sure you change  the type of that scrolling file into excutable using this command:

$ sudo chmod +x /bin/scrolling

Last Step:
1. Open Startup application from Ubuntu Start menu.


Open Startup Application in Ubuntu
2. Once opened you will see something like this.

View of Startup Application Preferences

3. Click "Add" and enter the following information as in the image below then click "Add".

Name: Scrolling
Command: /bin/scrolling
Comment: Enable two fingers scrolling and edge scrolling

Add Startup Program

4. Close the Startup Application


That's all you have to do, it's easy and you can try restart your computer to see the result. :D

If you find this is helpful or do you have something in mind you want to try with Startup Application? Please share your experience in the comment. Thank you :)

Sunday, August 21, 2016

Copy from dRPC documentation: gRPC Motivation and Design Principles.

I noticed that the motivation and design principles of gRPC is no longer available in the original source. So I copied this documentation for anyone interested in it. Please enjoy.

Motivation

Google has been using a single general-purpose RPC infrastructure called Stubby to connect the large number of microservices running within and across our data centers for over a decade. Our internal systems have long embraced the microservice architecture gaining popularity today. Having a uniform, cross-platform RPC infrastructure has allowed for the rollout of fleet-wide improvements in efficiency, security, reliability and behavioral analysis critical to supporting the incredible growth seen in that period.

Stubby has many great features - however, it's not based on any standard and is too tightly coupled to our internal infrastructure to be considered suitable for public release. With the advent of SPDY, HTTP/2, and QUIC, many of these same features have appeared in public standards, together with other features that Stubby does not provide. It became clear that it was time to rework Stubby to take advantage of this standardization, and to extend its applicability to mobile, IoT, and Cloud use-cases.

Principles & Requirements


Services not Objects, Messages not References - Promote the microservices design philosophy of coarse-grained message exchange between systems while avoiding the pitfalls of distributed objects and the fallacies of ignoring the network.

Coverage & Simplicity - The stack should be available on every popular development platform and easy for someone to build for their platform of choice. It should be viable on CPU & memory limited devices.

Free & Open - Make the fundamental features free for all to use. Release all artifacts as open-source efforts with licensing that should facilitate and not impede adoption.

Interoperability & Reach - The wire-protocol must be capable of surviving traversal over common internet infrastructure.

General Purpose & Performant - The stack should be applicable to a broad class of use-cases while sacrificing little in performance when compared to a use-case specific stack.

Layered - Key facets of the stack must be able to evolve independently. A revision to the wire-format should not disrupt application layer bindings.

Payload Agnostic - Different services need to use different message types and encodings such as protocol buffers, JSON, XML, and Thrift; the protocol and implementations must allow for this. Similarly the need for payload compression varies by use-case and payload type: the protocol should allow for pluggable compression mechanisms.

Streaming - Storage systems rely on streaming and flow-control to express large data-sets. Other services, like voice-to-text or stock-tickers, rely on streaming to represent temporally related message sequences.

Blocking & Non-Blocking - Support both asynchronous and synchronous processing of the sequence of messages exchanged by a client and server. This is critical for scaling and handling streams on certain platforms.

Cancellation & Timeout - Operations can be expensive and long-lived - cancellation allows servers to reclaim resources when clients are well-behaved. When a causal-chain of work is tracked, cancellation can cascade. A client may indicate a timeout for a call, which allows services to tune their behavior to the needs of the client.

Lameducking - Servers must be allowed to gracefully shut-down by rejecting new requests while continuing to process in-flight ones.

Flow-Control - Computing power and network capacity are often unbalanced between client & server. Flow control allows for better buffer management as well as providing protection from DOS by an overly active peer.

Pluggable - A wire protocol is only part of a functioning API infrastructure. Large distributed systems need security, health-checking, load-balancing and failover, monitoring, tracing, logging, and so on. Implementations should provide extensions points to allow for plugging in these features and, where useful, default implementations.

Extensions as APIs - Extensions that require collaboration among services should favor using APIs rather than protocol extensions where possible. Extensions of this type could include health-checking, service introspection, load monitoring, and load-balancing assignment.

Metadata Exchange - Common cross-cutting concerns like authentication or tracing rely on the exchange of data that is not part of the declared interface of a service. Deployments rely on their ability to evolve these features at a different rate to the individual APIs exposed by services.

Standardized Status Codes - Clients typically respond to errors returned by API calls in a limited number of ways. The status code namespace should be constrained to make these error handling decisions clearer. If richer domain-specific status is needed the metadata exchange mechanism can be used to provide that.

Originally written by Louis Ryan with help from others at Google.

Saturday, February 27, 2016

Wordpress Troubleshoot: Error Updating Plugins After Upgrade My PHP Version to PHP7



Today, I really surprised that I can't update any plugins in my Wordpress website. All of function were working well but still can't update any plugins. I though only this one site was broken until I opened my other site and it was broken too!!! What happened!? That was like a nightmare :((
Then, I searched for the error log in the Wordpress admin directory and there were many errors occurred. Here are some of the error messages.

[25-Feb-2016 14:47:10 UTC] PHP Fatal error:  Uncaught Error: Function name must be a string in /wp-content/plugins/shareaholic/lib/social-share-counts/curl_multi_share_count.php:53
Stack trace:
#0 /wp-content/plugins/shareaholic/public.php(444): ShareaholicCurlMultiShareCount->get_counts()
#1 /wp-includes/plugin.php(525): ShareaholicPublic::share_counts_api('')
#2 /wp-admin/admin-ajax.php(89): do_action('wp_ajax_shareah...')
#3 {main}  thrown in /wp-content/plugins/shareaholic/lib/social-share-counts/curl_multi_share_count.php on line 53 
[25-Feb-2016 14:51:48 UTC] PHP Fatal error:  Uncaught Error: Function name must be a string in /wp-content/plugins/shareaholic/lib/social-share-counts/curl_multi_share_count.php:53
Stack trace:
#0 /wp-content/plugins/shareaholic/public.php(444): ShareaholicCurlMultiShareCount->get_counts()
#1 /wp-includes/plugin.php(525): ShareaholicPublic::share_counts_api('')
#2 /wp-admin/admin-ajax.php(99): do_action('wp_ajax_nopriv_...')
#3 {main}  thrown in /wp-content/plugins/shareaholic/lib/social-share-counts/curl_multi_share_count.php on line 53 
[26-Feb-2016 23:16:50 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function ereg() in /wp-content/plugins/author-or-user-image/author_image.php:107
Stack trace:
#0 /wp-includes/plugin.php(525): zm_author_image->adinit('')
#1 /wp-admin/admin.php(168): do_action('admin_init')
#2 /wp-admin/update-core.php(10): require_once('/')
#3 {main}  thrown in /wp-content/plugins/author-or-user-image/author_image.php on line 107 
I googled for those error messages and found nothing related except an old post related to deprecated function ereg() in the older version of PHP. Aha! Maybe that is the source of the problems. I remembered that I changed the PHP version of my hosting from PHP 5.6 to PHP 7 about two days ago. My hosting provider said that by upgrading the PHP version to PHP 7 would improve the performance of Wordpress up to 130% of current performance. I totally sold to that advertisement at that time and changed my PHP version immediately.

I opened my cpanel and quickly downgraded my PHP version to 5.6.  Everything is working well now. I can update my plugins now. :) Lesson learned, don't too quick adopt the latest technology until it is stable enough and widely use.

Please leave a comment bellow if you find it useful.

Saturday, February 13, 2016

Dictionary: Philosophy Paper

Philosophy Paper contains a reasoned defense to a claim/thesis. Its objectives is to convince a reader about something that the writer want to say. From a philosophical writing, we can see someone's level of understanding of the subject problem or material because the writer can think critically about that that.

A philosophical paper may require several kinds of tasks, including:

  • Argument reconstruction 
  • Objections and replies 
  • Application 
  • Original argument 
  • Thought experiments

One good example of a philosophy paper is "Computing Machinery and Intelligence" by Alan M. Turing.

Source:

  • http://www.mit.edu/~yablo/writing.html
  • http://writingcenter.unc.edu/handouts/philosophy/
  • http://philosophy.fas.harvard.edu/files/phildept/files/brief_guide_to_writing_philosophy_paper.pdf
  • http://www.sfu.ca/philosophy/resources/writing.html

Wednesday, January 6, 2016

Git Tips: How to delete local branch and remote branch

I found this two commands very handy to keep your local and remote repositories clean from unused branches. Here are the steps that usually I use to keep my repositories clean:
  • First to check branches that exist in your local repository use the following command
$ git branch
  • After you see the list of your branches choose one you want to delete as seen bellow
$ git branch -d <your-branch-name>
  • To check branches that exist in your remote repository use this command
$ git branch -r
  •  And the to delete your remote branch use the following command
$ git push origin :<your-branch-name>
If you find this post useful, please leave a comment. :)

Finally, C# 9 record, the equivalent of Scala's case class

While C# is a wonderful programming language, there is something that I would like to see to make our life programmer easier. If you are fam...