text:
Q: Google map marking to fill address automatically using marker I want to mark my Address(Edit Text) with google map marking.
I have created a simple form but i want to mark it on map when i fill the address and drop a marker on the same place.
I am getting the latitude and longitude for address field then i would pin it using a marker but i have issues at the initial stage only(please consider me as a noob in android since i have started few days back)
SignUp Activity
    import android.app.ProgressDialog;
    import android.content.Intent;
    import android.content.pm.PackageManager;
    import android.os.AsyncTask;
    import android.os.Bundle;
    import android.support.v4.app.ActivityCompat;
    import android.support.v4.app.FragmentActivity;
    import android.util.Log;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.SeekBar;
    import android.widget.SeekBar.OnSeekBarChangeListener;
    import android.widget.TextView;
    import android.widget.Toast;

    import com.google.android.gms.maps.GoogleMap;
    import com.google.android.gms.maps.GoogleMap.OnInfoWindowClickListener;
    import com.google.android.gms.maps.GoogleMap.OnInfoWindowCloseListener;
    import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener;
    import com.google.android.gms.maps.GoogleMap.OnMarkerDragListener;
    import com.google.android.gms.maps.MapFragment;
    import com.google.android.gms.maps.OnMapReadyCallback;
    import com.google.android.gms.maps.model.LatLng;
    import com.google.android.gms.maps.model.Marker;
    import com.google.android.gms.maps.model.MarkerOptions;

    import org.apache.http.HttpEntity;
    import org.apache.http.HttpResponse;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.methods.HttpGet;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.json.JSONArray;
    import org.json.JSONException;
    import org.json.JSONObject;

    import java.io.IOException;
    import java.io.InputStream;

    import butterknife.Bind;
    import butterknife.ButterKnife;

    public class SignupActivity extends FragmentActivity implements OnMarkerClickListener, OnMarkerDragListener, OnInfoWindowClickListener, OnMapReadyCallback, OnInfoWindowCloseListener, GoogleMap.OnInfoWindowLongClickListener, OnSeekBarChangeListener {

        private static final String TAG = "SignupActivity";
        private GoogleMap googleMap;
        private static LatLng goodLatLng = new LatLng(37, -120);
        LatLng addressPos;
        Marker addressMarker;

        @Bind(R.id.input_name)
        EditText _nameText;
        @Bind(R.id.input_address)
        EditText _addressText;
        @Bind(R.id.input_email)
        EditText _emailText;
        @Bind(R.id.input_mobile)
        EditText _mobileText;
        @Bind(R.id.input_password)
        EditText _passwordText;
        @Bind(R.id.input_reEnterPassword)
        EditText _reEnterPasswordText;
        @Bind(R.id.btn_signup)
        Button _signupButton;
        @Bind(R.id.link_login)
        TextView _loginLink;

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_signup);
            ButterKnife.bind(this);

            String address = _addressText.getText().toString();

            // Initial Map
            try {

                if (googleMap == null) {
                    MapFragment mapFragment = (MapFragment) getFragmentManager()
                            .findFragmentById(R.id.map);
                    mapFragment.getMapAsync(this);

                }
            } catch (Exception e) {
                e.printStackTrace();
            }

            _signupButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    signup();
                }
            });

            _loginLink.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    // Finish the registration screen and return to the Login activity
                    Intent intent = new Intent(getApplicationContext(),LoginActivity.class);
                    startActivity(intent);
                    finish();
                    overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
                }
            });
        }

        public void signup() {
            Log.d(TAG, "Signup");

            if (!validate()) {
                onSignupFailed();
                return;
            }

            _signupButton.setEnabled(false);

            final ProgressDialog progressDialog = new ProgressDialog(SignupActivity.this,
                    R.style.AppTheme_Dark_Dialog);
            progressDialog.setIndeterminate(true);
            progressDialog.setMessage("Creating Account...");
            progressDialog.show();

            String name = _nameText.getText().toString();
            String address = _addressText.getText().toString();
            String email = _emailText.getText().toString();
            String mobile = _mobileText.getText().toString();
            String password = _passwordText.getText().toString();
            String reEnterPassword = _reEnterPasswordText.getText().toString();

            // TODO: Implement your own signup logic here.

            new android.os.Handler().postDelayed(
                    new Runnable() {
                        public void run() {
                            // On complete call either onSignupSuccess or onSignupFailed
                            // depending on success
                            onSignupSuccess();
                            // onSignupFailed();
                            progressDialog.dismiss();
                        }
                    }, 3000);
        }

        public void onSignupSuccess() {
            _signupButton.setEnabled(true);
            setResult(RESULT_OK, null);
            finish();
        }

        public void onSignupFailed() {
            Toast.makeText(getBaseContext(), "Login failed", Toast.LENGTH_LONG).show();

            _signupButton.setEnabled(true);
        }

        public boolean validate() {
            boolean valid = true;

            String name = _nameText.getText().toString();
            String address = _addressText.getText().toString();
            String email = _emailText.getText().toString();
            String mobile = _mobileText.getText().toString();
            String password = _passwordText.getText().toString();
            String reEnterPassword = _reEnterPasswordText.getText().toString();

            if (name.isEmpty() || name.length() < 3) {
                _nameText.setError("at least 3 characters");
                valid = false;
            } else {
                _nameText.setError(null);
            }

            if (address.isEmpty()) {
                _addressText.setError("Enter Valid Address");
                valid = false;
            } else {
                _addressText.setError(null);
            }

            if (email.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
                _emailText.setError("enter a valid email address");
                valid = false;
            } else {
                _emailText.setError(null);
            }

            if (mobile.isEmpty() || mobile.length()!=10) {
                _mobileText.setError("Enter Valid Mobile Number");
                valid = false;
            } else {
                _mobileText.setError(null);
            }

            if (password.isEmpty() || password.length() < 4 || password.length() > 10) {
                _passwordText.setError("between 4 and 10 alphanumeric characters");
                valid = false;
            } else {
                _passwordText.setError(null);
            }

            if (reEnterPassword.isEmpty() || reEnterPassword.length() < 4 || reEnterPassword.length() > 10 || !(reEnterPassword.equals(password))) {
                _reEnterPasswordText.setError("Password Do not match");
                valid = false;
            } else {
                _reEnterPasswordText.setError(null);
            }

            return valid;
        }

        @Override
        public boolean onMarkerClick(Marker marker) {
            return false;
        }

        @Override
        public void onMarkerDragStart(Marker marker) {
        }

        @Override
        public void onMarkerDrag(Marker marker) {
        }

        @Override
        public void onMarkerDragEnd(Marker marker) {
        }

        @Override
        public void onInfoWindowClick(Marker marker) {
        }

        @Override
        public void onMapReady(GoogleMap Map) {
            googleMap=Map;
            googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
            // Put a dot on my current location
            if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                // TODO: Consider calling
                //    ActivityCompat#requestPermissions
                // here to request the missing permissions, and then overriding
                //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
                //                                          int[] grantResults)
                // to handle the case where the user grants the permission. See the documentation
                // for ActivityCompat#requestPermissions for more details.
                return;
            }
            googleMap.setMyLocationEnabled(true);
            googleMap.setIndoorEnabled(true);
            googleMap.setTrafficEnabled(true);
            // 3D building
            googleMap.setBuildingsEnabled(true);
            // Get zoom button
            googleMap.getUiSettings().setZoomControlsEnabled(true);

            Marker marker = googleMap.addMarker(new MarkerOptions()
                    .position(goodLatLng)
                    .title("Address"));
        }

        public void showAddressMarker(View view) {

            String newAddress = _addressText.getText().toString();

            if (newAddress != null) {
                new PlaceAMarker().execute(newAddress);
            }
        }
        class PlaceAMarker extends AsyncTask<String, String, String> {

            @Override
            protected String doInBackground(String... params) {
                String startAddress = params[0];
                startAddress = startAddress.replaceAll(" ", "%20");

                getLatLng(startAddress, false);

                return null;
            }
            @Override
            protected void onPostExecute(String s) {
                super.onPostExecute(s);

                addressMarker = googleMap.addMarker(new MarkerOptions()
                        .position(addressPos).title("Address"));
            }
        }
        protected void getLatLng(String address, boolean setDestination) {
            String uri = "http://maps.google.com/maps/api/geocode/json?address="
                    + address + "&sensor=false";

            HttpGet httpGet = new HttpGet(uri);

            HttpClient client = new DefaultHttpClient();
            HttpResponse response;
            StringBuilder stringBuilder = new StringBuilder();

            try {
                response = client.execute(httpGet);
                HttpEntity entity = response.getEntity();

                InputStream stream = entity.getContent();

                int byteData;
                while ((byteData = stream.read()) != -1) {
                    stringBuilder.append((char) byteData);
                }

            } catch (IOException e) {
                e.printStackTrace();
            }
            double lat = 0.0, lng = 0.0;

            JSONObject jsonObject;
            try {
                jsonObject = new JSONObject(stringBuilder.toString());
                lng = ((JSONArray) jsonObject.get("results")).getJSONObject(0)
                        .getJSONObject("geometry").getJSONObject("location")
                        .getDouble("lng");
                lat = ((JSONArray) jsonObject.get("results")).getJSONObject(0)
                        .getJSONObject("geometry").getJSONObject("location")
                        .getDouble("lat");

            } catch (JSONException e) {
                e.printStackTrace();
            }
               addressPos = new LatLng(lat, lng);
        }

        @Override
        public void onInfoWindowClose(Marker marker) {
        }

        @Override
        public void onInfoWindowLongClick(Marker marker) {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    }

Main Activity file
    import android.content.Intent;
    import android.os.Bundle;
    import android.support.v7.app.ActionBarActivity;
    import android.view.Menu;
    import android.view.MenuItem;

    import com.google.android.gms.maps.GoogleMap;

    public class MainActivity extends ActionBarActivity {
        private GoogleMap googleMap;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            Intent intent = new Intent(this, LoginActivity.class);
            startActivity(intent);
        }

        @Override
        protected void onResume() {
            super.onResume();
        }

        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.menu_main, menu);
            return true;
        }

        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            // Handle action bar item clicks here. The action bar will
            // automatically handle clicks on the Home/Up button, so long
            // as you specify a parent activity in AndroidManifest.xml.
            int id = item.getItemId();

            //noinspection SimplifiableIfStatement
            if (id == R.id.action_settings) {
                return true;
            }

            return super.onOptionsItemSelected(item);
        }
    }

signup xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fitsSystemWindows="true">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="56dp"
        android:paddingLeft="24dp"
        android:paddingRight="24dp">

        <ImageView android:src="@drawable/logo"
            android:layout_width="wrap_content"
            android:layout_height="72dp"
            android:layout_marginBottom="24dp"
            android:layout_gravity="center_horizontal" />

        <!-- Name Label -->
        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp">
            <EditText android:id="@+id/input_name"
                style="@style/TextLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPersonName"
                android:hint="Name" />
        </android.support.design.widget.TextInputLayout>

        <!-- Address Label -->
        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp">
            <fragment
                android:layout_width="match_parent"
                android:layout_height="400dp"
                android:id="@+id/map"
                android:name="com.google.android.gms.maps.MapFragment" />
            <EditText android:id="@+id/input_address"
                style="@style/TextLabel"
                android:layout_marginTop="23dp"
                android:layout_marginRight="10dp"
                android:layout_marginLeft="10dp"
                android:ems="10"
                android:layout_below="@+id/map"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPostalAddress"
                android:hint="Address" />

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

        <!--  Email Label -->
        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp">
            <EditText android:id="@+id/input_email"
                style="@style/TextLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textEmailAddress"
                android:hint="Email" />
        </android.support.design.widget.TextInputLayout>

        <!-- mobile number -->
        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp">
            <EditText android:id="@+id/input_mobile"
                style="@style/TextLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="number"
                android:hint="Mobile Number" />
        </android.support.design.widget.TextInputLayout>

        <!-- Password Label -->
        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp">
            <EditText android:id="@+id/input_password"
                style="@style/TextLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:hint="Password"/>
        </android.support.design.widget.TextInputLayout>

        <!-- Password Re-enter Label -->
        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp">
            <EditText android:id="@+id/input_reEnterPassword"
                style="@style/TextLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:hint="Re-enter Password"/>
        </android.support.design.widget.TextInputLayout>

        <!-- Signup Button -->
        <android.support.v7.widget.AppCompatButton
            android:id="@+id/btn_signup"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="24dp"
            android:layout_marginBottom="24dp"
            android:padding="12dp"
            android:text="Create Account"/>

        <TextView android:id="@+id/link_login"
            style="@style/TextView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="24dp"
            android:text="Already a member? Login"
            android:gravity="center"
            android:textSize="16dip"/>

    </LinearLayout>
</ScrollView>

This is the error which i get at runtime nad please specify the thing clearly since i am new to android and keen to learn fast.
Error Log
AndroidRuntime: FATAL EXCEPTION: main Process: package, PID: 6547 java.lang.RuntimeException: Unable to start activity ComponentInfo{package.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class fragment at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2455) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519) at android.app.ActivityThread.access$800(ActivityThread.java:162) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:189) at android.app.ActivityThread.main(ActivityThread.java:5532) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745) Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class fragment and so on.


text:
Q: 'No' string rendered as numero sign (No.) in react-native-svg Text element with a specific font (RyoGothicPlusN) on ios The string 'No' renders as the numero sign № with the font RyoGothicPlusN-Regular on ios only. If I don't pass the font or pass something else f.e. Times New Roman, the string renders as expected.
import { Text } from 'react-native-svg';

<Text x="0" y="10" dx="10" fontSize={14} fontFamily="RyoGothicPlusN-Regular">No</Text>

Updating the package to the latest did not resolve.
Any ideas that could unblock me?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Export SQL Data to Excel Dropdown Is it possible to export records from SQL directly to a drop down data validation list?
I want to export data directly to the list without having to actually have the data saved within a sheet/table etc.

A: Step 1: Add a query data connection
If you do not have an existing query data connection that you can use on your form template, follow these steps to add a secondary data connection to your form template that queries data. If your form template already has a secondary data connection that you can use, you can skip this section and go to Step 2: Configure the control.
On the Tools menu, click Data Connections.
In the Data Connections dialog box, click Add.
In the Data Connection Wizard, click Create a new connection to, click Receive data, and then click Next.
On the next page of the wizard, click Database (Microsoft SQL Server or Microsoft Office Access only), and then click Next.
On the next page of the wizard, click Select Database.
In the Select Data Source dialog box, click New Source.
On the next page of the wizard, in the What kind of data source do you want to connect to list, click Microsoft SQL Server and then click Next.
In the Server name box, type the name of the server that contains the SQL Server database.
Under Log on credentials, do one of the following:
If the database determines who has access based on the credentials used in a Microsoft Windows network, click Use Windows Authentication.
If the database determines who has access based on a specified user name and password that you get from the database administrator, click Use the following User Name and Password, and then type your user name and password in the User Name and Password boxes.
Click Next.
In the Select the database that contains the data you want list, click the name of the database that you want to use, click Connect to a specific table, click the name of the primary table, and then click Next.
On the next page of the wizard, in the File Name box, type a name for the file that stores the data connection information, and then click Finish to save these settings.
If you plan to use other tables in the query data connection, you can add the other tables in this page of the wizard.
Add other tables
Click Add Table.
In the Add Table or Query dialog box, click the name of the child table, and then click Next. InfoPath attempts to set the relationships by matching field names in both tables. If you do not want to use the suggested relationship, select the relationship, and then click Remove Relationship. To add a relationship, click Add Relationship. In the Add Relationship dialog box, click the name of each related field in the respective column, and then click OK.
Click Finish.
To add additional child tables, repeat these steps.
Click Next.
To store the results of the query with the form template, select the Store a copy of the data in the form template check box. Selecting this check box stores the query results in the form template. Becuase the data is stored in the form template. the data is available in the forms that users fill out, even if their computers are not connected to a network.
Security Note: Selecting this check box stores the query results in the form template. Because the data is stored in the form template, it is available in the forms that users fill out, even if their computers are not connected to a network. If you are getting sensitive data from this data connection, you may want to disable this feature to help protect the data in case the computer is lost or stolen.
Click Next.
On the next page of the wizard, type a descriptive name for this secondary data connection. If you want the form to automatically receive data when the form is opened, select the Automatically retrieve data when form is opened check box.
Step 2: Configure the control
If the form template has multiple views, click View name on the View menu to go to the view with the control where you want to display the data from the secondary data source.
Double-click the list box, drop-down list box, or combo box control that you want to populate.
Click the Data tab.
Under List box entries, click Look up values from an external data source.
In the Data Source list, click the data source that you want to use.
Click Select XPath  Data Source button next to the Entries box.
In the Select a Field or Group dialog box, specify what data will be shown to the user and what data will be submitted to the external data source by doing one of the following.
Specify that the data the user will see is the same data the user will submit
Click a field, and then click OK.
Specify that the data the user will see is different from the data that the user will submit
Note: In this scenario, the data that the user will see is from one of the fields in the group, and the data that the user will submit is in another field in the same group.
Click a group, and then click OK.
In the Control Properties dialog box, click Select XPath  Data Source button next to the Value box.
In the Select a Field or Group dialog box, click a field that contains the data that the user will submit to the external data source, and then click OK.
In the Control Properties dialog box, click Select XPath  Data Source button next to the Display name box.
In the Select a Field or Group dialog box, click a field that contains the data that will appear in the control, and then click OK.
If the field in the Display name box has values with similar display names, and you want to display only unique names, select the Show only entries with unique display names check box.


text:
Q: How to crop image in HTML 5? I am working on a responsive site in which background is a large image as seen in the first image.
If I reduce the width of the browser automatically left and right edges should get trimmed like as shown in the second image. Center is focused.
How to do this?

A: @AngelGuy ,
use the following css :
background-image:url('bigImg.jpg');
background-size:cover;
background-repeat:no-repeat;

For a particular screen size with fixed height, resizing the width of the browser will not resize the image, the edges of the image will be trimmer.


text:
Q: How did spark RDD map to Cassandra table? I am new to Spark, and recently I saw a code is saving data in RDD format to Cassandra table. But I am not able to figure it out how it is doing the column mapping. It neither uses case class, also specifies any column names in the code like below:
rdd
.map(x => (x._1, x._2, x_3)) // x is a List here
.repartitionByCassandraReplica(keyspace, tableName)
.saveToCassandra(keyspace, tableName)

Since x inside is simply a List[(Int, String, Int)], which is not a case class, there is no name mapping to Cassandra table. So is there any definite order in Cassandra table that can match the order of columns we specify in the code?

A: This mapping relies on the order of columns in the Cassandra table definition that is as following:

*

*Partition key columns in the specified order

*Clustering columns in the specified order

*Alphabetically sorted by name for rest of the columns

Spark Cassandra Connector relies that these columns from table definition will be matched to the order of fields in the Scala tuple. You can see that in the source code of TupleColumnMapper class.


text:
Q: full calendar - associate clickable icons with events? I want to append 4 icons each event on the calendar. Each icon should calls different function on click event. To be honest, I am not too good in CSS. I have tried the below code but the click event for these icon is not invoked. Instead events event is invoked. Is there anyway to append 4 icons with clickable event? Thank you in advance
eventRender: function(event,element,calEvent) {
    element.find(".fc-event-title").after($("").html(""));
}

A: I think you need to use the .on() function to register an event handler to your icons.
Check this fiddle: http://jsfiddle.net/100thGear/rpc23/
The click events get triggered and are handled appropriately with the .on() handler. Let me know if this helps!


text:
Q: Polymer JS allowing one variable to be incorrect ("0") I am writing a code in polymer js and i need help with one thing.
i am using grep to find lets say kit of elements , that few elements should be equal to elements that i am searching for.
for example i have a table that looks like this:
ID     NAME     SECOND     THIRD     FOURTH
1      5        4          6         0
2      1        2          6         9
3      5        4          0         1

and search elements are NAME=5 SECOND=4 THIRD=6 FOURTH=1
so in this case grep should search for exact match, if there is no match then grep should search a match allowing one search element to be 0, so it should search with these elements:
NAME=0 SECOND=4 THIRD=6 FOURTH=1
NAME=5 SECOND=0 THIRD=6 FOURTH=1
NAME=5 SECOND=4 THIRD=0 FOURTH=1
NAME=5 SECOND=4 THIRD=6 FOURTH=0

as a result grep should catch element kits with id 1 and 3.
So the big questiong is: how to allow each element in grep to be 0, and for example if there are no results with one variable equal to 0 , then it should allow to make two variables equal to 0.
Really sorry for my bad interpretation, i would be really gratefull if anyone would help me. if you have any questions how i can ease understanding of the task, just write a comment. Thank you.
var NAME = 5;
var SECOND = 4;
var THIRD = 6;
var FOURTH = 1;

found_kits = $.grep(this.kit, function(e) {
   return e.NAME == NAME && el.SECOND == SECOND && el.THIRD == THIRD && el.FOURTH == FOURTH;
});


text:
Q: How to build JDK 8 from sources repository Can anybody take me a good tutorial how to build/compile OpenJDK8u(Linux) from the sources.
All I known is this link http://hg.openjdk.java.net/jdk8u
But I don't understand which directory I should I use and etc...
Thanks.

A: I found this README in the Repository. It has pretty short build Instructions. I hope this helps


text:
Q: structure members and pointer alignment Is a pointer to the struct aligned as if it were a pointer to the first element?
or
Is a conversion between a pointer to a struct and a pointer to the type of its first member (or visa versa) ever UB?
(I hope they are the same question...)
struct element
{
    tdefa x;
    tdefb y;
};

int foo(struct element* e);
int bar(tdefa* a);

~~~~~
tdefa i = 0;
foo((struct element*)&i);

or
struct element e;
bar((tdefa*)&e);

Where tdefa and tdefb could be defined as any type
Background:
I asked this question
and a user in a comment on one of the answers brought up C11 6.3.2.3 p7 that states:

"A pointer to an object type may be converted to a pointer to a
  different object type. If the resulting pointer is not correctly
  aligned for the referenced type, the behavior is undefined"

However I am having trouble working out when this would become an issue, my understanding was that padding would allow all members of the struct to be aligned correctly. Have I misunderstood?
and if:
struct element e;
tdefa* a = &e.x;

would work then:
tdefa* a = (tdefa*)&e;

would too.

A: There is never any initial padding; the first member of a struct is required to start at the same address as the struct itself.
You can always access the first member of a struct by casting a pointer to the whole struct, to be a pointer to the type of the first member.
Your foo example might run into trouble because foo will be expecting its argument to point to a struct element which in fact it does not, and there might be an alignment mismatch.
However the bar example and the final example is fine.

A: A pointer to a structure always points to its initial member.
Here is the citation directly from C99 standard (6.7.2.1, paragraph 13), emphasis mine:

Within a structure object, the non-bit-field members and the units in which bit-fields reside have addresses that increase in the order in which they are declared. A pointer to a structure object, suitably converted, points to its initial member (or if that member is a bit-field, then to the unit in which it resides), and vice versa. There may be unnamed padding within a structure object, but not at its beginning

As for your foo and bar examples:
The call to bar will be fine, as bar expects a tdefa, which is exactly what it's getting.
The call to foo, however, is problematic. foo expects a full struct element, but you're only passing a tdefa (while the struct consists of both tdefa and tdefb).


text:
Q: Find a maximum of a list without constructing the list I've been playing around with Python for making one-line solutions for some competition problems, and I've run into the following issue. My solution can be written as max([f(k) for k in range(n)]) (where f(k) is some simple expression), which looks great, but when n is large it ends up constructing a list before finding its maximum, which exceeds the memory limit. Is there a way to find the maximum without actually constructing the list, while still keeping it down to one line? I know the following works, but if I wanted that I'd just use a different language:
best = f(0)
for k in range(n):
  best = max(best, f(k))
return best

A: max() takes a generator also:
max(f(k) for k in range(n))

This saves you from having to build the entire list.
Thanks to @DanielRoseman for pointing out that in Python 2.x you should be using xrange() instead of range(). Recall that range() returns a list in Python 2.x, whereas xrange() returns an xrange object (a constant-memory iterable).


text:
Q: C# Static Classes - A static class cannot have non-static members I'm trying to understand the c# language and why you require the static keyword on all members within the static class. Yes, I understand a static class cannot be instantiated, but why aren't members by default static within a static class, as we know that a static class cannot have non-static members?
For Example:
Why can't this
public static class StaticClass
{
    public static int numberTest = 2;
}

be:
public static class StaticClass2
{
    public int numberTest = 2;
}

A: It is a design decission by the language designers. Of course a static class can have static members only, so the static qualifier is redundant. But it makes things clearer and less error-prone if you are forced to put it there. This becomes more and more important when your classes and projects get larger.

A: Most likely for historic reasons. You are right that an automatic, implied static would be more in line with other parts of the language.
But static classes were new in C# 2.0, and the change had to be non-breaking.


text:
Q: ajc on Maven command line, but not in Eclipse in order to keep Lombok working After successfully following this HowTo to integrate Lombok and AspectJ in a Maven build, my code doesn't compile anymore in eclipse.
There are a lot of errors everywhere due to absence of getter/setter/constructors normally generated by Lombok.
My goal is to be able to use eclipse to develop using Lombok, and after that using a mvn clean install on command line in order to build.
I tried to skip AspectJ weaving in eclipse, but without success.
Here is the profile I used to skip AspectJ:
<profile>
        <id>noAspectJ</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>aspectj-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>process-classes</id>
                            <phase>none</phase>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <compilerVersion>1.7</compilerVersion>
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

A: The best solution I found was to remove the AspectJ plugin from my Eclipse, since it don't need it there.
This way I could also avoid using a profile.
But this could probably lead to some problem if I used the JUnit tests in eclipse.


text:
Q: Search for Custom Field with Custom Post Types There are tutorials that explain how to limit a search to a specific category.
My question is, is there a way to configure wordpress' search to, within a custom post type, search for a custom field value.
So for example, if I search for "hello", the results would come up with posts that have a certain custom field equal to "hello". The certain post would also be a certain custom post type.
Any help is appreciated.

A: To filter search by custom post type use:
<?php query_posts($query_string . '&post_type=custom-post-type-name' ); ?>

before the loop.. then within the loop add a condition similar to this
<?php if ($meta_data[ 'meta-name' ] == 'hello') {
    //do something
} ?>

A: I think here is what you are looking for:
key is the custom field.
value is the value you are looking for
and compare is the operator you want to use.
you can also use LIKE if you want.
// WP_Query arguments
$args = array (
    'post_type'              => 'vendors',
    'post_status'            => 'published',
    'meta_query'             => array(
        array(
            'key'       => 'state',
            'value'     => 'Misissipi',
            'compare'   => '=',
        ),
    ),
);

// The Query
$query = new WP_Query( $args );

// The Loop
if ( $query->have_posts() ) {
    while ( $query->have_posts() ) {
        $query->the_post();
        // do something
    }
} else {
    // no posts found
}

// Restore original Post Data
wp_reset_postdata();


text:
Q: Purpose of gwt browser plug-in What is purpouse of GWT browser plug-in? Please help me to understand. And why browser can receive java object from server? Gwt tecnology must work without plugins.

A: GWT browser plugin helps the browser to recognize URL like *?gwt.codesvr=127.0.0.1:9997.
Then, when you do an action on a GWT component on a page which has this URL pattern,  the plugin will tell the browser that it must not try to execute some javascript code but forward the event to the code server (that you must have previously started) which will in turn compile the code on the fly and execute it.
The idea is that if you change a small piece of code, you can just reload the web page without having to recompile the whole project : your changes will be recompiled on the fly.
Here is a link to the relevant part of the official documentation.

A: GWT browser plugin is only for development mode to allow JAVA/GWT Developers to debug code.
Once GWT code is compiled in javascript and deployed into production webserver the browser plugin is not required. So users of your gwt website need not install any gwt plugin in their browser.
Dev Mode -http://www.gwtproject.org/doc/latest/DevGuideCompilingAndDebugging.html#DevGuideDevMode
Production Mode - http://www.gwtproject.org/doc/latest/DevGuideDeploying.html


text:
Q: how can I import images from facebook account to my iphone app? I have to take images from facebook account to my iphone, so what should I do to achieve such concept?

A: Try looking deeper through http://developers.facebook.com/docs/api may be it will give you the solution of your requirement.
In order to get the users profile pic...
http://graph.facebook.com/000000000/picture
Where 000000000 is an id of user logged.


text:
Q: How to solve the Laplace Equation in the hollow square region? Suppose the values of $a$, $b$, $V_1$ and $V_2$ is given. I want to find the solution of the Laplace equation,
$$\frac{\partial^2 \phi}{\partial x^2}+\frac{\partial^2 \phi}{\partial y^2}=0$$
in the orange region of the figure (with the boundary conditions given in the figure).
Can we use the separation of variable method for solving this problem? I have tried to find the solution by separation of variables, but it seems the the boundary conditions can not be satisfied. Do you have any idea for solving this problem, theoretically?

A: If we ignore the inner section, we have a box with 3 sides held at V = 0 and the top edge at V = V1. I'm pretty sure this is easily solvable by separation of variables using an oscillatory solution in x with a decaying solution along y. Using superposition we can then treat the inner box as a separate problem of similar geometry/boundary conditions. The exact solution would be a bit tedious with the origin being held at a corner of the larger box but I don't see how it's not solvable in principle.

A: OK, I will try to say something a bit more useful than my other response. I am still on the skeptical side of getting a closed-form, simple solution to this problem, specially using separation of variables. I think that the problem is that the potential outside of a square with that border conditions cannot be attacked using separation of variables. My reasoning is that, whatever the solution, very far from the square it should behave as $$\ln \frac{1}{\sqrt{x^2+y^2}},$$ and it is not hard to prove that this is inconsistent with a potential expressible as the product of a function depending on $x$ and a function depending on $y$. Since the potential inside a square can be solved by separation of variables, if the problem of this question could be solved by separation, then by superposition we could solve the problem of the external field to a square by separation of variables. Therefore, the original problem cannot be solve by separation of variables.


text:
Q: Laravel search by date plus time from releated table I have table order related to warehouse with related to warehouse_delivery.
With following structure:
+--------------------------------------+    +-----------+
|                Order                 |    | Warehouse |
+----+--------------+------+-----------+    +----+------+
| id | warehouse_id | cost | send_date |    | id | name |
+----+--------------+------+-----------+    +----+------+

+--------------------------------------------------------------------------+
|                            WarehouseDelivery                             |
+----+--------------+------------------------+-----------------------------+
| id | warehouse_id | domestic_delivery_time | international_delivery_time |
+----+--------------+------------------------+-----------------------------+

Delivery time is stored as days.
And now I would like to search by send_date to find Orders where send_date + domestic_delivery_time is today.
I don't have a idea how can I grab that domestic_delivery_time added to send_date.
Order::where('warehouse_id', $warehouseId)
->with(['product', 'warehouse.warehouseDelivery'])
->get();

How to write query?
Thank you.

A: I'm not sure there's a database-agnostic solution for this.
You'd need to use DB::raw. Here's a solution using a scope that covers MySQL, SQL Server and PostgreSQL:
// On Owner.php
public function scopeDueToday($query) {
    $today = \Carbon\Carbon::now()->format('Y-m-d');
    $driver = $query->getConnection()->getDriverName();

    return $query->whereHas('warehouse.warehouseDelivery', function ($deliveries) use ($today, $driver) {

        $raw = [
            'mysql' => "CAST(start_date + INTERVAL domestic_delivery_time days AS date)",
            'pgsql' => "(start_date + (domestic_delivery_time || ' day')::interval)::date",
            'sqlsrv' => "CONVERT(date, DATEADD(day, domestic_delivery_time, start_date))",
        ];

        return $deliveries->where(\DB::raw($raw[$driver]), '=', $today);
    });
}

// On your controller
Order::dueToday()->where('warehouse_id', $warehouseId)
        ->with(['product', 'warehouse.warehouseDelivery'])->get();


text:
Q: Is there a way to substitute recursively and automatically in sympy? I am coming from Mathematica, where you can do the following to fully substitute:
In[1]:=

x=y
y=z
Simplify[x]

Out[1]=

z

Is there a way of doing this automatically in SymPy? I am aware that I can manually substitute the variables 1 by 1 using subs or solve, or by doing something janky like this:
In[1]:

y=z
x=y
x

Out[1]:

z

but is there a way of making it automatically get the most expanded and substituted expression solving for 1 variable?

A: There is a proof of concept code here that handles multiple equations.
from sympy.abc import x, y, z
eqs = [Eq(x,y),Eq(y,z)]
focus(eqs, z)  # function defined in link
{z: x}


text:
Q: Artifacts in NetCDFs served to Leaflet from Geoserver over WMS when zooming I'm serving a set of NetCDF layers to a Leaflet map over WMS. The netCDFs are native EPSG:4326, and Leaflet requests them in EPSG:3857. They look great zoomed out:

But if I zoom in, I start seeing artifacts and gaps in the tiles that move as I continue to zoom in:

EDIT: some more details on the artifacts. When they start appearing at zoom 4, they occur in the 'left-most tiles' (whichever ones have a lower-left X value of about -20 000 km) and in the tiles directly to the left of X = 0 (but in the top-left this time). For example, this is over Scotland:

The width has been variable with zoom, but they generally get taller until there's just a continuous strip at higher zooms.
This image suggests that there's some problems going across the entire X < 0 space even though artifacts are only visible on the left-most tile (aligned with its right edge) and the right-most tile (aligned with its left edge):

I note that the gaps between tiles appear transparent, just as my regions with no data (NaN) do. In other regions, I can see the tile boundaries shifting on both sides (so no gap appears) when I zoom in.
The artifacts appear in regions that otherwise wouldn't have any data, and they appear as whatever the lowest-valued colour in my style is, regardless of the style I use.
This behaviour appears in all of the NetCDFs I've tested (a set of about 30 files), which are all produced through the same process. However, if I use the style preview when editing a style (which looks like a different projection to my eye), I don't see any artifacts:

This makes me wonder if some sort of error is occurring in the projection to EPSG:3857, either on Geoserver's part or on Leaflet's in requesting the tiles.
I note that the artifacts also appear in the requested tiles when checking the individual requests; this isn't a problem with their rendering in the browser. I've tested this both on a local installation of Geoserver 2.12.1 on macOS and on a Tomcat 7 installation of Geoserver 2.12.2 on CentOS.
EDIT: forcing Geoserver to serve EPSG:4326 by including srs: 'EPSG4326' in my layer request also seems to fix this (which could work for me, especially as GBIF hosts basemaps in EPSG:4326):


text:
Q: AutoNumeric Multiple - Append Rows With TextBox On Click Add Button I'm having an issue with http://autonumeric.org/  plugin.
When click on add button, it will append a row with some input fields. those fields are integer and decimal fields.
once row has appended it then it will initialize autonumeric with multiple fields. appended multiple rows with text fields then getting issue with input fields.
 - inputting the value, it's showing multiple textboxes and inputted value showing
 - inputted 5 at third textbox: showing as 555

AutoNumeric Append Text Box with AutoNumeric

      <button type='button' class='btn btn-danger' onclick='doAppendRow()'>Add</button>

```

    ```var row = 1;
const autoNumericOptions = {
  allowDecimalPadding: "floats",
  decimalCharacter: ",",
  digitGroupSeparator: "",
  emptyInputBehavior: "zero",
  decimalPlaces: 2
  // watchExternalChanges: true //!!!
};
function doAppendRow() {
  var output =
    "

Qty<input type='text' name='txtqty[]' class='form-control' />

Amount<input type='text' name='txtamount[]' class='form-control' />

";

  $("#dvappend").append(output);
  new AutoNumeric.multiple("input[name^=txtqty]", autoNumericOptions);
  new AutoNumeric.multiple("input[name^=txtamount]", autoNumericOptions);
  row++;
}

Please help!

CodePen Link: https://codepen.io/muruganrsm/pen/eYVqqZY


text:
Q: Failing termination check with a with-abstraction I'm surprised to see the following function fail the termination check. y ∷ ys is structurally smaller than x ∷ y ∷ ys, isn't it?
open import Data.List using (List ; [] ; _∷_)
open import Data.Nat using (ℕ ; zero ; suc)
open import Data.Nat.Properties using (<-cmp)

foo : List ℕ → ℕ
foo [] = 0
foo (x ∷ []) = 1
foo (x ∷ y ∷ ys) with <-cmp x y
... | _ = suc (foo (y ∷ ys))

Doing either (or both) of the following two things seems to make the termination checker see the light:

*

*Removing the with-abstraction.

*Changing the last clause to match with y ∷ ys instead of x ∷ y ∷ ys and recurse with ys instead of y ∷ ys. (And also changing <-cmp x y to <-cmp y y for a lack of xs.)
Now I am even more confused than I usually am and I'm wondering: What's going on, how does the with-abstraction (and its helper function) factor into all of this, and what do I do about it?
I've seen the other questions and answers concerning termination, but - unlike those more complicated cases - the case at hand seems to be about basic structural recursion, no?
Update
I just found an answer to the question, but if anybody would like to shed more light on what exactly is going on, e.g., how exactly the with-abstraction interferes with termination checking, then I'd be more than happy to accept that answer instead.

A: Turns out that this is a known limitation of the termination checker since 2.6.1. See the Termination checking section in the change log for 2.6.1: https://github.com/agda/agda/blob/v2.6.1/CHANGELOG.md
The pattern match and the recursive call won't work with a with-abstraction between them. A workaround is to also abstract over the recursive call in order to pull it up into the with-abstraction (from its original location after the with-abstraction).
open import Data.List using (List ; [] ; _∷_)
open import Data.Nat using (ℕ ; zero ; suc)
open import Data.Nat.Properties using (<-cmp)

foo : List ℕ → ℕ
foo [] = 0
foo (x ∷ []) = 1
foo (x ∷ y ∷ ys) with foo (y ∷ ys) | <-cmp x y
... | rec | _ = suc rec

In the above code, the pattern match x ∷ y ∷ ys and the recursive call foo (y ∷ ys) don't straddle the with-abstraction any longer and the termination check succeeds.
The above fixes my issue, but the change log describes more delicate cases that require a little more care.
This issue is tracked in Agda issue #59 (!), which contains more details and a history of the problem: https://github.com/agda/agda/issues/59


text:
Q: C: conflicting types error I want to check a linked List of Elements holding an Integer each, if a value is already inside.
struct ListenElement{
    int wert;
    struct ListenElement *nachfolger;
};

struct ListenAnfang{
    struct ListenElement *anfang;
};

struct ListenAnfang LA;

bool ckeckForInt(int value){
    if (LA.anfang == NULL){
        return 0;
    }
    return checkCurrent(LA.anfang, value);
}

bool checkCurrent(struct ListenElement* check, int value){
    if (check->wert == value){
        return true;
    }
    else if (check->nachfolger != NULL){
        return checkCurrent(check->nachfolger, value);
    }
    else{
        return false;
    }
}

Im getting a conflicting types for the checkCurrent Method, but can't find it.

A: checkCurrent() is used before it is declared, or defined, which results in an implicit function declaration being generated with a return type of int (which is not the same as the definition of the function which has return type bool). Add a declaration for checkCurrent() prior to its first use:
bool checkCurrent(struct ListenElement* check, int value);

bool ckeckForInt(int value){
    if (LA.anfang == NULL){
        return false; /* Changed '0' to 'false'. */
    }
    return checkCurrent(LA.anfang, value);
}

or move its definition prior to checkForInt().

A: Is missing the function declaration.
In C, you need to declare the function, exactly as it is.
struct ListenElement{
    int wert;
    struct ListenElement *nachfolger;
};

struct ListenAnfang{
    struct ListenElement *anfang;
};

struct ListenAnfang LA;

//The function declaration !
bool checkCurrent(struct ListenElement* check, int value);

bool ckeckForInt(int value){
    if (LA.anfang == NULL){
        return 0;
    }
    return checkCurrent(LA.anfang, value);
}

bool checkCurrent(struct ListenElement* check, int value){
    if (check->wert == value){
        return true;
    }
    else if (check->nachfolger != NULL){
        return checkCurrent(check->nachfolger, value);
    }
    else{
        return false;
    }
}


text:
Q: Linking cells from Google sheets to Microsoft word I have a quick question - is there a way that I can create a hyperlink between cells in Google sheets and Microsoft word, validated in a way that, whenever the data is updated in Google sheets, it's automatically updated in word?
Thank you
Regards
MA


text:
Q: querying on 10 million mongodb documents I am storing book meta-data like name,authors,price,publisher,etc in a mongodb document. I have about 10 million of these documents and they all are in one collection. The average document size is 1.9 KB. Now i have indexes on name,authors and price. In fact i have 2 indexes on price one in ascending order and one descending order. My mongodb version is 2.2.0 and i am using the php driver to query mongo. The driver's version is 1.12. But when i do a range query on price i get a MongoCursorTimeoutException. In my query i am trying to find books in a certain price range like "price less than 1000 and more than 500".
Increasing the timeout doesn't seem to be a good idea(It is already 30 sec). Is there anything else that i can do to speed up the query process.
EDIT
Actually my price index is compound. I have a status field which has an integer value so my price index looks like {price:-1,status:1} and {price:1,status:1}
Also I am trying to retrieve 20 documents at a time with PHP.

A: We have had a lot of experience with Mongo collections with millions of documents using both single/shared servers and dedicated replica sets on EC2 using both traditional and SSD EBS volumes. The workloads are varied: some are analytics-oriented and others are backing Web requests. Here is the root cause analysis path I'd recommend:

*

*Run your queries with .explain() to see what's going on in terms of indexes used, etc. Adjust indexes if necessary. Mongo's optimizer is rather naive so if your indexes don't match the query pattern perfectly, they may be missed.

*Check MMS and look for any of the following problems: (1) not all data in memory (indicated by page faults) and (2) queue lengths (typically indicating some type of bottleneck). Mongo's performance degrades rapidly when not all data is in memory because the database has a single global lock and touching storage, especially in the cloud is bad news. We recently upgraded to SSD cloud storage and we are seeing 3-10x improvements in performance on a database that's about 1/2 Tb in size.

*Increase the profiling level to 2 (the max), run for a while and look at the operation log. See the MongoDB profiler.
Hope this helps.

A: *

*Check your indecies. Reindex your data, and make sure that the collection is fully indexed before running the queries. (10 mi. docs may take awhile to index)

*The slowest part of any indexed query is the actual document retrieval. I could imagine that depending on the amount of documents you are pulling this could take 30 seconds or more and a lot of memory.

For more helpful instructions on some things you could try check out this page:
http://www.mongodb.org/display/DOCS/Optimization
For 10 mi. documents you might also think about sharding the data across computers. Remember that hard drive reads are slower than cpu cycles.

A: As @JohnyHK said my RAM was too low. So increased it to 12 GB and it works now. Thanks everyone for their comments and answers


text:
Q: completely remove admin module from Magento Ok, so several times now I've had magento be a utter b**** when it comes to updating my custom modules and it would save me an awful amount of time if i could just remove them completely. Important to note these always include a database table.
Currently to uninstall I delete the relevent files in app/etc/modules, app/design/adminhtml/default/default/layout and the folder in app/code/local/namespace/.
I also delete the table (modules contain install script anyway) and the reference in core_resource. I also delete the var folder, clear the cash and index to be damn sure it should all be gone.
Now if i were to then try to re-add an up dated module (with the same version number) with new fields in the model, it will somehow know what the original fields were and not add the new fields. This screams to me that I've not removed all the data in the database regarding this module.
What am i missing?

A: As already explained in your other question and as @Fabian Blechschmidt states, you simply just disable module (admin > config > system > advanced) and then remove the entry from the database table core_resource and clear cache/sessions as necessary. This removes the install information for that extension from Magento. Then you would delete the necessary files and folders relating to that extension.
If this isn't working for you, then you've either done something wrong, your Magento install has more serious issues or your extension is inserting multiple traces and references to it in other places in the structure/database.

A: A good practice is to create upgrade scripts to your module when you do updates instead of trying to remove it and install it from scratch. So if you have a module that is at version 1.0, you change the version to 1.1 and create a mysql4-upgrade-1.0-1.1.php file that does the upgrade (if you are not familiar with this, read http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-6-magento-setup-resources). In this case, putting your module on a system that has version 1.0 installed will run only the 1.0-1.1 upgrade while putting it on a system where the module is not present will run both the install (1.0) file and the 1.0-1.1 upgrade, which is pretty neat. I find myself doing this often as it is a lot easier to distribute the module to dev/qa/production servers without touching the database.
In the case you want to re-test the full install locally, the best way is to start with a clean database. Just install Magento, create a database dump right after and replace your db with this one when you need to. Magento has no support for "real" uninstallers. For example, if you add a table column in your installer, there is not standard way to remove that at uninstall. Until Magento comes up with an uninstall system, wiping the database is the safest way to make sure you revert an install.


text:
Q: How to get "From Form" Event to show up in Triggers? I am trying to figure out how to get "From Form" to show up in my event triggers.
I have a form connected to a spreadsheet and have an on submit function in one script and two other separate function in the same project.
I somehow successfully allowed one function to trigger on the forms submission. However, I added a new script to the project and am only getting the calendar and time driven options.
How can I add the From Form option to the new script?
Thanks!
screenshot


text:
Q: ¿Por qué al cerrar sesión, en una vista específica, en la url no envía a la vista login y solo la sobrepone seguida del slash en Vue JS? Existen 2 vistas, una llamada home y otra llamada parqueo  cuando me encuentro en la vista home, exise un botón que ejecuta una funcion para redireccionarme a la visa parqueoa la cual le envió parámetros por la url:
Esta es la funcion que se ejecuta en la vista home:
parqueoSeleccionado(index) {
      console.log("SELECICONANDO PARQUEO");
      console.log(index);
      let obj_parqueo_seleccionado = {};
      obj_parqueo_seleccionado.id_zona_parqueo = this.id_zona_parqueo;
      obj_parqueo_seleccionado.id_parqueo = index;
      obj_parqueo_seleccionado.id_vehiculo = this.id_vehiculo;
      obj_parqueo_seleccionado.placa = this.placa;
      obj_parqueo_seleccionado.id_categoria = this.id_categoria;

      this.$router.replace({
        path: "parqueo/" + index,
        query: obj_parqueo_seleccionado
      }) //Aca mando los parámetros.
    }

Luego al encontrarme en la vista parqueo y cierro sesión:
cerrarSesion() {
      this.$router.replace({ query:{} });
      this.$router.replace({ params:{} });
      console.log("CERRAR SESION");
      console.log(this.$route)
      setTimeout(() => {
        firebase
        .auth()
        .signOut()
        .then(() => {});
        this.$router.replace({ path: "login" });
        console.log(this.$route);
      }, 100);

    }

en la url me queda lo siguiente: http://localhost:8081/#/parqueo/login, cuando unicamente debería ser http://localhost:8081/#/login, pero que el problema me surge cuando envió parametros por la url, ya que al no mandar, no me da problemas.


text:
Q: Index on UNION query? i've got this union query:
(SELECT INSTALLER, INSTALLTIME, RESULT, JOBNUMBER, HONAME, ADDRESS, CITY, STATE, ZIP, NOTES, SMNOTES, '' as priority, PAFS, upsell, TERM, MMRUPGRADE, WARRANTY, EFT FROM ACCOUNTS
WHERE INSTALLDATE = '$date' && FUNDINGSTATUS !='DEAD')
UNION
(SELECT technician, servicetime, result, ID, Customername, address, city, state, zip, notes, board, priority, '', '', '', '', '', '' FROM service
WHERE serviceday = '$date')
ORDER BY INSTALLER, priority

i'm curious if putting an index on the date field will help speed up both queries? or will the fact that i use FUNDINGSTATUS in the first where clause will make that query not utilize the index?

A: Most likely it will help, but the only way to be sure is to break open the profiler, and have a look. Starting with version 5.0.37, MySQL has a built-in profiler.
Enable it with
set profiling=1;

To lookup the query_id
show profiles;

And to see the execution plan:
show profile for query x;

A: Answering your very question:

I'm curious if putting an index on the date field will help speed up both queries?

If the condition on installdate and serviceday is selective (that is few rows satisfy it), then yes, it will help.
Date fields usually tend to be selective.

or will the fact that i use FUNDINGSTATUS in the first where clause will make that query not utilize the index?

Yes, the index will still be used.
The engine will use the index to select only the records with installdate = $date and the will additionally filter on the value of fundingstatus.
For best results, create the following indexes:
ACCOUNTS  (installdate, fundingstatus)
service (serviceday)

If DEAD is a frequent value for fundingstatus, it may be better to rewrite this query like this:
SELECT  INSTALLER, INSTALLTIME, RESULT, JOBNUMBER, HONAME, ADDRESS, CITY, STATE, ZIP, NOTES, SMNOTES, '' as priority, PAFS, upsell, TERM, MMRUPGRADE, WARRANTY, EFT
FROM    ACCOUNTS
WHERE   INSTALLDATE = '$date' AND FUNDINGSTATUS < 'DEAD'
UNION ALL
SELECT  INSTALLER, INSTALLTIME, RESULT, JOBNUMBER, HONAME, ADDRESS, CITY, STATE, ZIP, NOTES, SMNOTES, '' as priority, PAFS, upsell, TERM, MMRUPGRADE, WARRANTY, EFT
FROM    ACCOUNTS
WHERE   INSTALLDATE = '$date' AND FUNDINGSTATUS > 'DEAD'
UNION
SELECT  technician, servicetime, result, ID, Customername, address, city, state, zip, notes, board, priority, '', '', '', '', '', ''
FROM    service
WHERE   serviceday = '$date'
ORDER BY
        INSTALLER, priority

so that the range access on both fields (installdate, fundingstatus) can be used.

A: Having the index on any field in the where clause can always improve the performance, whether by a lot or a little.
To answer your question of whether the index on "date" will be used despite first query having "FUNDINGSTATUS" in the where clause has 2 answers:

*

*If there are NO OTHER indexes on the table, then the date index will most definitely be used. That is because finding records with the specific date by index is a lot less work for the DB than searching the entire table, even if it does need to check the FUNDINGSTATUS after finding said records.

*If there ARE other indexes on the same table, then the answer is "it depends".
It mostly depends on what % of the data will be data that's notd ead vs. % of the data for a given date.
The optimizer usually tries to choose the index that will right away pick the smallest # of columns - e.g. if your table has data for 100 days and 1/2 of them is dead rows, then the date index will be chosen because it gives you 1% of the data without scanning the table vs. 50% of the data.


text:
Q: Grand Central Dispatch Growing Memory Overview:  I'm creating a Swift program that downloads live JSON Data that updates very frequently (possibly several times per second) and then displaying that to the user in a tableView.  When the program begins it does the downloading in a separate thread using GCD, essentially running the thread the whole time the program is running.
Problem: The program downloads and displays the data nicely but I notice that the program's memory (as seen in Xcode debug navigator) keeps growing much faster than the JSON data is coming in.  Within a few minutes it's a couple of hundred MBs.
I call dispatch_async from my 'Coordinator' object which also stores the collection of instance vars i'm updating.  Here is my code
func startDownload() {

   dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), {
      while (true) {
         self.myDataPipe.downloadMarketOdds(self.marketsToUpdate)
         dispatch_sync(dispatch_get_main_queue(), {
            self.referenceToViewController!.reloadUpComingMarketsTableView()
            self.referenceToViewController!.reloadMainTableView()
        })
      }
   } ) // end of dispatch_async

   // end of start()
}

I'm new to GCD and have done some searching on stackoverflow but haven't found anything that has been helpful yet.  Could someone please point me in the right direction or point out something obvious i'm missing?
Thanks in advance!

A: The best approach would be to analize memory report from Xcode or get more detailed information via Instruments.
I would sugget you to use autorelease pool (to force release of all autoreleased objects):
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), {
      while (true) {
        autoreleasepool {
             self.myDataPipe.downloadMarketOdds(self.marketsToUpdate)
             dispatch_sync(dispatch_get_main_queue(), {
                self.referenceToViewController!.reloadUpComingMarketsTableView()
                self.referenceToViewController!.reloadMainTableView()
            })
        }
      }
   } )

Or download data by GCD timer:
let interval = 5.0 // seconds
let queue = dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0)
let timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue)
dispatch_source_set_timer(timer, dispatch_time(DISPATCH_TIME_NOW, interval * NSEC_PER_SEC), interval * NSEC_PER_SEC, (1ull * NSEC_PER_SEC) / 10)
dispatch_source_set_event_handler(timer, {
    self.myDataPipe.downloadMarketOdds(self.marketsToUpdate)
    dispatch_sync(dispatch_get_main_queue(), {
        self.referenceToViewController!.reloadUpComingMarketsTableView()
        self.referenceToViewController!.reloadMainTableView()
    })
})
dispatch_resume(timer)


text:
Q: AWS IAM User Permission for a specific EC2 server not working I am trying to restrict a user to Start/Stop a particular EC2 instance (TESTSYS) and for this, I created below IAM policy and assigned to a test user (TESTUSER):
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "ec2:Describe*",
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "ec2:StartInstances",
                "ec2:StopInstances",
                "ec2:RebootInstances"
            ],
            "Resource": "arn:aws:ec2:us-east-1a:XXXXXXXXXXXX:instance/i-abcdefgh012345678",
            "Condition": {
                "StringEquals": {
                    "ec2:ResourceTag/Name": "TESTSYS"
                }
            }
        }
    ]
}

When I login as this test user and try to start "TESTSYS" instance I get error message You are not authorized to perform this operation. Encoded authorization failure message:. Below is the decoded message:
{
   "DecodedMessage": {
      "allowed": false,
      "explicitDeny": false,
      "matchedStatements": {
         "items": []
      },
      "failures": {
         "items": []
      },
      "context": {
         "principal": {
            "id": "ABCDEFGHIJK0123456789",
            "name": "testuser",
            "arn": "arn:aws:iam::XXXXXXXXXXXX:user/testuser"
         },
         "action": "ec2:StopInstances",
         "resource": "arn:aws:ec2:us-east-1:XXXXXXXXXXXX:instance/i-abcdefgh012345678",
         "conditions": {
            "items": [
               {
                  "key": "ec2:Tenancy",
                  "values": {
                     "items": [
                        {
                           "value": "default"
                        }
                     ]
                  }
               },
               {
                  "key": "ec2:PlacementGroup",
                  "values": {
                     "items": [
                        {
                           "value": "arn:aws:ec2:us-east-1:XXXXXXXXXXXX:placement-group/App Servers"
                        }
                     ]
                  }
               },
               {
                  "key": "XXXXXXXXXXXX:Name",
                  "values": {
                     "items": [
                        {
                           "value": "TESTSYS"
                        }
                     ]
                  }
               },
               {
                  "key": "ec2:ResourceTag/System",
                  "values": {
                     "items": [
                        {
                           "value": "TESTSYS"
                        }
                     ]
                  }
               },
               {
                  "key": "XXXXXXXXXXXX:System",
                  "values": {
                     "items": [
                        {
                           "value": "TESTSYS"
                        }
                     ]
                  }
               },
               {
                  "key": "ec2:AvailabilityZone",
                  "values": {
                     "items": [
                        {
                           "value": "us-east-1a"
                        }
                     ]
                  }
               },
               {
                  "key": "ec2:Region",
                  "values": {
                     "items": [
                        {
                           "value": "us-east-1"
                        }
                     ]
                  }
               },
               {
                  "key": "ec2:ResourceTag/Name",
                  "values": {
                     "items": [
                        {
                           "value": "TESTSYS"
                        }
                     ]
                  }
               },
               {
                  "key": "ec2:ebsOptimized",
                  "values": {
                     "items": [
                        {
                           "value": "true"
                        }
                     ]
                  }
               },
               {
                  "key": "ec2:InstanceType",
                  "values": {
                     "items": [
                        {
                           "value": "c4.large"
                        }
                     ]
                  }
               },
               {
                  "key": "ec2:RootDeviceType",
                  "values": {
                     "items": [
                        {
                           "value": "ebs"
                        }
                     ]
                  }
               },
               {
                  "key": "ec2:InstanceProfile",
                  "values": {
                     "items": [
                        {
                           "value": "arn:aws:iam::XXXXXXXXXXXX:instance-profile/EC2_TESTSYS"
                        }
                     ]
                  }
               }
            ]
         }
      }
   }
}

When I try to simulate this policy for this same test user for StartInstance & StopInstance then I do see that permission is ALLOWED.
Can you please let me know what am I missing?
Appreciate your help.
Thanks!

A: You are specifying an availability zone instead of a region. Try with us-east-1
"Resource": "arn:aws:ec2:us-east-1:XXXXXXXXXXXX:instance/i-abcdefgh012345678",


text:
Q: Notepad ++ highlights everything that comes after <%= in html.erb files
See the image above.
I'm working on notepad ++.
html.erb files are presented that way, and I don't know how to get rid of the sky blue highlighting that follows <%=.

A: zsalzbank, Ben and peterjwest are all correct. Here's some new information:
SciTE 2.29 has a version of SciLexer.dll that doesn't crash Notepad++ 5.9.3 and also interprets the single quote correctly.
I downloaded it from here: http://sourceforge.net/projects/scintilla/files/SciTE/2.29/ - the file you need is wscite229.zip
You can copy the new SciLexer.dll from the SciTE download into the Notepad++ folder.
UPDATE: Full instructions here: http://blog.dominicsayers.com/how-to-edit-erb-files-using-notepad/

A: I think your problem is the commented out end tag on that line.  The %> is being commented out.  Try using " instead of ' for your strings.

A: Here's a good article on it: http://therubyway.wordpress.com/2008/11/23/rails-on-notepad/
Essentially you just need to replace the scilexer.dll file (downloadable from the link) to fix the bugged <% %> syntax highlighting
Important Update:
Unfortunately this causes a crash on save (and will empty the file) on the new version of Notepad++, if you really want to use this it may work on an older version such as 5.8, you will have to test this.


text:
Q: Why is this variety given by the vanishing of a linear form? In this paper, in Proposition 4.2.6 on page 97, the author says that if $H$ is the vanishing locus of a biform of bidegree $(d_1,d_2)$, then $\phi(H)$ is defined by the vanishing of a linear form, where $\phi$ is the composition of a product of Veronese embeddings of degrees $d_1$ and $d_2$, with a Segre embedding.  Why is this true?  And does it remain true if either $d_1$ or $d_2$ is zero?

A: The Veronese embedding $\nu_d: \mathbf P^n \rightarrow \mathbf P^N$ of degree $d$ is defined by all sections of $O(d)$, so $\nu_d^* O(1) = O(d)$. That means that degree-$d$ hypersurfaces in the source, which are zero loci of sections of $O(d)$, get mapped to intersections of $\nu_d(\mathbf P^n)$ with zero loci of sections of $O(1)$ --- that is, linear forms.
Similarly the Segre embedding $\mathbf P^n \times \mathbf P^m \rightarrow \mathbf P^{nm+n+m}$ is defined by sections of $O(1,1)$. So hypersurfaces of bidegree $(1,1)$ get mapped to intersections of the image with zero loci of linear forms.
Putting those two together gives the claim.
Finally, if $d_1$ or $d_2$ is zero, the Veronese map is not an embedding: it maps projective space to a point. Then the Segre map will be an isomorphism, and so the statement is just what we already said about the Veronese map.


text:
Q: why can't I access a protected method from a private method if the protected ones are inherited by the subclasses? I do not understand this particular case or what Alexander says.
class instance is not the same as class?

As already Alexander Larikov said that you can't access protected
methods from class instance but not only protected methods but also
you can't access private methods from class instance. To access a
protected method of a parent class from the instance of a subclass you
declare a public method in the subclass and then call the protected
method of the parent class from the public method of the subclass,
i.e.

ALEXANDERS'S SOLUTION:
class testgiver{
    protected function dbConnect($userconnecttype)
    {
        echo "dbConnect called with the argument ".$userconnecttype ."!";
    }
}

class testprinter extends testgiver
{
    // WHAAAAAT? WHYYYYY?
    public function buildquestionarray() // public instead of private so you can call it from the class instance
    {
        $this->dbConnect('read');
   }
}

$tp=new testprinter();
$tp->buildquestionarray(); // output: dbConnect called with the argument read!

'Fatal error call to private method' but method is protected
why can't I access a protected method from a private method if the protected ones are inherited by the subclasses?
CODE BEFORE SOLUTION:
Line 726 of testprinter in the code below:
private function buildquestionarray()
{
  $query = "etc etc";
  **$conn = $this->dbConnect('read');
  $result = $conn->query($query);
  ...

Testprinter extends testgiver. Here's the extension of the class:
require_once('testgiver.php');

class testprinter extends testgiver
{...

And the declaration of the method in testgiver:
protected function dbConnect($userconnecttype)
{...

A: They didn't really explain it clearly in the other answers.
Visibility of properties and methods (which I'll refer to collectively as "names") is controlled by where the code that tries to access the name is running. It can be in top-level code, a regular function, or a class method. If it's in a method, what matters is the class where the method is defined.
It's not based on the class of the instance that the name is accessed through.

*

*If the name is declared private, you can only use the name in a method of the class that declares the name.

*If the name is declared protected, you can refer to it in a method of that class, and also a method of a parent or descendant class.

*If the name is declared public (the default, which also applies if the property is added dynamically), you can refer to it from anywhere.


text:
Q: Get affected-rows value from mysql DB using Mule 3.5.x+ On attempting to write to a table, I need to know if the row was updated (new row created or existing row updated) or not. I would have got this value from the affected-rows value.
Previously, the solution would have been to build a class like org.mule.transport.jdbc.sqlstrategy.SimpleUpdateSqlStatementStrategy and re-implement it to return the affected-rows value instead of the row itself.
However, it seems like the JDBC transport has been deprecated in favor of the Database connector, and I am finding it hard to track down the code or how to implement the functionality.
SOLUTION :
David's reply got me down the right track! Thanks David.
However, this problem was fixed in the mysql-connector-java in versions 5.1.27 and above.
So, the POM needed to be upgraded.

              mysql
              mysql-connector-java
              5.1.27

I was able to achieve the right results using DBCP2 as follows:

    <spring:beans>
         <spring:bean id= "jdbcDataSource" class ="org.apache.commons.dbcp.BasicDataSource" name= "Bean">
          <spring:property name= "driverClassName" value ="com.mysql.jdbc.Driver" />
          <spring:property name= "username" value = "root"/>
          <spring:property name= "password" value = "root"/>
          <spring:property name="url" value="jdbc:mysql://localhost:3306/local1?useAffectedRows=true"/>
            <!-- Following properties added for having auto reconnect  mechanism-->
          <spring:property name= "testOnBorrow" value = "true"/>
          <spring:property name= "validationQuery" value = "select 1"/>
         </spring:bean>
    </spring:beans>   <db:mysql-config name="MySQL_Configuration" dataSource-ref="jdbcDataSource" doc:name="MySQL_Configuration"/>

A: From the documentation:

target #[payload] The enricher expression used to enrich the current message with the result of the SQL processing.

This should allow you to define an expression that would tell Mule where to store the outcome of the update, which is the number of updated rows.
From the integration test suite:
<db:update config-ref="dbConfig"
           target="#[header:OUTBOUND:updateCount]">
  <db:parameterized-query>update PLANET set NAME='Mercury' where POSITION=4</db:parameterized-query>
</db:update>

This sets an outbound property named updateCount with the number of updated rows. I'd personally suggest to instead set a flow variable with #[flowVars['updateCount']], but it depends on your use case.


text:
Q: Editing row added to table with jQuery I found this post: Editing and deleting a newly added table row using Jquery and that seemed like it was exactly what I was looking for, but I couldn't get their suggested solution to work.
After making an ajax call, I add a new row to a table. The row looks similar to this:

    Edit
    <input type="checkbox" class="chkDeleteClass" name="deleteClasses[]" value="33" />
    CLASS101
    Class Description

The Edit link doesn't work until after a page refresh (I'm assuming that has something to due with the fact that it's not in the DOM immediately after it's added to the table). So, I needed to find a workaround, which lead me to the above-mentioned post.
I modified the code from there to look like this:
$('a').live('click', function(e){
    if ($(e.target).attr('class') == 'classAdminFormSubmit') {
        alert($(e.target).name());

        OpenEditDialog($(this));
        return false;
    }
});

The alert never fires, so I'm hoping it's just that my selector needs adjusting. I need to pass the selected anchor tag to the OpenEditDialog function.

A: $( 'a' ).live( 'click', function () {

    var $this = $( this );

    if ( $this.hasClass( 'classAdminFormSubmit' ) ) {

        alert( $this.attr( 'name' ) );

        OpenEditDialog( $this );

        return false;

    }

});

A: First, put a link in the row you just added, and give it a class, let's say it's editRow.
Second, use this code:
$('a.editRow').live('click', function(e){

    alert($(e.target).name());

    OpenEditDialog($(this));
    e.preventDefault(); // this is better than return false;
});


text:
Q: Removable HDD defined in fstab causing problems at startup when not present Recently I made some edits in my fstab file after some change in my partitions. (check
Partitions mounted with fstab, not opening from Nautilus nor Unity sidebars ) In the process I wanted to include a removable device so it would be present for all users when it was present.
It automatically mounted as \media\activeuser\HDDMaker with user access permissions set to activeuser only.  My idea was to mount it as \media\HDDMaker with access permissions to any user in a given group (gid=1004 common).
The fstab file looks like this:
UUID=543Exxxxxx  /mnt/543Exxxxxx  ntfs-3g  rw,nosuid,nodev,noexec,auto,gid=1004,umask=0002 0 0
/mnt/543Exxxxxx  /media/HDDMaker  auto     rbind,x-gvfs-show,x-gvfs-name=HDDMaker          0 0

This works fine when the HDD is attached to the computer at startup (except for the detail in my other question: Partitions mounted with fstab, not opening from Nautilus nor Unity sidebars ), but when the HDD is not attached I have two problems.

*

*It reports at startup that the device cannot be mounted. (and the startup process is halted until you press S)

*When plug, after the system is up, it doesn't automatically mounts. You have to manually mount it as
sudo mount /dev/sdb1 /media/HDDMaker
The desired behavior is that it reports no problem at startup, and that, when plugged, it automatically mounts on /media/HDDMaker, with permissions set to all users in group common.

A: For an external drive, in order to prevent hold-up of the boot, the nobootwait option should be added to the fourth column in the /etc/fstab. Moreover, you should preferably use the UUID of the drive instead to ensure the right drive is always mounted (and see @Marty Fried's comment to your question) so you get:
UUID=XXXXX  /media/HDDMaker  auto     rbind,x-gvfs-show,x-gvfs-name=HDDMaker,nobootwait          0 0

This post explains when and why this is a good method.
Furthermore, since fstab is run only on startup, unless you write a specific process to keep re-running it, you have to do a manual sudo mount -a
to mount the disk if added afterwards, if you use the fstab option to auto-mount.
Therefore, a solution you could try instead, if you have Desktop Ubuntu, is to eschew fstab for this solution


text:
Q: Getting Boolean Values from Checkboxes and Appending them as Numbers in another sheet, like Database Hi Google Apps Script Programmers,
Picture making a kind of database for a sandwich shop in Google Sheets, where most sheets are data tables with column 1 being an autonumber field. The first sheet is the main order form named MySubShop. It'll record the order#, cashier, customer, date/time, and have a bunch of checkboxes for the foods. The second sheet is named Lookups and has lookups for bread types and beverage types only because people can only select 1 type of bread and 1 beverage. The rest of the sheets are like database tables and are named like this: Breads, Meats, Cheeses, Condiments, and Sides.
In the main MySubShop sheet, during an order, a user will mainly click on checkboxes next to food items because users can select > 1 topping item. For instance, for cheeses, cheddar and provolone can both be checked. Same with meats, sides, etc.
A button will be clicked to get the values of all of the cells on the MySubShop order sheet and then set those values across all of the other sheets.
Question - The issue is I'd really like to store the values just like a database. Take the cheeses for example. If the checkboxes next to cheddar and provolone are checked, I'd like for Sheets to get those values and then, in the Cheeses sheet, lay out the data like this:
orderID  ,  cheeseID
1  ,   1   where 1 would = cheddar
1   ,  4   where 4 would = provolone
Unlike a database though, cheddar and provolone are defined by their ranges on the main MySubShop sheet. Chedder is a checkbox in cell G2 and provolone is a checkbox in cell G5. So if G2 is checked TRUE and if G5 is TRUE, then get those values and, on button click, set those values.
Question - I am new to Apps Script and would like some help figuring out some of this code, for instance, for the Cheeses. How to take a TRUE value in cell G2 and change it to a numerical value on the last row of col 2 of the Cheeses sheet.
Any help on this would be very greatly appreciated.
Thanks
    //GRAB ALL OF AN ORDER'S DATA ON MYSUBSHOP SHEET AND COPY IT TO THE OTHER SHEETS
    function setValuesAcrossSheets() {
      var mysheet = SpreadsheetApp.getActive().getSheetByName('MySubShop');

      //Get the order info
      var ordersvalues = [[mySubShop.getRange("B5").getValue(),
                           mySubShop.getRange("B4").getValue(),
                           mySubShop.getRange("B3").getValue(),
                           mySubShop.getRange("B2").getValue()]];

      orders.getRange(orders.getLastRow()+1, 1, 1, 4).setValues(ordersvalues);

      //increase the order number to get ready for the next order
      mySubShop.getRange("B5").setValue(newordernum+1);

//trying to figure out the best way to do this...
      var breadvalues = sheet.getRange("c2");  //a listbox that pulls options from another sheet
      var meatvalues = ['d5', 'd6', 'd7', 'd8', 'd9', 'd10']; //checkboxes in d5:d10
      var cheesevalues = ['g2', 'g3', 'g3', 'g4', 'g5']; //checkboxes in g2:g5
      var beveragevalues = sheet.getRange("f8"); //checkboxes in g2:g5
      var condimentvalues = ['j2', 'j3', 'j4', 'j5', 'j6', 'j7', 'j8']; //checkboxes in j2:j8
      var sidesvalues = ['m2', 'm3', 'm4', 'm5', 'm6']; //checkboxes in m2:m6

A: Try this
//GRAB ALL OF AN ORDER'S DATA ON MYSUBSHOP SHEET AND COPY IT TO THE OTHER SHEETS
function setValuesAcrossSheets() {
  var mysheet = SpreadsheetApp.getActive().getSheetByName('MySubShop');

  //Get the order info
  var ordersvalues = mysheet.getRange("B2:B5").getValues();
  if (ordersvalues[0][0]=="TRUE") { ordersvalues[0][0]=1  } else {ordersvalues[0][0]=0}
  if (ordersvalues[1][0]=="TRUE") { ordersvalues[1][0]=1  } else {ordersvalues[1][0]=0}
  if (ordersvalues[2][0]=="TRUE") { ordersvalues[2][0]=1  } else {ordersvalues[2][0]=0}

  orders.getRange(orders.getLastRow()+1, 1, 1, 4).setValues([ordersvalues[3][0], ordersvalues[0][0],ordersvalues[1][0],ordersvalues[2][0] ]);

  //increase the order number to get ready for the next order
  mySubShop.getRange("B5").setValue(newordernum+1);

If you want to do the same for many loops, you can do it inside a loop to make the code shorter.
Pl. share a copy of the sheet with public edit rights and paste the url here for better understanding

A: Since your checkboxes are displayed in vertical what I would do is to create an hidden column that hosts the food ids.
Approach:
As an example for the Cheeses you can have your cheeses checkboxes in column G from row 5 to row 10. Let's say that in column F which will be hidden I have the ids of my cheeses.
In this way I can relate the checkbox to the cheese id directly without filtering the actual names (that i suppose will exist in a column next to the checkboxes anyways).
Here an example:
let ss = SpreadsheetApp.getActiveSheet(); // MySubShop
let CheesIds = ss.getRange("F8:G12").getValues() // get the rows
                                    .filter(value=> value[1]) // the boolean value to filter the rows
                                    .flatMap(value => value[0]);  // the filtered cheese ids

You can reproduce this behavior for all of the others categories and then generate the entries in the corresponding sheets.
If this is not possible in your sheet please excuse my initial assumption.

A: I made the full application for you.
I added "Number of sandwitch" as a single order can have many similar sandwitch. No need to make many orders for it. If you don't like it, just feed "1" quantity for all orders.

function confirm_order() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var ordsht = ss.getSheetByName('MySubShop');
  var sumsht = ss.getSheetByName('Orders');
  var loksht = ss.getSheetByName('Lookups');
  var metsht = ss.getSheetByName('Meats');
  var brdsht = ss.getSheetByName('Breads');
  var chssht = ss.getSheetByName('Cheeses');
  var consht = ss.getSheetByName('Condiments');
  var sidsht = ss.getSheetByName('Sides');
  var bevsht = ss.getSheetByName('Beverages');
  var ordvals = ordsht.getRange("A1:M10").getValues();
  //Browser.msgBox(ordvals);
  sumsht.appendRow([ordvals[4][1], ordvals[3][1],ordvals[2][1],ordvals[1][1] , ordvals[5][1] ]);//order list
  brdsht.appendRow([ordvals[4][1], ordvals[1][2] , ordvals[5][1] ]);//bread
  bevsht.appendRow([ordvals[4][1], ordvals[7][5], ordvals[5][1] ]);//beverage
  //meat
  for (i=4;i<10;i++){
    if (ordvals[i][3]==true){
      metsht.appendRow([ordvals[4][1], ordvals[i][2], ordvals[5][1] ]);
    }//if
  }//for
  //cheese
  for (i=1;i<5;i++){
    if (ordvals[i][6]){
      chssht.appendRow([ordvals[4][1], ordvals[i][5], ordvals[5][1] ]);
    }//if
  }//for
  //condiments
  for (i=1;i<8;i++){
    if (ordvals[i][9]){
      consht.appendRow([ordvals[4][1], ordvals[i][8] , ordvals[5][1]]);
    }//if
  }//for
  //sides
  for (i=1;i<6;i++){
    if (ordvals[i][12]){
      sidsht.appendRow([ordvals[4][1], ordvals[i][11] , ordvals[5][1]]);
    }//if
  }//for
  //increase the order number to get ready for the next order
  ordsht.getRange("B5").setValue(ordvals[4][1]+1);
}
//

See the sheet here
https://docs.google.com/spreadsheets/d/1X97wIEHGxbRIzG4GEOZQOxwM7IPlGCgEHV7qcULLe78/edit#gid=189012034
After configuring the order just click "order"
You can further improve it like
Reset all options after each order,
Make sure atleast one option is selected for each item,
Limit the number of choices to, say max 3 (not more than 3 can be selected)
If you want, I will do it for you.
I will claim my sandwitch soon!!! Cheers!

A: I improved the solution using array. Hope the speed will improve greatly. Try it.
I introduced a "Detail" sheet. Once order is confirmed, it is written to this sheet at one go. You can filter it easily.
For convenience, I have provided query in all other sheets which pull data from the detail sheet.
https://docs.google.com/spreadsheets/d/10yvp5GFfR1b-I5fpuCbuhvkp_dahENowzQQZH6c9QOE/edit?usp=sharing

function confirm_order() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var ordsht = ss.getSheetByName('MySubShop');
  var sumsht = ss.getSheetByName('Orders');
  var detsht = ss.getSheetByName("Detail")
  //var loksht = ss.getSheetByName('Lookups');
  //var metsht = ss.getSheetByName('Meats');
  //var brdsht = ss.getSheetByName('Breads');
  //var chssht = ss.getSheetByName('Cheeses');
  //var consht = ss.getSheetByName('Condiments');
  //var sidsht = ss.getSheetByName('Sides');
  //var bevsht = ss.getSheetByName('Beverages');
  var ordvals = ordsht.getRange("A1:M10").getValues();
  //Browser.msgBox(ordvals);
  var ordary=[];
  sumsht.appendRow([ordvals[4][1], ordvals[3][1],ordvals[2][1],ordvals[1][1] , ordvals[5][1] ]);//order list
  ordary.push(["Bread",ordvals[4][1], ordvals[1][2] , ordvals[5][1] ]);//bread
  ordary.push(["Beverage",ordvals[4][1], ordvals[7][5], ordvals[5][1] ]);//beverage
  //meat
  for (i=4;i<10;i++){
    if (ordvals[i][3]==true){
      ordary.push(["Meat",ordvals[4][1], ordvals[i][2], ordvals[5][1] ]);
    }//if
  }//for
  //cheese
  for (i=1;i<5;i++){
    if (ordvals[i][6]){
      ordary.push(["Cheese",ordvals[4][1], ordvals[i][5], ordvals[5][1] ]);
    }//if
  }//for
  //condiments
  for (i=1;i<8;i++){
    if (ordvals[i][9]){
      ordary.push(["Condiment",ordvals[4][1], ordvals[i][8] , ordvals[5][1]]);
    }//if
  }//for
  //sides
  for (i=1;i<6;i++){
    if (ordvals[i][12]){
      ordary.push(["Sides",ordvals[4][1], ordvals[i][11] , ordvals[5][1]]);
    }//if
  }//for
  //increase the order number to get ready for the next order
  ordsht.getRange("B5").setValue(ordvals[4][1]+1);
  detsht.getRange("A"+(detsht.getLastRow()+1)+":D"+(detsht.getLastRow()+ordary.length)).setValues(ordary);

}
//