text:
Q: How to properly install pyclewn for VIM? I am interested in improving my workflow, and was hoping to add clewn or pyclewn so I could do debugging in vim. I am using Mac OS X 10.8. Unfortunately, I can't seem to get it installed with the basic instructions. I run the instuctions on this page: http://pyclewn.sourceforge.net/install.html
https://sourceforge.net/projects/pyclewn/
mbp:pyclewn-1.10.py2 nate$ python setup.py install --force
Failed to run 'gvim' as Vim.
Please set the EDITOR environment variable or run 'pyclewn --editor=/path/to/(g)vim'.

Traceback (most recent call last):
  File "setup.py", line 48, in <module>
    vimdir = pyclewn_install.vimdir()
  File "/Users/nate/Downloads/pyclewn-1.10.py2/clewn/misc.py", line 85, in _dec
ret = f(*args)
  File "/Users/nate/Downloads/pyclewn-1.10.py2/pyclewn_install.py", line 49, in vimdir
    path = vim.exec_vimcmd(['echon $VIM'])
  File "/Users/nate/Downloads/pyclewn-1.10.py2/clewn/vim.py", line 96, in exec_vimcmd
subprocess.Popen(args).wait()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

I try to do as it suggests by setting the EDITOR variable:
mbp:pyclewn-1.10.py2 nate$ EDITOR=/usr/bin/vim
mbp:pyclewn-1.10.py2 nate$ echo $EDITOR
/usr/bin/vim

...But I get the same error again. I get the same error if I try to use the Python 3 version of pyclewn as well.
Trying to run the other suggested command gives another error:
mbp:pyclewn-1.10.py2 nate$ ./pyclewn --editor=/usr/bin/vim
vim  CRITICAL
Exception in pyclewn:

<class 'clewn.ClewnError'>
"pyclewn.vim version does not match pyclewn's:
    pyclewn version: "pyclewn-1.10.py2"
    pyclewn.vim version: """
source line: "% (pyclewn_version, version))"
at /Users/nate/Downloads/pyclewn-1.10.py2/clewn/vim.py:383
pyclewn aborting...

Any ideas? I don't know enough about this kind of stuff to help fix it, unfortunately. The project is hosted on sourceforge, and I can't figure out how to report a bug there, so I'm posting here.

A: As usual, I am an idiot. Having not exported the EDITOR variable, it was invisible to the python script. So, for those of you that have this error, you need to do:
$ EDITOR=/usr/bin/vim
$ echo $EDITOR
/usr/bin/vim
$ export EDITOR

For me it seems that my version of vim does have netbeans_intg and autocmd support (required for pyclewn). It does not have python3 support. You can figure this out by typing vim --version. I am not sure if at some point in the past I replaced the version of vim that comes with OS X, or if that is how it comes now. I don't know why I would have modified/replaced the /usr/bin/ version, so I assume it is now standard that way. Hopefully this works for others.

A: I have no practical experience with pyclewn but a few things are relatively obvious from your question:

*

*You are using the default Vim that comes with Mac OS X. AFAIK, it doesn't come either with Python support or with the netbeans interface. Basically, there's no way to get a working pyclewn install (let alone a convincing editing environment) that way. I'd suggest you get a proper Vim build like MacVim which, AFAIK, comes with all you need. Assuming you have moved the bundled mvim script somewhere in your $PATH, you'll probably be able to run pyclewn --editor=/path/to/mvim.

*While you can install a GTK-based GVim on a Mac under X11, I don't believe you should take that route. This would give you a proper gvim command but you would probably loose on other fronts.


text:
Q: Error on inflating layout with navigation When i inflate my layout with navigation drawer there is a error on inflating the layout.what is the problem in this layout.Please help me if someone can.
I am aded navigation_view in between drawer_layout but it cannot work and error on inflating layout
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    app:actionViewClass="android.support.v7.widget.SearchView"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.techweblearn.musicplayer.MainActivity"
    android:id="@+id/drawer_layout">

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

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start" />

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

activity_main_view.xml
<android.support.design.widget.CoordinatorLayout  xmlns:android="http://schemas.android.com/apk/res/android"
app:actionViewClass="android.support.v7.widget.SearchView"
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">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <android.support.v7.widget.Toolbar
        android:id="@+id/my_toolbar"
        style="@style/MyAppTheme"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical" />

    <android.support.design.widget.TabLayout
        android:id="@+id/tab"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top"
        android:background="#ffffff"
        app:tabIndicatorColor="@color/black" />

</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
    android:layout_marginBottom="?attr/actionBarSize"
    android:layout_marginTop="105dp"
    android:layout_below="@id/appBar"
    android:id="@+id/view_pager"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentLeft="true">

</android.support.v4.view.ViewPager>

<RelativeLayout
    android:elevation="16dp"
    android:id="@+id/design_bottom_sheet"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    app:behavior_hideable="true"
    app:behavior_peekHeight="50dp"
    app:layout_behavior="@string/bottom_sheet_behavior">

    <fragment android:name="com.techweblearn.musicplayer.BottomPlayer"

        android:id="@+id/bottom_fragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</RelativeLayout>

Log
FATAL EXCEPTION: main
                                                                          Process: com.techweblearn.musicplayer, PID: 17999
                                                                          java.lang.RuntimeException: Unable to start activity ComponentInfo{com.techweblearn.musicplayer/com.techweblearn.musicplayer.MainActivity}: android.view.InflateException: Binary XML file line #12: Binary XML file line #12: Error inflating class android.support.design.widget.NavigationView
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
                                                                              at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                              at android.os.Looper.loop(Looper.java:154)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
                                                                           Caused by: android.view.InflateException: Binary XML file line #12: Binary XML file line #12: Error inflating class android.support.design.widget.NavigationView
                                                                           Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class android.support.design.widget.NavigationView
                                                                           Caused by: java.lang.reflect.InvocationTargetException
                                                                              at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                              at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
                                                                              at android.view.LayoutInflater.createView(LayoutInflater.java:645)
                                                                              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
                                                                              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
                                                                              at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
                                                                              at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
                                                                              at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
                                                                              at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                              at com.techweblearn.musicplayer.MainActivity.onCreate(MainActivity.java:116)
                                                                              at android.app.Activity.performCreate(Activity.java:6679)
                                                                              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
                                                                              at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                              at android.os.Looper.loop(Looper.java:154)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
                                                                           Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
                                                                              at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:190)
                                                                              at android.content.res.Resources.getColorStateList(Resources.java:992)
                                                                              at android.content.Context.getColorStateList(Context.java:542)
                                                                              at android.support.v7.content.res.AppCompatResources.getColorStateList(AppCompatResources.java:65)
                                                                              at android.support.design.widget.NavigationView.createDefaultColorStateList(NavigationView.java:422)
                                                                              at android.support.design.widget.NavigationView.<init>(NavigationView.java:148)
                                                                              at android.support.design.widget.NavigationView.<init>(NavigationView.java:100)
                                                                              at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                              at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
                                                                              at android.view.LayoutInflater.createView(LayoutInflater.java:645)
                                                                              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
                                                                              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
                                                                              at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
                                                                              at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
                                                                              at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
                                                                              at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                              at com.techweblearn.musicplayer.MainActivity.onCreate(MainActivity.java:116)
                                                                              at android.app.Activity.performCreate(Activity.java:6679)
                                                                              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
                                                                              at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                              at android.os.Looper.loop(Looper.java:154)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

A: *

*Remove attribute app:actionViewClass="android.support.v7.widget.SearchView" from DrawerLayout and CoordinatorLayout.

*Add menu and headerLayout to NavigationView.
Update your activity_main.xml as below:
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.techweblearn.musicplayer.MainActivity"
    android:id="@+id/drawer_layout">

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

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer" />

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

Update your activity_main_view.xml as below:
<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"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <android.support.v7.widget.Toolbar
            android:id="@+id/my_toolbar"
            style="@style/MyAppTheme"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical" />

        <android.support.design.widget.TabLayout
            android:id="@+id/tab"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:background="#ffffff"
            app:tabIndicatorColor="@color/black" />

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:layout_marginBottom="?attr/actionBarSize"
        android:layout_marginTop="105dp"
        android:layout_below="@id/appBar"
        android:id="@+id/view_pager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentLeft="true">

    </android.support.v4.view.ViewPager>

    <RelativeLayout
        android:elevation="16dp"
        android:id="@+id/design_bottom_sheet"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ffffff"
        app:behavior_hideable="true"
        app:behavior_peekHeight="50dp"
        app:layout_behavior="@string/bottom_sheet_behavior">

        <fragment
            android:name="com.techweblearn.musicplayer.BottomPlayer"
            android:id="@+id/bottom_fragment"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </RelativeLayout>
</android.support.design.widget.CoordinatorLayout>

Hope it helps!

A: Solved the error by adding.
app:itemTextColor="#000"

in navigationview
<android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:menu="@menu/nav_menu_item"
    app:headerLayout="@layout/nav_header"
    app:itemTextColor="#000"/>

redpajama_set_name: RedPajamaStackExchange


text:
Q: Measure network time in SQL query Question raised just out of curiosity while working on an SQL query over a VPN connection. VPN is slow hence query was also performing slow. But I don't have direct access to the Database Server, so to test queries I need to run them through VPN :(
Is there any way to eliminate time taken by network lag due to VPN and know the actual time taken by my query? without making a copy of database and bringing it to my local system/network.

A: You network performance is totally dependent on your infrastructure.
For identifying execution time you can use the TIME Statistics.
Run below query to set it on
SET STATISTICS TIME ON;

Now run your query.
If you switch to "Messages" table of the results you will see something like below. Which is your execution time.
 SQL Server Execution Times:
   CPU time = 0 ms,  elapsed time = 0 ms.


text:
Q: failed to connect to database in Web Site Administration Tool I want to use role and membership provider in ASPX.NET.So when i want to add a rule using Web Site Administration Tool i got this error:
    The following message may help in diagnosing the problem: Unable to connect to SQL
Server database. at
System.Web.Administration.WebAdminPage.CallWebAdminHelperMethod(Boolean isMembership,
 String methodName, Object[] parameters, Type[] paramTypes) at
ASP.security_users_manageusers_aspx.Page_Load() at
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at
System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at
 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint)

I set connectionstring as you can see here :
<membership defaultProvider="AspNetSqlMembershipProvider">
  <providers> <clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="authentication" />

What is the problem .
Best regards

A:
Unable to connect to SQL Server database.

The message said it all. There are a lot of reasons you cannot connect to SQL server.
1st thing to check will be to login to SQL Server using SSMS.
Normally, you should have connection string like this in web.config.
<connectionStrings>
   <remove name="authentication" />
   <add name="authentication" connectionString="Data Source=192.168.1.100;Initial Catalog=DATABASE_NAME;Persist Security Info=True;User ID=DATABASE_USERID;Password=DATABASE_PASSWORD;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>

Here are sample connection strings.


text:
Q: Initialize unordered_map in the initializer list I'm trying to find a solution to what may be a very trivial problem. I would like to initialize my const unordered_map in the class initializer list. However I'm yet to find the syntax that the compiler (GCC 6.2.0) will accept. A code link is here.
#include <unordered_map>

class test {
 public:
    test()
      : map_({23, 1345}, {43, -8745}) {}

 private:
   const std::unordered_map<long, long> map_;
 };

Error:
main.cpp: In constructor 'test::test()':
main.cpp:6:36: error: no matching function for call to 'std::unordered_map<long int, long int>::unordered_map(<brace-enclosed initializer list>, <brace-enclosed initializer list>)'
  : map_({23, 1345}, {43, -8745}) {}
                                ^

Are the complex constants not allowed to be initialized in the initializer list? Or the syntax has to be different?

A: Use curly braces instead of the parentheses because if you use parentheses it's calling the constructor that best matches your arguments instead of the overloaded constructor with a parameter of type initializer_list.
Using parentheses and curly braces have the same effect until there's an overloaded constructor taking initializer_list type as a parameter. Then when you use curly braces, the compiler is going to bend over backwards to try to call that overloaded constructor.
for example:
Foo( 3 ) is calling Foo( int x ) constructor;
Foo{ 3 } is calling Foo( initializer_list<int> x ) constructor;

but if there's no Foo( initializer_list<int> x ) constructor

then Foo( 3 ) and Foo{ 3 } are both calling Foo( int x ) constructor.

A: Use braces instead of the parentheses
class test {
 public:
    test()
      : map_{{23, 1345}, {43, -8745}} {}

 private:
   const std::unordered_map<long, long> map_;
 };


text:
Q: how jni non critical method handle garbage collection Jni has methods GetArrayElements and GetPrimitiveArrayCritical.
I know the *critical methods add gc lock to prevent gc when jni code is executing in critical sections, but if jni code is executing non-critical methods and gc happens, the array elements may be moved by gc. In this situation, native code may hold a wrong address. I don't know how jvm handle this, or if i misunderstand something.


text:
Q: CustomListAdapter() in CustomListAdapter cannot be applied Am new to android, am trying to create an app which will display persons according to their status, in apps am using navigation drawer with fragments.
when i am trying to list out the person's of particular categories I got an error. i.e.
Error:(50, 57) error: incompatible types: Past cannot be converted to Activity
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

am getting error "CustomListAdapter() in CustomListAdapter cannot be applied"
   import android.os.Bundle;
   import android.support.v4.app.Fragment;
   import android.view.LayoutInflater;
   import android.view.View;
   import android.view.ViewGroup;
   import android.widget.ListView;

  public class Past extends Fragment {

ListView list;
String[] itemname ={
        "John",
        "Mike",
        "Ria",
        "jack",
        "leo",

};

Integer[] imgid={
        R.drawable.pic1,
        R.drawable.pic2,
        R.drawable.pic3,
        R.drawable.pic4,
        R.drawable.pic5,
};

public Past() {
    // Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    return inflater.inflate(R.layout.fragment_past, container, false);

    CustomListAdapter adapter=new CustomListAdapter(this, itemname, imgid);
        //here am getting  an error
    list=(ListView)getView().findViewById(R.id.list);
    list.setAdapter(adapter);

    /*list.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                                int position, long id) {
            // TODO Auto-generated method stub
            String Slecteditem= itemname[+position];
            Toast.makeText(getApplicationContext(), Slecteditem, Toast.LENGTH_SHORT).show();

        }
    });*/
}

   @Override
    public void onDestroy() {
       super.onDestroy();
   }
 }

the CustomListAdapter.java code is given below
 import android.app.Activity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ArrayAdapter;
 import android.widget.ImageView;
 import android.widget.TextView;

 public class CustomListAdapter extends ArrayAdapter<String> {

 private final Activity context;
 private final String[] itemname;
 private final Integer[] imgid;

public CustomListAdapter(Activity context, String[] itemname, Integer[] imgid) {
    super(context, R.layout.mylist, itemname);
    // TODO Auto-generated constructor stub

    this.context=context;
    this.itemname=itemname;
    this.imgid=imgid;
}

public View getView(int position,View view,ViewGroup parent) {
    LayoutInflater inflater=context.getLayoutInflater();
    View rowView=inflater.inflate(R.layout.mylist, null,true);

    TextView txtTitle = (TextView) rowView.findViewById(R.id.item);
    ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
    TextView extratxt = (TextView) rowView.findViewById(R.id.textView1);

    txtTitle.setText(itemname[position]);
    imageView.setImageResource(imgid[position]);
    extratxt.setText("Description "+itemname[position]);
    return rowView;

   };
 }

Fragment called from MainActivity is given below
     else if(i==1){
        switch (j){

            case 0:
                Past past = new Past();
                fragmentTransaction = fragmentManager.beginTransaction();
                fragmentTransaction.replace(R.id.frameholde,past);
                fragmentTransaction.commit();
                break;

            case 1:
                Current current = new Current();
                fragmentTransaction = fragmentManager.beginTransaction();
                fragmentTransaction.replace(R.id.frameholde, current);
                fragmentTransaction.commit();
                break;

            case 2:
                Area area = new Area();
                fragmentTransaction = fragmentManager.beginTransaction();
                fragmentTransaction.replace(R.id.frameholde, area);
                fragmentTransaction.commit();
                break;

        }

A: In addition to the issue pointed out in the comments, you are returning from your onCreateView() method before setting up the adapter, thus the unreachable code issue.
Set a reference to the inflated View, use that view to find the ListView, and then return the View at the end of the method:
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View rootView = inflater.inflate(R.layout.fragment_past, container, false); //modified

        CustomListAdapter adapter = new CustomListAdapter(getActivity(), itemname, imgid);

        list=(ListView) rootView.findViewById(R.id.list); //modified
        list.setAdapter(adapter);

        return rootView; //added
    }

A: Pass this.getActivity() instead of this. If you still get error, please update your question with new error.


text:
Q: how to copy table rows and columns to clipboard in react using react-copy-to-clipboard?
*

*How can I copy rows and table content in react ? im using antd library however when i copy the table rows and contents and paste using react-copy -to clipboard  currently table data is being store in json this.state.datasource but when i copy  i just get [object Object],[object Object] instead of actuall row and column data ,  can someone pls help thanks!

/*eslint-disable */
import React, { Component } from 'react'
import { Table, Input, Button, Popconfirm, Form } from 'antd'
import { Helmet } from 'react-helmet'
import { Link } from 'react-router-dom'
import { connect } from 'react-redux'
import { Menu, Icon } from 'antd';

import {CopyToClipboard} from 'react-copy-to-clipboard';

import styles from './style.module.scss'
const EditableContext = React.createContext();

const EditableRow = ({ form, index, ...props }) => (
  <EditableContext.Provider value={form}>

  </EditableContext.Provider>
);
const { SubMenu } = Menu;

const EditableFormRow = Form.create()(EditableRow);

class EditableCell extends React.Component {
  state = {
    editing: false,
    copied: false,
  };

  onCopy() {
    console.log("copied");
    alert('copied to clipboard');
  }

  renderCell = form => {
    this.form = form;
    const { children, dataIndex, record, title } = this.props;
    const { editing } = this.state;
    return editing ? (
      <Form.Item style={{ margin: 0 }}>
        {form.getFieldDecorator(dataIndex, {
          rules: [
            {
              required: true,
              message: `${title} is required.`,
            },
          ],

    );
  };

  render() {
    const {
      editable,
      dataIndex,
      title,
      record,
      index,
      handleSave,
      children,
      ...restProps
    } = this.props;
    return (

        {editable ? (
          <EditableContext.Consumer>{this.renderCell}</EditableContext.Consumer>
        ) : (
          children
        )}

    );
  }
}
class Campaign extends React.Component {
  constructor(props) {
    super(props);
    this.columns = [
      {
        title: 'id',
        dataIndex: 'id',

      },
      {
        title: 'Campaign Name',
        dataIndex: 'name',
        editable: true,
      },
      {
        title: 'Banners',
        dataIndex: 'address',
        editable: true,
      },
      {
        title: 'Video',
        dataIndex: 'Video',
        editable: true,
      },
      {
        title: 'Target',
        dataIndex: 'Target',
        editable: true,
      },
      {
        title: 'Exchanges',
        dataIndex: 'Exchanges',
        editable: true,
      },
      {
        title: 'Status',
        dataIndex: 'Status',
        editable: true,
      },
      {
        title: 'Delete',
        dataIndex: 'Banners',
        render: (text, record) =>
          this.state.dataSource.length >= 1 ? (
            <Popconfirm title="Sure to delete?" onConfirm={() => this.handleDelete(record.key)}>
              Delete
            </Popconfirm>
          ) : null,
      },
    ];

    this.state = { //table data i want to copy
      dataSource: [
        {
          key: '0',
          name: 'Kates Campaign',
         id: '32',
          Video: 'London, Park Lane no. 0',
          Target: 'bacon',
          Exchanges: 'Eggs',
        },
        {
          key: '1',
          name: 'Fyber Tests',
          id: '32',
          address: 'Sample Banner Ad (ID 6 ECPM 20.0) ',
        },
      ],
      count: 2,
    };
  }

  render() {
    const { dataSource } = this.state;
    const components = {
      body: {
        row: EditableFormRow,
        cell: EditableCell,
      },
    };
    const columns = this.columns.map(col => {
      if (!col.editable) {
        return col;
      }
      return {
        ...col,
        onCell: record => ({
          record,
          editable: col.editable,
          dataIndex: col.dataIndex,
          title: col.title,
          handleSave: this.handleSave,
        }),
      };
    });
    return (

 Campaigns

        <Menu
        className={styles.menu}
        onClick={this.handleClick}
        style={{  marginleft: 80}}
        defaultSelectedKeys={['1']}
        defaultOpenKeys={['sub1']}
        mode="inline"

      >
        <SubMenu className={styles.sub}
          key="sub4"
          title={

              <Icon type="setting"style={{
  color: '#8c54ff'}} />
              Options

          }
        >
          <Icon type="arrow-down" style={{
  color: '#8c54ff'}} />
          <Menu.Item key="9"> CSV</Menu.Item>

          <Icon type="sync" style={{
  color: '#8c54ff'}}/>
          <Menu.Item key="11"> Sync</Menu.Item>

              <Icon
                type="copy"
                style={{
                  color: '#8c54ff',
                }}
              />
            // this is function to copy table data
          <CopyToClipboard text={dataSource} onCopy={() => this.setState({copied: true})}>
       </SubMenu>
      </Menu>

    );
  }
}
export default Campaign


text:
Q: Replace element tag to empty tag My requirements is to generate an empty element with the given scenario. I have the same in this Replacing the element tag with value to end tag. However, the output generated is not what I am expecting.
CONDITION:
Map according to priority:
1. If Test1 is equal to Payment1, generate this empty element <st:Test1/> 2. else if Test2 is equal to Payment2, generate this empty element <st:Test2/> 3. else if Test3 is equal to Payment3, generate this empty element <st:Test3/>.
MY XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:st="http://www.ebinterface.at/schema/4p1/" xmlns:po="http://schema.ebinterface.at/schema/4p1/" exclude-result-prefixes="po">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="@* | node()">
        <xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="*">
        <xsl:element name="st:{local-name()}">
            <xsl:apply-templates select="node()|@*"/>
        </xsl:element>
    </xsl:template>
    <xsl:template match="po:DEFG" priority="1">
        <st:DEFG>
            <!--handle any existing child content-->
            <xsl:apply-templates select="@* | node()"/>
            <xsl:if test="not(po:Test1)">
                <xsl:call-template name="Test1"/>
            </xsl:if>
            <xsl:if test="not(po:Test2)">
                <xsl:call-template name="Test2"/>
            </xsl:if>
            <xsl:if test="not(po:Test3)">
                <xsl:call-template name="Test3"/>
            </xsl:if>
        </st:DEFG>
    </xsl:template>
    <xsl:template match="po:Test1[.='Payment1']" name="Test1" priority="1">
        <st:Test1/>
    </xsl:template>
    <xsl:template match="po:Test2[.='Payment2']" name="Test2" priority="1">
        <st:Test2/>
    </xsl:template>
    <xsl:template match="po:Test3[.='Payment3']" name="Test3" priority="1">
        <st:Test3/>
    </xsl:template>
    <xsl:template match="*[namespace-uri()='http://www.ebinterface.at/schema/4p1/']">
        <xsl:element name="po:{local-name()}">
            <xsl:apply-templates/>
        </xsl:element>
    </xsl:template>
    <xsl:template match="*[namespace-uri()='http://www.ebinterface.at/schema/4p1/']/@*">
        <xsl:attribute name="po:{local-name()}"><xsl:value-of select="."/></xsl:attribute>
    </xsl:template>
</xsl:stylesheet>

INPUT FILE:
<?xml version="1.0" encoding="UTF-8"?>
<Statistics xmlns="http://schema.ebinterface.at/schema/4p1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ebinterface.at/schema/4p1/" Type="abc" Title="Statistics">
     <ABC dsig="fh">Sample ABC</ABC>
     <DEFG>
        <Note>Wir ersuchen um termingerechte Bezahlung.</Note>
        <Amount currencyCode="EUR">12.36</Amount>
        <Test1>Payment1</Test1>
     </DEFG>
</Statistics>

GENERATED OUTPUT:
<?xml version="1.0" encoding="UTF-8"?>
<st:Statistics xmlns:st="http://www.ebinterface.at/schema/4p1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ebinterface.at/schema/4p1/" Type="abc" Title="Statistics">
    <st:ABC dsig="fh">Sample ABC</st:ABC>
    <st:DEFG>
        <st:Note>Wir ersuchen um termingerechte Bezahlung.</st:Note>
        <st:Amount currencyCode="EUR">12.36</st:Amount>
        <st:Test1/>
        <st:Test2/> **This empty element should not appear since there's no Test2=Payment2**
        <st:Test3/> **This empty element should not appear since there's no Test3=Payment3**
    </st:DEFG>
</st:Statistics>

EXPECTED OUTPUT:
<?xml version="1.0" encoding="UTF-8"?>
<st:Statistics xmlns="http://schema.ebinterface.at/schema/4p1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ebinterface.at/schema/4p1/" st:Type="abc" st:Title="Statistics">
    <st:ABC st:dsig="fh">Sample ABC</st:ABC>
    <st:DEFG>
        <st:Note>Wir ersuchen um termingerechte Bezahlung.</st:Note>
        <st:Amount st:currencyCode="EUR">12.36</st:Amount>
        <st:Test1/>
    </st:DEFG>
</stStatistics>

Thank you in advance.
Your response is greatly appreciated.

A: When you call a template by name, that template will be executed regardless of whether it matches anything or not.
Not directly related to your question, you also have a template conflict between <xsl:template match="@* | node()"> and <xsl:template match="*">. Overall, you have way too much code; I believe you could do with just:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:po="http://schema.ebinterface.at/schema/4p1/"
xmlns:st="http://www.ebinterface.at/schema/4p1/"
exclude-result-prefixes="po">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<!-- move elements to new namespace -->
<xsl:template match="*">
    <xsl:element name="st:{local-name()}">
        <xsl:apply-templates select="node()|@*"/>
    </xsl:element>
</xsl:template>

<!-- move attributes to new namespace -->
<xsl:template match="@*">
    <xsl:attribute name="st:{local-name()}">
        <xsl:value-of select="."/>
    </xsl:attribute>
</xsl:template>

<!-- except attributes that are NOT in the default namespace -->
<xsl:template match="@*[namespace-uri()]">
    <xsl:copy/>
</xsl:template>

<xsl:template match="po:Test1[.='Payment1']">
    <st:Test1/>
</xsl:template>

<xsl:template match="po:Test2[.='Payment2']">
    <st:Test2/>
</xsl:template>

<xsl:template match="po:Test3[.='Payment3']">
    <st:Test3/>
</xsl:template>

</xsl:stylesheet>

Result
<?xml version="1.0" encoding="UTF-8"?>
<st:Statistics xmlns:st="http://www.ebinterface.at/schema/4p1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ebinterface.at/schema/4p1/" st:Type="abc" st:Title="Statistics">
   <st:ABC st:dsig="fh">Sample ABC</st:ABC>
   <st:DEFG>
      <st:Note>Wir ersuchen um termingerechte Bezahlung.</st:Note>
      <st:Amount st:currencyCode="EUR">12.36</st:Amount>
      <st:Test1/>
   </st:DEFG>
</st:Statistics>

Note:

*

*The three choices are not mutually exclusive as your question would suggest.

*Your expected output is not well-formed XML: you cannot have a prefix without binding it to a namespace.


text:
Q: Need to start string from a specific spot in C++ Here's my code:
#include <iostream>
#include <fstream>
#include <cstring>
#include <string>
#include <iterator>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
string word;
cout << "Insert a name to search for: ";
cin >> word;

ifstream file ("Names.txt");

string line;
getline(file, line, '.');

int i;
for (i = 0; i < line.length(); ++i) {
    if ('A' <= line[i] && line[i] <= 'Z') break;
}

string keyword = line.substr(i);

int cnt = count( istream_iterator<string>(file), istream_iterator<string>(), word);
cout << word << " appears " << cnt << " times. It appears most with " << keyword << ".    keyword" << endl;
return 0;
}

AT THE MOMENT: I can search for a certain name from a text file with thousands of names (one on each line) and see how many times does the name appear. On each line there also appears a keyword with a name and it starts with a capital letter and ends with a period.
MY PROBLEM: My code is almost ready but the problem is that it searches for a keyword from the beginning of the file and then prints it out (since my code is not made to do anything else yet)
MY GOAL: I want it to search for a keyword from a line where the SEARCH word was found. For example if I search for Juliet and it appears with a keyword Girl then I want it to print the name with that keyword not the FIRST keyword in a file.
MY THOUGHTS: There should be a way to start searching from the word but I do not know how.
Could you help me with making an extra loop so it starts second loop from e.g word Juliet. I don't know how I could convert cin to just a sequence of characters. Since usually when searching for a string in a text file the sequence of characters is between ' symbols.
'Juliet'

but I need to take the word string and somehow convert it
MY QUESTION: How can I convert input word to sequence of characters to get a starting point for a string

A: Something like this? It's not really an 'algorithm' it's just a simple loop.
string word;
cout << "Insert a name to search for: ";
cin >> word;
ifstream file ("Names.txt");
string a_word;
while (file >> a_word && a_word != word)
{
}
if (file)
{
    // found word now start second search.
}
else
{
    // error, didn't find word
}

Sorry if this isn't right, but I'm struggling to understand what you are stuck on. The above code is very simple, it's simpler than the code you wrote yourself.


text:
Q: Can I receive local or push notifications to my email address? Can I receive local and/or push notifications to my email account instead of as a notification that appears on my iPhone?
I want to receive the local and push notifications for some apps but I don't want to necessarily receive them as pop-up notifications on my iPhone screen, but would rather access them in my inbox when I have time.

A: The short answer is No.
iOS does not have any way for you to redirect notifications.
It may be possible to change how some notifications are sent, and have them sent to you via Boxcar or something similar, but that is going to be limited to a very small subset of applications or services which are designed to offer alternatives. Twitter and Facebook come to mind.


text:
Q: How to configure Selenium Node to run specified OS version? This is more of a question, can we configure selenium node to run specified OS version. I have a scenario where I need to run some Test in Windows 7 and some in Windows Server 2008 so I don't know if that's possible and if it is possible how to configure it.

A: You can define your own Capabilities by creating a Custom Capability Matcher and implement it to the Grid.
Or there is another and easier solution :) You work with the applicationName capability and use it to define the name of the node. It is an exist capability, but not documented (I don't know why).
In your nodeConfig:
{
    "capabilities":[
        {
            "platform":"WINDOWS",
            "browserName":"internet explorer",
            "maxInstances":1,
            "seleniumProtocol":"WebDriver",
            "applicationName":"PC001"
        }
    ],
    ...
}

... and in your code:
DesiredCapabilities dc = new DesiredCapabilities();
// ...
dc.setCapability("applicationName", "PC001");


text:
Q: Keep instant search results hover open to edit with Chrome tools We are trying to customize the Algoila instant results hover menu to fit our custom Magento theme. Does anyone know of a way to keep the instant result menu open so we can inspect elements using Chrome tools?

A: You can put the following debug flag to true:
  var options = {
      hint: false,
      templates: {
          dropdownMenu: '#menu-template'
      },
      dropdownMenuContainer: "#algolia-autocomplete-container",
      debug: true // to inspect the dropdown menu
  };

The associated documentation is here.

A: Alternatively, open Chrome developer tools, go to the 'source' tab and from there you can click Cmd + \ to pause the script whilst the dropdown is visible.

A: There is an option for elements state on the right side of the development tools:


text:
Q: Type 'String!' has no member 'photo' I am following a tutorial on Youtube about CoreML: Real Time Camera object detection with machine learning - Swift 4 by Mr. Brian
captureSession.sessionPreset = .photo

In this line, the error says:

Type "String" has no member 'photo'.

dataOutput.setSampleBufferDelegate(self, queue: DispatchQueue(label: "videoQueue"))

And another error is the 'self' part. The error is:

Cannot convert value of type 'ViewController' to expected argument type 'AVCaptureVideoDataOutputSampleBufferDelegate!'

Below is the whole code:
import UIKit
import AVFoundation
import AVKit
import Vision

class ViewController: UIViewController,         AVCaptureAudioDataOutputSampleBufferDelegate {
    override func viewDidLoad() {
        super.viewDidLoad()

        // here is where we start up the camera
        let captureSession = AVCaptureSession()
        captureSession.sessionPreset = .photo

        guard let captureDevice =
            AVCaptureDevice.defaultDevice(withMediaType: AVMediaTypeVideo) else { return }

        guard let input = try? AVCaptureDeviceInput(device:
            captureDevice) else { return }
        captureSession.addInput(input)

        captureSession.startRunning()

        let previewLayer = AVCaptureVideoPreviewLayer(session:
            captureSession)
        view.layer.addSublayer(previewLayer!)
        previewLayer!.frame = view.frame

        let dataOutput = AVCaptureVideoDataOutput()
        dataOutput.setSampleBufferDelegate(self, queue: DispatchQueue(label: "videoQueue"))
        captureSession.addOutput(dataOutput)

A: I think you got the answer for second error, for first error replace the error line with below
SWIFT 3
captureSession.sessionPreset = AVCaptureSessionPresetPhoto

SWIFT 4
captureSession.sessionPreset = AVCaptureSession.Preset.photo


text:
Q: pl/sql: sort by a group, then company, Or append 2 tables I donn't know what to do now...
This is what I have now from a query, but I want it to look like something in the table following this one:
COMPANYNUM       BALANCE      ROWENTRIES
2            8986762.37       2
125         141390.3          6
124          77431750         4
76           36299.82         6
17           -0.01                76
86           -1               19
500         -2000                 7
1           -101.48             6348
3               0               5
4               0               6
5               0               30
9               0           10
12              0               28
13              0               93
16              0               17
19              0             159
21              0               5
23              0               6
26              0               101
27              0               1
29              0               2
30              0               14
32              0               6
33              0               110
34              0               27

I want it to be like:
COMPANYNUM    BALANCE     ROWENTRIES
1             -101.48       6348
2             8986762.37        2
17            -0.01             76
76            36299.82      6
86            -1                19
124           77431750      4
125       141390.3      6
500       -2000             7
3               0               5
4               0               6
5               0               30
9               0           10
12              0               28
13              0               93
16              0               17
19              0             159
21              0               5
23              0               6
26              0               101
27              0               1
29              0               2
30              0               14
32              0               6
33              0               110
34              0               27

I want the order to be like: priority where the balances are not zero, then order by the company number, then append the balance entries that are zeros. Any ideas on how to achieve this in PL/SQL please...
Thanks.

A: Try:
ORDER BY
   CASE WHEN Balance <> 0
        THEN COMPANYNUM
   END  NULLS LAST,
   COMPANYNUM

See a demo here: http://www.sqlfiddle.com/#!4/859be/1


text:
Q: Remove string after predefined string I am pulling content from an RSS feed, before using jquery to format and edit the rss feed (string) that is returned. I am using replace to replace strings and characters like so:
var spanish = $("#wod a").text();
var newspan = spanish.replace("=","-");
$("#wod a").text(newspan);

This works great. I am also trying to remove all text after a certain point. Similar to truncation, I would like to hide all text starting from the word "Example".
In this particular RSS feed, the word example is in every feed. I would like to hide "example" and all text the follows that word. How can I accomplish this?

A: jQuery isn't intended for string manipulation, you should use Vanilla JS for that:
newspan = newspan.replace(/example.*$/i, "");

The .replace() method accepts a regular expression, so in this case I've used /example.*$/i which does a case-insensitive match against the word "example" followed by zero or more of any other characters to the end of the string and replaces them with an empty string.

A: Though there is not enough jQuery, you even don't need it to remove everything after a certain word in the given string. The first approach is to use substring:
var new_str = str.substring(0, str.indexOf("Example"));

The second is a trick with split:
var new_str = str.split("Example")[0];

A:
I would like to hide all text starting from the word "Example"

A solution that uses the simpler replace WITH backreferences so as to "hide" everything starting with the word Example but keeping the stuff before it.
var str = "my house example is bad"
str.replace(/(.*?) example.*/i, "$1")     // returns "my house"
// case insensitive. also note the space before example because you
// probably want to throw that out.

A: If you also want to keep "Example" and just remove everything after that particular word, you can do:
var str = "aaaa1111?bbb&222:Example=123456",
    newStr = str.substring(0, str.indexOf('Example') + 'Example'.length);

// will output: aaaa1111?bbb&222:Example


text: Q: How to get api level information from classes.dex My application is supposed to examine an android application and decides whether it is a malware or not.Examination part includes extracting information from manifest.xml file and classes.dex file. The problem is I dont know how to get api level information from dex code. I need to get all classes names, used variables, api calls etc. Is there any built in support in android for getting this information from classes.dex file ? Code example would be really appreciated. Thanks


text:
Q: Tomcat Websockets and hazelcast clusterization I have web service(service A), that should be clustered on different instances. It is ServerEndpoint and has socket communications with number of another services(services group B) and RESTful API(for service C).
I have a problem - I need to store all socket connections with B-services on A-service, and after service C makes API call to the A-service, it should return the best option from B group.
But I don't know how should I store websocket.Session objects using Hazelcast? Session objects are not serializable. Maybe I should reinit session by session ID on other cluster instances if needed?


text:
Q: How do I get the url of a loaded image with javascript and php - Parse PHP SDK I'm very new to php and javascript, I'm trying to make a form where you can upload an image and display its preview on the same page, and my code works, the problem is that I need to get that image's URL in order to upload it to my Parse Server. Here's the code I use:

<input style="display:none" id="input-image-hidden" onchange="document.getElementById('avatar-img').src = window.URL.createObjectURL(this.files[0])" type="file" accept="image/jpeg, image/png">
<button class="btn btn-primary btn-block" onclick="HandleBrowseClick('input-image-hidden');" >Upload an avatar</button>

So, when i first run my signUp.php page, I can get the URL of my 80.png image, which looks like: http://www.example.com/images/80.png
and it get shown into my

tag. I need to get that string and pass it to a php function to upload that image to Parse Server:
    $localFilePath = "URL_OF_MY_PREVIEW_IMAGE";
    $file = ParseFile::createFromFile($localFilePath, "image.jpg");

Any help will be greatly appreciated.
Thanks!


text:
Q: How to mention the FileInputFormat in readFile method of flink? I am using flink to read the data continuously from the file which gets append with data regularly. I tried to use readFile method in flink.But confused with how to mention the FileInputFormat in the argument of this method. My file format is json. Could anyone help me with this?.Thanks

A: Flink's InputFormat's are not suited to read from files which are concurrently written to.
Given this requirement, I assume you are looking for a way to consume the file as a stream and process it with Flink's DataStream API. In that case, you would need to implement a SourceFunction that tracks the size and progress of the file and continuously reads the file.
However, I would not recommend this design. I'd rather periodically start a new file and move it to a dedicated folder for consumption once it has been finalized and the next file been started.


text:
Q: SQL Integer Division Remainder Here is my situation: Say I have 7 hats.
Month       Hats
1           7

In my select statement I need to divide this by 3 and I can't have partial hats . I want to have 3 records with the following values:
Week     Hats
1        2
2        2
3        3

With normal rounding I would end up
Week     Hats
1        2
2        2
3        2

I cant have this cause i just lost a hat. How do I give the remainder of the quotient to one record (I don't care what record)?

A: Interesting problem.  You can do this using SQL-only.  The idea is to allocate the number of hats as an integer.  Then, add an additional hat to each week until you hit the total needed.
Here is a query that accomplishes this, for the data you have proposed:
with weeks as (
      select 1 as w union all select 2 union all select 3
     ),
     const as (
      select 7 as numhats,
             (select count(*) from weeks) as numweeks
     )
select w,
       ((numhats / numweeks) +
        (case when row_number() over (order by w) <= numhats % numweeks
              then 1
              else 0
         end)
       ) as hats
from weeks cross join
     const;

Note that this puts the extra hats on the first weeks rather than the last weeks.  You could put them on the last weeks by using order by w desc instead of order by w.

A: To solve this issue you need to you need some additional information. Track the original total, and find the sum of what was allocated
Week      HatNum     HatColor     OrigTotal     SumWeekHats     RowID
1         2          Blue         7             6               1
2         2          Blue         7             6               2
3         2          Blue         7             6               3
1         2          Red          7             6               1
2         2          Red          7             6               2
3         2          Red          7             6               3

Then update the hatNum (for 1 row per group) based on what hasn't been allocated


text:
Q: Magic square matrices A magic square is a square which allow non-negative integers entries in which all row sums and columns sums are equal.
Let $H_3(r)$ denotes number of magic squares of size $3*3$ in which each row and column have sum equals $r$. Prove that $$H_3(r) =\binom{r+4}{4}+\binom{r+3}{4}+\binom{r+2}{4}$$ where $H_3(r)$ is the number of $3*3$ magic squares of line sum $r$.
I try to find out the relations between all the
$$ \left[
\begin{array}\\
  a&b&c\\
  d&e&f\\
  g&h&i\\
\end{array}
\right] $$
variables. I thought if I manage to built a relation between all the variables so that the values of all variables depend upon any one or two independent variables. But I fail to built such relations among variables.
I asked this question to all my faculty teachers and school teacher, but no answer come up.
If the question is worth, please solve it.


text:
Q: I would like to put search bar beside a page selector I'm newbie and I would like to know the way to put search bar beside page selector.
Here's a screenshot now :
https://imgur.com/a/S9X3sIc
My desire layout :
https://imgur.com/a/0zx3rfl
How can I make it? I need your help. Thanks in advance. I love you guys. :D
    <div class="wpf-navi <?php echo esc_attr($class) ?>">

<form action="<?php echo wpforo_home_url() ?>" method="get">
        <?php wpforo_make_hidden_fields_from_url( wpforo_home_url() ) ?>
        <input type="text" placeholder="<?php wpforo_phrase('Search...') ?>" name="wpfs" class="wpfw-70" value="<?php echo isset($_GET['wpfs']) ? esc_attr(sanitize_text_field($_GET['wpfs'])) : '' ?>" ><input type="submit" class="wpfw-20" value="»">
                </form>

                <?php wpforo_phrase('Page') ?> <?php echo intval($paged) ?> / <?php echo intval($pages_count) ?>

            <?php if( $paged - 1 > 0 ): $prev_url = ( ($paged - 1) == 1 ? $sanitized_current_url : sprintf($url, $paged - 1) ); ?>
                <a href="<?php echo esc_url( WPF()->user_trailingslashit($prev_url) ) ?>" class="wpf-prev-button" rel="prev">
                     <?php wpforo_phrase('prev') ?>

            <?php endif ?>
            <select class="wpf-navi-dropdown" onchange="if (this.value) window.location.assign(this.value)" title="<?php esc_attr( wpforo_phrase('Select Page') ) ?>">
                <option value="<?php echo esc_url( WPF()->user_trailingslashit($sanitized_current_url) ) ?>" <?php wpfo_check($paged, 1, 'selected') ?>>1</option>
                <?php for($i = 2; $i <= $pages_count; $i++) : ?>
                    <option value="<?php echo esc_url( WPF()->user_trailingslashit( sprintf($url, $i) ) ) ?>" <?php wpfo_check($paged, $i, 'selected') ?>>
                        <?php echo $i ?>
                    </option>
                <?php endfor; ?>
            </select>
            <?php if( $paged + 1 <= $pages_count ): ?>
                <a href="<?php echo esc_url( WPF()->user_trailingslashit(sprintf($url, $paged + 1) ) ) ?>" class="wpf-next-button" rel="next">
                    <?php wpforo_phrase('next') ?>

            <?php endif ?>


text:
Q: How can I check if 2 different implementations (with same name) of a function agree in C? I have a header interface.h with a function f() and its two implementations, imp1.c and imp2.c. Both imp1.c, and imp2.c contain definitions for f(). I am checking f() with random inputs, but I want to make sure that the outputs from both imp1.c and imp2.c agree. How can I do that? Is there any way my main function can distinguish between the two implementations? Like
if(imp1.f() != imp2.f()) printf("The implementations differ on input %d", i);


text:
Q: Use vim shortcuts in TeXstudio I'm using TeXstudio to edit my *.tex files. Is there any way to add vim shortcuts to TeXstudio?

A: thanks, I work with latex workshop and  vim extension in vscode

A: According to the issue on their Sourceforge tracker and an issue on GitHub, there is currently no way to add vim keybindings to TeXstudio.
You can use other vi supported IDE such as VIM-LaTeX or Kile (Which uses Kate as editor).
Edit:
I ended up using VSCode for using latex with latex-workshop and vim extensions. Very convenient for me.


text:
Q: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. Reason: Token-based server access validation failed As the title states, I'm getting the following error when attempting to use a ASP.NET webapp:
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: 192.168.x.x]
This is from the "Application" log on the SQL server. I currently have a clustered setup (using Microsoft Failover Cluster) although the second node has not been configured yet. I've tried configuring SPNs:
setspn -L myserviceaccount
Registered ServicePrincipalNames for <DN>:
        MSSQLSvc/*SQL.corp.*.local:1433
        MSSQLSvc/*SQL.corp.*.local

And indeed, SQL Server does register it correctly as per its logs:
Message
The SQL Server Network Interface library successfully registered the Service Principal Name (SPN) [ MSSQLSvc/my.sql.fqdn ] for the SQL Server service.

However, the query SELECT auth_scheme FROM sys.dm_exec_connections WHERE session_id = @@spid ; returns NTLM and not Kerberos. I've restarted the server a few times to no avail. SQL Server runs under a domain user account with the appropriate delegation privileges.
Am I missing something?
UPDATE:
I was successfully able to get the SQL Server to use "Kerberos" as per the above query, but I'm still having no luck getting the IIS level to work.

A: This is known as the "double hop" issue between SQL Server and IIS. It looks like you may not have trusted the IIS server for delegation.
Here's a good checklist of things to do when setting up SQL Server with IIS using Kerberos.
Here's a great primer on the condition. The anonymous login is a give-away of the problem.


text:
Q: relationships in Sql I know how to create one to many, many to many relationships in SQL Server, but is it possible to create one to one relationship? And is it possible to create 1 to 0 or 1 relationship?

A: Yes, just put PRIMARY KEYs of both entities into a link table, defining a UNIQUE key on both entities:
myrel(entityA, entityB, UNIQUE(entityA), UNIQUE(entityB))

Thus, if entityA = 1 is related to entityB = 2:
entityA  entityB
      1        2

, you can relate neither entityA = 1 to any other entityB, nor an entityB = 2 to any other entityA.
If you relation is symmetrical (i. e. entityA and entityB belong to same domain and relating entityA to entityB also means relating entityB to entityA), then define an additional CHECK constrant:
entityA  entityB

UNIQUE(entityA)
UNIQUE(entityB)
CHECK(entityA < entityB)

and transform the normalized relation to a canonical one with this query:
SELECT entityA, entityB
FROM   myrel
UNION
SELECT entityB, entityA
FROM   myrel

This is a (0-1):(0-1) relation.
If you want it to be a 1:1 relation, define this table to be a domain for both entityA and entityB:
myrel(entityA, entityB, UNIQUE(entityA), UNIQUE(entityB))
A(id, PRIMARY KEY(id), FOREIGN KEY(id) REFERENCES myrel (entityA))
B(id, PRIMARY KEY(id), FOREIGN KEY(id) REFERENCES myrel (entityB))

By removing the FOREIGN KEY from either table's definition, you change the corresponding part of the relationship from 1 to (0-1).

A: Two ways:
1) a pk-pk 1:1 relationship. Table A and B have both a PK. Create an FK from the B PK to the PK of A. This makes 'B' the FK side of the 1:1 relationship
or
2) an FK/UC-PK 1:1 relationship. Table A has a PK and table B has a foreign key to A, but the FK in B is not on the PK of B. Now create a UC on the FK field(s) in B.

A: Yes, just make the Primary or alternate Key in the dependant table a Foreign Key to the Primary Key in the parent Table.

A: Yes
TableA
id PK
TableB
id PK FK TableA

A: It's fun but it my favorite questions on interview.
So You have table A, B corresponding each of them has primary key A_ID, B_ID. Add foreign key to any. Let it be B: A_REF, so you just need add unique constraint onto A_REF.


text:
Q: Folder "_catalogs" does not exist. error during SharePoint site collection UI upgrade I am migrating SharePoint 2010 web application to SharePoint 2013 using content database backup/restore approach. I have restored the database, mount database and then doing the site collection UI upgrade and it is failed with the "Folder '_catalogs' does not exist" error. I have tried "Fix it" button available in site collection health checks but that also throwing the same error (Screenshot below).

I reviewed the Hive logs using the correlation Id and found below error messages

UserAgent not available, file operations may not be optimized.
Application error when access /Misc/_catalogs/masterpage/Forms/AllItems.aspx, Error=Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.

A: Check if the folder is there in your SharePoint 2010 environment. If it is not there and someone, some how have deleted the folder, try to revert the folder with the revert function under sitesettings.


text:
Q: PHP version set to 7.0 instead of >7.1 in Laravel Homestead-7 Since upgrading to Laravel 5.6, my websites arent rendered with Homestead anymore. I guess, that this is a PHP version issue. Unlike the descriptions in the Laravel documentation my server is running not with PHP 7.2, instead phpversion() shows:
The current PHP version is 7.0.27-1+ubuntu16.04.1+deb.sury.org+1

Adding php Selectors to my Homestead.yaml file has no effect.
sites:
  - map: homestead.app
    to: /home/vagrant/Code/Laravel/public
    php: "7.2"

I updated the whole environment, including Virtual Box, Vagrant, etc. laravel/homestead is installed with version 5.1.0. How can I upgrade the system to PHP 7.2?
I tried vagrant destroy && vagrant up with the following output:
$ vagrant destroy && vagrant up
    homestead-7: Are you sure you want to destroy the 'homestead-7' VM? [y/N]
==> homestead-7: Forcing shutdown of VM...
==> homestead-7: Destroying VM and associated drives...
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Importing base box 'laravel/homestead'...
==> homestead-7: Matching MAC address for NAT networking...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Setting the name of the VM: homestead-7
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
    homestead-7: Adapter 1: nat
    homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
    homestead-7: 80 (guest) => 8000 (host) (adapter 1)
    homestead-7: 443 (guest) => 44300 (host) (adapter 1)
    homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
    homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
    homestead-7: 22 (guest) => 2222 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
    homestead-7: SSH address: 127.0.0.1:2222
    homestead-7: SSH username: vagrant
    homestead-7: SSH auth method: private key
    homestead-7: Warning: Connection reset. Retrying...
    homestead-7: Warning: Connection aborted. Retrying...
(...)
    homestead-7: Vagrant insecure key detected. Vagrant will automatically replace
    homestead-7: this with a newly generated keypair for better security.
    homestead-7:
    homestead-7: Inserting generated public key within guest...
    homestead-7: Removing insecure key from the guest if it's present...
    homestead-7: Key inserted! Disconnecting and reconnecting using new SSH key...
==> homestead-7: Machine booted and ready!

Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   5.0.18
VBoxService inside the vm claims: 5.2.4
Going on, assuming VBoxService is correct...
[homestead-7] GuestAdditions versions on your host (5.2.8) and guest (5.2.4) do not match.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   5.0.18
VBoxService inside the vm claims: 5.2.4
Going on, assuming VBoxService is correct...
Reading package lists...
Building dependency tree...
Reading state information...
dkms is already the newest version (2.2.0.3-2ubuntu11.5).
linux-headers-4.4.0-112-generic is already the newest version (4.4.0-112.135).
linux-headers-4.4.0-112-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Copy iso file C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso
into the box /tmp/VBoxGuestAdditions.iso

I have no idea whether my problem is connected to the GuestAdditions issue. However, the solution of vagrant up: Got different reports about installed GuestAdditions version did not help.
Thx for your help!

A: vagrant destroy && vagrant up If it's still not using 7.2 post the full output so we can see what may have gone wrong.

A: That problem was an outdated Homestead version.
Cloning the repository and restarting vagrant solved it.
git clone https://github.com/laravel/homestead.git ~/Homestead

Thanks for your help!


text:
Q: Why doesn't my array of booleans work for the Problem Ragaman from CCC? The problem I am trying to solve is Senior Problem S1 (Ragaman) from the 2016 Canadian Computing Competition: https://cccgrader.com/
Paraphrased problem description and specification:
Given two strings of length N (1 <= N <= 100), determine whether the second
string is a wildcard anagram of the first.  The first string will consist
entirely of lower case letter characters, the second might also contain
asterisk characters.

My code (in Java) already works for some cases but not all, and i've been trying to figure out the problem of my code for a few days and I still can't find it. I have used different array of booleans and int to solve the problem.
//s1_2016
import java.util.*;
public class Main {
    public static void main(String args[])
    {
        Scanner in = new Scanner(System.in);

        String s1 = in.nextLine();
        String s2 = in.nextLine();
        String newS2 = "";
        int  c = 0;

        //create new S2 string with no *
        for(int i=0;i<s2.length();i++)
            if(s2.charAt(i)!='*')
                newS2 = newS2 + s2.charAt(i);
            else
                c++;

        //makes a array of false based on the length of s1
        Boolean[] boolS1 = new Boolean[101];
        for(int i=0;i<101;i++)
            boolS1[i]=false;

        //main algorithm
        for(int i=0;i<newS2.length();i++)
            for(int j=0;j<s1.length();j++)
            {
                if((newS2.charAt(i)==s1.charAt(j))&&(boolS1[j]==false))
                    boolS1[j]=true;
            }
        //boolean found=true;
        int counter = 0;
        for(int i=0;i<s1.length();i++)
        {
            if (boolS1[i]==false)
                counter++;
        }

        if(counter==c)
            System.out.println("A");
        else
            System.out.println("N");
    }
}

If the code works for both the sample problems, it would be most likely working but when I try solving it with more long numbers, that's when it should start not working. Thanks in advance

A: Consider sample input 2

*

*cccrocks

*socc*rk*
and walk yourself through your "main algorithm".  For each position in newS2 you are testing every position in S1 for a match. What happens when i == 2?
The newS2.charAt(2) is 'c' which will match with the s1.charAt(0); charAt(1); charAt(2); and charAt(5) AND the Boolean array is initialized to false, so positions 0, 1, 2, and 5 in the Boolean array are all updated to true while i == 2.  That's not the behavior you want for finding anagrams.
You need to break out of the inner loop after finding your first match and setting that Boolean index to true.  Your solution may still have other problems, but I think that's the main one.


text:
Q: Update a Mongo Field with an API GET Request I have a MERN stack application where I send an email confirmation request to the user after they register.
When they click this link, I want it to update emailAuthorised to TRUE in the DB.
Currently,
my app looks like this for the request:
  router.get('/confirmation/:token', async (req, res) => {
    try {
      //verify the token with the secret
      const { id: { _id } } = jwt.verify(req.params.token, process.env.JWT_SEC);
        await model.User.update({ emailAuthorised: true }, { where: { _id } });
        res.send('verified');
    } catch (e) {
      res.send('This isnt working');
    }

  });

However I get this error the error passed.
I have a user model like this:

//UserSchema
const UserSchema = new mongoose.Schema(
    {
        //userdetails
        username: {type: String, required: true, default: "" },
        password:{type:String, required: true},
        //profile
        fullname:{type:String, required: false, default: "none"},
        firstname:{type:String, required: false, default: "", unique: false},
        surname:{type:String, required: false, default: "", unique: false},
        email:{type:String, required: true, unique: true},
        position: {type:String, required: false, unique: false},
        recruiter: {type: Boolean}, //Canidate or Recruiter,
        userImage: {type:String, required: false, unique: false, default: ""},
        //location
        locationCity:{type:String, required: false, unique: false, default: ""},
        country:{type:String, required: false, unique: false, default: ""},
        //work
        role:{type:String, required: false, default: ""},
        company: {type:String, default: ""},
        emailAuthorised: { type: Boolean, default: false},
        professionalBio: {type:String, default: ""},
        positionRecentTitle : {type:String, default: ""},
        positionRecentCompany : {type:String, default: ""},

        isAdmin:{
            type: Boolean,
            default: false,
        },
    },
    {timestamps: true }
);

module.exports = mongoose.model("User", UserSchema)

I can confirm the user is being jwt.verify'd as if I pass just a res.send afterwards, it works fine. It's just on the await model.user.update field.
Does anyone know why this is?
No additional errors are thrown.


text:
Q: set function usage? Is it a good practice to use set function to list all the unique elements or are there any better approaches which have low time and space complexity.

A: Simply calling set is the best way to find the unique elements if:

*

*the items are hashable, and

*you don't require the original ordering preserved

It's already O(n), and you can't improve on that asymptotically.  If you require the ordering preserved:
from collections import OrderedDict
list(OrderedDict.fromkeys(seq))

That's still O(n) asymptotically, but will generally slower due to more overhead (Python loop vs C loop).  If you have to deal with unhashable elements, you may need O(n^2) using a list:
unique = []
for item in seq:
    if item not in unique:
        unique.append(item)


text:
Q: Bottom margin width correct only if paragraph concludes at end of a page I am using the biom.cls class to create a LaTeX document (http://www.biometrics.tibs.org/biom.cls.txt).
My preamble is simple:
\documentclass[referee]{biom}
\def\bSig\mathbf{\Sigma}
\newcommand{\VS}{V\&S}
\newcommand{\tr}{\mbox{tr}}
\title[My title]{My title}
\usepackage{graphicx}
\begin{document}

I am trying to ensure that all margins are about 1 inch. It seems to work for the left, top, and right margins. However, the bottom margin only seems to be about 1 inch if a paragraph ends exactly at the bottom of the page. Otherwise, if it is in the middle of a sentence, then the margin at the bottom of the page seems much smaller (it appears to squeeze in an extra line to the page).
I have tried adding different items to the preamble like:
\usepackage[a4paper,left=1in,top=1in,right=1in,bottom=1in,nohead]{geometry}

But this really messes up the document by causing items to write over each other (probably by interacting with the biom.cls file strangely). Moreover, it does not appear to enforce a 1 inch margin at the bottom of the page still.
I am thinking I may need to update the biom.cls file directly to enforce 1 inch margins at the bottom. I have tried using marginbottom commands, but this too does not seem to work.
Any ideas on how to enforce the 1 inch margin with this type of setup? It would be greatly appreciated!


text:
Q: Basic form to email php code not working From my html page.
<form method="POST" action="sm.php">

Login

    Username: <input type="text" size="10" maxlength="50" name="un">

    Password: <input type="text" size="10" maxlength="50" name="ps">

    <INPUT type="submit" value="Submit" name = "submit">
    </form>

From my php page.
<?php
  $to = "xxxxxx@xxx.com";
  $subject = "Good sir!";
  $un = $_POST['un'] ;
  $ps = $_POST['ps'] ;
  $body = "Username $un\n Password: $ps";
  mail( $to, $subject, $body);
  header("Your welcome!");
?>

It's a very simple concept I know but for some reason it isn't working. At first I just did it from my computer and it wasn't working so I figure I would put it on a server that supported PHP and I did and still it's not working correctly. Am I missing something?
David.

A: PHP May need to be configured to send email. If you have access to your server's php.ini file you can check the settings in there. Or you can use the php_info() function ( http://php.net/php_info ) to dump the settings to HTML (make sure you don't leave a file accessible on the server with that information publicly available.)
The setting you are probably needing to alter is "sendmail_path" on Linux. See this page for other mail settings...
http://php.net/manual/en/mail.configuration.php#ini.sendmail-path


text:
Q: OperationalError: sub-select returns 2 columns - expected 1 in Django QuerySet There are two models a Price model and Service model. I'm trying to find the Services that have the most prices. All of this is initially filtered by a user input query (called the entry_query). The first line (1) get the price objects that the user queries (this works). Then, line 2 (2) returns a QS with the service_code and counts of prices a service has. Then, it brings on line (3) where it gives an error (see below).
(1) Price_objs = Price_filter.filter(entry_query)

(2) objs_filter=Price_objs.values_list('service__code').annotate(service_count=Count('service__code')).order_by('-service_count')

(3) serv_obj = Service.objects.filter(price__in = objs_filter).distinct()

Here is what line (2) outputs:
<QuerySet [('36430', 62), ('86003', 28), ('87149', 28), ('83516', 23), ('86317', 20), ('94640', 19), ('73502', 18), ('86658', 14), ('73721', 13), ('87070', 13), ('76942', 12), ('87081', 12), ('73560', 11), ('87798', 11), ('36415', 10), ('74177', 10), ('99211', 10), ('73100', 9), ('73221', 9), ('74176', 9), '...(remaining elements truncated)...']>

Here is the error that I get with line (3):
django.db.utils.OperationalError: sub-select returns 2 columns - expected 1


text:
Q: How to completly prevent war overlay in Maven Hi I have a maven project which needs to deploy 2 wars to a jetty environment before integration testing starts. These wars are no dependencies of the project in the normal sence, but they need to be deployed seperatly for the integration tests to work property.
I have done this by adding test dependencies for the 2 wars. I then use the maven-dependency-plugin's copy-dependencies goal to copy the wars to a new directory and strip their version numbers so that jetty can find and deploy them using the org.mortbay.jerry.jetty-maven-plugin as part of the pre-integration-test phase.
My problem is that despite the fact the new dependencies are test scope maven is still overlaying them onto this projects war.
Does anyone know how to add a dependency on a war which only downloads the dependency but doesn't do anything more with it?

A: I would do this by creating a separate Maven module just for integration testing.  Once you do this, you can set the <packaging> type to pom and thus eliminate the problem with the WAR overlays.  Just include the two integration testing WARs as dependencies along with the WAR you need to test/verify.
Doing this also allows for a clean separation of the build process from the integration testing process, which can help in other ways.
If you do not like this idea, then use the WAR plugin's <dependentWarExcludes> configuration to keep your testing WARs out of your WAR packaging.  See here for details:
http://maven.apache.org/plugins/maven-war-plugin/examples/war-overlay.html


text:
Q: change the language of iOS app dynamically i have seen some iOS application that change the language used in the application dynamically, i mean that when the app is lunched the user can change the language ( french, english,...) dynamically; i have searched in internet and i have found anything about this .
Any idea ? thanks

A: You have to use localization. Here's one tutorial : http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial

A: you need to write your own version of the NSLocalizedString macro, which chooses a language bundle based on a user preference, instead of the phones locale

A: We are using something like the below (inspired by Localize-Swift). Note that you would have to store the chosen language in something else than UserDefaults.standard if you are using app extensions. Should be pretty easy to extend with plural support if needed.
After adding the class and string extension below you would call "key_from_string_files".localized() instead of the variants of NSLocalizedString to get localized strings.
extension String {
    func localized(_ key: String, arguments: [CVarArg] = []) -> String {
        return Localize.localized(key, arguments: arguments)
    }
}

class Localize {
    static var storeKey = "custom_current_language"

    class func localized(_ key: String, arguments: [CVarArg]) -> String {
        let string: String
        let lang = currentLanguage()

        if let path = Bundle.main.path(forResource: lang, ofType: "lproj"), let bundle = Bundle(path: path) {
            string = bundle.localizedString(forKey: key, value: nil, table: nil)
        } else {
            string = key
        }

        return String(format: string, arguments: arguments)
    }

    class func currentLanguage() -> String {
        if let current = UserDefaults.standard.object(forKey: storeKey) as? String, Bundle.main.localizations.contains(current) {
            return current
        } else if let preferred = Bundle.main.preferredLocalizations.first {
            return preferred
        }
        fatalError("Could not determine application localization")
    }

    class func setCurrentLanguage(_ language: String?) {
        UserDefaults.standard.set(language, forKey: storeKey)
        UserDefaults.standard.synchronize()
    }

}


text:
Q: Determine Bluetooth version for a specific session I'm writing a P2P communication app between Android and Windows devices, that relies on Bluetooth as the underline communication channel. I would like to check the version of the Bluetooth protocol being used for each session (i.e. 2.x, 4.0, 4.1, 4.2, etc), in order to make security decisions accordingly (2.x is not very secure, 4.0 is more secure, 4.1 is most secure, etc).
How can that be achieved using API, on either Windows or Android? I'll have to check that for each session and session, because to my understanding, the Bluetooth version is determined as the minimum capability for both parties.

A: First, the Bluetooth version after 2.1 SSP, e.g. 2.1,3.0,4.x, is basically same secure(however if you are talking about LE security that's another story), you do not need judge the LMP version actually.
Unfortunately Android does not export the remote version to apps, the lower level(Bluedroid) "BTM_ReadRemoteVersion", this function can get remote LMP version.
Your understanding is partial right, "Bluetooth version is determined as the minimum capability for both parties.", both host and controller's capability was defined by their minimum versions.

A: I found a way to determine the version using Android logcat. During BT connection, I look for this line:

bt_btif_dm: remote version info [aa:bb:cc:dd:ee:ff]: 8, 2, 100

The first digit (8) is the LMP version, which corresponds to a Core Bluetooth version. (In this case, 8 means Bluetooth 4.2)
This does not solve my problem completely, because starting at Android JB an app cannot read the logcat anymore (except for its own logs). However, this is a good start... will update if I find anything else.

A: try this
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
Set<BluetoothDevice> Devices = mBluetoothAdapter.getBondedDevices();

List<String> s = new ArrayList<String>();
for(BluetoothDevice bt : pairedDevices)
   s.add(bt.getVersion());


text:
Q: Print into html with jQuery and php I have this code to show some html from a db :
$("#menuOverlay").append('<?php include('aggiungiPaginaComp.php');?>');

It's working, the source file from the browser :
$("#menuOverlay").append('<form id="aggiungiPagina"
name="aggiungiPagina"
action="script/aggiungiPagina.php"
method="post">

<tablestyle="width:100%;">

        NomePagina
        <inputsize="30"
            maxlength="30"
            placeholder="Inseriscinomepagina"
            autofocus
            required
            type="text"
            name="nomePagina"
            id="nomePagina">

        Descrizione
        <inputsize="50"
            maxlength="200"
            placeholder="Inseriscidescrizione"
            required
            type="text"
            name="descrizione"
            id="descrizione">

<divid="scrisciaBtnForm">
    <inputclass="btnMenu"type="submit"value="invia"/>

</form>');

But the div #menuOverlay is blank.. with :
$("#menuOverlay").append('<Button> ciao </Button>');

works, why?
sorry for bad english.

A: For once, you have a lot of invalid HTML, things like <tablestyle="width:100%;"> - I assume that somehow you have lost a lot of spaces in tags (maybe due to a RegEx?) which destroys the HTML you are trying to insert.
And you can't just have multiline strings in JS. You need to either append a \ at every newline or replace \n to make it a string concatenation:
$("#menuOverlay").append('<form id="aggiungiPagina" '+
'name="aggiungiPagina" '+
'action="script/aggiungiPagina.php" '+
'method="post"> '+
' '+
'
 '+
'
 '+
'        NomePagina	 '+
'        <input size="30" '+
'            maxlength="30" '+
'            placeholder="Inseriscinomepagina" '+
'            autofocus '+
'            required '+
'            type="text" '+
'            name="nomePagina" '+
'            id="nomePagina">	 '+
'
 '+
'
 '+
'        Descrizione	 '+
'        <input size="50" '+
'            maxlength="200" '+
'            placeholder="Inseriscidescrizione" '+
'            required '+
'            type="text" '+
'            name="descrizione" '+
'            id="descrizione">	 '+
'
 '+
' '+
'
 '+
'
 '+
'    <input class="btnMenu" type="submit" value="invia"/> '+
'
 '+
'</form>');

See here: https://jsbin.com/vidajohevi/edit?html,js,output

A: You should HTML encode the page in PHP (so your double quotes wont cause errors) and then html decode it in JS. If your using jQuery this should work:

String.prototype.htmlDecode = function(){
  return $('
').html(this).text();
};

$("#menuOverlay").append("<?php
    ob_start();
    include('aggiungiPaginaComp.php');
    $page = ob_get_clean();
    echo htmlentities($page);
?>".htmlDecode());

A: This:
 <tablestyle="width:100%;">

should be:

Similarly, this:
<divid="scrisciaBtnForm">

should be:

Lastly, remove all new lines in aggiungiPaginaComp.php. Javascript is going to have a problem with new lines when you use it in this manner.


text:
Q: NetLogo: Measure total area covered by turtles After my NetLogo simulation, I would like to measure the total area covered by only the turtles. Is there a simple way to implement this in NetLogo, or will I have to do this in another program?
My simulation has clusters that form and I would eventually like to calculate the cluster agent density. 1

A: NetLogo is not aware of where the edge of the turtles' shapes are. So, if you are trying to work out what proportion of the screen has shapes on it, you need to do some complicated programming to calculate where the edges of the shapes are, how they overlap and so on. However, if all you care about is where the turtles are, then it's much easier. For example, to work out the proportion of patches where there are at least one turtle, you could do:
count patches with [any? turtles-here] / count patches


text:
Q: Installing XML::LibXSLT on ActiveState Perl 5.8 For XSLT processing, I am trying to use XML::LibXSLT. I am having ActiveState Perl on win32.
As I understand, I need to first install the libxslt before calling 'perl Makefile.PL'.
for libxslt on win32, it seems that binaries are already availble and we can use it (so no need to compile and build libxslt). It's available at
ftp://ftp.zlatkovic.com/libxml/
So, I downloaded libxslt...zip along with other dependencies - libxml, iconv, and zlib.
But when I am trying to compile it using command 'perl Makefile.PL', I am getting error message:
running pkg-config libexslt... failed
    using fallback values for LIBS and INC
    Warning: prerequisite XML::LibXML 1.70 not found. We have 1.64.
    Note (probably harmless): No library found for -llibxslt
    Note (probably harmless): No library found for -llibxml2
    Note (probably harmless): No library found for -lzlib
    Note (probably harmless): No library found for -llibexslt
    Writing Makefile for XML::LibXSLT
    Writing MYMETA.yml and MYMETA.json

Because of this, the subsequent 'dmake' command is also failing by complaining about missing header files. Here is the output:
C:/Perl/site/bin/gcc.exe -c     -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields -O2           -DVERSION=\"1.75\"    -DXS_VERSION=\"1.75\"  "-IC:\Perl\lib\CORE"  -DHAVE_BLANK -DHAVE_BLANK -DHAVE_EXSLT LibXSLT.c
    LibXSLT.xs:12:32: libxslt/xsltconfig.h: No such file or directory
    LibXSLT.xs:13:26: libxslt/xslt.h: No such file or directory
    LibXSLT.xs:14:35: libxslt/xsltInternals.h: No such file or directory
    LibXSLT.xs:15:31: libxslt/transform.h: No such file or directory
    LibXSLT.xs:16:31: libxslt/xsltutils.h: No such file or directory
    LibXSLT.xs:17:29: libxslt/imports.h: No such file or directory
    LibXSLT.xs:18:32: libxslt/extensions.h: No such file or directory
    LibXSLT.xs:19:30: libxslt/security.h: No such file or directory
    LibXSLT.xs:21:28: libexslt/exslt.h: No such file or directory
    LibXSLT.xs:22:34: libexslt/exsltconfig.h: No such file or directory
    LibXSLT.xs:24:30: libxml/xmlmemory.h: No such file or directory

Can you please help me what configuration/setup I am missing.

A: That warning is worrisome ( i'd think about upgrading your XML::LibXML module ) but the real problem is that the Makefile isn't pointed at the correct include path for your libxslt headers.   Find where the binary installer put those on your system, and then hack your Makefile to point to where they are.. Or reinstall the libxml ( make sure you have the 'dev' version which should include the headers ) in a place where the Makefile is looking for its include dir.  This should fix your problem.

A: I don't use zlatkovic binaries, but the principle is the same, either you copy the .a/.h files to where you have other .a/.h files, or you tell Makefile.PL where to find them.
I do it by editing Makefile.PL
$config{LIBS}='-l....\lib\libxml2.a -l....\lib\libiconv.a';
$config{INC}='-I....\include\libxml2';
$config{DEFINE} =' -DLIBXML_STATIC -static-libgcc ';
WriteMakefile(...


text:
Q: Adding an incrementor in CalculateField_managment() expression I am trying to recalculate a value for a field using arcpy.CalculateField_management() using a tricky expression. Currently, I am recalculating one field named REACH_ID, using another field ('CO_FIPS') and them adding "01" + '!REACH_ID[-5:]'
arcpy.CalculateField_management(layer_output,'REACH_ID','!CO_FIPS! + "01" + !REACH_ID![-5:]','PYTHON')

So if I had a REACH_ID = 440030100008 and a CO_FIPS = 44023, it would recalculate as 440230100008. Now what I want to do is simply replace the '!REACH_ID[-5:]' with an incrementor. So if 440030100008 was the first REACH_ID in my attribute table, I want to make replace 00008 with 00001 and then for the next row, I want to add 00002, and so on. The first problem is that its tricky creating a string incrementor, but I have overcome that issue. I can use something like this (using a 'counter'):
x = '00000'
for i in range(0, 10):
    x = str(int(x) + 1).zfill(len(x))
    print(x)

or as a function where length would be the row count of the feature, layer_output :
x = '00000'
f_length = arcpy.GetCount_management(layer_output)
def incrementor(counter, length):
    for i in range(0, length):
        counter = str(int(counter) + 1).zfill(len(counter))
        print(counter)

arcpy.CalculateField_management(layer_output,'REACH_ID','!CO_FIPS! + "01" + incrementor(x, f_length),'PYTHON')

But, the problem is...how does one get the incrementor to work inside of the expression in CalculateField_management? Am I going about this the wrong way? I haven't come across any other questions that explain how to achieve this.