问:
Xcode can't find my cell identifier
I'm getting an error with my code that says...

"Terminating app due to uncaught exception
  'NSInternalInconsistencyException', reason: 'unable to dequeue a cell
  with identifier ItemCell - must register a nib or a class for the
  identifier or connect a prototype cell in a storyboard'?"

I've set the cell to ItemCell and I've run Product > Clean. It still can't find it. Can anyone see what I've done wrong? I've included a screen shot of my code and my storyboard.

```<code>import UIKit

 class ItemsViewController: UITableViewController {

  var itemStore: ItemStore!

@IBAction func addNewItem(_ sender: UIButton) {

    let newItem = itemStore.createItem()

    if let index = itemStore.allItems.index(of: newItem) {
        let indexPath = IndexPath(row: index, section: 0)

        tableView.insertRows(at: [indexPath], with: .automatic)
    }
}

@IBAction func toggleEditingMode(_ sender: UIButton) {
    if isEditing {
        sender.setTitle("Edit", for: .normal)

        setEditing(false, animated: true)
    } else {
        sender.setTitle("Done", for: .normal)

        setEditing(true, animated: true)
    }
}

override func viewDidLoad() {
    super.viewDidLoad()

    let statusBarHeight = UIApplication.shared.statusBarFrame.height

    let insets = UIEdgeInsetsMake(statusBarHeight, 0, 0, 0)
    tableView.contentInset = insets
    tableView.scrollIndicatorInsets = insets

    tableView.rowHeight = 65
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return itemStore.allItems.count
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    let cell = tableView.dequeueReusableCell(withIdentifier: "ItemCell", for: indexPath) as! ItemCell

    let item = itemStore.allItems[indexPath.row]

    cell.nameLabel.text = item.name
    cell.serialNumberLabel.text = item.serialNumber
    cell.valueLabel.text = "$\(item.valueInDollars)"

    return cell
}

override func tableView(_ tableView: UITableView,
                        commit editingStyle: UITableViewCellEditingStyle,
                        forRowAt indexPath: IndexPath) {
    if editingStyle == .delete {
        let item = itemStore.allItems[indexPath.row]

        let title = "Delete \(item.name)"
        let message = "You sure ya wanna delete this?"

        let ac = UIAlertController(title: title,
                                   message: message,
                                   preferredStyle: .actionSheet)

        let cancelAction  = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
        ac.addAction(cancelAction)

        let deleteAction = UIAlertAction(title: "Delete", style: .destructive, handler: { (action) -> Void in

        self.itemStore.removeItem(item)

        self.tableView.deleteRows(at: [indexPath], with: .automatic)
    })
        ac.addAction(deleteAction)
        present(ac, animated: true, completion: nil)
    }

}
override func tableView(_ tableView: UITableView,
                        moveRowAt sourceIndexPath: IndexPath,
                        to destinationIndexPath: IndexPath) {
    itemStore.moveItem(from: sourceIndexPath.row, to: destinationIndexPath.row)
}
</code>```

This is my ItemCell

```<code> import UIKit

 class ItemCell: UITableViewCell {

@IBOutlet var nameLabel: UILabel!
@IBOutlet var serialNumberLabel: UILabel!
@IBOutlet var valueLabel: UILabel!

   }
</code>```

And my ItemStore

```<code>  import UIKit

  class ItemStore {

  var allItems = [Item] ()

@discardableResult func createItem() -> Item {
    let newItem = Item(random: true)

    allItems.append(newItem)

    return newItem
}

func removeItem(_ item: Item) {
    if let index = allItems.index(of: item) {
        allItems.remove(at: index)
    }
}

func moveItem(from fromIndex: Int, to toIndex: Int) {
    if fromIndex == toIndex {
        return
    }

    let movedItem = allItems[fromIndex]

    allItems.remove(at: fromIndex)

    allItems.insert(movedItem, at: toIndex)
}

 }
</code>```

答:
You have to check your custom class name in storyboard as  ItemCell.swift  as your class name.

```<code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        // create a new cell if needed or reuse an old one
        let cell:ItemCell = tableView.dequeueReusableCell(withIdentifier: "ItemCell") as! ItemCell

        let item = itemStore.allItems[indexPath.row]

        cell.nameLabel.text = item.name
        cell.serialNumberLabel.text = item.serialNumber
        cell.valueLabel.text = "$\(item.valueInDollars)"

        return cell
    }
</code>```

Title: Xcode can't find my cell identifier

Body:
I'm getting an error with my code that says...

"Terminating app due to uncaught exception
  'NSInternalInconsistencyException', reason: 'unable to dequeue a cell
  with identifier ItemCell - must register a nib or a class for the
  identifier or connect a prototype cell in a storyboard'?"

I've set the cell to ItemCell and I've run Product > Clean. It still can't find it. Can anyone see what I've done wrong? I've included a screen shot of my code and my storyboard.

import UIKit

 class ItemsViewController: UITableViewController {

  var itemStore: ItemStore!

@IBAction func addNewItem(_ sender: UIButton) {

    let newItem = itemStore.createItem()

    if let index = itemStore.allItems.index(of: newItem) {
        let indexPath = IndexPath(row: index, section: 0)

        tableView.insertRows(at: [indexPath], with: .automatic)
    }
}

@IBAction func toggleEditingMode(_ sender: UIButton) {
    if isEditing {
        sender.setTitle("Edit", for: .normal)

        setEditing(false, animated: true)
    } else {
        sender.setTitle("Done", for: .normal)

        setEditing(true, animated: true)
    }
}

override func viewDidLoad() {
    super.viewDidLoad()

    let statusBarHeight = UIApplication.shared.statusBarFrame.height

    let insets = UIEdgeInsetsMake(statusBarHeight, 0, 0, 0)
    tableView.contentInset = insets
    tableView.scrollIndicatorInsets = insets

    tableView.rowHeight = 65
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return itemStore.allItems.count
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    let cell = tableView.dequeueReusableCell(withIdentifier: "ItemCell", for: indexPath) as! ItemCell

    let item = itemStore.allItems[indexPath.row]

    cell.nameLabel.text = item.name
    cell.serialNumberLabel.text = item.serialNumber
    cell.valueLabel.text = "$\(item.valueInDollars)"

    return cell
}

override func tableView(_ tableView: UITableView,
                        commit editingStyle: UITableViewCellEditingStyle,
                        forRowAt indexPath: IndexPath) {
    if editingStyle == .delete {
        let item = itemStore.allItems[indexPath.row]

        let title = "Delete \(item.name)"
        let message = "You sure ya wanna delete this?"

        let ac = UIAlertController(title: title,
                                   message: message,
                                   preferredStyle: .actionSheet)

        let cancelAction  = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
        ac.addAction(cancelAction)

        let deleteAction = UIAlertAction(title: "Delete", style: .destructive, handler: { (action) -> Void in

        self.itemStore.removeItem(item)

        self.tableView.deleteRows(at: [indexPath], with: .automatic)
    })
        ac.addAction(deleteAction)
        present(ac, animated: true, completion: nil)
    }

}
override func tableView(_ tableView: UITableView,
                        moveRowAt sourceIndexPath: IndexPath,
                        to destinationIndexPath: IndexPath) {
    itemStore.moveItem(from: sourceIndexPath.row, to: destinationIndexPath.row)
}

This is my ItemCell

 import UIKit

 class ItemCell: UITableViewCell {

@IBOutlet var nameLabel: UILabel!
@IBOutlet var serialNumberLabel: UILabel!
@IBOutlet var valueLabel: UILabel!

   }

And my ItemStore

  import UIKit

  class ItemStore {

  var allItems = [Item] ()

@discardableResult func createItem() -> Item {
    let newItem = Item(random: true)

    allItems.append(newItem)

    return newItem
}

func removeItem(_ item: Item) {
    if let index = allItems.index(of: item) {
        allItems.remove(at: index)
    }
}

func moveItem(from fromIndex: Int, to toIndex: Int) {
    if fromIndex == toIndex {
        return
    }

    let movedItem = allItems[fromIndex]

    allItems.remove(at: fromIndex)

    allItems.insert(movedItem, at: toIndex)
}

 }

Body:
You have to check your custom class name in storyboard as  ItemCell.swift  as your class name.

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        // create a new cell if needed or reuse an old one
        let cell:ItemCell = tableView.dequeueReusableCell(withIdentifier: "ItemCell") as! ItemCell

        let item = itemStore.allItems[indexPath.row]

        cell.nameLabel.text = item.name
        cell.serialNumberLabel.text = item.serialNumber
        cell.valueLabel.text = "$\(item.valueInDollars)"

        return cell
    }


来源: stackexchange

问:
can I create a secondary set of categories for each product?
I have PrestaShop 1.7.1.2 installed and I'm trying to create a 2nd set of categories to be used in a car accessories shop.

for example.. some of my main categories include speakers, wheel covers and multimedia systems but I also want each product to contain a secondary category that includes the car company -> brand -> year -> doors count.

so each customer will have all the main categories shown on the front page, but will also have a component to enter his car type and to get the relevant products specific to his car.

so in general I want each product to have two defined categories.. one main (for example speakers) and one secondary (for example AUDI ,A1 ,2010-2016, 3 doors.

how can I implement such a thing ? I'm a good programmer, if needed I'll write a relevant plugin if none can suite my needs.

any information regarding the issue would be greatly appreciated.

答:
This is nested categories, which is actually already implemented in Prestashop. You don't have to code anything specificly.

To show main categories you can use this method :

```<code>Category::getCategories($idLang = false, $active = true, $order = true, $sqlFilter = '', $orderBy = '', $limit = '');
</code>```

Or the category three :

```<code>Category::getNestedCategories( $idRootCategory = null,
    $idLang = false,
    $active = true,
    $groups = null,
    $useShopRestriction = true,
    $sqlFilter = '',
    $orderBy = '',
    $limit = ''
);
</code>```

If you need to show only for one product you can also use :

```<code>Product::getProductCategories($id_product = '');
</code>```

If you need anything, just look at classes directory, there is everything inside.

ContentLicense: CC BY-SA 3.0

Body:
This is nested categories, which is actually already implemented in Prestashop. You don't have to code anything specificly.

To show main categories you can use this method :

Category::getCategories($idLang = false, $active = true, $order = true, $sqlFilter = '', $orderBy = '', $limit = '');

Or the category three :

Category::getNestedCategories( $idRootCategory = null,
    $idLang = false,
    $active = true,
    $groups = null,
    $useShopRestriction = true,
    $sqlFilter = '',
    $orderBy = '',
    $limit = ''
);

If you need to show only for one product you can also use :

Product::getProductCategories($id_product = '');

If you need anything, just look at classes directory, there is everything inside.


问:
Swift - performance wise - comparing two arrays and get the difference in each and common in both
Hope you are having a great day.

I'm trying to understand what is the fastest approach to do the following:

Assuming I have these two Arrays:

```<code>var firstArray = ["a","b","c"]
var secondArray = ["a","d","e"]
</code>```

I'd like to get as an output:

1)Array of objects that inside firstArray but no in secondArray .

1)Array of objects that inside secondArray but no in firstArray .

3)Array of the common objects between firstArray and secondArray.

So basically the output would be:

1) ["b","c"]

2) ["d","e"]

3) ["a"]

The main issue here is to understand what is the most efficient way to do so. Thank you very much!

答:
I will assume that the elements of your arrays are Equatable.

If they are also Hashable, and if the order of the elements is not important for you, and if (as in your example), all elements are unique, you might want to consider using set algebra rather than the an ordered collection type such as Array. E.g. using Set in Swift allows you to use the subtract(_:) or subtracting(_:) mutating/non-methods for 1) and 2), and intersection(_:)/formIntersection(_:) for 3), which all use O(1) (amortized) lookup for comparing elements between the sets (as compared to e.g. using O(n) contains(_:) of Array (with Equatable elements) to lookup existance of some specified element).

For additional details, see the language reference for Set as well as the thread linked to by vadian:

Set operations (union, intersection) on Swift array?

If the elements in each array is not unique, and you want to keep multiples as well as the order between the elements, you could use the Set representation of one of the arrays while filtering the other one.

E.g., for:

```<code>var firstArray = ["a","b","c"]
var secondArray = ["a","d","e"]
</code>```

A) in O(n):

```<code>let excludeElements = Set(secondArray)        // O(n)
secondArray = secondArray
    .filter { !excludeElements.contains($0) } // O(n) due to O(1) (amortized) .contains lookup
</code>```

B) in O(n):

```<code>let excludeElements = Set(firstArray)         // O(n)
secondArray = secondArray
    .filter { !excludeElements.contains($0) } // O(n) due to O(1) (amortized) .contains lookup
</code>```

C) in O(n), using order and duplicates as they occur in firstArray:

```<code>let includeElements = Set(secondArray)  // O(n)
let commonElements = firstArray
    .filter(includeElements.contains)   // O(n) due to O(1) (amortized) .contains lookup
</code>```

C) in O(n), using order and duplicates as they occur in secondArray:

```<code>let includeElements = Set(firstArray) // O(n)
let commonElements = secondArray
    .filter(includeElements.contains) // O(n) due to O(1) (amortized) .contains lookup
</code>```

Performance?

The above only looks at asymptotic time complexity, and doesn't take into account any actual benchmarking. Generally the functional methods such as filter are slower than just a for or while loop, so if performance becomes an issue for your app, you should consider, at that point, performing profiling as well as custom bench-marking possible bottlenecks in your algorithms.

Also, if your arrays are known to be sorted, there are more efficient ways to traverse them and filter out the result. See e.g. the following thread (C language, but the logic is the important part):

Finding common elements in two arrays of different size

Body:
Hope you are having a great day.

I'm trying to understand what is the fastest approach to do the following:

Assuming I have these two Arrays:

var firstArray = ["a","b","c"]
var secondArray = ["a","d","e"]

I'd like to get as an output:

1)Array of objects that inside firstArray but no in secondArray .

1)Array of objects that inside secondArray but no in firstArray .

3)Array of the common objects between firstArray and secondArray.

So basically the output would be:

1) ["b","c"]

2) ["d","e"]

3) ["a"]

The main issue here is to understand what is the most efficient way to do so. Thank you very much!

Body:
I will assume that the elements of your arrays are Equatable.

If they are also Hashable, and if the order of the elements is not important for you, and if (as in your example), all elements are unique, you might want to consider using set algebra rather than the an ordered collection type such as Array. E.g. using Set in Swift allows you to use the subtract(_:) or subtracting(_:) mutating/non-methods for 1) and 2), and intersection(_:)/formIntersection(_:) for 3), which all use O(1) (amortized) lookup for comparing elements between the sets (as compared to e.g. using O(n) contains(_:) of Array (with Equatable elements) to lookup existance of some specified element).

For additional details, see the language reference for Set as well as the thread linked to by vadian:

Set operations (union, intersection) on Swift array?

If the elements in each array is not unique, and you want to keep multiples as well as the order between the elements, you could use the Set representation of one of the arrays while filtering the other one.

E.g., for:

var firstArray = ["a","b","c"]
var secondArray = ["a","d","e"]

A) in O(n):

let excludeElements = Set(secondArray)        // O(n)
secondArray = secondArray
    .filter { !excludeElements.contains($0) } // O(n) due to O(1) (amortized) .contains lookup

B) in O(n):

let excludeElements = Set(firstArray)         // O(n)
secondArray = secondArray
    .filter { !excludeElements.contains($0) } // O(n) due to O(1) (amortized) .contains lookup

C) in O(n), using order and duplicates as they occur in firstArray:

let includeElements = Set(secondArray)  // O(n)
let commonElements = firstArray
    .filter(includeElements.contains)   // O(n) due to O(1) (amortized) .contains lookup

C) in O(n), using order and duplicates as they occur in secondArray:

let includeElements = Set(firstArray) // O(n)
let commonElements = secondArray
    .filter(includeElements.contains) // O(n) due to O(1) (amortized) .contains lookup

Performance?

The above only looks at asymptotic time complexity, and doesn't take into account any actual benchmarking. Generally the functional methods such as filter are slower than just a for or while loop, so if performance becomes an issue for your app, you should consider, at that point, performing profiling as well as custom bench-marking possible bottlenecks in your algorithms.

Also, if your arrays are known to be sorted, there are more efficient ways to traverse them and filter out the result. See e.g. the following thread (C language, but the logic is the important part):

Finding common elements in two arrays of different size


问:
gridview to sql server database
is there any way to insert in bulk (i mean all gridview rows) to sql server database in single submit. its an ASP.Net app and I also want to validate data.</p>

答:
In oracle we have batch insert for example

your query returns two rows with column name as a,b,c

```<code>a:b:c
1:2:3
4:5:5
</code>```

you can use

```<code>insert into tab_name(a,b,c)(qry)
commit;
</code>```

Make it dynamic and it should work.

ContentLicense: CC BY-SA 2.5

Title: gridview to sql server database

Body:
In oracle we have batch insert for example

your query returns two rows with column name as a,b,c

a:b:c
1:2:3
4:5:5

you can use

insert into tab_name(a,b,c)(qry)
commit;

Make it dynamic and it should work.


问:
Uncaught SyntaxError: Unexpected token - Error in Some Browsers
I have a problem with following codes. There is not any problem with Chrome, Firefox and Opera. But it shows nothing on Maxthon Browser, some mobile and TV  browsers. I have this error in console of Maxthon Browser : Uncaught SyntaxError: Unexpected token =

My codes are here :

```<code>                                    <div class="SerieSeaons">
                                    <div class="seasons-link filters-button-group">
                                        <?php $s= 1; foreach ($seasons as $season) {
                                            ?>
                                            <a class="seasonlink <?php if($s == 1) { echo 'active'; } else { echo 'notloaded'; }?>" href="JavaScript:void(0);"
                                               data-filter=".<?php echo $season->slug; ?>"><?php echo $season->name; ?></a>
                                            <?php $s++; } ?>
                                    </div>
                                    <div class="el-item title sort-by-button-group button-group">
                                        <div class="sortitem status" data-sort-value="status">Watched</div>
                                        <div class="season-name">Season</div>
                                        <div class="sortitem episode-name hidden-xs" data-sort-value="episodename">Episode</div>
                                        <div class="sortitem e-name" data-sort-value="ename">Episode Name</div>
                                        <div class="sortitem date hidden-xs" data-sort-value="date">Air Date</div>
                                    </div>
                                    <div class="psscroll" style="height:100%">
                                        <div class="all-seriespart">
                                            <div class="asisotope" id="rp_<?php echo esc_attr($rp_id); ?>"></div>
                                        </div>
                                    </div>
                                </div>
</code>```

JavaScript :

```<code>jQuery.noConflict();
                                        jQuery(document).ready(function ($) {
                                            "use strict";
                                            var open_category = ".<?php echo $seasons[0]->slug;?>";
                                            function get_blog_posts(this_obj = "<?php echo $seasons[0]->slug;?>") {
                                                $.ajax({
                                                    type: "POST",
                                                    url: mixajaxurl,
                                                    data: "action=get_series_episodes&category="+ this_obj,
                                                    success: function (result) {
                                                        var $newItems = $(result);
                                                        $("#rp_<?php echo esc_js($rp_id); ?>").isotope('insert', $newItems, function () {
                                                            $("#rp_<?php echo esc_js($rp_id); ?>").ready(function () {
                                                                $("#rp_<?php echo esc_js($rp_id); ?>").isotope('layout');
                                                            });
                                                            $("#rp_<?php echo esc_js($rp_id); ?>").isotope('layout');
                                                            $("#rp_<?php echo esc_js($rp_id); ?>").isotope({
                                                                getSortData: {
                                                                    status: '[data-watched]',
                                                                    episodename: function( itemElem ) {
                                                                        var weight = jQuery( itemElem ).find('.dataepisode').text();
                                                                        return parseFloat( weight.replace( /[\(\)]/g, '') );
                                                                    },
                                                                    ename: '.e-name',
                                                                    date: '.date'
                                                                }
                                                            });
                                                            $(window).trigger('resize');
                                                        });
                                                        $("#rp_<?php echo esc_js($rp_id); ?>").removeClass('loading');

                                                    }
                                                });
                                            }
                                            function watch_alls(cat_slug = "<?php echo $seasons[0]->slug;?>") {
                                                $.ajax({
                                                    type: "POST",
                                                    url: mixajaxurl,
                                                    data: "action=watch_to_all&category="+ cat_slug,
                                                    success: function (result) {
                                                        $('.watchallwrap').html(result)
                                                    }
                                                });
                                            }
                                            var filterFns = {
                                                ium: function () {
                                                    var name = jQuery(this).find('.name').text();
                                                    return name.match(/iumjQuery/);
                                                }
                                            };
                                            $(".seasons-link").on("click",".notloaded", function(){
                                                $("#rp_<?php echo esc_js($rp_id); ?>").addClass('loading');
                                                open_category = $(this).data('filter');
                                                get_blog_posts(open_category);
                                                watch_alls(open_category);
                                                $(window).trigger('resize');
                                                var filterValue = jQuery(this).attr('data-filter');
                                                filterValue = filterFns[filterValue] || filterValue;
                                                $('.asisotope').isotope({
                                                    itemSelector: '.ajax_post',
                                                    layoutMode: 'fitRows',
                                                    filter: filterValue
                                                });
                                                jQuery(this).removeClass('notloaded');
                                                return false;
                                            });

                                            jQuery('.seasons-link').each(function (i, buttonGroup) {
                                                var jQuerybuttonGroup = jQuery(buttonGroup);
                                                jQuerybuttonGroup.on('click', 'a', function () {
                                                    jQuerybuttonGroup.find('.active').removeClass('active');
                                                    $(this).addClass('active');
                                                    $('.psscroll').scrollTop(0);
                                                    $('.psscroll').perfectScrollbar('update');
                                                });

                                            });

                                            $(window).load(function () {
                                                $("#rp_<?php echo esc_js($rp_id); ?>").addClass('loading');
                                                get_blog_posts();
                                                watch_alls("<?php echo $seasons[0]->slug;?>");
                                                $('.asisotope').isotope({
                                                    itemSelector: '.ajax_post',
                                                    layoutMode: 'fitRows'
                                                });

                                                function watchblog() {
                                                    $(".asisotope").isotope({
                                                        itemSelector: '.ajax_post',
                                                        layoutMode: 'fitRows'
                                                    });
                                                }
                                                setInterval(watchblog, 100);
                                            });
                                        });
</code>```

答:
You're using ES6 default function parameters, something that only very recent browsers support.

Either you don't use these language features or set up something like Babel to transpile the code into compatible code.

This is your code with default parameters

```<code>function multiply(a, b = 1) {
    return a * b;
}
</code>```

this will work in older browsers as well

```<code>function multiply(a, b) {
    b = (typeof b !== 'undefined') ?  b : 1;
    return a * b;
}
</code>```

Body:
I have a problem with following codes. There is not any problem with Chrome, Firefox and Opera. But it shows nothing on Maxthon Browser, some mobile and TV  browsers. I have this error in console of Maxthon Browser : Uncaught SyntaxError: Unexpected token =

My codes are here :

                                        <?php $s= 1; foreach ($seasons as $season) {
                                            ?>
                                            <a class="seasonlink <?php if($s == 1) { echo 'active'; } else { echo 'notloaded'; }?>" href="JavaScript:void(0);"
                                               data-filter=".<?php echo $season->slug; ?>"><?php echo $season->name; ?>
                                            <?php $s++; } ?>

Watched

Season

Episode

Episode Name

Air Date

                                            <div class="asisotope" id="rp_<?php echo esc_attr($rp_id); ?>">

JavaScript :

jQuery.noConflict();
                                        jQuery(document).ready(function ($) {
                                            "use strict";
                                            var open_category = ".<?php echo $seasons[0]->slug;?>";
                                            function get_blog_posts(this_obj = "<?php echo $seasons[0]->slug;?>") {
                                                $.ajax({
                                                    type: "POST",
                                                    url: mixajaxurl,
                                                    data: "action=get_series_episodes&category="+ this_obj,
                                                    success: function (result) {
                                                        var $newItems = $(result);
                                                        $("#rp_<?php echo esc_js($rp_id); ?>").isotope('insert', $newItems, function () {
                                                            $("#rp_<?php echo esc_js($rp_id); ?>").ready(function () {
                                                                $("#rp_<?php echo esc_js($rp_id); ?>").isotope('layout');
                                                            });
                                                            $("#rp_<?php echo esc_js($rp_id); ?>").isotope('layout');
                                                            $("#rp_<?php echo esc_js($rp_id); ?>").isotope({
                                                                getSortData: {
                                                                    status: '[data-watched]',
                                                                    episodename: function( itemElem ) {
                                                                        var weight = jQuery( itemElem ).find('.dataepisode').text();
                                                                        return parseFloat( weight.replace( /[\(\)]/g, '') );
                                                                    },
                                                                    ename: '.e-name',
                                                                    date: '.date'
                                                                }
                                                            });
                                                            $(window).trigger('resize');
                                                        });
                                                        $("#rp_<?php echo esc_js($rp_id); ?>").removeClass('loading');

                                                    }
                                                });
                                            }
                                            function watch_alls(cat_slug = "<?php echo $seasons[0]->slug;?>") {
                                                $.ajax({
                                                    type: "POST",
                                                    url: mixajaxurl,
                                                    data: "action=watch_to_all&category="+ cat_slug,
                                                    success: function (result) {
                                                        $('.watchallwrap').html(result)
                                                    }
                                                });
                                            }
                                            var filterFns = {
                                                ium: function () {
                                                    var name = jQuery(this).find('.name').text();
                                                    return name.match(/iumjQuery/);
                                                }
                                            };
                                            $(".seasons-link").on("click",".notloaded", function(){
                                                $("#rp_<?php echo esc_js($rp_id); ?>").addClass('loading');
                                                open_category = $(this).data('filter');
                                                get_blog_posts(open_category);
                                                watch_alls(open_category);
                                                $(window).trigger('resize');
                                                var filterValue = jQuery(this).attr('data-filter');
                                                filterValue = filterFns[filterValue] || filterValue;
                                                $('.asisotope').isotope({
                                                    itemSelector: '.ajax_post',
                                                    layoutMode: 'fitRows',
                                                    filter: filterValue
                                                });
                                                jQuery(this).removeClass('notloaded');
                                                return false;
                                            });

                                            jQuery('.seasons-link').each(function (i, buttonGroup) {
                                                var jQuerybuttonGroup = jQuery(buttonGroup);
                                                jQuerybuttonGroup.on('click', 'a', function () {
                                                    jQuerybuttonGroup.find('.active').removeClass('active');
                                                    $(this).addClass('active');
                                                    $('.psscroll').scrollTop(0);
                                                    $('.psscroll').perfectScrollbar('update');
                                                });

                                            });

                                            $(window).load(function () {
                                                $("#rp_<?php echo esc_js($rp_id); ?>").addClass('loading');
                                                get_blog_posts();
                                                watch_alls("<?php echo $seasons[0]->slug;?>");
                                                $('.asisotope').isotope({
                                                    itemSelector: '.ajax_post',
                                                    layoutMode: 'fitRows'
                                                });

                                                function watchblog() {
                                                    $(".asisotope").isotope({
                                                        itemSelector: '.ajax_post',
                                                        layoutMode: 'fitRows'
                                                    });
                                                }
                                                setInterval(watchblog, 100);
                                            });
                                        });

Body:
You're using ES6 default function parameters, something that only very recent browsers support.

Either you don't use these language features or set up something like Babel to transpile the code into compatible code.

This is your code with default parameters

function multiply(a, b = 1) {
    return a * b;
}

this will work in older browsers as well

function multiply(a, b) {
    b = (typeof b !== 'undefined') ?  b : 1;
    return a * b;
}


问:
Which prog language to use for a server/android app projects?
I am thinking of doing a server that will be some sort of a webpage (to display data) and also a server that can send information to android app.

I currently know a bit of c++ and python. And android java a bit more. I was allready looking at java and tomcat but not liking the idea...

What are the best metods to make a server that will be able to send data to mobile app.. I dont need to communicate both ways only that android app becomes information.

EDIT
Sory I wasn't clear enough. A server needs to acces services and get data from the APIs and then it will save it in db. But the part where this server needs to communicate with android app is unclear for me.

答:
If you only need to host a website that displays data, without the need for server processing / database, you might want to take a look at GitHub Pages. You will be able to host static web pages for free.

Else, I would recommend you to learn PHP. Purchase a web domain and hosting, it usually comes with database for you to store data.


问:
View doesn't return anything in Laravel
I just started to learn the laravel framework and have a strange situation here.

First of all in my web.php I have code like:

```<code><?php
Route::get('/', function () {
    return view('welcome');
});

Route::get('users', ['uses' => 'UsersController@index']);
</code>```

In my UsersController.php file I have code like:

```<code><?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class UsersController extends Controller
{
    public function index(){
        return view('users.index');
    }
}
</code>```

I have a file named index.blade.php in directory views/users that has the same content as the default welcome.blade.php. But when I try to return view('users.index'); there is no result (no error, or text) but when I try to return view('welcome'); it works just fine.

The directory and the file truly exists.
I'm using Macbook Pro.

welcome.blade.php and the /users/index.blade.php content (default welcome page):

```<code><!doctype html>
<html lang="{{ config('app.locale') }}">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Laravel</title>

        <!-- Fonts -->
        <link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">

        <!-- Styles -->
        <style>
            html, body {
                background-color: #fff;
                color: #636b6f;
                font-family: 'Raleway', sans-serif;
                font-weight: 100;
                height: 100vh;
                margin: 0;
            }

            .full-height {
                height: 100vh;
            }

            .flex-center {
                align-items: center;
                display: flex;
                justify-content: center;
            }

            .position-ref {
                position: relative;
            }

            .top-right {
                position: absolute;
                right: 10px;
                top: 18px;
            }

            .content {
                text-align: center;
            }

            .title {
                font-size: 84px;
            }

            .links > a {
                color: #636b6f;
                padding: 0 25px;
                font-size: 12px;
                font-weight: 600;
                letter-spacing: .1rem;
                text-decoration: none;
                text-transform: uppercase;
            }

            .m-b-md {
                margin-bottom: 30px;
            }
        </style>
    </head>
    <body>
        <div class="flex-center position-ref full-height">
            @if (Route::has('login'))
                <div class="top-right links">
                    @if (Auth::check())
                        <a href="{{ url('/home') }}">Home</a>
                    @else
                        <a href="{{ url('/login') }}">Login</a>
                        <a href="{{ url('/register') }}">Register</a>
                    @endif
                </div>
            @endif

            <div class="content">
                <div class="title m-b-md">
                    Laravel
                </div>

                <div class="links">
                    <a href="https://laravel.com/docs">Documentation</a>
                    <a href="https://laracasts.com">Laracasts</a>
                    <a href="https://laravel-news.com">News</a>
                    <a href="https://forge.laravel.com">Forge</a>
                    <a href="https://github.com/laravel/laravel">GitHub</a>
                </div>
            </div>
        </div>
    </body>
</html>
</code>```

答:
if your laravel version is 5.1+

try this:

```<code>Route::get('users', 'UsersController@index');
</code>```

if it doesn't help you :

you could test step by step

step 1 :
replace route :

```<code>Route::get('users', function () {
    return 'Is OK';
});
</code>```

and run url : localhost:port/users

if Is ok

Step 2:

```<code>Route::get('users', 'UsersController@index');
</code>```

and replace UserController index method :

```<code>public function index()
{
    return 'Is OK';
}
</code>```

if Is ok go to step3:

create test.blade.php file in resources/views with content:

```<code>Is ok
</code>```

and replace controller code with:

```<code>public function index()
{
    return view('test');
}
</code>```

It will help you to find where is problem

Title: View doesn't return anything in Laravel

Body:
I just started to learn the laravel framework and have a strange situation here.

First of all in my web.php I have code like:

<?php
Route::get('/', function () {
    return view('welcome');
});

Route::get('users', ['uses' => 'UsersController@index']);

In my UsersController.php file I have code like:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class UsersController extends Controller
{
    public function index(){
        return view('users.index');
    }
}

I have a file named index.blade.php in directory views/users that has the same content as the default welcome.blade.php. But when I try to return view('users.index'); there is no result (no error, or text) but when I try to return view('welcome'); it works just fine.

The directory and the file truly exists.
I'm using Macbook Pro.

welcome.blade.php and the /users/index.blade.php content (default welcome page):

<!doctype html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Laravel</title>

        <link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">

            @if (Route::has('login'))

                    @if (Auth::check())
                        Home
                    @else
                        Login
                        Register
                    @endif

            @endif

                    Laravel

                    Documentation
                    Laracasts
                    News
                    Forge
                    GitHub

Body:
if your laravel version is 5.1+

try this:

Route::get('users', 'UsersController@index');

if it doesn't help you :

you could test step by step

step 1 :
replace route :

Route::get('users', function () {
    return 'Is OK';
});

and run url : localhost:port/users

if Is ok

Step 2:

Route::get('users', 'UsersController@index');

and replace UserController index method :

public function index()
{
    return 'Is OK';
}

if Is ok go to step3:

create test.blade.php file in resources/views with content:

Is ok

and replace controller code with:

public function index()
{
    return view('test');
}

It will help you to find where is problem


问:
How can I be sure that a very large zip file is finished compressing?
I am writing a VBScript to try to compress multiple directories in different locations into the same Zip file.

The current solution I am using is to iterate over the directories I want to compress (of which there are currently 2), get the file objects and use the copyHere method to copy the source folder into a zip file with the proper header format.

That part seems to be working okay, the difficulty I am having is with the error checking. The only two solutions I have found online are to get the count of objects in the source and target directories and sleep until they are the same, or to check if the zip file is open for appending and sleep until it is.

The first option is easy with one directory but becomes much more tedious with multiple folders, not to mention that Windows will likely create an object in the target directory before it has finished copying and I am compressing files potentially over 10 GB so that solution won't work.

I had tried to implement the second solution but every time the loop got to the second call to CopyHere it would tell me that the zip file was corrupted from the first iteration. Is it not possible to compress very large files to a zip with VBScript?

Any other suggestions as to how I can error check that the compressing is done using VBScript would be very helpful.

答:
Here is a Function Create_WinRar_Archive(Source,Target_Archive,Password) to compress a folder with rar.exe command line of Winrar.
We can call this function by two ways :

If you want create an archive without password, so we called it by this way :

Call Create_WinRar_Archive(Source,Target_Archive,"")

or if you want to set to this archive a password just we called it as :

Call Create_WinRar_Archive(Source,Target_Archive,Password)

And here is an example to compress the Pictures folder

```<code>Option Explicit
Dim ws,Source,Target_Archive,Password
Set ws = CreateObject("Wscript.Shell")
Source = ws.ExpandEnvironmentStrings("%userprofile%\pictures")
Target_Archive = "C:\BackupImages.rar"
Password = "123456"
Call Create_WinRar_Archive(Source,Target_Archive,Password)
Wscript.echo "All files are archived successfully !"
ws.run "Explorer " & Target_Archive
'******************************************************************************************************
Function Create_WinRar_Archive(Source,Target_Archive,Password)
'This function executes the command line
'version of WinRAR and reports whether
'the archive exists after WinRar exits.
'If it exists then it returns true. If
'not it returns an error message.
'------------------------------------------------------------------------------------
    Dim oFSO,oShell,aScriptFilename,sScriptFilename
    Dim sWorkingDirectory,ProgramFiles,sWinRarLocation
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Set oShell = CreateObject("Wscript.Shell")
'--------Find Working Directory--------
    aScriptFilename = Split(Wscript.ScriptFullName, "\")
    sScriptFilename = aScriptFileName(Ubound(aScriptFilename))
    sWorkingDirectory = Replace(Wscript.ScriptFullName, sScriptFilename, "")
'-------Ensure we can find Winrar.exe------
 If oFSO.FileExists(sWorkingDirectory & " " & "Winrar.EXE") Then
    sWinRarLocation = ""
    ElseIf oFSO.FileExists(oShell.ExpandEnvironmentStrings("%ProgramFiles%\Winrar\rar.exe")) Then
        sWinRarLocation = oShell.ExpandEnvironmentStrings("%programfiles%\Winrar\")
    ElseIf oFSO.FileExists(oShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%\Winrar\rar.exe")) Then
        sWinRarLocation = oShell.ExpandEnvironmentStrings("%programfiles(x86)%\Winrar\")
  Else
    Create_WinRar_Archive = "Error: Couldn't find Winrar.EXE"
    Exit Function
  End If
  '--------------------------------------
'The Command "A" Means ==> add to archive
'To create a WinRar file with the specified name after command A (archive) and the switches -ep1 (exclude base directory from names) and -r (recursive)
    If Password = "" Then
        oShell.Run """" & sWinRarLocation & "rar.exe"" A -ep1 -r """ & _
        Target_Archive & """ """ & Source & """",0,True
    Else
'The -hp<password> switch: To use a password
        oShell.Run """" & sWinRarLocation & "rar.exe"" A -ep1 -r -hp"&Password&" """ & _
        Target_Archive & """ """ & Source & """",0,True
    End If
    If oFSO.FileExists(Target_Archive) Then
        Create_WinRar_Archive = 1
    Else
        Create_WinRar_Archive = "Error: Creating archives failed !"
        MsgBox Create_WinRar_Archive,16,Create_WinRar_Archive
    End If
End Function
'****************************************************************************************************
</code>```

Body:
Here is a Function Create_WinRar_Archive(Source,Target_Archive,Password) to compress a folder with rar.exe command line of Winrar.
We can call this function by two ways :

If you want create an archive without password, so we called it by this way :

Call Create_WinRar_Archive(Source,Target_Archive,"")

or if you want to set to this archive a password just we called it as :

Call Create_WinRar_Archive(Source,Target_Archive,Password)

And here is an example to compress the Pictures folder

Option Explicit
Dim ws,Source,Target_Archive,Password
Set ws = CreateObject("Wscript.Shell")
Source = ws.ExpandEnvironmentStrings("%userprofile%\pictures")
Target_Archive = "C:\BackupImages.rar"
Password = "123456"
Call Create_WinRar_Archive(Source,Target_Archive,Password)
Wscript.echo "All files are archived successfully !"
ws.run "Explorer " & Target_Archive
'******************************************************************************************************
Function Create_WinRar_Archive(Source,Target_Archive,Password)
'This function executes the command line
'version of WinRAR and reports whether
'the archive exists after WinRar exits.
'If it exists then it returns true. If
'not it returns an error message.
'------------------------------------------------------------------------------------
    Dim oFSO,oShell,aScriptFilename,sScriptFilename
    Dim sWorkingDirectory,ProgramFiles,sWinRarLocation
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Set oShell = CreateObject("Wscript.Shell")
'--------Find Working Directory--------
    aScriptFilename = Split(Wscript.ScriptFullName, "\")
    sScriptFilename = aScriptFileName(Ubound(aScriptFilename))
    sWorkingDirectory = Replace(Wscript.ScriptFullName, sScriptFilename, "")
'-------Ensure we can find Winrar.exe------
 If oFSO.FileExists(sWorkingDirectory & " " & "Winrar.EXE") Then
    sWinRarLocation = ""
    ElseIf oFSO.FileExists(oShell.ExpandEnvironmentStrings("%ProgramFiles%\Winrar\rar.exe")) Then
        sWinRarLocation = oShell.ExpandEnvironmentStrings("%programfiles%\Winrar\")
    ElseIf oFSO.FileExists(oShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%\Winrar\rar.exe")) Then
        sWinRarLocation = oShell.ExpandEnvironmentStrings("%programfiles(x86)%\Winrar\")
  Else
    Create_WinRar_Archive = "Error: Couldn't find Winrar.EXE"
    Exit Function
  End If
  '--------------------------------------
'The Command "A" Means ==> add to archive
'To create a WinRar file with the specified name after command A (archive) and the switches -ep1 (exclude base directory from names) and -r (recursive)
    If Password = "" Then
        oShell.Run """" & sWinRarLocation & "rar.exe"" A -ep1 -r """ & _
        Target_Archive & """ """ & Source & """",0,True
    Else
'The -hp<password> switch: To use a password
        oShell.Run """" & sWinRarLocation & "rar.exe"" A -ep1 -r -hp"&Password&" """ & _
        Target_Archive & """ """ & Source & """",0,True
    End If
    If oFSO.FileExists(Target_Archive) Then
        Create_WinRar_Archive = 1
    Else
        Create_WinRar_Archive = "Error: Creating archives failed !"
        MsgBox Create_WinRar_Archive,16,Create_WinRar_Archive
    End If
End Function
'****************************************************************************************************


问:
how to properly use dinamic id name in vue v-for?
i'm trying to iterate a div within a v-for.
and i'm trying to use the index parameter for dynamic div id assignment, but i don't know how to properly use it...

Least i am using bootstrap collapse to assign a data-target to the rendered div.
It doesn't work.

Here the code:

```<code>                '<div class="servizioInlista" v-for="(servizio,index) in servizi.lineaGialla.servizi">'+
                        '<div class="row">'+
                            '<div class="col-lg-8 col-xs-8 nopadding">'+
                                '<h4 class="blu">{{servizio.nomeServizio}}</h4>'+
                            '</div>'+
                            '<div class="col-lg-4 col-xs-4>"'+
                                '<span class="pull-right nomargin"  v-on:click="mostraServiziGiallo" v-bind:class="[GiallaTutti ? \'minus\' : !GiallaTutti,\'plus\']" data-toggle="collapse" data-target="#singoloGialla.index"></span>'+
                            '</div>'+
                        '</div>'+
                        '<div v-bind:id="singoloGialla.index" class="row">'+
                            '<p>{{servizio.descrizione}}</p>'+
                        '</div>'+
                    '</div>'+
</code>```

答:
From what I understand you want something like this:

```<code><div v-bind:id="'singoloGialla-' + index" class="row">
  <p>{{servizio.descrizione}}</p>
</div>
</code>```

and

```<code>< ... v-bind:data-target="'#singoloGialla-' + index">
</code>```

So, we are taking the string 'singoloGialla-' and concatenating it with the the dynamic value of the index variable. When we use the + operator to concatenate a string and a number, the number is first converted to a string, then concatenated to the existing string. This is not Vue specific, but normal JavaScript behavior.

Body:
i'm trying to iterate a div within a v-for.
and i'm trying to use the index parameter for dynamic div id assignment, but i don't know how to properly use it...

Least i am using bootstrap collapse to assign a data-target to the rendered div.
It doesn't work.

Here the code:

                '
'+
                        '
'+
                            '
'+
                                '
{{servizio.nomeServizio}}
'+
                            '
'+
                            '
"'+
                                ''+
                            '
'+
                        '
'+
                        '
'+
                            '
{{servizio.descrizione}}
'+
                        '
'+
                    '
'+

Body:
From what I understand you want something like this:

<div v-bind:id="'singoloGialla-' + index" class="row">
  <p>{{servizio.descrizione}}</p>
</div>

and

< ... v-bind:data-target="'#singoloGialla-' + index">

So, we are taking the string 'singoloGialla-' and concatenating it with the the dynamic value of the index variable. When we use the + operator to concatenate a string and a number, the number is first converted to a string, then concatenated to the existing string. This is not Vue specific, but normal JavaScript behavior.


问:
What's your most controversial programming opinion?
This is definitely subjective, but I'd like to try to avoid it becoming argumentative. I think it could be an interesting question if people treat it appropriately.

The idea for this question came from the comment thread from my answer to the "What are five things you hate about your favorite language?" question. I contended that classes in C# should be sealed by default - I won't put my reasoning in the question, but I might write a fuller explanation as an answer to this question. I was surprised at the heat of the discussion in the comments (25 comments currently).

So, what contentious opinions do you hold? I'd rather avoid the kind of thing which ends up being pretty religious with relatively little basis (e.g. brace placing) but examples might include things like "unit testing isn't actually terribly helpful" or "public fields are okay really". The important thing (to me, anyway) is that you've got reasons behind your opinions.

Please present your opinion and reasoning - I would encourage people to vote for opinions which are well-argued and interesting, whether or not you happen to agree with them.

答:
Design patterns are a waste of time when it comes to software design and development.

Don't get me wrong, design patterns are useful but mainly as a communication vector. They can express complex ideas very concisely: factory, singleton, iterator...

But they shouldn't serve as a development method. Too often developers architect their code using a flurry of design pattern-based classes where a more concise design would be better, both in term of readability and performance. All that with the illusion that individual classes could be reused outside their domain. If a class is not designed for reuse or isn't part of the interface, then it's an implementation detail.

Design patterns should be used to put names on organizational features, not to dictate the way code must be written.

(It was supposed to be controversial, remember?)

OwnerDisplayName: Jon Skeet

LastEditorDisplayName: brian d foy

OwnerDisplayName: fbonnet


问:
My working fine PHP scripts aren't working anymore
I've been using this for a long time and now it stopped working. I just don't get why PHP changes on you. Someone help.

The problem is with these two lines:

```<code>$res = mysql_query("SELECT num FROM ywsite WHERE item='sitehits'", $db);
$num = mysql_result($res,0,"num");
</code>```

Here's the rest of the script:

```<code><?php
    $res = mysql_query("SELECT num FROM ywsite WHERE item='sitehits'", $db);
    $num = mysql_result($res,0,"num");
    $equals = $num + 1;
    mysql_query("UPDATE ywsite SET num='$equals' WHERE item='sitehits'");
?>
</code>```

答:
"Stopped working" is not a problem description. Nothing just changes on you. If code you wrote stops working, it means something external you're relying on has changed, such as the version of the PHP interpreter you're running it on, or, say, a MySQL server you're connecting to.

Check that MySQL is running and you can connect to it.

Ensure you're actually connecting to it in your code. You say "here's the rest of the script", yet your script doesn't include any code to connect to a database before sending queries to it. If that's all the code there is, there used to be more and you removed it.

Check that your SELECT query returned a result

```<code>if (!$res) die("Error in SELECT query: " . mysql_error());
</code>```

Check that your UPDATE query ran the same way, by checking the return value of mysql_query

Finally, you don't need to select the current value to add to that value. You can issue just one UPDATE query.

```<code>mysql_query("UPDATE ywsite SET num = num + 1 WHERE item = 'sitehits'") or die("Error updating: " . mysql_error());
</code>```

Body:
I've been using this for a long time and now it stopped working. I just don't get why PHP changes on you. Someone help.

The problem is with these two lines:

$res = mysql_query("SELECT num FROM ywsite WHERE item='sitehits'", $db);
$num = mysql_result($res,0,"num");

Here's the rest of the script:

<?php
    $res = mysql_query("SELECT num FROM ywsite WHERE item='sitehits'", $db);
    $num = mysql_result($res,0,"num");
    $equals = $num + 1;
    mysql_query("UPDATE ywsite SET num='$equals' WHERE item='sitehits'");
?>

Body:
"Stopped working" is not a problem description. Nothing just changes on you. If code you wrote stops working, it means something external you're relying on has changed, such as the version of the PHP interpreter you're running it on, or, say, a MySQL server you're connecting to.

Check that MySQL is running and you can connect to it.

Ensure you're actually connecting to it in your code. You say "here's the rest of the script", yet your script doesn't include any code to connect to a database before sending queries to it. If that's all the code there is, there used to be more and you removed it.

Check that your SELECT query returned a result

if (!$res) die("Error in SELECT query: " . mysql_error());

Check that your UPDATE query ran the same way, by checking the return value of mysql_query

Finally, you don't need to select the current value to add to that value. You can issue just one UPDATE query.

mysql_query("UPDATE ywsite SET num = num + 1 WHERE item = 'sitehits'") or die("Error updating: " . mysql_error());


问:
How to install Pillow on Python 3.5?
As the title suggested I have trouble installing Pillow on Python 3.5.2. I believe I already have pip and easyinstall preinstalled. I have viewed some tutorials and attempted to type '>$pip install Pillow' into the IDLE shell but it came back with a syntax error. I am new to programming and have no prior IT exprience so please be specific and put it in simple terms. My OS is Windows 10. Thanks.</p>

答: Use pip install Pillow. It worked for me</p>

Title: How to install Pillow on Python 3.5?


问:
find type -f also returns non-matching files in matching directory

all files/folders in current directory:

```<code>./color_a.txt
./color_b.txt
./color_c.txt
./color/color_d.txt
./color/blue.txt
./color/red.txt
./color/yellow.txt
</code>```

command used to find all files with the word color in name:

```<code>find ./*color* -type f
</code>```

result:

```<code>./color_a.txt
./color_b.txt
./color_c.txt
./color/color_d.txt
./color/blue.txt
./color/red.txt
./color/yellow.txt
</code>```

expected result:

```<code>./color_a.txt
./color_b.txt
./color_c.txt
./color/color_d.txt
</code>```

The result also includes all the non-matching file names under a matching parent directory.
How could I get ONLY files with names directly matching the color pattern?

Thanks a lot!

答:
You can use the regex option

```<code>find -regex ".*color_.*" -type f
</code>```

ContentLicense: CC BY-SA 4.0

Body:
all files/folders in current directory:

./color_a.txt
./color_b.txt
./color_c.txt
./color/color_d.txt
./color/blue.txt
./color/red.txt
./color/yellow.txt

command used to find all files with the word color in name:

find ./*color* -type f

result:

./color_a.txt
./color_b.txt
./color_c.txt
./color/color_d.txt
./color/blue.txt
./color/red.txt
./color/yellow.txt

expected result:

./color_a.txt
./color_b.txt
./color_c.txt
./color/color_d.txt

The result also includes all the non-matching file names under a matching parent directory.
How could I get ONLY files with names directly matching the color pattern?

Thanks a lot!

Body:
You can use the regex option

find -regex ".*color_.*" -type f


问:
Folder structure in GitHub for my Eclipse Maven project
I am trying to push my eclipse maven project to my GitHub repository but the  folder structure it is mapping is wrong.

My Maven Project is named DocOcr and i am trying to push it to DocOcr repository on GitHub using Egit in Eclipse. Although it is copying files but its creating one more folder under gitub DocOcr repo named DocOcr and copying all files under it.

Now my pom.xml and src are getting copied to GitHub as {myusername}/DocOcr/DocOcr

i want my pom.xml and src to get copied to {myusername}/DocOcr/.

Can someone please help ?

答:
Double-check where your .git is located locally: it should be in the same folder as where your pom.xml is.

If it is not, backup that .git (in case you have done multiple commit), and see if you can initialize a new one where your pom.xml is, and import it: re-share your project as described in "How make Eclipse/EGit recognize existing repository information after update?".

Or, as described in "When I commit a project an extra project dir is created", create the Git repo with the option "Use or create repository in parent folder of project" enabled, at the very top of the "Configure Git Repository" dialog (Team -> Share Project... -> Git)

Which is exactly what I meant by "it should be in the same folder as where your pom.xml is."


问:
How to preserve milisecond data on java simpledateFormat
Basically I'm trying to convert string data to Timestamp format. When I converted data to timestamp format, SimpleDateFormat added three minutes.
Because milisecond data equals 3 minute.But I want to preserve milisecond data on timestamp value.

Code:

```<code>public Double TimestampTest(String Timestamp ){
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
    Date parsedDate = null;
    try {
        parsedDate = dateFormat.parse(Timestamp);
    } catch (ParseException e1) {
        e1.printStackTrace();
    }
    Timestamp timestamp = new java.sql.Timestamp(parsedDate.getTime());
...
}
</code>```

Timestamp value

```<code>2002-04-17 23:45:58.983
</code>```

For test case

```<code>System.out.println(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse("2015-04-22T19:54:11.219983Z"));
System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS'Z'").parse("2015-04-22 19:54:11.219983Z"));
</code>```

Results are same for both of them

```<code>Wed Apr 22 19:57:50 EEST 2015

Wed Apr 22 19:57:50 EEST 2015
</code>```

Because

```<code>219 983 milliseconds = 3.66638333 minutes
</code>```

To sum up I want to preserve ms data .Is there any way to do it ?

答:
If I understand, what you have at the end of your string are microseconds, not milliseconds. The old, obsolete Date and SimpleDateFormat classes have no support for microseconds. But you can use the new java.time classes:</p>

```<code>System.out.println(ZonedDateTime.parse("2015-04-22T19:54:11.219983Z",
                                       DateTimeFormatter.ofPattern(("yyyy-MM-dd'T'HH:mm:ss.SSSSSSVV"))));
</code>```

Body:
Basically I'm trying to convert string data to Timestamp format. When I converted data to timestamp format, SimpleDateFormat added three minutes.
Because milisecond data equals 3 minute.But I want to preserve milisecond data on timestamp value.

Code:

public Double TimestampTest(String Timestamp ){
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
    Date parsedDate = null;
    try {
        parsedDate = dateFormat.parse(Timestamp);
    } catch (ParseException e1) {
        e1.printStackTrace();
    }
    Timestamp timestamp = new java.sql.Timestamp(parsedDate.getTime());
...
}

Timestamp value

2002-04-17 23:45:58.983

For test case

System.out.println(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse("2015-04-22T19:54:11.219983Z"));
System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS'Z'").parse("2015-04-22 19:54:11.219983Z"));

Results are same for both of them

Wed Apr 22 19:57:50 EEST 2015

Wed Apr 22 19:57:50 EEST 2015

Because

219 983 milliseconds = 3.66638333 minutes

To sum up I want to preserve ms data .Is there any way to do it ?

Body:
If I understand, what you have at the end of your string are microseconds, not milliseconds. The old, obsolete Date and SimpleDateFormat classes have no support for microseconds. But you can use the new java.time classes:

System.out.println(ZonedDateTime.parse("2015-04-22T19:54:11.219983Z",
                                       DateTimeFormatter.ofPattern(("yyyy-MM-dd'T'HH:mm:ss.SSSSSSVV"))));


问:
How to make an if statement if your pointer is getting garbage
Hi everyone I have a problem taking care of a malfunction, I'm building a dynamic linked list which connects structures with *next and *previous,
now if the structures are unable to connect (long story) I need to print "the way does not exist" now I've made an if statement

```<code>    temp = point_start; // point_start is the head of the list
condition = 2;
for(i=0;i<gagnum;i++) //gagnum is the number of structures
{
    temp=point_start->previous; // previous is the pointer of the previous structure.

    if (temp != 0xcdcdcdcd) // ------> is this legal?
        condition = 1;
    else
    {
        printf("no route found ")
        condition = 2;
        break;
    }

}
</code>```

I have an if statement which says "if (temp != 0xcdcdcdcd)" so when it gets garbage I put out the message and stop the program, is this legal to use? is there a better way to do this? thank you so much for your help!

答: Hi the answer to the problem is just to NULL all your pointers when you're building the linked list.  then check if the pointer is NULL instead of garbage, hope it helps!</p>

Body:
Hi everyone I have a problem taking care of a malfunction, I'm building a dynamic linked list which connects structures with *next and *previous,
now if the structures are unable to connect (long story) I need to print "the way does not exist" now I've made an if statement

    temp = point_start; // point_start is the head of the list
condition = 2;
for(i=0;i<gagnum;i++) //gagnum is the number of structures
{
    temp=point_start->previous; // previous is the pointer of the previous structure.

    if (temp != 0xcdcdcdcd) // ------> is this legal?
        condition = 1;
    else
    {
        printf("no route found ")
        condition = 2;
        break;
    }

}

I have an if statement which says "if (temp != 0xcdcdcdcd)" so when it gets garbage I put out the message and stop the program, is this legal to use? is there a better way to do this? thank you so much for your help!


问:
Overloading a function with a function from another class
I have a BinaryMemoryReader class that has a function defined like this:

```<code>template <typename T>
inline void read(T **data) {
    *data = (T*)&stream[position];
    position += sizeof(T);
}
</code>```

It handles most of the standard types from a stream in memory.

The custom complex types have read functions of their own, such as:

```<code>void AnotherClass::read(BinaryMemoryReader *const reader)
{
    reader->read<bool>(&num);
    reader->read<short>(&count);
}
</code>```

What I'd like to is write the code that would, when I write

```<code>reader->read<AnotherClass>(&var);
</code>```

would call the second function. It would mean that AnotherClasss read function would overload the BinaryMemoryReaders read function for that particular type.

It would allow me to write a much more cleaner code.

EDIT:
The general idea is this:

Have a central BinaryMemoryReader class.

Have a generic read function within it to deal with the standard types.

Have the syntax to call it be bmr->read<int>(&intVar);

Have specialized read functions defined in their own classes.

Most importantly, the syntax to call them would be bmr->read<customType>(&customTypeVar);

That way the specific read functions would be associated with their own classes, but would be able to be called from the BinaryMemoryReader.

答:
As I wrote in my comment I would use the following approach:

Have a templated free function

```<code>template <typename T>
void read(BinaryMemoryReader& bmr, T& data) {
    bmr.read(&data);
}
</code>```

Specialize that function for each of the types you want to handle

```<code>class AnotherClass {
     template <typename T>
     friend void read(BinaryMemoryReader& bmr, T &data);

     bool num;
     short count;
 };

 template <>
 void read(BinaryMemoryReader& bmr, AnotherClass &data) {
     bmr.read<bool>(&(data.datanum));
     bmr.read<short>(&(data.count));
 };
</code>```

Call it like

```<code> BinaryMemoryReader bmr;
 AnotherType at;
 read(bmr,at);
</code>```

That technique is used for instance with the c++ standard I/O library and overloads provided for the

```<code> std::ostream& operator<<(std::ostream&, const T&);
 std::istream& operator>>(std::istream&, T&);
</code>```

functions.

Alternatively you could do that specialization for the BinaryMemoryReader::read() function. But BinaryMemoryReader must be friend of all class specializations.

Body:
I have a BinaryMemoryReader class that has a function defined like this:

template <typename T>
inline void read(T **data) {
    *data = (T*)&stream[position];
    position += sizeof(T);
}

It handles most of the standard types from a stream in memory.

The custom complex types have read functions of their own, such as:

void AnotherClass::read(BinaryMemoryReader *const reader)
{
    reader->read<bool>(&num);
    reader->read<short>(&count);
}

What I'd like to is write the code that would, when I write

reader->read<AnotherClass>(&var);

would call the second function. It would mean that AnotherClasss read function would overload the BinaryMemoryReaders read function for that particular type.

It would allow me to write a much more cleaner code.

EDIT:
The general idea is this:

Have a central BinaryMemoryReader class.

Have a generic read function within it to deal with the standard types.

Have the syntax to call it be bmr->read<int>(&intVar);

Have specialized read functions defined in their own classes.

Most importantly, the syntax to call them would be bmr->read<customType>(&customTypeVar);

That way the specific read functions would be associated with their own classes, but would be able to be called from the BinaryMemoryReader.

Body:
As I wrote in my comment I would use the following approach:

Have a templated free function

template <typename T>
void read(BinaryMemoryReader& bmr, T& data) {
    bmr.read(&data);
}

Specialize that function for each of the types you want to handle

class AnotherClass {
     template <typename T>
     friend void read(BinaryMemoryReader& bmr, T &data);

     bool num;
     short count;
 };

 template <>
 void read(BinaryMemoryReader& bmr, AnotherClass &data) {
     bmr.read<bool>(&(data.datanum));
     bmr.read<short>(&(data.count));
 };

Call it like

 BinaryMemoryReader bmr;
 AnotherType at;
 read(bmr,at);

That technique is used for instance with the c++ standard I/O library and overloads provided for the

 std::ostream& operator<<(std::ostream&, const T&);
 std::istream& operator>>(std::istream&, T&);

functions.

Alternatively you could do that specialization for the BinaryMemoryReader::read() function. But BinaryMemoryReader must be friend of all class specializations.


问:
Android: how to start the app intalled in the phone using the packagename and pass it a parameter?
I HAVE REEDITED THE QUESTION

I am getting the apps installed in the Android phone with the code below. I put the info of the app in an instance of PInfo (one of my customized class).

Now I want to get one of them and open it passing a parameter, I have tried the following:

```<code>Uri uri =Uri.parse("THEURL");
Intent intent = getPackageManager().getLaunchIntentForPackage(((PInfo)apps.get(0)).apppackage);
intent.setData(uri);

startActivity(intent);
</code>```

This opens the app but how to pass the parameter? (The code above is not working) For example, a string.

答:
You should create a method that handles the incoming intent and call it within your onCreate or onResume methods.

You'll pass the information like this:

intent.putExtra("foo", someString);

Then you'll try read the information passed along within the intent.

String incomingString = getIntent().getStringExtra("foo"); should do the trick within your handleIncomingIntent()

Body:
I HAVE REEDITED THE QUESTION

I am getting the apps installed in the Android phone with the code below. I put the info of the app in an instance of PInfo (one of my customized class).

Now I want to get one of them and open it passing a parameter, I have tried the following:

Uri uri =Uri.parse("THEURL");
Intent intent = getPackageManager().getLaunchIntentForPackage(((PInfo)apps.get(0)).apppackage);
intent.setData(uri);

startActivity(intent);

This opens the app but how to pass the parameter? (The code above is not working) For example, a string.


问:
i cant install Tweak Tool
i tried

```<code>apt-get install unity-tweak-tool-daily
</code>```

E : unable locate a package

and im tried gnome tweak tool

gnome

答:
add repo before apt-get install

```<code>sudo add-apt-repository ppa:freyja-dev/unity-tweak-tool-daily

sudo apt-get update && sudo apt-get install unity-tweak-tool
</code>```

reference http://www.omgubuntu.co.uk/2013/03/unity-tweak-tool-is-now-available-in-raring

Title: i cant install Tweak Tool

Body:
i tried

apt-get install unity-tweak-tool-daily

E : unable locate a package

and im tried gnome tweak tool

gnome

Body:
add repo before apt-get install

sudo add-apt-repository ppa:freyja-dev/unity-tweak-tool-daily

sudo apt-get update && sudo apt-get install unity-tweak-tool

reference http://www.omgubuntu.co.uk/2013/03/unity-tweak-tool-is-now-available-in-raring


问:
C# UnityEvents - Override
I had been searching so much to solve my problem but I found nothing.

So, what is my problem?
I have a class that extends from UnityEvent and it has 2 virtual methods and it has public identifier in another file that should call those methods. But when I put my script in inspector nothing happens (except root virtual methods).

The class:

```<code>using UnityEngine;
using UnityEngine.Events;
using System.Collections;

namespace Namespace {
    [System.Serializable]
    public class SomeClass : UnityEvent {
        public virtual void OnSomething(GameObject objectSender, GameObject objectAction) {

        }
        public virtual void OnSomethingElse(GameObject objectSender, GameObject objectAction) {
        }
    }
}
</code>```

I overrided those methods in a file and but in variable "script" shown below but they are not overrided.
And using of SomeClass:

```<code>using UnityEngine;
using UnityEngine.Events;
using System.Collections;

namespace Namespace {
    public class ActionListener : MonoBehaviour {
        public SomeClass script;

        // When I lose last hope
        // private void Start() {
        //  script.Invoke();
        //}
        public void OnHover(GameObject sender, GameObject action) {
            script.OnHoverListener(sender, action);
        }
        public void OnClick(GameObject sender, GameObject action) {
            script.OnClickListener(sender, action);
        }
    }
}
</code>```

答:
I have solved this problem using MonoBehaviour instead UnityEvent.

And not it looks like this

```<code>using UnityEngine;
using UnityEngine.Events;
using System.Collections;

namespace Namespace {
    public class SomeClass : MonoBehaviour {
        public virtual void OnSomething(GameObject objectSender, GameObject objectAction) {

        }
        public virtual void OnSomethingElse(GameObject objectSender, GameObject objectAction) {
        }
    }
}
</code>```

And in use

```<code>using UnityEngine;
using UnityEngine.Events;
using System.Collections;

namespace Namespace {
    public class ActionListener : MonoBehaviour {
        public SomeClass script;

        public void OnHover(GameObject sender, GameObject action) {
            script.OnSomething(sender, action);
        }
        public void OnClick(GameObject sender, GameObject action) {
            script.OnSomethingElse(sender, action);
        }
    }
}
</code>```

Title: C# UnityEvents - Override

Body:
I had been searching so much to solve my problem but I found nothing.

So, what is my problem?
I have a class that extends from UnityEvent and it has 2 virtual methods and it has public identifier in another file that should call those methods. But when I put my script in inspector nothing happens (except root virtual methods).

The class:

using UnityEngine;
using UnityEngine.Events;
using System.Collections;

namespace Namespace {
    [System.Serializable]
    public class SomeClass : UnityEvent {
        public virtual void OnSomething(GameObject objectSender, GameObject objectAction) {

        }
        public virtual void OnSomethingElse(GameObject objectSender, GameObject objectAction) {
        }
    }
}

I overrided those methods in a file and but in variable "script" shown below but they are not overrided.
And using of SomeClass:

using UnityEngine;
using UnityEngine.Events;
using System.Collections;

namespace Namespace {
    public class ActionListener : MonoBehaviour {
        public SomeClass script;

        // When I lose last hope
        // private void Start() {
        //  script.Invoke();
        //}
        public void OnHover(GameObject sender, GameObject action) {
            script.OnHoverListener(sender, action);
        }
        public void OnClick(GameObject sender, GameObject action) {
            script.OnClickListener(sender, action);
        }
    }
}

Body:
I have solved this problem using MonoBehaviour instead UnityEvent.

And not it looks like this

using UnityEngine;
using UnityEngine.Events;
using System.Collections;

namespace Namespace {
    public class SomeClass : MonoBehaviour {
        public virtual void OnSomething(GameObject objectSender, GameObject objectAction) {

        }
        public virtual void OnSomethingElse(GameObject objectSender, GameObject objectAction) {
        }
    }
}

And in use

using UnityEngine;
using UnityEngine.Events;
using System.Collections;

namespace Namespace {
    public class ActionListener : MonoBehaviour {
        public SomeClass script;

        public void OnHover(GameObject sender, GameObject action) {
            script.OnSomething(sender, action);
        }
        public void OnClick(GameObject sender, GameObject action) {
            script.OnSomethingElse(sender, action);
        }
    }
}


问:
Can no create new C++ class in Android Studio
I am running Android Studio 2.1. I have created a new blank activity project.

I have set the proper locations of the SDK, JDK, and NDK in project configuration.

I then right clicked on the 'app' folder and hit 'create new c++ class'.

I then entered a name for it called  "SquareIt". Everything in the dialog is filled out, yet the 'OK' button is still greyed out and I can not click it.

答:
In Menu Bar [View]--[Tool windows]--[Project], change this drop-down box to [Project] instead of default [Android],then you can create you c++ class without encounter the 'OK' button problem.

P.S. My android studio version is 2.3.3.


问:
calling overloaded function from derived class
I have two questions:
1. If base class and derived class has the same member function- compute() and if I create an object of derived class and call derived_obj.compute(), then which class's function is invoked?

2.Could you justify the output for this:

```<code>     #include<iostream.h>
    #include<iostream.h>
class Base
{
    int x, y, z;
    public:
    Base()
    {
        x = y = z = 0;
    }
    Base(int xx, int yy = 'A', int zz = 'B')
    {
        x = xx;
        y = x + yy;
        z = x + y;
    }
    void Display(void)
    {
        cout<< x << " " << y << " " << z << endl;
    }
};
class Derived : public Base
{
    int x, y;
    public:
    Derived(int xx = 65, int yy = 66) : Base(xx, yy)
    {
        y = xx;
        x = yy;
    }
    void Display(void)
    {
        cout<< x << " " << y << " ";
        Display();
    }
};
int main()
{
    Derived objD;
    objD.Display();
    return 0;
}
</code>```

答: In this case it is the derived class's function that is called because the object objD has been declared as such.</p>

Body:
I have two questions:
1. If base class and derived class has the same member function- compute() and if I create an object of derived class and call derived_obj.compute(), then which class's function is invoked?

2.Could you justify the output for this:

     #include<iostream.h>
    #include<iostream.h>
class Base
{
    int x, y, z;
    public:
    Base()
    {
        x = y = z = 0;
    }
    Base(int xx, int yy = 'A', int zz = 'B')
    {
        x = xx;
        y = x + yy;
        z = x + y;
    }
    void Display(void)
    {
        cout<< x << " " << y << " " << z << endl;
    }
};
class Derived : public Base
{
    int x, y;
    public:
    Derived(int xx = 65, int yy = 66) : Base(xx, yy)
    {
        y = xx;
        x = yy;
    }
    void Display(void)
    {
        cout<< x << " " << y << " ";
        Display();
    }
};
int main()
{
    Derived objD;
    objD.Display();
    return 0;
}


问:
Problem installing mysql gem on Snow Leopard: uninitialized constant MysqlCompat::MysqlRes
I've got a problem trying to install the Ruby mysql gem driver.

I recently upgraded to Snow Leopard and did the Hivelogic manual install of MySQL. This all seems to work fine as I can access mysql from the command line and make changes to the database.

My problem is that if I now use

```<code>rake db:migrate
</code>```

I get:

```<code>rake aborted!
uninitialized constant MysqlCompat::MysqlRes

(See full trace by running task with --trace)
</code>```

Now it appears that my mysql gem isn't working correctly as I can access MySQL fine from Python using the Python driver (which I compiled to). I therefore tried to rebuild the gem using the following command from this site: http://techliberty.blogspot.com/, (incidentally I am using a recent Intel MacBook Pro):

```<code>  sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
</code>```

This compiles although I get No definition for the documentation:

```<code>  Building native extensions.  This could take a while...
  Successfully installed mysql-2.8.1
  1 gem installed
  Installing ri documentation for mysql-2.8.1...

  No definition for next_result

  No definition for field_name
  ...
</code>```

I'm a little stumped as my mysql_config is located in the correct place:

```<code> /usr/local/mysql/bin/mysql_config
</code>```

And I have removed all other instances of the mysql gem, from my system.

Any suggestions would be greatly appreciated. Many thanks.

PS I saw this previous post uninitialized constant MysqlCompat::MysqlRes (using mms2r gem) but it doesn't seem applicable for my version.

答:
After searching for a long time on solving this particular problem, and trying out all of the above options (and the options on many other sites) without luck, I removed my mysql-5.5 install and installed mysql-5.1. All of a sudden, and with a bit of the above help for compiling 64 bit versions, I finally managed to install a working mysql gem.

So, if you're running into this problem and are running mysql 5.5, try degrading to mysql 5.1.

Body:
I've got a problem trying to install the Ruby mysql gem driver.

I recently upgraded to Snow Leopard and did the Hivelogic manual install of MySQL. This all seems to work fine as I can access mysql from the command line and make changes to the database.

My problem is that if I now use

rake db:migrate

I get:

rake aborted!
uninitialized constant MysqlCompat::MysqlRes

(See full trace by running task with --trace)

Now it appears that my mysql gem isn't working correctly as I can access MySQL fine from Python using the Python driver (which I compiled to). I therefore tried to rebuild the gem using the following command from this site: http://techliberty.blogspot.com/, (incidentally I am using a recent Intel MacBook Pro):

  sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

This compiles although I get No definition for the documentation:

  Building native extensions.  This could take a while...
  Successfully installed mysql-2.8.1
  1 gem installed
  Installing ri documentation for mysql-2.8.1...

  No definition for next_result

  No definition for field_name
  ...

I'm a little stumped as my mysql_config is located in the correct place:

 /usr/local/mysql/bin/mysql_config

And I have removed all other instances of the mysql gem, from my system.

Any suggestions would be greatly appreciated. Many thanks.

PS I saw this previous post uninitialized constant MysqlCompat::MysqlRes (using mms2r gem) but it doesn't seem applicable for my version.


问:
Create one slider for every wordpress page with the title's page with revolution slider
I would like to create a slider for every page of my website with the title of this page in it. I would like to do this without create a slider for each page, is it possible to do this automatically? To charge the title page automatically in the revolution slider?

Thanks :)

答:
You could try it like this:

1.) Add a layer to the slider that will contain the title.

2.) Under "Advanced Parameters", give that layer an ID, for example #MyLayerID.

3.) Add a jQuery code that changes the value of the element with that ID with the title of the current page, something like:

```<code>$(document).ready(
    function() {
        var title = jQuery(this).attr('title');
        $('#MyLayerID').text(title);
    }
);
</code>```

Regarding the title - site name question:

You can try this:

```<code>title=title.substr(0,title.lastIndexOf("-"));
</code>```

Body:
You could try it like this:

1.) Add a layer to the slider that will contain the title.

2.) Under "Advanced Parameters", give that layer an ID, for example #MyLayerID.

3.) Add a jQuery code that changes the value of the element with that ID with the title of the current page, something like:

$(document).ready(
    function() {
        var title = jQuery(this).attr('title');
        $('#MyLayerID').text(title);
    }
);

Regarding the title - site name question:

You can try this:

title=title.substr(0,title.lastIndexOf("-"));


问:
from active div how to filter the dynamically div based on multiple selections
by default displayed record, data should be displayed based on multiple check box

Hi, I need help, I am new for frontend, I have record displayed in unordered, all records are having a class name. and another div have the list of multiple choice, from there I am passing class name, So I want to record should be displayed dynamically based on selection

am facing the problem to sorting the divs,I am new in fronted side, please any one can help.thanks

below is my problem
example:

```<code><div class="main>

    <div class="aa"> data elements or contents</div>
    <div class="zz"> data elements or contents</div>
    <div class="cc"> data elements or contents</div>
    <div class="aa"> data elements or contents</div>
    <div class="bb"> data elements or contents</div>

</div>
</code>```

====and in another div i have multiple choice option from there i can pass the class name or id if that id or classname are mathe in main div then child div content should be arraenged in that order===

if first i selected call aa then bb, so immediate result should be as below=====

```<code><div class="main>
    <div class="aa"> data elements or contents</div>
    <div class="aa"> data elements or contents</div>
    <div class="bb"> data elements or contents</div>
    <div class="zz"> data elements or contents</div>
    <div class="cc"> data elements or contents</div>
</div>
</code>```

答:
you can try  like this</p>

```<code>$(function() {
  $(".main div").sort(sort_div).appendTo('.listitems');
  function sort_div(a, b) {
    //your sorting logic
    return ($(b).attr('class')) < ($(a).attr('class')) ? 1 : -1;
  }
});
</code>```

Body:
by default displayed record, data should be displayed based on multiple check box

Hi, I need help, I am new for frontend, I have record displayed in unordered, all records are having a class name. and another div have the list of multiple choice, from there I am passing class name, So I want to record should be displayed dynamically based on selection

am facing the problem to sorting the divs,I am new in fronted side, please any one can help.thanks

below is my problem
example:

 data elements or contents

 data elements or contents

 data elements or contents

 data elements or contents

 data elements or contents

====and in another div i have multiple choice option from there i can pass the class name or id if that id or classname are mathe in main div then child div content should be arraenged in that order===

if first i selected call aa then bb, so immediate result should be as below=====

 data elements or contents

 data elements or contents

 data elements or contents

 data elements or contents

 data elements or contents

Body:
you can try  like this

$(function() {
  $(".main div").sort(sort_div).appendTo('.listitems');
  function sort_div(a, b) {
    //your sorting logic
    return ($(b).attr('class')) < ($(a).attr('class')) ? 1 : -1;
  }
});


问:
Connecting phpmyadmin to local database created in mysqlworkbench
I have a bunch of tables and databases created in mysql workbench, but I don't know how to connect them to phpmyadmin. When I start phpmyadmin I get the following error:

```<code>Warning in .\libraries\dbi\DBIMysqli.php#556
mysqli_real_escape_string() expects parameter 1 to be mysqli, boolean given

Backtrace

.\libraries\dbi\DBIMysqli.php#556: mysqli_real_escape_string(
boolean false,
string '_',
)
.\libraries\DatabaseInterface.php#2735: PMA\libraries\dbi\DBIMysqli-
>escapeString(
boolean false,
string '_',
)
.\libraries\navigation\nodes\Node.php#449: PMA\libraries\DatabaseInterface-
>escapeString(string '_')
.\libraries\navigation\NavigationTree.php#289:
PMA\libraries\navigation\nodes\Node->getData(
string 'databases',
integer 0,
string '',
)
.\libraries\navigation\NavigationTree.php#847:
PMA\libraries\navigation\NavigationTree->_buildPath()
.\libraries\navigation\Navigation.php#45:
PMA\libraries\navigation\NavigationTree->renderState()
.\libraries\Header.php#425: PMA\libraries\navigation\Navigation->getDisplay()
.\libraries\Response.php#260: PMA\libraries\Header->getDisplay()
.\libraries\Response.php#273: PMA\libraries\Response->_getDisplay()
.\libraries\Response.php#432: PMA\libraries\Response->_htmlResponse()
PMA\libraries\Response->response()
</code>```

I am trying to host from IIS 8 win 2012 server r2...so I don't know how to fix this error as there is no config.inc file and is there a way to directly connect the tables I have created in workbench to phpmyadmin?

答:
Both MySQL WorkBench and PHPMyAdmin are tools to use MySQL, that is, they connect to the RDBMS and provide a ui to simplify your work with it. So your tables are created in MySQL, not in MySQL WorkBench.

The actual error means that the connection to the RDBMS was unsuccessful. This is why mysqli_real_escape_string gets a boolean argument. You will need to make sure that you connect using the correct:

host

port

username

password

You will need to ensure everything is correct using the PHPMyAdmin configuration.

Body:
I have a bunch of tables and databases created in mysql workbench, but I don't know how to connect them to phpmyadmin. When I start phpmyadmin I get the following error:

Warning in .\libraries\dbi\DBIMysqli.php#556
mysqli_real_escape_string() expects parameter 1 to be mysqli, boolean given

Backtrace

.\libraries\dbi\DBIMysqli.php#556: mysqli_real_escape_string(
boolean false,
string '_',
)
.\libraries\DatabaseInterface.php#2735: PMA\libraries\dbi\DBIMysqli-
>escapeString(
boolean false,
string '_',
)
.\libraries\navigation\nodes\Node.php#449: PMA\libraries\DatabaseInterface-
>escapeString(string '_')
.\libraries\navigation\NavigationTree.php#289:
PMA\libraries\navigation\nodes\Node->getData(
string 'databases',
integer 0,
string '',
)
.\libraries\navigation\NavigationTree.php#847:
PMA\libraries\navigation\NavigationTree->_buildPath()
.\libraries\navigation\Navigation.php#45:
PMA\libraries\navigation\NavigationTree->renderState()
.\libraries\Header.php#425: PMA\libraries\navigation\Navigation->getDisplay()
.\libraries\Response.php#260: PMA\libraries\Header->getDisplay()
.\libraries\Response.php#273: PMA\libraries\Response->_getDisplay()
.\libraries\Response.php#432: PMA\libraries\Response->_htmlResponse()
PMA\libraries\Response->response()

I am trying to host from IIS 8 win 2012 server r2...so I don't know how to fix this error as there is no config.inc file and is there a way to directly connect the tables I have created in workbench to phpmyadmin?