Showing posts with label google chrome. Show all posts
Showing posts with label google chrome. Show all posts

This Week I Learned 2018 - Week 41

Last week post or rather, old stuff from the archive.

Do we have an obsession with home ownership? (via /r/malaysia) While the discussion was referring to fresh graduates who are started out, the general rule of thumb still applies for everyone. Don't buy a house if you don't intend to stay more than ten years. Or don't buy houses 3 times more than your annual salary. Never equal home ownership like status symbol (just like car), you're taking a huge financial risk and long term repayment period. Another approach is to start small buy buying a low cost flat, stay in it, rent it, and sell it to buy a better house.

Judging by the current trend through NAPIC (National Property Information Centre), it's best to rent and wait before buying. Furthermore, the saving from your monthly mortgage installment into other investments will out weight the interest paid and potential capital appreciation of your property. By the time you're ready for retirement, might as well move to some where outskirts and rent again and live off the dividends of your investment in your golden years. Off course, if you're planning to get marry and owning a home is crucial to satisfy your SO and in-laws (another status symbol issue), first time homeowner can apply through PR1MA, which was created to prevent wealthier people from inflating the housing prices.

Now, instead of taking advice from armchair experts in the forum, why not do your own calculation using the The New York Times' rent or buy calculator.

Ignore this discussion if you're one of those crazy rich Asians.

And by the way, there have been quite a discussion where the upcoming Budget 2019 will have an impact of the housing prices. We will wait and see then.

Do you need a bigger house? No. We spend majority of our times in the kitchen, living room, and bed room. Perhaps a SOHO (Small Office Home Office) suite is a preferable choice if you don't have kids or big family.

How many ways to refresh a page in Google Chrome? Three. Only if you've open the Chrome Dev Tools and right click the refresh button as shown in the screenshot below illustrates this. Now, what are the differences between these three refreshing methods?  Normal reload will use re-validate and use cache files when needed. Hard reload will skip the cache and re-download everything again. As the name implies, empty cache and hard reload will clear the cache file and re-download everything.


What the fsck with Perl's constant? Besides the default `use constant` pragma, we have 21 (yes, bloody 21 ways) Perl's modules to deal with constant or readonly values. Worse still, none of these modules satisfy the needs of proper constant usage, it's a case by case basis. The recommended one is Const::Fast. More on this in coming posts.

This Week I Learned 2018 - Week 09

Last week post of something from the past.

柯P、唐鳳的口譯員,是怎麼練英文的?八个字。找对方法,大量学习。虛心求教,切无自满。

Google Chrome's Lighthouse. Yes, definitely a good tool. Now you don't need an external consultant to advise you on how to fully optimize your website or web application. Definitely important if you want to implement RPRL pattern in your Progressive Web Apps (PWAs). Web development is getting more complex due to increasing popularity of mobile web.

If you're doing any forms of technical support, documentation is a slow but good return of investment. But yet, so many organization and developers does not enforce or encourage such practice due to myriad of silly and selfish reasons.

Signal foundation (via HN), made possible (50 millions donation) by co-founder of Whatsapp, Brian Acton. Will this work? Sincerely, hope it will works. We definitely needs free and open source privacy technology to enable secure communication.

Comparison between regular glass, crystal glass, and acrylic glass. In the end of the day, availability and price will determine which type of aquarium glass you will buy. If you need a large quantities of aquarium tank, might as well go to DIY route and build it yourself. We've seen quite a few aquarium shop build their own aquarium tanks.

Collecting in the Swamps of Peninsular Malaysia. There are or were a group of local Betta fish breeder as well as fisheries department who specialized in wild Betta that are unique in MY. Unfortunately, local Betta fishes are lackluster compare to the species breed by our neighboring countries.

P1, F0, F1, what are they? Within a year, you can inbreed your Betta fishes until four generations from F0/P1 till F3/P4. Betta fish, either male or female, on average, is mature enough for breeding when they reach 3 months old. For each generation, we pick the best feature we want and breed selectively to create our line. It's a long tedious process and some even took years to get the right features and colour combination. For faster result, we can try outbreeding.

A few more dead fishes reminded me to re-read this article on how to how to ship fish in a box, which tells us a lot about handling water quality parameters (temperature, pH, and oxygen or carbon dioxide level). This information is crucial when you want to extend the longevity of your aquarium fishes. A few key notes from the articles which I've summarized it here:

1/ Wild Betta fish live in warm tropical padi field with the optimum temperatures between 25.5 till 26.5 Celsius. As fish is cold-blooded animal and can't regulate their body temperature, it will follow the temperature of the surrounding water. That is why you will need to acclimate the fish for 15 till 20 minutes before moving it to a new tank. Sudden changes in temperature will stress out the fish and make it susceptible to diseases.

2/ When packaging, use minimum possible water or one-thirds water. Simply because oxygen is hard to dissolve in water and we need as much oxygen as possible.

3/ There is one local breeder which uses sedatives or tranquilizers and he advised us not to mix the packaging water into the aquarium.

4/ So many fish medications do not even list the active ingredient even a Material Safety Data Sheet (MSDS). It makes you wonder long exposure to these chemical liquids will do to us?

5/ Salts (non-treated or coarse/rock salt) is your best friend. Use 2 to 11 grams per liter or 1 tea-spoon per 5 gallons. While some said using salts (aquarium salts is controversial), it does provides multiple benefits. Good example is to disinfect any equipment shared between multiple tanks. We've seen some aquarium shop uses it for their Betta fish and we've personally use it as well. Well, it seems to work for them and us. Furthermore, it also reduces osmoregulatory stress.

6/ Antibiotics? Some aquarium shop use it (yellow powder). Avoid it at any costs as it's harmful to both fishes and human in long term. Bacteria can build resistance over prolong usage.

This Week I Learned - 2017 Week 16

Last week post or the regular whole series.

Minor hiccups due to sleeping schedule messed up my daily routine. Nothing but readjustment to get back on track. Switching different way of monitoring your habits did not produced the result needed. Furthermore, you should unwind during the weekend. If you need to use the Internet, write down the items you want to research instead of impulsively googling. Maybe I should just switch to dumb phone, nothing but for calls and SMS, like the old days. But it may not be a feasible solution and impractical.

#1 My whole development life in a circle where I have to encounter XXX again in the current development works. There is a write up on the origins of XXX as FIXME (via HN). Reason that we use XXX is easily greppable comment prefixes.

#2 How to handle Perl class-level variables. Two ways. (1) Lexical variable scoped (via subroutine) and (2) package variable. Simple concept that took me a while to finally realize and understand it.
# (1)
my $foo = 123;
sub get_foo { $foo }

# (2)
our $fubb = 456;

On a related note, found a list of Perl modules related to testing. There is so many modules that I haven't try out yet. So many things to try out, yet so little time.

#3 How do you remove all files except one? Seems hard yet so simple, if you know and remember how it works. Only on a rare instance you will encounter this. Typically we just move the file to different folder and delete the source folder.
$ shopt -s extglob 
$ rm -- !(file.txt)

#6 "If you haven't experienced true solitude yet, go find some. It's pretty grounding." (via HN) It's not a man against the wild but rather a man seeking himself through the solitude of nature. It has been so long that we ever lie down and look up the sky and enjoy the stars?

#7 "Colour is in the eye of the beholder". Interesting that our vocabulary influences how we perceive colours. Himba people have interesting vocabulary for colours, for example zoozu (dark colours and black), vapa (light colours and white), borou (green with blue and purple), dumbu (beige with yellow and some light green), and serandu (red with orange and pink). You can read more on this presentation, The Development of Color Categories in Two Languages: a longitudinal study.

#8 If you're facing problem with Google Chrome whenever you're opening new page but it took a while to load while waiting for "Resolving host...". Clear the DNS cache in Chrome. Seems to resolve the lagging issue for me and making browsing experience bearable.

This Week I Learned - 2017 Week 13

Read the last week post or follow the whole series.

Night owl turned early bird messed up my sleep cycle badly. Nevertheless, the draft report have been completed and waiting for submission.

#1 Feeling nostalgia after watching the unboxing video of IBM PC AT and Model M. The sounds of the diskette reading and loading the data reminded me of the good old days of early computing period. I'm not sure what happened to our XT 8088 but I'm surely wish I can see it again and try to boot it up again. I did once during my college days but would really love to do it again after all these years. Back in those days, XT 286 is my dream machine and how I wish we have the financial means to upgrade to it. 


#2 Lots of Docker debugging for the past week and I learned quite a lot. It's the right time to setup my virtualization machine (more on this in coming week) and start looking into Docker.

When using Docker Compose, use `docker-compose ps` instead of `docker ps`. While both commands show the listing of the available containers, the former command will only list containers declared in the `docker-compose.yml` file, a subset of the all available containers. Best to go through all the Docker Compose CLI command line parameters.

Next, you want to read (or search) the content of a file in the docker container. See the example below. Yes, I know you can just simply use the `grep` command directly.
$ docker exec -i mycontainer cat /etc/hosts | grep localhost

#3 Setting up multiple SSL certificates using one IP address in Nginx. And also how to verify and read SSL certificate info from the console. Next is to configure Google Chrome to accept invalid certificate from localhost. Copy and paste `chrome://flags/#allow-insecure-localhost` to the address text box to access the setting. Instruction as shown below.


Resolving Unmet .deb Package Dependencies

Ubuntu 15.04 Vivid Vervet was released a few days back and is time for me to properly set it up after I've installed the beta version few weeks back. Upgrade to the stable version was painless as it was a fresh beta release installation. Just the usual apt-get update and upgrade should be okay. No issues encounter so far after a 300-plus MB download.

As usual, Google Chrome will be the first application to be installed. This is just to sync all my bookmarks and histories so I can save a few keystrokes. And as usual, I always use the most straightforward or the only way I can remember to install it.

First, download the .deb package from the download site. Pick the 64-bits version. I always wonder why the 32-bits version still exists and it dawned to me, there are still system running on this architecture.

Next, install the .deb package you've just downloaded. Just use the dpkg command. As the console result shown below, there is an error (emphasized in red) of a missing dependency of libappindicator1 package. libappindicator1 is a library that take your application menu and place them in the top panel.
$ sudo dpkg -i google-chrome-stable_current_amd64.deb 
[sudo] password for ang: 
Selecting previously unselected package google-chrome-stable.
(Reading database ... 202735 files and directories currently installed.)
Preparing to unpack google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (42.0.2311.90-1) ...
dpkg: dependency problems prevent configuration of google-chrome-stable:
 google-chrome-stable depends on libappindicator1; however:
  Package libappindicator1 is not installed.

dpkg: error processing package google-chrome-stable (--install):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for gnome-menus (3.10.1-0ubuntu5) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu3) ...
Processing triggers for bamfdaemon (0.5.1+15.04.20150202-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.58ubuntu1) ...
Errors were encountered while processing:
 google-chrome-stable

To resolve any dependencies issue with .deb packaging system, just use the command below.
$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libappindicator1 libindicator7
The following NEW packages will be installed:
  libappindicator1 libindicator7
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 40.9 kB of archives.

The -f parameter is to tell apt-get to fix any broken dependencies as written in the man page below. Note I've trimmed the spacing and fix the content below to fit the width of the blog.
$ man apt-get | grep " \-f," -A 5
-f, --fix-broken
Fix; attempt to correct a system with broken dependencies in place. This option, when used with install/remove, can omit any packages to permit APT to deduce a likely solution. If packages are specified, these have to completely correct the problem. The option is sometimes necessary when running APT for the first time; APT itself does not allow broken package dependencies to exist on a system. It is possible that a system's dependency structure can be so corrupt as to require manual intervention (which usually means using dpkg --remove to eliminate some of the offending packages). Use of this option together with -m may produce an error in some situations. Configuration Item: APT::Get::Fix-Broken.

Is there anyway to install a .deb package and resolve its dependencies directly without resorting to apt-get? Yes, there is another tool called gdebi, which unfortunately is not a default preinstalled package. Let's install this and extract the program description from the man page. Note the line emphasized in red regarding limitation of apt.
$ sudo apt-get install gdebi
$ man gdebi | grep DESC -A 2
DESCRIPTION
gdebi lets you install local deb packages resolving and installing its dependencies. apt does the same, but only for remote (http, ftp) located packages. It can also resolve build-depends of debian/control files.

Based on the description above, surprisingly, it seems to me apt-get cannot install local .deb package. Let's verify this.
$ sudo apt-get install google-chrome-stable_current_amd64.deb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package google-chrome-stable_current_amd64.deb
E: Couldn't find any package by regex 'google-chrome-stable_current_amd64.deb'

Based on my finding right now, it seems to me in order to solve the limitation of the dpkg that cannot resolve dependencies, apt-get -f was created. And to fix the inability of apt-get to install local .deb package, gdebi was developed. Why layer of wrapper was added to exiting program to fix its limitation? Why can't dpkg resolve a .deb package unmet dependencies?

The background information provided by Rafal, which I quoted here (emphasis by author himself), answered my above questions. The thing is, dpkg knows nothing about repositories and hence, cannot find and download the dependent packages. When you use apt to install a package, it will download all its dependencies from the repositories and later pass to dpkg to install it individually according to a sequence.
"dpkg itself is not capable of managing repositories. It is required to use a higher-level tool, like apt-get, to fetch anything from repositories. dkpg is only the core tool, that installs/removes/configures packages, taking care of dependencies and other factors. apt-get and aptitude are tools that manage repositories, download data from them, and use dkpg to install/remove packages from them. This means, that apt-get and aptitude can resolve dependencies and get required packages from repository, but dpkg cannot, because it knows nothing about repositories."
Alternatively, instead of installing using a .deb package. We can we use apt directly through setting up a Chrome repository as detailed below.
$ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - 
$ sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
$ sudo apt-get update 
$ sudo apt-get install google-chrome-stable

However, is best to always verify that the signinig key have been added successfully.
$ apt-key list | grep Google -C 2

pub   1024D/7FAC5991 2007-03-08
uid                  Google, Inc. Linux Package Signing Key 
sub   2048g/C07CB649 2007-03-08

But still, one question remains which I still can't google a good answer for. Why can't apt install a local .deb package?





Noto Sans CJK

"Noto Sans CJK is a sans serif typeface designed as an intermediate style between the modern and traditional. It is intended to be a multi-purpose digital font for user interface designs, digital content, reading on laptops, mobile devices, and electronic books."
--  http://www.google.com/get/noto/cjk.html
I've been reading a lot of Chinese text these days but the text displayed by the default CJK fonts are awful. When Google release the Noto Font, I was hoping that it can improve the readability, sadly, the result still remain the same.

Installation is quite straight forward.
1. Download the Simplified and Traditional Chinese fonts from Google's Noto font site.

2. Unzip the files and copy to the default OpenType folder.
$ mv *.otf /usr/share/fonts/truetype.

3. Update the font cache.
$ sudo fc-cache -f

As you can see from the captured screenshots for both Chrome and Iceweasel/Firefox. Text are fuzzy, due to anti-aliasing, and hard to read using the default font size. Readability only improves until you've zoom it to 150%. Iceweasel/Firefox fair worse than Chrome as the font rasterization kind of messed up with a mixed of aliased and anti-aliasing text.

Note to self - 2014-06-19

I've a feeling that Vagrant and Google Chrome hates each other. I can understand Vagrant or Virtual Box is resource intensive but Chrome with just one tab with Gmail opened? Seriously?

The curse of PHP. Once you've been stereotyped as programmer of certain programming language, is hard to switch or move to another language.

Talking about being absent minded. Nearly lost my whole bag, didn't realized it until I traveled for hours.

Disable Google Ads in AdBlock

No wonder I kept seeing Google Ads on my search result for the past few weeks. It seemed Google paid Adblock to white list its ads.

For Google Chrome,
1. Go to Settings
2. On the left, select Extensions
3. Find AdBlock
4. Click Options
5. Click Filter Lists tab
6. Uncheck Allow some non-intrusive advertising