The Coder

I love codding regardless of its language

Life is worthwhile enough to avoid any job which machines can do.

Brief Introduction
Current Situation

I am using Linux / Ubuntu as my primary OS and LibreOffice. Distinct abilities of these tools are very useful. I especially like Regular Expression to do my affairs. Particularly, the ability of Kate editor to execute regular expression comes in mighty handy.

Background

I started codding by Fortran(1991) and then QBasic(1992). At the same time, I started to code on Casio calculator FX-3600Pv.

Before I met SQL, I would use Excell and its macro language to meet my needs. I started to use HTML codes in 2001 and then I discovered CGI/Perl as a magnificent language. My acquaintance with PHP (2002) has opened a new horizon to me. It has been a trigger for me to learn Mysql, Apache, JavaScript and CSS. After 2014, I started codding for Eviews.

Stackoverflow

Eviews codding
Coding for Eviews! Why?

Indeed, I love coding in R project. But Eviews is very easy to use, especially for beginners. Therefore, I am solicitous to make addins in order to make life easy for lazy economists (of course including me).

subroutine ARstracture(   )
if !ifVarLar=1 then
	%eqnamear = @getnextname("ZZ__ARStru")
	equation {%eqnamear}.ls  {%lsAR}
	%eqnamearS = @getnextname("ZZ__SARStru")
	equation {%eqnamearS}.ls  {%lsSAR}
	{%eqnamear}.arma(type=root,g) 
endif
endsub
subroutine GecikmeHesapla(  scalar sayi )
if !ifVarLar=1 then
	call MakeLsEquation (sayi)
	%lsAR=%BagimliDegisken+%ls1 +%ARvars +%DigerDegiskenler
	%lsSAR=%BagimliDegisken+%ARvars +%DigerDegiskenler
	%ls=%BagimliDegisken+%ls1 + %ls2 +%DigerDegiskenler
	'%statmsg4="Computing....."+%ls 
	'statusline %statmsg4
	'seterr %NARDLWaldTXTQ
	call WriteToLog(%ARDLN +" : "+ %ls)
	%buyazi= "Estimate of "+ %vars +" "+ %ARDLN
	  statusline {%buyazi}
	equation {%eqname}.ls  {%ls}  
	!ac={%eqname}.@aic
	!sw={%eqname}.@schwarz
	!hq= {%eqname}.@hq
	!lg= {%eqname}.@logl
	if(!ac<!a_1) then
	!a_1=!ac
	!b_1=sayi
	%LagArdl1=%ARDLNa
	endif
	if(!sw<!a_2) then
	!a_2=!sw
	!b_2=sayi
	%LagArdl2=%ARDLNa
	endif
	if(!hq<!a_3) then
	!a_3=!hq
	!b_3=sayi
	%LagArdl3=%ARDLNa
	endif
	if(!lg<!a_4) then
	!a_4=!lg
	!b_4=sayi
	%LagArdl4=%ARDLNa
	endif
	  {%tn}(sayi+1,1)= %ARDLNa
	  {%tn}(sayi+1,2)=!ac
	  {%tn}(sayi+1,3)=!sw
	  {%tn}(sayi+1,4)=!hq
	  {%tn}(sayi+1,5)=!lg
	 ' {%tn}(sayi+1,6)= %ls
	'{%mn}(sayi,!a_1y)=!ac
	'{%mn}(sayi,!a_2y)=!sw
	'{%mn}(sayi,!a_3y)=!hq
	d {%eqname}
endif
endsub
                    
Web based coding
Web based! Why?

Because I really like it.

My expertises and skills
PHP
PHP is the best programming language. After wasting a lot of precious time, I abandoned my own PHP framework. Now, I am using Codeigniter. My favorite command is preg_match.
 <?php
// PHP parsing portions of mysql result as variable on preg_replace
    foreach($result as $value){ 
        $id = $value['id'];
        $title = preg_replace('@\\\\(\d+)@' ,'\\\\\\\\$1', preg_replace("/\\$/","&#<span></span>36;",$value['title']));      
        $synopsis = $value['synopsis'];
        $synopsis = preg_replace('/&lt;!--TITLE-->/', $title, $synopsis);
    } 
                            
Mysql
Mysql is my favorite database software. I am using database for dealing with complex data.
//How to reset or change the MySQL root password?
sudo mysql -u root
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Apache
Apache server is stable and powerful.
RewriteCond %{HTTP_HOST} ^(www\.)?([a-z0-9-]+)\.example\.com [NC]
RewriteRule .? - [E=Wa:%1,E=Wb:%2]
RewriteRule ^(.*?)-([a-z]+) %{ENV:Wb}/$1.%{ENV:Wb} [L]
RewriteRule ^(.*?)-([0-9]+)([a-z]) %{ENV:Wb}/$1$3.$2 [L]  
Javascript & Jquery
JavaScript is essential tool for frontend developers. I had some old projects on JavaScript, but I found Jquery quite powerful. I got stick to core JavaScript instead of migrating to Jquery, but I think I wasted a lot of valuable time.
(function( $ ){ 
   $.fn.wmcrop=function(option){
    var option = $.extend({
        active:["link","image","strike","bold","italic","underline","quote","code"],           
        //    ratio:0.5, // width/height  false
        preview:false,
        insertform:false,
        minH:20,
        minW:20,
        preview:false
    },option||{});
    var that=this;
    var s={};
    this.makechange=function( budiv,genelId){
           s.w=gw=budiv.innerWidth();
           s.h=gh=budiv.innerHeight();
           $("#"+genelId).css({
               width:s.w,
               height:s.h
           });
           ii=$("#gi_"+genelId+"") ;
           iw=ii.outerWidth();
           ih=ii.outerHeight();
           cl=parseInt(ii.css("left"));
           ct=parseInt(ii.css("top"));
           that.ayarla(genelId,gw,gh)            
           s.slw=cl;
           s.srh=s.slh=gh;
           s.srw=(gw-cl-iw);
           s.stw=s.sbw=iw;
           s.sth=ct;
           s.stl=s.sbl=cl;
           s.sbh=(gh-ct-ih);
           ortudiv.l= $("#sl_"+genelId).css({
               width:s.slw,
               height:s.slh,
               left:0,
               top:0
           });
           ortudiv.r=  $("#sr_"+genelId).css({
               width:s.srw,
               height:s.srh,
               top:0,
               right:0
           });
           ortudiv.t= $("#st_"+genelId).css({
               width: s.stw,
               height:s.sth,
               left:s.stl,
               top:0
           });
           ortudiv.b= $("#sb_"+genelId).css({
               width: s.sbw,
               height:s.sbh,
               left:s.sbl,
               bottom:0
           });   
           $("#or_"+genelId).css({
               cursor:"move",
               "z-index":4,
               right: 0,
               top: 0,
               left: 0,  
               bottom: 0,
               display:"block",
               width:"100%",
               height:  "100%" 
           })
           //,"background-color": "#4c9900"})   
           $("#il_"+genelId).css({
               width: 6,
               height:"100%"
           })
           $("#ir_"+genelId).css({
               width: 6,
               height:"100%",
               right:0
           })
           $("#it_"+genelId).css({
               width: "100%" , 
               height:6,
               top:0
           });
           $("#ib_"+genelId).css({
               width: "100%" ,
               height:6,
               bottom:0
           });

           $("#blc_"+genelId).css({
               top: "50%" ,
               left:0
           });
           $("#blb_"+genelId).css({
               bottom: 0 ,
               left:0
           });
           $("#btl_"+genelId).css({
               top: 0 ,
               left:0
           });
           $("#btc_"+genelId).css({
               top: 0 ,
               left:"50%"
           });
           $("#btr_"+genelId).css({
               top: 0,
               right:0
           });
           $("#bbc_"+genelId).css({
               bottom: 0  ,
               left:"50%"
           });
           $("#brc_"+genelId).css({
               top: "50%"  ,
               right:0
           });
           $("#brb_"+genelId).css({
               bottom: 0  ,
               right:0
           });            

           $("div div",ii).each(function(){
               $(this).bind("mousedown",   function() {
                   that.mdown($(this))
               }).bind("mouseup",  function( ) {//s={};
                //   $dragging2=false;//$(this).unbind('mousedown');                        
               })
           });
       }
       return this.each(function(){
           var ff=$(this);
          $("img", ff).load(function(){that.corpbuild(ff)}) 
       })        
    }
   })( jQuery );  
Bash
Using Linux provided me vast abilities to do my jobs. However, some useful commands should be executed constantly on terminal. Thanks to Bash to help me in this regard. For illustration, installing new version of OS requires installation of old applications.

I have written all installing server applications and have made required configurations in a single Bash file. The project in Github is here. easyLAMPP
#! /bin/bash
### Start
clear
kullanici=$HOME
phpMyAdminVer="4.8.2"
txtund=$(tput sgr 0 1) # Underline
txtbld=$(tput bold) # Bold
txtred=$(tput setaf 1) # Red
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue
txtpur=$(tput setaf 5) # Purple
txtcyn=$(tput setaf 6) # Cyan
txtwht=$(tput setaf 7) # White
txtrst=$(tput sgr0) # Text reset
txtund=$(tput sgr 0 1) # Underline
txtbld=$(tput bold) # Bold
bldred=${txtbld}$(tput setaf 1) # red
bldblu=${txtbld}$(tput setaf 4) # blue
bldwht=${txtbld}$(tput setaf 7) # white
txtrst=$(tput sgr0) # Reset
info=${txtgrn}*${txtrst} # Feedback
pass=${bldblu}*${txtrst}
warn=${bldred}!${txtrst}
sorno=0
function chackkur(){
for p; do
 dpkg -s "$p" >/dev/null 2>&1 && {
        echo  $txtgrn$txtbld  $p $txtrst$txtgrn " is installed." $txtrst
    } || {
    echo  $txtred$txtbld  $p $txtrst$txtred " is not installed." $txtrst
    echo $bldblu "Starting to install $p ....."
      echo  $txtpur
      sudo  apt-get install $p  -y
      echo $txtrst
    }
 done
}
function yazdir(){
  echo $txtylw 
  echo ${1} 
  echo $txtrst  
}
function dikkat(){
  echo $txtylw$txtbld
  echo ${1} 
  echo $txtrst  
}
function sor(){
echo $txtcyn$txtbld ${1} $txtylw$txtbld
read ${2}
echo $txtrst
}
function sudolama(){
  echo $bldblu ">> sudo ${1}"
      echo  $txtrst$txtpur
      sudo  ${1}
      echo $txtrst
}
function anladinmi(){
sorno=$(($sorno+1))
sorgir="devam$sorno"
echo -e "${1}"
sor "Devam ? [y/n/e] Yes / No / Exit "   sorgir 

if [ "$sorgir" = 'y' ]
then
echo "vay be"
elif [ "$sorgir" = 'e' ] 
then
echo "ok"
exit

else
 anladinmi "${1}"
  fi
}
sor "Do you want to start install? [y/n/e] Yes / No / Exit" "devam"
if [ "$devam"  = 'e' ]
then
exit
else
dikkat   "Attention it is started!"  
fi;
if [ "$devam"  = 'y' ]
then
cd $HOME
 mkdir "gecici"
 cd gecici
sudolama "apt-get autoremove /n"
yazdir "oncekileri sil"
sudolama "apt-get remove --purge php5-mysql  -y" 
sudolama "apt-get remove --purge mysql-server -y"
sudolama "apt-get remove --purge libapache2-mod-php5 -y"
sudolama "apt-get remove --purge php5 -y"
sudolama "apt-get remove --purge apache2 -y"
sudolama "apt-get update && apt-get upgrade"
chackkur  "kate" "gedit"  "apache2" "php php7.2-mysql php7.2-curl php7.2-json php7.2-cgi  php7.2 libapache2-mod-php7.2" "libapache2-mod-php" "mysql-server" "php-mysql" "php-curl php-soap php-mcrypt php-xdebug php-zip" "sysbench" " php-pear php-dev libmysqlclient-dev" 
sudolama "a2enmod rewrite"
CSS
CSS is essential for good visual presentation. I confess that my art abilities are not good at all. Thanks to Bootstrap which provides stylish aspects as well as makes it easy to design.
header {
    background: #fff;
    width: 100%;
    height: 76px;
    position: fixed;
    top: 0;
    left: 0;
    border-bottom: 4px solid #4C9CF1;
    z-index: 100;
}
#UstNav {
    float: left;
    padding: 20px;
}
#UstNav #menu-icon {
    display: hidden;
    width: 40px;
    height: 40px;
    background: #4C8FEC url(menu-icon.png) center;
}
#UstNav a:hover#menu-icon {
    background-color: #444;
    border-radius: 4px 4px 0 0;
}
#UstNav ul {
    list-style: none;
}
regular expression
/<\s*span\s+lang=\"?\'?[a-zA-Z]+\"?\'?[^>]+>([^<\/]+|[-;&%!:\?\w\d\s\<>\/=\(\)\.,\"\']+)<\/span>/i
@<\s*img(.+?)(border\s*=\s*[\"']?\d+[\"']?)+([^>]*)>@is
@<img[\d\w\-:=;\"'/.,\s\\\]+src\s*=\s*[\"'\\\]*[\d\w/.:\-_\s]+$virtual_files_yeri/orj/([\w\d\.]+)[\"'\\\]*[^>]*>@is
/(\{\(){1}(\[([\w\d]+)\])?([\w\s\d\.\-]+)(\|([\p{L}\w\s\d\.\-\=\&\;\:\{\}\,\/\\\\]+))?(\)\}){1}/ie
/(&#(?:x0*[0-9a-f]{2,5}(?![0-9a-f;])|(?:0*\d{2,4}(?![0-9;]))))/iS
Thanks to bitbucketregex highlighter fontawesome