понедельник, 27 июля 2015 г.

Get Folders Sizes

du -chs ./*



0       ./proc
654M    ./root
232K    ./run
5.6M    ./sbin
4.0K    ./selinux
3.3G    ./sites
4.0K    ./srv
0       ./sys
4.1M    ./tmp
435M    ./usr
860M    ./var
0       ./vmlinuz
13M     ./work

четверг, 4 июня 2015 г.

Microsoft Visual Studio Emulators

Microsoft Visual Studio Emulator for Android :
http://go.microsoft.com/fwlink/?LinkID=530049
or
http://go.microsoft.com/fwlink/?LinkID=532868
190000000
500000000
http://go.microsoft.com/fwlink/?LinkID=517148


Emulators for Windows Mobile 10.0.10069
http://go.microsoft.com/fwlink/?LinkID=532802
 1084376
 2026385408

%programfiles(x86)%\Windows Kits\10\Emulation\Mobile\10.0.1.0\flash.vhd


http://codeshake.net/use-visual-studio-android-emulator-android-studio/


ToolsForWin81_WP80_WP81
WindowsPhone81Emulators

среда, 6 мая 2015 г.

Druapl 7 locale DOMAIN with Port

change includes/locale.inc

function locale_language_url_rewrite_url(&$path, &$options) {
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['languages'] = &drupal_static(__FUNCTION__);
  }
  $languages = &$drupal_static_fast['languages'];

  if (!isset($languages)) {
    $languages = language_list('enabled');
    $languages = array_flip(array_keys($languages[1]));
  }

  // Language can be passed as an option, or we go for current URL language.
  if (!isset($options['language'])) {
    global $language_url;
    $options['language'] = $language_url;
  }
  // We allow only enabled languages here.
  elseif (!isset($languages[$options['language']->language])) {
    unset($options['language']);
    return;
  }

  if (isset($options['language'])) {
    switch (variable_get('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX)) {
      case LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN:
        if ($options['language']->domain) {
          // Ask for an absolute URL with our modified base_url.
          global $is_https;
          $url_scheme = ($is_https) ? 'https://' : 'http://';
          $options['absolute'] = TRUE;

          // Take the domain without ports or protocols so we can apply the
          // protocol needed. The setting might include a protocol.
          // This is changed in Drupal 8 but we need to keep backwards
          // compatibility for Drupal 7.
          $host = 'http://' . str_replace(array('http://', 'https://'), '', $options['language']->domain);
          $port = parse_url($host, PHP_URL_PORT);
          $host = parse_url($host, PHP_URL_HOST);

          // Apply the appropriate protocol to the URL.
          $options['base_url'] = $url_scheme . $host . ($port?(80==$port?'':':'.$port):'');
          if (isset($options['https']) && variable_get('https', FALSE)) {
            if ($options['https'] === TRUE) {
              $options['base_url'] = str_replace('http://', 'https://', $options['base_url']);
            }
            elseif ($options['https'] === FALSE) {
              $options['base_url'] = str_replace('https://', 'http://', $options['base_url']);
            }
          }
        }
        break;

      case LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX:
        if (!empty($options['language']->prefix)) {
          $options['prefix'] = $options['language']->prefix . '/';
        }
        break;
    }
  }
}

среда, 1 апреля 2015 г.

Clear chrome downloads history using chrome console

var x = document.getElementsByClassName('control-remove-link'); for (i in x){if(x[i].click)
{x[i].click()}}

Chrome 46+
var x = document.getElementsByClassName('remove'); for (i in x){if(x[i].click){x[i].click()}}

пятница, 6 марта 2015 г.

Digger's Blog: BCDBOOT failure when attempting to copy boot files...

Digger's Blog: BCDBOOT failure when attempting to copy boot files...: If you, like me, tried to deploy Windows8 (maybe for 7 is the same) using a wim image and then used the command bcdboot c:\windows and y...

понедельник, 19 января 2015 г.

Symfony2 Forms and Doctrine Entity: Unique field values validation

Symfony2 Forms and Doctrine Entity: Unique field values validation

If you’re using Symfony2 forms paired with Doctrine entities, you might sometimes need to validate fields so that the values in that field is always unique. Say – “username” field or “email” field. Two users must not have the same username or email.
There is a form validation constraint – “Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity” which integrates nicely with your entity and allows unique values validation when the form is submitted. Let’s look at some code samples to see how it works:
Here, the email and username fields will be checked for duplicate values and the defined message will be displayed if duplicate values are found.

пятница, 16 января 2015 г.

Symfony2 Nginx and Apache2

Nginx Conf

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /PATH_TOSYMFONY_PROJECT/web;

        # Make site accessible from http://localhost/
        server_name localhost;

        location / {
            try_files $uri /app.php$uri$is_args$query_string;
        }

        #
        # Pass (app|app_dev|config).php to apache2
        #
        location ~ ^/(app|app_dev|config)\.php(/|$) {
                #DMZ Only
                #Default Port
                set $_port 80;
                if ($host = EXTERNAL_IP) {
                    set $_port 10880;
                }

                if ($host = INTERNAL_IP) {
                    set $_port 80;
                }
                #End For DMZ
                proxy_pass          http://127.0.0.1:81;
                proxy_set_header    X-Real-IP  $remote_addr;

                proxy_set_header    X-Forwarded-For $remote_addr;
                proxy_set_header    X-Forwarded-Proto $scheme;

                #
                # Нужно для того чтобы симфони могло генерировать урлы без "app.php"
                #
                proxy_set_header    X-Rewrite-URL $request_uri;
                proxy_set_header    X-Original-URL $request_uri;
                proxy_set_header    X-Original-Addr $remote_addr;

                proxy_set_header    Host $host:$_port;

        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny all;
        }
}


Apache2 conf

<VirtualHost *:81>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/PATH_TOSYMFONY_PROJECT/web"
    DirectoryIndex app.php

    <IfModule env_module>
        SetEnv APPLICATION_ENV development
    </IfModule>

    <Directory "/PATH_TOSYMFONY_PROJECT/web">
        AllowOverride None
        Allow from All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>