Python app with tesseract does not work on Bluemix

Question: I have a python application which uses tesseract for detecting checkboxes in scanned images, works perfectly fine on my local machine, but when I push my code to Bluemix along with the python-tesseract buildpack it fails generating the output file which means the tesseract is not getting detected on Bluemix.
This is my manifest.yml:

applications:
  - path: .
    memory: 512M
    instances: 1
    domain: mybluemix.net
    name: edge-noise-detector-bluemix
    host: edge-noise-detector-bluemix
    disk_quota: 1024M
    buildpack: https://github.com/LeoKotschenreuther/python-tesseract-buildpack.git

This is my requirements.txt:

Flask
  numpy
  Pillow==4.1.1
  pycparser
  pyOpenSSL
  pyparsing
  pytesseract
  python-dateutil
  python-swiftclient
  pytz
  PyWavelets
  scikit-image
  scipy
  requests
  matplotlib==1.4.3
  opencv-python
  cf_deployment_tracker
  tesseract

Here is the logs from Bluemix:
<code>Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/app/.heroku/python/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "server.py", line 217, in predict_square_checkboxes
    ImgOcr = image_hocr_class.ocr_hocr('temporary.png')
  File "/home/vcap/app/src/image_hocr_class.py", line 39, in __init__
    self.HTMLTree = xml.etree.ElementTree.parse(self.HOCRFileName).getroot()
  File "/app/.heroku/python/lib/python3.6/xml/etree/ElementTree.py", line 1196, in parse
    tree.parse(source, parser)
  File "/app/.heroku/python/lib/python3.6/xml/etree/ElementTree.py", line 586, in parse
    source = open(source, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'images/8e297b93a39f1e08a490f72c8db53bf0.hocr'
</code>
This normally happens when pytesseract could not locate the path of tesseract. Not sure how to get this work on Bluemix.
Does anyone got python with tesseract working on Bluemix? Please help.
Comment: What is the error? Please edit with the recent logs.
Comment: I updated with the server logs from bluemix.
Comment: If you find that the Cloud Foundry build pack is too locked down, one other approach you could look at is creating and deploying a docker image: https://www.ibm.com/blogs/bluemix/2017/10/ibm-bluemix-cloud-foundry-docker-applications/ on Cloud Foundry.  This will give you much more control over the container.
Answer: IBM Cloud gives you a number of possibilities to run your applications.
Cloud Foundry Runtimes is one of them, but in your situation doesn't seem a good fit. Whenever you have a dependency that you need to install you need to create your custom buildpack which can be a rather complex task. (https://docs.cloudfoundry.org/buildpacks/custom.html)
Ever heard about Docker/Kubernetes? If you have a number of application dependency (like tesseract in your case) I would suggest you to create a Kubernetes environment to build your app!
have a look at these resources: https://hub.docker.com/r/tesseractshadow/tesseract4re/
https://console.bluemix.net/docs/containers/container_index.html#container_index
Comment: Thank you Gianluca.. yes I am taking that approach.


Adding a C Wire to a wall mounted gas heater for a WiFI Thermostat

Question: I have a typical 2 wire thermostat for a wall mounted propane heater. I want to install a wifi honeywell thermostat.  The thermostat is right next to the heater so running a third wire is no problem I just don't have a clue where the wire taps into the homeywell gas control valve see pics below The red and white are the 2 wires to the thermostat
Comment: This might not even be a 24v system and might take more work to get a wifi thermostat working.  Unless you know how to measure voltages and wire up a relay, this might not be something you can DIY.
Answer: the "WHT" wire that goes from the 24V transformer to the gas valve is the C wire, tap into that.
looking at the picture of the valve it looks like the two terminals on the front of the valve (near the knob) are boith the same piece of metal, so C will be be the stripy wire on the side near the gas plumbing.
Comment: looking at the picture of the valve  it lookls like the two terminals on the front of the valve (near the knob) are both the same piece of metal, so that will be R and C will be  be the stripy wire on the side near the gas plumbing.
Comment: It should be the wire connected to the TR (transformer) terminal on the gas valve
Comment: yes, one of those wires, not the other one.
Comment: The three gas valve terminals are uniquely labeled (TR, TH, TH/TR)
Comment: So the hardware doesn't match the wiring digram where the four terminal are tow labeled th and two tr?
Comment: I could be reading the diagram wrong all the same
Comment: Thank you for the prompt response it's much appreciated the last question is what gage wire should I run for C ?
Comment: use the same same as the R and W,  cut back some of that brown stuff there may be one inside there already.
Comment: @ejvette instead of writing a "thanks" comment, please up vote the answer to show your appreciation. You'll learn that if you take the [tour].


How to decorate a component in angular.dart

Question: I would like to provide a possibility to show my components in a bit different look and feel and thought using the decorator for it. Something like:

    <my-component my-decorator></my-component>

.
@Component(
  selector: 'my-component',
  templateUrl: '.../my-component.html',
  cssUrl: '.../my-component.css',
  publishAs: 'comp',
)
class MyComponent {

  MyComponent(final Element element) {
    Logger.root.fine("MyComponent(): element = $element, element.attributes = ${element.attributes.keys}");
  }

}

@Decorator(selector: '[my-decorator]')
class MyDecorator {

  final Element element;

  @NgOneWay('my-decorator')
  var model; // is not used

  MyDecorator(this.element) {
    Logger.root.fine("MyDecorator(): element = $element, element.nodeName = ${element.nodeName}");
    Logger.root.fine("MyDecorator(): element.shadowRoot = ${element.shadowRoot}, element.parent = ${element.parent}");
  }

}

Unfortunately, it seems that my-decorator is processed before my-component so it is getting null shadowRoot property in the injected Element object.
It would be possible to check on existence of the my-decorator attribute within the my-component backing class, but that is clearly polluting the design.

UPDATE: Thanks to replay from Marko Vuksanovic, the following is now returning the :
@Decorator(selector: '[my-decorator]')
class MyDecorator extends AttachAware {

  final Element element;

  @NgOneWay('my-decorator')
  var model; // is not used

  MyDecorator(this.element) {
    Logger.root.fine("MyDecorator(): element = $element, element.nodeName = ${element.nodeName}");
    Logger.root.fine("MyDecorator(): element.shadowRoot = ${element.shadowRoot}, element.parent = ${element.parent}");
  }

  void attach() {
    Logger.root.fine("attach(): element.shadowRoot = ${element.shadowRoot}");
  }

}

The question still remains how to modify the styling of the shadow DOM.
Thanks in advance for any comments/ideas/solutions.
Comment: I think it might be helpful if you provided some code that shows what you try to accomplish. Maybe just a `new Future(() { access the elements shadowRoot here });` might be sufficient.
Comment: @GünterZöchbauer How are you able to respond within 2 minutes?!  I will add minimal code ...
Comment: I had SO page open and I saw that a new question appeared, that's all - no magic, no tricks ;-)
Comment: Very happy to get such a quick response - proves that Dart rocks already. Regarding my question, is there alternative way to decorate a custom component?
Comment: You could fire an event in the components `onShadowRoot()` method and `element.on['on-shadow'].listen((e) => dosomething)` in the decorator. The disadvantage is that the component needs to be changed.
Comment: @GünterZöchbauer, you broke my formatting ;-)
Comment: Sorry, didn't realize that you had more tags than just `...` Dart code often contains HTML fragments so it didn't look uncommon. Usually indenting is IMHO better than the `pre` tag. There is a button `{}` in the toolbar for that.
Comment: No worry. I used `` 'cause I needed **bold** to emphasize the change. I am not sure if there is any other way.
Comment: I understand. I changed it because I don't like to look at code without syntax-highlighting. I usually use comments to draw attention to specific code lines like ` somecode {} // <== I added this` like suggested http://meta.stackexchange.com/questions/32705/bold-code-in-a-question
Answer: You can try using AttachAware and it's attach method. You should implement AttachAware interface in your decorator and/or component.
Here's link to Angular.dart docs - https://docs.angulardart.org/#angular-core-annotation.AttachAware
To change the styling of a ShadowDom component you can use element.shadowRoot to get the root of your web component. Shadow root is almost like 'document' object. You can use shadow root to get reference to any element and then you can easily modify it by applying styles as needed.
You could use something like
this.element.shadowRoot.querySelector('[some-attr]').innerHtml = "Modified by decorator" // disclaimer: not tested, but I hope you get the idea.
Comment: @drasko-kokic, sorry, try using AttachAware and it's attach method instead of ShadowRootAware.onShadowRoot.
Comment: Interesting, I thought onShadowRoot would only work in a component.
Comment: Unfortunately `onShadowRoot` is not called in a `Decorator`.
Comment: Even with the latest Dart SDK 1.4.0 the `element.shadowRoot.querySelector` is never returning any object. Any working samples would be very helpful.
Answer: You can add a style tag to the shadowDom programmatically:
shadowRoot.append(new StyleElement()..text = ':host{background: red;}');

or
shadowRoot.append(new StyleElement()..text = "@import url('some.css')");


Trying to create a custom ArrayAdapter with ArrayList

Question: I'm trying to get ArrayList with different variables that i'm getting from a database to display in a customized listview
this is the main xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="View the balance sheet"
        android:textSize="29sp"
        android:id="@+id/view"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="36dp" />

    <ListView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/listView">

    </ListView>
</RelativeLayout>

this is the customized layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/description_names"
        android:text="description"
        android:layout_marginTop="25sp"
        android:layout_marginLeft="15sp"/>

     <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/values_names"
        android:text="value"
        android:layout_marginTop="25sp"
        android:layout_marginLeft="105sp"/>
</RelativeLayout>

this is the adapter, i wanted both the ArrayLists from the main activity but it's not working
class CustomAdapter extends ArrayAdapter<String> {

    CustomAdapter(@NonNull Context context, ArrayList<String> mDetails,ArrayList<String> mValues) {
        super(context,R.layout.custom_layout ,mDetails);
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        LayoutInflater inflater=LayoutInflater.from(getContext());
        View customView=inflater.inflate(R.layout.custom_layout,parent,false);
        String details=getItem(position);
        String values=getItem(position);

        TextView description_names=(TextView)customView.findViewById(R.id.description_names);
        TextView values_names=(TextView)customView.findViewById(R.id.values_names);
        description_names.setText(details);
        return customView;
    }
}

main activity
ListView listvIew=(ListView)findViewById(R.id.listView);
final  ArrayAdapter<String>array=new CustomAdapter(this,mDetails,mValues);

listvIew.setAdapter(array);
private ArrayList<String>mDetails=new ArrayList<>();
private ArrayList<String>mValues=new ArrayList<>();

V3Ref.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
    String value=dataSnapshot.child("records").child("values").getValue(String.class);
    Log.d(TAG, "onChildAdded: the value is"+value);
    mDetails.add(value);
    mValues.add(value);
    array.notifyDataSetChanged();
}

i'm getting values from the database then putting them in ArrayLists then i'm trying to display them in a customized listview but it's not working when i try to use the second Arraylist
Answer: adapter calls from your main activity should be like,
CusatomeAdapter adapter;
adapter = new CusatomeAdapter(mActivity,mList1 ,mList2);
mListview.setAdapter(adapter);

here is your adapter calss
public class CusatomeAdapter extends BaseAdapter {
    public ArrayList<String> mList1;
    public ArrayList<String> mList2;
    Activity activity;

    public CusatomeAdapter(Activity activity,ArrayList<String> mList1 , ArrayList<String> mList2){
        super();
        this.activity = activity;
        this.mList1 = mList1;
        this.mList2 = mList2;
    }

    @Override
    public int getCount() {
        return mList1.size();   //give the size of list here
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        LayoutInflater inflater = activity.getLayoutInflater();

        if (convertView == null) {
            convertView = inflater.inflate(R.layout.row_detail, null);
            holder = new ViewHolder();
            holder.tv_detail = (TextView) convertView.findViewById(R.id.tv_detail);

            //same way define another text view and set their value ..

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

        holder.tv_detail.setText(mList1.get(position).toString());
        return convertView;
    }

    private class ViewHolder {
        TextView tv_detail;
    }
}

Comment: i just tried but it's not showing the listView, the values aren't being display in that listView the whole page is still blank
Comment: are you getting 2 array list with value in to your adapter class ?
Comment: Show me the UI of list view row file what you want to inflate as a row file?
Comment: i'm not getting any listView at all; i'm just getting the values in the android monitor but they can't display at all in the emulator
Comment: Impossible thing! anyway first populate your listview with static data. if you didn't see static data in listview then it clearly seems that ,there is mistake in your xml file
Comment: it's working on one side the arraylist is being used and it's filling the listView but the other isn't        private ArrayListmValues=new ArrayList<>();        so when i use this public void onChildAdded(DataSnapshot dataSnapshot, String s) {
    String value=dataSnapshot.child("records").child("values").getValue(String.class);
    Log.d(TAG, "onChildAdded: the value is"+value);              mDetails.add(value);
    mValues.add(value);          }      the mDetails is showing something but mValues isn't @ Radhey


Max Payne No Gameplay on Windows 7

Question: I have a physical disc copy of Max Payne 1. The disc does not work with Windows 7. I searched many gaming forums and their answers have not given me any success.
The PC I'm trying to run it on has 8GB of Ram and a 1 TB HDD. The PC is running Windows 7 Home 64-bit.
I have installed Max Payne from the file directly on the disc called "Disk1" as suggested in many forums. I have run the setup application from "Disk1" with success of installing the program.
I have changed the resolution and the PC to 16 bit color mode. A Yes or No dialog box comes up when I click the Max Payne link on the Start menu. I click Yes to verify I accept the Max Payne application. The screen flashes and the time circle like the old sand hourglass comes up and spins.
A resolution change occurs that makes the desktop have larger icons. Then the desktop goes back to its more modern resolution.
Nothing happens after the screen flashes back to its regular resolution. Its like the Max Payne process or service stops completely.
Answer: The physical release uses SafeDisc DRM, no longer supported by Microsoft:
http://www.howtogeek.com/230773/how-to-play-pc-games-that-require-safedisc-or-securom-drm-on-windows-10-8.1-8-7-and-vista/
Publisher Rockstar actually "cracked" the game for the Steam release, it seems:

Max Payne No Gameplay on Windows 7


AFCI Trips When Stainless Steel Hoses Touch Washing Machine Cabinet. Why?

Question: I noticed the hot water hose on my washing machine (SpeedQueen Top Loader) was corroded, so I decided to replace the hoses.
I bought braided stainless steel hoses and installed them.
Everything worked fine, until I pushed the washer back to the wall and the AFCI tripped.
After some confusion, I discovered that if the braided stainless hoses touched the washer's cabinet the AFCI would trip.   The trip happens as soon as the unit is plugged in.
What would cause the AFCI to trip in this case?
The washer has a 3 prong plugged and metal cabinet.  The AFCI is a 15 AMP Murray Combo AFCI.  The LED indicates ARC fault on some trips.
I have done the following tests:
Current between cabinet and shut off valves
I checked for current between the cabinet and the brass shutoff values.  My multimeter shows less than 1.4 uAMPs of current but it fluctuates.  This is with the washer plugged in.   This is micro amps not mili Amps, so would not expect it to trigger the AFCI unless it is bad.
Appliance Cord
I checked each prong of the plug against the back of the washer.  Only the ground plug shows continuity. The neutral and load are fine.
Why is the AFCI tripping?
For now, I have replaced the stainless hoses with rubber coated stainless ones so we can use the washer.
Any insights into the problem would be helpful.   Want to note that this is a 1899, 3 story home with electrical upgrades done at various stages.  I bought the home 3 years ago.
Comment: Is there current elsewhere on your plumbing? i.e. feeding back *into* the washer via ground?
Comment: Is your breaker a combination device AFCI+gfci? What is the code on the breaker (lights that show what the fault was).  Do you have 3 wire from the service panel to the washing machine, last is your plumbing bonded to the ground of the service panel.
Comment: Plumbing is bonded to the panel.   We have 3 wire service to the washer and tested it with a simple plug tester.
The breaker is listed as a combo-AFCI which detects  line-to-ground, line-to-neutral and series arcs.  LEDs are inconsistent but usually arc fault.
Comment: I used an insulated wire to simulate the steel hose.  I ran it from the receptacle to the plumbing valves and it tripped.  I got the same result between the valves and the back of the washer.  The unit is on the 3rd floor and panel in the basement so not easy to run a ground test all the way to the panel.
Answer: Many new washing machines have inverter drives on then now, and those inverters create what's called "Common Mode Noise", electrical noise referenced to ground. The washer doesn't need to be running, just plugged in for the inverter to create CM noise.
I'd say that your ground connection to the outlet or in the machine is loose or missing, so the CM noise is discharging through the machine frame itself when it comes in contact with your plumbing. Think of it as if it were a static charge built up from walking on nylon carpet and you touch a metal surface. That discharge looks like an arc fault to the breaker.
Check that inside of your washer, the bonding jumper is connected. it will be a green wire going from the machine frame to the ground terminal that the cord is connected to. If that's OK, get a receptacle tester to make sure your receptacle is connected to ground.


How to upgrade GTK 3.18 to 3.20 on ubuntu 16.04?

Question: While trying to install lollypop I got this error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lollypop/container.py", line 79, in update_db
    self.__show_first_run()
  File "/usr/lib/python3/dist-packages/lollypop/container.py", line 335, in __show_first_run
    view = FirstRunView()
  File "/usr/lib/python3/dist-packages/lollypop/view_first_run.py", line 29, in __init__
    builder.add_from_resource("/org/gnome/Lollypop/FirstRunView.ui")
GLib.Error: gtk-builder-error-quark: .:3:50 Required gtk+ version 3.20, current version is 3.18 (7)

Answer: If you Google this, you will find guides like this and this. In addition, you will find that this has been asked before on this very site at least twice: once in 2016 and once in 2015.
Now, to be fair, I'm used to arch, which already ships with 3.20. Being maybe 1 year after the release of 3.20, I almost didn't believe the Ubuntu guides above. Really? Add a separate repository, including one with staging in the name? Nevertheless, it's true and the tl;dr is very simple:
sudo add-apt-repository ppa:gnome3-team/gnome3-staging
sudo add-apt-repository ppa:gnome3-team/gnome3
sudo apt update
sudo apt dist-upgrade

I did these exact steps today, rebooted for good measure, and enjoyed that my preferred openbox themes (which work fine on arch) were no longer messed up (due to 3.18, which I never would have suspected).
Comment: It's GNOME3. The question is about GTK3. Are they the same?
Comment: @Hendy sure. I understand. And pointing to places where you found information is very good. Also pointing out that the question has been asked and answered before, those are all good and helpful things to do. I just think you can do all that without saying 'google it'. That just sounds very condescending. And there's really no need for that.
Comment: Just as a point of information this is the first search result for [upgrade gtk to 3.20], so someone might land on this page after a reasonable effort to Google it. Thanks for the helpful links.
Comment: @DongNguyen I think it's just the name of the repository. Take a look at the [list of packages](https://launchpad.net/%7Egnome3-team/+archive/ubuntu/gnome3-staging/+index?field.series_filter=xenial&batch=75&memo=75&start=75) in said repository and you'll see an awful lot of `3.20` values for the versions, including `gtk+3.0`. So yes, I think the answer is accurate: adding this staging repo will updates one's gtk-relevant packages to `3.20`.
Comment: I thing that is for installing the whole Gnome3 DE.
Comment: You're welcome to try it and/or post your own answer. Note that none of the commands above involve `install pkgname`; so nothing is installed. It simply adds a repo which triggers `apt update` to see a newer version of relevant packages that are *already* installed, and it updates them.
Comment: 'google it'? Really? Well I did and it brought me here. I think it's really poor form to answer questions with something that starts with 'google it'. The rest of the answer is good though :-)
Comment: @kris Yeah, really. I only answered this because I'd done it myself based on other guides (that come up with google; just click my link). I think it's bad form to ask answered questions, and StackExchange seems to agree by closing duplicates. In fact, this 2017 question duplicates one from [2016](https://askubuntu.com/questions/830832/update-gnome-on-ubuntu-16-04) which duplicates one from [2015](https://askubuntu.com/questions/625244/how-to-upgrade-to-the-latest-gnome-version?noredirect=1&lq=1). All have the same info.
Comment: @kris Fair point. I toned it down just now, linked directly to the previous versions, and marked this question as a duplicate. Seem reasonable? Thanks for your input.
Comment: Facing segmentation fault on some apps after dist-upgrade, the ppa itself suggest to do ppa-purge for Ubuntu older than 18.04, see this: https://launchpad.net/~gnome3-team/+archive/ubuntu/gnome3-staging


How will Deja-Dup operates when backing up to an external USB drive?

Question: I want to set up regular backups, and deja-dup seems like a nice tool.  However, I want to put my backups on an extension USB drive that I have, not on a remote network location.  Naturally, this drive is not always connected.  If I configure deja-dup to backup to a directory on this drive (e.g. /media/extention/backup), what would happen?  Will it prompt me to connect the drive when it is missing (the desired behavior), or just fail silently?  Is there some way to tweak it to do so?
I can roll my own cron-based backup script that checks if this drive is mounted, but I would really prefer to use an existing, integrated tool.
Answer: Deja Dup will wait for you to connect your external drive. So, when your external USB drive is not connected, Deja Dup will show a Notification saying that "Backup will continue when <external USB drive's partition name> gets connected."
So, when you do connect your external drive, Deja Dup will start backup automatically. Otherwise, it will wait in the background till the drive is connected.
Comment: That is correct, but when I connect my drive and open DejyDup and press "start backup now" I get the error that I don't have the right permissions
Comment: I fixed that with the permissions like this: I created a folder `dejaDupBackup` on the USB drive as root and gave that folder to my user with `chown myuser dejaDupBackup`. Then I chose a non existing folder inside that folder on the USB by entering "dejaDupBackup/backup-" into the field in the settings of DejaDup
Answer: The only downside to this is it will nag you constantly until you connect the USB drive.  I set this up on my daughters laptop as a manual step.
I configured dejay dup as desired (daily) but left 'automatic backups' OFF.  I then made a script file to run deja-dup --backup and pointed a launcher to it.  She now runs the launcher after connecting the USB drive.  The first backup is long/intense but subsequent backups are short/quick.


apache fop can't get pdf with proper bytes written to

Question: I am trying to generate a pdf download file. I have the following code to generate pdf from xml and xsl-fo. Can anyone point me what I am missing in my code. When I open the pdf, it says corrupted and if I open that file using notepad++ all is see is [B@4bf24bf2 in the file.
public void generatePDF(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException {

        PortletContext portletContext = resourceRequest.getPortletSession().getPortletContext();

        URL url = portletContext.getResource("/WEB-INF/xsd/xsl-fo.xsl");

        File xsltfile = new File(url.getPath());

        StreamSource source = new StreamSource(new File(portletContext.getResource("/WEB-INF/xsd/service.xml").getPath()));

        StreamSource transformSource = new StreamSource(xsltfile);

        // Construct FopFactory
        FopFactory fopFactory = FopFactory.newInstance();

        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();

        // Create ByteArrayOutputStream
        ByteArrayOutputStream outStream = new ByteArrayOutputStream();

        // Setup JAXP using identity transformer
        TransformerFactory tfactory = TransformerFactory.newInstance();
        Transformer xslfoTransformer;

        try {

            xslfoTransformer = tfactory.newTransformer(transformSource); // identity transformer

            Fop fop;

            try {

                // Construct fop with desired output format
                fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, outStream);

                Result res = new SAXResult(fop.getDefaultHandler());

                try {
                    xslfoTransformer.transform(source, res);

                    byte[] pdfBytes = outStream.toByteArray();
                    resourceResponse.setContentLength(pdfBytes.length);
                    resourceResponse.setContentType("application/pdf");
                    resourceResponse.addProperty("Content-Disposition", "attachment;filename=fleetevents.pdf");
                    resourceResponse.getWriter().print(pdfBytes);
                    resourceResponse.getWriter().flush();

                } catch (TransformerException exception ) {
                    logger.log(Level.SEVERE, exception.getMessage(), exception);

                }

            } catch (FOPException fopException) {
                logger.log(Level.SEVERE, fopException.getMessage(), fopException);

            }
        }  catch(TransformerConfigurationException exception) {
            logger.log(Level.SEVERE, exception.getMessage(), exception);

        } catch(TransformerFactoryConfigurationError  exception) {
            logger.log(Level.SEVERE, exception.getMessage(), exception);

        }

    }

My sample xml
<?xml version="1.0" encoding="iso-8859-1"?>
<services>
    <service>
        <serviceId>11111</serviceId>
        <openDate>2012-02-16</openDate>
        <closeDate>2012-02-16</closeDate>
        <orderStatus>Status2</orderStatus>
        <description>INSPECT MACHINE</description>
        <repairCost>$266.76</repairCost>
    </service>
    <service>
        <serviceId>11111</serviceId>
        <openDate>2012-02-16</openDate>
        <closeDate>2012-02-16</closeDate>
        <orderStatus>Status1</orderStatus>
        <description>INSPECT MACHINE</description>
        <repairCost>$266.76</repairCost>
    </service>
</services>

and my sample xsf-fo.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output encoding="iso-8859-1" />
<xsl:template match ="services">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
        <fo:layout-master-set>
            <fo:simple-page-master master-name="service">
                <fo:region-body></fo:region-body>
            </fo:simple-page-master>
        </fo:layout-master-set>

        <fo:page-sequence master-reference="service">
            <fo:flow flow-name="xsl-region-body">
                <fo:block>
                    <fo:table>
                        <fo:table-body>
                            <fo:table-row>
                                <fo:table-cell border="solid 1px black"
                                text-align="center" font-weight="bold">
                                    <fo:block>Service Id</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="solid 1px black"
                                text-align="center" font-weight="bold">
                                    <fo:block>Open Date</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="solid 1px black"
                                text-align="center" font-weight="bold">
                                    <fo:block>Close Date</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="solid 1px black"
                                text-align="center" font-weight="bold">
                                    <fo:block>Order Status</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="solid 1px black"
                                text-align="center" font-weight="bold">
                                    <fo:block>Description</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="solid 1px black"
                                text-align="center" font-weight="bold">
                                    <fo:block>Repair Cost</fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <xsl:for-each select="./service">
                                <fo:table-row>
                                    <fo:table-cell border="solid 1px bold" text-align="center">
                                        <fo:block><xsl:value-of select="serviceId" /></fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="solid 1px bold" text-align="center">
                                        <fo:block><xsl:value-of select="openDate" /></fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="solid 1px bold" text-align="center">
                                        <fo:block><xsl:value-of select="closeDate" /></fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="solid 1px bold" text-align="center">
                                        <fo:block><xsl:value-of select="orderStatus" /></fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="solid 1px bold" text-align="center">
                                        <fo:block><xsl:value-of select="description" /></fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="solid 1px bold" text-align="center">
                                        <fo:block><xsl:value-of select="repairCost" /></fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                            </xsl:for-each>
                        </fo:table-body>
                    </fo:table>
                </fo:block>
            </fo:flow>
        </fo:page-sequence>
    </fo:root>
</xsl:template>
</xsl:stylesheet>

UPDATE
I think I got it, I need to use resourceResponse.getPortletOutputStream().write(pdfBytes);
resourceResponse.getPortletOutputStream().flush(); instead of resourceResponse.getWriter().print(pdfBytes); resourceResponse.getWriter().flush();
Answer: Looking at the definitions of getWriter() vs getPortletOutputStream(), it seems getWriter will return a PrintWriter that will only write text to the response.
Whereas PortletOutputStream will write binary data. Since you have quite a few special characters in your xml, I guess it is expected that Printwriter fails to do the job and PortletOutputStream succeeds:
http://portals.apache.org/pluto/portlet-2.0-apidocs/javax/portlet/MimeResponse.html


How to INSERT INTO SELECT by considering IF EXISTS rules in MySQL?

Question: In MySQL its possible to insert data retrieved from another table, e.g.:
INSERT INTO
    `table2`
    (
        `table2_id`,
        `foo`
    )
SELECT
    `id`,
    `foo`
FROM
    `table1`
WHERE
    ...
;

On the other side it's also possible to define an ON DUPLICATE strategy:

INSERT IGNORE statement
ON DUPLICATE KEY UPDATE clause
REPLACE statement

Now. How to combine both and insert data from another table, but handle duplications for every row? For REPLACE it's clear -- it works by just replacing INSERT by REPLACE in the query above. But how to apply the IGNORE and UPDATE behaviour by INSERTing data SELECTed from another table?
Comment: Is it just for mysql you need a MERGE operator . add what you don't have and change what you have ...
Answer: Such a combination is indeed possible:
basic query
INSERT INTO
    `table2`
    (
        `table2_id`,
        `foo`
    )
SELECT
    `id`,
    `foo`
FROM
    `table1`
WHERE
    ...

REPLACE
REPLACE INTO
    `table2`
    (
        `table2_id`,
        `foo`
    )
SELECT
    `id`,
    `foo`
FROM
    `table1`
WHERE
    ...

ON DUPLICATE KEY UPDATE
INSERT INTO
    `table2`
    (
        `table2_id`,
        `foo`
    )
SELECT
    `id`,
    `foo`
FROM
    `table1`
WHERE
    ...
ON DUPLICATE KEY UPDATE
    `foo` = `table1`.`foo`
;

INSERT IGNORE
INSERT IGNORE
    `table2`
    (
        `table2_id`,
        `foo`
    )
SELECT
    `id`,
    `foo`
FROM
    `table1`
WHERE
    ...
;


Making a  slideshow

Question: I am looking to create a  slideshow. What I mean by that is that I want to create one of those things that you sometimes see on websites where you have a row of buttons at the bottom, and clicking on those buttons fades you to an image or a  element, but if you do not touch those buttons, they switch in order between one another. How can I make something like this? I am new to web development, and help would be much appreciated. I am aware that this task will require JavaScript, however I would like to avoid jQuery if at all possible, I will still consider suggestions made using jQuery, so please don't hesitate to post them.
Thank you.
Answer: I don't believe there is any way to do this with HTML/CSS alone, though I could be wrong. When I was first starting web development I found it useful to look at code from Twitter Bootstrap to figure out how they managed to create certain effects/elements.
If I understand what you want correctly, I think you are looking for Carousel. Take a look at that and hopefully it'll help. You can even use bootstrap if you'd like.
Good luck.
Comment: @MituIP91 Thank you for the suggestion. The link that you gave is exactly what I am looking for, but I would rather have an image fade as opposed to the sliding effect that the example that you showed gives.
Answer: Google Jquery Sliders or Gallerys.
Or CSS sliders

http://www.queness.com/post/14329/pure-css3-sliders-and-tutorials
http://vandelaydesign.com/blog/tools/awesome-jquery-sliders/

You dont need to know any jquery to be able to get a working slider. Read the Documentation and look at the example files to get started. If you use jquery make sure you link your files to the document correctly.
Comment: Thank you. I would like to try making one myself, but I will use these as resources in order to do so.
Answer: Here is a very simple jQuery carousel which slides automatically.
EXAMPLE
The code is very simple and easy to use as well.
HTML
Just a DIV with images inside

CSS
CSS is pretty straight forward as well
#banner_area img
{
    display:none;
    position: absolute;
}
#banner_area img:first-child
{
    display:block;
}
#banner_area > img /* Use this to resize all image's container */
{
    width:400px;
    height:250px;
}

JavaScript
Don't forget to include jQuery as well // You can increase/decrease the time
function cycleImages() {
    var images = $('#banner_area img'),
        now = images.filter(':visible'),
        next = now.next().length ? now.next() : images.first(),
        speed = 1000;

    now.fadeOut(speed);
    next.fadeIn(speed);
}

$(function () {
    setInterval(cycleImages, 1400);
});

Making a  slideshow


Optimizing shared array access with temporary volatile qualifier

Question: I was wondering if in the following scenario a temporary volatile qualifier would yield correct behavior. Assume an ISR collects values in an array and once enough values have been collected it signals readiness.
int array[10]; // observe no volatile here
int idx = 0;   // neither here
volatile bool ready = false; // but here

Here's the ISR is pseudo-code
ISR() {
  if (idx < 10)
     array[idx++] = ...;
  ready = (idx >= 10);
}

Assume we can guarantee that array will be read only after ready is signalled, and elements are accessed via specific method only:
int read(int idx) {
  // temporary volatile semantics
  volatile int *e = (volatile int*)(array + idx);
  return *e;
}

which seems to be allowed according to cpp-reference

A cast of a non-volatile value to a volatile type has no effect. To access a non-volatile object using volatile semantics, its address must be cast to a pointer-to-volatile and then the access must be made through that pointer.

For completeness the main routine does the following
void loop() {
   if (ready) {
     int val = read(0); // Read value
     // do something with val.
   }
}

In such a scenario should I expect to read correct values from array or is volatile on the array elements required to guarantee that writing to the array from within ISR() is actually performed in RAM?
Note that Why is volatile needed in C? does not detail whether or not in this special case volatile is needed.
Comment: Possible duplicate of [Why is volatile needed in C?](http://stackoverflow.com/questions/246127/why-is-volatile-needed-in-c)
Comment: ISR = Interrupt Service Routine = non=portable anyway. Check your compiler documentation.
Comment: `volatile` prevent only compiler optimization. Does not take of variable access.
Answer: The write to array[] is not through volatile, so you can't rely on that being observable behavior. Yes, the compiler must issue a non-cached read of array, but that is only half of the picture.
You're talking about order as if that's affected by volatile - it isn't.
Comment: But the compiler has to execute the write no matter if the array is volatile or not. There is no way for the compiler to deduct that "this written value is never read so I can skip the write" - it should rather deduct the opposite. Though I suppose that if the array is written in one translation unit and read in another, it might complicate the matter? Suppose the array was declared as `static`, guaranteeing that read/writes must be in the same translation unit?
Comment: @Lundin exactly what I was thinking / hoping. The writes have to take place and by forcing volatile reads later on (in a non time critial path of execution) everything would be fine...
Comment: @Lundin: By that logic "the compiler also has to execute all reads, there's no way it can detect a new value was written". You're trying to reason `volatile` away. As for `static`, that's insufficient. A compiler would need to do escape analysis to see if a pointer is leaked.
Comment: Umm... no? The read in this case definitely has to be executed, because of the volatile qualifiers. If not for that, the compiler would of course be free to skip it. The very question here is if the write becomes mandatory because of the volatile access read.
Comment: @Lundin: The analogy was that "If writes must be performed even in the absence of `volatile`, then reads without `volatile` must also be executed.". But no, a `volatile` read does not force a `volatile` write, if only  because the `volatile` read might be paired with another `volatile` write in another TU. The compiler cannot assume these two operations are paired.
Comment: To get back to my original comment, the compiler can't very well optimize away a write if it can't deduct that the variable isn't used. This is very clear in the C standard: "An actual implementation need not evaluate part of an expression if it can deduce that its value is not used and that no needed side effects are produced". The compiler can deduce no such thing here, so if it would optimize away the write, it wouldn't be conforming. Now of course, the compiler might be dumb and not realize that the ISR is executed, in which case the code will break for that reason.


double area integrals over coherence functions on circles

Question: I am having trouble showing the following, which shows up from coherence theory:
$\frac{\pi b^2}{\alpha^2}(1-J_0^2(\alpha b)-J_1^2(\alpha b))=\int_0^{2\pi}\int_0^b\int_0^b r_1r_2\frac{J_1\left (\alpha\sqrt{r_1^2+r_2^2-2r_1r_2\cos(\theta)}\right )}{\alpha\sqrt{r_1^2+r_2^2-2r_1r_2\cos(\theta)}} dr_1dr_2d\theta$
Where $J_n$ is the nth order Bessel function of the first kind. The result is so nice, but I can't find a way to show it. Can anyone provide some help in showing this equality?
Answer: In answer to my own question, the equality can be shown as follows. First, we realize that $\int_0^{2\pi}\int_0^b\int_0^b r_1r_2\frac{J_1\left (\alpha\sqrt{r_1^2+r_2^2-2r_1r_2\cos(\theta)}\right )}{\alpha\sqrt{r_1^2+r_2^2-2r_1r_2\cos(\theta)}} dr_1dr_2d\theta\\=\frac{1}{2\pi}\int_0^{2\pi}\int_0^{2\pi}\int_0^b\int_0^b r_1r_2\frac{J_1\left (\alpha\sqrt{r_1^2+r_2^2-2r_1r_2\cos(\theta_1-\theta_2)}\right )}{\alpha\sqrt{r_1^2+r_2^2-2r_1r_2\cos(\theta_1-\theta_2)}} dr_1dr_2d\theta_1d\theta_2$
From here we notice that $\sqrt{r_1^2+r_2^2-2r_1r_2\cos(\theta_1-\theta_2)}$ is the distance between two particular points in the circle of radius $b$. Let that distance be denoted as $L$.
Then we have
$\frac{1}{2\pi}\iint_{A_1}\iint_{A_2}\frac{J_1(\alpha L)}{\alpha L} dA_1 dA_2$.
We can write this instead as
$\frac{(\pi b^2)^2}{2\pi}\int_0^{2b}\frac{J_1(\alpha L)}{\alpha L}p(L) dL$, where $p(L)$ is the probability density of choosing two points of distance $L$ within a circle of radius $b$. This probability density is well known. See for instance equation (5) of Ricardo García-Pelayo 2005 J. Phys. A: Math. Gen. 38 3475 doi:10.1088/0305-4470/38/16/001 and references therein.
We have $p(L)=\frac{L}{\pi b^2}\left ( 4\cos^{-1}[d/(2b)]-L\sqrt{4b^2-L^2}/b^2 \right ), 0\leq L \leq 2b$
The integral can now be easily evaluated and gives the required equality.
This technique is usable any time the integrand is a function of only one parmater, like L in this case.


How do I speak to my companion?

Question: I just finished up the last quest on Korriban, and my companion, Khem Val keeps saying, "I want to speak with you."
So... I right click him, and he says: "I want to speak with you."
So, I'm at a loss. How do I speak with the big lug?
Answer: You need to go to a private place, such as your ship or a cantina.
Answer: You'll need to find some privacy before your companion will open up to you.
In other words: once you get your own ship, speak to them there.
Comment: Until you get your own ship, a Cantina suffices (as David mentions)
Comment: Going to accept David's answer, because a ship is not yet available to me.
Answer: One exception to the cantina rule is the small cantina in the Senate Tower on Coruscant.  My companion refused to talk to me there, so I had to take him to the other Cantina, the one in the Market Sector.  Once they are in the right area a quest marker will appear over their head and you can right click to start the conversation.

How do I speak to my companion?


setImageViewUri from URL on remote view in android widget

Question: I try to set image from url with remote view. Here is the code that i use :
<code>   rv = new RemoteViews(mContext.getPackageName(), R.layout.widget_item_default);
    WidgetItem item = mWidgetItems.get(position);
    rv.setImageViewUri(R.id.imageDeal, Uri.parse(item.urlImage));
</code>
And the code of the layout :
<code> <ImageView
     android:id="@+id/imageDeal"
     android:layout_width="fill_parent"
     android:layout_height="80dp"
     android:layout_marginBottom="2dp"
     android:layout_marginLeft="4dp"
     android:layout_marginRight="4dp"
     android:adjustViewBounds="true"
     android:scaleType="centerCrop"
     android:src="@drawable/mem" />
</code>
Widget is launched but there is no image printed in the imageView.
Answer: Your question is answered here: https://groups.google.com/forum/?fromgroups=#!topic/android-developers/jupslaeAEuo
Comment: This did not help me out. This is what I tried with it: http://pastebin.com/1Jk6zKPr
Comment: I use setImageViewUri, it doesn's show picture but show background of imageview
Comment: That sucks. But hey, widgets really aren't worth developing
Comment: This link is been reported to google as dangerous :S, Website is not accessible
Comment: The link is been removed now? I have no permissions this is strange
Answer: <code>FutureTarget<Bitmap> futureTarget = Glide.with(mContext)
                            .load(resizedImageUrl)
                            .asBitmap()
                            .into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
                    try
                    {
                        rv.setImageViewBitmap(R.id.icon, futureTarget.get());
                    } catch (InterruptedException | ExecutionException e)
                    {
                        e.printStackTrace();
                    }
                    Glide.clear(futureTarget);
</code>


Are there algorithms for generating aesthetically pleasing scatter plots?

Question: I'm tinkering around with making a bokeh generator.
Currently, all the positions are random, but the results are not often visually pleasing.
It seems that what looks good is having around 3 'clusters' somewhat spaced out.
Are there any algorithms for generating scatter plots with constraints like that? I feel like this should be a solved problem, but I'm not familiar with this area (I have very little math background) and I'm not sure where to start looking.
Looks decent:

Too scattered:
:
Too clustered:
Comment: The second and third ones look fine to me. There's no mathematical solution here because aesthetics are not a mathematical concept. You did suggest that this is graph generation with "constraints", but you don't actually *have* any constraints, not ones that are precise enough for mathematics. I would ask this on StackOverflow.
Answer: This is really vague, but you could make a circle, then turn 60 degrees in a random direction and plot another circle, then turn 60 to somewhere and another, etc. This should theoretically give a nice little triangle dot pattern. Postulating here.
Answer: I do not know if such algorithms exist but here is an untested heuristic. You want to identify clusters and discourage circles that don't belong to chosen clusters. You could choose distances $a$ and $b$ ($a<b$) such that two circles separated by $a$ are close while two circles separated by more than $b$ are far. The difference $b-a$ may be the common radius of the circles. Consider a cluster to be a maximal group of circles such that you cannot divide the group into two subgroups of circles such that no circle in one group is close to any circle in the other subgroup.
Also choose a low probability $p$ with which you will allow a circle even if it violates $3$ cluster requirement. Start with $0$ clusters. Randomly generate circles. A circle stays if it is close to a circle from one existing cluster but is far from all circles in other clusters. It also stays and forms a new cluster if it is far from all existing circles and there are less than three clusters before the current circle is added. Even if the circle does not satisfy the previous two requirements, it may be retained with probability $p$ but would be ignored in future comparisons for inclusion of new circles. Stop when each of the 3 clusters has a certain minimum number of circles.


Solving two limits(possibly L'Hospital's rule)

Question: So i have two limits that i want to solve, so i will put them together in one question, while both are probably solved with help of L'Hospital's rule. I am not sure for the second one.
1)
$$ \lim \limits_{x\to 0}\left( \frac{e^{4}\left( 1-x^{2}\right) ^{\frac{1}{x^{2}} }}{\left( 1-2x\right) ^{\frac{1}{x} }} \right) ^{\frac{1}{x} } $$
I am having problems with this one to make it into one that can be used for L'Hospital's rule, but i cannot get it into $\frac{0}{0}$, there are others options as well, but i am stuck.
2)
$$\lim_{n\rightarrow \infty}(\frac{\arcsin(\frac{1}{n})+\arcsin(\frac{2}{n})+...+\arcsin(\frac{n}{n})}{n})$$
So i thought i could solve this one even if i used comparing test, but i cannot fins a way, but this one is probably not solved with L'Hospital rule, because of $n$, but i put it in one question, because i found both limits in the same group. I apologize for putting them in the same question if they differ too much.
Any help would be appreciated. Thank you in advance.
Comment: The second is a Riemann sum.
Comment: In the first limit use $\lim_{t\to 0}(1+at)^{1/t}=e^a$.

By the way, in the first one you have $x\to 0^+$?
Comment: For the first one, are you allowed to use Taylor series ?
Comment: on the first one I was looking at taking log, then putting x^3 in the denominator with x^3 multiplied through the top as needed, then you'd need to differentiate 3 times I think
Comment: @RobertZ it's just $x\rightarrow 0$
Comment: @ClaudeLeibovici yes probably it would be allowed, but i was looking for a simpler approach
Comment: Please, do not ask two unrelated questions as one
Answer: Second one:
$$L=\lim_{n\rightarrow \infty}(\frac{arcsin(\frac{1}{n})+arcsin(\frac{2}{n})+...+arcsin(\frac{n}{n})}{n}),$$
$$L=\int_0^1 \arcsin{x}dx=(x\arcsin{x}+\sqrt{1-x^2})|_0^1=\frac{\pi-4}{4}.$$
Answer: As regards the first limit, by using $\lim_{t\to 0}(1+at)^{1/t}=\lim_{s\to +\infty}(1+a/s)^{s}=e^a$ we have that
$$\lim \limits_{x\to 0}\left( \frac{e^{4}\left( 1-x^{2}\right) ^{\frac{1}{x^{2}} }}{\left( 1-2x\right) ^{\frac{1}{x} }} \right)=\frac{e^4\cdot e^{-1}}{e^{-2}}=e^5.$$
So the base of the exponential is eventually greater then $2$ (something $>1$ and less than $e^5$).
If $x\to 0^+$ then for $0<x<r$ for some $r>0$,
$$+\infty \leftarrow 2^{1/x}<\left( \frac{e^{4}\left( 1-x^{2}\right) ^{\frac{1}{x^{2}} }}{\left( 1-2x\right) ^{\frac{1}{x} }} \right) ^{\frac{1}{x} }$$
If $x\to 0^-$ then for $-r<x<0$ for some $r>0$,
$$0 <\left( \frac{e^{4}\left( 1-x^{2}\right) ^{\frac{1}{x^{2}} }}{\left( 1-2x\right) ^{\frac{1}{x} }} \right) ^{\frac{1}{x} }<2^{1/x}\to 0.$$
Therefore you have different behaviours for $x\to 0^-$ and $x\to 0^+$ and the limit for $x\to 0$ does not exist!
Answer: For the first if $x \to 0$ then the limit does not exist. To prove this let us observe that $$(1 - x^{2})^{1/x^{2}} \to e^{-1}, (1 - 2x)^{1/x} \to e^{-2}$$ as $x \to 0$ and hence $$f(x) = \left(\frac{e^{4}(1 - x^{2})^{1/x^{2}}}{(1 - 2x)^{1/x}}\right) \to e^{5} > 1$$ and $g(x) = 1/x \to \infty$ as $x \to 0^{+}$ so $\{f(x)\}^{g(x)} \to \infty$ as $x \to 0^{+}$.
But when $x \to 0^{-}$ then $g(x) \to -\infty$ and hence $\{f(x)\}^{g(x)} \to 0$ as $x \to 0^{-}$. It follows that the desired limit does not exist. In the above we have used the following standard limits $$\lim_{x \to 0}(1 + ax)^{1/x} = e^{a},a^{x} \to \infty\text{ as }x \to \infty\text{ if }a > 1$$
The second limit is a Riemann sum and can be evaluated easily (as explained in answer from alans).
Answer: Just for your curiosity.
Since you have received nice and simple answers for the first problem, let me show what could be done with Taylor series.
Considering $$A=\left( \frac{e^{4}\left( 1-x^{2}\right) ^{\frac{1}{x^{2}} }}{\left( 1-2x\right) ^{\frac{1}{x} }} \right) ^{\frac{1}{x} }$$ $$\log(A)=\frac 1x\,\log\left( \frac{e^{4}\left( 1-x^{2}\right) ^{\frac{1}{x^{2}} }}{\left( 1-2x\right) ^{\frac{1}{x} }} \right)=\frac 1x\,\left(4+\frac 1{x^2}\log(1-x^2)- \frac 1x \log(1-2x)\right)$$ Now, using the fact that around $y=0$ $$\log(1-y)=-y-\frac{y^2}{2}+O\left(y^3\right)$$ we then have $$\frac 1{x^2}\log(1-x^2)=-1-\frac{x^2}{2}+O\left(x^3\right)$$ $$\frac 1x \log(1-2x)=-1-x-\frac{4 x^2}{3}+O\left(x^3\right)$$ All the above makes $$\log(A)=\frac 1x\,\left(4+x+\frac{5 x^2}{6}+O\left(x^3\right)\right)=\frac{4}{x}+1+\frac{5 x}{6}+O\left(x^2\right)$$ So, when $x\to 0^+$, $\log(A)\to \infty$ and $A\to \infty$
Answer: Second limit:
$$\lim_{n\to\infty}(\frac{arcsin(\frac{1}{n})+arcsin(\frac{2}{n})+...+arcsin(\frac{n}{n})}{n}) = 0$$
Although being quite tricky and taking some time for me to wrap my head around, you can actually use L'Hospitals rule on the second limit because its already in $$\lim_{x\to\infty}=\frac{\infty}{\infty}$$ since the limit of the bottom is seen to be infinity and the limit of the top $$\lim_{x\to\infty}\sin(1/x)+\sin(2/x)....$$ also approaches infinity because this is just adding a bunch of numbers between 0 and 1 and the greater value of x the more numbers it adds between 1 and 0 and approaches infinity.
From this we can create the series for the top of the fraction in the limit: $$\lim_{x\to\infty}\sum_{n=1}^x\arcsin(\frac{n}{x})$$ From here we apply L'Hopitals. To take the derivative of the sum you just take the derivative of the formula which is the same as taking the derivative of each value in the sum. Our limit after L'Hospital becomes:
$$\lim_{x\to\infty}\frac{\sum_{n=1}^x -\frac{n}{x^2\sqrt{(1-\frac{n^2}{x^2})}}}{1}$$
from this take the limit of the first value $$\lim_{x\to\infty}-\frac{1}{x^2\sqrt{1-\frac{n^2}{x^2}}} = 0 $$and last value which n = x so $$\lim_{x\to\infty}-\frac{x}{x^2\sqrt{1-\frac{n^2}{x^2}}} = -\frac{1}{x\sqrt{1-\frac{n^2}{x^2}}} = \lim_{x\to\infty}\frac{1}{x} = 0$$ The limit of the start and end of the sum is 0 and every limit value in between that has to be in between the start and end value since n is increasing linearly so every value is 0. Therefore the limit finally is simplified to top and bottom limit as $$\frac{0}{1}$$ so the limit can be concluded to equal zero.
Answer: Hint: For #1, substitute $t=1/x$ then use the limit definition of $e^x$.
For #2, it is a riemann sum.
Comment: @MathIsTheWayOfLife see above
Comment: what do you mean with limit definition of $e^x$ ?
Comment: $$\lim_{t\to\infty}(1+k/t)^t=e^t$$


Can i turn a light switch into an outlet?

Question: Ok so here's the deal, I have a light that is controlled by two switches. One is in my bathroom and the other is in my hallway where the light is located.  I would like to eliminate the switch in the bathroom and replace it with an outlet that is hot all the time.  First of all, can this even be done?  If so how do I go about doing this.
Comment: Maybe.  Probably.
Comment: Where is this light, and can you get us photos of the inisdes of the boxes involved?
Comment: Whether and exactly how you can do this depends on which items are currently connected by cables and where the power comes in to the circuit. If power is delivered to one of the switches then your proposal is possible. If power comes in to the lamp  first and there is no cable between the switches then your proposal is possible. If power comes in to the lamp first, and the lamp is cabled to one of the switches, and there is a cable between the switches, then the existing number of conductors is not sufficient to do what you want, and you will need to pull another wire.
Comment: A.I.Brevelri this should be an answer.
Comment: @Ed: Well if Doug comes back with the info on what cables go where then I'll answer the second part of his question, i.e. how to wire it. If he doesn't come back in 24 hrs then I'll make my comment an answer.
Comment: Doug, you've edited your post from a duplicate account. Please log in as you before further activity.
Comment: What is your location? The answers so far seem to indicate that this is allowable in the US. From my (admittedly limited) experience I do not believe running an outlet from a lighting circuit would be legal in the UK, but I could be wrong. It is certainly the case that all wiring in a bathroom in the UK must be done by a certified electrician, which I somehow doubt you are.
Comment: Also, is there a small appliance circuit already in this bathroom?  If there isn't, you may have to pull a new 20A homerun anyway...
Answer: First, is this legal?. NEC requires switches in certain specific locations.   What's more, some cities also require switches in cetain locations.   Not least, that's so emergency responders can get the lights on, so an EMT can treat you, or a cop doesn't shoot your son because she can't see that's a computer mouse.  Run this by your electrical inspector.
Ok then.
Turn off the circuit.  Look inside the lamp box. Is there 3-wire  (black white red) cable there?
We know there is 3-wire cable inside the switches, because that's how those switches work.
If this is on conduit we'll have to revisit.  But assuming this is done in cable... The 3 colors are always black white red.   Right mow the colors mean gibberish.  We will give the colors meaning.  And that means every place those 3-wire cables go, must be rewired.  The new meanings will be:

Black -- always-hot (no surprise there)
White -- actual neutral
Red - switched-hot

You must studiously follow this code everywhere in this network of 3-wire cable, or you'll get the sparky boomy.  now each device gets wired to the wires it wants:

switches get connect 2 wires to always-hot black and switched-hot red. If you are reusing 3-way switches, make sure to use a black screw, a brass will go unused.
receptacles get always-hot black on the brass screws, and neutral white on the silver screws.
lamps take switched-hot red and neutral white.   They usually have pigtail wires; the black or brown wire is switched-hot (red).  The white or light blue wire on the lamp goes to neutral.

After that, you wirenut-join all wires of the same color (remembering one lamp wire counts as red).
If you have any single wires left dangling, put a smaller wire-nut on them and tape them to keep the wirenut from falling off (they love to fall off singles).
Answer: Whether and exactly how you can do this depends on which items are currently connected by cables and where the power comes in to the circuit.
If power is delivered to one of the switches then your proposal is possible. If power comes in to the lamp first and there is no cable between the switches then your proposal is possible.
If power comes in to the lamp first, and the lamp is cabled to one of the switches, and there is a cable between the switches, then the existing number of conductors is not sufficient to do what you want without pulling another wire. In particular, you will need to replace the 12/2wG between the lamp and the switch with 12/3wG.

This is the most likely of the nine ways that a three-way single-light would commonly be connected:

If your cabling looks like this then you can change the bathroom switch to an outlet like this:

Note that you don't have to purchase a two-way switch. Just use one of the traveler terminals and ignore the other.
Other cases would be handled similarly. Basically you abandon the original purposes of the wires and re-use them to construct two adjacent circuits.
I have not drawn in the fault ground wires. These are always just connected all together and connected to every metal junction box and to every ground screw that you can identify.

A final word: using electricity near water, as in a kitchen or bathroom, is considered particularly dangerous. Make every attempt to properly ground your new outlet. At the very minimum, use only GFCI outlets in bathrooms, kitchens, and laundries.
Comment: If power comes into the light first with a 3 way switch, then there needs to be a /3 cable to each switch location (either line or load + both travellers need to be present at the switch location)
Comment: @ThreePhaseEel: Correct -- assuming there is no cable running between the switches, i.e. assuming **switch====light(power)====switch**. But also possible is **light(power)------switch====switch**, with the entire three-way replacing the switch in a simple switch loop.


Can I replace the engineer's I-Beam recommendation with a different one?

Question: I'm removing a load bearing wall and the structural engineer recommended a W8x15 steel I-beam.  It would save me a lot of effort if I could use a 6" beam instead.  So I'm trying to calculate the deflection of the W8x15 beam and then find a W6x?? beam with similar deflection.
I've found the specs for various wide flange beams here, but I can't find a max deflection equation that uses the elastic section modulus provided in the specs.
So, can someone point me in the right direction?
Comment: I suppose there was a reason you hired, and presumably paid, and engineer for his recommendation.  Generally an engineer will specify the minimal-sized components to support the loads.  So you now want to save money by using something smaller than what the engineer specified.  That doesn't sound wise to me.  Why don't you go back to your engineer and see if a W6 could be used instead of a W8?
Comment: Not an engineer, but if I read that chart correctly a W6-25 should be equally or more robust. You should talk to your engineer.
Comment: there is a possibility that an insurance company could use the fact that you did not follow the engineer's design to void your claim if something happened to the house .... you may want to have the engineer certify the use of the new beam
Comment: Not sure what you are doing .Or how far a span you want open. Could you live with one center post.  Or not a  option .  And if you go to the  W-6 , do you loose ,head room. They do have a blind header. were the beam goes post to post. And  the framing hangs on that,giving you a flush ceiling look and you do not see beam. Works on 2nd  floor.            with of beam goes into attic.
Comment: What is the span?
Comment: The span is 16 feet.  The reasons as to why I would prefer 6" over 8" gets complicated, but cost is not the reason.
Answer: I think I figured it out.  I was thrown off by the Elastic Section Modulus.
Anyway, the deflection is calculated using the following parameters:
W = load
L = length
E = Young's Modulus
I = moment of inertia
And the equation for max deflection is:

I'm trying to find a beam with the same maxdef or smaller.  I can ignore W and L because they are the same regardless of I-beam.  Young's Modulus E is a property of the steel used, so it is also the same regardless of I-beam and can be ignored (this is what I misunderstood).  This means, the only variable I have to worry about is I.  I can see in the equation that I is part of the denominator, so if I increases, deflection decreases.  So I just need a W6 beam with a larger I than what the W8x15 beam has.
Final answer:  The only W6 beam with a greater I than the W8x15 beam is the W6x25,
Comment: If something happens it'll all be on you. The engineer didn't sign off on this. You still need to go back to him.
Comment: The responsibility is all on me anyway because I didn't pay the engineer to produce proper drawings because it would triple the cost of the beam project. That was also his recommendation for a DIYer.  I did confirm my changes and math with the engineer so this answer is the correct answer and the downvotes are wrong.  I understand the comments questioning my judgement and I think they are healthy. But downvoting the correct answer just creates misinformation.


How to make a link preview for discord

Question: Im very new to html and im wondering how to do people do this with their site? https://i.leastrio.net/CVUCo5PIR6.png I would like to do this with my site but im very confused. Thanks!
Comment: link is broken, which makes this question almost useless
Answer: Technical Background
Many social network such as Discord generate link previews by grabbing the metadata of the web page. Most of the time they grab the following metadata.
<code><meta property="og:type" content="website">
<meta property="og:url" content="https://linkfork.co/">
<meta property="og:title" content="LinkFork | Link Preview Customization">
<meta property="og:description" content="LinkFork lets you shorten, and customize how your link will appear when shared on social media, for free.">
<meta property="og:image" content="https://linkfork.co/images/poster.png">
</code>
So to change this for your website you need to be able to modify the HTML source code. Each social network grabs different metadata. Therefor you need to modify it for the all social network you are targeting.
Easy Solution
One easy solution is using a service that allows you to customize the link preview for any link such as LinkFork. LinkFork will allow you customize the image, title, and description of the link preview. It will generate a shorten link that you can post to any social network and have consistent link preview for all your social media.
Comment: LinkFork.co no longer seems to exist.
Comment: One thing to keep in mind while attempting to set this up is that the website must be using SSL and be using the appropriate chain link certificate in addition to the certificate itself and the key. Without the chain link certificate, this functionality will not work on Discord, iMessage, Facebook, Twitter, etc.

How to make a link preview for discord


When will zfs 0.7 be available

Question: ZOL 0.7 has been released a while ago now, and I'm wondering when this will be included in Ubuntu. I have not found a PPA for 0.7 and it does not appear to be in Artful, so I assume it's not coming in 17.10, but is it going to be in 18.04?
There have been a lot of useful changes, mostly hardware acceleration that I would really like to have.
Comment: Sorry? https://launchpad.net/~zfs-native/+archive/ubuntu/daily
Comment: Aside from that, it doesn't look like their packaging repository has released official packages for 0.7 yet: https://github.com/zfsonlinux/pkg-zfs/releases, so presumably everybody else is waiting on them.
Answer:
And I'm wondering when this will be included in ubuntu

When it is considered stable and zfs 0.7 is not stable yet.

I have not found a ppa for 0.7

But there is one. Personal archive to add 0.7 to your system ...
sudo add-apt-repository ppa:zfs-native/daily
sudo apt-get update

And yes: this is experimental. So prepare for failure, like a wiped disk.
See their launchpad page on comments on this. Last update was 4 weeks ago so someone is waiting on someone ;)
Another method of adding this ...
deb http://ppa.launchpad.net/zfs-native/daily/ubuntu trusty main
deb-src http://ppa.launchpad.net/zfs-native/daily/ubuntu trusty main

Leave the "trusty" as is and it will install. Mileage may vary though as it was not intended for other releases.
Stable version should be used (and that is 0.6.5). Personal archive:
sudo add-apt-repository ppa:zfs-native/stable
sudo apt-get update

And in case anyone wants to know what zfs is: wikipedia on zfs ...

ZFS is a combined file system and logical volume manager designed by Sun Microsystems. The features of ZFS include protection against data corruption, support for high storage capacities, efficient data compression, integration of the concepts of filesystem and volume management, snapshots and copy-on-write clones, continuous integrity checking and automatic repair, RAID-Z and native NFSv4 ACLs.

and this specifically on Ubuntu:

Ubuntu integration
The question of the CDDL license's compatibility with the GPL license resurfaced in 2015, when the Linux distribution Ubuntu announced that it intended to make precompiled OpenZFS binary kernel modules available to end-users directly from the distribution's official package repositories.  In 2016, Ubuntu announced that a legal review resulted in the conclusion that providing support for ZFS via a binary kernel module was not in violation of the provisions of the GPL license.  Others followed Ubuntu's conclusion,  while the FSF and SFC reiterated their opposing view.
Ubuntu 16.04 LTS ("Xenial Xerus"), released on April 21, 2016, allows the user to install the OpenZFS binary packages directly from the Ubuntu software repositories.  As of April 2017, no legal challenge has been brought against Canonical regarding the distribution of these packages.
Comment: This PPA only provides packages for Trusty, or am I mistaken there? OP didn't mention his Ubuntu version, but I suppose he meant a PPA for 16.04 or 17.04.
Comment: Yes, but you can change the distro See technical details about this PPA on https://launchpad.net/~zfs-native/+archive/ubuntu/daily
Comment: I did not know it wasnt stable yet, if you look at the release page: https://github.com/zfsonlinux/zfs/releases they released 0.7.1 already, and the tarballs are there to download. I might just build it myself :)
Comment: With stable we mean "stable for Ubuntu" ;-)
Comment: 0.7 is way more stable than 0.6.5x
Comment: There seem to be no technical details.
Answer: The current beta of Ubuntu 18.04 is shipping with ZoL 0.7.5: https://packages.ubuntu.com/bionic/zfs-dkms

When will zfs 0.7 be available


angularjs checkbox ng-checked not working

Question: I have the following code :-
<!DOCTYPE html>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

        <form>

              Select basket :
              <select id="selectedBasket" class="form-control" ng-model="selectedBasket" ng-options="b.name for b in baskets">
              </select>

                <input type="checkbox" value="" ng-checked="selectedBasket !== null && selectedBasket.items.indexOf(f) !== -1">
                  {{ f }}

        </form>

if I select Mary or Jane, I can correctly see the correct items in their basket checked. However if I manually check all the fruits and then look at Mary or Jane, it doesn't exclude the items that are not in their baskets. Why is ng-checked failing?
Bonus question, is it best practise to set selectedBasket to null and checking for null in a directive assuming I want nothing as a default value, is there a better way?
Answer: You've got no ng-model in your checkbox so your manual action isn't registered anywhere.
ng-checked is only used to make a 'slave' checkbox it can take no manual action.
My guess is you should use a ng-model initialized to your ng-check value instead of using a ng-checked.
If you want to keep your ng-checked what you can do is :
<input type="checkbox" ng-click="selectedBasket.items.push(f)" ng-checked="selectedBasket !== null && selectedBasket.items.indexOf(f) !== -1">

in fact it's still wrong... must be tired, use a toogle function in your ng-click which add or remove the item should be better...
Comment: I know, but the point is why is ng-checked failing? if i switch to a new basket shouldn't it look at the items and determine the check based on whether the item is in the basket or not? it appears to work if the item is in the basket but not when the item isnt in basket.
Comment: just checked the docs, apparently ng-checked should not be used with ng-model https://docs.angularjs.org/api/ng/directive/ngChecked so thats not the answer
Comment: Yes because a forgot a word which was "instead" of ng-checked.
Comment: Fact is, you'r not making any action to your model when you click, and it must ruined the inner working of the ng-checked. If you want to keep your ng-checked what you can do is :
Answer: Had the same problem with ng-check, tried everything but nothing worked. I wanted to control the number of checked Items when clicked to 2, so I used the $Event sent with ng-click and disable it.
Here is a sample code:
 <input type="checkbox" ng-click="toggleCheck($event, product._id);"
  ng-checked="isChecked(product._id)">

   $scope.toggleCheck($event, productId){
        if ( $scope.featuredProducts.indexOf(productId) === -1) {
            if ($scope.featuredProducts.length < 2) {
                $scope.featuredProducts.push(productId);
            }else {
                $event.preventDefault();
                $event.stopPropagation();
            }
        } else {
             $scope.featuredProducts.splice( $scope.featuredProducts.indexOf(productId), 1);
        }
    }

    $scope.isChecked(productId){
        return ($scope.featuredProducts.indexOf(productId) !== -1);
    }


Get nested object count of key value pair

Question: I am creating a React app and have the following list:
const list = [
    {
        id: '1',
        group: 'sports 1',
        sports: [{
            'basketball': [
                {competed: true},
                {won: false}
            ],
            'soccer': [
                {competed: false},
                {won: false}
            ],
            'hockey': [
                {competed: false},
                {won: false}
            ]
        }],
        competedInAll: false
    },
    {
        id: '2',
        group: 'sports 2',
        sports: [{
            'tennis': [
                {competed: false},
                {won: false}
            ],
            'swimming': [
                {competed: false},
                {won: false}
            ],
            'baseball': [
                {competed: false},
                {won: false}
            ]
        }],
        competedInAll: false
    },
    {
        id: '3',
        group: 'sports 3',
        sports: [{
            'volleyball': [
                {competed: true},
                {won: false}
            ],
            'karate': [
                {competed: true},
                {won: false}
            ],
            'surfing': [
                {competed: true},
                {won: false}
            ]
        }],
        competedInAll: false
    }
];

I am iterating through the list like so:

    {list.map(item => (

           {item.group}

               {Object.keys(item.sports[0]).map((sport, i) =>
{sport}
)}

    ))}

Which will produce the following output:

        sports 1

basketball
soccer
hockey

        sports 2

tennis
swimming
baseball

        sports 3

volleyball
karate
surfing

I am wanting to achieve:

        sports 1 (2 remaining)

basketball
soccer
hockey

        sports 2 (3 remaining)

tennis
swimming
baseball

        sports 3 (compete in all sports)

volleyball
karate
surfing

How can I get the total count of competed that equal false (grouped) in each of the sports?
How can I set this count to 'competed in all sports' (grouped) when they are all set to true?
Answer: const getStatus = (item) => {
  let length = Object.values(item.sports[0]).filter(x => !x[0].competed).length;
  /*
  A more readable version below
  let sports = item.sports[0];
  let sportDetails = Object.keys(sports);
  let notCompetedSports = sportDetails.filter(sport => sport[0].competed === false);
  let length = notCompletedSports.length'
  */
  return length === 0 ? 'competed in all sports' : length+" remaining"
}

    {list.map(item => (

           {item.group} ({getStatus(item)})

               {Object.keys(item.sports[0]).map((sport, i) =>
{sport}
)}

    ))}

Comment: @user1752759, I want you to suggest that you can make your `list` structure more comfortable to use by changing `sports` value to object instead of list like this: `sports : { 'basketball' : { 'completed' : true, 'won' : true }}` by this it would be easy to handle and you can reduce your code line
Comment: Hi Dhananjai.  I am getting a `Cannot read property 'sports' of undefined` for `let length = Object.values(item.sports[0]).filter(x => !x[0].competed).length;` error
Comment: yeah, pass the item to the function. Sorry about the typo. updated above.
Comment: is there a way to add an onclick event to update the state to `true` (possibly with hooks)?
Comment: yes, you can add the event on the list item. But please post it as a separate question as it digresses from the original question. The answer should solve the initial question. Would be happy to help with the new question, if you meet with any issues.
Answer: render(){
//here I put list in render but you can place in your code as you need
  const list = [
    {
      id: '1',
      group: 'sports 1',
      sports: [{
          'basketball': [
              {competed: true},
              {won: false}
          ],
          'soccer': [
              {competed: false},
              {won: false}
          ],
          'hockey': [
              {competed: false},
              {won: false}
          ]
      }],
      competedInAll: false
    },

    {
      id: '2',
      group: 'sports 2',
      sports: [{
          'tennis': [
              {competed: false},
              {won: false}
          ],
          'swimming': [
              {competed: false},
              {won: false}
          ],
          'baseball': [
              {competed: false},
              {won: false}
          ]
      }],
      competedInAll: false
    },

    {
      id: '3',
      group: 'sports 3',
      sports: [{
          'volleyball': [
              {competed: true},
              {won: false}
          ],
          'karate': [
              {competed: true},
              {won: false}
          ],
          'surfing': [
              {competed: true},
              {won: false}
          ]
      }],
      competedInAll: false
    }
  ];

  let remaining = [] // remaining variable is empty list we will push the number of remaining items which are false in the same sequence as our list item are.

  //this loop is used to find out the number of completed = false and push in remaining list
  for(var i=0; i<list.length; i++){
    let count = 0;
    for (var key in list[i].sports[0]){
      if(!list[i].sports[0][key][0].competed){
        count = count + 1
      }
    }
    remaining.push(count);
  }
  //loop end here

  return (

        {list.map((item,index) => (

            {item.group}(remaining: {remaining[index]})

              {Object.keys(item.sports[0]).map((sport, i) =>
{sport}
)}

        ))}

  )
}

Things to note I have added index here list.map((item,index) =>{}) as a extra parameter to recieve in map() function and use this index in {item.group}(remaining: {remaining[index]})


Is there a 'push to talk' button on gamepad for GTA Online?

Question: Is there a push-to-talk button for voicechat on gamepad in the PC port of GTA Online?
If not, is there a way to map the Xbox contoller scheme for this? (I am using PS3 controller and SCP Server.)
For now I use voice-activated + mute, but I prefer using push-to-talk so that my fellow gamers don't have to listen to me yell at my kids and wife.
Comment: I was literally asking this of people last night.. and then realized they could not hear me anyways :D .. But seriously no.. I have not found a push to talk button on the controller.
Comment: You can set your buttons in the game options. You can also set buttons of your controller. :)
Answer: I found that there is no way to do this in-game for the gamepad.
For en-us keyboard the N key will activate push-to-talk by default.
However, various utils (depending on your gamepad) can be used to map one of the gamepad buttons to the push-to-talk button (N key).
Since this game makes good use of all gamepad buttons, remapping one of the gamepad buttons for push-to-talk is unreasonable to do, and therefore the best option when doing voice chat with GTAV:PC is to use voice-activated+mute.
DISCLAIMER
Yes, I know that this is the norm for console gamers, but us oldskool PC gamers are used to push-to-talk. It is especially handy for those of us with large/busy households, or who are gaming in public / cafes / etc which is the great thing about PC games: you can play them on a laptop!
Comment: Can you add more information about these utilities?
Answer: I believe you can setup in settings > key binds a setting for a gamepad button


What are the black egg-like lumps with green bubbles in LEGO Jurassic World?

Question: As I roam the hub islands I've come across these black egg-like structures with green bubbles/glow coming from them - none of the characters I've unlocked yet seem to be able to interact with them, and I can't read the contents of the hexagon that appears when I'm near them.
What are they and how do I interact with them?
Comment: Just a guess (I haven't got this far in the game yet), but the Prima Guide mentions a dinosaur ability called "Goo Spit" with this description: Dilophosauruses can spit venom goo at black LEGO objects to destroy them.
Comment: That sounds about right. The icon could well be a Dilophosaurus - I don't have one yet either sadly, but suggest you add that as an answer now ;-)
Answer: According to the Prima Guide, there is a dinosaur ability called "Goo Spit" with the following description:

Dilophosauruses can spit venom goo at black LEGO objects to destroy them.
Comment: Now I've moved closer to my TV, I can see they clearly are Dilophosauruses. Thanks :)


system of First-Order ODES

Question: I am looking at the following exercise:
Consider the initial value problem
$\left\{\begin{matrix}
x''(t)=x(t)\\
x(0)=a\\
x'(0)=b
\end{matrix}\right.$
Write it as a system of First-Order ODES with suitable initial values and show that Euler method can get unstable for a great step $(h)$.
That is the solution that the assistant of the prof gave us:
$$y_1=x \Rightarrow y_1'=x'=y_2 | y_1(0)=x(0)=a \\ y_2=x' \Rightarrow y_2'=x''=y_1 | y_2(0)=x'(0)=b $$
$$\binom{y_1}{y_2}'=\begin{pmatrix}
0 & 1\\
1 & 0
\end{pmatrix} \binom{y_1}{y_2} \text{ with } \binom{y_1(0)}{y_2(0)}=\binom{a}{b}$$
Euler method:
$$\binom{y_1^{n+1}}{y_2^{n+1}}=\binom{y_1^n}{y_2^n}+h \begin{pmatrix}
0 & 1\\
1 & 0
\end{pmatrix} \binom{y_1^n}{y_2^n}=\binom{y_1^n+hy_2^n}{y_2^n+hy_1^n} \\ \binom{y_1^{n+1}}{y_2^{n+1}}= \begin{pmatrix}
1 & h\\
h & 1
\end{pmatrix} \binom{y_1^n}{y_2^n}$$
$$b=-a$$
The exact solution of the initial value problem is ($t^n=nh$)
$\binom{y_1(t)}{y_2(t)}=e^t \binom{a}{-a} \Rightarrow \binom{y_1(t^n)}{y_2(t^n)}=e^{-t^n} \binom{a}{-a}=e^{-nh} \binom{a}{-a}$, $h$ constant, $n \to +\infty, y \to 0$.
$y=e^{-t}$
Euler method
$\binom{y_1^1}{y_2^1}=\begin{pmatrix}
1 & h\\
h & 1
\end{pmatrix} \binom{y_1^0}{y_2^0}=\begin{pmatrix}
1 & h\\
h & 1
\end{pmatrix} \binom{a}{-a}=(1-h) \binom{a}{-a}$
$\binom{y_1^2}{y_2^2}=\begin{pmatrix}
1 & h\\
h & 1
\end{pmatrix} \binom{y_1^1}{y_2^1}=(1-h)^2 \binom{a}{-a}$
$\dots \dots \dots$
$\binom{y_1^n}{y_2^n}=(1-h)^n \binom{a}{-a}$
$|1-h|>1 \Rightarrow h>2$.
First of all, how do we find that $\binom{y_1^1}{y_2^1}=\begin{pmatrix}
1 & h\\
h & 1
\end{pmatrix} \binom{y_1^0}{y_2^0}=\begin{pmatrix}
1 & h\\
h & 1
\end{pmatrix} \binom{a}{-a}=(1-h) \binom{a}{-a},\binom{y_1^2}{y_2^2}=\begin{pmatrix}
1 & h\\
h & 1
\end{pmatrix} \binom{y_1^1}{y_2^1}=(1-h)^2 \binom{a}{-a}$, $\dots $,$\binom{y_1^n}{y_2^n}=(1-h)^n \binom{a}{-a}$?
I found the following:
$\binom{y_1^1}{y_2^1}=\begin{pmatrix}
1 & h\\
h & 1
\end{pmatrix} \binom{a}{b}, \binom{y_1^2}{y_2^2}=\begin{pmatrix}
1+h^2 & 2h\\
2h & h^2+1
\end{pmatrix} \binom{a}{b}, \binom{y_1^3}{y_2^3}=\begin{pmatrix}
1+3h^2 & h(h^2+3)\\
h(h^2+3) & 1+3h^2
\end{pmatrix} \binom{a}{b}$
Am I wrong?  If not, how could we find the general formula?
Also, don't we find the real solution of the system  of the First-Order ODES as follows?
$\begin{vmatrix}
-\lambda & 1\\
 1& -\lambda
\end{vmatrix}=0 \Rightarrow \lambda^2=1 \Rightarrow \lambda=\pm 1$.
Now we are looking for the eigenvectors.
For $\lambda=1$:
$\begin{pmatrix}
-1 & 1 \\
1 & -1
\end{pmatrix} \binom{u}{w}=\binom{0}{0} \Rightarrow \left\{\begin{matrix}
-u+w=0\\
u-w=0
\end{matrix}\right. \Rightarrow \left\{\begin{matrix}
w=u\\
u=w
\end{matrix}\right. \overset{\text{ we set } u=1}{\Rightarrow }  u=w=1$
For $\lambda=-1$:
$\begin{pmatrix}
1 & 1 \\
1 & 1
\end{pmatrix} \binom{u}{w}=\binom{0}{0} \Rightarrow  u+w=0 \Rightarrow u=-w \overset{\text{  we set w=-1}}{\Rightarrow } u=1=-w$
So the solution is of the form:
$\binom{y_1}{y_2}=c_1 \binom{1}{1} e^{t}+ c_2 \binom{-1}{1} e^{-t}$
Using the initial conditions, I got the following:
$\binom{y_1}{y_2}= \frac{a+b}{2} \binom{1}{1} e^t+ \frac{b-a}{2} \binom{-1}{1}e^{-t}$
How could we show that for a great step $h$ the method can get unstable?
EDIT:  We have $A=\begin {pmatrix} 1&h\\h&1 \end {pmatrix}$ and we write it as  $A=SDS^{-1}$ where $D$ is diagonal.  Then $A^n=SD^nS^{-1}$.
$$S=\begin {pmatrix} -1&1\\1&1 \end {pmatrix}$$
$$S^{-1}=\begin {pmatrix} \frac{-1}{2}&\frac{1}{2}\\\frac{1}{2}&\frac{1}{2} \end {pmatrix}$$
$$D=\begin {pmatrix} 1-h&0\\0&1+h \end {pmatrix} \Rightarrow D^n=\begin {pmatrix} (1-h)^n&0\\0&(1+h)^n \end {pmatrix}$$
How do we conclude that $ \binom{y_1^n}{y_2^n}=(1-h)^n \binom{a}{b} ?$
EDIT 2: I found that:  $$\binom{y_1^n}{y_2^n}=\begin{pmatrix}
(1-h)^n \left( \frac{a-b}{2} \right )+(1+h)^n \left( \frac{a+b}{2} \right )\\ \\
(1-h)^n\left( \frac{b-a}{2} \right )+(1+h)^n \left( \frac{a+b}{2} \right )
\end{pmatrix}$$
I have to show that Euler method gets unstable for a great step $h$.
But why does this hold? $y_1^n$ and $y_2^n$ are unbounded for each $h>0$ since $(1+h)^n \to +\infty$, right? Or am I wrong?
Comment: What are the recent changes? The question doesn't seem to have been edited since it was posted.
Comment: Why do you say $b=-a$?  Under the exact solution, it should be $t=nh$ and you have lost the $e^{-t}$ solution.
Comment: any numerical method will be unstable for this problem. the reason is you have a solution $e^{t}\pmatrix{1\\-1}$   no matter what the initial condition once you have a component in the direction $\pmatrix{1\\-1},$ is going to grow exponentially.
Comment: @RossMillikan The assistant of the prof set it... He did it elsewhise than I did it...
Answer: Given $A=\begin {pmatrix} 1&h\\h&1 \end {pmatrix}$, the way to find $A^n$ is to write $A=SDS^{-1}$ where $D$ is diagonal.  Then $A^n=SD^nS^{-1}$.  Alpha shows $S=\begin {pmatrix} -1&1\\1&1 \end {pmatrix}, S^{-1}=\begin {pmatrix} -1/2&1/2\\1/2&1/2 \end {pmatrix}, D=\begin {pmatrix} 1-h&0\\0&1+h \end {pmatrix}$ so your computed solutions will grow or shrink with $(1+h)^n, (1-h)^n$
Comment: @mathreadler:  You can always find a similarity transformation to [Jordan normal form](http://en.wikipedia.org/wiki/Jordan_normal_form) which is almost diagonal and is easy to raise to powers.
Comment: @evinda:  We can't deduce that.  You will have $y_1^n=(1-h)^nc+(1+h)^nd$ for some constants $c,d$ and similar for $y_2^n$  You have a two dimensional vector space of solutions.  The specific solution will depend on the initial conditions.
Comment: You find the real solution from the initial problem. You have the real solution in your original post under "Using the initial conditions"  You are right that the real solution goes off to infinity in general because of the $e^t$ term.  That is probably the source of $b=-a$:  somehow you know that the solution should not blow up and you have to make sure that term does not contribute.  If you look at the Euler approximation, even if $b=-a$ so the $(1+h)^n$ term is not there, when $h \gt 2$ the other term will blow up.
Comment: I think my last comment answers your Edit 2:  the $(1+h)^n$ always goes to infinity, but if you have initial conditions that eliminate it $(b=-a)$ the real solution will decay as $e^{-t}$.  If $h \lt 2$ your computed solution will also decay, but if $h \gt 2, |1-h| \gt 1$ and $(1-h)^n$ blows up.
Comment: Why will the computed solutions grow or shrink with $(1+h)^n, (1-h)^n$ ?
Comment: Could you explain me how we deduce that $\binom{y_1^n}{y_1^n}=(1-h)^n \binom{a}{b}$ ?
Comment: Can we be sure that such a D exists? If that is so, why?
Comment: Substituting $S,S^{-1},D$ I got:

$$\binom{y_1^n}{y_2^n}=\begin{pmatrix}
(1-h)^n \left( \frac{a-b}{2} \right )+(1+h)^n \left(\frac{a+b}{2} \right )\\ \\
(1-h)^n \left( \frac{b-a}{2} \right) +(1+h)^n \left( \frac{a+b}{2} \right )
\end{pmatrix}$$

I have to show that Euler method gets unstable for a great step $h$.

$$$$
But why does this hold? $y_1^n$ and $y_2^n$ are unbounded for each $h>0$ since $(1+h)^n \to +\infty$, right? Or am I wrong?
$$$$
Comment: @RossMillikan Also do we find the real solution from the given initial value problem $$\left\{\begin{matrix}
x''(t)=x(t)\\
x(0)=a\\
x'(0)=b
\end{matrix}\right.$$

or from the system $\binom{y_1}{y_2}'=\bigl(\begin{smallmatrix}
0 & 1\\
1 & 0
\end{smallmatrix}\bigr) \binom{y_1}{y_2} \\ \binom{y_1(0)}{y_2(0)}=\binom{a}{b}$ ?
Comment: @RossMillikan I didn't find that $(1-h)^n \to +\infty$ for $h>2$ because I thought that this would be satisfied when $1-h>1$. So do we require that $|1-h|>1$? If so, could you explain me why?
Comment: Since $h$ is always positive, we never have $1-h \gt 1$  The solution in $(1-h)^n$ tends to decay away nicely, as it should because it is supposed to follow the $e^{-t}$ in the real solution.  The problem comes when $h \gt 2$ because then it blows up (oscillating in sign).  That is what we mean by the method becoming unstable-a well behaved solution is modeled by something that diverges.
Comment: @RossMillikan I still haven't understood why we look at the absolute value $|1-h|$ in order to determine where $(1-h)^n$ tends to. Could you explain it to me?
Comment: Because, for example, $-1.1^n$ does not converge.  As long as $|1-h| \lt 1, (1-h)^n$ will converge to zero.
Comment: How do we relate the fact that $-1.1^n$ does not converge?
Comment: The correct solution is $ae^{-t}$.  If you follow this to some reasonably large time $T$, the step in your model will be $h=T/n$ as there are $n$ stepts to get there.  The solution your Euler model follows will be $a(1-h)^n$ If we want to follow up to $T=100$, as long as $n \gt 50$ the solution will fall towards zero.  When $n \lt 50$ the solution will bounce around wildly.
Answer: Set $J=\begin{bmatrix}0&1\\1&0\end{bmatrix}$ and $I$ the corresponding identity. Then $J^2=I$ and the fundamental solution of the system is
$$
e^{tJ}=\cosh(t)I+\sinh(t)J
$$
The transformation matrix from initial vector to step $n$ of the Euler method can be split the same way into even and odd parts with respect to h
$$
(I+hJ)^n=\frac12((1+h)^n+(1-h)^n)I+\frac12((1+h)^n-(1-h)^n)J
$$
Applying the initial vector $v=\binom{a}{-a}$, which is an eigenvector of $I$, $J$ and thus also $I+hJ$ and $\exp(tJ)$ with eigenvalues obtained by replacing $J$ with $-1$, results in
$$
Jv=-v,\quad e^{tJ}v=e^{-t}v,\quad (1+hJ)^nv=(1-h)^nv.
$$
The other eigenspace consists of vectors $w=\binom{a}{a}$ with
$$
Jw=w,\quad e^{tJ}w=e^tw,\quad(1+hJ)^nw=(1+h)^nw.
$$
Note that solutions starting in the eigenspace of $-1$ fall to zero, however, for $h>2$, the numerical solution not only oscillates but also grows to infinity. $h=3$ might not seem a reasonable step size, but $x''=400x$ separated as $x'=20y,\,y'=20x$ gives as stability requirement $20h<2$ or $h<0.1$ which seems more realistic.
Comment: So is that what I did so far wrong? Also, at the beginning why does it hold that $e^{tJ}=\cosh(t)I+ \sinh(t)J$ ?Then why do we calculate $(I+hJ)^n$? And in general could you explain me what you do from this part till the end?
Comment: You did nothing wrong, the given solution specializes very early for the eigenspace for $λ=-1$, i.e., $c_1=0$ and $c_2=-a$. You stay with the general solution. I wanted to highlight that matrix powers reduce to number powers when using an eigenbasis. The linear ODE system $y'=Ay$ has the solution $y(t)=e^{tA}y(0)$, where the matrix exponential uses the same power series as the scalar exponential.
Comment: So we have the following, right?
$\binom{y_1^1}{y_2^1}=\begin{pmatrix}
1 & h\\
h & 1
\end{pmatrix} \binom{a}{b}, \binom{y_1^2}{y_2^2}=\begin{pmatrix}
1+h^2 & 2h\\
2h & h^2+1
\end{pmatrix} \binom{a}{b}, \binom{y_1^3}{y_2^3}=\begin{pmatrix}
1+3h^2 & h(h^2+3)\\
h(h^2+3) & 1+3h^2
\end{pmatrix} \binom{a}{b}$
$$$$
How can we find the general formula of the solution $\left( \frac{y_1^i}{y_2^i}\right)$ that Euler method gives?
Comment: You will find that, as I wrote in the second big formula, $$\begin{bmatrix}y^n_1\\y^n_2\end{bmatrix}=\begin{bmatrix} e_n(h) & o_n(h) \\ o_n(h) & e_n (h) \end{bmatrix}\begin{bmatrix}a\\b\end{bmatrix}$$ where $e_n(h),\,o_n(h)$ are the even and odd parts of $(1+h)^n$.
Answer: Euler's Method using the relation
$$
\begin{bmatrix}
u\\v
\end{bmatrix}'
=
\begin{bmatrix}
0&1\\1&0
\end{bmatrix}
\begin{bmatrix}
u\\v
\end{bmatrix}
$$
would give
$$
\begin{bmatrix}
u\left((k+1)\frac tn\right)\\v\left((k+1)\frac tn\right)
\end{bmatrix}
=
\begin{bmatrix}
u\left(k\frac tn\right)\\v\left(k\frac tn\right)
\end{bmatrix}
+
\frac tn
\begin{bmatrix}
0&1\\1&0
\end{bmatrix}
\begin{bmatrix}
u\left(k\frac tn\right)\\v\left(k\frac tn\right)
\end{bmatrix}
$$
or
$$
\begin{align}
\begin{bmatrix}
u(t)\\v(t)
\end{bmatrix}
&=
\left(
\begin{bmatrix}
1&0\\0&1
\end{bmatrix}
+
\frac tn
\begin{bmatrix}
0&1\\1&0
\end{bmatrix}
\right)^n
\begin{bmatrix}
u(0)\\v(0)
\end{bmatrix}\\[6pt]
&=
\begin{bmatrix}
-1&1\\1&1
\end{bmatrix}
\left(
\begin{bmatrix}
1&0\\0&1
\end{bmatrix}
+
\frac tn
\begin{bmatrix}
-1&0\\0&1
\end{bmatrix}
\right)^n
\begin{bmatrix}
-1&1\\1&1
\end{bmatrix}^{-1}
\begin{bmatrix}
u(0)\\v(0)
\end{bmatrix}\\[6pt]
&=
\begin{bmatrix}
-1&1\\1&1
\end{bmatrix}
\begin{bmatrix}
\left(1-\frac tn\right)^n&0\\
0&\left(1+\frac tn\right)^n
\end{bmatrix}
\begin{bmatrix}
-1&1\\1&1
\end{bmatrix}^{-1}
\begin{bmatrix}
u(0)\\v(0)
\end{bmatrix}\\[6pt]
&=
\begin{bmatrix}
\frac{\left(1+\frac tn\right)^n+\left(1-\frac tn\right)^n}2
&\frac{\left(1+\frac tn\right)^n-\left(1-\frac tn\right)^n}2\\
\frac{\left(1+\frac tn\right)^n-\left(1-\frac tn\right)^n}2
&\frac{\left(1+\frac tn\right)^n+\left(1-\frac tn\right)^n}2
\end{bmatrix}
\begin{bmatrix}
u(0)\\v(0)
\end{bmatrix}\\[6pt]
&\to
\begin{bmatrix}
\cosh(t)&\sinh(t)\\\sinh(t)&\cosh(t)
\end{bmatrix}
\begin{bmatrix}
u(0)\\v(0)
\end{bmatrix}\\
\end{align}
$$

system of First-Order ODES