Pages

03 December 2016

How to install fonts to linux?

I downloaded merriweather from fonts.google, it is delivered in truetype font (TTF) format. To install them system wide in ubuntu, I made "merriweather" folder under /usr/share/fonts/trutype then locate all ttf files related to various weight of merriweather font, here. Then restart font cache to make the system reflected by the changes.

> mkdir /usr/share/fonts/truetype/merriweather/

> cp *.ttf /usr/share/fonts/truetype/merriweather/

> sudo fc-cache -fv

03 November 2016

SASS Problem with Compass - can't extend nested selectors

While compiling materialize.scss with compass to override some trivial classes as in the getting started guide, I got this annoying error.

error scss/screen.scss (Line 9: Can't extend .blue .lighten-4: can't extend nested selectors) Compilation failed in 1 files.

I was trying to apply this as shown in the materialize.css guide: http://materializecss.com/color.html

.ilike-blue-container {
    @extend .blue-text, .text-lighten-4;
}

Everyone on the stackoverflow guesses without a reasonable source of problem; I have come to this conclusion after just few scrolls on sass documentation.



The problem is using wrong sytax while extending another .class.
http://sass-lang.com/documentation/file.SASS_REFERENCE.html#multiple_extends


.ilike-blue-container {
    @extend .blue-text;
    @extend .text-lighten-4;

}


01 September 2016

Why doesn't 'git diff' invoke external diff tool?

Because "git difftool" does!

But how?

Default, git difftool is not related to any merge tool, of course. We have to do it on our own. I am using ubuntu and as far as I experienced, meld is a good choice to use with git difftool. Following command will make meld is default merge tool.

git config --global --add diff.tool meld

When git difftool is executed, that will ask user each of changed files in order.

git difftool

If you want to investigate changes in a specific commit, you can use the command below.

git difftool commit_hash{^,}



take care!

10 August 2016

COMRESET failed (errno=-32)

Early in the morning, I hit this issue because of putting my nose into boot options. I changed the option form AHCI to RAID then restart but what I see flood of "COMRESET failed (errno=-32)" errors. I immediately restart and rollback my action but this doesnt prevent me from falling into desperate flow of error logs in /var/log/syslog.

To solve problem, I make my talisman: used screwdriver to remove dvdrom. Because some ubuntu forum posts mentioning the reason is poor SATA cable connection. In my laptop there is no cable but there is  a socket to easily remove dvdrom. Anyway after removing, start the system and EUREKA the problem logs are gone! I checked mounted disks and validate reading and writing data is ok with some consequent restarts.

Then of course I didnt leave the dvdrom empty. I shutdown the system and stick it into place roughly. And now everyone is allright.

The lesson do not touch (mess up with) anything if it is working.  :)

Aug 10 08:25:09 msi kernel: [   10.940622] ata3: limiting SATA link speed to 1.5 Gbps
Aug 10 08:25:09 msi kernel: [   13.156558] ata3: COMRESET failed (errno=-32)
Aug 10 08:25:09 msi kernel: [   13.156574] ata3: reset failed (errno=-32), retrying in 8 secs
Aug 10 08:25:09 msi kernel: [   23.156871] ata3: COMRESET failed (errno=-32)
Aug 10 08:25:09 msi kernel: [   23.156887] ata3: reset failed (errno=-32), retrying in 33 secs
Aug 10 08:25:09 msi kernel: [   25.497046] random: nonblocking pool is initialized
Aug 10 08:25:09 msi kernel: [   58.169592] ata3: COMRESET failed (errno=-32)
Aug 10 08:25:09 msi kernel: [   58.169610] ata3: reset failed, giving up
Aug 10 08:25:09 msi kernel: [   58.169627] ata3: exception Emask 0x10 SAct 0x0 SErr 0x4000000 action 0xe frozen t4
Aug 10 08:25:09 msi kernel: [   58.169644] ata3: irq_stat 0x00000040, connection status changed
Aug 10 08:25:09 msi kernel: [   58.169657] ata3: SError: { DevExch }
Aug 10 08:25:09 msi kernel: [   58.169668] ata3: hard resetting link
Aug 10 08:25:09 msi kernel: [   60.397605] ata3: COMRESET failed (errno=-32)
Aug 10 08:25:09 msi kernel: [   60.397621] ata3: reset failed (errno=-32), retrying in 8 secs
Aug 10 08:25:09 msi kernel: [   68.169774] ata3: limiting SATA link speed to 1.5 Gbps
Aug 10 08:25:09 msi kernel: [   68.169777] ata3: hard resetting link
Aug 10 08:25:09 msi kernel: [   70.397807] ata3: COMRESET failed (errno=-32)
Aug 10 08:25:09 msi kernel: [   70.397823] ata3: reset failed (errno=-32), retrying in 8 secs
Aug 10 08:25:09 msi kernel: [   78.169945] ata3: hard resetting link
Aug 10 08:25:09 msi kernel: [   80.430008] ata3: COMRESET failed (errno=-32)
Aug 10 08:25:09 msi kernel: [   80.430025] ata3: reset failed (errno=-32), retrying in 33 secs
Aug 10 08:25:09 msi kernel: [  113.170659] ata3: hard resetting link
Aug 10 08:25:09 msi kernel: [  115.398716] ata3: COMRESET failed (errno=-32)
Aug 10 08:25:09 msi kernel: [  115.398733] ata3: reset failed, giving up
Aug 10 08:25:09 msi kernel: [  115.398751] ata3: exception Emask 0x10 SAct 0x0 SErr 0x4000000 action 0xe frozen t3
Aug 10 08:25:09 msi kernel: [  115.398767] ata3: irq_stat 0x00000040, connection status changed
Aug 10 08:25:09 msi kernel: [  115.398781] ata3: SError: { DevExch }
Aug 10 08:25:09 msi kernel: [  115.398792] ata3: hard resetting link
Aug 10 08:25:09 msi kernel: [  117.626755] ata3: COMRESET failed (errno=-32)
Aug 10 08:25:09 msi kernel: [  117.626771] ata3: reset failed (errno=-32), retrying in 8 secs
Aug 10 08:25:09 msi kernel: [  125.398897] ata3: limiting SATA link speed to 1.5 Gbps
Aug 10 08:25:09 msi kernel: [  125.398899] ata3: hard resetting link
Aug 10 08:25:09 msi kernel: [  127.626961] ata3: COMRESET failed (errno=-32)
Aug 10 08:25:09 msi kernel: [  127.626977] ata3: reset failed (errno=-32), retrying in 8 secs
Aug 10 08:25:09 msi kernel: [  135.399117] ata3: hard resetting link
Aug 10 08:25:09 msi kernel: [  137.627159] ata3: COMRESET failed (errno=-32)
Aug 10 08:25:09 msi kernel: [  137.627175] ata3: reset failed (errno=-32), retrying in 33 secs
Aug 10 08:25:09 msi kernel: [  151.224523] EXT4-fs (nvme0n1p2): mounted filesystem with ordered data mode. Opts: (null)
Aug 10 08:25:09 msi kernel: [  170.399819] ata3: hard resetting link
Aug 10 08:25:09 msi kernel: [  172.659867] ata3: COMRESET failed (errno=-32)
Aug 10 08:25:09 msi kernel: [  172.659884] ata3: reset failed, giving up
Aug 10 08:25:09 msi kernel: [  172.659902] ata3: exception Emask 0x10 SAct 0x0 SErr 0x4000000 action 0xe frozen t2
Aug 10 08:25:09 msi kernel: [  172.659918] ata3: irq_stat 0x00000040, connection status changed
Aug 10 08:25:09 msi kernel: [  172.659932] ata3: SError: { DevExch }
Aug 10 08:25:09 msi kernel: [  172.659942] ata3: hard resetting link
Aug 10 08:25:09 msi kernel: [  174.919899] ata3: COMRESET failed (errno=-32)
Aug 10 08:25:09 msi kernel: [  174.919916] ata3: reset failed (errno=-32), retrying in 8 secs
Aug 10 08:25:09 msi kernel: [  181.635850] lp: driver loaded but no devices found

28 July 2016

Domain Name System(DNS) Syntax Rules

What is a domain name, Why IANA cares?
Domain names are used to access machines over local network or internet with human readable syntax instead of IPs. www.example.com is the global example domain name that is reserved for educational purposes by IANA. IANA(International Assigned Numbers Association) manages DNS root zone and many other critical protocols and standards of internet. At first glance, i will highlight the right most part of domain name "com", our example domain name. "com" is defined by IANA as a top level domain name (TLD) and there are 312 TLDs and six kind of top level domain names presented in IANA DNS Root Zone:
  1. country-code(tr, ru, us, uk...), 
  2. sponsored(xxx, jobs, travel), 
  3. infrastructure(arpa), 
  4. generic-restricted(biz, name, pro), 
  5. generic(com, info, net), 
  6. test(.భారత్)
In the IANA DNS Root zone page, there is each of top level domain names and related organizations listed.

tlds-alpha-by-domain.txt
# Version 2011121300, Last Updated Tue Dec 13 15:07:02 2011 UTC
AC
AD
AE
AERO
AF
AG
AI
AL
AM
AN
AO
AQ
AR
ARPA
AS
ASIA
AT
AU
AW
AX
AZ
BA
BB
BD
BE
BF
BG
BH
BI
BIZ
BJ
BM
BN
BO
BR
BS
BT
BV
BW
BY
BZ
CA
CAT
CC
CD
CF
CG
CH
CI
CK
CL
CM
CN
CO
COM
COOP
CR
CU
CV
CW
CX
CY
CZ
DE
DJ
DK
DM
DO
DZ
EC
EDU
EE
EG
ER
ES
ET
EU
FI
FJ
FK
FM
FO
FR
GA
GB
GD
GE
GF
GG
GH
GI
GL
GM
GN
GOV
GP
GQ
GR
GS
GT
GU
GW
GY
HK
HM
HN
HR
HT
HU
ID
IE
IL
IM
IN
INFO
INT
IO
IQ
IR
IS
IT
JE
JM
JO
JOBS
JP
KE
KG
KH
KI
KM
KN
KP
KR
KW
KY
KZ
LA
LB
LC
LI
LK
LR
LS
LT
LU
LV
LY
MA
MC
MD
ME
MG
MH
MIL
MK
ML
MM
MN
MO
MOBI
MP
MQ
MR
MS
MT
MU
MUSEUM
MV
MW
MX
MY
MZ
NA
NAME
NC
NE
NET
NF
NG
NI
NL
NO
NP
NR
NU
NZ
OM
ORG
PA
PE
PF
PG
PH
PK
PL
PM
PN
PR
PRO
PS
PT
PW
PY
QA
RE
RO
RS
RU
RW
SA
SB
SC
SD
SE
SG
SH
SI
SJ
SK
SL
SM
SN
SO
SR
ST
SU
SV
SX
SY
SZ
TC
TD
TEL
TF
TG
TH
TJ
TK
TL
TM
TN
TO
TP
TR
TRAVEL
TT
TV
TW
TZ
UA
UG
UK
US
UY
UZ
VA
VC
VE
VG
VI
VN
VU
WF
WS
XN--0ZWM56D
XN--11B5BS3A9AJ6G
XN--3E0B707E
XN--45BRJ9C
XN--80AKHBYKNJ4F
XN--90A3AC
XN--9T4B11YI5A
XN--CLCHC0EA0B2G2A9GCD
XN--DEBA0AD
XN--FIQS8S
XN--FIQZ9S
XN--FPCRJ9C3D
XN--FZC2C9E2C
XN--G6W251D
XN--GECRJ9C
XN--H2BRJ9C
XN--HGBK6AJ7F53BBA
XN--HLCJ6AYA9ESC7A
XN--J6W193G
XN--JXALPDLP
XN--KGBECHTV
XN--KPRW13D
XN--KPRY57D
XN--LGBBAT1AD8J
XN--MGBAAM7A8H
XN--MGBAYH7GPA
XN--MGBBH1A71E
XN--MGBC0A9AZCG
XN--MGBERP4A5D4AR
XN--O3CW4H
XN--OGBPF8FL
XN--P1AI
XN--PGBS0DH
XN--S9BRJ9C
XN--WGBH1C
XN--WGBL6A
XN--XKC2AL3HYE2A
XN--XKC2DL3A5EE0H
XN--YFRO4I67O
XN--YGBI2AMMX
XN--ZCKZAH
XXX
YE
YT
ZA
ZM
ZW

Details of DNS Jargon(Syntax)
www.example.com is a standard domain name and following list is showing the aspects and rules of a domain name. I have picked rules and create this list with wiki and referenced RFCs
  • www, example and com are labels [wiki]
  • each label can be maximum 63 characters long [RFC1035, page 10] [RFC1123, page 13]
  • dots(.) are seperators [wiki]
  • com is top level domain (TLD)
  • www and example are subdomains  [wiki]
  • a domain can have maximum 127 subdomains [wiki]
  • domain name has maximum 255 characters [RFC1035, page 9][RFC1123, page 13]
  • the hierarchy of domains descends from right to left [wiki
  • LDH Rule: labels must contain only Letters, Digits and Hypen (not start or end with hypen) [RFC3696, page 3]  
  • top level domain names not be all numeric [RFC3696, page 3
  • domain names are not case sensitive [RFC3696, page 3]  

Final Touch, Regular Expression Pattern for Domain Name Syntax
The initial motivation of searching all these information is creating a unique pattern to validate domain names whilst user interactions or in any side of applications. However, without reducing the complexity of 312 tlds and their combinations, it is almost impossible to write a regex pattern to meet these requirements. But pattern creation tradeoff must be well analyzed and shouldn' t be copy-pasted from any resource on the internet. It must be flexible enough and meet the requirements of both above rules and you. I prefer this pattern:

Console
true
true
true
true
true
false
false