问:
Can't hide soft input keyboard -- getWindowToken() always null
I have an Activity with Tabs set up with a ViewPager, in one of the Fragments there's an EditText which opens soft input keyboard when the Activity starts, which isn't something I want. I've been trying to hide it but when I'm trying to get a WindowToken it's always null -- on the EditText itself, on the root view of the Fragment, on the ContentView of the parent activity (I tried findViewById(android.R.id.content) with and without getDecorView(), with and without getRootView()), on every View I get from ContentView with getChildAt(). getCurrentFocus() also returns null.
Also, I tried getting the parent Activity both from getActivity() and from a reference I keep in my Application class, and they work the same.

My ultimate goal is to hide the keyboard, or not show it at all unless the user explicitly calls it. If I have to find a way to get a WindowToken for that, I'd like to do that, but if there's another way to hide the keyboard, I'll be happy to try that too.

I'd like to know why the question was downvoted. I can't improve it if I don't know the reason.

Bits of related code:

activity_main.xml:

```<code><android.support.v4.widget.DrawerLayout
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:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:background="@color/windowBackground"
    tools:openDrawer="start">

<include
    layout="@layout/app_bar_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

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

</android.support.v4.widget.DrawerLayout>
</code>```

app_bar_main.xml:

```<code><?xml version="1.0" encoding="utf-8"?>
<android.support.design.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"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.company.app.activities.MainActivity">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:elevation="4dp"
    android:theme="@style/AppTheme.AppBarOverlay">

    ...

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/underline_grey"
        app:tabMode="scrollable"
        app:tabGravity="center"
        app:popupTheme="@style/AppTheme.PopupOverlayBg"/>

</android.support.design.widget.AppBarLayout>
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:scrollbars="vertical"
    android:orientation="vertical"
    app:layout_anchor="@+id/appbar_layout"
    android:fillViewport="true">
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <include
            layout="@layout/bg"
            android:layout_width="match_parent"
            android:layout_height="800dp" />
    <include
        android:id="@+id/pager_frame"
        layout="@layout/content_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/></FrameLayout>
</ScrollView>
</android.support.design.widget.CoordinatorLayout>
</code>```

(before anyone says anything, the Scroll wasn't my idea)

content_main.xml:

```<code><?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.company.app.activities.MainActivity"
tools:showIn="@layout/app_bar_main">

<android.support.v4.view.ViewPager
    android:id="@+id/main_page_pager"
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>
</code>```

fragment_get_bonuses.xml:

```<code><android.support.constraint.ConstraintLayout
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"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:orientation="vertical"
android:gravity="center"
tools:context="com.company.app.fragments.GetBonusesFragment">

...

<android.support.v7.widget.CardView
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/guideline50"
app:layout_constraintBottom_toTopOf="@+id/guideline70"
card_view:contentPadding="4dp"
card_view:cardUseCompatPadding="true"
card_view:cardElevation="4dp"
card_view:cardCornerRadius="10dp"
card_view:cardBackgroundColor="@color/windowBackground"
android:layout_span="6">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:padding="4dp"
    android:gravity="center"
    android:weightSum="1">
    <EditText
        android:id="@+id/bonuses_code_edit"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:layout_weight=".5"
        android:padding="8dp"
        android:layout_marginRight="4dp"
        android:background="@drawable/border_grey"
        android:hint="xxxx-xxxx-xxxx"
        android:maxLines="1"
        android:lines="1"
        android:inputType="text"
        android:nextFocusForward="@+id/bonuses_code_card"/>
    <android.support.v7.widget.CardView
        android:id="@+id/bonuses_code_card"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="4dp"
        card_view:contentPadding="0dp"
        card_view:cardUseCompatPadding="false"
        card_view:cardElevation="4dp"
        card_view:cardCornerRadius="10dp"
        card_view:cardBackgroundColor="@color/pinkAcivateCode"
        android:layout_weight=".5"
        android:clickable="true"
        android:onClick="onMenuButtonsClick">
        <TextView
            android:id="@+id/bonuses_code_button"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="@string/activate_code"
            android:textColor="@color/textColorPrimary"
            android:lines="2"
            android:padding="8dp" />
    </android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v7.widget.CardView>
...

<android.support.constraint.Guideline
android:id="@+id/guideline50"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="0dp" />

<android.support.constraint.Guideline
android:id="@+id/guideline70"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.7"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="0dp" />

...

</android.support.constraint.ConstraintLayout>
</code>```

MainActivity.java:

```<code>public class MainActivity extends AppCompatActivity
    implements NavigationView.OnNavigationItemSelectedListener {

AppCompatActivity context;

...

TabLayout mainPageTabs;

View pagerView;
ViewPager mainPagePager;
MainPageTabsAdapter adapter;

TextView tabBonuses;
...

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fresco.initialize(this);
    setContentView(R.layout.activity_main);
    context = this;
    App.getContext().setCurrent(context); // saves reference to currently running Activity in Application class
    ...

    pagerView = findViewById(R.id.pager_frame);
    mainPageTabs = (TabLayout) findViewById(R.id.tabs);
    ...
    setupMainTabs();
}

public void setupMainTabs(){
    if (mainPagePager == null) mainPagePager = (ViewPager) findViewById(R.id.main_page_pager);
    if (mainPageTabs == null) mainPageTabs = (TabLayout) findViewById(R.id.tabs);
    setupMainPageViewPager(mainPagePager);
    mainPageTabs.setupWithViewPager(mainPagePager,true);
    ...

    tabBonuses = (TextView) LayoutInflater.from(this).inflate(R.layout.tab_item, null); // TextView with a background
    tabBonuses.setText(getText(R.string.collect_bonuses));
    ...
    mainPageTabs.getTabAt(0).setCustomView(tabBonuses);
    ...
//        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
//        imm.hideSoftInputFromWindow(findViewById(R.id.pager_frame).getWindowToken(), 0);
}

private void setupMainPageViewPager(ViewPager viewPager) {
    adapter = new MainPageTabsAdapter(getSupportFragmentManager(),this);
    viewPager.setAdapter(adapter);
    viewPager.setOffscreenPageLimit(2);
}

...

@Override
protected void onResume() {
    super.onResume();
    App.getContext().setCurrent(context);
    ...
//        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
//        imm.hideSoftInputFromWindow(findViewById(R.id.pager_frame).getWindowToken(), 0);
}

...
</code>```

}

Application class:

```<code>...
private static App context;
private AppCompatActivity current;
...
@Override
public void onCreate() {
    super.onCreate();
    if (context == null) context = (DreamClub) getApplicationContext();
    ...
}
...

public void setCurrent(AppCompatActivity a) {
    current = a;
}

public Activity getCurrent(){return current;}
...

public static App getContext() {
    if (context == null) context = new DreamClub();
    return context;
}
</code>```

MainPageTabsAdapter.java:

```<code>public class MainPageTabsAdapter extends FragmentPagerAdapter {

Context context;

ArrayList<Fragment> fragmList;
ArrayList<String> titleList;

public MainPageTabsAdapter(FragmentManager fm, Context context) {
    super(fm);
    this.context = context;
    fragmList = new ArrayList<>();
    fragmList.add(new GetBonusesFragment());
    ...
    titleList = new ArrayList<>();
    titleList.add(context.getString(R.string.collect_bonuses));
    ...
}

@Override
public Fragment getItem(int position) {
    return fragmList.get(position);
}

...

@Override
public CharSequence getPageTitle(int position) {
    return titleList.get(position);
}
}
</code>```

GetBonusesFragment.java:

```<code>public class GetBonusesFragment extends Fragment {

EditText codeEdit;
View root;

...

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    root = inflater.inflate(R.layout.fragment_get_bonuses, container, false);
    ...
    codeEdit = (EditText) root.findViewById(R.id.bonuses_code_edit);
//        InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//        codeEdit.requestFocus();
//        imm.hideSoftInputFromWindow(codeEdit.getWindowToken(), 0);
    ...
//        codeEdit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
//            @Override
//            public void onFocusChange(View v, boolean hasFocus) {
//                if (hasFocus) {
//                    InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//                    imm.showSoftInput(root,0)/*hideSoftInputFromWindow(root.getWindowToken(), 0)*/;
//                }
//                else {
//                    Log.v("!!!called","on focus change: false");
//                    InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//                    imm.hideSoftInputFromWindow(root.getWindowToken(), 0);
//                }
//            }
//        });
    ...
    InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
    imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY,0);
//        try {
//            InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//            imm.hideSoftInputFromWindow(DreamClub.getContext().getCurrent().getCurrentFocus().getWindowToken(), 0);
//        }
//        catch (Exception e) {
//            try {
//                InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//                imm.hideSoftInputFromWindow(DreamClub.getContext().getCurrent().getWindow().findViewById(android.R.id.content).getRootView().getWindowToken(), 0);
//            }
//            catch (Exception e1) {
//                if (DreamClub.getContext().getCurrent().getWindow().findViewById(android.R.id.content).getRootView() != null && ((ViewGroup)getActivity().getWindow().findViewById(android.R.id.content).getRootView()).getChildCount() > 0) {
//                    for (int i = 0; i < ((ViewGroup)DreamClub.getContext().getCurrent().getWindow().findViewById(android.R.id.content).getRootView()).getChildCount(); i++) {
//                        if (((ViewGroup)DreamClub.getContext().getCurrent().getWindow().findViewById(android.R.id.content).getRootView()).getChildAt(i).getWindowToken() != null) {
//                            InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//                            imm.hideSoftInputFromWindow(((ViewGroup)DreamClub.getContext().getCurrent().getWindow().findViewById(android.R.id.content).getRootView()).getChildAt(i).getWindowToken(), 0);
//                            break;
//                        }
//                    }
//                }
//            }
//        }
//        root.findViewById(codeEdit.getNextFocusForwardId()).requestFocus();
//        root.findViewById(R.id.bonuses_wallets).requestFocus();
//        if (codeEdit.hasFocus()) {
//            codeEdit.clearFocus();
//        }
//        InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//        imm.hideSoftInputFromWindow(codeEdit.getWindowToken(), 0);
//        imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
    return root;
}

//    @Override
//    public void onResume() {
//        super.onResume();
//        InputMethodManager imm = (InputMethodManager)(DreamClub.getContext().getCurrent().getSystemService(Context.INPUT_METHOD_SERVICE));
//        imm.hideSoftInputFromWindow(codeEdit.getWindowToken(), 0);
//    }
}
</code>```

答:
Add this in your manifest file

```<code> <activity android:name="com.your.package.ActivityName"
  android:windowSoftInputMode="stateHidden"  />
</code>```

or try

```<code>getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
</code>```

But if your requirement like hide keyborad on Button click or backPressed then use like this

```<code>public static void HideKeyboard(Context context, View view) {
    if (view == null) {
        return;
    }
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (!imm.isActive()) {
        return;
    }
    imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
</code>```

and please more follow this link

How to hide Soft Keyboard when activity starts

Body:
I have an Activity with Tabs set up with a ViewPager, in one of the Fragments there's an EditText which opens soft input keyboard when the Activity starts, which isn't something I want. I've been trying to hide it but when I'm trying to get a WindowToken it's always null -- on the EditText itself, on the root view of the Fragment, on the ContentView of the parent activity (I tried findViewById(android.R.id.content) with and without getDecorView(), with and without getRootView()), on every View I get from ContentView with getChildAt(). getCurrentFocus() also returns null.
Also, I tried getting the parent Activity both from getActivity() and from a reference I keep in my Application class, and they work the same.

My ultimate goal is to hide the keyboard, or not show it at all unless the user explicitly calls it. If I have to find a way to get a WindowToken for that, I'd like to do that, but if there's another way to hide the keyboard, I'll be happy to try that too.

I'd like to know why the question was downvoted. I can't improve it if I don't know the reason.

Bits of related code:

activity_main.xml:

<android.support.v4.widget.DrawerLayout
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:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:background="@color/windowBackground"
    tools:openDrawer="start">

<include
    layout="@layout/app_bar_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

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

</android.support.v4.widget.DrawerLayout>

app_bar_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.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"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.company.app.activities.MainActivity">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:elevation="4dp"
    android:theme="@style/AppTheme.AppBarOverlay">

    ...

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/underline_grey"
        app:tabMode="scrollable"
        app:tabGravity="center"
        app:popupTheme="@style/AppTheme.PopupOverlayBg"/>

</android.support.design.widget.AppBarLayout>
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:scrollbars="vertical"
    android:orientation="vertical"
    app:layout_anchor="@+id/appbar_layout"
    android:fillViewport="true">
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <include
            layout="@layout/bg"
            android:layout_width="match_parent"
            android:layout_height="800dp" />
    <include
        android:id="@+id/pager_frame"
        layout="@layout/content_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/></FrameLayout>
</ScrollView>
</android.support.design.widget.CoordinatorLayout>

(before anyone says anything, the Scroll wasn't my idea)

content_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.company.app.activities.MainActivity"
tools:showIn="@layout/app_bar_main">

<android.support.v4.view.ViewPager
    android:id="@+id/main_page_pager"
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

fragment_get_bonuses.xml:

<android.support.constraint.ConstraintLayout
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"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:orientation="vertical"
android:gravity="center"
tools:context="com.company.app.fragments.GetBonusesFragment">

...

<android.support.v7.widget.CardView
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/guideline50"
app:layout_constraintBottom_toTopOf="@+id/guideline70"
card_view:contentPadding="4dp"
card_view:cardUseCompatPadding="true"
card_view:cardElevation="4dp"
card_view:cardCornerRadius="10dp"
card_view:cardBackgroundColor="@color/windowBackground"
android:layout_span="6">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:padding="4dp"
    android:gravity="center"
    android:weightSum="1">
    <EditText
        android:id="@+id/bonuses_code_edit"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:layout_weight=".5"
        android:padding="8dp"
        android:layout_marginRight="4dp"
        android:background="@drawable/border_grey"
        android:hint="xxxx-xxxx-xxxx"
        android:maxLines="1"
        android:lines="1"
        android:inputType="text"
        android:nextFocusForward="@+id/bonuses_code_card"/>
    <android.support.v7.widget.CardView
        android:id="@+id/bonuses_code_card"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="4dp"
        card_view:contentPadding="0dp"
        card_view:cardUseCompatPadding="false"
        card_view:cardElevation="4dp"
        card_view:cardCornerRadius="10dp"
        card_view:cardBackgroundColor="@color/pinkAcivateCode"
        android:layout_weight=".5"
        android:clickable="true"
        android:onClick="onMenuButtonsClick">
        <TextView
            android:id="@+id/bonuses_code_button"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="@string/activate_code"
            android:textColor="@color/textColorPrimary"
            android:lines="2"
            android:padding="8dp" />
    </android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v7.widget.CardView>
...

<android.support.constraint.Guideline
android:id="@+id/guideline50"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="0dp" />

<android.support.constraint.Guideline
android:id="@+id/guideline70"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.7"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="0dp" />

...

</android.support.constraint.ConstraintLayout>

MainActivity.java:

public class MainActivity extends AppCompatActivity
    implements NavigationView.OnNavigationItemSelectedListener {

AppCompatActivity context;

...

TabLayout mainPageTabs;

View pagerView;
ViewPager mainPagePager;
MainPageTabsAdapter adapter;

TextView tabBonuses;
...

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fresco.initialize(this);
    setContentView(R.layout.activity_main);
    context = this;
    App.getContext().setCurrent(context); // saves reference to currently running Activity in Application class
    ...

    pagerView = findViewById(R.id.pager_frame);
    mainPageTabs = (TabLayout) findViewById(R.id.tabs);
    ...
    setupMainTabs();
}

public void setupMainTabs(){
    if (mainPagePager == null) mainPagePager = (ViewPager) findViewById(R.id.main_page_pager);
    if (mainPageTabs == null) mainPageTabs = (TabLayout) findViewById(R.id.tabs);
    setupMainPageViewPager(mainPagePager);
    mainPageTabs.setupWithViewPager(mainPagePager,true);
    ...

    tabBonuses = (TextView) LayoutInflater.from(this).inflate(R.layout.tab_item, null); // TextView with a background
    tabBonuses.setText(getText(R.string.collect_bonuses));
    ...
    mainPageTabs.getTabAt(0).setCustomView(tabBonuses);
    ...
//        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
//        imm.hideSoftInputFromWindow(findViewById(R.id.pager_frame).getWindowToken(), 0);
}

private void setupMainPageViewPager(ViewPager viewPager) {
    adapter = new MainPageTabsAdapter(getSupportFragmentManager(),this);
    viewPager.setAdapter(adapter);
    viewPager.setOffscreenPageLimit(2);
}

...

@Override
protected void onResume() {
    super.onResume();
    App.getContext().setCurrent(context);
    ...
//        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
//        imm.hideSoftInputFromWindow(findViewById(R.id.pager_frame).getWindowToken(), 0);
}

...

}

Application class:

...
private static App context;
private AppCompatActivity current;
...
@Override
public void onCreate() {
    super.onCreate();
    if (context == null) context = (DreamClub) getApplicationContext();
    ...
}
...

public void setCurrent(AppCompatActivity a) {
    current = a;
}

public Activity getCurrent(){return current;}
...

public static App getContext() {
    if (context == null) context = new DreamClub();
    return context;
}

MainPageTabsAdapter.java:

public class MainPageTabsAdapter extends FragmentPagerAdapter {

Context context;

ArrayList<Fragment> fragmList;
ArrayList<String> titleList;

public MainPageTabsAdapter(FragmentManager fm, Context context) {
    super(fm);
    this.context = context;
    fragmList = new ArrayList<>();
    fragmList.add(new GetBonusesFragment());
    ...
    titleList = new ArrayList<>();
    titleList.add(context.getString(R.string.collect_bonuses));
    ...
}

@Override
public Fragment getItem(int position) {
    return fragmList.get(position);
}

...

@Override
public CharSequence getPageTitle(int position) {
    return titleList.get(position);
}
}

GetBonusesFragment.java:

public class GetBonusesFragment extends Fragment {

EditText codeEdit;
View root;

...

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    root = inflater.inflate(R.layout.fragment_get_bonuses, container, false);
    ...
    codeEdit = (EditText) root.findViewById(R.id.bonuses_code_edit);
//        InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//        codeEdit.requestFocus();
//        imm.hideSoftInputFromWindow(codeEdit.getWindowToken(), 0);
    ...
//        codeEdit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
//            @Override
//            public void onFocusChange(View v, boolean hasFocus) {
//                if (hasFocus) {
//                    InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//                    imm.showSoftInput(root,0)/*hideSoftInputFromWindow(root.getWindowToken(), 0)*/;
//                }
//                else {
//                    Log.v("!!!called","on focus change: false");
//                    InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//                    imm.hideSoftInputFromWindow(root.getWindowToken(), 0);
//                }
//            }
//        });
    ...
    InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
    imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY,0);
//        try {
//            InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//            imm.hideSoftInputFromWindow(DreamClub.getContext().getCurrent().getCurrentFocus().getWindowToken(), 0);
//        }
//        catch (Exception e) {
//            try {
//                InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//                imm.hideSoftInputFromWindow(DreamClub.getContext().getCurrent().getWindow().findViewById(android.R.id.content).getRootView().getWindowToken(), 0);
//            }
//            catch (Exception e1) {
//                if (DreamClub.getContext().getCurrent().getWindow().findViewById(android.R.id.content).getRootView() != null && ((ViewGroup)getActivity().getWindow().findViewById(android.R.id.content).getRootView()).getChildCount() > 0) {
//                    for (int i = 0; i < ((ViewGroup)DreamClub.getContext().getCurrent().getWindow().findViewById(android.R.id.content).getRootView()).getChildCount(); i++) {
//                        if (((ViewGroup)DreamClub.getContext().getCurrent().getWindow().findViewById(android.R.id.content).getRootView()).getChildAt(i).getWindowToken() != null) {
//                            InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//                            imm.hideSoftInputFromWindow(((ViewGroup)DreamClub.getContext().getCurrent().getWindow().findViewById(android.R.id.content).getRootView()).getChildAt(i).getWindowToken(), 0);
//                            break;
//                        }
//                    }
//                }
//            }
//        }
//        root.findViewById(codeEdit.getNextFocusForwardId()).requestFocus();
//        root.findViewById(R.id.bonuses_wallets).requestFocus();
//        if (codeEdit.hasFocus()) {
//            codeEdit.clearFocus();
//        }
//        InputMethodManager imm = (InputMethodManager)(getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
//        imm.hideSoftInputFromWindow(codeEdit.getWindowToken(), 0);
//        imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
    return root;
}

//    @Override
//    public void onResume() {
//        super.onResume();
//        InputMethodManager imm = (InputMethodManager)(DreamClub.getContext().getCurrent().getSystemService(Context.INPUT_METHOD_SERVICE));
//        imm.hideSoftInputFromWindow(codeEdit.getWindowToken(), 0);
//    }
}

Body:
Add this in your manifest file

 <activity android:name="com.your.package.ActivityName"
  android:windowSoftInputMode="stateHidden"  />

or try

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

But if your requirement like hide keyborad on Button click or backPressed then use like this

public static void HideKeyboard(Context context, View view) {
    if (view == null) {
        return;
    }
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (!imm.isActive()) {
        return;
    }
    imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}

and please more follow this link

How to hide Soft Keyboard when activity starts


来源: stackexchange

问:
Filtering only on Annotations in Django
Taking the example from:
http://docs.djangoproject.com/en/dev/topics/db/aggregation/#filter-and-exclude

```<code>Publisher.objects.filter(book__rating__gt=3.0).annotate(num_books=Count('book'))
</code>```

Is there anyway to have the filter only apply to the annotation, so it would return all publishers, with some having a num_books=0?

答:
I just facing this kind of problem. And if my interpreation for the problem and expected solution is correct, this is my working solution:

Publisher.objects.annotate(num_books=Count('book')).filter(book__rating__gt=3.0)

Just swap filter & annotate position. This is done in Django version 1.9

ContentLicense: CC BY-SA 2.5

Title: Filtering only on Annotations in Django

Body:
Taking the example from:
http://docs.djangoproject.com/en/dev/topics/db/aggregation/#filter-and-exclude

Publisher.objects.filter(book__rating__gt=3.0).annotate(num_books=Count('book'))

Is there anyway to have the filter only apply to the annotation, so it would return all publishers, with some having a num_books=0?

ContentLicense: CC BY-SA 3.0


问:
Is there a Mercurial extension like svn propset?
I need to attach custom metadata to my source files that at tracked via Mercurial.  The svn properties commands are exactly what I need.

Is there a mercurial extension that provides commands similar to propset, propget, propdel, etc?

If there isn't an extension, why not?

Is there an alternative/better approach for custom metadata when using Mercurial?

Is custom metadata not useful to anyone else?

Is the extension dearly desired but just not written yet?

extra info: If it helps.  The metadata I'm tracking is whether each file has been codereviewed, unittested, qa'd, etc.  This data needs to be traceable and merges between branches/clones aren't fine grained enough.

答:
Mercurial's philosophy is that you track files and only files. You can't even check in an empty folder because Mercurial doesn't know about folders!

So, here are the answers:

I can't find any extension that does what you want. (You can write your own of course.)

The Mercurialful way to do what you want is to store the data in a flat file and use some scripts to process it. :(

It sounds like you've got a pretty well thought out system in place and good engineering practice at your company so I won't be pedantic here about it, but one can make a reasonable argument that your method does nothing except hurt portability. There's nothing magical about properties, I would just run an svn proplist -v . on your tree, dump that to hidden files -- something like .tracking -- just explicitly merge it along with your normal files. This doesn't really add any work since you have to merge properties anyway.

I hope that works for you!


问:
Pivot or Transforming JavaScript object
I have the following JavaScript object. I need to generate a new object from the given object. What is the approach I should take in JavaScript?

```<code>[
 {"name": "Dan",  "city" : "Columbus", "ZIP":"47201"},
 {"name": "Jen",  "city" : "Columbus", "ZIP":"47201"},
 {"name": "Mark", "city" : "Tampa",  "ZIP":"33602"},
]
</code>```

How can I transform or pivot to generate the following object?

```<code>[
 { "47201": [
              {"name": "Dan", "city": "Columbus"},
              {"name": "Jen", "city": "Columbus"},
             ],
    "count": "2"
  },
  { "33602": [
              {"name": "Mark", "city": "Tampa"}
             ],
    "count": "1"
  }
 ]
</code>```

答:
The below code will work for your requirement. The final result is stored in the variable result which holds the array object.</p>

```<code>    var source = [{
            "name": "Dan",
            "city": "Columbus",
            "ZIP": "47201"
        },
        {
            "name": "Mark",
            "city": "Tampa",
            "ZIP": "33602"
        },
        {
            "name": "Jen",
            "city": "Columbus",
            "ZIP": "47201"
        }
    ];

    var result = [];
    finalarr('ZIP');

    function finalarr(propname) {
        var obj = JSON.parse(JSON.stringify(source));

        obj.forEach(function(elm,i) {
            var arr = {};var chli=[];var charr={};
            var flag = 0;

            for (var prop in elm) {
                if(prop != propname){
                    charr[prop]=elm[prop];
                }
            }

            for(var i=0;i<result.length;i++){
                if(result[i][elm[propname]]){
                    result[0][elm[propname]].push(charr);
                    //console.log(result[i][propname]);
                    flag = 1;
                }
            }

            if(flag == 0){
                chli.push(charr);
                arr["count"] = checkarr(obj,propname,elm[propname]);
                arr[elm[propname]]=chli;
                result.push(arr);
            }
        });
    }

    function checkarr(obj,propname,value){
        var count = 0;
        obj.forEach(function(elm,i) {
            if(elm[propname] == value){
                count++;
            }
        });

        return count;
    }

console.log(result);
</code>```

Title: Pivot or Transforming JavaScript object

Body:
I have the following JavaScript object. I need to generate a new object from the given object. What is the approach I should take in JavaScript?

[
 {"name": "Dan",  "city" : "Columbus", "ZIP":"47201"},
 {"name": "Jen",  "city" : "Columbus", "ZIP":"47201"},
 {"name": "Mark", "city" : "Tampa",  "ZIP":"33602"},
]

How can I transform or pivot to generate the following object?

[
 { "47201": [
              {"name": "Dan", "city": "Columbus"},
              {"name": "Jen", "city": "Columbus"},
             ],
    "count": "2"
  },
  { "33602": [
              {"name": "Mark", "city": "Tampa"}
             ],
    "count": "1"
  }
 ]

Body:
The below code will work for your requirement. The final result is stored in the variable result which holds the array object.

    var source = [{
            "name": "Dan",
            "city": "Columbus",
            "ZIP": "47201"
        },
        {
            "name": "Mark",
            "city": "Tampa",
            "ZIP": "33602"
        },
        {
            "name": "Jen",
            "city": "Columbus",
            "ZIP": "47201"
        }
    ];

    var result = [];
    finalarr('ZIP');

    function finalarr(propname) {
        var obj = JSON.parse(JSON.stringify(source));

        obj.forEach(function(elm,i) {
            var arr = {};var chli=[];var charr={};
            var flag = 0;

            for (var prop in elm) {
                if(prop != propname){
                    charr[prop]=elm[prop];
                }
            }

            for(var i=0;i<result.length;i++){
                if(result[i][elm[propname]]){
                    result[0][elm[propname]].push(charr);
                    //console.log(result[i][propname]);
                    flag = 1;
                }
            }

            if(flag == 0){
                chli.push(charr);
                arr["count"] = checkarr(obj,propname,elm[propname]);
                arr[elm[propname]]=chli;
                result.push(arr);
            }
        });
    }

    function checkarr(obj,propname,value){
        var count = 0;
        obj.forEach(function(elm,i) {
            if(elm[propname] == value){
                count++;
            }
        });

        return count;
    }

console.log(result);


问:
Gitlab - Too many authentication failures for git
My command line git is not working since last week, all I remember is that I init a local folder into git version controlled, and add a remote git ref to it. Then my git is unable to push or pull. It shows:

```<code>git clone git@gitlab.xxx.com:xxx/myproj.git myproj
Cloning into 'myproj'...
Received disconnect from 192.168.xxx.xxx: 2: Too many authentication failures for git
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
</code>```

What's weird is that my version control in JetBrain Idea works fine, it can still pull or push that project which can't be pull in command line.

I've add the id_rsa.pub to gitlab before, and I re-add it again now, but it does not work.

My ssh debug info

ssh -v git@gitlab.xxx.com

```<code>OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to gitlab.xxx.com [192.168.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /Users/abc/.ssh/id_rsa type -1
debug1: identity file /Users/abc/.ssh/id_rsa-cert type -1
debug1: identity file /Users/abc/.ssh/id_dsa type -1
debug1: identity file /Users/abc/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA d7:11:d8:62:a6:30:1d:4a:c7:f1:99:bd:ba:54:de:60
debug1: Host 'gitlab.corp.com' is known and matches the RSA host key.
debug1: Found key in /Users/abc/.ssh/known_hosts:127
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn0
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn6
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn1
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn2
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn5
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn8
Received disconnect from 192.168.100.218: 2: Too many authentication failures for git
abc@LiuzhMacbook:~/.ssh$
abc@LiuzhMacbook:~/.ssh$ ls
authorized_keys  id_rsa           known_hosts      tmp/
abc@LiuzhMacbook:~/.ssh$ rm known_hosts
abc@LiuzhMacbook:~/.ssh$ ssh -v git@gitlab.corp.com
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to gitlab.corp.com [192.168.100.218] port 22.
debug1: Connection established.
debug1: identity file /Users/abc/.ssh/id_rsa type -1
debug1: identity file /Users/abc/.ssh/id_rsa-cert type -1
debug1: identity file /Users/abc/.ssh/id_dsa type -1
debug1: identity file /Users/abc/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA d7:11:d8:62:a6:30:1d:4a:c7:f1:99:bd:ba:54:de:60
The authenticity of host 'gitlab.corp.com (192.168.100.218)' can't be established.
RSA key fingerprint is d7:11:d8:62:a6:30:1d:4a:c7:f1:99:bd:ba:54:de:60.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.corp.com,192.168.100.218' (RSA) to the list of known hosts.
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn0
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn6
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn1
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn2
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn5
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn8
Received disconnect from 192.168.100.218: 2: Too many authentication failures for git
</code>```

答: In SourceTree, try changing SSH Client from PuTTY/Plink to Open SSH.

Body:
My command line git is not working since last week, all I remember is that I init a local folder into git version controlled, and add a remote git ref to it. Then my git is unable to push or pull. It shows:

git clone git@gitlab.xxx.com:xxx/myproj.git myproj
Cloning into 'myproj'...
Received disconnect from 192.168.xxx.xxx: 2: Too many authentication failures for git
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What's weird is that my version control in JetBrain Idea works fine, it can still pull or push that project which can't be pull in command line.

I've add the id_rsa.pub to gitlab before, and I re-add it again now, but it does not work.

My ssh debug info

ssh -v git@gitlab.xxx.com

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to gitlab.xxx.com [192.168.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /Users/abc/.ssh/id_rsa type -1
debug1: identity file /Users/abc/.ssh/id_rsa-cert type -1
debug1: identity file /Users/abc/.ssh/id_dsa type -1
debug1: identity file /Users/abc/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA d7:11:d8:62:a6:30:1d:4a:c7:f1:99:bd:ba:54:de:60
debug1: Host 'gitlab.corp.com' is known and matches the RSA host key.
debug1: Found key in /Users/abc/.ssh/known_hosts:127
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn0
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn6
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn1
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn2
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn5
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn8
Received disconnect from 192.168.100.218: 2: Too many authentication failures for git
abc@LiuzhMacbook:~/.ssh$
abc@LiuzhMacbook:~/.ssh$ ls
authorized_keys  id_rsa           known_hosts      tmp/
abc@LiuzhMacbook:~/.ssh$ rm known_hosts
abc@LiuzhMacbook:~/.ssh$ ssh -v git@gitlab.corp.com
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to gitlab.corp.com [192.168.100.218] port 22.
debug1: Connection established.
debug1: identity file /Users/abc/.ssh/id_rsa type -1
debug1: identity file /Users/abc/.ssh/id_rsa-cert type -1
debug1: identity file /Users/abc/.ssh/id_dsa type -1
debug1: identity file /Users/abc/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA d7:11:d8:62:a6:30:1d:4a:c7:f1:99:bd:ba:54:de:60
The authenticity of host 'gitlab.corp.com (192.168.100.218)' can't be established.
RSA key fingerprint is d7:11:d8:62:a6:30:1d:4a:c7:f1:99:bd:ba:54:de:60.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.corp.com,192.168.100.218' (RSA) to the list of known hosts.
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn0
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn6
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn1
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn2
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn5
debug1: Authentications that can continue: publickey,password,hostbased
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn8
Received disconnect from 192.168.100.218: 2: Too many authentication failures for git


问:
Onclick function is not working in Chrome browser
This is working fine in Internet Explorer and Firefox but not working in Chrome browser

<select name="Consolidate Report" class="input">
    <option value="">Consolidate Report</option>
    <option value="" onclick="view_graph()">View Graph</option>
    <option value="" onclick="export_graph()">Export Excel</option>
</select>```

答:
<option> elements don't fire the click event in most browsers.
you can go with onchange event for select.

http://webbugtrack.blogspot.in/2007/11/bug-280-lack-of-events-for-options.html

How to use onClick() or onSelect() on option tag in a JSP page?


问:
Angular Keycloak The 'Access-Control-Allow-Origin' header contains multiple values '*
I have deployed my front-end angular app with keycloak enabled. Also have a java rest based back-end for communication. When i run the app keycloak shows the login page, Then after i login it does not shows anything.

XMLHttpRequest cannot load http://test.ssdiary.com:2222/auth/realms/app1/protocol/openid-connect/token. Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values '*, http://test.ssdiary.com', but only one is allowed. Origin 'http://test.ssdiary.com' is therefore not allowed access.

GET http://test.ssdiary.com:2222/auth/realms/app1/protocol/openid-connect/login…ame.html/init?client_id=srms-frontend&origin=http%3A%2F%2Ftest.ssdiary.com 403 (Forbidden)strong text

Header from network tab

```<code>Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:accept, authorization, content-type, x-requested-with
Access-Control-Allow-Methods:GET, POST, OPTIONS, PUT
Access-Control-Allow-Origin:*
Access-Control-Max-Age:1
Connection:keep-alive
Content-Length:0
Date:Fri, 09 Jun 2017 04:57:38 GMT
Server:WildFly/10
X-Powered-By:Undertow/1
</code>```

答:
Please read the specifications of the Access-Control-Allow-Origin header here.

For requests without credentials, the server may specify "*" as a wildcard, thereby allowing any origin to access the resource.

You are setting Access-Control-Allow-Credentials:true in your request. Thus, multiple origins are not allowed to access the returned content. Try to send a single origin as the value of Access-Control-Allow-Origin from your server.

Body:
I have deployed my front-end angular app with keycloak enabled. Also have a java rest based back-end for communication. When i run the app keycloak shows the login page, Then after i login it does not shows anything.

XMLHttpRequest cannot load http://test.ssdiary.com:2222/auth/realms/app1/protocol/openid-connect/token. Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values '*, http://test.ssdiary.com', but only one is allowed. Origin 'http://test.ssdiary.com' is therefore not allowed access.

GET http://test.ssdiary.com:2222/auth/realms/app1/protocol/openid-connect/login…ame.html/init?client_id=srms-frontend&origin=http%3A%2F%2Ftest.ssdiary.com 403 (Forbidden)strong text

Header from network tab

Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:accept, authorization, content-type, x-requested-with
Access-Control-Allow-Methods:GET, POST, OPTIONS, PUT
Access-Control-Allow-Origin:*
Access-Control-Max-Age:1
Connection:keep-alive
Content-Length:0
Date:Fri, 09 Jun 2017 04:57:38 GMT
Server:WildFly/10
X-Powered-By:Undertow/1


问:
Python 3 Selenium KeyError: 'value' Issue won't initialize Geckodriver for Firefox
I'm having trouble running geckodriver with Python 3. I recently switched to Python 3 with an application that I've been working on, and have updated Firefox(53.0), Selenium(3.4.3), and geckodriver(0.17.1). I'm also using OSX and used pip to install all of my packages.

```<code>from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

# Set Firefox Settings
# binary = FirefoxBinary('Users/username/Applications/Firefox.app/Contents/MacOS/firefox')
# binary = FirefoxBinary('/Applications/Firefox.app/Contents/MacOS/firefox')
# binary = FirefoxBinary('/Applications/Firefox.app/Contents/MacOS/firefox-bin')

path = '/usr/local/bin/geckodriver'
profile = webdriver.FirefoxProfile()

browser = webdriver.Firefox(executable_path=path,
                        firefox_profile=profile,
                        firefox_binary=binary)

browser.get("http://google.com")
</code>```

The web browser will start, but then I will receive the following error:

```<code>Traceback (most recent call last):
File "/Users/jphubert/Desktop/AbstractionProject/py/browsertest.py", line 11, in <module>
firefox_profile=profile),
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 155, in __init__
keep_alive=True)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 183, in start_session
self.capabilities = response['value']
KeyError: 'value'
</code>```

I have uninstalled and reinstalled Firefox and geckodriver, taking @Viragos advice to ensure I installed the MacOS version. @Debanjan set me on the right track to try and set the Firefox binary and include it in the webdriver profile but I'm still getting the same error.

I've tried taking the Firefox binary from GitHub and putting it in a .py file as well, and have made attempts to remove the profile and executable path, but the same problem persists. My binary files are in the correct location and it works if I follow the path myself and click through their .exe files, but I can't make my script run anymore.

I've been running Selenium without any issues on Python 2.7, and only since yesterday, upgrading gecko and Python, have I been having problems.

Thank you!

答:
Here is the Answer to your Question:

Using Selenium 3.4.x, Python 3.6.1 along with geckodriver v0.16.1 & Mozilla Firefox 53.0, you can configure the following parameters:

firefox_binary: To provide the absolute path of the exact Firefox Binary you intend to use.

firefox_profile: To specify if you want to start with a new/existing Firefox Profile.

executable_path: To specify absolute path of the geckodriver.exe.

It is to be noted that the current Selenium-Python binding is unstable with geckodriver and looks to be Architecture specific. You can find the github discussion and merge here. So you may additionally need to pass the absolute path of the firefox binary as firefox_binary argument while initializing the webdriver

The following code block will open a Firefox Browser as per the configuration we set through the previous mentioned parameters:

```<code>from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary('C:\\Program Files\\Mozilla Firefox\\firefox.exe')
profile = webdriver.FirefoxProfile()
path = "C:\\Utility\\BrowserDrivers\\geckodriver.exe"

browser = webdriver.Firefox(executable_path=path, firefox_profile=profile,firefox_binary=binary)
browser.get("http://google.com")
</code>```

Let me know if this Answers your Question.

Body:
I'm having trouble running geckodriver with Python 3. I recently switched to Python 3 with an application that I've been working on, and have updated Firefox(53.0), Selenium(3.4.3), and geckodriver(0.17.1). I'm also using OSX and used pip to install all of my packages.

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

# Set Firefox Settings
# binary = FirefoxBinary('Users/username/Applications/Firefox.app/Contents/MacOS/firefox')
# binary = FirefoxBinary('/Applications/Firefox.app/Contents/MacOS/firefox')
# binary = FirefoxBinary('/Applications/Firefox.app/Contents/MacOS/firefox-bin')

path = '/usr/local/bin/geckodriver'
profile = webdriver.FirefoxProfile()

browser = webdriver.Firefox(executable_path=path,
                        firefox_profile=profile,
                        firefox_binary=binary)

browser.get("http://google.com")

The web browser will start, but then I will receive the following error:

Traceback (most recent call last):
File "/Users/jphubert/Desktop/AbstractionProject/py/browsertest.py", line 11, in <module>
firefox_profile=profile),
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 155, in __init__
keep_alive=True)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 183, in start_session
self.capabilities = response['value']
KeyError: 'value'

I have uninstalled and reinstalled Firefox and geckodriver, taking @Viragos advice to ensure I installed the MacOS version. @Debanjan set me on the right track to try and set the Firefox binary and include it in the webdriver profile but I'm still getting the same error.

I've tried taking the Firefox binary from GitHub and putting it in a .py file as well, and have made attempts to remove the profile and executable path, but the same problem persists. My binary files are in the correct location and it works if I follow the path myself and click through their .exe files, but I can't make my script run anymore.

I've been running Selenium without any issues on Python 2.7, and only since yesterday, upgrading gecko and Python, have I been having problems.

Thank you!

Body:
Here is the Answer to your Question:

Using Selenium 3.4.x, Python 3.6.1 along with geckodriver v0.16.1 & Mozilla Firefox 53.0, you can configure the following parameters:

firefox_binary: To provide the absolute path of the exact Firefox Binary you intend to use.

firefox_profile: To specify if you want to start with a new/existing Firefox Profile.

executable_path: To specify absolute path of the geckodriver.exe.

It is to be noted that the current Selenium-Python binding is unstable with geckodriver and looks to be Architecture specific. You can find the github discussion and merge here. So you may additionally need to pass the absolute path of the firefox binary as firefox_binary argument while initializing the webdriver

The following code block will open a Firefox Browser as per the configuration we set through the previous mentioned parameters:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary('C:\\Program Files\\Mozilla Firefox\\firefox.exe')
profile = webdriver.FirefoxProfile()
path = "C:\\Utility\\BrowserDrivers\\geckodriver.exe"

browser = webdriver.Firefox(executable_path=path, firefox_profile=profile,firefox_binary=binary)
browser.get("http://google.com")

Let me know if this Answers your Question.


问:
Inherit purchase order and create new object

Blockquote

I inherit the _inherit='purchase.order, and create new object with name _name='job.order' and use its view but when i am going to save it showing error (odoo warning) in pic.

答:
use _inherits instead of _inherit this way you will create new object with with all field of 'purchase.order plus new field you declare in your model that won't affect original model.

for reference check res.user model in base module


问:
Unable to django start server after commited some migration files to smartgit
enter code here(kemgo-api-v2) ronnie@vax-PC-88:/var/www/html/kemgo-api-v2$ python manage.py runserver

```<code>Performing system checks...

System check identified no issues (0 silenced).
Unhandled exception in thread started by <function wrapper at 0x7f22b50abcf8>
Traceback (most recent call last):
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 222, in wrapper
    fn(*args, **kwargs)
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run
    self.check_migrations()
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 159, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 17, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 48, in __init__
    self.build_graph()
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 241, in build_graph
    self.graph.add_dependency(migration, key, parent)
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/db/migrations/graph.py", line 42, in add_dependency
    raise KeyError("Migration %s dependencies references nonexistent parent node %r" % (migration, parent))
KeyError: u"Migration storefront.0002_storeview dependencies references nonexistent parent node (u'km', u'0010_auto_20170327_0841')"
</code>```

0002_storeview.py

```<code># -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import django.utils.timezone

class Migration(migrations.Migration):

    dependencies = [
        ('km', '0010_auto_20170327_0841'),
        ('storefront', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='StoreView',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('ip', models.GenericIPAddressField(default=b'', null=True, blank=True)),
                ('viewtype', models.CharField(default=b'1', max_length=1, null=True, blank=True, choices=[(b'1', b'View'), (b'2', b'Mobile'), (b'3', b'Website'), (b'4', b'Email'), (b'5', b'Contact Tab'), (b'6', b'TDS Download')])),
                ('source', models.CharField(default=b'IOS', max_length=20, null=True, blank=True)),
                ('status', models.CharField(default=b'0', max_length=1, null=True, blank=True, choices=[(b'0', b'Inactive'), (b'1', b'Active')])),
                ('created_date', models.DateTimeField(default=django.utils.timezone.now)),
                ('store', models.ForeignKey(related_name=b'storeview', to='km.Store')),
                ('user', models.ForeignKey(related_name=b'store_userview', to='km.User', null=True)),
            ],
            options={
            },
            bases=(models.Model,),
        ),
    ]
</code>```

i have deleted the following files and then commit:
    globalmarket/migrations/init.py
    inquiry/migrations/init.py
    km/migrations/.gitignore
    km/migrations/0001_initial.py
    km/migrations/0002_store1.py
    km/migrations/0003_remove_storemodule_created_date.py
    km/migrations/0004_storemodule_created_date.py
    km/migrations/0005_delete_store1.py
    km/migrations/init.py
    km/migrations/back/.gitignore
    km/migrations_bck/.gitignore
    km/migrations_bck/0025_auto_20150224_1547.py.bak
    km/migrations_bck/0026_auto_20150225_0958.py.bak
    km/migrations_bck/0107_auto_20151023_0541.py.bak
    km/migrations_bck/@
    storefront/migrations/0001_initial.py
    storefront/migrations/0002_storeview.py
    storefront/migrations/init.py

答:
Error message seems pretty clear:

```<code>KeyError: u"Migration storefront.0002_storeview dependencies references nonexistent parent node (u'km', u'0010_auto_20170327_0841')"
</code>```

Maybe you forgot to commit a file (0010_auto_20170327_0841.py) to your git repository, or this file has been deleted for a reason. Anyway, when applying migration, the migration 0002_storeview.py from application storefront try to locate its parent (the previous migration) but can't find the corresponding file

Body:
enter code here(kemgo-api-v2) ronnie@vax-PC-88:/var/www/html/kemgo-api-v2$ python manage.py runserver

Performing system checks...

System check identified no issues (0 silenced).
Unhandled exception in thread started by <function wrapper at 0x7f22b50abcf8>
Traceback (most recent call last):
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 222, in wrapper
    fn(*args, **kwargs)
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run
    self.check_migrations()
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 159, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 17, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 48, in __init__
    self.build_graph()
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 241, in build_graph
    self.graph.add_dependency(migration, key, parent)
  File "/home/mohit/.virtualenvs/kemgo-api-v2/local/lib/python2.7/site-packages/django/db/migrations/graph.py", line 42, in add_dependency
    raise KeyError("Migration %s dependencies references nonexistent parent node %r" % (migration, parent))
KeyError: u"Migration storefront.0002_storeview dependencies references nonexistent parent node (u'km', u'0010_auto_20170327_0841')"

0002_storeview.py

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import django.utils.timezone

class Migration(migrations.Migration):

    dependencies = [
        ('km', '0010_auto_20170327_0841'),
        ('storefront', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='StoreView',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('ip', models.GenericIPAddressField(default=b'', null=True, blank=True)),
                ('viewtype', models.CharField(default=b'1', max_length=1, null=True, blank=True, choices=[(b'1', b'View'), (b'2', b'Mobile'), (b'3', b'Website'), (b'4', b'Email'), (b'5', b'Contact Tab'), (b'6', b'TDS Download')])),
                ('source', models.CharField(default=b'IOS', max_length=20, null=True, blank=True)),
                ('status', models.CharField(default=b'0', max_length=1, null=True, blank=True, choices=[(b'0', b'Inactive'), (b'1', b'Active')])),
                ('created_date', models.DateTimeField(default=django.utils.timezone.now)),
                ('store', models.ForeignKey(related_name=b'storeview', to='km.Store')),
                ('user', models.ForeignKey(related_name=b'store_userview', to='km.User', null=True)),
            ],
            options={
            },
            bases=(models.Model,),
        ),
    ]

i have deleted the following files and then commit:
    globalmarket/migrations/init.py
    inquiry/migrations/init.py
    km/migrations/.gitignore
    km/migrations/0001_initial.py
    km/migrations/0002_store1.py
    km/migrations/0003_remove_storemodule_created_date.py
    km/migrations/0004_storemodule_created_date.py
    km/migrations/0005_delete_store1.py
    km/migrations/init.py
    km/migrations/back/.gitignore
    km/migrations_bck/.gitignore
    km/migrations_bck/0025_auto_20150224_1547.py.bak
    km/migrations_bck/0026_auto_20150225_0958.py.bak
    km/migrations_bck/0107_auto_20151023_0541.py.bak
    km/migrations_bck/@
    storefront/migrations/0001_initial.py
    storefront/migrations/0002_storeview.py
    storefront/migrations/init.py

Body:
Error message seems pretty clear:

KeyError: u"Migration storefront.0002_storeview dependencies references nonexistent parent node (u'km', u'0010_auto_20170327_0841')"

Maybe you forgot to commit a file (0010_auto_20170327_0841.py) to your git repository, or this file has been deleted for a reason. Anyway, when applying migration, the migration 0002_storeview.py from application storefront try to locate its parent (the previous migration) but can't find the corresponding file


问:
How do you dismiss the keyboard when editing a UITextField
I know that I need to tell my UITextField to resign first responder when I want to dismis the keyboard, but I'm not sure how to know when the user has pressed the "Done" key on the keyboard. Is there a notification I can watch for?</p>

答: Here is a trick for getting automatic keyboard dismissal behavior with no code at all. In the nib, edit the First Responder proxy object in the Identity inspector, adding a new first responder action; let's call it dummy:. Now hook the Did End on Exit event of the text field to the dummy: action of the First Responder proxy object. That's it! Since the text field's Did End on Exit event now has an action–target pair, the text field automatically dismisses its keyboard when the user taps Return; and since there is no penalty for not finding a handler for a message sent up the responder chain, the app doesn't crash even though there is no implementation of dummy: anywhere.

OwnerDisplayName: kubi

LastEditorDisplayName: Chris Hanson


问:
How to get in which floor user is locate?
I need to location of floor where is user currently locating and I tried two ways

using CLLocation and location.floor?.level
and google elevation API

https://developers.google.com/maps/documentation/elevation/start

but on the First case, I got nil
and the second case I get the elevation which I got in the first case but I didn't floor.

so how to get floor ? thanks

答:
From my understanding :

If floor information is not available for the current location, the value of this property is nil.

https://developer.apple.com/documentation/corelocation/clfloor/1616759-level


问:
Sitecore Task Scheduling With Time Period Exception
I have a number of scheduled tasks set up in Sitecore.  Some run every 15 mins others every few hours.

An example config:

  <sitecore>
    <scheduling>
      <agent type="Acme.Tasks.SitemapProducts, AcmeSitecore" method="Run" interval="00:15:00" site="website">
        <param desc="filename">~/products.xml</param>
        <param desc="Site">website</param>
        <param desc="HasVariants">false</param>
      </agent>
    </scheduling>
  </sitecore>
```

This runs a task that builds an xml file every 15 mins and is working fine.  However I now want to stop this task from running between certain times on certain days. Is there any way for me to add this via config?

答:
No. There is no way of doing this via config only.

What you can do is to pass extra parameters to your scheduled task and set start and end time. And then in your scheduled task code just check if current time is between start and end time.

The job will be executed but it will not generate new xml.

<sitecore>
    <scheduling>
      <agent type="Acme.Tasks.SitemapProducts, AcmeSitecore" method="Run" interval="00:15:00" site="website">
        <param desc="filename">~/products.xml</param>
        <param desc="Site">website</param>
        <param desc="HasVariants">false</param>
        <StartTime>08:00</StartTime>
        <Endtime>21:00</Endtime>
      </agent>
    </scheduling>
</sitecore>
```

<p>Code should be something like this (not tested):</p>

<pre class="lang-cs prettyprint-override"><code>public class SitemapProducts
{
    public string StartTime { get; set; }
    public string EndTime { get; set; }

    public void Run()
    {
      if (!string.IsNullOrEmpty(StartTime) && DateTime.Now.ToString("HH:mm") < StartTime)
      {
          return;
      }
      if (!string.IsNullOrEmpty(EndTime) && DateTime.Now.ToString("HH:mm") > EndTime)
      {
          return;
      }
    }
</code>```

Body:
I have a number of scheduled tasks set up in Sitecore.  Some run every 15 mins others every few hours.

An example config:

  <sitecore>
    <scheduling>
      <agent type="Acme.Tasks.SitemapProducts, AcmeSitecore" method="Run" interval="00:15:00" site="website">
        <param desc="filename">~/products.xml</param>
        <param desc="Site">website</param>
        <param desc="HasVariants">false</param>
      </agent>
    </scheduling>
  </sitecore>

This runs a task that builds an xml file every 15 mins and is working fine.  However I now want to stop this task from running between certain times on certain days. Is there any way for me to add this via config?

Body:
No. There is no way of doing this via config only.

What you can do is to pass extra parameters to your scheduled task and set start and end time. And then in your scheduled task code just check if current time is between start and end time.

The job will be executed but it will not generate new xml.

<sitecore>
    <scheduling>
      <agent type="Acme.Tasks.SitemapProducts, AcmeSitecore" method="Run" interval="00:15:00" site="website">
        <param desc="filename">~/products.xml</param>
        <param desc="Site">website</param>
        <param desc="HasVariants">false</param>
        <StartTime>08:00</StartTime>
        <Endtime>21:00</Endtime>
      </agent>
    </scheduling>
</sitecore>

Code should be something like this (not tested):

public class SitemapProducts
{
    public string StartTime { get; set; }
    public string EndTime { get; set; }

    public void Run()
    {
      if (!string.IsNullOrEmpty(StartTime) && DateTime.Now.ToString("HH:mm") < StartTime)
      {
          return;
      }
      if (!string.IsNullOrEmpty(EndTime) && DateTime.Now.ToString("HH:mm") > EndTime)
      {
          return;
      }
    }


问:
No Pattern Interface Error with many methods in UIA backend
I am trying to automate a rather old game client using pywinauto. I've had some success using the default win32 backend, but the uia backend can see more control identifiers, so I am attempting to rewrite the current automation with uia instead. Unfortunately, I have noticed that there seems to be less functionality with UIA. For example, I can only click_input, as there is no silent click. The bigger problem I have been having though is calling any method that requires an iface, as I get the error "NoPatternInterface".

For example, I am attempting to call get_selection() as a method of a ListItemWrapper, and it returns the following error.

Any Advice would be appreciated!

答:
If this is your own app with all sources, you can implement UI Automation provider for this control class. It's out of scope for pywinauto because providers are often implemented on app side. Some guidance could be found in this MSDN article or somewhere else. This is a kind of challenge.

P.S. I would be interested in examples for the most common apps like WinForms or WPF so that we can provide a short reference in pywinauto docs.


问:
RDF4J workbench failing SPARQL federated query
I have Tomcat running on my machine with RDF4J server and RDF4J workbench deployed. I am trying to run a federated query to join two Native Java Stores (NativeStore1 and NativeStore2) and link data from them.

Right now, I am trying to get anything back from NativeStore2 from a query on NatvieStore1, but it is failing. I am running the federated query directly from the workbench.  Regular queries work fine.

Is there a better way to do this, or am I just doing it wrong? Any help is very much appreciated.

My SPARQL query from NativeStore1:

```<code>select ?a ?b ?name
    where
    {
      ?a ?b ?name.
      SERVICE <http://localhost:8080/rdf4j-server/repositories/NativeStore2> {
          ?a ?b ?name1.
      }
    }
</code>```

Given error in RDF4j (this is a string of html that gets thrown out directly under the query box):

Apache Tomcat/7.0.77 - Error report
HTTP Status 500 - Query evaluation error: org.eclipse.rdf4j.query.QueryEvaluationException: java.lang.NullPointerException

type Status report

message Query evaluation error: org.eclipse.rdf4j.query.QueryEvaluationException: java.lang.NullPointerException

description The server encountered an internal error that prevented it from fulfilling this request.

Apache Tomcat/7.0.77

RDF4J Server log:

```<code>Query evaluation errororg.eclipse.rdf4j.query.QueryEvaluationException: org.eclipse.rdf4j.query.QueryEvaluationException: java.lang.NullPointerExceptionCaused by: org.eclipse.rdf4j.query.QueryEvaluationException: java.lang.NullPointerExceptionCaused by: java.lang.NullPointerException: null

at org.eclipse.rdf4j.http.client.QueueCursor.convert(QueueCursor.java:47)
at org.eclipse.rdf4j.http.client.QueueCursor.convert(QueueCursor.java:19)
at org.eclipse.rdf4j.common.iteration.QueueIteration.checkException(QueueIteration.java:185)
at org.eclipse.rdf4j.common.iteration.QueueIteration.getNextElement(QueueIteration.java:133)
at org.eclipse.rdf4j.common.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:90)
at org.eclipse.rdf4j.common.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:52)
at org.eclipse.rdf4j.query.algebra.evaluation.federation.JoinExecutorBase.getNextElement(JoinExecutorBase.java:122)
at org.eclipse.rdf4j.common.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:90)
at org.eclipse.rdf4j.common.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:52)
at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:68)
at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:63)
at org.eclipse.rdf4j.sail.base.SailClosingIteration.hasNext(SailClosingIteration.java:89)
at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:63)
at org.eclipse.rdf4j.sail.helpers.SailBaseIteration.hasNext(SailBaseIteration.java:48)
at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:63)
at org.eclipse.rdf4j.query.QueryResults.report(QueryResults.java:256)
at org.eclipse.rdf4j.http.server.repository.TupleQueryResultView.renderInternal(TupleQueryResultView.java:100)
at org.eclipse.rdf4j.http.server.repository.QueryResultView.render(QueryResultView.java:64)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.github.ziplet.filter.compression.CompressingFilter.doFilter(CompressingFilter.java:300)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2549)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2538)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
at org.eclipse.rdf4j.http.client.QueueCursor.convert(QueueCursor.java:47)
at org.eclipse.rdf4j.http.client.QueueCursor.convert(QueueCursor.java:19)
at org.eclipse.rdf4j.common.iteration.QueueIteration.checkException(QueueIteration.java:185)
at org.eclipse.rdf4j.common.iteration.QueueIteration.handleClose(QueueIteration.java:172)
at org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration.close(AbstractCloseableIteration.java:51)
at org.eclipse.rdf4j.common.iteration.QueueIteration.checkException(QueueIteration.java:181)
... 48 common frames omitted
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.getService(StrictEvaluationStrategy.java:225)
at org.eclipse.rdf4j.query.algebra.evaluation.federation.ServiceJoinIterator.handleBindings(ServiceJoinIterator.java:68)
at org.eclipse.rdf4j.query.algebra.evaluation.federation.JoinExecutorBase.run(JoinExecutorBase.java:67)
at org.eclipse.rdf4j.query.algebra.evaluation.federation.ServiceJoinIterator.<init>(ServiceJoinIterator.java:45)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:911)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:881)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:240)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:783)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:673)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:237)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:706)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:237)
at org.eclipse.rdf4j.sail.base.SailSourceConnection.evaluateInternal(SailSourceConnection.java:246)
at org.eclipse.rdf4j.sail.helpers.AbstractSailConnection.evaluate(AbstractSailConnection.java:267)
at org.eclipse.rdf4j.repository.sail.SailTupleQuery.evaluate(SailTupleQuery.java:54)
at org.eclipse.rdf4j.http.server.repository.RepositoryController.handleRequestInternal(RepositoryController.java:208)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:147)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
... 30 common frames omitted
</code>```

答: Issue should be fixed by rdf4j 2.2.2 see github https://github.com/eclipse/rdf4j/issues/812 and the issue reported by sethdippold https://github.com/eclipse/rdf4j/issues/824</p>

Body:
I have Tomcat running on my machine with RDF4J server and RDF4J workbench deployed. I am trying to run a federated query to join two Native Java Stores (NativeStore1 and NativeStore2) and link data from them.

Right now, I am trying to get anything back from NativeStore2 from a query on NatvieStore1, but it is failing. I am running the federated query directly from the workbench.  Regular queries work fine.

Is there a better way to do this, or am I just doing it wrong? Any help is very much appreciated.

My SPARQL query from NativeStore1:

select ?a ?b ?name
    where
    {
      ?a ?b ?name.
      SERVICE <http://localhost:8080/rdf4j-server/repositories/NativeStore2> {
          ?a ?b ?name1.
      }
    }

Given error in RDF4j (this is a string of html that gets thrown out directly under the query box):

Apache Tomcat/7.0.77 - Error report
HTTP Status 500 - Query evaluation error: org.eclipse.rdf4j.query.QueryEvaluationException: java.lang.NullPointerException

type Status report

message Query evaluation error: org.eclipse.rdf4j.query.QueryEvaluationException: java.lang.NullPointerException

description The server encountered an internal error that prevented it from fulfilling this request.

Apache Tomcat/7.0.77

RDF4J Server log:

Query evaluation errororg.eclipse.rdf4j.query.QueryEvaluationException: org.eclipse.rdf4j.query.QueryEvaluationException: java.lang.NullPointerExceptionCaused by: org.eclipse.rdf4j.query.QueryEvaluationException: java.lang.NullPointerExceptionCaused by: java.lang.NullPointerException: null

at org.eclipse.rdf4j.http.client.QueueCursor.convert(QueueCursor.java:47)
at org.eclipse.rdf4j.http.client.QueueCursor.convert(QueueCursor.java:19)
at org.eclipse.rdf4j.common.iteration.QueueIteration.checkException(QueueIteration.java:185)
at org.eclipse.rdf4j.common.iteration.QueueIteration.getNextElement(QueueIteration.java:133)
at org.eclipse.rdf4j.common.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:90)
at org.eclipse.rdf4j.common.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:52)
at org.eclipse.rdf4j.query.algebra.evaluation.federation.JoinExecutorBase.getNextElement(JoinExecutorBase.java:122)
at org.eclipse.rdf4j.common.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:90)
at org.eclipse.rdf4j.common.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:52)
at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:68)
at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:63)
at org.eclipse.rdf4j.sail.base.SailClosingIteration.hasNext(SailClosingIteration.java:89)
at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:63)
at org.eclipse.rdf4j.sail.helpers.SailBaseIteration.hasNext(SailBaseIteration.java:48)
at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:63)
at org.eclipse.rdf4j.query.QueryResults.report(QueryResults.java:256)
at org.eclipse.rdf4j.http.server.repository.TupleQueryResultView.renderInternal(TupleQueryResultView.java:100)
at org.eclipse.rdf4j.http.server.repository.QueryResultView.render(QueryResultView.java:64)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.github.ziplet.filter.compression.CompressingFilter.doFilter(CompressingFilter.java:300)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2549)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2538)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
at org.eclipse.rdf4j.http.client.QueueCursor.convert(QueueCursor.java:47)
at org.eclipse.rdf4j.http.client.QueueCursor.convert(QueueCursor.java:19)
at org.eclipse.rdf4j.common.iteration.QueueIteration.checkException(QueueIteration.java:185)
at org.eclipse.rdf4j.common.iteration.QueueIteration.handleClose(QueueIteration.java:172)
at org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration.close(AbstractCloseableIteration.java:51)
at org.eclipse.rdf4j.common.iteration.QueueIteration.checkException(QueueIteration.java:181)
... 48 common frames omitted
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.getService(StrictEvaluationStrategy.java:225)
at org.eclipse.rdf4j.query.algebra.evaluation.federation.ServiceJoinIterator.handleBindings(ServiceJoinIterator.java:68)
at org.eclipse.rdf4j.query.algebra.evaluation.federation.JoinExecutorBase.run(JoinExecutorBase.java:67)
at org.eclipse.rdf4j.query.algebra.evaluation.federation.ServiceJoinIterator.<init>(ServiceJoinIterator.java:45)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:911)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:881)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:240)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:783)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:673)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:237)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:706)
at org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy.evaluate(StrictEvaluationStrategy.java:237)
at org.eclipse.rdf4j.sail.base.SailSourceConnection.evaluateInternal(SailSourceConnection.java:246)
at org.eclipse.rdf4j.sail.helpers.AbstractSailConnection.evaluate(AbstractSailConnection.java:267)
at org.eclipse.rdf4j.repository.sail.SailTupleQuery.evaluate(SailTupleQuery.java:54)
at org.eclipse.rdf4j.http.server.repository.RepositoryController.handleRequestInternal(RepositoryController.java:208)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:147)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
... 30 common frames omitted