text:
Q: Illegal string offset 'formId' in repeater gravityform PLease Help me,
I have this errors

Warning: Illegal string offset 'formId' in
  C:\xampp\htdocs\wp-content\plugins\repeater-add-on-for-gravity-forms\class-gf-field-repeater.php
  on line 287
Warning: Illegal string offset 'children' in
  C:\xampp\htdocs\wp-content\plugins\repeater-add-on-for-gravity-forms\class-gf-field-repeater.php
  on line 291

...

if (empty($value)) {
    $value['formId'] = $form_id;
    if (!empty($repeater_start)) { $value['start'] = $repeater_start; }
        if (!empty($repeater_min)) { $value['min'] = $repeater_min; }
        if (!empty($repeater_max)) { $value['max'] = $repeater_max; }
        if (!empty($repeater_children)) { $value['children'] = $repeater_children; }

        $value = json_encode($value);
    }

...

A: Hi I solved adding $value = array() in line 287.
if (empty($value)) {
    $value = array();
    $value['formId'] = $form_id;
    if (!empty($repeater_start)) { $value['start'] = $repeater_start; }
    if (!empty($repeater_min)) { $value['min'] = $repeater_min; }
    if (!empty($repeater_max)) { $value['max'] = $repeater_max; }
    if (!empty($repeater_children)) { $value['children'] = $repeater_children; }
    $value = json_encode($value);
}

That's work for me, I hope it could help you.

A: <?php
class GF_Field_Repeater extends GF_Field {
    public $type = 'repeater';

    public static function init_admin() {
        $admin_page = rgget('page');

        if ($admin_page == 'gf_edit_forms' && !empty($_GET['id'])) {
            add_action('gform_field_standard_settings' , array('GF_Field_Repeater', 'gform_standard_settings'), 10, 2);
            add_action('gform_field_appearance_settings' , array('GF_Field_Repeater', 'gform_appearance_settings'), 10, 2);
            add_action('gform_editor_js_set_default_values', array('GF_Field_Repeater', 'gform_set_defaults'));
            add_action('gform_editor_js', array('GF_Field_Repeater', 'gform_editor'));
            add_filter('gform_tooltips', array('GF_Field_Repeater', 'gform_tooltips'));
        }

        if ($admin_page == 'gf_entries') {
            add_filter('gform_form_post_get_meta', array('GF_Field_Repeater', 'gform_hide_children'));
        }
    }

    public static function init_frontend() {
        add_action('gform_form_args', array('GF_Field_Repeater', 'gform_disable_ajax'));
        add_action('gform_enqueue_scripts', array('GF_Field_Repeater', 'gform_enqueue_scripts'), 10, 2);
        add_filter('gform_pre_render', array('GF_Field_Repeater', 'gform_unhide_children_validation'));
        add_filter('gform_pre_validation', array('GF_Field_Repeater', 'gform_bypass_children_validation'));
    }

    public static function gform_enqueue_scripts($form, $is_ajax) {
        if (!empty($form)) {
            if (GF_Field_Repeater::get_field_index($form) !== false) {
                wp_enqueue_script('gforms_repeater_postcapture_js', plugins_url('js/jquery.postcapture.min.js', __FILE__), array('jquery'), '0.0.1');
                wp_enqueue_script('gforms_repeater_js', plugins_url('js/gf-repeater.min.js', __FILE__), array('jquery'), GF_REPEATER_VERSION);
                wp_enqueue_style('gforms_repeater_css', plugins_url('css/gf-repeater.css', __FILE__), array(), GF_REPEATER_VERSION);
            }
        }
    }

    public function get_form_editor_field_title() {
        return 'Repeater';
    }

    public function get_form_editor_field_settings() {
        return array(
            'admin_label_setting',
            'css_class_setting',
            'description_setting',
            'error_message_setting',
            'label_setting',
            'prepopulate_field_setting'
        );
    }

    public static function gform_set_defaults() {
        echo "
            case \"repeater\" :
                field.label = \"Repeater\";
            break;
        ";
    }

    public static function gform_standard_settings($position, $form_id) {
        if ($position == 1600) {
            echo "

                    Start ";

            gform_tooltip('form_field_repeater_start');

            echo "
                    <input type=\"number\" id=\"field_repeater_start\" min=\"1\" value=\"1\" onchange=\"SetFieldProperty('start', this.value);\">

";

            echo "

                    Min ";

            gform_tooltip('form_field_repeater_min');

            echo "
                    <input type=\"number\" id=\"field_repeater_min\" min=\"1\" value=\"1\" onchange=\"SetFieldProperty('min', this.value);\">

";

            echo "

                    Max ";

            gform_tooltip('form_field_repeater_max');

            echo "
                    <input type=\"number\" id=\"field_repeater_max\" min=\"1\" onchange=\"SetFieldProperty('max', this.value);\">

";
        }
    }

    public static function gform_appearance_settings($position, $form_id) {
        if ($position == 400) {
            echo "

                    <input type=\"checkbox\" id=\"field_repeater_hideLabel\" onchange=\"SetFieldProperty('hideLabel', this.checked);\">
                    Hide Label & Description ";

            gform_tooltip('form_field_repeater_hideLabel');

            echo "

";
        }
    }

    public static function gform_editor() {
        echo "";
    }

    public static function gform_tooltips($tooltips) {
        $tooltips['form_field_repeater_start'] = "The number of times the repeater will be repeated when the form is rendered. Leaving this field blank or setting it to a number higher than the maximum number is the same as setting it to 1.";
        $tooltips['form_field_repeater_min'] = "The minimum number of times the repeater is allowed to be repeated. Leaving this field blank or setting it to a number higher than the maximum field is the same as setting it to 1.";
        $tooltips['form_field_repeater_max'] = "The maximum number of times the repeater is allowed to be repeated. Leaving this field blank or setting it to a number lower than the minimum field is the same as setting it to unlimited.";
        $tooltips['form_field_repeater_hideLabel'] = "If this is checked, the repeater label and description will not be shown to users on the form.";
        return $tooltips;
    }

    function validate($value, $form) {
        $repeater_required = $this->repeaterRequiredChildren;

        if (!empty($repeater_required)) {
            $dataArray = json_decode($value, true);

            foreach ($form['fields'] as $key=>$value) {
                $fieldKeys[$value['id']] = $key;

                if (is_array($value['inputs'])) {
                    foreach ($value['inputs'] as $inputKey=>$inputValue) {
                        $inputKeys[$value['id']][$inputValue['id']] = $inputKey;
                    }
                }
            }

            if ($dataArray['repeatCount'] < $this->min) {
                $this->failed_validation  = true;
                $this->validation_message = "A minimum number of ".$this->min." is required.";
                return;
            }

            if ($this->max && $dataArray['repeatCount'] > $this->max) {
                $this->failed_validation  = true;
                $this->validation_message = "A maximum number of ".$this->max." is allowed.";
                return;
            }

            for ($i = 1; $i < $dataArray['repeatCount'] + 1; $i++) {
                foreach ($dataArray['children'] as $field_id=>$field) {
                    $inputNames = $field['inputs'];
                    $repeatSkips = $field['conditionalLogic']['skip'];

                    if (!is_array($inputNames)) { continue; }

                    if (is_array($repeatSkips)) {
                        if (in_array($i, $repeatSkips) || in_array('all', $repeatSkips)) { continue; }
                    }

                    foreach ($inputNames as $inputName) {
                        if (is_array($inputName)) { $inputName = reset($inputName); }

                        if (substr($inputName, -2) == '[]') {
                            $getInputName = substr($inputName, 0, strlen($inputName) - 2).'-'.$dataArray['repeaterId'].'-'.$i;
                        } else {
                            $getInputName = $inputName.'-'.$dataArray['repeaterId'].'-'.$i;
                        }

                        $getInputName = str_replace('.', '_', strval($getInputName));
                        $getInputData = rgpost($getInputName);
                        $getInputIdNum = preg_split("/(_|-)/", $getInputName);

                        if (in_array($getInputIdNum[1], $repeater_required)) {
                            $fieldKey = $fieldKeys[$getInputIdNum[1]];
                            $fieldType = $form['fields'][$fieldKey]['type'];
                            $failedValidation = false;

                            switch($fieldType) {
                                case 'name':
                                    $requiredIDs = array(3, 6);
                                    if (in_array($getInputIdNum[2], $requiredIDs) && empty($getInputData)) { $failedValidation = true; }
                                    break;
                                case 'address':
                                    $skipIDs = array(2);
                                    if (!in_array($getInputIdNum[2], $skipIDs) && empty($getInputData)) { $failedValidation = true; }
                                    break;
                                default:
                                    if (empty($getInputData)) { $failedValidation = true; }
                            }

                            if ($failedValidation) {
                                $this->failed_validation  = true;
                                if ($this->errorMessage) { $this->validation_message = $this->errorMessage; } else { $this->validation_message = "A required field was left blank."; }
                                return;
                            }
                        }
                    }
                }
            }
        }
    }

    public function get_field_content($value, $force_frontend_label, $form) {
        if (is_admin()) {
            $admin_buttons = $this->get_admin_buttons();
            $field_content = "{$admin_buttons}

begin repeater

REPEATER

top of repeater

";
        } else {
            $field_label        = $this->get_field_label($force_frontend_label, $value);
            $description        = $this->get_description($this->description, 'gsection_description gf_repeater_description');
            $hide_label         = $this->hideLabel;
            $validation_message = ( $this->failed_validation && ! empty( $this->validation_message ) ) ? sprintf( "
%s
", $this->validation_message ) : '';
            if (!empty($field_label)) { $field_label = "
{$field_label}
"; } else { $field_label = ''; }
            if ($hide_label) { $field_label = ''; $description = ''; }
            $field_content = "
{$field_label}{FIELD}
{$description}{$validation_message}";
        }
        return $field_content;
    }

    public function get_field_input($form, $value = '', $entry = null) {
        if (is_admin()) {
            return '';
        } else {
            $form_id            = $form['id'];
            $is_entry_detail    = $this->is_entry_detail();
            $is_form_editor     = $this->is_form_editor();
            $id                 = (int) $this->id;
            $field_id           = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_$id" : 'input_' . $form_id . "_$id";
            $tabindex           = $this->get_tabindex();
            $repeater_parem     = $this->inputName;
            $repeater_start     = $this->start;
            $repeater_min       = $this->min;
            $repeater_max       = $this->max;
            $repeater_required  = $this->repeaterRequiredChildren;
            $repeater_children  = $this->repeaterChildren;

            if (!empty($repeater_parem)) {
                $repeater_parem_value = GFFormsModel::get_parameter_value($repeater_parem, $value, $this);
                if (!empty($repeater_parem_value)) { $repeater_start = $repeater_parem_value; }
            }

            if (!empty($repeater_children)) {
                $repeater_children_info = array();
                $repeater_parems = GF_Field_Repeater::get_children_parem_values($form, $repeater_children);

                foreach($repeater_children as $repeater_child) {
                    $repeater_children_info[$repeater_child] = array();
                    $repeater_child_field_index = GF_Field_Repeater::get_field_index($form, 'id', $repeater_child);

                    if (!empty($repeater_required)) {
                        if (in_array($repeater_child, $repeater_required)) {
                            $repeater_children_info[$repeater_child]['required'] = true;
                        }
                    }

                    if (!empty($repeater_parems)) {
                        if (array_key_exists($repeater_child, $repeater_parems)) {
                            $repeater_children_info[$repeater_child]['prePopulate'] = $repeater_parems[$repeater_child];
                        }
                    }

                    if ($repeater_child_field_index !== false) {
                        if ($form['fields'][$repeater_child_field_index]['inputMask']) {
                            $repeater_children_info[$repeater_child]['inputMask'] = $form['fields'][$repeater_child_field_index]['inputMaskValue'];
                        } elseif ($form['fields'][$repeater_child_field_index]['type'] == 'phone' && $form['fields'][$repeater_child_field_index]['phoneFormat'] = 'standard') {
                            $repeater_children_info[$repeater_child]['inputMask'] = "(999) 999-9999";
                        }

                        if ($form['fields'][$repeater_child_field_index]['conditionalLogic']) {
                            $repeater_children_info[$repeater_child]['conditionalLogic'] = $form['fields'][$repeater_child_field_index]['conditionalLogic'];
                        }
                    }
                }

                $repeater_children = $repeater_children_info;
            }

            if (empty($value)) {
                $value['formId'] = $form_id;
                if (!empty($repeater_start)) { $value['start'] = $repeater_start; }
                if (!empty($repeater_min)) { $value['min'] = $repeater_min; }
                if (!empty($repeater_max)) { $value['max'] = $repeater_max; }
                if (!empty($repeater_children)) { $value['children'] = $repeater_children; }

                $value = json_encode($value);
            }

            return sprintf("<input name='input_%d' id='%s' type='hidden' class='gform_repeater' value='%s' %s />", $id, $field_id, $value, $tabindex);
        }
    }

    public function get_value_save_entry($value, $form, $input_name, $lead_id, $lead) {
        $dataArray = json_decode($value, true);
        $value = Array();

        for ($i = 1; $i < $dataArray['repeatCount'] + 1; $i++) {
            foreach ($dataArray['children'] as $field_id=>$field) {
                $inputData = Array();

                if (array_key_exists('inputs', $field)) {
                    $inputNames = $field['inputs'];
                    $repeatSkips = $field['conditionalLogic']['skip'];

                    if (is_array($repeatSkips)) {
                        if (in_array($i, $repeatSkips) || in_array('all', $repeatSkips)) { continue; }
                    }

                    if (is_array($inputNames)) {
                        foreach ($inputNames as $inputName) {
                            if (substr($inputName, -2) == '[]') {
                                $getInputName = substr($inputName, 0, strlen($inputName) - 2).'-'.$dataArray['repeaterId'].'-'.$i;
                            } else {
                                $getInputName = $inputName.'-'.$dataArray['repeaterId'].'-'.$i;
                            }

                            $getInputData = rgpost(str_replace('.', '_', strval($getInputName)));

                            if (!empty($getInputData)) {
                                if (is_array($getInputData)) {
                                    foreach ($getInputData as $theInputData) {
                                        $inputData[] = $theInputData;
                                    }
                                } else {
                                    $inputData[] = $getInputData;
                                }
                            }
                        }
                    }
                } else {
                    if (GF_Field_Repeater::get_field_type($form, $field_id) == 'section') { $inputData = '[gfRepeater-section]'; }
                }

                $childValue[$field_id] = $inputData;
            }
            $value[$i] = $childValue;
        }

        return maybe_serialize($value);
    }

    public function get_value_entry_list($value, $entry, $field_id, $columns, $form) {
        if (empty($value)) {
            return '';
        } else {
            $dataArray = GFFormsModel::unserialize($value);
            $arrayCount = count($dataArray);
            if ($arrayCount > 1) { $returnText = $arrayCount.' entries'; } else { $returnText = $arrayCount.' entry'; }
            return $returnText;
        }
    }

    public function get_value_entry_detail($value, $currency = '', $use_text = false, $format = 'html', $media = 'screen') {
        if (empty($value)) {
            return '';
        } else {
            $dataArray = GFFormsModel::unserialize($value);
            $arrayCount = count($dataArray);
            $output = "\n";
            $count = 0;
            $repeatCount = 0;
            $display_empty_fields = rgget('gf_display_empty_fields', $_COOKIE);
            $form_id = $this->formId;
            $get_form = GFFormsModel::get_form_meta_by_id($form_id);
            $form = $get_form[0];

            foreach ($dataArray as $key=>$value) {
                $repeatCount++;
                $tableContents = '';

                if (!empty($value) && !is_array($value)) {
                    $save_value = $value;
                    unset($value);
                    $value[0] = $save_value;
                }

                foreach ($value as $childKey=>$childValue) {
                    $count++;
                    $childValueOutput = '';

                    if (empty($display_empty_fields) && count($childValue) == 0) { continue; }

                    if (is_numeric($childKey)) {
                        $field_index = GF_Field_Repeater::get_field_index($form, 'id', $childKey);
                        if ($field_index === false) { continue; }
                        $entry_title = $form['fields'][$field_index]['label'];
                    } else {
                        $entry_title = $childKey;
                    }

                    $entry_title = str_replace('[gfRepeater-count]', $repeatCount, $entry_title);

                    if ($format == 'html') {
                        if ($childValue == '[gfRepeater-section]') {
                            if ($media == 'email') {
                                $tableStyling = ' style="font-size:14px;font-weight:bold;background-color:#eee;border-bottom:1px solid #dfdfdf;padding:7px 7px"';
                            } else {
                                $tableStyling = ' class="entry-view-section-break"';
                            }
                        } else {
                            if ($media == 'email') {
                                $tableStyling = ' style="background-color:#EAF2FA;font-family:sans-serif;font-size:12px;font-weight:bold"';
                            } else {
                                $tableStyling = ' class="entry-view-field-name"';
                            }
                        }

                        $tableContents .= "
\n".$entry_title."	\n
\n";
                    } else {
                        $tableContents .= $entry_title.": ";
                    }

                    if (is_array($childValue)) {
                        if (count($childValue) == 1) {
                            $childValueOutput = $childValue[0];
                        } elseif (count($childValue) > 1) {
                            if ($format == 'html') {
                                if ($media == 'email') {
                                    $childValueOutput = "
\n";
                                } else {
                                    $childValueOutput = "
\n";
                                }
                            }

                            foreach ($childValue as $childValueData) {
                                if ($format == 'html') {
                                    $childValueOutput .= "
".$childValueData."
";
                                } else {
                                    $childValueOutput .= $childValueData."\n";
                                }
                            }

                            if ($format == 'html') { $childValueOutput .= "
\n"; }
                        }

                        if ($media == 'email') { $tableStyling = ''; } else { $tableStyling = ' class=\"entry-view-field-value\"'; }

                        if ($format == 'html') {
                            $tableContents .= "
\n".$childValueOutput."	\n
\n";
                        } else {
                            $tableContents .= $childValueOutput."\n";
                        }
                    }
                }

                if (!empty($tableContents)) {
                    if ($format == 'html') {
                        if ($media == 'email') { $tableStyling = ' width="100%" border="0" cellpadding="5" bgcolor="#FFFFFF"'; } else { $tableStyling = ' class="widefat fixed entry-detail-view"'; }
                        $output .= "
\n";
                        $output .= $tableContents;
                        $output .= "
\n";
                    } else {
                        $output .= $tableContents."\n";
                    }
                }
            }
        }

        if ($count !== 0) {
            if ($format == 'text') { $output = rtrim($output); }
            return $output;
        } else { return ''; }
    }

    public function get_value_merge_tag($value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br) {
        $output = GF_Field_Repeater::get_value_entry_detail($raw_value, '', false, $format, 'email');
        $output = preg_replace("/[\r\n]+/", "\n", $output);
        return trim($output);
    }

    public function get_value_export($entry, $input_id = '', $use_text = false, $is_csv = false) {
        if (empty($input_id)) { $input_id = $this->id; }
        $output = rgar($entry, $input_id);
        $output = GF_Field_Repeater::get_value_entry_detail($output, '', false, 'text', 'email');
        $output = preg_replace("/[\r\n]+/", ", ", trim($output));
        return $output;
    }

    public static function gform_hide_children($form) {
        $form_id = $form['id'];
        $repeaterChildren = Array();
        $grid_modified = false;
        $grid_meta = GFFormsModel::get_grid_column_meta($form_id);

        foreach($form['fields'] as $key=>$field) {
            if ($field->type == 'repeater') {
                if (is_array($field->repeaterChildren)) { $repeaterChildren = array_merge($repeaterChildren, $field->repeaterChildren); }
            } elseif ($field->type == 'repeater-end') { array_push($repeaterChildren, $field->id); }

            if (!empty($repeaterChildren)) {
                if (in_array($field->id, $repeaterChildren)) {
                    unset($form['fields'][$key]);

                    if (is_array($grid_meta)) {
                        $grid_pos = array_search($field->id, $grid_meta);
                        if ($grid_pos) {
                            $grid_modified = true;
                            unset($grid_meta[$grid_pos]);
                        }
                    }
                }
            }
        }

        if ($grid_modified) { GFFormsModel::update_grid_column_meta($form_id, $grid_meta); }

        $form['fields'] = array_values($form['fields']);

        return $form;
    }

    public static function gform_disable_ajax($args) {
        $get_form = GFFormsModel::get_form_meta_by_id($args['form_id']);
        $form = reset($get_form);

        if (GF_Field_Repeater::get_field_index($form) !== false) {
            $args['ajax'] = false;
        }

        return $args;
    }

    public static function gform_bypass_children_validation($form) {
        if (GF_Field_Repeater::get_field_index($form) === false) { return $form; }

        $repeaterChildren = Array();

        foreach($form['fields'] as $key=>$field) {
            if ($field->type == 'repeater') {
                if (is_array($field->repeaterChildren)) { $repeaterChildren = array_merge($repeaterChildren, $field->repeaterChildren); }
            }

            if (!empty($repeaterChildren)) {
                if (in_array($field->id, $repeaterChildren) && !$field->adminOnly) {
                    $form['fields'][$key]['adminOnly'] = true;
                    $form['fields'][$key]['repeaterChildValidationHidden'] = true;
                }
            }
        }

        return $form;
    }

    public static function gform_unhide_children_validation($form) {
        if (GF_Field_Repeater::get_field_index($form) === false) { return $form; }

        foreach($form['fields'] as $key=>$field) {
            if ($field->repeaterChildValidationHidden) {
                $form['fields'][$key]['adminOnly'] = false;
                $form['fields'][$key]['repeaterChildValidationHidden'] = false;
            }
        }

        return $form;
    }

    public static function get_field_index($form, $key = 'type', $value = 'repeater') {
        if (is_array($form)) {
            if (!array_key_exists('fields', $form)) { return false; }
        } else { return false; }

        foreach ($form['fields'] as $field_key=>$field_value) {
            if (is_object($field_value)) {
                if (property_exists($field_value, $key)) {
                    if ($field_value[$key] == $value) { return $field_key; }
                }
            }
        }

        return false;
    }

    public static function get_field_type($form, $id) {
        $field_index = GF_Field_Repeater::get_field_index($form, 'id', $id);
        if ($field_index !== false) { return $form['fields'][$field_index]['type']; }
        return false;
    }

    public static function get_children_parems($form, $children_ids) {
        foreach($form['fields'] as $key=>$value) {
            if (in_array($value['id'], $children_ids)) {
                if ($value['inputName']) {
                    $parems[$value['id']] = $value['inputName'];
                } elseif ($value['inputs']) {
                    foreach($value['inputs'] as $key=>$value) {
                        if ($value['name']) { $parems[$value['id']] = $value['name']; }
                    }
                }
            }
        }
        if (!empty($parems)) { return $parems; } else { return false; }
    }

    public static function get_children_parem_values($form, $children_ids) {
        global $wp_filter;
        $children_parems = GF_Field_Repeater::get_children_parems($form, $children_ids);

        if (empty($children_parems)) { return false; }

        // Check the URL first
        foreach($_GET as $url_key=>$url_value) {
            $key = array_search($url_key, $children_parems);
            if ($key !== false) {
                $parems[$key][0] = $url_value;
            } else {
                $split_key = preg_split('/\D+\K/', $url_key);
                $key = array_search($split_key[0], $children_parems);
                if ($key !== false) { $parems[$key][$split_key[1]] = $url_value; }
            }
        }

        // Then check the filters
        foreach($wp_filter as $key=>$value) {
            $split_key = preg_split('/^gform_field_value_+\K/', $key);
            if (!empty($split_key[1])) {
                $key1 = array_search($split_key[1], $children_parems);
                if ($key1 !== false) {
                    $parems[$key1][0] = apply_filters($key, '');
                } else {
                    $split_key2 = preg_split('/\D+\K/', $split_key[1]);
                    $key2 = array_search($split_key2[0], $children_parems);
                    if ($key2 !== false) { $parems[$key2][$split_key2[1]] = apply_filters($key, ''); }
                }
            }
        }
        if (!empty($parems)) { return $parems; } else { return false; }
    }
}
GF_Fields::register(new GF_Field_Repeater());


text:
Q: VBA Vlookup with defined name range I am having 2 workbooks (Lookup and Destination) and trying to retrieve values from a defined name range in the Lookup workbook.
 ......
 Set rng = Range(Cells(15, 3), Cells(863, 12)) 'C15:L863
 wbkLookup.Names.Add Name:="LookupAreaDK", RefersTo:=rng
 ......
 colDest.Formula = "=VLOOKUP(" & colLookup.Address(False, False) & ", LookupAreaDK ,10,0)"

But I've got #NAME? as returned values. What is wrong with the syntax? Could anyone help? Thanks.

A: So, you need to assign the address to the colLookup, or create another variable.
Then, this works:
Dim colLookup As String
colLookup = Cells(1, 4).Address
colDest.Formula = "=VLOOKUP(" & colLookup & ", LookupAreaDK ,3,0)"

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to implement Aggregate Root repository an add child entity with EF I'm developing an MVC application. I have a Domain Model, and I use a repositry pattern for data access and Entity Framework Code First. I also have a UnitOfWork class which I call the repository operations through.
My problem mainly arises when I try to take advantage of aggregate roots and handle child objects through their parent repository.
This is the problem:
Parent class "Supplier" has several Contracts with Departments. I've chosen to make the contract a child of Supplier in this case.
To add a new contract I need to add a method to add a contract in my SupplierRepository, I tried:
 public class SupplierRepository : GenericRepository<Supplier>
        {

            public SupplierRepository(MyContext context)
            : base(context)
            {
            }

            public void AddSupplierContract(SupplierContract contract)
            {
                 var supplier = context.Suppliers.Find(contract.SupplierId);
                 supplier.Contract.Add(contract);

            }

And I also tried:
            public void AddSupplierContract(SupplierContract contract)
            {
                context.Entry(contract).State = EntityState.Added;
            }

         }

When i call
_unitOfWork.save();

I get an error telling me:

An entity object cannot be referenced by multiple instances of IEntityChangeTracker

UnitOfWork instansiates my DbContext (myDbContext) and my SupplierRepository and calls the myDbContext.Save()

*

*Why do I get this behavior

*How should I implement an Aggregate Root Repository (CRUD operations for the child objects)

As far as I understand I should have a method in the repository that takes a contract and adds it, and not do this in the Controller of my MVC app, but I don't seem to get it working.
I've seen a lot of information about Aggregate Roots, but no examples of how to implement it.
Thanks.
Solution:
Well I finally figured it out.
So it was not a problem with the repository, but the new SupplierContract queryed the store for the user entity that created it (through an extension method). Obviously this context did not dispose and therefore i had two current DbContexts when I instansiated it to save the contract entity.
Hopefully someone saves time by reading this.
The Aggregate Root repository I solved by just doing like this in the SupplierRepository:
    public void AddSupplierContract(SupplierContract contract)
    {
        db.SupplierContracts.Add(contract);
    }

And calling UnitOfWork.Save() method.

A: While technically you may have solved this issue, I do hope you are aware there's something fundamentally flawed in your design (unless you're using Fowler repositories): repositories (the DDD kind) deal in aggregates only. The fact that SupplierContract needs to be added to the context is not a concern of the calling code. So, why expose that method? I would also reconsider having the repository delegate the save (why else have a UoW). As far as aggregates are concerned I get the feeling you seem to be treating them as structural objects, not as behavioral ones. Hence you seem to be in for a world of pain, going through some of the moves, but not getting any of the value.

A: To get rid of that error, you should use same MyContext instance to create all the repositories. If you use some dependency-injector, it should allow you to configure same MyContext object through single request. For example, for Ninject, that would be
kernel.Bind<MyContext>().ToSelf().InRequestScope();


text:
Q: Neural network from scratch in R I am writing a neural network from scratch in r programming language and apply it on iris dataset.
here
d1f is a matrix of propagation error of output layer
d2f is a matrix of propagation error of hidden layer
a1,a2,a3,a4 are activation output of hidden layer
o1,o2,o3 are activation output of output layer
w1b & w2b are the matrix of weights of hidden layer and output layer respectively
j is used to store cost of each observation
till now I had written it for only single pass through the whole dataset. So only propagation error is calculated but weights will not get updated.
whenever I run this code I got an error
Error in a1(1 - a1) : could not find function "a1"
bt after termination i can see the value of a1 on the right side of R-Studio.
It seems like is d2f is not calculated even.so what i am doing wrong.
here is the code
library(datasets)
library("phonTools", lib.loc="~/R/win-library/3.5")
iris.df =data(iris)
data(iris)
data("iris")
iris.df=iris

J = vector(mode = "numeric" , length = nrow(iris.df) )

attach(iris.df)

iris.df$y1 = 0

iris.df$y2 = 0

iris.df$y3 = 0

iris.df$y1[iris.df$Species =="setosa"] = 1

iris.df$y2[iris.df$Species =="versicolor"] = 1

iris.df$y3[iris.df$Species =="virginica"] = 1

w1b = matrix(rexp(20, rate=.1), ncol=5)  #Declaring weights between 1st             layer

w1b = wb1*0.24 - 0.12

q = c(1,1,1,1)

#w1b = cbind(q,w1b)

w2b = matrix(rexp(12, rate=.1), ncol=4)

w2b = w2b*0.24 - 0.12

q = c(1,1,1)

#w2b = cbind(q,w2b)

d1f = zeros(3,4)

d2f = zeros(4,5)

sigmoid = function(z)
{
  sig = 1/( 1 + exp(-z) )

  return(sig)
}

for (i in 1:150) {

# Forward Propagation For First Layer

a1 = sigmoid( 1*w1b[1,1] + iris.df$Sepal.Length[i]*w1b[1,2] +     iris.df$Sepal.Width[i]*w1b[1,3] + iris.df$Petal.Length[i]*w1b[1,4] +     iris.df$Petal.Width[i]*w1b[1,5] )

a2 = sigmoid( 1*w1b[2,1] + iris.df$Sepal.Length[i]*w1b[2,2] + iris.df$Sepal.Width[i]*w1b[2,3] + iris.df$Petal.Length[i]*w1b[2,4] + iris.df$Petal.Width[i]*w1b[2,5] )

a3 = sigmoid( 1*w1b[3,1] + iris.df$Sepal.Length[i]*w1b[3,2] + iris.df$Sepal.Width[i]*w1b[3,3] + iris.df$Petal.Length[i]*w1b[3,4] + iris.df$Petal.Width[i]*w1b[3,5] )

a4 = sigmoid( 1*w1b[4,1] + iris.df$Sepal.Length[i]*w1b[4,2] + iris.df$Sepal.Width[i]*w1b[4,3] + iris.df$Petal.Length[i]*w1b[4,4] + iris.df$Petal.Width[i]*w1b[4,5] )

#Forward Propagation For Second Layer

o1 = sigmoid( 1*w2b[1,1] + a1*w2b[1,2] + a1*w2b[1,3] + a1*w2b[1,4] )

o2 = sigmoid( 1*w2b[2,1] + a2*w2b[2,2] + a2*w2b[2,3] + a2*w2b[2,4] )

o3 = sigmoid( 1*w2b[3,1] + a3*w2b[3,2] + a3*w2b[3,3] + a3*w2b[3,4] )

#Backward Propagation For First Layer

d1f[1,1] = d1f[1,1] + o1*(1-o1) *(o1-y1[i])  #For Baised Node

d1f[2,1] = d1f[2,1] + o2*(1-o2) *(o2-y2[i])  #For Baised Node

d1f[3,1] = d1f[3,1] + o3*(1-o3) *(o3-y3[i])  #For Baised Node

d1f[1,2] = d1f[1,2] + a1*o1*(1-o1)*(o1-y1[i])

d1f[2,2] = d1f[2,2] + a1*o2*(1-o2)*(o2-y2[i])

d1f[3,2] = d1f[3,2] + a1*o3*(1-o3)*(o3-y3[i])

d1f[1,3] = d1f[1,3] + a2*o1*(1-o1)*(o1-y1[i])

d1f[2,3] = d1f[2,3] + a2*o2*(1-o2)*(o2-y2[i])

d1f[3,3] = d1f[3,3] + a2*o3*(1-o3)*(o3-y3[i])

d1f[1,4] = d1f[1,4] + a3*o1*(1-o1)*(o1-y1[i])

d1f[2,4] = d1f[2,4] + a3*o2*(1-o2)*(o2-y2[i])

d1f[3,4] = d1f[3,4] + a3*o3*(1-o3)*(o3-y3[i])

#Backward Propagation For Second Layer

d2f[1,2] = d2f[1,2] + iris.df$Sepal.Length[i] * a1(1-a1) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[1,3] = d2f[1,3] + iris.df$Sepal.Width[i] * a1(1-a1) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[1,4] = d2f[1,4] + iris.df$Petal.Length[i] * a1(1-a1) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[1,5] = d2f[1,5] + iris.df$Petal.Width[i] * a1(1-a1) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

###########

d2f[1,1] = d2f[1,1] + a1(1-a1) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] ) #For Biased Node

d2f[2,1] = d2f[2,1] + a2(1-a2) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] ) #For Biased Node

d2f[3,1] = d2f[3,1] + a3(1-a3) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] ) #For Biased Node

d2f[4,1] = d2f[4,1] + a4(1-a4) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] ) #For Biased Node

d2f[2,2] = d2f[2,2] + iris.df$Sepal.Length[i] * a2(1-a2) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[2,3] = d2f[2,3] + iris.df$Sepal.Width[i] * a2(1-a2) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[2,4] = d2f[2,4] + iris.df$Petal.Length[i] * a2(1-a2) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[2,5] = d2f[2,5] + iris.df$Petal.Width[i] * a2(1-a2) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[3,2] = d2f[3,2] + iris.df$Sepal.Length[i] * a3(1-a3) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[3,3] = d2f[3,3] + iris.df$Sepal.Width[i] * a3(1-a3) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[3,4] = d2f[3,4] + iris.df$Petal.Length[i] * a3(1-a3) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[3][5] = d2f[3,5] + iris.df$Petal.Width[i] * a3(1-a3) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[4,2] = d2f[4,2] + iris.df$Sepal.Length[i] * a4(1-a4) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[4][3] = d2f[4,3] + iris.df$Sepal.Width[i] * a4(1-a4) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[4,4] = d2f[4,4] + iris.df$Petal.Length[i] * a4(1-a4) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

d2f[4,5] = d2f[4,5] + iris.df$Petal.Width[i] * a4(1-a4) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

cost = ( iris.df$y1[i] * log(o1) + (1-y1[i]) * log(1-o1) + iris.df$y2[i] * log(o2) + (1-y2[i]) * log(1-o2) + iris.df$y3[i] * log(o3) + (1-y3[i]) * log(1-o3) )/nrow(iris.df)

j[i] = cost
}

A: If you want to get the product of a1 and 1-a1, you explicitly have to write the '*' in between.
d2f[1,2] = d2f[1,2] + iris.df$Sepal.Length[i] * a1*(1-a1) * ( (o1-y1[i])*o1*(1-o1)*w2b[1,2] + (o2-y2[i])*o2*(1-o2)*w2b[2,2] + (o3-y3[i])*o3*(1-o3)*w2b[3,2] )

If you open parentheses after a1, r thinks youre referring to a function called a1, because thats the syntax for functions. The same problem is in multiple occasions of your code. You should always state the arithmetic operators you want to use.


text:
Q: Can I specify solution or search space in Z3? Let me explain my question with an example:
Suppose, I have a domain of possible discrete integers, e.g., -1, 0, 2, 3, 5 and 6
Now, I am looking for a solution (or model) for a variable x that will satisfy the following constraints:
(x > 0) && (x < 6) && (x != 3) && (x > 2)
The answer will be (from the solution domain) = 5, right?
How can I do this in Z3?
That is, I would like to define solution space using discrete entities and then assert few constraints and ask Z3 to check for satisfiablity. If satisfyable, then want the model.
Can anyone help me with the example?
Thank you,
--Ishtiaque

A: Asserting that x == -1 || x == 0 || x == 2 || x == 3 || x == 5 || x == 6 as an axiom beforehand should do it. I don't know if Z3 has a better way built into it though.
Edit:
Another solution may be to use an array, though I haven't used them before. Conceptually it should be possible to declare an array A that contains the numbers, and then say:
(exists (y Int) (=(select A y) x))`
Not sure if that is the exact syntax as I haven't used arrays before, but hopefully it should work.


text:
Q: Dialogflow doesn't recognise certain words in training phrases I have created a number of intents and for the most part, they're all working well and by that I mean, it identifies the correct intent and the sentiment score is as expected.
However, there are a couple of words that exist on the intent training phrases, but dialogflows sentiment score is negative. On the example below "Missing" appears to be the issue. When i use the same phrase and replace "Missing" for "Wrong" it also gives me a negative response.
These 3 items are currently on the intent as training phrases:

*

*proactive is missing (fails)

*proactive is wrong (fails)

*proactive is correct (pass)

Any ideas? i'm starting to think dialogflow is a very positive bot :-)
`

{
  "responseId": "1232141231231",
  "queryResult": {
    "queryText": "proactive is missing",
    "parameters": {},
    "allRequiredParamsPresent": true,
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            ""
          ]
        }
      }
    ],
    "intent": {
      "name": "projects/my-projectid/agent/intents/dialog-value-here",
      "displayName": "question one"
    },
    "intentDetectionConfidence": 1,
    "languageCode": "en",
    "sentimentAnalysisResult": {
      "queryTextSentiment": {
        "score": -0.8,
        "magnitude": 0.8
      }
    }
  }
}

`

A: After doing some reading on various ways of creating coherent conversations, I came across this article from google. My key takeaways from it are:

*

*Cohesion: The average similarity value between each pair of phrases in the same intent. That value is computed for each intent. The higher the intent cohesion value, the better the intent training phrases.

*Separation: Given two intents, the average distance between each pair of training phrases in the two intents.

*Confusing phrases: Training phrases that are highly similar to training phrases in other intents.
Though I wasn't able to fix my current issue, it helped me understand why the bot gets confused, pretty much out of context from all other training phrases.
If anyone has any thoughts or recommendations, i'd really appreciate it.


text:
Q: pam_mont of home and shared folders I have a samba network. Authentication is done using winbind and uses login successfully.
Home folder is mount with no problem, but users don't have access to mounted subfolders:
/home/user  -> user home
/home/dept  -> shared files
If I login as root and "su"; I can access to /home/user/dept with no problem. I think the problem is in mount options, but I cannot find it.
My pam_mount.conf.xml is:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">
<pam_mount>
 <path>/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin</path>

 <mntoptions allow="nosuid,nodev,loop,encryption,fsck,nonempty,allow_root,allow_other" />
 <logout wait="0" hup="0" term="0" kill="0" />
 <mkmountpoint enable="1" remove="true" />
 <volume options="user=%(DOMAIN_USER),domain=DOMAIN" fstype="cifs" server="192.168.1.5" path="%(DOMAIN_USER)" mountpoint="/home/%(USER)"></volume>
 <volume options="user=%(DOMAIN_USER),domain=DOMAIN" fstype="cifs" server="192.168.1.5" path="dept" mountpoint="/home/%(USER)/dept"></volume>
</pam_mount>

Any hint/idea?

A: It is a samba problem, because when I mount a folder using sudo I loose execution permission to the folder:
 user@computer:~$ ls -l | grep shared
 drwxrwx---   2 user domain users          0 Dec 12 16:34 shared
 user@computer:~$ sudo mount -t cifs //192.168.1.5/shared /home/user/shared -o user=user,domain=DOMAIN,uid=15002,gid=15000,rw,iocharset=utf8
 Password:
 user@computer:~$ ls -l | grep shared
 drw-rwx---+ 43 user domain users          0 Dec 22 10:34 shared
 user@computer:~$ sudo umount shared

A: There is two ways.
1) install cifs-utils (if it's not already done) and try:
# mount.cifs //your.server.name/path /mnt/yourfolder -o username=your_name,password=you_password,uid=YOURDOMAIN\\your_name

"uid" is immportant. This way works in my network.
2) Set your domain as default domain during logging and setup pam_mount.conf.xml simply like that:
<volume user="*" fstype="cifs" server="192.168.1.5" path="%(DOMAIN_USER)" mountpoint="~/folder_name">

My question is how to setup chmod for ~/folder_name in mountpoint?


text:
Q: Rails: Routing error when rendering AJAX partial I am encountering a routing error when I try to render a partial in an ajax call:
Routing Error

No route matches {:action=>"destroy", :controller=>"relationships", :user_id=>#<User id: 2, username: .....

Within my app, I have a list of followers for a user displayed on the profile page. Instead of paginating the followers, I would like to try to return the next offset of followers from the server through AJAX. My view already utilizes partials for displaying a list of these followers (limited to 5 records).
My goal is to use an AJAX call to return this partial with the next offset of records formated (I haven't implemented the functionality to return offset records yet - I'm just trying to get the ajax working first). The partials work fine when I visit the profile page in my browser (and view the first 5 records), the error occurs when I make the AJAX call.
Here is the form in the view where the ajax call originates:
<%= form_tag user_relationships_path(@user), method: :get, remote: true do %>
    <%= submit_tag 'load more...' %>
<% end %>

Here is the route:
resources :users, only: [:index, :show, :new, :create, :edit, :update, :destroy] do
  resources :relationships, only: [:create, :destroy, :index]
end

Here is my controller action (relationships#index) which responds to the request:
def index
  @user = User.find_by_username(params[:user_id])
    respond_to do |format|
      format.js { render 'load_followers' }
  end
end

The load_followers.js.erb partial:
$('ul#followers').append("<%= render 'users/following_items', users: @user.followers %>")

The users/following_items.html.erb partial:
<% users.each do |user| %>

       <%= link_to user do %>
       <%= gravatar_for user, 40 %>
       <% end %>

       <%= render 'relationships/follow', user: user %>

    <%= link_to user.username, user %>

joined <%= join_date_for user %>

<% end %>

And finally the relationships/follow.html.erb partial:
<% unless current_user?(user) %>
   <% if current_user.following? user %>

<%= link_to 'unfollow', user_relationship_path(user), method: :delete, class: "btn" %>

   <% else %>

<%= link_to 'follow', user_relationships_path(user), method: :post, class: "btn btn-primary" %>

   <% end %>
<% end %>

I have tracked down the offending code to the relationships/follow.html.erb partial. When that is removed, the ajax call works fine and the partial is appended to the end of the ul. Clearly it has to do with rails having an issue with the link_to to the relationships#destroy method - however, nothing I've tried seems to work.
Edit: Here are the results of running rake routes:
root        /                                                posts#index
            posts_test        /posts/test(.:format)                            posts#test
                submit        /submit(.:format)                                posts#new
                signup        /signup(.:format)                                users#new
                 login        /login(.:format)                                 sessions#new
                logout DELETE /logout(.:format)                                sessions#destroy
                 about        /about(.:format)                                 about#index
                search        /search(.:format)                                search#index
              sessions POST   /sessions(.:format)                              sessions#create
           new_session GET    /sessions/new(.:format)                          sessions#new
               session DELETE /sessions/:id(.:format)                          sessions#destroy
         post_comments POST   /posts/:post_id/comments(.:format)               comments#create
            post_votes POST   /posts/:post_id/votes(.:format)                  votes#create
                 posts GET    /posts(.:format)                                 posts#index
                       POST   /posts(.:format)                                 posts#create
              new_post GET    /posts/new(.:format)                             posts#new
                  post GET    /posts/:id(.:format)                             posts#show
    user_relationships GET    /users/:user_id/relationships(.:format)          relationships#index
                       POST   /users/:user_id/relationships(.:format)          relationships#create
 new_user_relationship GET    /users/:user_id/relationships/new(.:format)      relationships#new
edit_user_relationship GET    /users/:user_id/relationships/:id/edit(.:format) relationships#edit
     user_relationship GET    /users/:user_id/relationships/:id(.:format)      relationships#show
                       PUT    /users/:user_id/relationships/:id(.:format)      relationships#update
                       DELETE /users/:user_id/relationships/:id(.:format)      relationships#destroy
                 users GET    /users(.:format)                                 users#index
                       POST   /users(.:format)                                 users#create
              new_user GET    /users/new(.:format)                             users#new
             edit_user GET    /users/:id/edit(.:format)                        users#edit
                  user GET    /users/:id(.:format)                             users#show
                       PUT    /users/:id(.:format)                             users#update
                       DELETE /users/:id(.:format)                             users#destroy
            categories GET    /categories(.:format)                            categories#index
                       POST   /categories(.:format)                            categories#create
          new_category GET    /categories/new(.:format)                        categories#new
              category GET    /categories/:id(.:format)                        categories#show
                              /:category(.:format)                             posts#index

Thanks!

A: Notices your rake routes outputted this line:
DELETE /users/:user_id/relationships/:id(.:format)

This means your named route user_relationship is expecting both user and relationship IDs. Reason being, relationship is a nested resource of user.
So for instance you currently have this in your link to:
= link_to 'unfollow', user_relationship_path(user), method: :delete, class: "btn"

Instead it should be something like:
= link_to 'unfollow', user_relationship_path(user, relationship), method: :delete, class: "btn"


text:
Q: ui-router and login url return state Here is a complicated question.
I am trying to create a returnState for when a user tries to access a page that requires authorisation.
So, I created some data on the state object which looks like this:
$stateProvider.state('account', {
    url: '/account',
    templateUrl: '/app/account/index.tpl.html',
    controller: 'AccountController',
    controllerAs: 'controller',
    data: {
        requireLogin: true,
        state: 'account' // tells the page to redirect here if not logged in
    }
});

and then I have this bit of code to run on stateChangeStart:
.run(['$rootScope', '$state', 'AccountService', function ($rootScope, $state, account) {

    // On state change
    $rootScope.$on('$stateChangeStart', function (event, toState) {

        var data = toState.data; // Get our state data
        var requireLogin = typeof data === 'undefined' ? false : data.requireLogin; // Check to see if we have any data and if so, check to see if we need login rights
        var user = account.current() // Get our current user

        // If we require login rights and we are not authenticated
        if (requireLogin && !user.authenticated) {

            // Get our current state
            var state = data.state || '';

            // Stop processing
            event.preventDefault();

            // redirect to the login page and pass the state parameter
            $state.transitionTo('login', { returnState: state });
        }
    });
}]);

and then on my loginController I have this function:
self.loginUser = function () {

    // Login
    self.login = service.login(self.model);

    // If we login properly
    self.login.promise.then(function (response) {

        // If we have a return Url
        if (returnState) {

            // Go to that url
            $state.go(returnState);
        } else {

            // Otherwise, Redirect to the home page
            $state.go('home');
        }
    });
};

The example I have shown works perfectly. But now I have found I have more complicated needs.
I have another set of states:
$stateProvider.state('designer', {
    url: '/:sport/designer',
    abstract: true,
    templateUrl: '/app/designer/designer.tpl.html',
    controller: 'DesignerController',
    controllerAs: 'controller'
}).state('designer.team', {
    url: '',
    templateUrl: '/app/designer/team.tpl.html'
}).state('designer.kit', {
    url: '/kit',
    templateUrl: '/app/designer/kit.tpl.html'
}).state('designer.design', {
    url: '/design',
    templateUrl: '/app/designer/design.tpl.html'
}).state('designer.refine', {
    url: '/refine',
    templateUrl: '/app/designer/refine.tpl.html'
}).state('designer.order', {
    url: '/order',
    templateUrl: '/app/designer/order.tpl.html'
}).state('designer.save', {
    url: '/save',
    templateUrl: '/app/designer/save.tpl.html',
    data: {
        requireLogin: true
    }
});

as you can see, this state and a few children and the last state (save) requires the user to be logged in. Because states inherit the parameters of their parents I should be able to do something like:
state: 'designer.save({ sport: :sport })'

but I get an error stating:

Error: Could not resolve 'desginer.save({ sport: :sport })' from state 'login'

now I am assuming this is because :sport is not being passed as a string, but I have tried alsorts and I cannot get this to work.
Is there a better way to handle routes?
I did try using the stateChangeStart function to get the state we were moving from, but I don't seem to be able to access that.

A: First if we look at the docs we can see $state.go accepts the following arguments:

*

*absolute state name

*parameters

*options

I cannot see it mentioned anywhere that it is leagal to put parameters directly into state name. So there we have the reason for the error message. 'designer.save({ sport: :sport })' is not a correct absolute state name.

Because states inherit the parameters of their parents

That means not only that you can access them but also that they are passed automatically in certain situations:

Any parameters that are not specified will be inherited from currently
  defined parameters. This allows, for example, going to a sibling state
  that shares parameters specified in a parent state. Parameter
  inheritance only works between common ancestor states, I.e.
  transitioning to a sibling will get you the parameters for all
  parents, transitioning to a child will get you all current parameters,
  etc.

Thus you should not have to provide any parameters as long as you're in the designer state or any of it's children. If you're not, well then you need to find a way to pass the parameters as a second argument to $state.go.

A: Thanks to user2847643 for his suggestion. I actually came up with a better way of handling this.
First, I modified the login state to this:
$stateProvider.state('login', {
    url: '/account/login',
    params: {
        returnState: '',
        returnParams: {}
    },
    views: {

        // the main template will be placed here (relatively named)
        '': {
            templateUrl: 'app/account/login/index.tpl.html'
        },

        // the child views will be defined here (absolutely named)
        'register@login': {
            templateUrl: 'app/account/login/register.tpl.html',
            controller: 'RegisterController',
            controllerAs: 'controller'
        },

        // for column two, we'll define a separate controller
        'login@login': {
            templateUrl: 'app/account/login/login.tpl.html',
            controller: 'LoginController',
            controllerAs: 'controller'
        }
    }
});

As you can see, this accepts two optional parameters.
I then modified the login function to this:
self.loginUser = function () {

    // Login
    self.login = service.login(self.model);

    // If we login properly
    self.login.promise.then(function (response) {

        console.log(returnState);
        console.log(returnParams);

        // If we have a return Url
        if (returnState) {

            // Go to that url
            $state.go(returnState, returnParams);
        } else {

            // Otherwise, Redirect to the home page
            $state.go('home');
        }
    });
};

which now correctly calls the $state.go function passing the state and the parameters (or an empty object).
And I actually put my logic for handling the returnStates in the stateChangeStart binding that I showed earlier, so this now looks like this:
$rootScope.$on('$stateChangeStart', function (event, toState, toParams) {

    var data = toState.data; // Get our state data
    var requireLogin = typeof data === 'undefined' ? false : data.requireLogin; // Check to see if we have any data and if so, check to see if we need login rights
    var user = account.current() // Get our current user

    // If we require login rights and we are not authenticated
    if (requireLogin && !user.authenticated) {

        // Get our current state
        var name = toState.name;
        var params = toParams;

        // If our state is the login page (i.e. we accessed it directly)
        if (name === 'login') {

            // Set our state to the homepage
            name = 'home';
            toParams = {};
        }

        // Stop processing
        event.preventDefault();

        // redirect to the login page and pass the state parameter
        $state.transitionTo('login', { returnState: name, returnParams: params });
    }
});

And there we have it.

A: Thank you r3plica for this post. I was facing few issues and resolved it in following way. Someone can correct me, if I am wrong.

*

*You should use ui-router latest version, old does not support params. I am using 0.2.13.

*In the controller, you need to read the params as  $state.go($stateParams.returnState, $stateParams.returnParams)

*In $stateChangeStart event, you need to pass parameters fromState, fromParams as well. This is used to check if the fromState is not login, so you skip reloading login page again and again.
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams){
       // var restrictedPage = $.inArray($location.path(),['/landing', '/list','/landing/users']);
    var data = toState.data;
    if(typeof toState.data !== 'undefined' && fromState.name !== 'login'){......}
   }


text:
Q: E0277 "Sized is not implemented for the type [u8]", but my type does not have a [u8] I'm making a Node tree. Here is the code:
use std::option::Option;
use std::path;

#[derive(Debug)]
enum NodeType {
    Binding((String, String)),
    Header,
    Include(path::Path),
    Raw(String),
}

#[derive(Debug)]
pub struct Node {
    node_type: NodeType,
}

impl Node {
    fn new() -> Node {
        Node { node_type: NodeType::Header }
    }
}

When I compile this, I get the following error:
error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied in `std::path::Path`
 --> src/main.rs:8:13
  |
8 |     Include(path::Path),
  |             ^^^^^^^^^^^ within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]`
  |
  = note: `[u8]` does not have a constant size known at compile-time
  = note: required because it appears within the type `std::path::Path`
  = note: only the last field of a struct may have a dynamically sized type

I searched for this error, but it seems to refer to an type where Sized is not implemented. Oddly, the error output says that [u8] does not implement Sized, but there's not even one u8 in my code. What could it be?

A: The problem is that your NodeType enum contains a std::path::Path in its Include variant, but Path is an unsized type (because it contains a [u8] indirectly, and [u8] is unsized, hence the error you get).
To fix this, change the Include variant to contain either a &Path (if the node should borrow the path) or a PathBuf (if the node should own the path), or else change Node::new() to return Box<Node>.
Changing Include to contain a &Path requires adding a lifetime parameter to Node and to NodeType. The concrete lifetime may be static when the enum is not an Include.
The code below demonstrates how this would work. Note how there are two impl blocks for Node: the first one (impl Node<'static>) should contain all methods that don't use the lifetime parameter, while the second one (impl<'a> Node<'a>) should contain all methods that do use the lifetime parameter (that includes all methods with a self parameter).
use std::path;

#[derive(Debug)]
enum NodeType<'a> {
    Binding((String, String)),
    Header,
    Include(&'a path::Path),
    Raw(String),
}

#[derive(Debug)]
pub struct Node<'a> {
    node_type: NodeType<'a>,
}

impl Node<'static> {
    fn new() -> Node<'static> {
        Node { node_type: NodeType::Header }
    }
}

impl<'a> Node<'a> {
    fn include(path: &'a path::Path) -> Node<'a> {
        Node { node_type: NodeType::Include(path) }
    }
}


text:
Q: How to detect autofilters in excel using python? I am just wandering how to detect and turn off autofilter for worksheet in excel, using xlsxwriter, if not using other python library
I search for the documentation but could not really find one that points to detection but turning off it, I can thinking of
worksheet.autofilter("")

Does this work?
REgards

A: Maybe something like this:
Sub loop_workbooks_for_loop()

Dim i As Integer
Dim ws_num As Integer

Dim starting_ws As Worksheet
Set starting_ws = ActiveSheet
ws_num = ThisWorkbook.Worksheets.count

For i = 1 To ws_num
    ThisWorkbook.Worksheets(i).Activate
    If ActiveSheet.AutoFilterMode Then
       ActiveSheet.AutoFilterMode = False
    End If
Next

starting_ws.Activate

End Sub


text:
Q: Query database related variables in JDO I need to get some database related variables like gtid_executed, it's convenient to get this value from mysql via query statement like below:
show global variables like "gtid_executed";

the result in mysql:
mysql> show global variables like "gtid_executed";
+---------------+--------------------------------------------+
| Variable_name | Value                                      |
+---------------+--------------------------------------------+
| gtid_executed | 2270cb64-37a1-11ec-a47a-0242ac110002:1-190 |
+---------------+--------------------------------------------+
1 row in set (0.00 sec)

I want do this query from JDO likes below:
PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory("Tutorial");

PersistenceManager pm = pmf.getPersistenceManager();

String queryText = "show global variables like gtid_executed";
Query query = pm.newQuery("javax.jdo.query.SQL", queryText);
Object res = query.execute();

But this exception occured:
Exception in thread "main" javax.jdo.JDOUserException:
You have specified an SQL statement ("show global variables like gtid_executed") that doesnt start with SELECT.
This is invalid.

How can I do query like show variables *** in JDO gracefully? Or any other good methods in replace is appreciated!

A: Finally I found the workaround:

*

*First method is set datanucleus.query.sql.allowAll as true for persistence-unit properties:

<property name="datanucleus.query.sql.allowAll" value="true"/>

*

*Second method is use jdbc query:

// use native jdbc for query not begin with select
Connection conn = (Connection) pm.getDataStoreConnection().getNativeConnection();
String queryText = "show global variables like \"gtid_executed\"";
Statement statement = conn.createStatement();
ResultSet resultSet = statement.executeQuery(queryText);


text:
Q: Which option is correct
If two real polynomials $f(x)$ and $g(x)$ of degrees m ($\gt$ $1$) and n ($\gt$ $0$) respectively,satisfy
$f(x^2 + 1)$ $=$ $f(x)g(x)$
for every $x$ $\in$ $\mathbb R$,then

Which one is correct

*

*$f$ has exactly one real root $x_0$ such that $f'(x_0)\ne 0$.

*$f$ has exactly one real root $x_0$ such that $f'(x_0)$ $= 0$.

*$f$ has m distinct real roots.

*$f$ has no real root.
I tried using some examples but failed.

A: Note that if $x$ is a root of $f$, then so is $x^2 + 1$. But $|x^2 + 1| > |x|$ for all real numbers $x$. So every real root of $f$ requires the existence of another real root of higher magnitude.


text:
Q: Double Not operator I saw this line of code in a book:
!!(document.all && document.uniqueID);

Why is it necessary to use the double not operator? Do not the && operator already transform the result to a Boolean?

A: && will return the value of document.uniqueID (if document.all has any value other than '',false, null, undefined, 0, NaN) for document.all && document.uniqueID:
 for Example 45 === (true && 45) //true

From mozilla.org.
Logical AND (&&) expr1 && expr2 returns expr1 if it can be converted to false; otherwise, it returns expr2. Thus, when used with Boolean values, && returns true if both operands are true; otherwise, it returns false.
So it is necessary to use !! to convert the above expression into Boolean.


text:
Q: Nested quotes in link_to helper within js.erb file I'm trying to get this to work in my votes.js.erb file I'm using for my ajax request but it's not spitting out anything.
<% if current_user && @micropost.has_evaluation?(:votes, current_user) %>
    $("#vote<%= @micropost.id %> a").html('<%= link_to "".html_safe, vote_micropost_path(@micropost, type: "down"), :method => :post, :remote => true %>')
<% else %>
    $("#vote<%= @micropost.id %> a").html('<%= link_to "".html_safe, vote_micropost_path(@micropost, type: "up"), :method => :post, :remote => true %>')
<% end %>

It has to do with the nested quotations but I can't find the right combo.
I've been trying different things like using \ to escape the inner quotes and also " but this doesn't seem to work for me either with this this code
<% if current_user && @micropost.has_evaluation?(:votes, current_user) %>
    $("#vote<%= @micropost.id %> a").html("<%= escape_javascript(link_to ''.html_safe, vote_micropost_path(@micropost, type: 'down'), :method => :post, :remote => true %>")
<% else %>
    $("#vote<%= @micropost.id %> a").html("<%= escape_javascript(link_to ''.html_safe, vote_micropost_path(@micropost, type: 'up'), :method => :post, :remote => true %>")
<% end %>

A: Try
<% if current_user && @micropost.has_evaluation?(:votes, current_user) %>
    $("#vote<%= @micropost.id %> a").html('<%= link_to " ".html_safe, vote_micropost_path(@micropost, type: "down"), :method => :post, :remote => true %>')
<% else %>
    $("#vote<%= @micropost.id %> a").html('<%= link_to "".html_safe, vote_micropost_path(@micropost, type: "up"), :method => :post, :remote => true %>')
<% end %>

or use
    $("#vote<%= @micropost.id %> a").html('<%= link_to content_tag('i', class: 'fa fa-heart fa-3x'), vote_micropost_path(@micropost, type: "down"), :method => :post, :remote => true %>')


text:
Q: How can i access std::ostream file? I have an output file as .gcode format which is being written by std::ostream* object. I want to edit in the output file and again have to write into the std::ostream* object.
Is there any steps to be proceed further?

A: The class std::ostream doesn't handle buffering or hardware I/O. It only handles formatting and conversions. it needs to be associated with a class derived from std::streambuf in order for that output to go anywhere.
#include <iostream>
#include <sstream>
int main()
{std::ostream stream(nullptr); // useless ostream (badbit set)
stream << "Hello World"; // nothing happens (well, failbit is also set)

stream.rdbuf(std::cout.rdbuf()); // uses cout's buffer
stream << "Hello World\n"; // prints to cout

std::stringbuf str;
stream.rdbuf(&str); // uses str
stream << "Hello World"; // writes to str
std::cout << "str = '" << str.str() << "'\n";}


text:
Q: How to Connect/Query to AWS Neptune instance using HTTP POST/GET request I am trying to connect to Amazon Neptune instance by sending a HTTP Post request using Neptune END Point via Fiddler.
But ending up in timeout error.
Can Neptune instance be connected to via HTTP request using fiddler/Postman?

A: If you are seeing timeouts while connecting to the database, the first step would be to check if you have network connectivity to the endpoint.
Try: telnet endpoint port
If you have connectivity, you would see something like this:
Trying 172.217.5.110...
Connected to endpoint (172.217.5.110).
Escape character is '^]'

If this does work, then any HTTP client should be able to connect to your database. (CURL, POSTMAN etc)
If telnet does not work, then it is almost certain that you have not configured your EC2 Security Groups correctly. The gist of what you need to do is:

*

*Create a security Group (say 'ec2') and attach that to your EC2 client instance. By default, this security group should allow outbound connections to all IPs. If that is not the case, add it.

*Create a security Group (say 'db'). In Inbound rules, add a rule that allows inbound TCP connections to your database port, and source as the security group created in #1.

*Now modify your Neptune Cluster, and attach 'db' to it.

*Security Group changes propagate pretty fast, so you should be able to test this using telnet.
You may find other answers that say that you need the database and the EC2 instance to be in the same security group. That is not entirely true, it is just a special case of the steps mentioned above where instead of creating 2 security groups, you can use a single security group for both - db and the client instance. From a security and design perspective, its best if you have separate security groups for your DB and your client instances.
Once you have all the network settings correctly configured, confirm that telnet works. After that you can make HTTP requests using a client of your choice. For example:
> curl http://my-endpoint:port/status
healthy
Hope this helps.

A: Timeout Error most commonly comes from the fact you aren't on the same VPC as your Neptune instance.
Please check this by doing an hping for example:
sudo hping3 -S -p 8182 [YOUR NEPTUNE ENDPOINT]
If hping can't ping it then you aren't on the same VPC.
So, just create a EC2 instance (ON THE SAME VPC AS YOUR NEPTUNE INSTANCE) and use it as VPN, I personally use this one setup-ipsec-vpn.
If your EC2 is using Ubuntu then just do:
wget https://git.io/vpnsetup -O vpnsetup.sh && sudo sh vpnsetup.sh
Then setup the credentials you get as a result to your computer, launch the VPN connection and retry the hping part to test the connection.

A: Yes, AWS Neptune end point can be connected using postman and I am able to successfully load the TinkerPop modern graph from S3 to neptune db instance using following command.
'Content-Type: application/json' \
    http://your-neptune-endpoint:8182/loader -d '
    {
      "source" : "s3://neptune-us-east-1/tinkerpopmodern/",
      "format" : "csv",
      "accessKey" : "access-key-id",
      "secretKey" : "secret-key",
      "region" : "us-east-1",
      "failOnError" : "FALSE",
      "mode" : "NEW"
    }'


text:
Q: How to find and replace number as text? I have a column with the following content:
Column
---------
01.6221
01.6222
01.6223

I need to replace all the "01" with "10", but for some reason when I do the replace, the dot disappears.
What am I doing wrong?

A: Check the formatting of your source. (Difficult for me to be more specific because full stops behave differently with different language settings). If your source is Text it should work.
A workaround might be to replace 01 with 10. rather than with 10.


text:
Q: working with Generics to specify the sub class type? I Have below the constructor and private paramter.
private Class class;
public SomeRequest(subClass_of_SomeClass.java){
        this.class=subClass_of_above_parameter;
    }

Now the constructor should not accept any class type. It has to accept the class type which is a sub class of SomeClass.java.
How can i write a generic parameter?
private Class<SomeClass> class;

Is above declaration correct?

A: you can use something like:
private class Class<T extends SomeClass> { ... }

or
private class Class<? extends SomeClass> { ... }

(editted for the sake of correctness, in case someone would need to compile it ;))

A: Best way of doing it will be the way @Kamil explained but if you specifically want to use subclasses then Declare SomeClass as abstract or declare it as Interface.


text:
Q: history -a not working in bash Am I doing something wrong?  I think I'm following the directions in the man page, and it's just not having any effect.
[501] $ history | tail
  492  echo 3
  493  echo 4
  494  echo 5
  495  echo 6
  496  echo 7
  497  echo 8
  498  echo 9
  499  echo 10
  500  PS1='[\!] \$ '
  501  history | tail
[502] $ tail ~/.bash_history
echo 1
echo 2
echo 3
echo 4
echo 5
echo 6
echo 7
echo 8
echo 9
echo 10
[503] $ history -a
[504] $ tail ~/.bash_history
echo 1
echo 2
echo 3
echo 4
echo 5
echo 6
echo 7
echo 8
echo 9
echo 10
[505] $ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
Copyright (C) 2007 Free Software Foundation, Inc.
[506] $

Shouldn't the output of the command tail ~/.bash_history be different the second time?

A: It seems this is something Apple-specific.  (I'm using Mac OS 10.11.6 El Capitan.)
My HISTFILE value is the immediate cause:
[512] $ echo $HISTFILE
/Users/Wildcard/.bash_sessions/8BC6B122-0D74-445B-B6A0-7D4D446598CB.historynew

But since I don't set that variable, where is it being set?
Aha, it's in /etc/bashrc_Apple_Terminal.  And from the comments there, it looks like I only ran into this because I tried history -a by itself, without ever setting shopt -s histappend.  They've coded it so that if you turn on histappend, or set the HISTTIMEFORMAT variable, they skip the session resume support code.
Here's the inline documentation for that section:
# Resume Support: Save/Restore Shell State
#
# Terminal assigns each terminal session a unique identifier and
# communicates it via the TERM_SESSION_ID environment variable so that
# programs running in a terminal can save/restore application-specific
# state when quitting and restarting Terminal with Resume enabled.
#
# The following code defines a shell save/restore mechanism. Users can
# add custom state by defining a shell_session_save_user_state function
# that writes restoration commands to the session file at exit. e.g.,
# to save a variable:
#
#   shell_session_save_user_state() { echo MY_VAR="'$MY_VAR'" >> "$SHELL_SESSION_FILE"; }
#
# During shell startup the session file is executed. Old files are
# periodically deleted.
#
# The default behavior arranges to save and restore the bash command
# history independently for each restored terminal session. It also
# merges commands into the global history for new sessions. Because
# of this it is recommended that you set HISTSIZE and HISTFILESIZE to
# larger values.
#
# You may disable this behavior and share a single history by setting
# SHELL_SESSION_HISTORY to 0. There are some common user customizations
# that arrange to share new commands among running shells by
# manipulating the history at each prompt, and they typically include
# 'shopt -s histappend'; therefore, if the histappend shell option is
# enabled, per-session history is disabled by default. You may
# explicitly enable it by setting SHELL_SESSION_HISTORY to 1.
#
# The implementation of per-session command histories in combination
# with a shared global command history is incompatible with the
# HISTTIMEFORMAT variable--the timestamps are applied inconsistently
# to different parts of the history; therefore, if HISTTIMEFORMAT is
# defined, per-session history is disabled by default.
#
# Note that this uses PROMPT_COMMAND to enable per-session history
# the first time for each new session. If you customize PROMPT_COMMAND
# be sure to include the previous value. e.g.,
#
#   PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND; }your_code_here"
#
# Otherwise, the per-session history won't take effect until the first
# restore.
#
# The save/restore mechanism is disabled if the following file exists:
#
#   ~/.bash_sessions_disable


text:
Q: Retrieve actual event object that triggered a positive response to a Siddhi query In Siddhi, is it possible to retrieve the actual event that caused a positive response to a query.
For example if i have an event A that causes a condition to be satisfied, I can, via the query projection make available attributes of event A that i wish to use (as a Siddhi core event) in the ExecutionRuntime callback.
However I'd like to retrieve the actual event object that satisfied the query. Not just some/all of its attributes, as I would like to use that complete event as part of further processing. Is this possible?
If it is possible, would I also be able to get back events in the case where multiple events are required to satisfy a complex query(pattern/sequence).
thanks in advance for assistance.

A: If the query is similar to below (without select attributes / or with a select *), any event satisfies value>20 condition will be accessible from QueryCallback or StreamCallback. However, the event available within the callback would not be exactly the same input event, rather a cloned event of that input event (reason being the events will get cloned internally for expiring purposes etc..).
from inputStream[value>20]
insert into outputStream;

However, AFAIK, when it comes to pattern/sequence, getting all events that  satisfied the query is impossible.


text:
Q: Contact form 7 - change style Hi guys I need some help with Contact form 7 now all input areas are vertically in one column , is it possible to make one input area to the right side,I have attached the links to screenshots? How i could do this in Wordpress?
How it looks now: https://ibb.co/MMKnf6L
How it should looks(right side one input area): https://ibb.co/vJxJ7kk
WP code

 Your Name (required)
    [text* your-name]

 Your Email (required)
    [email* your-email]

 Subject
    [text your-subject]

 Your Message
    [textarea your-message]

[submit "Send"]

A: Yes! With some CSS magic you can get any layout you want. So even this layout can be achieved with some code. I used some flexbox code to make the structure.
More about flexbox can be found here: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox
Demo
I replaced the shortcodes with HTML to make my demo more visible. Please replace the inputs with your own CF7 shortcodes.

.prefix-form-container {
 display: flex;
}

.prefix-column {
 display: flex;
 flex-direction: column;
 padding: 10px;
}

.prefix-label {
  display: block;
}

/* demo code */
input, textarea {
 width: 100%;
}

     Your Name (required)
      <input type="text">

     Your Email (required)
      <input type="text">

     Subject
      <input type="text">

     Your Message
      <textarea></textarea>

    <button type="submit">Send form</button>


text:
Q: Nodejs TCP server manage errors I've a TCP Server running using nodejs on Debian 8.
I am having some issues with TCP port reusing due to the tcp stack of the tcp clients I have (out of my control. they have a static tcp source port).
I want to know which of this error handling is the correct one:
net.createServer(function(sock) {
    [...]
    sock.on('error', function(e) {
        console.log('Network error ' + e);
        sock.destroy()
    })}).listen(PORT, HOST);

Or
net.createServer(function(sock) {
    [...]
    sock.on('error', function(e) {
        console.log('Network error ' + e);
    })}).listen(PORT, HOST);

A: You don't have to call sock.destroy(), since it's the socket itself that encountered an error situation so it will clean up after itself (you'd call it if something else in your app has caused an error, and you want to close the socket quickly).
However, you're missing another error handler, namely one attached to the server itself. This is the one that will get called with listen() fails:
net.createServer(function(sock) {

  ...

  sock.on('error', function(e) {
    console.log('Socket error:', e);
  });

}).listen(PORT, HOST).on('error', function(e) {
  console.log('Server error:', e);
});


text:
Q: Regex to exclude certain errors from a log I am new to this so would appreciate your help on writing a regex for this.
I have a log of errors that are fine however I would like to exclude certain error types from being reported as they are known errors:
Here is an example of a good log error
12/09/2012 11:30:01 AM : [ERROR] : System.Data.SqlClient.SqlException: Invalid column name 'sys_utc_updated'.

In the same log file, I would like to exclude line of errors that have this type:
12/09/2012 12:12:01 [0] 30-Error: Invalid index command: "/search.asp".

and exclude lines of errors with this type:
12/09/2012 04:12:06 [2] 30-Error: Action failed - unencrypted communication is not allowed : "ACTION=GETSTATUS".

I tried writing this regex but I don't think I got it correct:
/(?:(?:Error)(?:ERROR)(?:[^Invalid\ index\ command]*))|(?:(?:Action\ failed\ \-\ unencrypted\ communication\ is\ not\ allowed))/im

A: From your example, a simple /30-Error/ would be sufficient. Or even /Error/ if you're matching case-sensitive.


text:
Q: discord.py команда !ping выдает одно и тоже значние я собирался создать команду которая будет выводить данные о загруженности машины с ботом(в т.ч. автон.заряд, загруженность cpu пинг и оперативной памяти.) при прописаний команды все значения постоянно одинаковы и меняются только при следующем перезапуске бота.
код команды:
async def бот(ctx: commands.Context):
     embed=discord.Embed(title="загруженность бота", color=0x0400ff)
     embed.add_field(name="автономный заряд", value=f"{percentbat}%", inline=False)
     embed.add_field(name="CPU", value=f"{CPU}%", inline=False)
     embed.add_field(name="memory", value=f"{percentmem}%", inline=False)
     embed.add_field(name="ping", value=f"{round(bot.latency * 1000)}ms", inline=False)
     await ctx.send(embed=embed)

переменные:
battery = psutil.sensors_battery()
percentbat = int(battery.percent)

CPU = psutil.cpu_percent()

mem = psutil.virtual_memory()
percentmem = int(mem.percent)

библиотеки которые я использую:
psutil
discord.py

A:
Изучай основы python, они всегда пригодятся :)

Когда ты создаешь переменную, ты присваиваешь ей значение, которое не изменяется.
Для того, чтобы исправить ошибку, изменяй содержимое переменной при каждом вызове команды.
Вот рабочий код:
async def бот(ctx: commands.Context):
     # Задаём переменные
     battery = psutil.sensors_battery()
     percentbat = int(battery.percent)
     CPU = psutil.cpu_percent()
     mem = psutil.virtual_memory()
     percentmem = int(mem.percent)

     # Создаём объект discord.Embed
     embed=discord.Embed(title="загруженность бота", color=0x0400ff)
     embed.add_field(name="автономный заряд", value=f"{percentbat}%", inline=False)
     embed.add_field(name="CPU", value=f"{CPU}%", inline=False)
     embed.add_field(name="memory", value=f"{percentmem}%", inline=False)
     embed.add_field(name="ping", value=f"{round(bot.latency * 1000)}ms", inline=False)

     # Отправляем наш embed
     await ctx.send(embed=embed)


text:
Q: What's the deal with the C:\Program Files\xerox\nwwia folder? It doesn't contain anything, can't be deleted. Seems to just hang there forever.
Does anyone here knows what its story?

A: Apparently (from this forum):

Xp has inbuilt ability to scan and OCR docs.
This ability was licenced from Xerox, despite the fact that every scanner uses it's own ocr program much better than XP built in generic hit or miss form
If you are determined to use the inbuilt XP version, if your scanner will let you, it will use the Xerox/nwwia folder as tempory holding place for the files while it processes them.
It is perfectly harmless so leave it alone.

A: According to this it's a harmless "ghost" file.

A: I read a post on ask-leo.com that basically said nobody knows why it is there, but may have something to do with "Windows Image Acquisition", and that it is the windows login process that has the directory open.  Also, it is safe.


text:
Q: IBM Worklight - windows 8 tablet run time javascript exception While running my app for Windows 8 tablet, I am getting runtime exception in jQuery lib.

Unhandled exception at line 1469, column 3 in
  ms-appx://6059b213-0a33-4d20-8429-fc91e6f329d9/www/default/js/jquery-1.9.1.js

steps taken in my project:

*

*created a new worklight project

*added the below scripts manually to default .html file (can't use script tags in Stackoverflow...):

script src="js/jquery-1.9.1.js"
  script src="js/jquery.mobile-1.3.1.js"

*commented out this line: <script>window.$ = window.jQuery = WLJQ;</script>
http://i.stack.imgur.com/BiPPy.png

http://i.stack.imgur.com/NcJPC.png

A: jQuery 1.9.1 will not work with win8. Two options here

*

*(preferred) use jQuery 1.8.x. It is enough for jQuery mobile 1.3.x

*Patch jQuery 1.9.1. Find this line
body.appendChild( container ).appendChild( div );
and replace it with
    if (typeof(MSApp) !== "undefined"){
        MSApp.execUnsafeLocalFunction(function(){
            body.appendChild( container ).appendChild( div );
        });
    } else {
        body.appendChild( container ).appendChild( div );
    }


text:
Q: difficulties with the php part of JOIN of one-to-many relational database I think I got the MySQL part of my database correct. After tons of studying, I created an InnoDB database with two tables: Venues and Events.
Each venue has a unique ID (VENUE_ID) that I indexed. Then each event has a column by the name of VENUE_LOCATION that has the ID number of the venue the event belongs to.
This is how I have the event table is set up :)

I think that's all good, now I'm having problems getting all of that data displayed using php :/
So far I've done simple stuff such as select data from a single table but I'm lost as to how I can retrieve the information from the events table, AND insert all of the corresponding information from VENUES depending on what number is in 'VENUE_LOCATION'.
And I really have searched up so many examples and tutorials but I have found nothing that exactly shows what I want to do. Any tips as to which direction I should take are greatly appreciated :)!
Thanks again
Edit:
Here's what I have now
<?php

$dbuser="nightl7_main";
$dbpass="mypw";
$dbname="nightl7_complete";  //the name of the database
$chandle = mysql_connect("localhost", $dbuser, $dbpass)
    or die("Connection Failure to Database");
mysql_select_db($dbname, $chandle) or die ($dbname . " Database not found. " . $dbuser);

$result = mysql_query("SELECT * FROM example")
or die(mysql_error());
return $result;

?>

A: SELECT e.*, v.* FROM Events e
INNER JOIN Venues v ON e.VENUE_LOCATION = v.VENUE_ID

This will select all the information of events and all the information of the venue where the event has taken place.

EDIT
This is the PHP code you could be using for starters:
<?php

$dbuser = 'nightl7_main';
$dbpass = 'mypw';
$dbname = 'nightl7_complete';  //the name of the database
$chandle = mysql_connect('localhost', $dbuser, $dbpass)
    or die('Connection Failure to Database');
mysql_select_db($dbname, $chandle) or die ($dbname . ' Database not found. ' . $dbuser);

$query = 'SELECT e.*, v.* FROM Events e '.
         'INNER JOIN Venues v ON e.VENUE_LOCATION = v.VENUE_ID';
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
    echo $row['ID'].' '.$row['VENUE_LOCATION'].' '.$row['IMAGE_URL'].'<br />'; // access any column you like here
}
?>


text:
Q: Node js: making recursive function ran sequentially/ control flow I've been learning Node for only few days now. The reason why I decided to switch to Node is that it's way faster than php, which I used to use as a server side language. Recently, I realized that using php is not that effective when it comes to sending requests and processing data in a recursive manner my previous post considering php and VK api. (By the way, I found a solution to that one)
So I rewrote my function to Node and now it doesn't work properly due to the async nature of Node.
To put it short: this function must find all the indirect connections between users of a social network and fill an array connections with data about each found indirect connection (which is also an array that contains strings of data about each chain member (i.e. name, second_name and id)).
var find_links = function(n, node1, ports,
  vk, visited, connection, connections, event_count, callback) {
  n+=1;
  if(n<2) { // I don't want to go too far with my recursion. I keep track of it
    // vk.request just send a request to api and gets a list of friends of a user with user_id: node1

    vk.request('friends.get', {'user_id' : node1, 'fields' : 'domain, first_name'}, function(_o) {
      // when we get response it may be either response or 'error' if user has deleted their account

    if('response' in _o) { // just checking if we have response

        for (var item of _o['response']['items']) {
          for (var port of ports['response']['items']) {

            if(port['id'] == item['id']) {
              data = item['first_name'] + ' ' + item['last_name'] + ' ' + item['id']; // info about user
              connection.push(data);
              connections.push(connection);
              connection.pop();
              break;
            }
            else {
              if (!visited.present(item['id'])) { // if we haven't encountered this user before
                data = item['first_name'] + ' ' + item['last_name'] + ' ' + item['id']; // info about user
                connection.push(data);
                visited.push(item['id']); // we add user_id to visited array
                // recursion
                find_links(n, item['id'], ports, vk, visited, connection, connections, event_count, console.log);
                connection.pop();
              }
            }
          }

        }
        if (n == 1) {
          callback("conn is "+connections);
        }
      }
      else {
        return 1;
      }
    });
  }
  else { // if n == 2, i check only friends of current user and return
    vk.request('friends.get', {'user_id' : node1, 'fields' : 'domain, first_name'}, function(_o) {
      if('response' in _o) {
        for(item_ of _o['response']['items']) {
          for(var arg_ of ports['response']['items']) {
            if (arg_['id'] === item_['id'] && !visited.present(item_['id'])) {
              data = item_['first_name'] + ' ' + item_['last_name'] + ' ' + item_['id'];
              connection.push(data); // add data about user to connection
              connections.push(connection);
              connection.pop();
              break;
            }
            else {
              connection.pop();
            }
          }
        }
      }
      return 1;
    })
  }
}

So, when I log connections array which must contain data about all the chains found, I get this ,,,,,,,,,,,,,,,,. Items just aren't pushed to the array, are they?
So, how can I get my code run in a loop sequentially and wait for the recursive function to finish before proceeding?
Response from VK when I request friends looks like this:
{ response:
    { count: 67,
      items:
       [ { id: 6248811,
           first_name: 'Екатерина',
           last_name: 'Федорова',
           domain: 'k.fedorova' },
         { id: 8102967,
           first_name: 'Роман',
           last_name: 'Соколинский',
           domain: 'majestyk',
           hidden: 1 },
           .....
    ]
    }
}

A: What you need is async library.
    var async = require('async');

    function myRecursiveFunc(arr, results, fcb) {
        async.eachSeries(arr,
        function(item, cb) {
            doSomethingAsync(function() {
            ...
            // modify results arr here
            ...
            // do we have a new array to process?
            if(...) {
                myRecursiveFunction(newArr, results, cb);
            }else{
                // call next iteration
                cb();
            }
            });
        },
        function(err) {
            fcb(err);
        }
        );

    }

    var results = [];
    var arr = [...];
    myRecursiveFunction(arr, results, function(err) {
        if(err) {
            console.trace(err);
        }
        console.log(results);
    });


text:
Q: Loading 50.000 items in a table creates unexpected timeline results I'm testing the performance between Elm and Polymer by using the Chrome Timeline. I have written a table in each language/library and I'm filling this with 100, 1000, 5000, 10.000 and 50.000 items. I measured the loading, scripting and rendering time.
I've come across a result in my measurements which I didn't expect.
In the images below(in the links) you can see the (Polymer) results for 10.000 and 50.000 items. For the 10.000 items a lot of rendering takes place, but for the 50.000 items there is almost no rendering and a lot of scripting... Can someone explain this to me?
10.000 items Polymer
50.000 items Polymer
In the table below the render time in ms is set out for Elm and Polymer.
╭───────╥────────────┬─────────────╮
│       ║     Elm    │   Polymer   │
╞═══════╬════════════╪═════════════╡
│ 100   ║   17,98    │    11,7     │
│ 1000  ║   92,44    │    95,32    │
│ 5000  ║   570,98   │    571,24   │
| 10.000║   1115,12  │    1138,08  │
| 50.000║   0,42     │    0,72     │
└───────╨────────────┴─────────────┘


text:
Q: Data Explorer slightly overeager to ellipt column headers The Data Explorer's results table (not to be confused with the underlying SQL tables) has default column widths that it decides on and sticks to. I don't know how they're calculated, but I'd guess it's based on the length of the header, the length of the data within, and a preset maximum. Thing is, the length-of-header bit is possibly a little off. See the following row of headers:

Original: Revision Number|Revision ID|  Event Type  |  Date  |  User Link  |Comment
Ellipted: Revision Numbe…|Revision I…|  Event Type  |  Date  |  User Link  |Commen…

The last character of some of the columns is being ellipted. Thing is, there's (AFAICT) more than enough space there to show them (presumably allocated based on their lengths). Hence the post title - the headers don't need to be ellipted, but the last character of each is being cut off anyway.
(If you want to repro, the above screenshot was taken from here.)

Okay, this is just crazy:

Original:   Review Link  |Review Type
Ellipted:   Review Link  |Review Type…

Yes, I know there's already a pull request pending to status-completed it, but I thought that was such an ...interesting example that it had to be put here for historical reference.

A: Yeah, that whole bit of code is kind of a mess...but I went ahead and made it messier, just for you.
Fixed pending a pull and redeploy (it should also now behave better when clicking the column headers to sort them, too).


text:
Q: Google Drive SDK Push Notification : differentiate file open and file change event I am working on Google Drive SDK Push Notification, I am getting push notification on my callback servlet.
Whenever i change or open file(drive file) i gets push notifications, from all this notification i am unable to fix which is File Open and File Change event.
Please help me to sort out this problem.