Get me outta here!

BLOG @ Erman Gülhan

Clean Code Driven Software Developer

Menu

Skip to content
  • Home
  • Contact

Author Archives

admin

How to Restart Supervisor Workers

August 1, 2019 by admin


supervisorctl update
supervisorctl restart laravel-worker:*

Linux Shell supervisorworker Leave a comment

How to Set Raw, html text for checkbox – radio labels when used symfony form builder

May 22, 2019 by admin

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.

Php symfony twig Leave a comment

Wamp Server Yüklerken Eksik VCRUNTIME140.dll ve MSVCR110.dll Dosyaları Hatası

May 29, 2017 by admin

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

Uncategorized MSVCR110.dllVCRUNTIME140.dllwampserver Leave a comment

How to use alias table name with CDbCriteria using Yii Framework

October 26, 2015 by admin
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));
	}
}
Php Yii Framework aliascdbcriteriawith Leave a comment

How to set timezone to Europe/Istanbul on Linux servers

October 18, 2015 by admin

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.
Linux dpkg-reconfiguretimezonetzdata Leave a comment

How to calculate one day ago date time using MySQL

October 1, 2015 by admin

We should use the following statement to calculate one day ago date time using MySQL:

SELECT NOW() - INTERVAL 1 DAY;
mysql SQL Leave a comment

How to get next auto increment value with query on MySQL

September 17, 2015 by admin

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"
mysql SQL Leave a comment

Update form with UniformJs after any changes on uniform elements

September 11, 2015 by admin

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();
Html Javascript JQuery uniformUniformJs Leave a comment

How to create a cookie which never expire using Codeigniter

September 9, 2015 by admin

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);

 

CodeIgniter Php Leave a comment

Example usage of query with MySQL replace

July 21, 2015 by admin
UPDATE your_table
SET url = REPLACE(url, 'test/1', 'test/2')
WHERE url LIKE '%test/1%'
mysql SQL examplemysqlreplace Leave a comment

Post navigation

← Older posts

Recent Posts

  • How to Restart Supervisor Workers
  • How to Set Raw, html text for checkbox – radio labels when used symfony form builder
  • Wamp Server Yüklerken Eksik VCRUNTIME140.dll ve MSVCR110.dll Dosyaları Hatası
  • How to use alias table name with CDbCriteria using Yii Framework
  • How to set timezone to Europe/Istanbul on Linux servers

Recent Comments

    Archives

    • August 2019
    • May 2019
    • May 2017
    • October 2015
    • September 2015
    • July 2015
    • April 2015
    • March 2015
    • February 2015
    • December 2014
    • November 2014
    • October 2014
    • September 2014
    • August 2014
    • July 2014
    • June 2014
    • May 2014
    • April 2014
    • March 2014
    • February 2014
    • January 2014
    • December 2013
    • November 2013
    • October 2013
    • September 2013
    • August 2013
    • July 2013
    • June 2013
    • May 2013
    • February 2013
    • January 2013
    • December 2012
    • November 2012
    • April 2012
    • March 2012
    • January 2012

    Categories

    • android
    • Apache
    • CodeIgniter
    • Common
    • debian
    • Elasticsearch
    • git
    • Html
    • Javascript
    • JQuery
    • Linux
    • mysql
    • Php
    • Postgresql
    • Regex
    • Shell
    • SQL
    • Svn
    • symfony
    • twig
    • Uncategorized
    • Vim
    • Yii Framework

    Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
    Proudly powered by WordPress | Theme: Something Fishy by Caroline Moore.