supervisorctl update
supervisorctl restart laravel-worker:*
Author Archives
How to Set Raw, html text for checkbox – radio labels when used symfony form builder
As default, Symfony 4 does not allow the set raw label text for form elements. I needed this when I want to show terms of use checkbox in a form. I found a workaround solution to accomplish this.
FormType Source Code:
/* ... */ class RegistrationFormType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('termsOfUse', CheckboxType::class, [ 'mapped' => false, 'label' => 'I agree and accept #TERMS_OF_USE_LINK#', 'constraints' => new IsTrue(), ]); /* ... */ } }
Twig Template Source Code
{{ form_start(form) }} {% set termsOfUseFormGroup %} {{ form_row(form.termsOfUse) }} {% endset %} {{ termsOfUseFormGroup|replace({'#TERMS_OF_USE_LINK#':'<a href="#">Terms of Use</a>'})|raw }} {{ form_end(form) }}
To explain briefly, I set rendered terms of use form group content (which is {{ form_row(form.termsOfUse) }}) to a variable (which is termsOfUseFormGroup) and replace #TERM_OF_USE_LINK# string to a link.
Wamp Server Yüklerken Eksik VCRUNTIME140.dll ve MSVCR110.dll Dosyaları Hatası
Wamp Server (bendeki versiyon WampServer 64 bits (x64) 3.0.6) yüklerken ve çalıştırmaya çalışırken 2 dll dosyası eksik hatası veriyor. Bu dll’ler:
- VCRUNTIME140.dll (yükleme esnasında)
- MSVCR110.dll (çalıştırma esnasında)
Bu hatayı gidermek Wamp Server’ı sağlıklı yüklemek için:
1) Önceki Wamp Server programını kaldırın
2) Microsoft Visual C++ 2010 SP1 Redistributable Package (x64) yüklemesini yapın: https://www.microsoft.com/en-us/download/details.aspx?id=48145
3) Wamp Server’ı tekrar baştan kurun
How to use alias table name with CDbCriteria using Yii Framework
public function getUserOpts($op=null) { $ret=User::model() ->active() ->with(array('userTypeVal.userType' => array('alias' => 'ut'))); if(empty($op)) { return $ret->findAll('ut.name="company-official"'); } else { return $ret->find('ut.name="company-official" and t.id=:uid',array(':uid'=>$op)); } }
How to set timezone to Europe/Istanbul on Linux servers
On deabian systems, we can use the following command to do this:
dpkg-reconfigure tzdata
You should select “Europe” from first menu and “Istanbul” from second menu. Example output:
Current default time zone: 'Europe/Istanbul' Local time is now: Sun Oct 18 14:14:34 EEST 2015.
How to calculate one day ago date time using MySQL
We should use the following statement to calculate one day ago date time using MySQL:
SELECT NOW() - INTERVAL 1 DAY;
How to get next auto increment value with query on MySQL
The following select query returns next auto increment value:
SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = "db_name" AND TABLE_NAME = "table_name"
Update form with UniformJs after any changes on uniform elements
When you make any changes on a form with UniformJs and if you make changes on the form such uncheck a checkbox, you must update your changes on uniform elements.
// make a checkbox (uniform element) checked $('#checkbox').prop('checked',true); // update uniform element $.uniform.update('#checkbox'); // or you can make update for all uniform elements in the form $.uniform.update();
How to create a cookie which never expire using Codeigniter
Maximum value of cookie expiration time is 2147483647 (2^31 – 1 = 2147483647 = 2038-01-19 04:14:07) [see: RFC 2616, 14.6 Age]
So the example code snippet:
// substracting current time from last exp. time because CI adds current time to the value $unexpired_cookie_exp_time = 2147483647 - time(); $cookie = array( 'name' => 'cookie_name', 'value' => 'cookie_value', 'expire'=> $unexpired_cookie_exp_time ); $CI->input->set_cookie($cookie);
Example usage of query with MySQL replace
UPDATE your_table SET url = REPLACE(url, 'test/1', 'test/2') WHERE url LIKE '%test/1%'