Posts

osx - Build Bash variable name -

this question has answer here: dynamic parameter expansion [duplicate] 1 answer i want create function colored output (just learn bash little better) here works esc_seq="\x1b[" # foreground red fg_red="${esc_seq}31;" # background yellow bg_yellow="43;" # style bold fs_bold="1m" # echo echo -e "${fg_red}${bg_yellow}${fs_bold}hello world!" no try build function function ext_echo() { // lets $1 red, $2 yellow, $3 bold // need ... echo -e "${fg_$1}${bg_$2}${fs_$3}hello world!" } how can build echo execution parameters? the following script should enough starting point: #!/bin/bash ext_echo() { declare -a colors colors=( [red]="<red>" [blue]="<blue>" ) c in "$@"; echo ${colors[$c]} done } ext_echo red blue out...

HTML Email: Images are not showing in MS Outlook and Gmail -

i creating html emailer. when check in yahoo mail, images there in emailer. not there in gmail , ms outlook, , displaying in outlook mail, too. so images displaying in yahoo, outlook mail. not displaying in gmail , local outlook software. i have checked radio button of gmail setting always allow external images i want know table structure affects different email engine? <!--email_cover_page--> <!-- speakers --> <table class="speakers" style=" border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;background: #fa4b00;" align="center" border="0" cellpadding="0" cellspacing="0" width="600"> <tbody> <tr> <td style=" border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;font-size:0px; line-height:0px; mso-line-height-rule: exactly;" ali...

php - $_POST not work in codeingiter -

my login form : http://www.khabgahfeiz.ir/admin/login in controller : public function handling() { var_dump($_post['email']); return; .... but return null value , got error : severity: notice message: undefined index: email filename: backend/login.php line number: 29 use $this->input->post() . e.g.: $this->input->post('table field'=>'form element name');

class - in php why does isn't work -

class grandclass { public $data; public function __construct() { $this->somemethodintheparentclass(); } public function somemethodintheparentclass() { $this->$data = 123456; } } class myparent extends grandclass{ public function __construct() { parent::__construct(); } } class child extends myparent { // public $data; public function __construct() { parent::__construct(); } public function getdata() { return $this->data; } } $a = new child(); var_dump($a->getdata()); php notice: undefined variable: data in d:\test.php on line 7 php fatal error: cannot access empty property in d:\test.php on line 7 update function somemethodintheparentclass below using $this->data = 123456; public function somemethodintheparentclass() { $this->data = 123456; }

fastICA in R (Extracting the Components) -

i'm new r. run analysis in sas. however, need use fastica in r. i've conducted independent component analysis in r , looking extract actual components. the code i've used follows: ica<-fastica(final_all_truncated_s, n.comp = 100) ica list 5 elements "x" "k" "w" "a" "s" i extract values these elements, save excel file, , import sas. question is, how extract values these elements can export excel file? rather saving results excel format, recommend saving each component of result separate csv file. this way don't need additional packages, , have software-independent file format can read sas, excel, etc. you can achieve using simple for-loop in r, e.g.: for (x in names(ica)) { write.csv(ica[[x]], file=sprintf('%s.csv', x), row.names=false, quote=false) } here, names(ica) returns vector of list indices ("x", "k", "w", "a", , "s")...

php - Getting blank array from web service -

i having strange problem in consuming web services created on server. this url of web services created http://52.53.227.143/api_test.php?post_name=bsn%20syntha-6%20isolate i can't able receive data in array or other format on site. used both file_get_content , curl receive json format, giving me blank array. here code: $post_name = 'bsn syntha-6 isolate'; $base = "http://52.53.227.143/api_test.php?post_name=".$post_name; $str = file_get_contents($base); echo '<pre>'; print_r(json_decode($str)); its giving me following result: stdclass object ( [info] => array ( ) ) i use curl, here's code: $curl = curl_init(); curl_setopt($curl, curlopt_ssl_verifypeer, false); curl_setopt($curl, curlopt_header, false); curl_setopt($curl, curlopt_followlocation, true); curl_setopt($curl, curlopt_url, $base); curl_setopt($curl, curlopt_useragent, 'mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.2.3) gecko/20100401 firefo...

php - WordPress hook / filter to process link inside a post -

Image
is there hook / filter process link being added wordpress post ? my aim pre-process link inserted in post using following button , shorten using third party api bit.ly i want both internal / external links. one solution think of add button editor prefer hook / filter job, way more clean , convert custom plugin website (there allowing wordpress up-gradable). i went through wordpress docs , skimmed through following hooks / filters of no use me https://developer.wordpress.org/reference/hooks/add_link/ https://developer.wordpress.org/reference/hooks/post_link/ and of ones listed here https://developer.wordpress.org/?s=link update 1 : far know, external urls inserted post content tinymce editor link plugin, php nothing. in wordpress, there're 2 plugins located @ wp-includes/js/wplink.js , wp-includes/js/tinymce/plugins/wplink/plugin.js . note if you're not in script_debug mode, have .min suffix. wp-includes/js/wplink.js handles dialog: ...