问:
Android - OnClick inside gridview row
I'm trying to launch a activity from a button inside my gridview item, meaning that when user click on gridview Item it should do one function and when the user click on the button inside the gridview item it should do another function, let me elaborate, here is my single item layout that is being populated inside of my gridview;

```<code><android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?android:attr/selectableItemBackground"
android:orientation="horizontal"
app:cardCornerRadius="5dp"
app:cardElevation="3dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true">

<RelativeLayout
    android:id="@+id/single_row"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="10dp"
    android:paddingTop="10dp">

    <com.mikhaellopez.circularimageview.CircularImageView
        android:id="@+id/imgFood"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        app:civ_border_color="#ffffff"
        app:civ_border_width="2dp"
        app:civ_shadow="true"
        app:civ_shadow_color="#000000"
        app:civ_shadow_radius="10" />

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_toRightOf="@+id/imgFood">

    <TextView
        android:id="@+id/txtName"
        android:layout_marginLeft="5dp"
        android:layout_marginStart="5dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Name"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="16sp"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/currentid"
        android:layout_marginLeft="5dp"
        android:layout_marginStart="5dp"
        android:layout_below="@+id/txtName"
        android:text="Current ID : "
        android:visibility="visible"
        />

    <TextView
        android:id="@+id/studentid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ID"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="16sp"
        android:layout_below="@+id/txtName"
        android:layout_toRightOf="@+id/currentid"
        android:layout_marginEnd="30dp"
        android:layout_marginRight="30dp"
        />

    </RelativeLayout>

    <Button
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_gravity="end"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:id="@+id/editit"
        android:background="@android:drawable/btn_dialog"/>

</RelativeLayout>
</code>```

here is how the above layout looks:

and here is my adapter getview from where I try to do the intent/actions from;

```<code>@Override
public View getView(int position, View view, ViewGroup viewGroup) {

    View row = view;
    ViewHolder holder = new ViewHolder();

    if (row == null) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(layout, null);

        holder.txtName = (TextView) row.findViewById(R.id.txtName);
        holder.txtPrice = (TextView) row.findViewById(R.id.studentid);
        holder.imageView = (CircularImageView) row.findViewById(R.id.imgFood);
        holder.dit = (Button) row.findViewById(R.id.editit);

        final ViewHolder finalHolder = holder;
        holder.dit.setOnClickListener(new View.OnClickListener() {

            String getname = finalHolder.txtName.getText().toString();
            String gethandicap = finalHolder.txtPrice.getText().toString();

            @Override
            public void onClick(View v) {
                // Do something
                Intent editintent = new Intent(context, MainActivity.class);
                editintent.putExtra("studentname", getname);
                editintent.putExtra("studentid", getID);
                context.startActivity(editintent);
            }
        });

        row.setTag(holder);
    } else {
        holder = (ViewHolder) row.getTag();
    }

    Sudentdb student = studentsList.get(position);

    holder.txtName.setText(student.getName());
    holder.txtPrice.setText(student.getID());

    if (student.getImage() != null && student.getImage().length > 0) {
        Glide.with(context)
                .load(student.getImage())
                .into(holder.imageView);
    } else {
        holder.imageView.setImageBitmap(null);
    }

    return row;

}
</code>```

The problem I'm having is that the button inside the gridview item is not performing any actions, in log it only says ACTION_DOWN and since I added a button inside the item the item onclick also doesn't work.

EDIT; ADDING GRIDVIEW ONCLICK AND LAYOUT

```<code>gridView = (GridView) findViewById(R.id.gridView);
    list = new ArrayList<>();
    adapter = new StudentListAdapter(this, R.layout.food_items, list);
    gridView.setAdapter(adapter);

    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                                int position, long id) {

            String dataFromGrid;
            dataFromGrid = ((TextView)(view.findViewById(R.id.txtName))).getText().toString();

            Intent i = new Intent(getApplicationContext(), Student.class);

            i.putExtra("unfromstudent",dataFromGrid);
            startActivity(i);
</code>```

gridview layout (I have tried focusable and clickable)

```<code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clickable="true"
    android:focusable="true"
     >

    <GridView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:focusable="true"
        android:id="@+id/gridView"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:columnWidth="120dp"
        android:gravity="center"
        android:layout_margin="2dp"
        android:numColumns="1"

        />

</RelativeLayout>
</code>```

答:
I don't have enough reputation so i can't comment your question, why don't you use a recyclerview with a gridLayoutManager? You can see a basic example here .

After that you can implement your recyclerview adapter this way:

```<code>public class StudentsAdapter extends RecyclerView.Adapter<StudentsAdapter.ViewHolder> {

private final OnStudentItemClickListener mListener;
private Context mContext;
private List<Student> mStudents;

public StudentsAdapter(Context context, List<Student> items, OnStudentItemClickListener listener) {
    mContext = context;
    mStudents =items;
    mListener = listener;
}

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext())
            .inflate(R.layout.list_item_student, parent, false);
    return new ViewHolder(view);
}

@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    Student student = mStudents.get(position);

    holder.mTextName.setText(student.getName());
    holder.mTextPrice.setText(student.getID());

    if (student.getImage() != null && student.getImage().length > 0) {
        Glide.with(context)
                .load(student.getImage())
                .into(holder.imageView);
    } else {
        holder.imageView.setImageBitmap(null);
    }
}

@Override
public int getItemCount() {
    return mStudents.size();
}

public interface OnStudentItemClickListener {
    void onStudentItemClick(Student student);
    void onStudentButtonClick(Student student);
}

public class ViewHolder extends RecyclerView.ViewHolder
        implements View.OnClickListener {
    TextView mTextName;
    TextView mTextPrice;
    CircleImageView mImageView;
    Button mDit;

    public ViewHolder(View view) {
        super(view);

        mTextName = (TextView) view.findViewById(R.id.txtName);
        mTextPrice = (TextView) view.findViewById(R.id.studentid);
        mImageView = (CircleImageView) view.findViewById(R.id.imgFood);
        mDit = (Button) view.findViewById(R.id.editit);
        mDit.setOnClickListener(view1 -> {
            if (null != mListener) {
                mListener.onStudentButtonClick(mStudents.get(getAdapterPosition()));
            }
        });
        itemView.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        if (null != mListener) {
            mListener.onStudentItemClick(mStudents.get(getAdapterPosition()));
        }
    }
}
</code>```

}

Title: Android - OnClick inside gridview row

Body:
I'm trying to launch a activity from a button inside my gridview item, meaning that when user click on gridview Item it should do one function and when the user click on the button inside the gridview item it should do another function, let me elaborate, here is my single item layout that is being populated inside of my gridview;

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?android:attr/selectableItemBackground"
android:orientation="horizontal"
app:cardCornerRadius="5dp"
app:cardElevation="3dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true">

<RelativeLayout
    android:id="@+id/single_row"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="10dp"
    android:paddingTop="10dp">

    <com.mikhaellopez.circularimageview.CircularImageView
        android:id="@+id/imgFood"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        app:civ_border_color="#ffffff"
        app:civ_border_width="2dp"
        app:civ_shadow="true"
        app:civ_shadow_color="#000000"
        app:civ_shadow_radius="10" />

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_toRightOf="@+id/imgFood">

    <TextView
        android:id="@+id/txtName"
        android:layout_marginLeft="5dp"
        android:layout_marginStart="5dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Name"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="16sp"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/currentid"
        android:layout_marginLeft="5dp"
        android:layout_marginStart="5dp"
        android:layout_below="@+id/txtName"
        android:text="Current ID : "
        android:visibility="visible"
        />

    <TextView
        android:id="@+id/studentid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ID"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="16sp"
        android:layout_below="@+id/txtName"
        android:layout_toRightOf="@+id/currentid"
        android:layout_marginEnd="30dp"
        android:layout_marginRight="30dp"
        />

    </RelativeLayout>

    <Button
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_gravity="end"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:id="@+id/editit"
        android:background="@android:drawable/btn_dialog"/>

</RelativeLayout>

here is how the above layout looks:

and here is my adapter getview from where I try to do the intent/actions from;

@Override
public View getView(int position, View view, ViewGroup viewGroup) {

    View row = view;
    ViewHolder holder = new ViewHolder();

    if (row == null) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(layout, null);

        holder.txtName = (TextView) row.findViewById(R.id.txtName);
        holder.txtPrice = (TextView) row.findViewById(R.id.studentid);
        holder.imageView = (CircularImageView) row.findViewById(R.id.imgFood);
        holder.dit = (Button) row.findViewById(R.id.editit);

        final ViewHolder finalHolder = holder;
        holder.dit.setOnClickListener(new View.OnClickListener() {

            String getname = finalHolder.txtName.getText().toString();
            String gethandicap = finalHolder.txtPrice.getText().toString();

            @Override
            public void onClick(View v) {
                // Do something
                Intent editintent = new Intent(context, MainActivity.class);
                editintent.putExtra("studentname", getname);
                editintent.putExtra("studentid", getID);
                context.startActivity(editintent);
            }
        });

        row.setTag(holder);
    } else {
        holder = (ViewHolder) row.getTag();
    }

    Sudentdb student = studentsList.get(position);

    holder.txtName.setText(student.getName());
    holder.txtPrice.setText(student.getID());

    if (student.getImage() != null && student.getImage().length > 0) {
        Glide.with(context)
                .load(student.getImage())
                .into(holder.imageView);
    } else {
        holder.imageView.setImageBitmap(null);
    }

    return row;

}

The problem I'm having is that the button inside the gridview item is not performing any actions, in log it only says ACTION_DOWN and since I added a button inside the item the item onclick also doesn't work.

EDIT; ADDING GRIDVIEW ONCLICK AND LAYOUT

gridView = (GridView) findViewById(R.id.gridView);
    list = new ArrayList<>();
    adapter = new StudentListAdapter(this, R.layout.food_items, list);
    gridView.setAdapter(adapter);

    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                                int position, long id) {

            String dataFromGrid;
            dataFromGrid = ((TextView)(view.findViewById(R.id.txtName))).getText().toString();

            Intent i = new Intent(getApplicationContext(), Student.class);

            i.putExtra("unfromstudent",dataFromGrid);
            startActivity(i);

gridview layout (I have tried focusable and clickable)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clickable="true"
    android:focusable="true"
     >

    <GridView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:focusable="true"
        android:id="@+id/gridView"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:columnWidth="120dp"
        android:gravity="center"
        android:layout_margin="2dp"
        android:numColumns="1"

        />

</RelativeLayout>

Body:
I don't have enough reputation so i can't comment your question, why don't you use a recyclerview with a gridLayoutManager? You can see a basic example here .

After that you can implement your recyclerview adapter this way:

public class StudentsAdapter extends RecyclerView.Adapter<StudentsAdapter.ViewHolder> {

private final OnStudentItemClickListener mListener;
private Context mContext;
private List<Student> mStudents;

public StudentsAdapter(Context context, List<Student> items, OnStudentItemClickListener listener) {
    mContext = context;
    mStudents =items;
    mListener = listener;
}

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext())
            .inflate(R.layout.list_item_student, parent, false);
    return new ViewHolder(view);
}

@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    Student student = mStudents.get(position);

    holder.mTextName.setText(student.getName());
    holder.mTextPrice.setText(student.getID());

    if (student.getImage() != null && student.getImage().length > 0) {
        Glide.with(context)
                .load(student.getImage())
                .into(holder.imageView);
    } else {
        holder.imageView.setImageBitmap(null);
    }
}

@Override
public int getItemCount() {
    return mStudents.size();
}

public interface OnStudentItemClickListener {
    void onStudentItemClick(Student student);
    void onStudentButtonClick(Student student);
}

public class ViewHolder extends RecyclerView.ViewHolder
        implements View.OnClickListener {
    TextView mTextName;
    TextView mTextPrice;
    CircleImageView mImageView;
    Button mDit;

    public ViewHolder(View view) {
        super(view);

        mTextName = (TextView) view.findViewById(R.id.txtName);
        mTextPrice = (TextView) view.findViewById(R.id.studentid);
        mImageView = (CircleImageView) view.findViewById(R.id.imgFood);
        mDit = (Button) view.findViewById(R.id.editit);
        mDit.setOnClickListener(view1 -> {
            if (null != mListener) {
                mListener.onStudentButtonClick(mStudents.get(getAdapterPosition()));
            }
        });
        itemView.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        if (null != mListener) {
            mListener.onStudentItemClick(mStudents.get(getAdapterPosition()));
        }
    }
}

}


来源: stackexchange

问:
Trying to run Django tests, get error loading either pysqlite2 or sqlite3?
I am trying to run tests on a project that is not mine when i python manage.py test, I get

```<code>raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'
</code>```

I have installed the sqlite3 and pysqlite2 and all the dev-lib packages, it tells me the requirements are already satisfied. I installed them outside of the virtual env, I believe this is my problem, but I am afraid to use sudo apt-get remove because last time I used this command I deleted almost my entire Ubuntu. Any suggestions?

答:
Inside your virtual env:

```<code>pip install pysqlite2
</code>```

NOTE: sqlite3 module is included in the standard library (since Python 2.5).

EDIT: try this to install the following:

```<code>sudo apt-get update && sudo apt-get upgrade
sudo apt-get install libsqlite3-dev libsqlite3
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I am trying to run tests on a project that is not mine when i python manage.py test, I get

raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'

I have installed the sqlite3 and pysqlite2 and all the dev-lib packages, it tells me the requirements are already satisfied. I installed them outside of the virtual env, I believe this is my problem, but I am afraid to use sudo apt-get remove because last time I used this command I deleted almost my entire Ubuntu. Any suggestions?

Body:
Inside your virtual env:

pip install pysqlite2

NOTE: sqlite3 module is included in the standard library (since Python 2.5).

EDIT: try this to install the following:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install libsqlite3-dev libsqlite3


问:
IEnumerable to string delimited with commas?
I have a DataTable that returns

```<code>IDs
,1
,2
,3
,4
,5
,100
,101
</code>```

I want to convert this to single string value, i.e:

```<code>,1,2,3,4,5,100,101
</code>```

How can i rewrite the following to get a single string

```<code>var _values = _tbl.AsEnumerable().Select(x => x);
</code>```

答:
You can use MoreLINQ extension</p>

```<code>var singleString = _values.ToDelimitedString(",");
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I have a DataTable that returns

IDs
,1
,2
,3
,4
,5
,100
,101

I want to convert this to single string value, i.e:

,1,2,3,4,5,100,101

How can i rewrite the following to get a single string

var _values = _tbl.AsEnumerable().Select(x => x);

Body:
You can use MoreLINQ extension

var singleString = _values.ToDelimitedString(",");


问:
How to avoid duplicate commits after my changes are merged into master branch in Gerrit
We are using Gerrit in our project and we strive to maintain a linear history by always rebasing our local changes on top of any incoming new changes.

After I've committed my changes into my local master branch, I push them into the remote:

```<code>git push origin HEAD:refs/for/master
</code>```

This creates a Gerrit review for my commit. And when I run git status it says that my local branch is ahead of origin/master by one commit, because my new commit has not been merged into the the remote master branch yet. Keep in mind that there may be other commits for review by other developers which have not been merged into the remote master branch. This means that I cannot rebase my commit on top of them because they are not in the remote mater branch yet.

When my commit has been merged into the remote master branch, either before or after any other commits, and after I've run git fetch origin, running git status says that my local master branch and the remote have diverged, because the local version of my commit (its sha-1) is different from the remote version. Basically my commit is duplicated under a different sha-1. Then I have to run git reset --hard HEAD~1 to delete the local version of my commit and then git merge origin/master to fast-forward my local branch to include the new changes from the remote master branch. Is there any way to avoid this?

答:
A good way to avoid this is to use rebase instead of merge. To do this change your project settings in page /admin/projects/YOUR_PROJECT setting the value "Rebase if Necessary" for "Submit Type" entry.

After pushing the commit from Gerrit you can update your local repository using git pull --rebase or git fetch origin ; git rebase origin/master.

To go further, you can create a single local branch per commit, then pushing this branch to refs/for/master and rebase the same way as before. It has the advantage to not create dependency into differents commits.

Body:
We are using Gerrit in our project and we strive to maintain a linear history by always rebasing our local changes on top of any incoming new changes.

After I've committed my changes into my local master branch, I push them into the remote:

git push origin HEAD:refs/for/master

This creates a Gerrit review for my commit. And when I run git status it says that my local branch is ahead of origin/master by one commit, because my new commit has not been merged into the the remote master branch yet. Keep in mind that there may be other commits for review by other developers which have not been merged into the remote master branch. This means that I cannot rebase my commit on top of them because they are not in the remote mater branch yet.

When my commit has been merged into the remote master branch, either before or after any other commits, and after I've run git fetch origin, running git status says that my local master branch and the remote have diverged, because the local version of my commit (its sha-1) is different from the remote version. Basically my commit is duplicated under a different sha-1. Then I have to run git reset --hard HEAD~1 to delete the local version of my commit and then git merge origin/master to fast-forward my local branch to include the new changes from the remote master branch. Is there any way to avoid this?


问:
Rewrite Rule to exclude images
I've got the following htaccess code and I need it to only work if it is not images.  Right now its making all the images seem as if they don't exist on the pages on the site.

```<code># If there are caps, set HASCAPS to true and skip next rule

RewriteRule [A-Z] - [E=HASCAPS:TRUE,S=1]

# Skip this entire section if no uppercase letters in requested URL
RewriteRule ![A-Z] - [S=28]

# Replace single occurance of CAP with cap, then process next Rule.

RewriteRule ^([^A]*)A(.*)$ $1a$2
RewriteRule ^([^B]*)B(.*)$ $1b$2
RewriteRule ^([^C]*)C(.*)$ $1c$2
RewriteRule ^([^D]*)D(.*)$ $1d$2
RewriteRule ^([^E]*)E(.*)$ $1e$2
RewriteRule ^([^F]*)F(.*)$ $1f$2
RewriteRule ^([^G]*)G(.*)$ $1g$2
RewriteRule ^([^H]*)H(.*)$ $1h$2
RewriteRule ^([^I]*)I(.*)$ $1i$2
RewriteRule ^([^J]*)J(.*)$ $1j$2
RewriteRule ^([^K]*)K(.*)$ $1k$2
RewriteRule ^([^L]*)L(.*)$ $1l$2
RewriteRule ^([^M]*)M(.*)$ $1m$2
RewriteRule ^([^N]*)N(.*)$ $1n$2
RewriteRule ^([^O]*)O(.*)$ $1o$2
RewriteRule ^([^P]*)P(.*)$ $1p$2
RewriteRule ^([^Q]*)Q(.*)$ $1q$2
RewriteRule ^([^R]*)R(.*)$ $1r$2
RewriteRule ^([^S]*)S(.*)$ $1s$2
RewriteRule ^([^T]*)T(.*)$ $1t$2
RewriteRule ^([^U]*)U(.*)$ $1u$2
RewriteRule ^([^V]*)V(.*)$ $1v$2
RewriteRule ^([^W]*)W(.*)$ $1w$2
RewriteRule ^([^X]*)X(.*)$ $1x$2
RewriteRule ^([^Y]*)Y(.*)$ $1y$2
RewriteRule ^([^Z]*)Z(.*)$ $1z$2

# If there are any uppercase letters, restart at very first RewriteRule in file.
RewriteRule [A-Z] - [N]

RewriteCond %{ENV:HASCAPS} TRUE

RewriteRule ^/?(.*) /$1 [R=301,L]
</code>```

I've already tried adding RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png)$ [NC] but either it didn't work or I placed it in the wrong place.

答:
Place this rule at top of your .htaccess to skip all existing files and directories:</p>

```<code># skip all files and directories from rewrite rules below
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
</code>```

Title: Rewrite Rule to exclude images

Body:
I've got the following htaccess code and I need it to only work if it is not images.  Right now its making all the images seem as if they don't exist on the pages on the site.

# If there are caps, set HASCAPS to true and skip next rule

RewriteRule [A-Z] - [E=HASCAPS:TRUE,S=1]

# Skip this entire section if no uppercase letters in requested URL
RewriteRule ![A-Z] - [S=28]

# Replace single occurance of CAP with cap, then process next Rule.

RewriteRule ^([^A]*)A(.*)$ $1a$2
RewriteRule ^([^B]*)B(.*)$ $1b$2
RewriteRule ^([^C]*)C(.*)$ $1c$2
RewriteRule ^([^D]*)D(.*)$ $1d$2
RewriteRule ^([^E]*)E(.*)$ $1e$2
RewriteRule ^([^F]*)F(.*)$ $1f$2
RewriteRule ^([^G]*)G(.*)$ $1g$2
RewriteRule ^([^H]*)H(.*)$ $1h$2
RewriteRule ^([^I]*)I(.*)$ $1i$2
RewriteRule ^([^J]*)J(.*)$ $1j$2
RewriteRule ^([^K]*)K(.*)$ $1k$2
RewriteRule ^([^L]*)L(.*)$ $1l$2
RewriteRule ^([^M]*)M(.*)$ $1m$2
RewriteRule ^([^N]*)N(.*)$ $1n$2
RewriteRule ^([^O]*)O(.*)$ $1o$2
RewriteRule ^([^P]*)P(.*)$ $1p$2
RewriteRule ^([^Q]*)Q(.*)$ $1q$2
RewriteRule ^([^R]*)R(.*)$ $1r$2
RewriteRule ^([^S]*)S(.*)$ $1s$2
RewriteRule ^([^T]*)T(.*)$ $1t$2
RewriteRule ^([^U]*)U(.*)$ $1u$2
RewriteRule ^([^V]*)V(.*)$ $1v$2
RewriteRule ^([^W]*)W(.*)$ $1w$2
RewriteRule ^([^X]*)X(.*)$ $1x$2
RewriteRule ^([^Y]*)Y(.*)$ $1y$2
RewriteRule ^([^Z]*)Z(.*)$ $1z$2

# If there are any uppercase letters, restart at very first RewriteRule in file.
RewriteRule [A-Z] - [N]

RewriteCond %{ENV:HASCAPS} TRUE

RewriteRule ^/?(.*) /$1 [R=301,L]

I've already tried adding RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png)$ [NC] but either it didn't work or I placed it in the wrong place.

Body:
Place this rule at top of your .htaccess to skip all existing files and directories:

# skip all files and directories from rewrite rules below
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]


问:
A suitable PC for Visual Studio 2010 programming
I'm planning on buying a new PC for programming under Visual Studio 2010. My main other usages are:

Programming under Microsoft Visual Studio.

Running VMWare Virtual Machines.

Probably multi-monitor (if my budget lets me buy an extra one)

Here are my questions:

Do I need to purchase a high performance display adapter considering my usage described above? or a medium-range one will suffice? In general, I'd like to know how much a display adapter could affect my usages?

Which CPU could perform better? Core i7, Core 2 Quad, AMD?  I have a limited budget but I really need a good performance and buying a good CPU/MB/RAM is my first priority.

答:
I'm running VS2008/VS2010 on a triple monitor setup with a really awful graphics card -- ATI Radeon HD3450.  Graphics performance hasn't affected me one bit since I'm just doing simple WPF applications.  Your needs will vary if you're doing game development or something more demanding.

I would spend your money on RAM, especially if you're using VMs.  And not only do the VMs need memory to run well, they will also need to use the same disk.  So either put them on a different hard disk, or go SSD.  VS20xx thrashes the drive during compiling, and a fast disk will help you out a lot.

ContentLicense: CC BY-SA 2.5


问:
Where do I put VBA code?
Gustav very provided me with code but I have no idea where to put it.

Am I correct in putting the function into a module? What about the other two lines of code?

I'm used to query expressions, but afaik I can't put VBA code in there.

I've tried all sorts of things, but I keep getting "#Name?" on my form.

Gustav's post:

I guess you could calculate like this:

```<code>RetentionStartdate = DateAdd("ww", 14, DateAdd("d", vbSaturday - Weekday    (HireDate), HireDate))
</code>```

From then on, you can count full months:

```<code>RetentionMonths = Months(RetentionStartDate, Date)
</code>```

using a function like this:

```<code>Public Function Months( _
  ByVal datDate1 As Date, _
  ByVal datDate2 As Date, _
  Optional ByVal booLinear As Boolean) _
  As Integer

' Returns the difference in full months between datDate1 and datDate2.
'
' Calculates correctly for:
'   negative differences
'   leap years
'   dates of 29. February
'   date/time values with embedded time values
'   negative date/time values (prior to 1899-12-29)
'
' Optionally returns negative counts rounded down to provide a
' linear sequence of month counts.
' For a given datDate1, if datDate2 is decreased stepwise one month from
' returning a positive count to returning a negative count, one or two
' occurrences of count zero will be returned.
' If booLinear is False, the sequence will be:
'   3, 2, 1, 0,  0, -1, -2
' If booLinear is True, the sequence will be:
'   3, 2, 1, 0, -1, -2, -3
'
' If booLinear is False, reversing datDate1 and datDate2 will return
' results of same absolute Value, only the sign will change.
' This behaviour mimics that of Fix().
' If booLinear is True, reversing datDate1 and datDate2 will return
' results where the negative count is offset by -1.
' This behaviour mimics that of Int().

' DateAdd() is used for check for month end of February as it correctly
' returns Feb. 28. when adding a count of months to dates of Feb. 29.
' when the resulting year is a common year.
'
' 2010-03-30. Cactus Data ApS, CPH.

  Dim intDiff   As Integer
  Dim intSign   As Integer
  Dim intMonths As Integer

  ' Find difference in calendar months.
  intMonths = DateDiff("m", datDate1, datDate2)
  ' For positive resp. negative intervals, check if the second date
  ' falls before, on, or after the crossing date for a 1 month period
  ' while at the same time correcting for February 29. of leap years.
  If DateDiff("d", datDate1, datDate2) > 0 Then
    intSign = Sgn(DateDiff("d", DateAdd("m", intMonths, datDate1), datDate2))
    intDiff = Abs(intSign < 0)
  Else
    intSign = Sgn(DateDiff("d", DateAdd("m", -intMonths, datDate2), datDate1))
    If intSign <> 0 Then
      ' Offset negative count of months to continuous sequence if requested.
      intDiff = Abs(booLinear)
    End If
    intDiff = intDiff - Abs(intSign < 0)
  End If

  ' Return count of months as count of full 1 month periods.
  Months = intMonths - intDiff

End Function
</code>```

答:
For use in a query, create a helper function:

```<code>Public Function RetentionMonths(ByVal HireDate As Date) As Integer

    Dim RetentionStartdate As Date

    RetentionStartdate = DateAdd("ww", 14, DateAdd("d", vbSaturday - Weekday(HireDate), HireDate))

    RetentionMonths = Months(RetentionStartDate, Date)

End Function
</code>```

Like the Months function, save this function in your code module, and your query could look like:

```<code>Select *, RetentionMonths([HireDate]) As RetentionMonths
From YourTable
</code>```

Title: Where do I put VBA code?

Body:
Gustav very provided me with code but I have no idea where to put it.

Am I correct in putting the function into a module? What about the other two lines of code?

I'm used to query expressions, but afaik I can't put VBA code in there.

I've tried all sorts of things, but I keep getting "#Name?" on my form.

Gustav's post:

I guess you could calculate like this:

RetentionStartdate = DateAdd("ww", 14, DateAdd("d", vbSaturday - Weekday    (HireDate), HireDate))

From then on, you can count full months:

RetentionMonths = Months(RetentionStartDate, Date)

using a function like this:

Public Function Months( _
  ByVal datDate1 As Date, _
  ByVal datDate2 As Date, _
  Optional ByVal booLinear As Boolean) _
  As Integer

' Returns the difference in full months between datDate1 and datDate2.
'
' Calculates correctly for:
'   negative differences
'   leap years
'   dates of 29. February
'   date/time values with embedded time values
'   negative date/time values (prior to 1899-12-29)
'
' Optionally returns negative counts rounded down to provide a
' linear sequence of month counts.
' For a given datDate1, if datDate2 is decreased stepwise one month from
' returning a positive count to returning a negative count, one or two
' occurrences of count zero will be returned.
' If booLinear is False, the sequence will be:
'   3, 2, 1, 0,  0, -1, -2
' If booLinear is True, the sequence will be:
'   3, 2, 1, 0, -1, -2, -3
'
' If booLinear is False, reversing datDate1 and datDate2 will return
' results of same absolute Value, only the sign will change.
' This behaviour mimics that of Fix().
' If booLinear is True, reversing datDate1 and datDate2 will return
' results where the negative count is offset by -1.
' This behaviour mimics that of Int().

' DateAdd() is used for check for month end of February as it correctly
' returns Feb. 28. when adding a count of months to dates of Feb. 29.
' when the resulting year is a common year.
'
' 2010-03-30. Cactus Data ApS, CPH.

  Dim intDiff   As Integer
  Dim intSign   As Integer
  Dim intMonths As Integer

  ' Find difference in calendar months.
  intMonths = DateDiff("m", datDate1, datDate2)
  ' For positive resp. negative intervals, check if the second date
  ' falls before, on, or after the crossing date for a 1 month period
  ' while at the same time correcting for February 29. of leap years.
  If DateDiff("d", datDate1, datDate2) > 0 Then
    intSign = Sgn(DateDiff("d", DateAdd("m", intMonths, datDate1), datDate2))
    intDiff = Abs(intSign < 0)
  Else
    intSign = Sgn(DateDiff("d", DateAdd("m", -intMonths, datDate2), datDate1))
    If intSign <> 0 Then
      ' Offset negative count of months to continuous sequence if requested.
      intDiff = Abs(booLinear)
    End If
    intDiff = intDiff - Abs(intSign < 0)
  End If

  ' Return count of months as count of full 1 month periods.
  Months = intMonths - intDiff

End Function

Body:
For use in a query, create a helper function:

Public Function RetentionMonths(ByVal HireDate As Date) As Integer

    Dim RetentionStartdate As Date

    RetentionStartdate = DateAdd("ww", 14, DateAdd("d", vbSaturday - Weekday(HireDate), HireDate))

    RetentionMonths = Months(RetentionStartDate, Date)

End Function

Like the Months function, save this function in your code module, and your query could look like:

Select *, RetentionMonths([HireDate]) As RetentionMonths
From YourTable


答:
Awk version

```<code>awk -F',' '
   NR==1 {s=0;for( i=1;i<=NR;i++) D=sprintf("%s \"%s\" : [", (s++?",":""), $i);next}
         {for( i=1;i<=NR;i++) D[i] = D[i] sprintf( "%s %s", (NR>2?",":""), $(i))}
   END   {
      printf( "{ ")
      s=0;for( d in D) { printf( "%s]", (s++?",":""), D[d] )
      printf( "}"
      }
   ' YourFile > final.py
</code>```

quick and dirty,not memory optimized (2000 lines is not so huge form modern memory space)

Title: convert csv to dictionary

Body:
I have the following csv file(total 20000 lines)

ozone,paricullate_matter,carbon_monoxide,sulfure_dioxide,nitrogen_dioxide,longitude,latitude,timestamp,avg_measured_time,avg_speed,median_measured_time,timestamp:1,vehicle_count,lat1,long1,lat2,long2,distance_between_2_points,duration_of_measurement,ndt_in_kmh
99,99,98,116,118,10.09351660921,56.1671665604395,1407575099.99998,0,0,0,1407575099.99998,0,56.1089513576227,10.1823955595246,56.1048021343541,10.1988040846558,1124,65,62
99,99,98,116,118,10.09351660921,56.1671665604395,1407575099.99998,0,0,0,1407575099.99998,0,56.10986429895,10.1627288048935,56.1089513576227,10.1823955595246,1254,71,64
99,99,98,116,118,10.09351660921,56.1671665604395,1407575099.99998,0,0,0,1407575099.99998,0,56.1425188527673,10.1868802625656,56.1417522836526,10.1927236478157,521,62,30
99,99,98,116,118,10.09351660921,56.1671665604395,1407575099.99998,18,84,18,1407575099.99998,1,56.1395320665735,10.1772034087371,56.1384485157567,10.1791506011887,422,50,30

I want to convert this into a dictionary like

{'ozone': [99,99,99,99], 'paricullate_matter': [99,99,99,99],'carbon_monoxide': [98,98,98,98],etc....}

What i have tried

import csv

reader = csv.DictReader(open('resulttable.csv'))

output = open("finalprojdata.py","w")

result = {}
for row in reader:
    for column, value in row.iteritems():
        result.setdefault(column, []).append(float(value))
output.write(str(result))

The output am getting is consisting of only few dictionaries. Like from

{'vehicle_count': [0,0,0,1], 'lat1': etc}

The whole csv file is not getting converted to dictionary.

Body:
Awk version

awk -F',' '
   NR==1 {s=0;for( i=1;i<=NR;i++) D=sprintf("%s \"%s\" : [", (s++?",":""), $i);next}
         {for( i=1;i<=NR;i++) D[i] = D[i] sprintf( "%s %s", (NR>2?",":""), $(i))}
   END   {
      printf( "{ ")
      s=0;for( d in D) { printf( "%s]", (s++?",":""), D[d] )
      printf( "}"
      }
   ' YourFile > final.py

quick and dirty,not memory optimized (2000 lines is not so huge form modern memory space)


问:
View property information by hovering over it in Layout Editor?
So there used to be a way to view information about a specific property of a view/layout in the layout editor by hovering over it however it stopped working when I updated Android Studio. Is there any way to bring it back? Here's a picture so you can better understand what I'm referring to.

答: Update: So I noticed that if I add the property to my "favorites", I can then hover over it and get information on what it does but I still haven't found a way to do it in the entire properties tab.</p>


问:
Return multiple strings from dll
we are having a discussion as what is a good way to return multiple strings from one dll function. Currently we have 8 strings, but there will be more. For simplicity I now consider all strings will have equal lengths.

```<code>extern "C" int DLLNAME_ _stdcall GetResult(TestResults* testResults);
</code>```

where

```<code>struct TestResults
{
    int stringLengths;
    char* string1;
    char* string2;
    char* string3;
    char* string4;
    ...
};
</code>```

or second option: where

```<code>struct TestResults
{
    int stringLengths;
    char string1[64];
    char string2[64];
    char string3[64];
    char string4[64];
    ...
};
</code>```

third option:
extern "C" int DLLNAME_ _stdcall GetResult(int stringLengths, char* string1, char* string2, char* string3, ...);

The dll will communicate over a serial line and retrieve information that will be filled into the strings. Where the memory needs to be allocated is open for discussion and can be part of the answer.

The background is that we have a VB6 application team that prefers the second method and a C++/C# team that prefers the first method. Last method looks to suit both teams but looks a bit strange to me with so many parameters.

Maybe there are more options. What is common practice under Windows? Any examples from the Windows API or arguments to choose one over the other?

Edit: The strings have a meaning as in first name, last name, email. We currently have eight, but in the future we might add a couple for example for address. An array would not be the correct choice for this, but that was not clear from the original context.

答:
As you declare your function as extern "C" I suppose that you cannot use std::vector<std::string> as return type.

Another possibility would be:

```<code>struct String
{
   int         size; /* size of string */
   const char* str;  /* actual string  */
}
struct TestResults
{
   int     size; /* number of strings             */
   String* arr;  /* pointer to an array of String */
};
</code>```

and then the same as before:

```<code>extern "C" int DLLNAME_ _stdcall GetResult(TestResults* testResults);
</code>```

With that you are flexible to return as much strings as you like. Also loop through your TestResults is easy.

Edit #1: As said in the comments: use BSTR. So your struct would look like:

```<code>struct TestResults
{
   int   size; /* number of strings           */
   BSTR* arr;  /* pointer to an array of BSTR */
};
</code>```

A BSTR will be allocated by: BSTR MyBstr = SysAllocString(L"I am a happy BSTR");. This allocation also sets the member which contain the length of the string. You have to free the allocated memory with: SysFreeString(MyBstr);. Also you need to allocate the whole array BSTR*.

Title: Return multiple strings from dll

Body:
we are having a discussion as what is a good way to return multiple strings from one dll function. Currently we have 8 strings, but there will be more. For simplicity I now consider all strings will have equal lengths.

extern "C" int DLLNAME_ _stdcall GetResult(TestResults* testResults);

where

struct TestResults
{
    int stringLengths;
    char* string1;
    char* string2;
    char* string3;
    char* string4;
    ...
};

or second option: where

struct TestResults
{
    int stringLengths;
    char string1[64];
    char string2[64];
    char string3[64];
    char string4[64];
    ...
};

third option:
extern "C" int DLLNAME_ _stdcall GetResult(int stringLengths, char* string1, char* string2, char* string3, ...);

The dll will communicate over a serial line and retrieve information that will be filled into the strings. Where the memory needs to be allocated is open for discussion and can be part of the answer.

The background is that we have a VB6 application team that prefers the second method and a C++/C# team that prefers the first method. Last method looks to suit both teams but looks a bit strange to me with so many parameters.

Maybe there are more options. What is common practice under Windows? Any examples from the Windows API or arguments to choose one over the other?

Edit: The strings have a meaning as in first name, last name, email. We currently have eight, but in the future we might add a couple for example for address. An array would not be the correct choice for this, but that was not clear from the original context.

Body:
As you declare your function as extern "C" I suppose that you cannot use std::vector<std::string> as return type.

Another possibility would be:

struct String
{
   int         size; /* size of string */
   const char* str;  /* actual string  */
}
struct TestResults
{
   int     size; /* number of strings             */
   String* arr;  /* pointer to an array of String */
};

and then the same as before:

extern "C" int DLLNAME_ _stdcall GetResult(TestResults* testResults);

With that you are flexible to return as much strings as you like. Also loop through your TestResults is easy.

Edit #1: As said in the comments: use BSTR. So your struct would look like:

struct TestResults
{
   int   size; /* number of strings           */
   BSTR* arr;  /* pointer to an array of BSTR */
};

A BSTR will be allocated by: BSTR MyBstr = SysAllocString(L"I am a happy BSTR");. This allocation also sets the member which contain the length of the string. You have to free the allocated memory with: SysFreeString(MyBstr);. Also you need to allocate the whole array BSTR*.


问:
table rows and cells are broken
I have the following styling and HTML, but when it displays, the table appears broken (all the table rows and cells are broken). I'm not sure why; how can I fix it?

the tbody need have this size: height: calc(100vh - 130px);

the red line defines the size of the table.

edit: my tbody need have scroll and the thead need be fixed.

jsfiddle: https://jsfiddle.net/zuxq2gr0/11/

.col-lg-12 {
  border: 1px solid red;
}

tbody {
  display: block;
  overflow-y: scroll;
  height: calc(100vh - 130px);
}

tbody > tr {
  display: table;
  width: 100%;
}```

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

          test
          test
          test
          test
          test

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          <compose view="./-box.html"></compose>

```

答:
just remove
 and
 it will work here is the demo link
Demo

Title: table rows and cells are broken

Body:
I have the following styling and HTML, but when it displays, the table appears broken (all the table rows and cells are broken). I'm not sure why; how can I fix it?

the tbody need have this size: height: calc(100vh - 130px);

the red line defines the size of the table.

edit: my tbody need have scroll and the thead need be fixed.

jsfiddle: https://jsfiddle.net/zuxq2gr0/11/

.col-lg-12 {
  border: 1px solid red;
}

tbody {
  display: block;
  overflow-y: scroll;
  height: calc(100vh - 130px);
}

tbody > tr {
  display: table;
  width: 100%;
}

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

          test
          test
          test
          test
          test

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          test
          test
          test

              <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                <option value="" selected=""></option>
                <option value="-action"> Action</option>
              </select>

          <compose view="./-box.html"></compose>

Body:
just remove  <thead> and  <tbody> it will work here is the demo link
Demo


问:
i have a problem with exception "java.lang.ArrayIndexOutOfBoundsException"
i have a problem with exception "java.lang.ArrayIndexOutOfBoundsException"
i wrote a program which have src array of 48 length then processes it to take each 6 indexes to another array using method arrayCopy and print each dst array
for me it works fine it prints each 6 indexes from the initial array but at the end i get an exception help please . the algorithm is just a test because i want to use the arrayCopy in another algorithm so i don't need suggestion to change the algorithm . i hope it is clear fair enough </p>

```<code>  public static void main(String [] arg)
        {
            int[] src = new int[48];
            for(int j=0;j<src.length;j++)
            {
                src[j]=j+1;
                System.out.print(src[j]+" ");
            }
            System.out.println();
            int[] dst = new int[6];
            int from=0;
            for(int i=0;i<src.length;i++)
            {
                System.arraycopy(src, from, dst, 0, 6); // Copies 6 indexes from src starting at from into dst
                from=from+6;
                print(dst);
                System.out.println();
            }

            }

        public static void print(int [] dst)
        {
            for(int i=0;i<dst.length;i++)
                System.out.print(dst[i]+" ");
        }
</code>```

答: The way you've written it, on the last iteration of your loop from + 5 = 53 which is greater than 47 (therefore out of bounds of source). </p>

Body:
i have a problem with exception "java.lang.ArrayIndexOutOfBoundsException"
i wrote a program which have src array of 48 length then processes it to take each 6 indexes to another array using method arrayCopy and print each dst array
for me it works fine it prints each 6 indexes from the initial array but at the end i get an exception help please . the algorithm is just a test because i want to use the arrayCopy in another algorithm so i don't need suggestion to change the algorithm . i hope it is clear fair enough

  public static void main(String [] arg)
        {
            int[] src = new int[48];
            for(int j=0;j<src.length;j++)
            {
                src[j]=j+1;
                System.out.print(src[j]+" ");
            }
            System.out.println();
            int[] dst = new int[6];
            int from=0;
            for(int i=0;i<src.length;i++)
            {
                System.arraycopy(src, from, dst, 0, 6); // Copies 6 indexes from src starting at from into dst
                from=from+6;
                print(dst);
                System.out.println();
            }

            }

        public static void print(int [] dst)
        {
            for(int i=0;i<dst.length;i++)
                System.out.print(dst[i]+" ");
        }


问:
Type checking doesn't work with JSON.parse()?
couldn't find a proper explanation why type checking doesn't work with JSON.parse(), can someone shed some light on it? Example:

```<code>> let n: number = 1
undefined
> typeof n
'number'
> n = true
⨯ Unable to compile TypeScript: [eval].ts (1,1): Type 'true' is not assignable to type 'number'. (2322)
> typeof JSON.parse(JSON.stringify(true))
'boolean'
> n = JSON.parse(JSON.stringify(true))
true
> typeof n
'boolean'
</code>```

Thanks!

答:
Because if you see the type definition for JSON.parse, it returns any:

```<code>parse(text: string, reviver?: (key: any, value: any) => any): any;
</code>```

Which means that type checking will be disabled on the parsed output. You can learn more about the any type in the official documentation.

Body:
couldn't find a proper explanation why type checking doesn't work with JSON.parse(), can someone shed some light on it? Example:

> let n: number = 1
undefined
> typeof n
'number'
> n = true
⨯ Unable to compile TypeScript: [eval].ts (1,1): Type 'true' is not assignable to type 'number'. (2322)
> typeof JSON.parse(JSON.stringify(true))
'boolean'
> n = JSON.parse(JSON.stringify(true))
true
> typeof n
'boolean'

Thanks!

Body:
Because if you see the type definition for JSON.parse, it returns any:

parse(text: string, reviver?: (key: any, value: any) => any): any;

Which means that type checking will be disabled on the parsed output. You can learn more about the any type in the official documentation.


问:
MongoDB - Equivalent of LEFT JOIN where one collection isn't exists
Is there an equivalent to LEFT JOIN query where right collection isn't exists in MongoDB?

SQL:

```<code>SELECT * FROM TableA as A LEFT JOIN TableB as B ON A.id = B.id
WHERE B.Id IS NULL
</code>```

MongoDB: ???

P.S.: My initial sketch:

```<code>db.getCollection('collA').aggregate([
    {
      $lookup:
        {
          from: "collB",
          localField: "_id",
          foreignField: "_id",
          as: "collB"
        }
   }
   //, {$match : collB is empty}
])
</code>```

答:
Well your edit basically has the answer. Simply $match where the array is empty:

db.getCollection('collA').aggregate([
    { "$lookup": {
      "from": "collB",
      "localField": "_id",
      "foreignField": "_id",
      "as": "collB"
    }},
   { "$match": { "collB.0": { "$exists": false } } }
])
```

The $exists test on the array index of 0 is the most efficient way to ask in a query "is this an array with items in it".

Body:
Is there an equivalent to LEFT JOIN query where right collection isn't exists in MongoDB?

SQL:

SELECT * FROM TableA as A LEFT JOIN TableB as B ON A.id = B.id
WHERE B.Id IS NULL

MongoDB: ???

P.S.: My initial sketch:

db.getCollection('collA').aggregate([
    {
      $lookup:
        {
          from: "collB",
          localField: "_id",
          foreignField: "_id",
          as: "collB"
        }
   }
   //, {$match : collB is empty}
])

Body:
Well your edit basically has the answer. Simply $match where the array is empty:

db.getCollection('collA').aggregate([
    { "$lookup": {
      "from": "collB",
      "localField": "_id",
      "foreignField": "_id",
      "as": "collB"
    }},
   { "$match": { "collB.0": { "$exists": false } } }
])

The $exists test on the array index of 0 is the most efficient way to ask in a query "is this an array with items in it".


答:
I'd need to have a lot more data to be able to fully understand what's going on, but here's what I could gather from the limited data available:

```|Grp 1 |Grp 2 |Grp 3 |Grp 4 | Grp 5     | Padding?   |
|------|------|------|------|-----------|------------|
|00 fe |a6 11 |f5 0d |c7 19 |00 ff 01 09|00 00 00 00 | : 03.06.2017 - 07:44:06
|00 fe |68 40 |f4 0d |da 15 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 16:51:20
|00 fe |33 3d |f4 0d |c6 14 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 16:37:39
|00 fe |83 1d |f4 0d |ba 15 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 14:22:27
|00 fe |c2 19 |f4 0d |7d 16 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 14:06:26
|00 fe |f5 15 |f4 0d |b2 16 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 13:50:13
|00 fe |67 14 |f4 0d |e4 16 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 13:43:35
|00 fe |80 0f |f4 0d |6a 17 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 13:22:40```

Group 1: Year?

Group 2: Not sure. Might be tied into how the time is calculated.

Group 3: I'm fairly confident this is the day and month. It's packed pretty tightly, if my guess is correct.

Group 4: I have a hunch this is the hour/minutes/seconds. At the very least, this and Group 2 are linked together in some way.

Group 5: Unlikely related to timestamps.

Padding: I'm assuming this is just empty space that is never used.

The only way to truly be able to reverse the protocol would be to have lots of varying information. Dates with varying years/months/days and timestamps with similar hours but different minutes/seconds, etc.

Apologies if this doesn't help you much, either way good luck!

Title: reverse engineer hex values to time date format

Body:
I logged the Bluetooth transmission between two devices and I want to reverse engineer the protocol. I figured everything out but not the date time format.
I have the following known pairs of hex values and dates:

00:fe:a6:11:f5:0d:c7:19:00:ff:01:09:00:00:00:00  --> 03.06.2017 - 07:44:06
00:fe:68:40:f4:0d:da:15:00:ff:01:09:00:00:00:00  --> 02.06.2017 - 16:51:20
00:fe:33:3d:f4:0d:c6:14:00:ff:01:09:00:00:00:00  --> 02.06.2017 - 16:37:39
00:fe:83:1d:f4:0d:ba:15:00:ff:01:09:00:00:00:00  --> 02.06.2017 - 14:22:27
00:fe:c2:19:f4:0d:7d:16:00:ff:01:09:00:00:00:00  --> 02.06.2017 - 14:06:26
00:fe:f5:15:f4:0d:b2:16:00:ff:01:09:00:00:00:00  --> 02.06.2017 - 13:50:13
00:fe:67:14:f4:0d:e4:16:00:ff:01:09:00:00:00:00  --> 02.06.2017 - 13:43:35
00:fe:80:0f:f4:0d:6a:17:00:ff:01:09:00:00:00:00  --> 02.06.2017 - 13:22:40

How can I convert it from hex values to the date/time format? I already tried if they transmit the date/time in a unix time stamp format but it seems they are using something differently.

Does somebody see a solution?

Thanks

Body:
I'd need to have a lot more data to be able to fully understand what's going on, but here's what I could gather from the limited data available:

|Grp 1 |Grp 2 |Grp 3 |Grp 4 | Grp 5     | Padding?   |
|------|------|------|------|-----------|------------|
|00 fe |a6 11 |f5 0d |c7 19 |00 ff 01 09|00 00 00 00 | : 03.06.2017 - 07:44:06
|00 fe |68 40 |f4 0d |da 15 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 16:51:20
|00 fe |33 3d |f4 0d |c6 14 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 16:37:39
|00 fe |83 1d |f4 0d |ba 15 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 14:22:27
|00 fe |c2 19 |f4 0d |7d 16 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 14:06:26
|00 fe |f5 15 |f4 0d |b2 16 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 13:50:13
|00 fe |67 14 |f4 0d |e4 16 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 13:43:35
|00 fe |80 0f |f4 0d |6a 17 |00 ff 01 09|00 00 00 00 | : 02.06.2017 - 13:22:40

Group 1: Year?

Group 2: Not sure. Might be tied into how the time is calculated.

Group 3: I'm fairly confident this is the day and month. It's packed pretty tightly, if my guess is correct.

Group 4: I have a hunch this is the hour/minutes/seconds. At the very least, this and Group 2 are linked together in some way.

Group 5: Unlikely related to timestamps.

Padding: I'm assuming this is just empty space that is never used.

The only way to truly be able to reverse the protocol would be to have lots of varying information. Dates with varying years/months/days and timestamps with similar hours but different minutes/seconds, etc.

Apologies if this doesn't help you much, either way good luck!


问:
Select all those rows whose certain columns (and not all the columns) have specific values
I need to select all those rows whose certain columns (and not all the columns) have specific values.

For example:

```<code>SELECT * from TABLE1
WHERE col_A in (1,2)
   or col_B in (1,2)
   or col_C in (1,2)
</code>```

What is the best way to achieve it?

答:
What is the best way to achieve it?

The best way is to use the query you are already using:

```<code>SELECT *
from   TABLE1
WHERE  col_A in (1,2)
or     col_B in (1,2)
or     col_C in (1,2)
</code>```

Body:
I need to select all those rows whose certain columns (and not all the columns) have specific values.

For example:

SELECT * from TABLE1
WHERE col_A in (1,2)
   or col_B in (1,2)
   or col_C in (1,2)

What is the best way to achieve it?

Body:
What is the best way to achieve it?

The best way is to use the query you are already using:

SELECT *
from   TABLE1
WHERE  col_A in (1,2)
or     col_B in (1,2)
or     col_C in (1,2)


问:
Responsive menu not working on WordPress
As I converted my website to WordPress I realised that my responsive menu stopped working properly.
Instead of hiding the menu and revealing the burger button which should toggle the menu, the ul appears visible at all times and seems unaffected by any of the jquery code. Would anyone happen to have any idea as per how to correct that please?
Thank you all in advance for your attention.

HTML:

```<code><nav>
  <a href="#" id="burger_menu"><i class="fa fa-bars"></i></a>
  <?php
    wp_nav_menu(array(
      'theme_location'  => 'primary',
      'container'       => 'div'
    ));
  ?>
</nav>
</code>```

CSS:

```<code>header nav #burger_menu {
  padding-right: 20px;
  font-size: 40px;
  display: none;
  color: #fff;
}

header nav .menu ul {
  display: block;
  line-height: 0;
}

header nav .menu ul li {
  padding: 10px;
  display: inline-block !important;
  float: left;
}

@media screen and (max-width: 1023px) {
  /* NAV */
  header nav #burger_menu {
    display: inline-block;
  }

  header nav ul {
    background: rgba(98,194,210,0.85) !important;
    line-height: 10px !important;
  }

  header nav ul,
  nav:active ul {
    display: none !important;
    position: absolute;
    padding: 20px 40px;
    background: #62c2d2;
    right: 0;
    top: 80px;
    width: 30%;
  }
}
</code>```

jQuery:

```<code>//RESPONSIVE NAV
$('#burger_menu').on('click', function(e) {
  e.preventDefault();
  $('header ul').toggle();
  $('header ul').mouseleave(function() {
    $('header ul').css('display', 'none !important');
  });
});
</code>```

答:
You are binding click event twice in which first is for showing and second for hiding the menu, so when you click link it will just show then hide immediately so try to use toggle() like,

```<code>//RESPONSIVE MENU
$('#burger_menu').on('click', function(e) {
    e.preventDefault();
    $('header nav .menu ul').toggle();
}
</code>```

Body:
As I converted my website to WordPress I realised that my responsive menu stopped working properly.
Instead of hiding the menu and revealing the burger button which should toggle the menu, the ul appears visible at all times and seems unaffected by any of the jquery code. Would anyone happen to have any idea as per how to correct that please?
Thank you all in advance for your attention.

HTML:

  <?php
    wp_nav_menu(array(
      'theme_location'  => 'primary',
      'container'       => 'div'
    ));
  ?>

CSS:

header nav #burger_menu {
  padding-right: 20px;
  font-size: 40px;
  display: none;
  color: #fff;
}

header nav .menu ul {
  display: block;
  line-height: 0;
}

header nav .menu ul li {
  padding: 10px;
  display: inline-block !important;
  float: left;
}

@media screen and (max-width: 1023px) {
  /* NAV */
  header nav #burger_menu {
    display: inline-block;
  }

  header nav ul {
    background: rgba(98,194,210,0.85) !important;
    line-height: 10px !important;
  }

  header nav ul,
  nav:active ul {
    display: none !important;
    position: absolute;
    padding: 20px 40px;
    background: #62c2d2;
    right: 0;
    top: 80px;
    width: 30%;
  }
}

jQuery:

//RESPONSIVE NAV
$('#burger_menu').on('click', function(e) {
  e.preventDefault();
  $('header ul').toggle();
  $('header ul').mouseleave(function() {
    $('header ul').css('display', 'none !important');
  });
});

Body:
You are binding click event twice in which first is for showing and second for hiding the menu, so when you click link it will just show then hide immediately so try to use toggle() like,

//RESPONSIVE MENU
$('#burger_menu').on('click', function(e) {
    e.preventDefault();
    $('header nav .menu ul').toggle();
}


问:
Reading lists to a file (convert to int or float) in Python
How do I follow these instructions?

"4.4 Read the numbers in the file prices.txt into a number list.

Remember readline() reads a line from a file as a string. Make sure you do proper type conversion so the data are actually stored as numbers in the list. "

This is my code. (How do I change it to int or float?)

```<code>f = open ('prices.txt', 'r')
data = []
line = f.readline().strip()
data.append(line)
while line != "":
    line = f.readline().strip()
    data.append(line)
f.close()

print("File reading completed, data were read into a list")
print (data)
</code>```

答:
```<code>f = open ('prices.txt', 'r')
data = []
line = f.readline().strip()
values = line.split();
for value in values:
    data.append(float(value));
while line != "":
    line = f.readline().strip()
    values = line.split();
    for value in values:
        data.append(float(value));

f.close()

print("File reading completed, data were read into a list")
print (data)
</code>```

Body:
How do I follow these instructions?

"4.4 Read the numbers in the file prices.txt into a number list.

Remember readline() reads a line from a file as a string. Make sure you do proper type conversion so the data are actually stored as numbers in the list. "

This is my code. (How do I change it to int or float?)

f = open ('prices.txt', 'r')
data = []
line = f.readline().strip()
data.append(line)
while line != "":
    line = f.readline().strip()
    data.append(line)
f.close()

print("File reading completed, data were read into a list")
print (data)


问:
Which file do I add MVC relationship too in PHP
Hello I am following a tutorial on sitepoint about MVC (Model View Controller). However the instructions are not 100% clear in that tutorial, and the comment section has been closed.

On this tutorial https://www.sitepoint.com/the-mvc-pattern-and-php-1/ it says to setup relationships betwee model, view and contoller. It provides the code but does not state where this code should go or in what file it should go. First they tell us make model using code on tutorial, than make view file, than make controller file all codes for files they provided in tutorial. Then they say use following code to make relationships, but they do not state where to place this code.

```<code><?php
$model = new Model();
$controller = new Controller($model);
$view = new View($controller, $model);
echo $view->output();
</code>```

I would appreciate any assistance you can provide or advise me on as to where this particular code goes for setting up the relationships please.

I sincerely apologise if this is not the right place to ask. I seem to get banned from posting questions for a period of 3 days when I ask questions, and I am not sure as to why that reason could be.

So accept my apologise if this is another one of those posts.

Thanks in advance.

答:
In general, that code would go in your bootstrap file. Right after the setup of DIC and the execution or the router.

As for real-world code, the structure you see in that tutorial, it a very naive example. There wouldn't be a magical "model", that your views and controllers depend upon, but various services. And the choice of commands, that are executed on the chosen controller, would be governed by the routing result.

In practice, that code would look closer to:

```<code>// routing is used to get $command and $resource
// where $command = $request->getMethod() . $parameters['action'];

$controller = $container->get("controllers.$resource");
if (method_exists($controller, $command)) {
    $controller->{$command}($request);
}

$view = $container->get("views.$resource");
if (method_exists($view, $command)) {
    $response = $view->{$command}($request);
    $response->send();
}
</code>```

Body:
Hello I am following a tutorial on sitepoint about MVC (Model View Controller). However the instructions are not 100% clear in that tutorial, and the comment section has been closed.

On this tutorial https://www.sitepoint.com/the-mvc-pattern-and-php-1/ it says to setup relationships betwee model, view and contoller. It provides the code but does not state where this code should go or in what file it should go. First they tell us make model using code on tutorial, than make view file, than make controller file all codes for files they provided in tutorial. Then they say use following code to make relationships, but they do not state where to place this code.

<?php
$model = new Model();
$controller = new Controller($model);
$view = new View($controller, $model);
echo $view->output();

I would appreciate any assistance you can provide or advise me on as to where this particular code goes for setting up the relationships please.

I sincerely apologise if this is not the right place to ask. I seem to get banned from posting questions for a period of 3 days when I ask questions, and I am not sure as to why that reason could be.

So accept my apologise if this is another one of those posts.

Thanks in advance.

Body:
In general, that code would go in your bootstrap file. Right after the setup of DIC and the execution or the router.

As for real-world code, the structure you see in that tutorial, it a very naive example. There wouldn't be a magical "model", that your views and controllers depend upon, but various services. And the choice of commands, that are executed on the chosen controller, would be governed by the routing result.

In practice, that code would look closer to:

// routing is used to get $command and $resource
// where $command = $request->getMethod() . $parameters['action'];

$controller = $container->get("controllers.$resource");
if (method_exists($controller, $command)) {
    $controller->{$command}($request);
}

$view = $container->get("views.$resource");
if (method_exists($view, $command)) {
    $response = $view->{$command}($request);
    $response->send();
}


问:
How to do unit test for SPContext in Sharepoint using VS 2010
Here I am unit testing the share point code in visual studio 2010 but the thing is the code contains the SPContext for getting current url while testing we are passing static url so at that time when calling the method that using SPContext statement its throwing null reference exception. "So can any one give me solution for this issue....."

Thanks in advance.....


问:
Getting Access is denied exception when calling CompositionCapabilities.GetForCurrentView
I am getting the following exception when I call CompositionCapabilities.GetForCurrentView.

System.UnauthorizedAccessException: 'Access is denied. (Exception from
  HRESULT: 0x80070005 (E_ACCESSDENIED))'

```<code>public App()
{
    this.InitializeComponent();
    this.Suspending += OnSuspending;

    // Exception happens here.
    var capabilities = CompositionCapabilities.GetForCurrentView();
}
</code>```

The weird thing is the code compiles OK so I assume the API is available. Do I need to declare any capabilities in Package.appxmanifest?

答:
You don't need to declare anything. The method is simply called too early.

So instead of calling it in the constructor, call it right after the Window is created -

```<code>protected override void OnWindowCreated(WindowCreatedEventArgs args)
{
    if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4))
    {
        var capabilities = CompositionCapabilities.GetForCurrentView();
        var areEffectsSupported = capabilities.AreEffectsSupported();
        var areEffectsFast = capabilities.AreEffectsFast();
    }

    base.OnWindowCreated(args);
}
</code>```

Note you will want to add a check to see if that API is supported too, like in the code above.

Body:
I am getting the following exception when I call CompositionCapabilities.GetForCurrentView.

System.UnauthorizedAccessException: 'Access is denied. (Exception from
  HRESULT: 0x80070005 (E_ACCESSDENIED))'

public App()
{
    this.InitializeComponent();
    this.Suspending += OnSuspending;

    // Exception happens here.
    var capabilities = CompositionCapabilities.GetForCurrentView();
}

The weird thing is the code compiles OK so I assume the API is available. Do I need to declare any capabilities in Package.appxmanifest?

Body:
You don't need to declare anything. The method is simply called too early.

So instead of calling it in the constructor, call it right after the Window is created -

protected override void OnWindowCreated(WindowCreatedEventArgs args)
{
    if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4))
    {
        var capabilities = CompositionCapabilities.GetForCurrentView();
        var areEffectsSupported = capabilities.AreEffectsSupported();
        var areEffectsFast = capabilities.AreEffectsFast();
    }

    base.OnWindowCreated(args);
}

Note you will want to add a check to see if that API is supported too, like in the code above.


问:
Jump to next error FILE in Intellij
I am looking for any way to navigate between errors in IntelliJ.

I know how to jump INSIDE one file. And I found a bunch of macros, editor extensions, etc. plugins to extend the functionality, but there seem to be nothing to help me in these scenarios:

I remove method from baseclass.

I hit rebuild, so nice, now 20 files have errors as expected.

Now I have to manually click either on the red error in the make info to open the file, or on the file in the project tree (marked red) to open the error file. Once inside the file its easy, F2, some ALT+ENTER, fixed.

So any way to jump TO NEXT ERROR FILE.

Or any way to navigate between (not open) files by keyboard. E.g. Open next file in tree structure, etc..

答: If you switch to the Project Editor (Alt + 1) and then press F2 it jumps to the next file with an error.

Title: Jump to next error FILE in Intellij