text:
Q: Use AJAX with Zend Framework 2 I want to use AJAX with Jquery in my ZF2 project. Exactly, I want to change select options when an over select value change.
For this, I try to implement AJAX method. I don't find a good tutorial on internet for my problem, but I try to do this with different sources. This is my code :
Controller :
public function init()
{
    parent::init();
    $contextSwitch = $this->_helper->getHelper('contextSwitch');
    $contextSwitch ->addActionContext('getcurrenttime', 'json')->initContext();
}

public function getcurrenttimeAction()
{
    $date = new Zend_Date();
    $chaine = $date->toString();
    $this->_helper->json($chaine);
}

This is my my route configuration :
 'administratif_personnel' => array(
            'type' => 'Literal',
            'priority' => 1000,
            'options' => array(
                'route' => '/administratif/personnel',
                'defaults' => array(
                    'controller' => 'Administratif\Controller\Personnel',
                    'action'     => 'liste',
                ),
            ),
            'may_terminate' => true,
            'child_routes' => array(
                [...]
                'getcurrenttime' => array(
                    'type' => 'Literal',
                    'options' => array(
                        'route' => '/getcurrenttime',
                        'defaults' => array(
                            'controller' => 'Administratif\Controller\Personnel',
                            'action'     => 'getcurrenttime',
                        ),
                    ),
                ),
            ),
        ),

And this is my Jquery code in a view (depend of the same controller) I try to do two different method :


text:
Q: Filtering a loaded kml file in OpenLayers I'm trying to create an interactive search engine (for finding event tickets) of which one of its features is a visual map that shows related venues using OpenLayers.  I have a plethora of venues (3000+) in a kml file that I would like to selectively show a filtered subsection of.  Below is the code I have but when I try to run it has a JavaScript error.  Running firebug and chrome developer tools makes me think that it is not getting passed the parameters I give because it says that the variables are null.  However, I cannot figure out why they are not getting passed.  Any insight is greatly appreciated.
var map, drawControls, selectControl, selectedFeature, select;
$('#kml').load('venuesComplete.kml');
kml=$('#kml').html();
function showVenues(state, city, venue){
    filterStrategy = new OpenLayers.Strategy.Filter({});
    var kmllayer = new OpenLayers.Layer.Vector("KML", {
    strategies: [filterStrategy,
        new OpenLayers.Strategy.Fixed()],
    protocol: new OpenLayers.Protocol.HTTP({
        url: "venuesComplete.kml",
        format: new OpenLayers.Format.KML({
        extractStyles: true,
        extractAttributes: true
        })
    })
    });
    select = new OpenLayers.Control.SelectFeature(kmllayer);
    kmllayer.events.on({
        "featureselected": onFeatureSelect,
        "featureunselected": onFeatureUnselect
    });
    map.addControl(select);
    select.activate();
    filter = new OpenLayers.Filter.Comparison({
        type: OpenLayers.Filter.Comparison.LIKE,
        property: "",
        value: ""
    });
    function clearFilter(){
        filterStrategy.setFilter(null);
    }
    function setFilter(property, value){
        filter.value = value;
        filter.property = property;
        filterStrategy.setFilter(filter);
    }
    var vector_style = new OpenLayers.Style();
    if(venue!=""){
        setFilter('name', venue);
    }else if(city!=""){
        setFilter('description', city);
    }else if(state!=""){
        setFilter('description', state);
    }
    map.addLayer(kmllayer);
    function onPopupClose(evt) {
        select.unselectAll();
    }
    function onFeatureSelect(event) {
        var feature = event.feature;
        var selectedFeature = feature;
        var popup = new OpenLayers.Popup.FramedCloud("chicken",
            feature.geometry.getBounds().getCenterLonLat(),
            new OpenLayers.Size(100,100),
            "
"+feature.attributes.name + "
" + feature.attributes.description +'
'+feature.attributes,
            null,
            true,
            onPopupClose
        );
        document.getElementById('venueName').value=feature.attributes.name;
        document.getElementById("output").innerHTML=event.feature.id;
        feature.popup = popup;
        map.addPopup(popup);
    }
    function onFeatureUnselect(event) {
        var feature = event.feature;
        if(feature.popup) {
            map.removePopup(feature.popup);
            feature.popup.destroy();
            delete feature.popup;
        }
    }
}
function init() {
    map = new OpenLayers.Map('map');
    var google_map_layer = new OpenLayers.Layer.Google(
        'Google Map Layer',
        {type: google.maps.MapTypeId.HYBRID}
    );
    map.addLayer(google_map_layer);
    state="";
    state+=document.getElementById('stateProvDesc').value;
    city="";
    city+=document.getElementById('cityZip').value;
    venue="";
    venue+=document.getElementById('venueName').value;
    showVenues(state,city,'Michie Stadium');
    map.addControl(new OpenLayers.Control.LayerSwitcher({}));
    map.zoomToMaxExtent();

}

A: i would recommend that you see this example of filtering strategy for openlayers.
this snippet from original code:
filter = new OpenLayers.Filter.Comparison({
  type: OpenLayers.Filter.Comparison.BETWEEN,
  property: "when",
  lowerBoundary: startDate,
  upperBoundary: new Date(startDate.getTime() + (parseInt(spanEl.value, 10) * 1000))
});

var flights = new OpenLayers.Layer.Vector("Aircraft Locations", {
  projection: geographic,
  strategies: [new OpenLayers.Strategy.Fixed(), filterStrategy],
  protocol: new OpenLayers.Protocol.HTTP({
    url: "kml-track3b.kml",
    format: new OpenLayers.Format.KML({

...

this is the original kml file, using  feature with  nodes.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Can't find the error: VLOOKUP not returning the value I am working with an excel file and I am trying to "map" some values with the vLookUp function.
The first parameter of the vLookUp function is giving me headaches: The function works with certains values (typed by hand in a text format)...but doesnt work with pre-generated values (the sames ones...but generated from an ERP system..). I checked to make sure that I was looking for "same nature" values ( text vs text ) ...but I can't find out why the first 3 values (typed by hand) are fine... but the last 3 (pre generated) gives me a #N/A error: It has to be a difference of "format" ..but I can't find out where's  the difference...
This is the formula used: =VLOOKUP(D1;$A$1:$B$219;2;FALSE)
The actual file
1008600 379.99      1008600 379.99
1008601 379.99      1008601 379.99
1010600 449.99      1010600 449.99
1010601 449.99      1010601 #N/A
1013600 489.99      1013600 #N/A
1014601 509.99      1014601 #N/A
1015600 569.99
1018603 679.99
1019600 809.99

Thank you !

A: The issue is that you haven't converted you values in column A to numbers. Since the first three values in your lookup range are themselves strings, they are matching the stringified numbers.
In order to fix, click on one of the numbers in column A, press Ctrl+Space to select the entire column, and then click on the exclamation mark and select Convert to number:

After that, you'll notice that your previous values now show errors, so follow the same process to conver them to numbers as well. @nutsch's solution is does not require you to modify your data, so if the type of your data is not crucial, that is a good fix as well :)

A: Using this formula will address the issue highlighted by RocketDonkey
=VLOOKUP(TEXT(D1,"#"),$A$1:$B$219,2,FALSE)

A: This has been a major pain for me as well(Excel is full of stupid assumptions). What I do is copy the entire column to a text editor, change the column to match the lookup column, and copy and paste the data back into the column. This has worked well for me.

A: May I highlight the little noticeable reply that Barry Houdini came with in 2012 above:
    =VLOOKUP(D1&"",$A$1:$B$219,2,FALSE)

that really works (for me in Excel 2010), despite you are dealing with Numbers or a mix of Numbers or Text strings.
Cudos to Barry, you are a truely Houdini


text:
Q: How do application pages compare to ASP.NET web forms? We are considering moving from an ASP.NET Web forms model to SharePoint 2010 Application Pages. The main reason for this is so we can utilise the SharePoint Foundation solutions framework rather than maintaining Web forms separately.
The reason we have used Web forms in the past are as follows:

*

*Integration with third party components (such as K2 Blackpearl) via .NET libraries.

*Process isolation from SharePoint content application pools.

*Capability to connect to custom databases (we have used SQL authentication but are looking to move away from that approach for security reasons).

My two queries around this are:

*

*Are there any limitations around third party libraries that can be utilised in Application Pages?

*Does SharePoint offer any capabilities to ensure that our Application Pages won't impact application pool availability?

I have looked around for an explanation of the limitations and benefits associated with Application Pages, but have only found comparisons with Site Pages.

A: As far as I know:

*

*Only the normal ones for an ASP.NET
application - e.g. Framework
version, CAS policy, etc..

*Yes... but it's the application pool
itself! If you want to isolate your
code, you're looking at having to
put it into it's own application
pool. There's no reason not to do
that - it's a configuration I use sometimes with custom code that is 'risky' - though obviously there's an
overhead to it.


text:
Q: Part of the content of a CollapsingToolbarLayout is getting sticky on top, when used with viewpager and recyclerview I am trying to implement a layout like this:

The issue is that when scrolling up the card touches the toolbar and it does not go up anymore like this:

I want it to scroll up till the viewpager to fills the screen ie, at least the rectangle card, should scroll up beyond the toolbar(Even the tabLayout can also scroll up). But I don't want it to stay sticky at the top.
The main layout is here:
 <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:showIn="@layout/activity_main">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/background_dark"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:id="@+id/toolbarCollapse"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="190dp"
                android:minHeight="190dp"
                android:src="@drawable/ic_launcher_foreground"
                app:layout_collapseMode="parallax" />

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?actionBarSize"
                app:layout_collapseMode="pin" />

        </com.google.android.material.appbar.CollapsingToolbarLayout>

    </com.google.android.material.appbar.AppBarLayout>

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        app:behavior_overlapTop="90dp"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:id="@+id/lin"
            android:nestedScrollingEnabled="false"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <include layout="@layout/debit_card_item" />

            <com.google.android.material.tabs.TabLayout
                android:id="@+id/tabLayout"
                android:layout_width="match_parent"
                android:layout_height="?actionBarSize"
                android:layout_marginTop="40dp"
                android:background="?attr/colorPrimary" />

            <androidx.viewpager.widget.ViewPager
                android:id="@+id/viewPager"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1" />

        </LinearLayout>
    </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

The fragments of the pager are inside a NestedScrollView like this:
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rcView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</androidx.core.widget.NestedScrollView>

Things that I tried:

*

*I have tried to remove the NestedScrollView above the linear layout and added the app:behavior_overlapTop="90dp"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" to the linear layout. but it's still giving me the same output.

*Set the height of the view pager statically(gave the same result).

-->>>EDIT<<<
 3. I thought of a workaround and I am trying to add custom behavior to my LinearLayout in my mainActivity. so as to reduce the margin-bottom and height of the rectangular card. It is giving good results when I fling and close the collapsing toolbar. But when I hold down and scroll, the screen is flickering as shown below:

My Custom behavior is
class CustomHeaderBehavior : AppBarLayout.ScrollingViewBehavior {
    private var mContext: Context

    var height = 0
    var width = 0
    var marginBottom = 0
    var firstTime = true

    constructor(
        context: Context,
        attrs: AttributeSet?
    ) : super(context, attrs) {
        mContext = context
    }

    constructor(
        context: Context?,
        attrs: AttributeSet?,
        mContext: Context
    ) : super(context, attrs) {
        this.mContext = mContext
    }

    override fun layoutDependsOn(
        parent: CoordinatorLayout,
        child: View,
        dependency: View
    ): Boolean {
        return super.layoutDependsOn(parent, child, dependency)
    }

    override fun onDependentViewChanged(
        parent: CoordinatorLayout,
        childP: View,
        dependency: View
    ): Boolean {
        val child = childP.findViewById<RelativeLayout>(R.id.cardParent)
        val maxScroll: Int = (dependency as AppBarLayout).totalScrollRange
        val percentage =
            abs(dependency.y) / maxScroll.toFloat()
        Log.d("Behavx","D.y "+abs(dependency.y)+ " m s "+maxScroll+ " p "+percentage)
        val lp: LinearLayout.LayoutParams =
            child.layoutParams as LinearLayout.LayoutParams
        if(firstTime){
            height = child.height
            width = child.width
            marginBottom = lp.bottomMargin
            firstTime = false
        }
        Log.d("Behaviour", "P "+ ((1-(percentage))*100).toString() +" H " +height+ " U H " +(height*(((1-(percentage))*100))/100) )
//        lp.bottomMargin = ((marginBottom*(((1-(percentage))*100))/100) - ((height*((((percentage))*100))/100))).toInt()
        lp.bottomMargin = ((marginBottom*(((1-(percentage))*100))/100)).toInt() //updating margin bottom
        lp.height = ((height*(((1-(percentage))*100))/100)).toInt() //updating height

        child.layoutParams = lp
        child.alpha = 1 - (percentage * 4)
        return super.onDependentViewChanged(parent, childP, dependency)

    }

    companion object {
        fun getToolbarHeight(context: Context): Int {
            var result = 0
            val tv = TypedValue()
            if (context.theme.resolveAttribute(R.attr.actionBarSize, tv, true)) {
                result = TypedValue.complexToDimensionPixelSize(
                    tv.data,
                    context.resources.displayMetrics
                )
            }
            return result
        }
    }
}

The flicker seems to be happening because the dependency.y is becoming wrong randomly, while I hold down and scroll and update the height of the card(if I only update the margin flicker is not occurring). For some reason controlling the width is happening smoothly. But unfortunately, that's not helping me here.

*I also tried to do something similar by adding an offsetChangedListener to the app bar like this:
appBar.addOnOffsetChangedListener(OnOffsetChangedListener { appBarLayout, verticalOffset ->
    if (abs(verticalOffset) == appBarLayout.totalScrollRange) {
        //  Collapsed
        cardParent.visibility = View.GONE
    } else {
        //Expanded
        cardParent.visibility = View.VISIBLE
    }
})
But I am still getting the flicker
I have added the sample project here:
github link
The custom behavior is pushed to a new branch custom_behaviour

A: Finally Solved my issue. I added the card inside the collapsing layout like Kalyans answer and added a dummy view and a -ve margin to the card to have the overlap behavior effect like
<com.google.android.material.appbar.CollapsingToolbarLayout
        android:id="@+id/toolbarCollapse"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?actionBarSize"
            app:layout_collapseMode="pin" />

        <View
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:background="#000" />

        <include
            layout="@layout/debit_card_item"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="-90dp"
            app:layout_collapseMode="parallax" />
    </LinearLayout>

</com.google.android.material.appbar.CollapsingToolbarLayout>

I have also pushed my code to the github.

A: In order to achieve that effect, the card layout should be inside the collapsing toolbar.
Try replacing this:
<ImageView
            android:layout_width="match_parent"
            android:layout_height="190dp"
            android:minHeight="190dp"
            android:src="@drawable/ic_launcher_foreground"
            app:layout_collapseMode="parallax" />

with:
<include layout="@layout/debit_card_item"
            android:layout_width="match_parent"
            android:layout_height="190dp"
            android:minHeight="190dp"
            android:layout_marginTop="32dp"
            android:layout_marginBottom="72dp"
            app:layout_collapseMode="parallax"/>

and remove <include layout="@layout/debit_card_item" /> in the NestedScrollView.
Hope this helps.


text:
Q: VirtualBox error "Kernel driver not installed" I can't seem to make VirtualBox to work, I've installed it and reinstalled by 3 ways: Terminal, Ubuntu Software Center and VirtualBox's official web site installation and I keep getting the same kernel error.

This command
sudo apt-get install virtualbox-dkms

Returns
virtualbox-dkms is already the newest version

I tried what the error tells me:
sudo /etc/init.d/vboxdrv setup

but then I tells me that DKMS is actually NOT installed (which is a contradiction).
If anyone has encountered the same problem and actually solved it please tell me and explain me step by step 'cause I'm new to Linux.

A: First, make sure that the DKMS package has built and is loaded into the kernel.
lsmod | grep box

and make sure the results look sensible . (there should me some module loaded)
If it's there then your good to go, if not then the easiest way to build DKMS modules is to simply restart. Once your running again lsmod to make sure your module loaded.
Also, it seems your doing this in a really odd way.
The way I do it is:
get the deb from https://www.virtualbox.org/wiki/Linux_Downloads
dpkg -i DownloadedVirtualBoxFile.deb

if there are any errors then
apt-get -f install

to resolve dependencies.
Then just run Virtual Box and let it tell you the next step. You should get an error and instructions about adding your user to the virtual box group.
I would recommend starting by completely removing VirtualBox from your system.
dpkg --get-selections | grep box

to get a list then
dpkg --remove virtualbox-4.2

to remove them (only virtual box stuffs).
Next install from the link above using the deb package.

A: Fixed! I've managed to fix it by typing in terminal:
sudo apt-get install linux-headers-$(uname -r)

A: If you are stil having issues with the kernel error try this for Ubuntu 12.10 and Virtualbox 4.1.18.
sudo apt-get install linux-headers-3.5.0-19-generic
sudo dpkg-reconfigure virtualbox
sudo dpkg-reconfigure virtualbox-dkms


text:
Q: locating element explicitly waiting and without wait what's difference? The question is about selenium webdriver's explicitly wait feature which is same locating action with a timeout. Webdriver waits element to be visible or present. In my situation, I locate elements with explicit waiting and without it. When it is without the explicit wait, it founds and assigns it. But below, I also try to locate element explicitly waiting, that variable is unassigned, and in such form passes to for iteration, and my for iteration gives UnboundLocalError
I know that error is not selenium but python based. I can get rid of that error by using instead of pass y_priceNewProds = x_priceNewProds` but I need to understand why selenium webdriver cannot locate the element with wait if it already a line above found it. There must be cookies also.
code is below;
import pandas as pd
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

#reading from csv file url-s
def readCSV(path_csv):
    df=pd.read_csv(path_csv)
    return df

fileCSV=readCSV(r'C:\Users\Admin\Downloads\urls.csv')
length_of_column_urls=fileCSV['linkamazon'].last_valid_index()

def create_driver():
    chrome_options = Options()
    chrome_options.headless = True
    chrome_options.add_argument("start-maximized")
    # options.add_experimental_option("detach", True)
    chrome_options.add_argument("--no-sandbox")
    chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
    chrome_options.add_experimental_option('excludeSwitches', ['enable-logging'])
    chrome_options.add_experimental_option('useAutomationExtension', False)
    chrome_options.add_argument('--disable-blink-features=AutomationControlled')

    webdriver_service = Service(r'C:\pythonPro\w_crawl\AmznScrpBot\chromedriver.exe')
    driver = webdriver.Chrome(service=webdriver_service, options=chrome_options)

    return driver

#going to urls 1-by-1
def goToUrl_Se(driver):
    global counter
    counter = 0
    for i in range(0, length_of_column_urls + 1):
        xUrl = fileCSV.iloc[i, 1]
        print(xUrl,i)
        # going to url(amazn) via Selenium WebDriver
        driver.get(xUrl)
        parse_data()
        counter+=1
    driver.quit()

#fetch-parse the data from url page
def parse_data():
    global asin, title, bookform, priceNewProd
    wait=WebDriverWait(driver,timeout=20)

    try:
        #trying code snippets where locating elements occur by XPATH, in some ofthem
        #there is also WebDriver explicit wait, that element has both methods
        #with presence_of element wait method and without explicit wait method. Just trying to understand
        #why sometimes elements cannot be located on page
        y_data_index=wait.until(EC.presence_of_element_located((By.XPATH,"//div[@data-index='1']")))
        print(y_data_index.text,'y_index')
        x_data_index=wait.until(EC.visibility_of_element_located((By.XPATH,"//div[@data-index='1']")))
        print(x_data_index.text,'x_index')
        x_titles=driver.find_elements(By.XPATH,'//span[contains(@class,"a-size-medium")]')
        x_bookforms = driver.find_elements(By.XPATH,'//div[contains(@class,"a-section a-spacing-none a-spacing-top-micro s-price-instructions-style")]//div[contains(@class,"a-row a-size-base a-color-base")]//a[contains(@class,"a-size-base a-link-normal puis-medium-weight-text s-underline-text s-underline-link-text s-link-style s-link-centralized-style a-text-bold")]')
        x_priceNewProds = driver.find_elements(By.XPATH,'//div[contains(@class,"a-row a-size-base a-color-base")]//span[contains(@data-a-color,"base")]//span[contains(@class,"a-offscreen")][1]')
        y_priceNewProds=wait.until(EC.visibility_of_all_elements_located((By.XPATH,'//div[contains(@class,"a-row a-size-base a-color-base")]//span[contains(@data-a-color,"base")]//span[contains(@class,"a-offscreen")][1]')))
    except:
        pass

    for i in range(len(x_titles)):
        x_title=x_titles[i].text
        x_priceNewProd = x_priceNewProds[i].text
        print(x_priceNewProd)
        y_priceNewProd=y_priceNewProds[i].text
        print(y_priceNewProd)
        try:
            x_bookform=x_bookforms[i].text
            print(x_bookform)
        except:
            x_bookform='-'
        title = x_title
        bookform = x_bookform
        priceNewProd = x_priceNewProd
        write_to_csv()

def write_to_csv():
    if counter==0:
        df=pd.DataFrame({'Products':title,'Bookform':bookform,'Price':priceNewProd},index=[0])
        wr=df.to_csv('results_new00.csv',index=False,mode='w')
    else:
        df=pd.DataFrame({'Products':title,'Bookform':bookform,'Price':priceNewProd},index=[0])
        wr=df.to_csv('results_new00.csv',index=False,mode='a',header=False)

driver=create_driver()
goToUrl_Se(driver)

 y_priceNewProd=y_priceNewProds[i].text UnboundLocalError: local variable 'y_priceNewProds' referenced before assignment

A: Since you didn't share all the code including the link we can't know what exactly happens there, but I guess that this line
wait.until(EC.visibility_of_all_elements_located((By.XPATH,'//div[contains(@class,"a-row a-size-base a-color-base")]//span[contains(@data-a-color,"base")]//span[contains(@class,"a-offscreen")][1]')))

Throws exception since that element(s) are / is not visible.
This is why y_priceNewProds remains not assigned any value.
While if you use simple driver.find_elements method it can find those elements since they are existing but, again, not visible.
UPD
After you shared the link I tested that and now I can say: Yes, I was right!
Those elements are not visible.
The following code throws TimeoutException
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
options = Options()
options.add_argument("start-maximized")

webdriver_service = Service('C:\webdrivers\chromedriver.exe')
driver = webdriver.Chrome(service=webdriver_service, options=options)
url = 'https://www.amazon.com/s?i=stripbooks&bbn=1&rh=n%3A1%2Cp_n_feature_eighteen_browse-bin%3A8622846011&dc&fs=true&ds=v1%3AgAO0%2BZc%2BC6RthRkqyWzOHmDVufv7JbuCK96Grvjle68&qid=1665559431&rnid=8622845011&ref=sr_nr_p_n_feature_eighteen_browse-bin_5'
driver.get(url)
wait = WebDriverWait(driver, 20)

m_list = wait.until(EC.visibility_of_all_elements_located((By.XPATH, '//div[contains(@class,"a-row a-size-base a-color-base")]//span[contains(@data-a-color,"base")]//span[contains(@class,"a-offscreen")][1]')))
print(m_list)

UPD2
But if you will take the direct parent of that element it will work correctly since it is visible.
For the following code:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
options = Options()
options.add_argument("start-maximized")

webdriver_service = Service('C:\webdrivers\chromedriver.exe')
driver = webdriver.Chrome(service=webdriver_service, options=options)
url = 'https://www.amazon.com/s?i=stripbooks&bbn=1&rh=n%3A1%2Cp_n_feature_eighteen_browse-bin%3A8622846011&dc&fs=true&ds=v1%3AgAO0%2BZc%2BC6RthRkqyWzOHmDVufv7JbuCK96Grvjle68&qid=1665559431&rnid=8622845011&ref=sr_nr_p_n_feature_eighteen_browse-bin_5'
driver.get(url)
wait = WebDriverWait(driver, 20)

m_list = wait.until(EC.visibility_of_all_elements_located((By.XPATH, '//div[contains(@class,"a-row a-size-base a-color-base")]//span[contains(@data-a-color,"base")]')))
print(len(m_list))

the output is:
27


text:
Q: change listview row background based on a choice from other activity: Following my privious qustion that you can see here:
How to create custom listview for android with margins between 2 elements?
I have made some progress due to the help I recived here.
So my state right now is:
http://i.stack.imgur.com/yK5to.jpg
pressing on the blue part of one of the tasks pops the following  color plate activity:
http://i.stack.imgur.com/UWmIg.jpg
all the 5 colors here are buttons, what i need to do is to check what color was
pressed and then change the background drawing of the task that opened the color plate activity.
Only that i don't understand how it's done, any suggestions?
in the color plate activity i have an "setOnClickListener" function for each one of the buttons.
here is the java code for my list activity:
public class SkyGiraffeAppActivity extends Activity implements AdapterView.OnItemClickListener, View.OnClickListener {
// All static variables
static final String TAG = "SkyGiraffeAppActivity";
// XML node keys
static final String KEY_TASK = "task"; // parent node
static final String KEY_ID = "id";
static final String KEY_TITLE = "title";
static final String KEY_DATE = "date";
static final String KEY_TIME = "time";
static final String KEY_PRIORITY  = "priority";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ListView list = new ListView(this);
    list.setDivider(null);
    list.setDividerHeight(0);
    setContentView(list);

    final ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();
    Log.e(TAG, "Created Array");

    XMLParser parser = new XMLParser();

    Log.e(TAG, "Getting xml from raw folder");
    InputStream xml = getResources().openRawResource(R.raw.taskslists); // getting XML

    Log.e(TAG, "reading xml file to string");
    String sxml = parser.readTextFile(xml);

    Log.e(TAG, "creating dom element from string");
    Document doc = parser.getDomElement(sxml); // getting DOM element

    Log.e(TAG, "getting node list of all the elements");
    NodeList nodeList = doc.getElementsByTagName(KEY_TASK);

    Log.e(TAG, "looping through all the elements");
    for (int i = 0; i < nodeList.getLength(); i++)
    {
        // creating new HashMap
        HashMap<String, String> map = new HashMap<String, String>();
        Element e = (Element) nodeList.item(i);
        Log.e(TAG, "element number: " + i + " added to hash map");
        // adding each child node to HashMap key => value
        map.put(KEY_ID, parser.getValue(e, KEY_ID));
        map.put(KEY_TITLE, parser.getValue(e, KEY_TITLE));
        map.put(KEY_DATE, parser.getValue(e, KEY_DATE));
        map.put(KEY_TIME, parser.getValue(e, KEY_TIME));
        map.put(KEY_PRIORITY, parser.getValue(e, KEY_PRIORITY));

        // adding HashList to ArrayList
        menuItems.add(map);
    }

    // Adding menuItems to ListView
    ListAdapter adapter = new SimpleAdapter(this, menuItems, R.layout.row,
          new String[] { KEY_TITLE, KEY_DATE, KEY_TIME, KEY_PRIORITY},
          new int[]    { R.id.text_title, R.id.text_date, R.id.text_time ,R.id.image_priority}){

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View row =  super.getView(position, convertView, parent);
            View left = row.findViewById(R.id.bchangecolor);
            left.setTag(position);
            left.setOnClickListener(SkyGiraffeAppActivity.this);
            View right = row.findViewById(R.id.barrow);
            right.setTag(position);
            right.setOnClickListener(SkyGiraffeAppActivity.this);

            ImageView prioriy = (ImageView) row.findViewById(R.id.image_priority);

            Log.e(TAG, "pririty number: " + menuItems.get(position).get(KEY_PRIORITY));
            int number = Integer.valueOf(menuItems.get(position).get(KEY_PRIORITY));
            switch ( number )
            {
            case 1:
                prioriy.setImageResource(R.drawable.priority_first);
                break;
            case 2:
                prioriy.setImageResource(R.drawable.priority_second);
                break;
            case 3:
                prioriy.setImageResource(R.drawable.priority_third);
                break;
            case 4:
                prioriy.setImageResource(R.drawable.priority_fourth);
                break;
            case 5:
                prioriy.setImageResource(R.drawable.priority_fifth);
                break;
            default:
                prioriy.setImageResource(R.drawable.priority_first);
            }

            return row;
        }
    };

    list.setAdapter(adapter);
    list.setOnItemClickListener(this);
}

public void onClick(View v) {
     switch(v.getId()) {
        case R.id.bchangecolor:
            Log.e(TAG, "pressed the color change button on" + v.getId());
            startActivity(new Intent(getApplicationContext(),TaskColorChangeActivity.class));
            break;
        case R.id.barrow:
            Log.e(TAG, "pressed the arrow button on" + v.getId());
            Intent intent = createIntentwithExtra(v);
            startActivity(intent);
            break;
        default:
            break;
        }
}

public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    Log.e(TAG, "pressed the row itself" + v.getId());
    Intent intent = createIntentwithExtra(v);
    startActivity(intent);
}

public Intent createIntentwithExtra(View v)
{
    Intent intent = new Intent(getApplicationContext(), SingleMenuItemActivity.class);
    String title = ((TextView) v.findViewById(R.id.text_title)).getText().toString();
    String date = ((TextView) v.findViewById(R.id.text_date)).getText().toString();
    String time = ((TextView) v.findViewById(R.id.text_time)).getText().toString();
    intent.putExtra(KEY_TITLE, title);
    intent.putExtra(KEY_DATE, date);
    intent.putExtra(KEY_TIME, time);

    return intent;
}}

and my color plate activity:
public class TaskColorChangeActivity extends Activity
{
static final String TAG = "TaskColorChangeActivity";
Button bBlue, bGreen, bYellow, bOrange, bRed;

protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.colorplate);

    bBlue = (Button) findViewById(R.id.bblue);
    bGreen = (Button) findViewById(R.id.bgreen);
    bYellow = (Button) findViewById(R.id.byellow);
    bOrange = (Button) findViewById(R.id.borange);
    bRed = (Button) findViewById(R.id.bred);

    bBlue.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
        }
    });
    bGreen.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
        }
    });
    bYellow.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
        }
    });
    bOrange.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
        }
    });
    bRed.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
        }
    });
}}

it would be nice if someone with permissions changed the links to the actual images.
Thanks.

A: You can return some data from you activity to your parent activity
( How to return a result (startActivityForResult) from a TabHost Activity? )
You can return what color you've choosen and regarding this data you can do whatever you want.


text:
Q: Evaluate: $ \sum_{i}^{n+1} n !$ $ \sum_{i}^{n+1} n !$
This sum is suppose to equal $(n+1)!$.  For some reason I don't get why.  Can anyone explain?
Taken directly from http://www.inchmeal.io/2016/01/15/how-to-prove-it-ch-7-sec-1.html q22(a) last part.

A: Hint: All the terms are the same; $n!$ does not depend on $i$.

A: Example: $\sum_{1}^{5}2 = 5 \times 2 = 10$; $\sum_{1}^{n}x = n \times x = nx$ for all integers $n \geq 1$ and all real $x$.
Clearly, we have
$$
\sum_{1}^{n+1}n! = (n+1)\times n! = (n+1)!.
$$


text:
Q: PyMySQL does not connect from Cron but from Console I have a script that connects to a MySQL DB via pyMySQL.
It works like a charm when I execute it manually from the console, but gives this output when I run this cronjob:
@reboot sudo python3 /var/www/html/ls/src/AppBundle/Command/crawl.py true > /tmp/listener.log 2>&1
Result:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py", line 890, in connect
(self.host, self.port), self.connect_timeout)
 File "/usr/lib/python3.5/socket.py", line 711, in create_connection
raise err
File "/usr/lib/python3.5/socket.py", line 702, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Why is that? I followed all of this https://stackoverflow.com/a/15684341/1092632 w/out any success.
Any hint appreciated!
Edit
Things I tried:
connect = pymysql.connect(host=constants.HOST,
                          user=constants.USERNAME,
                          passwd=constants.PASSWORD,
                          db=constants.DATABASE,
                          charset='utf8mb4',
                          port=constants.PORT,
                          unix_socket=constants.SOCKET,
                          cursorclass=pymysql.cursors.DictCursor)

constants.py
# MySQL #
HOST = '127.0.0.1' // Localhost, 127.0.0.1 and public IP of Server (having bind to 0.0.0.0
USERNAME = 'admin'
PASSWORD = 'XXX'
DATABASE = 'ls_base'
PORT = '3306' // With and without ''
SOCKET = '/var/run/mysqld/mysqld.sock' // File exists

A: This problem could be either caused by
1. server configuration
or by your
2. python code.
for point 2, to be sure to exclude your code from the error, try this:
import MySQLdb
def dbconnect():
    try:
        db = MySQLdb.connect(
            host='localhost',
            user='root',
            passwd='XXX',
            db='myDB'
        )
    except Exception as e:
        sys.exit(e)
    return db
print dbconnect()

this code runs whit cron on a STOCK, RHEL server:
* * * * * root /var/www/html/myApp/stopClock/stopClock.py

If this does not work, and you get the same error, the problem is your server cron config:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/var/www/html/myApp

This is what I use. and of course the Shebang in my first line of code:
#!/usr/bin/env python

A: I too had errno 111 when my python3 code connected to my localhost database from a cron @reboot execution. The python3 code would run fine when executing from shell. After much debugging I found out that the database connection was being made too soon. I added this to my code:
import subprocess

while subprocess.Popen('service mysqld status', shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8').find('Active: active') == -1:
     sleep(1)
#once mysql is ready it will break out of while loop and continue to
connection = pymysql.connect(host='localhost'............the rest of your code

Hope this helps.


text:
Q: How to make notification box float in the center Using Bulma css framework, I try to make the notification box popup at about the center of the page, without interrupting existing data (it is a notification that pops for 3 seconds and then it should disappear). For example: 2 images on top of each other(snippet 1), and I want the notification box to float on top of them without pushing any content(snippet 2)

<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css" rel="stylesheet" />

<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css" rel="stylesheet" />

    <button class="delete"></button> Primar lorem ipsum dolor sit amet, consectetur adipiscing elit lorem ipsum dolor. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam
    gravida purus diam, et dictum felis venenatis efficitur. Sit amet, consectetur adipiscing elit

A: Simply give the notification position: absolute along with a z-index which is higher than the element you want it to sit on top of (1 will likely work fine):

.notification.is-primary {
  position: absolute;
  z-index: 1;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css" rel="stylesheet" />

    <button class="delete"></button> Primar lorem ipsum dolor sit amet, consectetur adipiscing elit lorem ipsum dolor. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam
    gravida purus diam, et dictum felis venenatis efficitur. Sit amet, consectetur adipiscing elit

A: I created a CSS rule like:
.top-of-the-world{
   position: absolute !important;
   z-index: 100 !important;
}

That way I do not alter Bulma's rules.
Then I added the class top-of-the-world to my notification
.notification.top-of-the-world


text:
Q: Hiding unimportant getter methods from swagger UI in Java I have two fields in my class startDate and endDate of LocalDateTime. Internally, these need to be returned as Optional<ZonedDateTime>, while in the query they are provided as LocalDateTimes.
@ApiModel
public class SearchQuery {

    private static final ZoneId UTC_TIMEZONE = ZoneId.of("UTC");

    @ApiParam(value = "Start date and time of the requested time frame.", example = "2019-06-01T12:30", defaultValue = "0000-01-01T00:00")
    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
    private LocalDateTime startDate;

    @ApiParam(value = "End date and time of the requested time frame.", example = "2019-06-30T23:59", defaultValue = "9999-12-31T23:59")
    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
    private LocalDateTime endDate;

    public LocalDateTime getStartDate() {
        return this.startDate;
    }

    public LocalDateTime getEndDate() {
        return this.endDate;
    }

    public Optional<ZonedDateTime> getStartDateWithTimezone() {
        return Optional.ofNullable(startDate)
            .map(date -> date.atZone(UTC_TIMEZONE));
    }

    public Optional<ZonedDateTime> getEndDateWithTimezone() {
        return Optional.ofNullable(endDate)
            .map(date -> date.atZone(UTC_TIMEZONE));
    }
}

Swagger (Springfox v2.9.2) now shows the needed fields but also endDateWithTimezone.present and startDateWithTimezone.present, which are of course both not needed as parameters:

I have been trying for some time now to find ways to hide these from my swagger documentation. How can I do this?

A: I believe this might be a duplicate?: https://stackoverflow.com/a/41677559/8932643
Ronny Shibley answers:

For Parameters
public void getApi(@ApiIgnore String param){}

@ApiModelProperty(hidden="true")
public String paramInsideClass

A: The solution was quite simple in the end.
You have to use the annotation @ApiModelProperty(hidden = true) directly on the getter you want to hide.

A: rename getStartDateWithTimezone to findStartDateWithTimezone


text:
Q: Como cambiar el contenido de un div desde un menú? React tengo un componente, que tiene dos div un panel y un contenido y querio cambiar el contenido de acuerdo al panel
Cada boton es un componente y cada casa es otro

function Panel() {
    const changemenu = () =>{

    }
    return (

                <Button>Step 1</Button>
                <Button>Step 2</Button>
                <Button>Step 3</Button>

                <House name='House 1' img='1'/>
                <House name='House 2' img='1'/>
                <House name='House 3' img='1'/>
                <House name='House 4' img='1'/>
                <House name='House 5' img='1'/>

    );
}

Quisiera poder mostrar solo la info correspondiente a ese menú
Sabrá alguien si se pude hacer con css o  donde puedo encontrar la información para usar una función de js en el componente

A: Yo te recomendaría que usaras alguna librería que ya tiene eso implementado como material ui el componente tabs.
De todas maneras, si lo quieres hacer a tu manera, lo haría así:
const houses = [{name: "House1", step: 1, img: "1"},{name: "House2", step: 1, img: "1"},{name: "House3", step: 2, img: "1"},{name: "House4", step: 3, img: "1"}];

function Panel() {
    const [filteredHouses, setFilteredHouses] = useState([]);
    const [step, setStep] = useState(1);

    useEffect(()=>{
        setFilteredHouses(houses.filter(x => x.step === step))
    },[step])

    const changemenu = (step) =>{
        setStep(step);
    }
    return (

                <Button onClick={()=> changemenu(1)}>Step 1</Button>
                <Button onClick={()=> changemenu(2)}>Step 2</Button>
                <Button onClick={()=> changemenu(3)}>Step 3</Button>

                {filteredHouses.map((x,index)=>{
                     return <House key={index} name={x.name} img={x.img} />
                })}

    );
}

También debes de Agregar la función Onclick en el componente Button para llamar al evento
function Button(props){
return(
    <button
    className="button" onClick={props.onClick} >
        {props.children}
    </button>
);
}


text:
Q: Can many "regular" animals interact with magical people, creatures, and places in Harry Potter world? This question was inspired by another question on animals in the Harry Potter world. That question was about animals that were half-magical and half-muggle.
Which animals that look and act mugglish (is that a word?) can interact with magical people, beasts, and places?
I am specifically not asking about truly magical creatures that had interacted with muggles incidentally. So that leaves out Thunderbirds, phoenixes, occamies, hippogriffs, dragons, and other such beasts.
I am asking about animals like owls which can fly from a magical place like Hogwarts to a muggle place like London and back.
Can other muggle creatures go from the muggle world to the magical world and back?
Edit to clarify: I am not asking about situations where somebody brings an animal to a magical place, such as when Neville brings his toad, Trevor, to Hogwarts. I asking about where animals can freely interact with both magical and muggle places on their own. We know muggle humans can't, because otherwise they would see Hogwarts or enter Platform 9 3/4. But we don't see incidents in the stories where muggle animals try to go to magical places on their own and are prevented from doing so because of charms and spells.
Edit to clarify: Although an animagus like Peter Pettigrew can transform into a rat and go from magical places to muggle places, I am only asking about normal animals. It seemed obvious to me that animagi could go where they wish in either human or animal form. (Thanks to Reya for pointing that out.)

A: Yes; or at least you would think so
There has been no mention or reference that "muggle" animals are in any way prohibited or barred from interacting with the magical world, let alone that it would be inconceivably impractical to enforce such a limitation.
In fact, here's Newt Scamander talking about how difficult it is to keep the 30 or so magical species secret from the muggle world:

The International Confederation of Wizards argued the matter out at their famous summit meeting of 1692. No fewer than seven weeks of sometimes acrimonious discussion between wizards of all nationalities were devoted to the troublesome question of magical creatures. How many species would we be
  able to conceal from Muggle notice and which should they be? Where and how should we hide them? The debate raged on, some creatures oblivious to the fact that their destiny was being decided, others contributing to the debate.
   At last agreement was reached. Twenty-seven species, ranging in size from dragons to Bundimuns, were to be hidden from Muggles so as to create the illusion that they had never existed outside the imagination. This number was increased over the following century, as wizards became more confident in their
  methods of concealment. In 1750, Clause 73 was inserted in the International Statute of Wizarding Secrecy, to which wizard ministries worldwide conform today:
Each wizarding governing body will be responsible for the concealment, care and control of all magical beasts, beings and spirits dwelling within its territory's borders. Should any such creature cause harm to, or draw the notice of, the Muggle community, that nation's wizarding governing body will be subject to discipline by the International Confederation of Wizards. -Fantastic Beasts and Where to Find Them, Introduction by Newt Scamander (xiv - A BRIEF HISTORY OF MUGGLE AWARENESS OF FANTASTIC BEASTS).

and continued:

It would be idle to deny that there have been' occasional breaches of Clause 73 since it was first put in place. Older British readers will remember the Ilfracombe Incident of 1932, when a rogue Welsh Green dragon swooped down upon a
  crowded beach full of sunbathing Muggles. Fatalities were mercifully prevented by the brave actions of a holidaying wizarding family (subsequently awarded Orders of Merlin, First Class}, when they immediately performed the largest batch of Memory Charms this century on the inhabitants of Ilfracombe, thus narrowly averting catastrophe.-Fantastic Beasts and Where to Find Them, Introduction by Newt Scamander (xvi - MAGICAL BEASTS IN HIDING).

Now imagine how difficult it would be to prevent animals going the other way, from the muggle world into the wizarding world, and vice versa.
I'm sure there are examples somewhere, but it's difficult to pick for the following reasons:

*

*Fully magical places - places which have become unplottable, hidden or just generally constricted to magical only - are usually too far from "muggle" locations for "normal" animals to venture in and out from.

*The books are written from the perspective of Harry Potter, unless he specifically notices or mentions these things, it's hard to get examples


text:
Q: How to run two processes at once JAVA How to run a process in background while another process will be a User GUI which will manipulate all gathered information in background?

A: You Could...
Use a Thread, which will allow you to execute code in the background.
See Lesson: Concurrency for more details.
You could even use an Executor of some kind if you have a number of tasks you want to run...
You Could...
Use a SwingWorker if you are using Swing and want to run long running process in the background and safely interact with the UI
See Worker Threads and SwingWorker for more details
You Could
Make use of the concurrency support in JavaFX if that's what you're using.  See Concurrency in JavaFX for more details...

A: You are looking for so called Threads. They can be used in various ways in Java: http://docs.oracle.com/javase/tutorial/essential/concurrency/
In case of the GUI you also have to use the SwingUtilities with invokeNow/invokeLater to update the GUI from within a thread.


text:
Q: probleme with fetch EAGER I work with jpa hibernate
I try to develop three class :
but I have error related to type of fetch EAGER
@Entity
public class Request implements Serializable{

    /**
     *
     */
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer requestId;
    private String detailRequest;

    private String place;

        @ManyToMany(mappedBy="requests",fetch=FetchType.EAGER)
    private List<Expertise> expertises;

...
//getter , setter and constructor
}

the Expertise .java
@Entity
public class Expertise implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 1L;
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
    private int idExpertise;
    private String seniority;
    @ManyToMany(mappedBy="expertises",fetch=FetchType.EAGER)
    private List<TechnicalSkill> technicalSkills=new ArrayList<TechnicalSkill>();

    @ManyToMany
    private List<Request> requests=new ArrayList<Request>();

....
//getter , setter and constructor
}

the TechnicalSkill.java
@Entity
public class TechnicalSkill implements Serializable{

    /**
     *
     */
    private static final long serialVersionUID = 1L;

     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
    private int idTechnicalSkill;
    private String description;
    @ManyToMany
    private List<Expertise> expertises=new ArrayList<Expertise>();

...
//getter , setter and constructor
}

but when I run this class in jboss  this error is diplayed
Caused by: org.hibernate.HibernateException: cannot simultaneously fetch multiple bags

A: Its because of the Eager fetch in Expertise entity for
  @ManyToMany(mappedBy="expertises",fetch=FetchType.EAGER)
    private List<TechnicalSkill> technicalSkills=new ArrayList<TechnicalSkill>();

Remove the Eager fetch and it will work.


text:
Q: ldap_add: no such object (32) while setting up ldap on centos 7? I am setting OpenLDAP on centos7 and seem to encounter an error while adding the first user.
[root@web1 ~]# ldapadd -x -W -D "cn=Manager,dc=web1,dc=com" -f /root/rootuser.ldif
    Enter LDAP Password:
    adding new entry "uid=ldapuser,ou=People,dc=web1,dc=com"
    ldap_add: No such object (32)
            matched DN: dc=web1,dc=com

I have added the base.ldif file successfully and need to add the people & group files now.
[root@web1 ~]# ldapadd -x -W -D "cn=Manager,dc=web1,dc=com" -f /root/base.ldif
Enter LDAP Password:
adding new entry "dc=web1,dc=com"
ldap_add: Already exists (68)

Base file:
[root@web1 ~]# cat base.ldif
dn: dc=web1,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: web1 com
dc: web1

dn: cn=Manager,dc=web1,dc=com
objectClass: organizationalRole
cn: Manager
Description: Directory Manager

dn: ou=People,dc=web1,dc=com
objectClass: organizationalUnit
ou: People

dn: ou=Group,dc=web1,dc=com
objectClass: organizationalUnit
ou: Group

Rootuser.ldif
[root@web1 ~]# cat rootuser.ldif
dn: uid=ldapuser,ou=People,dc=web1,dc=com
uid: ldapuser
cn: ldapuser
sn: ldapuser
mail: ldapuser@web1.com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {crypt}$1$0ck/7MvX$VkTriVqcFOnsoIhF1TzTt1
shadowLastChange: 17223
shadowMin: 0
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 1003
gidNumber: 1004
homeDirectory: /home/ldapuser

RootGroup.ldif
[root@web1 ~]# cat rootgroup.ldif
dn: cn=ldapuser,ou=Group,dc=web1,dc=com
objectClass: posixGroup
objectClass: top
cn: ldapuser
userPassword: {crypt}x
gidNumber: 1004

Ldapsearch results for dc
[root@web1 ~]# ldapsearch -hlocalhost -x -sbase | grep '^dn:'
dn: dc=web1,dc=com

I am not able to determine what is causing this error.


text:
Q: Passing Class arguments through RMI I'm supposed to invoke a method requiring a Class<T> argument on a remote object through RMI. I have to admit I'm not very familiar with RMI or CORBA.
The target method interface implemented by the remote object is:
public <T extends Enum<? extends Foo<?>> > void doSomething(String str, Class<T> enumClazz);

When I pass a class as argument in the RMI call, I get this exception:
Caused by: java.lang.NoSuchMethodException: $Proxy196.doSomething(java.lang.String, javax.rmi.CORBA.ClassDesc)
    at java.lang.Class.throwNoSuchMethodException(Class.java:284)
    at java.lang.Class.getMethod(Class.java:855)

Why is the object transformed to a javax.rmi.CORBA.ClassDesc? FYI the Java EE container is a WebSphere Application server 8.0.0.5.


text:
Q: Custom Filter causes IndexOutOfBoundException in android's listview Hello i have tried to override the GetFilter function in my custom adapter class, when the code hit the notifyDataSetChanged(); it produces IndexOutOfBoundException
Here is the Adapter's Code
public class SelectUserAdapter extends ArrayAdapter<UserWithCheckbox> implements
    Filterable {
private ArrayList<UserWithCheckbox> UsersLits;
private Context c;
LayoutInflater vi;

public SelectUserAdapter(Context context, int textViewResourceId,
        ArrayList<UserWithCheckbox> countryList) {
    super(context, textViewResourceId, countryList);
    this.UsersLits = new ArrayList<UserWithCheckbox>();
    this.UsersLits.addAll(countryList);
    c = this.getContext();
}

private class ViewHolder {
    TextView code;
    CheckBox name;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder = null;
    Log.v("Users View", String.valueOf(position));

    if (convertView == null) {
        vi = (LayoutInflater) this.getContext().getSystemService(
                Context.LAYOUT_INFLATER_SERVICE);
        convertView = vi.inflate(R.layout.users_select_list_item, null);

        holder = new ViewHolder();
        holder.code = (TextView) convertView.findViewById(R.id.Name);
        holder.name = (CheckBox) convertView.findViewById(R.id.IsSelected);
        convertView.setTag(holder);

        holder.name.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                CheckBox cb = (CheckBox) v;
                UserWithCheckbox User = (UserWithCheckbox) cb.getTag();
                Toast.makeText(
                        c,
                        "Clicked on Checkbox: " + cb.getText() + " is "
                                + cb.isChecked(), Toast.LENGTH_LONG).show();
                User.setSelected(cb.isChecked());
            }
        });
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    UserWithCheckbox User = UsersLits.get(position);
    holder.code.setText(User.getCode());
    // holder.name.setText(User.getName());
    holder.name.setChecked(User.isSelected());
    holder.name.setTag(User);

    return convertView;

}

public Filter getFilter() {
    return new Filter() {

        @Override
        protected FilterResults performFiltering(CharSequence constraint) {

            FilterResults results = new FilterResults();
            ArrayList<UserWithCheckbox> FilteredResults = new ArrayList<UserWithCheckbox>();
            if (constraint != null && constraint.toString().length() > 0) {
                for (int index = 0; index < UsersLits.size(); index++) {
                    UserWithCheckbox User = UsersLits.get(index);
                    if (User.code.contains(constraint.toString())) {
                        FilteredResults.add(User);
                    }
                }
                results.values = FilteredResults;
                results.count = FilteredResults.size();
            } else {
                synchronized (UsersLits) {
                    results.values = UsersLits;
                    results.count = UsersLits.size();
                }

            }
            return results;
        }

        @SuppressWarnings("unchecked")
        @Override
        protected void publishResults(CharSequence constraint,
                FilterResults results) {
            UsersLits.clear();

            UsersLits = (ArrayList<UserWithCheckbox>) results.values;
            notifyDataSetChanged();

        }

    };
}

}
And here is the Activity Code:
public class SelectUsers extends Activity {
public static SelectUserAdapter dataAdapter = null;
float Long, Lat;
String UID, Radius;
String provider;
ListView listView;
Criteria criteria;
LocationManager locationmanager;
File sdcard = Environment.getExternalStorageDirectory();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_select_users);
    displayListView();
    //dataAdapter.checkButtonClick();
    EditText FilterText = (EditText)findViewById(R.id.FilterSelectUsers);
    FilterText.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO Auto-generated method stub
            dataAdapter.getFilter().filter(s.toString());

        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count,
                int after) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable s) {

        }
    });
}


text:
Q: Array to key value pair (Hash) >> description

=> [" name=\"margin-top\" content=\"1\" />\r\n", " name=\"oreintation\" content=\"horizontal\" />\r\n", " name=\"paper-height\" content=\"6\" />\r\n", " name=\"paper-width\" content=\"5\" />\r\n", " name=\"margin-left\" content=\"3\" />\r\n"]

description is of type array
I need key as margin-top value 1.
I need key as oreintation value oreintation and so on, how to get this done?

A: Use
result = {}
description.each{|val|
 result[val.split("\"")[1]] = val.split("\"")[3]
}
result # contains expected hash


text:
Q: How to get mocked method to return different values (from an array) for any args? I have a method findSubmission. Imagine I have possible return values in an array submission. Right now, I am returning by their indices. But I would like to return all the values of the submission one after the other without using their indices like the way I do right now.
when(submissionService.findSubmission(Mockito.anyLong())).thenReturn(submission[0], submission[1], submission[2], submission[3], submission[4])

A: You can use :
import org.mockito.AdditionalAnswers;

when(submissionService.findSubmission(Mockito.anyLong())).thenAnswer(AdditionalAnswers.returnsElementsOf(Arrays.asList(submission)));


text:
Q: How get first level of dom images src is a way to get first value of image src without foreach?
$doc->loadHTML($description);

foreach ($doc->getElementsByTagName('img') as $image) {
    echo $image->getAttribute('src');
}

this is not working $doc->getElementsByTagName('img')->item(0)->nodeValue);

A: This should work:
echo $doc->getElementsByTagName('img')->item(0)->getAttribute('src');


text:
Q: Google Analytics: Tracking multi categories where a page belongs I have a content driven website, where each content item belongs to many different categories.
For example, article "A" belongs to the categories "cat1", "cat3", "cat4" and article "B" belongs to the categories "cat2", "cat3", "cat4".
The number of categories is very big (around 800) and the number of articles more than 10.000.
I want to know all the pageviews of articles that belong to a given category.
Researching google analalytics I didnt find any tool that allows me to do that.
I investgated if I could misuse the campaigns to do it, but the only way would be to rewrite the urls (in order for the campaigns to work), and I dont want to touch my very nice urls.
I tried doing it with events, but it was messing up my bounce rate (since an event meant that the users were actually doing something, so the page was not counted as "bounced").
Has anyone any idea of what I could do to record my categories?
The same solution could be applied to tags in a blog post. (Lets say you wanted to know all the pageviews of all blog posts that have the tag "travel").
Thanks
Koyan

A: Ok, I didnt manage to do exactly what I wanted, but canibalising the custom fields I managed to do something very close.
I put in my ga code the following:
_gaq.push(['_setCustomVar', 1, 'Cat', '-coats-winter-red-used-light-pockets-', 3 ]);

Where coats, winter, red, used, light, pockets are the tags (categories) of that page.
I use php to produce this string.
An other page would have the following for example:
_gaq.push(['_setCustomVar', 1, 'Cat', '-dress-winter-blue-new-light-pockets-', 3 ]);

And all these got pushed to a single variable. Now, I cannot find which of the tags has the most hits (the one part of the report I wanted), but I can find how many hits a certain tag has.
To do that, I created a custom report, where I put the metric group "pageviews" and the Dimension drilldowns "Custom Variable (Key 1)", "Custom Variable (Key 1)
Custom Variable (Value 01)", "Page"
Then I run the report, click on the variable "Cat", and filter for -winter- and it gives me how manypageviews I had for articles with the tag "winter".
Dissadvantages:
a) There is a limit of 64 bytes for the combination of custom variable name and value. I have overcome this by not using actually the tags, but their id's
(so, in my real scenario, the values look like -31-39-45-130-168-206-249- but this is good enough for me).
b) You cannot find from inside google analytics which category/tag has the most pageviews.
(you can always export it though to a csv and work on it in an other script).
Hopefully Google will add a "tags" functionality sometime in the future (am I the only one needing this?)

A: One potential solution would be to use custom variables. For example:
Category1 = Coats
Category2 = Winter
Category3 = Red

The two limitations of this solution are that you are limited to five custom variables per page and that your google analytics queries would get fairly complex as you would need to search across all the category variables to find the specific value you're looking for.


text:
Q: Counting consecutive numbers in a list I couldn't find a question that was similar enough to mine to where I could develop a satisfactory answer.
I'm pretty new to Python (3.4.3). I am trying to add elements to an output list using a for loop by comparing each element of an input list to the next element in it.
Here is my code so far:
random_list=[1,4,5,6,7,9,19,21,22,23,24]

def count_consec(random_list):
    count=1
    consec_list=[]
    for i in listrand:
        if listrand[i] == listrand[i+1]+1:
            count+=1
        else:
            list.append(count)
    return consec_list

Basically, I want to add to consec_list[] values that represent how the length of consecutive blocks of numbers in random_list[].
I expect my output in this case to look like this:
[1,4,1,1,4]

As in, there is one singular number, followed by 4 consecutive numbers, followed by one singular number, followed by one singular number, followed by 4 consecutive numbers.
I tried many different ways and I have gotten the function to build a list, but all the elements are 1s.

A: You could take an approach like this:
def countlist(random_list):
    retlist = []
    # Avoid IndexError for  random_list[i+1]
    for i in range(len(random_list) - 1):
        # Check if the next number is consecutive
        if random_list[i] + 1 == random_list[i+1]:
            count += 1
        else:
            # If it is not append the count and restart counting
            retlist.append(count)
            count = 1
    # Since we stopped the loop one early append the last count
    retlist.append(count)
    return retlist

A: There are a few problems with your code, among others undefined variables, or using an element i from the list as the index of that element, but also you will get an index error for the last element, and you never add the last count to the result list.
Instead, I'd suggest using the zip(lst, lst[1:]) recipe for iterating pairs of elements from the list, and using consec[-1] to access and modify the counts already in the list.
def count_consec(lst):
    consec = [1]
    for x, y in zip(lst, lst[1:]):
        if x == y - 1:
            consec[-1] += 1
        else:
            consec.append(1)
    return consec

random_list=[1,4,5,6,7,9,19,21,22,23,24]
print(count_consec(random_list))
# [1, 4, 1, 1, 4]

Alternatively, you could subtract the index from each element. This way, successive consecutive elements will end up being the same element. Now, you can just use itertools.groupby to group and count those elements.
>>> random_list=[1,4,5,6,7,9,19,21,22,23,24]
>>> [e-i for i, e in enumerate(random_list)]
[1, 3, 3, 3, 3, 4, 13, 14, 14, 14, 14]
>>> [sum(1 for _ in g) for _, g in itertools.groupby(_)]
[1, 4, 1, 1, 4]

A: The following code fixes it up. You were iterating over the elements of the list itself instead of the counter you were referencing.
random_list=[1,4,5,6,7,9,19,21,22,23,24]

def count_consec(listrand):
    count=1
    consec_list=[]
    for i in range(len(listrand[:-1])):
        if listrand[i]+1 == listrand[i+1]:
            count+=1
        else:
            consec_list.append(count)
            count=1

    # Account for the last iteration
    consec_list.append(count)

    return consec_list

print(count_consec(random_list))

Returns this:
[1, 4, 1, 1, 4]

A: Here's my version
Say you had a list of numbers, which you want to loop through and count the consecutive streaks:
list_of_nums = [4,5,7,8,2,1,3,5,7,6,8,9,9,9,2,2]

You could do something like this:
streak_count = []
counter = 1
for i in range(len(list_of_nums)):
    if i != (len(list_of_nums) - 1):
        diff = list_of_nums[i+1] - list_of_nums[i]
        if diff == 1:
            counter += 1
        else:
            streak_count.append(counter)
            counter = 1
    else:
        streak_count.append(counter)

A: Here is a more pythonic way of solution,
alist = [1,4,5,6,7,9,19,21,22,23,24]

Before taking the difference, duplicate the first element of the list and add an extra element of which the difference is more than 1 with the last element of the list to the end of the list
alist = np.array([alist[0]] + alist + [alist[-1]+2])

Get the indexes where the differences of consecutive elements in the list are greater than 1
dif1_loc = np.where(np.diff(alist) != 1)[0]
dif1_loc
> [ 0  1  5  6  7 11]

Take the difference of the locations to get the length of each patterns of consecutive numbers
consec_len = np.diff(dif1_loc).values
consec_len
> array([1, 4, 1, 1, 4])


text:
Q: zsh doesn't use my $PATH correct I try to ran a script from ~/.dotfiles/bin, but zsh doesn't got it instead the bash:
➜  ~  cat ~/.dotfiles/bin/dotfiles-test
#!/bin/bash
echo 'hello world'
➜  ~  echo $PATH
/usr/local/share/npm/bin/:~/.dotfiles/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
➜  ~  dotfiles-test
zsh: command not found: dotfiles-test
➜  ~  bash
bash-3.2$ source .exports
bash-3.2$ echo $PATH
/usr/local/share/npm/bin/:~/.dotfiles/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin/:~/.dotfiles/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
bash-3.2$ dotfiles-test
hello world
bash-3.2$

A: Just replace ~/.dotfiles/bin to $HOME/.dotfiles/bin.


text:
Q: Material Dialog afterOpened vs AfterViewInit. Is it safe to accesss dialog data in AfterViewInit? I open dialog in a standard way:
this.dialogRef = this.dialog.open(DialogComponent, {
      width: '90vw',
      height: '85vh',
      ....

And in DialogComponent I access dialog data in ngAfterViewInit:
  constructor(
    public dialogRef: MatDialogRef<DialogComponent>,
    @Inject(MAT_DIALOG_DATA) public data: DialogData,
  ) {}

  ngAfterViewInit() {
    this.data = this.data.width

(this is a pseudo code). As you see I dont use:
this.dialogRef.afterOpen().pipe( ...

Can anyone explain whats the difference between this.dialogRef.afterOpen and ngAfterViewInit?
Is it safe to access data in AfterViewInit?

A: ngAfterViewInit is an Angular hook used to perform functions after a certain moment of the life of that instance of the component, see here for more information.
MatDialogRef.afterOpened is an observable notified when the given instance of MatDialog is opened.
Basically, ngAfterViewInit should be used from inside the dialog to perform things after its view has been initialized, MatDialogRef.afterOpened should be used by the component that opens the dialog to perform things when the dialog has opened but has not yet been closed.
Since your data are injected in the constructor, they are already there during view initialization so it is safe to use them during that phase.

A: After reading the source code of DialogComponent See Details
this.dialogRef.afterOpen will trigger on the animation complete of the component.
where as ngAfterViewInit
import { Component } from '@angular/core';

@Component({
   selector: 'app-lifecycle-hook',
   template: `

Lifecycle Hook Demo

    `
})
export class LifecycleHookComponent {
  constructor() {
    console.log("---constructor---");
  }
  ngOnInit() {
    console.log("---Inside ngOnInit---");
  }
  ngDoCheck() {
    console.log("---Inside ngDoCheck---");
  }
  ngAfterContentInit() {
    console.log("---Inside ngAfterContentInit---");
  }
  ngAfterContentChecked() {
    console.log("---Inside ngAfterContentChecked---");
  }
  ngAfterViewInit() {
    console.log("---Inside ngAfterViewInit---");
  }
  ngAfterViewChecked() {
    console.log("---Inside ngAfterViewChecked---");
  }
  ngOnDestroy() {
    console.log("---Inside ngOnDestroy---");
  }
}

Output:
---constructor---
---Inside ngOnInit---
---Inside ngDoCheck---
---Inside ngAfterContentInit---
---Inside ngAfterContentChecked---
---Inside ngAfterViewInit---
---Inside ngAfterViewChecked---

So you can use either on NgOnInit or after you ngAfterViewInit will get the data

A: Not an answer directly but it could help with usage of afterOpened. In your component class inject a dialog instance, then open the modal using the templateRef the same way you would use a component declared in your modules'  entryComponents array. A demo in StackBlitz is provided below.
@ViewChild('widgetEditorModal') public widgetEditorModal: TemplateRef<any>;
private widgetEditorDialogRef: MatDialogRef<TemplateRef<any>>;

isModalOpen = false;

constructor(public dialog: MatDialog) {}

openWidgetEditorDialog() {

  const dialogConfig = new MatDialogConfig();
  dialogConfig.role = 'dialog';
  dialogConfig.width = '720px';

  // widgetEditorModal is my modal templateRef
  this.widgetEditorDialogRef = this.dialog.open(this.widgetEditorModal, dialogConfig);

  this.widgetEditorDialogRef.afterOpened().subscribe(result => {
      this.isModalOpen = true;
      console.log('widgetEditorModal has been opened!');
  });

  this.widgetEditorDialogRef.afterClosed().subscribe(result => {
      this.isModalOpen = false;
      console.log('widgetEditorModal has been close!');
  });
}

And the template piece:
<button mat-raised-button color="primary" (click)="openWidgetEditorDialog()">Open modal</button>

<ng-template #widgetEditorModal>

Widget settings

      <button mat-icon-button matDialogClose tabindex="-1">
        <mat-icon aria-label="Close dialog">close</mat-icon>
      </button>

  <mat-dialog-content>

Your settings form here

  </mat-dialog-content>
  <mat-dialog-actions class="border-top">
    <button type="button" mat-button matDialogClose>Cancel</button>
    <button type="button" mat-raised-button color="accent">Save changes</button>
  </mat-dialog-actions>
</ng-template>

StackBlitz demo here


text:
Q: ImageMagick: How to compare original PNG to lossy JPEG? I want to compare original PNG image to lossy JPEG image to see how much I am loosing. I found that I can use ImageMagic to compare images. I prefer using Java (im4java). I am very confused with their documentation (http://www.imagemagick.org/script/compare.php). It doesn't describe which platform it is for. How do I use these command lines and are they even available in im4java? If someone can write steps on how I use it I will appreciate it.

A: ImageMagick runs on many platforms. If you click Binary Releases, they have a listing of available packages. The im4java library, as its home page describes, calls the ImageMagick command line tools to do its work, so it will run on any platform that supports both ImageMagick and Java. Browsing through its API documentation, it looks like the compare command is not available in im4java, so you must modify im4java to support it.

A: So why can't you use the ImageMagick commandline tool directly?
Note, that comparing 2 different images with the help of compare only leads to meaningfull results if the two do have the same dimensions (Width x Height) in terms of pixels. compare does a comparison that is done pixel by pixel.
Here's how I would do it:
 compare \
       -verbose \
       -debug coder \
       -log "%u %m:%l %e" \
        orig1.png \
        orig2.jpeg \
       -compose src \
        diff.png

This command takes 2 images as input: orig1.png and orig2.jpeg. It produces diff.png as output. It also gives you some debugging info on stdout. The output image has all pixels colored in red which are different between the inputs.
Another possibility is this modified command:
 compare \
       -verbose \
       -debug coder \
       -log "%u %m:%l %e" \
        orig1.png \
        orig2.jpeg \
       -compose difference \
        diff.png

It visualizes the differences in another way. You could also not write the differences to a file, but tell compare to open a window and display the differences on screen:
 compare \
       -verbose \
       -debug coder \
       -log "%u %m:%l %e" \
        orig1.png \
        orig2.jpeg \
       -compose difference \
        x:

A: My blog entry is more about JPEG quality and what is the difference of ImageMagick and Lightroom, but you can find the helpful command line that does the required comparison:
composite image1.ext image2.ext -compose difference diff.png

Ensure that you use .png (or .gif or other lossless format) as the output image, because first of all you are interested in the difference, and .jpg would distort it as a photo.


text:
Q: EXC_BAD_ACCESS on long press; no zombie activity EDIT: I have determined that the following happens only on an iPad Retina simulator and on my iPad Mini 3 test device. It happens 100% of the time on those targets and never on any other iPad or iPhone simulator (iPad Air/Air 2; iPad Pro; iPhone 5 through 7 Plus). I don't have any other devices for testing.

I have an app written in Swift that displays a UITableView where I have added a UILongPressGestureRecognizer to a custom view inside each cell. The app runs fine until I long-press on a row, at which point the app stops with

Thread 1: EXC_BAD_ACCESS (code=1, address=0xd08600b6)

(The address varies wildly and seems pretty random. Sometimes it's 0x0.) When the crash occurs, no output appears in the debug console. XCode itself opens to the first line of the class declaration for my app delegate.
I put a breakpoint at the first line of my long-press event handler method but the app crashes before the breakpoint is hit. I also added an exception breakpoint, but it does not catch the problem either.
I've enabled zombie objects in the scheme, but nothing shows up. I've tried running the app using Instruments and the zombies template; the app simply stops and Instruments doesn't flag any zombie activity. XCode's Analyze reports no problems.
I don't know how it can be relevant, but this problem is new since I first archived the app in preparation for distribution to testers. Before that, the app was working flawlessly on simulators and on a test device. The problem first showed up the first time I installed and ran the distribution .ipa file on a device. I then went back to simulator and found the same behavior. I've cleaned the project, cleaned the build folder, rebooted my development machine, and done everything I can think of to run in a pristine state. No difference.
I'm at a loss for how to make progress in tracking this down. Any suggestions would be greatly appreciated.
Further Information
It appears that the crash is happening inside the #selector object that was passed to the UILongPressGestureRecognizer initializer. Here's the call stack from the Debug navigator pane:

#0   0x006e7295 in objc_retain ()
   #1 0x0007529f in @objc TikkunRowView.onLongPress(sender : UILongPressGestureRecognizer, forEvent : UIEvent) -> () ()
   #2 0x01cc6d3b in -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] ()
   #3 0x01ccf75e in _UIGestureRecognizerSendTargetActions ()
   #4 0x01cccdee in _UIGestureRecognizerSendActions ()
   #5 0x01ccbca8 in -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] ()
   #6 0x01cb6670 in _UIGestureEnvironmentUpdate ()

And here's the code in #1 above where the crash occurs (the calll at offset <+42>):
Tikkun Sample`@objc TikkunRowView.onLongPress(sender : UILongPressGestureRecognizer, forEvent : UIEvent) -> ():
    0x60270 <+0>:   pushl  %ebp
    0x60271 <+1>:   movl   %esp, %ebp
    0x60273 <+3>:   pushl  %esi
    0x60274 <+4>:   subl   $0x24, %esp
    0x60277 <+7>:   movl   0x14(%ebp), %eax
    0x6027a <+10>:  movl   0x10(%ebp), %ecx
    0x6027d <+13>:  movl   0x8(%ebp), %edx
    0x60280 <+16>:  movl   %ecx, (%esp)
    0x60283 <+19>:  movl   %ecx, -0x8(%ebp)
    0x60286 <+22>:  movl   %edx, -0xc(%ebp)
    0x60289 <+25>:  movl   %eax, -0x10(%ebp)
    0x6028c <+28>:  calll  0x7c9ec                   ; symbol stub for: objc_retain
    0x60291 <+33>:  movl   -0x10(%ebp), %ecx
    0x60294 <+36>:  movl   %ecx, (%esp)
    0x60297 <+39>:  movl   %eax, -0x14(%ebp)
    0x6029a <+42>:  calll  0x7c9ec                   ; symbol stub for: objc_retain
>>  0x6029f <+47>:  movl   -0xc(%ebp), %ecx << CRASH HAPPENS WITH THIS LINE HIGHLIGHTED
    0x602a2 <+50>:  movl   %ecx, (%esp)
    0x602a5 <+53>:  movl   %eax, -0x18(%ebp)
    0x602a8 <+56>:  calll  0x7c9ec                   ; symbol stub for: objc_retain
    0x602ad <+61>:  movl   -0x8(%ebp), %ecx
    0x602b0 <+64>:  movl   %ecx, (%esp)
    0x602b3 <+67>:  movl   -0x10(%ebp), %edx
    0x602b6 <+70>:  movl   %edx, 0x4(%esp)
    0x602ba <+74>:  movl   -0xc(%ebp), %esi
    0x602bd <+77>:  movl   %esi, 0x8(%esp)
    0x602c1 <+81>:  movl   %eax, -0x1c(%ebp)
    0x602c4 <+84>:  calll  0x5fd40                   ; Tikkun_Sample.TikkunRowView.onLongPress (sender : __ObjC.UILongPressGestureRecognizer, forEvent : __ObjC.UIEvent) -> () at TikkunRowView.swift:128
    0x602c9 <+89>:  movl   -0xc(%ebp), %eax
    0x602cc <+92>:  movl   %eax, (%esp)
    0x602cf <+95>:  calll  0x7c9e6                   ; symbol stub for: objc_release
    0x602d4 <+100>: addl   $0x24, %esp
    0x602d7 <+103>: popl   %esi
    0x602d8 <+104>: popl   %ebp
    0x602d9 <+105>: retl

I'm no expert on reading this stuff, but it looks like the crash is happening in compiler-generated code that is supposed to dispatch to my event handler method. I have no idea what objects this code is checking before getting to calling my code (at offset <+84>). Here's the code I use to construct the gesture recognizer:
let g = UILongPressGestureRecognizer(target: self, action: #selector(TikkunRowView.onLongPress(sender:forEvent:)))

A: I don't know why the console didn't give you any detail error message. (It should!) But looking at your code, it's obviously due to the wrong signature of the gesture action callback. The following is quoted from the api doc.

The action methods invoked must conform to one of the following signatures:
      - (void)handleGesture;
      - (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer;


text:
Q: Не могу понять принцип работы таймера в JS Хочу написать скрипт, который будет добавлять в заголовок символ доллара каждую секунду, 10 раз. Вот пример кода, почему таймер не останавливается? Как написать правильно, и если можно вкратце принцип работы таймера в JS, а то я видимо чего-то недопонимаю.

A: Проверять count нужно внутри printTxtHead, снаружи проверка отработает только 1 раз.

let count = 0;
const timerId = window.setInterval(printTxtHead, 1000);

function printTxtHead() {
  document.getElementById('txt-head').innerHTML += "$";
  count++;
  if (count > 10) {
    window.clearInterval(timerId);
  }
}


text:
Q: Use expression to only keep 1 layer in the legend When I print my project, that includes different layers, I always end up with all the layers in the legend. What I want when printing is to only show 1 layer, that always has the same name "Werken". The rest of the layers are not necessary to be shown in the legend. What kind of expression would I have to write to become this result?

A: Legend filter expressions only apply on a per-layer basis. In other words, you can apply a filter to one layer at a time. You can't apply a filter to all layers in the legend.

So there's no way to use an expression to control which layers are displayed in the legend.

It's quite easy to remove layers you don't want manually. There are two ways:

*

*Select the layers you don't want in the legend, and click the red minus button.

*If you have a lot of layers, and have trouble finding the one layer that you want to keep, simply remove all the layers as in step 1. Then click the green plus button, and add the layer you do want.

Once the legend is set up how you want it, you can re-use the same legend in other print layouts.

*

*When you create a new print layout in the same project, you can copy and paste the legend from the old print layout into the new layout.

*Save the print layout as a template. When you open a different project, load the saved template into a blank print layout.

Note: This answer applies to the GUI (graphical user interface) only. It might be possible to solve this problem using pyqgis in the Python Console, but that's outside the scope of the question as it's written. If you want a pyqgis solution, be aware that questions on this site asking for code without including a code snippet will be closed for this reason:

Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example.


text:
Q: What does "<=>" in MySQL mean? What does <=> in MySQL mean and do?

A: It's the NULL-safe equal operator.
The difference between <=> and = is when one or both of the operands are NULL values. For example:
NULL <=> NULL gives True
NULL = NULL   gives NULL

Here is the full table for the <=> comparison of values 1, 2 and NULL:

     |  1      2    NULL
-----+-------------------
1    | True   False False
2    | False  True  False
NULL | False  False True

Compare to the ordinary equality operator:

     |  1      2    NULL
-----+-------------------
1    | True   False NULL
2    | False  True  NULL
NULL | NULL   NULL  NULL

A: NULL-safe equal to operator
http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_equal-to

A: <=> is a so called NULL-safe-equality operator.
SELECT 1 <=> 1, NULL <=> NULL, 1 <=> NULL;
-> 1, 1, 0

SELECT 1 = 1, NULL = NULL, 1 = NULL;
-> 1, NULL, NULL

A: The manual says it all:

NULL-safe equal. This operator
  performs an equality comparison like
  the = operator, but returns 1 rather
  than NULL if both operands are NULL,
  and 0 rather than NULL if one operand
  is NULL.

mysql> select NULL <=> NULL;
+---------------+
| NULL <=> NULL |
+---------------+
|             1 |
+---------------+
1 row in set (0.00 sec)

mysql> select NULL = NULL;
+-------------+
| NULL = NULL |
+-------------+
|        NULL |
+-------------+
1 row in set (0.00 sec)

mysql> select NULL <=> 1;
+------------+
| NULL <=> 1 |
+------------+
|          0 |
+------------+
1 row in set (0.00 sec)

mysql> select NULL = 1;
+----------+
| NULL = 1 |
+----------+
|     NULL |
+----------+
1 row in set (0.00 sec)

mysql>

A: It's the same as SQL standard keyword DISTINCT
SELECT * FROM somewhere WHERE `address1` is not distinct from `address2`


text:
Q: How do I create a dropdown inside a vue <b-row v-if="userIdArr.length >0 && incidentIdArr.length ===0" class="mt-5">
    <b-col md="10" offset-md="1">
        <b-table overflow="auto" hover border :items="userIdArr" :fields="userArrTblfields">
          <template slot="serialDropdown" slot-scope="row">
             <b-form-select v-model="selectedSerial" :options="serialOptions"></b-form-select>
         </template>
     </b-table>
  </b-col>

now down in my <script:
                userIdArr: [],
                userArrTblfields: [
                    { key: 'id', label: 'id', class: 'text-center' },
                    { key: 'firstname', sortable: true, class: 'text-center' },
                    { key: 'lastname', sortable: true, class: 'text-center' },
                    { key: 'employeeID', sortable: true, class: 'text-center' },
                    { key: 'serialDropdown', sortable: true, class: 'text-center' }
                    ],
                selectedUser: null,
                selectedSerial: [],
                serialOptions: [
                    { value: 'J00001', text: 'J00001'},
                    { value: 'J00002', text: 'J00002'},
                    { value: 'J00003', text: 'J00003'},
                    { value: 'J00004', text: 'J00004'},
                    { value: 'J00005', text: 'J00005'}
                ],

The dropdown appears however it shows the same values for all table rows and the select of the dropdown is duplicated for each row??? How can I separate out the selected values and keep the dropdowns separate per table row?


text:
Q: For each record in a table, insert a record in another table and put the key into the first table's record I am localizing an application and need to convert existing TEXT columns to have multiple translated versions of the text.
The original table looks like this:
person

*

*personId: INT

*description: VARCHAR(20)

*(other columns)

To store the localized text, I created a new table:
text

*

*textId: INT (auto-incrementing)

*languageId: INT

*text: TEXT

I want to replace the person.description column with a new person.descTextId column.
For each person that has a value in the description column but descTextId is null:

*

*Insert a new text record with that person's description (English
languageId=1)

*Update the person's descTextId to the new textId
value

Then remove the person.description column.
What is the cleanest way to do all of this?  Do I need to create a procedure and cursor or is there a clever MySQL syntax that would help with this? How would you do it?

A: I figured it out with a temporary procedure and loop.
DROP PROCEDURE IF EXISTS moveToTextTable;
DELIMITER ;;

CREATE PROCEDURE moveToTextTable()
BEGIN
  DECLARE n INT DEFAULT 0;
  DECLARE i INT DEFAULT 0;
  DECLARE id INT DEFAULT 0;

  SELECT COUNT(*) INTO n FROM person WHERE description IS NOT NULL AND description <> '';
  WHILE i<n DO
    SELECT personId INTO id FROM person WHERE description IS NOT NULL AND description <> '' AND descTextId IS NULL LIMIT 1;
    INSERT INTO text (languageId, text) SELECT 1, description FROM person WHERE personId = id;
    UPDATE person SET descTextId = LAST_INSERT_ID() WHERE personId = id;
    SET i = i + 1;
  END WHILE;
END;
;;

DELIMITER ;
CALL moveToTextTable();
DROP PROCEDURE IF EXISTS moveToTextTable;


text:
Q: Is it possible to wrap boost sockets with Pimpl? in a project we want to wrap the Boost Asio socket in a way, that the using class or the wrapping .h does not have to include the boost headers.
We usually use pointers and forward declarations for wrapped classes.
Foward declaration:
namespace boost
{
  namespace asio
  {
    namespace ip
    {
      class udp;
    }
  }
}

And then declaring the socket:
  scoped_ptr<boost::asio::ip::udp::socket> socket_;
  scoped_ptr<boost::asio::ip::udp::endpoint> receiveEp_;

(If you don't know scoped_ptr, ignore it, the problem is equal with a standard * pointer.)
But this gives a compiler error:
error C2027: use of undefined type 'boost::asio::ip::udp'

I understand this is because udp is actually not a namespace, but a class itself. We only want to use the inner class though, any ideas?

A: If you are using pimpl, why are you putting member variables in your header?  Are the socket and endpoint typedefs used in your interface?  If they are not part of your interface, the whole point of the pimpl idiom is that you don't define the member variables of a class in the header file; they are implementation details.
I expect something like this in the header file:
// ...

class MyClass {
public:
    MyClass();
    // .. Other member functions

private:
    struct Imp;
    boost::shared_ptr<Imp> m_imp;   // This is the only member variable.
};

And then in your implementation file:
#include <boost/asio/whatever.hpp>

struct MyClass::Imp
{
    scoped_ptr<boost::asio::ip::udp::socket> socket_;
    scoped_ptr<boost::asio::ip::udp::endpoint> receiveEp_;

    // Remainder of implementation class ...
};

// Other implementation details.

To answer your specific question, the types you are trying to use are typedefs in the asio udp class, so the compiler needs to have seen the definition of that class to use it.

A: With inner types your only option is wrapping everything. Hide scoped pointers themselves inside a forward declared class. Users would see only your API and pass around your own objects instead of boost objects.
In your example though scoped_ptr look like private member declarations, you can get away with simple:
// header
class SomeClass
{
public:
    SomeClass();
    // stuff
private:
    scoped_ptr<class pimpl_bla> _m;
};

// source
class pimpl_bla
{
public:
    scoped_ptr<boost::asio::ip::udp::socket> socket_;
};

SomeClass::SomeClass()
    :_m(new pimpl_bla)
{
}


text:
Q: Modifying SVG after it has been loaded How would I modify an SVG file after it has been loaded by the browser, preferably through jquery? A simple example would be pressing a button and the color of the SVG element changes. Any documentation would help as well.
EDIT: This link helped a great deal:
w3.org/Graphics/SVG/IG/resources/svgprimer.html#SVG_in_HTML

A: You can't "modify" SVG files (except by changing them on the server).  SVG files define a collection of SVG objects, each of which can be identified with an ID, if you wish.  These objects can be manipulated with JavaScript like you would any DOM element (e.g. setAttribute, etc).  Check http://www.w3.org/TR/SVG11/types.html#BasicDOMInterfaces for the DOM interfaces.  Notice that SVGElement extends Element, which is the basic DOM element type.
EDIT: simple example:
<html>
<body>
    <input type="button" onclick="doSVGThing()" value="change">
    <svg xmlns="http://www.w3.org/2000/svg"
        xmlns:xlink="http://www.w3.org/1999/xlink">
    <rect id="aRect" x="10" y="10" height="100" width="100"
            style="stroke:#ff0000; fill: #9999ff"></rect>
</svg>
    <script type="text/javascript">
        function doSVGThing() {
            var r = document.getElementById('aRect');
            r.setAttribute('style', 'stroke: #00ff00; fill: #99ff99');
        }
    </script>
</body>
</html>


text:
Q: About IOKit framework in iphone Thanks in advance.
   Do any one have idea about IOKit frame work in iphone. Actually i got some information that it was rejected by apple, means if we use this frame work the appstore will not accept the apps. But we can use ambient sensor with IOKit framework. so, any one have an idea about IOKit framework. Please hep me.

A: It sounds as though the rejection email tells you everything you need to know.
The rule is: you can only use documented APIs.
IOKit is not listed in the iOS documentation. So if you want your app available on the App Store you can't use it. It's as simple as that.