text:
Q: OpenLayers and external CSS I am using geoExt and OpenLayers to plot some map. Everything worked well until I had to add some styling. To display it on the webpage, I need to use the CSS of my university and once I do that, I have some horizontal white lines between each tile (but not vertically though). The lines have always the same height. The problem seems to come only from the CSS, since if I remove it in the html (it is the first thing invoked in <head>), everything looks correct.
Searching here and on the web, I found than some people proposed to create a CSS after everything else which sets:
.openlayers-map img {max-width: none;}

But it didn't solve anything. Is there a way to tell to a div that it needs to load no styles but the one used by OpenLayers?
Here is a sample of the code I have:
 var osm = new OpenLayers.Layer.OSM(
            "Open Street Map"
    );
 bwms = new OpenLayers.Layer.WMS(
                    "usa:states - Tiled", "http://128.178.82.176:8080/geoserver/usa/wms",
            {
                    layers: "usa:states",
                    tiled: true,
                    transparent: true
            },{
                    singleTile: true,
                    projection: new OpenLayers.Projection("EPSG:4326") // specified because it is different than OSM's
            }
    );

   mapPanel = new GeoExt.MapPanel({
            renderTo: "mapPanel",
            map: new OpenLayers.Map({
                    projection: epsg900913,
                    displayProjection: epsg4326,
                    units: "m",
                    center: new OpenLayers.LonLat(6.59,46.39).transform(epsg4326,epsg900913)
            }),
            layers: [osm,bwms],
            // height/width in pixels
            height: 450,

            zoom: 10,
            border: false
    });


text:
Q: Can SQL Server Connection String Contain Options like XACT_ABORT? Can SQL string contain options like XACT_ABORT. For example, I can execute set XACT_ABORT On, but I would like to set this option in connection string. Is it possible? I tried to write XACT_ABORT=On; and XACT_ABORT=yes;, but that didnt work.

A: No, that is not possible. The possible options are documented here:

*

*http://msdn.microsoft.com/en-us/library/ms130822.aspx

*http://www.connectionstrings.com/all-sql-server-connection-string-keywords
I also advise you to stick to the default options because that is what everyone uses. The product works best one you are close to the defaults. Also, help on the web will be easier to obtain.

redpajama_set_name: RedPajamaStackExchange


text:
Q: R Text Mining: find correlations among words within a certain distance of a keyword I have been following this example and was wondering if it is possible to draw the figure 4.4 for combinations of words that were within 10 words of the keyword instead of words that are right next to each other.  For example, let's say I wanted to know which words were commonly within 10 words of "sir"?
Sorry, my company has disabled copying/pasting text on your website so I can't post the code.

A: Don't know about the 10 words difference. But one option may be to calculate co-occurrences on sentence-level, for example with the udpipe::cooccurrence function.


text:
Q: open modal bootstrap on submit form how can I open a modal when the user has validated the form ?

            S'inscrire

Merci !

A: You can use the modal id or class to open it when the user clicks on submit button.
Lets say you have this HTML
<form id="submit-button">
    //form components
</form>

Then you can write this JQuery code:
//trigger when form is submitted
$("#submit-button").submit(function(e){
    $('#registration').modal('show');
    return false;
});

The $('#registration').modal('show'); will display the modal and return false; prevent the form to post the data which will stop the page to reload. Or, you can also do this
$(document).ready(function() {
  $('#submit-button').on('submit', function(e){
      $('#registration').modal('show');
      e.preventDefault();
  });
});

e.preventDefault(); will stop the page from the page reload.

A: You can add this to to your function when you the form is validated:
$('#registration').modal({
        show: 'false',
        backdrop: 'static',
        keyboard: false
    });

*

*Keyboard false means when you press escape the modal won't
disappeared.

*Setting the backdrop to static means when people click    with their
mouse outside of the modal. The modal won't close.

EDIT
if ($("form button").valid()) {
       $('#registration').modal({
            show: 'false',
            backdrop: 'static',
            keyboard: false
            });
};

A: you can add this on validation success:
$("#registration").modal('show');

A: I would use an Ajax solution to submit the form without refreshing the page.
You could even update the modal response based on the outcome of the request.

$("#ajaxform").submit(function(e) {

  var url = "path/to/your/script.php"; // the script where you handle the form input.

  $.ajax({
    type: "POST",
    url: url,
    data: $("#ajaxform").serialize(), // serializes the form's elements.
    success: function(data)
    {
     //if request successful
     $(".modal-title").text('Request successful');
     $('#registration').modal('show');
    },
    error: function(data)
    {
      //if request unsuccessful
      $(".modal-title").text('Request failed');
      $('#registration').modal('show');
    }
  }).done(function() {
    //finally, reinitialise modal text back to default 'merci'
    $(".modal-title").text('merci');
  });

  e.preventDefault(); // avoid to execute the actual submit of the form.
});

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

<form name="ajaxform" id="ajaxform" action="ajax-form-submit.php" method="POST" class="form-group">
  First Name: <input type="text" name="fname" value="" class="form-control"/>
 Last Name: <input type="text" name="lname" value="" class="form-control"/>
 Email : <input type="text" name="email" value="" class="form-control"/>

  <button type="submit" class="btn btn-default">submit</button>
</form>

Merci !


text:
Q: object storage image response type to base64 in angularjs I'm trying to retrieve data from Object Storage. We have api to get those image files through which I got below formatted data.
����\u0000\u0010JFIF\u0000\u0001\u0001\u0000\u0000\u0001\u0000\u0001\u0000\u0000��\u0000C\u0000\b\u0006\u0006\u0007\u0006\u0005\b\u0007\u0007\u0007\t\t\b\n\f\u0014\r\f\u000b\u000b\f\u0019\u0012\u0013\u000f\u0014\u001d\u001a\u001f\u001e\u001d\u001a\u001c\u001c $.' \",#\u001c\u001c(7),01444\u001f'9=82<.342��\u0000C\u0001\t\t\t\f\u000b\f\u0018\r\r\u00182!\u001c!22222222222222222222222222222222222222222222222222��\u0000\u0011\b\u0001,\u0000�\u0003\u0001\"\u0000\u0002\u0011\u0001\u0003\u0011\u0001��\u0000\u001a\u0000\u0000\u0003\u0001\u0001\u0001\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0003\u0000\u0004\u0005\u0006��\u00007\u0010\u0000\u0001\u0004\u0001\u0003\u0002\u0005\u0002\u0004\u0005\u0004\u0002\u0003\u0000\u0000\u0000\u0001\u0000\u0002\u0003\u0011!\u0004\u00121AQ\u0013\"aq�\u0005�\u00142��#3B��RS��r�Cb���\u0000\u0019\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0003\u0004\u0005��\u0000%\u0011\u0001\u0001\u0000\u0002\u0001\u0004\u0002\u0003\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0011\u0012\u0003\u00131Q!2\u0004\u0014A\"a����\u0000\f\u0003\u0001\u0000\u0002\u0011\u0003\u0011\u0000?\u0000����Fp�\u0015k\u000e���\u0004a\u0000\u0005QMY�@�!h\u0003���vG� \u0005�\u000fO�P+���1\u0018��E�\b@J@�EB/\u0001!\u001e`(ڊG7v\u000f�ֹ��v�k\u0019\tHA�ᕺ\u000eʎk\\r��\u0014\u0013��-]��=v@�J)\u000f�]ÎS�X=E._\u0013kA ��\u0015r\u0002L��Q���Z�v+\u0004 ^�,��U�\u001e��SWt\u0002o|���% �\u0018MiL���I\u0007�!�\u0011\r�9D\f�\u0019�\nE���\n\u001c'\u001d�5�\u0004�<�Ԡ[g*���(���+��\u0015�- �m�\"�U���O�PF�V��@�\u0018QR��ɇ=���9X\u000e��?0HG\u001b?6o�YNf\u0005\u000e)\u0018X�\b\u001a�T�X*Z�u�\u0016Lಃ�\u0002�B��Dh���\u0006��\u000b\u0000K�\u001c\u000eB�Vt�t��M\n\u0019�xdt�\u000e�\u0005��\u000b\u0000��+u쵪\r�\u000f�:��,���\u0017\u0000M\u000e:�=4߉�I���\u0015\u0005+�\u0010-O���\u0014{��h�J@�E����**E���\n��� \u001c�maq�[R���\u000b���ְx!ݍ�T��\u0000���\u001c�[觧w�?��WAnT�\u000e\u000b*��O+(�������V�-�\u000e#���M\u0003+ُB��r�5�6�%k�\u001d�7]\u000f����?��at�@[x[��=�θ�^3��5@*27��\u0015�U�!�\u0018Q ��v19Ҹ\u0011�T��\u001c\u001568�\u000er�c\u0013�#@weA\u001fa]��\u0002;�)���I��R\u0001�t�����'c\u0013�\u0002�3Hl'�Q޶�j~�>�t�7�/�k��[���O���ι�\u000fe\u001dDE�w�4�K�\u0003�֧�Okܯ\u000e\u0018�\u001f\u0011-p�vl7tW�h���e��טc�\u0005e�ݬ���gp�?�1�\u0000�\u0010/Rf#o<,J���}��m�V��!�YGu$�J��ĭiB`��ևTj�!$a`\u001cz\u0015`\u0002۾�&\u001a��\u001e��d\u0000-k,Q\u001a�k@��Po\bZ_T@@VAdT�\t���JBh�p�;�ే�-�\u0014F:�G�\u000bh~���rɬ��(i�%���L ��\u0002��fj`d�\u001bcŃT�E��\u0015��d�R\u000bY����y�ᚪ�\u00144�Sd�\u0001�{\u001d\u001bKn�S�\u000fc��\u001e�TG��\u001a�\u001d�.y5L\u001e�R\u0019�3�n\r\u0007\u0000z����5E�\u001e�)��\u001c���k���l�U���w����w�'�K\fڭ;\"\u00125�Ӊpy!��X\u0004�\u001b8I-\u001e�\u0000�G��;��E��\t���և\u0006��\r���U$��Z�2\u00174��da �ڼQW�\u001d�d�\u0006�D�\u0012汌2�4��l\u0011�+��Q�#��\f��\u0000UX\u0006�w�&���\u0005\u001c\u001b�<�\u0016�4m\u0014��A���Xed\u001bJ.\u0012}S��=\u0014�p\u0011v�$��5|�����\r�3J� �;\u001e6�@=��660\u0006��\u0001�\u0002��\u001b^湏\rh���׺he�d��o\u0017G�\u0006|m~��k�\u0011V��\u0000\u0001\u0000ik���I\f'\u0000�f�?�b�Ia:��ѝ�\u001d��������M�}��3��6�l���Փ���\u001b\u0014e���%\b����\\���Ʈ�O�p\td�\u0013!�\u0016��\u001f&�6+��Ul�b�I�k�<1\u001d\u0013�~�MQ߃�E�X\u0018ִ1��\"�TOs��E��ӱڷk\u001dr\u0002�����k�_f�{\u0003�*\b\u001d\u0016�G1�{ex.c�m\u0014\u0005��\u0000z��]��=�\t\u0018$�[��M\u0012G��Kbf�\u0003��\u0000�\u000emy�f\b�4\f�J\u001a\u001d�\u0002\b�Ů}L��M�ҽ�6��ky%�3�����\u001cN�\"�h�������1���9�p<ۍ�\u0000r���F\u000e�F\u0007�^\u001avQ;�\u0016O���\n��^�!�\u001d�m����j�K�\u000e�T^��;�+D������\u000e�o�Zm��+\u0018}a|���\u0000��4��V��C�8X8 �\u0000.i\u0019<��l�k\u001c+\r6>AGF�Lpm�L�^\u000e\u001c\u001bX���&�JR�\rv��4Sj\u0003C�l.\u0000�cv�}$�k�\u001c��\u0006<Ph\u000e���M\u000e��y��=��\u001f����5���6�\u0016\r��d���7lt�P�\u001f��c���\r��G�����9ުnx�Bwx\u0006I����\u0000���fŇ\u001d����\u0016�\">�!��\"\u0001��h2�`8�6��\u0007�x��]���\u0000I\u0000Y�)�\u0000Q|n�ۜ\u001b�\u00065���o�4�t��<oq\u0018\u000f-k�\u000e\u001d\u001b\u0007B��+�Z�4��\na�<�\u000fW,\\��K�ޔ>�o)5 �\u0007S�H\u0016(�Hٲ\u001a�\u0017\u0011�*\\�ώ��ޗ�P\u0016��$o�$,�˜I]\u0005�f��%�7\n\u0019�+�\u001d{p��u��=M���&�ˎI���\u0018{c����_ɛ�\u0000\u0019���\u0000�w=Gl\u000f\u001f�p5�U�}��\\�%Ӏt��\b��>&��\u0014�t���/+0�Pe \t�k����\u0018�t���K&�'2i\u0018]eѐ��h��בK�6�D֗\u0017\u0010+s�*�\\۫\u0017�+�\u0005dd�W,�4�#�!#�\u000e���z�^oԴ��a��W\u000f\n`�2 ?(<��\u0005+�=�\u001c)\u001a�\u0017�\u0013����{�!�x��Gc��e�u���bq�4���\u0019T)�\u0013�N#���St09��F^����m�=\u0017�ߪM�{\u0019\u001c%�������R�`A�H�T����\u0019f\u000e��o�#\u000e�\u001e\rrH�h�O�׹�\u001b���X'v�S�a��s��;u�X�b��띫ә\u001dVזc�,�z�\\���W'��V�T\u001d\u0012���\u001cM\u0003x4�K\u0018\bkk�sx��o\u0010R�\fyr��<f��\u000f\nmcZ����J��\u000f\u0016��p�-nx[��]E�vK\u001aI�E��w�����/\u0018��~�+�]�\u0001ܧ�3�\u0002x\n\u0010\u000b$�E4Ӷ)\b\fs����\u0006I\u0003)���5��ꤞ-\\\u001e\u0011aa\u000e��h��>�V��\u0001�2،{�z�\u0015�$�P��=��\u0002� Վ\u0013j��7�b���\u000bj��H'����闠\u0011'\u000b�ku����\u0000�Dž��\u001c\u001b�WL^#4�%~��>�����(f�ĵ�i#�\u000f\nnwu�?K6�8\u0004e�t\u0019\u0001�W�\u0003k=�ҏ�&�j�\u0000\u000f�y\u001b\u0014l�|Ji$�0x�q��]��B⼝\u000b�\u000f�ifv��D=�C��\u0003<�A�(�DL���u\u0005�4f��Jq���s�K�[��=�r�\u001b��1ۘ\\��܀a����\u0006N?e���l�Ѵ��|M�N\u0003l\u0002�|���W�\u001e��&ǵ�\u000f�N/\u0000�{�\fdo.`�|���^su����M�� 9ܙ3^P\u000e8^��K�1��+\u0007�O�z��P>�^Jm�SY�AM�(q\u0007�\t��\r\u000eQO�����VA�i�{T�\u0016K /n�)i\u0007���I�o�'��.C�6�K\u001b�{'��\u000b톨�\u001d�G\u0006����e�\f��\u0011\u000b\u0001s�/��֓��h�(/;�Z�D�\u001b#��Z��v�ih��laRv66��5Os\u0003KZ\u001aK\\����\u0002�M#��4c�;�Tt��\u0011�\f����+w�b�\t�\u0000sZ]�h�\u0001\u0000�E\u0006�\u001bf�`\u000e�\u0000\u000e�n?ub�yB�\u0007)��\u0003\u0000��0�@\u001c\u0014��N�\u0000yA��<\u001b\u000bv\u0000�I b������8\u00198����^F.�~M�������\u000b\"��)����9\u001b����쉻���O�(��U�.Ed\b��k@~\u00169)m\u0012o!\u0006��x!.k%\u0010~�\u001f\u0014�\u000b(�Jp����\f��w�'�o��\u0002�n\u0002]/�y�]\u000b\u001d/�\\����\u001a<����Cw�k\u001a\u001dUu����k�\u0003�\u0017F@\u0012�j�\u0001\u0014@\"���5�;�D\u001c��<z��rǼn\u0004q�#��w��I%ԴK!k�o�g�~k+�4��\u000f{ay���\u0006�֓Vz\u000bWc���1�E�{\u0001~�]4�2�6�\u0006��\u001f�Rv����H��J�T�谋$U�\u001c`c��q.�s��\u0000n�dP\u0017^���J�!�U�\u0013y*\u000e9Us�T]V��kn�\u0012�D\u0010z�`m\u0013��A�nJ\rx�jţK\u0014\u0000\u001c,�U���tGt.?���U{�\u0016�����g#�\\\u001b6V:V\\#Yy5�E-a3B��\u000eU\u0003Mg\u000b\u0000\u0007D��3�\u000f'��,p�h�#d�����O\u0018wu\u0007j'v�F�x�wyG�Y��p�y6�Å�Ю'��\u0000�h\u0004�.9�{\u001b8Z�����ԺH�����F�h�\u0004\u001eފz�>�O��H�N�@�I\u0018opI�|���\b�\u0011i�\r�'��\u0001\u0005��;��'���S��\u0004\u0011�=\u0013����\u0016�\u001b�I\u0006\"�ƌ����_7\u001dmM�J�\u001e�<H�Ɯ�\u0000\u000eh\u0000o?�v�\u00042��|ms�<��2\u000f��~\u0002�ӰJd.{��\u000eq \u001f@��\u0013C*o\u0000�\r�j%s�q87c{\u001c��LM(�-#��5�\u000bX@\u0003H�MT\u0010�[�\u0002\u000fT۰�,����,��8s]�ס�Z�$yqfעW�F\u00010�\u0000�=\u0017��m+�q\u000e��\b+\u0012��\u0019T#�r��V\u0013=A�P\u0007���݅�G\u0014R\u0012T�l�J���IS<�]iOu\u0015��Z��}�\u001e\u0016\u001d��\b\u0002�\n(,\u00100�Y-��zf�\u001cݮ���T\u0018��k�\u000b����>\u001e�%u~5�f6���\\�\u0007\u0013�R\u0013\\��z���p�\u001dl᠝��\u001f�Ju��D�WjQ��!u)����+&�s��\u0003ѫ�MT濈\u0007�\u0000��x�j\u000f~\u0013����\u0017�'�矰Rv�V���O\u0018\u001f���Rs���p���q��4��\u0000��H_'�����S�{�}z�<���_%�\u00009�`���#�D\u0007u��ey���\u001b��+��-��\u0000qߢ\u0003&��=3i�/f�[�#��\u0010�\u0006D��?�c�����j\u0019�>��~�\td\u0007��K���Ny{5\u001aI^k�h���)�/f�謎�\u0012\u000f\t\u0003�U ]Aa�n\u0003�{ ��h�\ne�eM�P3�\u0005I��q�I$��ғ�\u0007�\u0000{��\u001fu'?\u0016�pa\"ɳ�)$=B�=�w�!>�d���TP;>�86k����\u0000)��\u0000�d\u0016����Pz\u0004o��\u000f\u001e�xϪ\u0017Y��Ɂ�A���!��b{elz\u0014\u0002�U�� }>R���P]|,�ub���=�:�J^k�!7�H�z��s�������ϳ��g\b�烏�+�\u0007d\u000eze\u0002o\u0002�#�zעG����Sy�\u0010\u0007sv���۔�J�;`��Åt���\r��N>�*ҍ��\u0017��\u0007\u0016\u0002$�WB�\u001cs��#d���;�ϲ\u0006��c�Z�q}��\u0005���\t���{$$�\u0012�@�\u0014��\u0016;����I&�\u0015�\u000f\\����Ss��!!\u0019ʃ���Ac%w*e����(]�u�Ү��\u001a\u0019K��@<��v2�b�P�携@�\u0006?���m\u0000l₥t\u0002Ґ7n'\b����\u0015��O�@qk\u001ex�C��H�#�R\u0006�%\u0012�9?(�?�\u0014ۍ�a%�v����ɠo�,�ʑ~h�\u000b�p~�\u0005�zתR�u�\u000e�R34\u000e~\n��-o$ ��i�:,���F\u001c)��VE�zn��\u001e/��:Q��\\��\u0017\u000e�a�\u001bꮑgI�\u00153%ݕ\u0019\t����F!�S���(��L\u000b���\u001a�:ߢ�`��\"�\u0011АJ�����7\b��=���\t�Kw���p�xB���v߀W��l�ye�.�Tz��ߏT\f�\f\u0010��4�'\u0012�\u001ey+~v4�$�9F�\u0015�LmÜߒ����rO�� XR9\u0006�\"�v��L\u00166\u0013����\u001b\u001fܮC�|{-��N\u0011�uӟB�ډ�ˈ=���|���P\u0012^��\u000e�8�����\u0003�$�E�n�X\u000erp���\u00068�e�v��t�\u000f��"

How can I convert this encrypted data to base 64?

A: You can likely use this library - https://github.com/ninjatronic/angular-base64 to encode that string as base64.


text:
Q: Shorten URL on flask server with mod_rewrite I want to shorten the URL for my flask based website from this:
mywebsite.com/cgi-bin/app/app.cgi/contact

to this:
mywebsite.com/contact

My .htaccess file includes the following:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /home/user/public_html/cgi-bin/app/app.cgi/$1 [L]

I'm running the website on a namecheap shared server if that makes a difference.
Thanks!


text:
Q: Open detached OLE binary in native application I have some OLE binaries detached from RTF document.  For example OLE binaries belong to MS Word.  This OLE binaries are in FAT32 compound storage format. I am trying to load this binaries in native app using C++ ole headers.
I'm able to get IStorage object from binary using stgopenstorageex but when I try to call OleLoad method, error "Class not registered" is thrown.
Does anyone have any idea on how to proceed?

A: I made some progress today.
Problem with the "Class not registered" error was resolved by opening "Word.Document.8" storage in IStorage object and then calling OleLoad on "Word.Document.8" storage.
I now have IOleObject.
If I call DoWerb method, MS Word opens and shows document.
This is good progress.
Now I would like to get COM handle to this document.
Idea is to load the document in MS Word hidden (headless) and save it to disk as doc,  docx or PDF.
Anyone have any idea?


text:
Q: How to reside multi version of Oracle Client in DBD::Oracle on the same server We have Oracle11gR1 and Oracle18c.
Perl clients(11.7.0.1) have to access to both version so far.
But Oracle client(11.7.0.1) were recommended to upgrade to new one(12.1.0.2)
according to Doc ID 207303.1  - 'Client / Server Interoperability Support Matrix '
I'd like to hava 2 version of DBD:Oracle on the same clinet.
one for 11.7.0.1.
another for 12.1.0.2.
Because We can back to stable one immediately if new one caused problems.
How can I do that?
or
Impossible? Why?
I was successfully to install the following,
oracle-instantclient12.1-devel-12.1.0.2.0-1.i386.rpm
oracle-instantclient12.1-basic-12.1.0.2.0-1.i386.rpm

After re-install DBD::Oracle,V$SESSION_CONNECT_INFO shows them to '12.1.0.2'.that's I expected.
My Question is
How to switch back and force between 2 version of Oracle clinet of DBD::Oracle for just in case.
Because We can back to stable one immediataly if new one caused problems.
Ideally, By changing $ORACLE_HOME or $LD_LIBRARY_PATH could be achieved I hope.
Otherwise, A lot of task will be needed like that changing $ORACLE_HOME or $LD_LIBRARY_PATH and re-complile DBD:Oracle to switch them in everytimes.
Does anyone have good advise?
Thanks in advance.


text:
Q: Allow checkout without login for existing users only (woocommerce) I'm trying to find a solution that will allow paying for an order without login for registered users only. Guests must not be able to pay for the order. I have already found some snippets which link orders if email exists or create a new account if not. I would like to simplify the purchase process for existing users but still avoid guest checkout for new customers.
Here is the code which I have already tried (it works to link orders to existing customers, but I would like to prevent guest checkout and new account creation during checkout). Actually there is no need to login users. I would like to simply allow to complete the order in case if the user (email or use ID) exists and decline if user do not exists.
`
//assign user in guest order
add_action( 'woocommerce_new_order', 'action_woocommerce_new_order');
function action_woocommerce_new_order( $order_id ) {
    $order = new WC_Order($order_id);
    $user = $order->get_user();

    if( !$user ){
        //guest order
        $userdata = get_user_by( 'email', $order->get_billing_email() );
        if(isset( $userdata->ID )){
            //registered
            update_post_meta($order_id, '_customer_user', $userdata->ID );
        }else{
            //Guest
        }
    }
}

`


text:
Q: Why is my Active Record query changing so drastically by just modifying my order by? My original Active Record Query is shown below with the query it produces...
Active Record Query
player.measurables.includes(:workout, :measurable_type, [workout: :player_workout_type])
.where(measurable_type_id: measurable_type.id)
.order('player_workout_types.priority ASC, measurables.value DESC').first

Result
SELECT  [measurables].[id] AS t0_r0, [measurables].[workout_id] AS t0_r1, [measurables].[measurable_type_id] AS t0_r2, [measurables].[value] AS t0_r3, [measurables].[created_at] AS t0_r4, [measurables].[updated_at] AS t0_r5, [measurables].[imported_with_errors] AS t0_r6, [measurables].[import_key] AS t0_r7, [measurables].[order_by] AS t0_r8, [measurables].[reliability_id] AS t0_r9, [workouts_measurables].[id] AS t1_r0, [workouts_measurables].[player_id] AS t1_r1, [workouts_measurables].[date] AS t1_r2, [workouts_measurables].[description] AS t1_r3, [workouts_measurables].[player_workout_type_id] AS t1_r4, [workouts_measurables].[nfl_player_id] AS t1_r5, [workouts_measurables].[college_player_id] AS t1_r6, [workouts_measurables].[import_key] AS t1_r7, [workouts_measurables].[created_at] AS t1_r8, [workouts_measurables].[updated_at] AS t1_r9, [workouts_measurables].[recorder_id] AS t1_r10, [workouts_measurables].[field_conditions] AS t1_r11, [workouts_measurables].[comments] AS t1_r12, [workouts_measurables].[jersey] AS t1_r13, [workouts_measurables].[report_id] AS t1_r14, [workouts_measurables].[all_star_game_id] AS t1_r15, [player_workout_types].[id] AS t2_r0, [player_workout_types].[type] AS t2_r1, [player_workout_types].[description] AS t2_r2, [player_workout_types].[rising_seniors_event] AS t2_r3, [player_workout_types].[import_key] AS t2_r4, [player_workout_types].[created_at] AS t2_r5, [player_workout_types].[updated_at] AS t2_r6, [player_workout_types].[priority] AS t2_r7, [measurable_types].[id] AS t3_r0, [measurable_types].[is_primary] AS t3_r1, [measurable_types].[code] AS t3_r2, [measurable_types].[abbreviation] AS t3_r3, [measurable_types].[description] AS t3_r4, [measurable_types].[unit_id] AS t3_r5, [measurable_types].[created_at] AS t3_r6, [measurable_types].[updated_at] AS t3_r7, [measurable_types].[preferred_type] AS t3_r8, [measurable_types].[order_by] AS t3_r9, [measurable_types].[precision] AS t3_r10, [reliabilities].[id] AS t4_r0, [reliabilities].[code] AS t4_r1, [reliabilities].[description] AS t4_r2, [reliabilities].[priority] AS t4_r3, [reliabilities].[created_at] AS t4_r4, [reliabilities].[updated_at] AS t4_r5, [reliabilities].[is_active] AS t4_r6, [reliabilities].[translation] AS t4_r7 FROM [measurables] LEFT OUTER JOIN [workouts] [workouts_measurables] ON [workouts_measurables].[id] = [measurables].[workout_id] LEFT OUTER JOIN [player_workout_types] ON [player_workout_types].[id] = [workouts_measurables].[player_workout_type_id] LEFT OUTER JOIN [measurable_types] ON [measurable_types].[id] = [measurables].[measurable_type_id] LEFT OUTER JOIN [reliabilities] ON [reliabilities].[id] = [measurables].[reliability_id] INNER JOIN [workouts] ON [measurables].[workout_id] = [workouts].[id] WHERE [workouts].[player_id] = @0 AND [measurables].[measurable_type_id] = @1  ORDER BY reliabilities.priority, player_workout_types.priority ASC, measurables.value DESC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY', N'@0 int, @1 int', @0 = 203646, @1 = 203

Active Record Query to put NULLs Last
player.measurables.includes(:workout, :measurable_type, :reliability, [workout: :player_workout_type])
.where(measurable_type_id: measurable_type.id)
.order('case when reliabilities.priority is not null then 0 else 99 end ASC, player_workout_types.priority ASC, measurables.value DESC').first

Result
It errors out with the following...
TinyTds::Error: The multi-part identifier "reliabilities.priority" could not be bound.:
  EXEC sp_executesql N'SELECT  [measurables].* FROM [measurables] INNER JOIN [workouts] ON [measurables].[workout_id] = [workouts].[id] WHERE [workouts].[player_id] = @0 AND [measurables].[measurable_type_id] = @1  ORDER BY case when reliabilities.priority is not null then 0 else 99 end ASC, player_workout_types.priority ASC, measurables.value DESC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY', N'@0 int, @1 int', @0 = 203646, @1 = 203

A: It appears I incorrectly thought that the includes worked as a left join. After making the following corrections from the comments left this worked for me..
player.measurables.includes(:workout, :measurable_type, :reliability, [workout: :player_workout_type], :reliability)
      .joins('left join reliabilities on reliabilities.id = measurables.reliability_id')
      .where(measurable_type_id: measurable_type.id)
      .order('case when reliabilities.priority is null then 99 else reliabilities.priority end ASC, measurables.value ASC').first


text:
Q: How to center-align a selected Item in a ComboBox in WinForms? I have a form with a ComboBox. I found the post: http://blog.michaelgillson.org/2010/05/18/left-right-center-where-do-you-align/ that helped me to centre-align all the items in the DropDown list. The problem is that the selected item (the item shown in the comboBox.Text property) remains left aligned.
How can I centre-align also the selected Item?
The code is:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ComboBoxTextProperty
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();

            List<string> source = new List<string>() { "15", "63", "238", "1284", "13561" };
            comboBox1.DataSource = source;
            comboBox1.DrawMode = DrawMode.OwnerDrawFixed;
            comboBox1.DropDownStyle = ComboBoxStyle.DropDown;
            comboBox1.SelectedIndex = 0;
            comboBox1.DrawItem += new DrawItemEventHandler(ComboBox_DrawItem);
    }

    /// <summary>
    /// Allow the text in the ComboBox to be center aligned.
    /// Change the DrawMode Property from Normal to either OwnerDrawFixed or OwnerDrawVariable.
    /// If DrawMode is not changed, the DrawItem event will NOT fire and the DrawItem event handler will not execute.
    /// For a DropDownStyle of DropDown, the selected item remains left aligned but the expanded dropped down list is centered.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
    {
        ComboBox comboBox1 = sender as ComboBox; // By using sender, one method could handle multiple ComboBoxes.
        if (comboBox1 != null)
        {
            e.DrawBackground(); // Always draw the background.
            if (e.Index >= 0) // If there are items to be drawn.
            {
                StringFormat format = new StringFormat(); // Set the string alignment.  Choices are Center, Near and Far.
                format.LineAlignment = StringAlignment.Center;
                format.Alignment = StringAlignment.Center;

                // Set the Brush to ComboBox ForeColor to maintain any ComboBox color settings.
                // Assumes Brush is solid.
                Brush brush = new SolidBrush(comboBox1.ForeColor);
                if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) // If drawing highlighted selection, change brush.
                {
                    brush = SystemBrushes.HighlightText;
                }
                e.Graphics.DrawString(comboBox1.Items[e.Index].ToString(), comboBox1.Font, brush, e.Bounds, format); // Draw the string.
            }
        }
    }
}
}

A: To make the text horizontally centered, you need to do two things:

*

*To center-align dropdown menu items, make the ComboBox owner-draw and draw the items yourself, center-aligned.

*To center-align the text area of the control, find the Edit control of the ComboBox and set ES_CENTER style for it to make it center-aligned as well.

You may also be interested to this post: ComboBox Text Align Vertically Center.
Example
To make the dropdown text align at center, you need to handle drawing of items yourself. To do so, set DrawMode property of ComboBox to OwnerDrawFixed. Then you can handle DrawItem event or override OnDrawItem.
To set the alignment of text area to center, you need to find the Edit control owned by ComboBox. To do so, you can use GetComboBoxInfo method which returns a COMBOBOXINFO. The next step is calling GetWindowLong method to get styles of the edit control and then add ES_CENTER and then call SetWindowLong to set the new style.
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class MyComboBox : ComboBox
{
    public MyComboBox()
    {
        DrawMode = DrawMode.OwnerDrawFixed;
    }

    [DllImport("user32.dll")]
    static extern int GetWindowLong(IntPtr hWnd, int nIndex);
    [DllImport("user32.dll")]
    static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
    const int GWL_STYLE = -16;
    const int ES_LEFT = 0x0000;
    const int ES_CENTER = 0x0001;
    const int ES_RIGHT = 0x0002;
    [StructLayout(LayoutKind.Sequential)]
    public struct RECT
    {
        public int Left;
        public int Top;
        public int Right;
        public int Bottom;
        public int Width { get { return Right - Left; } }
        public int Height { get { return Bottom - Top; } }
    }
    [DllImport("user32.dll")]
    public static extern bool GetComboBoxInfo(IntPtr hWnd, ref COMBOBOXINFO pcbi);

    [StructLayout(LayoutKind.Sequential)]
    public struct COMBOBOXINFO
    {
        public int cbSize;
        public RECT rcItem;
        public RECT rcButton;
        public int stateButton;
        public IntPtr hwndCombo;
        public IntPtr hwndEdit;
        public IntPtr hwndList;
    }
    protected override void OnHandleCreated(EventArgs e)
    {
        base.OnHandleCreated(e);
        SetupEdit();
    }
    private int buttonWidth = SystemInformation.HorizontalScrollBarArrowWidth;
    private void SetupEdit()
    {
        var info = new COMBOBOXINFO();
        info.cbSize = Marshal.SizeOf(info);
        GetComboBoxInfo(this.Handle, ref info);
        var style = GetWindowLong(info.hwndEdit, GWL_STYLE);
        style |= 1;
        SetWindowLong(info.hwndEdit, GWL_STYLE, style);
    }
    protected override void OnDrawItem(DrawItemEventArgs e)
    {
        base.OnDrawItem(e);
        e.DrawBackground();
        var txt = "";
        if (e.Index >= 0)
            txt = GetItemText(Items[e.Index]);
        TextRenderer.DrawText(e.Graphics, txt, Font, e.Bounds,
            ForeColor, TextFormatFlags.Left | TextFormatFlags.HorizontalCenter);
    }
}

Note: I put the whole logic inside a derived control called MyComboBox to make it more reusable and easier to apply, however, obviously you can do this without inheritance and just by relying on the events of an existing ComboBox control. You can also enhance the code a  bit by adding a TextAlignment property which allows setting the text alignment.


text:
Q: Match, Copy, Paste and clear takes a long time. How to speed up? I am using below code in one workbook as the following:
(1) Match a range on SheetA against a range on SheetB.
(2) If the data found on SheetB, then some values will be inserted on SheetB and Sheet Log.
(3) The matched data (rows) on SheetB will be copied to Sheet Result and Autofit.
(4) The matched data (rows) on SheetB will be cleared. (cut & paste is not applicable).
The count of values on the first range in SheetA is normally 7 or 8 and this macro was as fast as it takes 2 seconds to finish all that steps.
I tried to put 146 values on the first range, but the macro turned to be very slow and it took 35 seconds to finish.
Please, how to speed up and optimize this macro?
Note: there is no problem at all to change match code or copy, paste, autofit and clear code.
Link for the full macro and sheet on the first comment.
Sub Match_Copy()
    With Application
       .Calculation = xlCalculationManual
       .ScreenUpdating = False
       .EnableEvents = False
    End With
'----------------------------- Match, Code
     Dim Cell As Object, Match_A As Variant
      For Each Cell In WorkOrder
          Match_A = Application.Match(Cell.value, Auto_Data, 0)
            If Not IsError(Match_A) Then

              Cell.Offset(, 6).Resize(1, 3).value = Array("Close", Now, ws.name) 'Put Data of Close in every Area

            If ws.name = "SheetB" Then 'Put Data of Close in Log Sheet
              Sheets("Log").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Resize(1, 3).value = _
              Array(Application.UserName, Now, Cell)
            End If
           End If
        Next Cell

'----------------------------- Copy, Paste, AutoFit and Clear Code
    Dim StatusColumn As Range
    Set StatusColumn = ws.Range("G2", ws.Cells(Rows.Count, "G").End(xlUp))

      For Each Cell In StatusColumn
         If Cell.value = "Close" Then
            Cell.EntireRow.Copy

            Dim DestRng As Range
              Set DestRng = Sheets("Result").Cells(Rows.Count, "A").End(xlUp).Offset(1)
                  DestRng.PasteSpecial xlPasteValues

                DestRng.Rows.AutoFit
             If DestRng.Rows.RowHeight < 45 Then DestRng.Rows.RowHeight = 45

            End If
       Next Cell

 For Each Cell In StatusColumn
   If Cell.value = "Close" Then
      Cell.EntireRow.Clear
     End If
    Next Cell
'-----------------------------
    With Application
      .Calculation = xlCalculationAutomatic
      .ScreenUpdating = True
      .EnableEvents = True
    End With
End sub

A: Please, check the next adapted code. It uses arrays for faster iteration and for faster results return. Also, setting the row height for each cell consumes Excel resources. I commented some rows but no time now for everything. If something unclear, please do  not hesitate to ask for clarifications:
Sub Run_Close()
  Dim dStart As Double: dStart = Timer

    With Application
       .Calculation = xlCalculationManual
       .ScreenUpdating = False
       .EnableEvents = False
    End With
    '------------------
    Dim lastR As Long: lastR = Sheets("SheetA").Cells(Rows.Count, "A").End(xlUp).Row
    Dim Auto_Data As Range: Set Auto_Data = Sheets("SheetA").Range("A2:A" & lastR)

    Dim Count_Auto_Data As Long: Count_Auto_Data = WorksheetFunction.CountA(Auto_Data)
     If Count_Auto_Data = 0 Then Exit Sub

     With Auto_Data
        .NumberFormat = "General"
        .Value = .Value
     End With
    '------------------
    Sheets("Result").AutoFilter.ShowAllData

    Dim ws As Worksheet, arrWsFin, arrLog, k As Long
    For Each ws In Sheets(Array("SheetB")) 'There are another 3 Sheets
       ws.AutoFilter.ShowAllData

        Dim LastRow As Long: LastRow = ws.Cells(Rows.Count, "A").End(xlUp).Row

        Dim WorkOrder As Range: Set WorkOrder = ws.Range("A3:A" & LastRow)
        Dim arrWO: arrWO = WorkOrder.Value2        'place the range in an array for faster iteration
         ReDim arrWsFin(1 To LastRow, 1 To 3)      'redim array to keep the modifications in ws sheet
         ReDim arrLog(1 To 3, 1 To LastRow): k = 1 'redim array to keep maximum modif of ws sheet
        '----------------------------- Match, Code
         Dim Cell As Object, Match_A As Variant, i As Long
          For i = 1 To UBound(arrWO)
              Match_A = Application.Match(arrWO(i, 1), Auto_Data, 0)
              If Not IsError(Match_A) Then
                   arrWsFin(i, 1) = "Close": arrWsFin(i, 2) = Now: arrWsFin(i, 3) = ws.name

                    If ws.name = "SheetB" Then 'Put Data of Close in the array for further return at once
                      arrLog(1, k) = Application.UserName: arrLog(2, k) = Now: arrLog(3, k) = arrWO(i, 1): k = k + 1
                    End If
               End If
          Next i
          ws.Range("G2").Resize(UBound(arrWsFin), UBound(arrWsFin, 2)).Value = arrWsFin
          If k > 1 Then
            ReDim Preserve arrLog(1 To 3, 1 To k - 1)
            Sheets("Log").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Resize(UBound(arrLog, 2), UBound(arrLog)).Value = Application.Transpose(arrLog)
          End If

         '----------------------------- Copy, Paste and AutoFit, Code
        Dim StatusColumn As Range, totRng As Range, lastCol As Long, arrSt, arrResult, arrRow, j As Long
        lastR = ws.Cells(Rows.Count, "G").End(xlUp).Row
        Set StatusColumn = ws.Range("G2", ws.Cells(Rows.Count, "G").End(xlUp))
        arrSt = StatusColumn.Value2 'place the range in an array for faster iteration
        lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column
        Set totRng = ws.Range("A2", ws.Cells(lastR, lastCol))  'total range to extract the row slice

        Dim rngClearCont As Range
        ReDim arrResult(1 To lastCol, 1 To lastR): k = 1
        For i = 1 To UBound(arrSt)
             If arrSt(i, 1) = "Close" Then
                arrRow = totRng.Rows(i).Value
                'load arrResult array:
                For j = 1 To lastCol
                    arrResult(j, k) = arrRow(1, j)
                Next
                k = k + 1
                If rngClearCont Is Nothing Then
                    Set rngClearCont = StatusColumn.Cells(i) 'set the range necessary to clear rows at the end
                Else
                    Set rngClearCont = Union(rngClearCont, StatusColumn.Cells(i))
                End If
            End If
        Next i
        If k > 1 Then
            ReDim Preserve arrResult(1 To lastCol, 1 To k - 1)
            With Sheets("Result").Cells(Rows.Count, "A").End(xlUp).Offset(1).Resize(UBound(arrResult, 2), _
                                                UBound(arrResult))
                    .Value = Application.Transpose(arrResult)
                    .Rows.RowHeight = 45
            End With
            rngClearCont.EntireRow.ClearContents
        End If
        '-----------------------------
Next ws

    With Application
      .Calculation = xlCalculationAutomatic
      .ScreenUpdating = True
      .EnableEvents = True
    End With

    MsgBox "Time taken: " & Format(Timer - dStart, "0.00s")
End Sub

It should take less than a second...

A: The root of your issue is that you are making many edits to the worksheet.  One of the first ways to speed up VBA code is to reduce the number of times you write data to the sheet.
Rather than writing your data to the sheet every time in a For Each loop, add all of your data to an Array and then write that entire Array to the sheet(s) at once.  This way, you don't have to write multiple times for every For Each loop, but only once.
I cannot guarantee that this is the only reason your code is "sub-optimal" but it's a good place to start to improve performance times.

A: While writing to the sheet does take time, the main problem here is the copy/paste part.
If you, after the row
Cell.Offset(, 6).Resize(1, 3).value = Array("Close", Now, ws.name) 'Put Data of Close in every Area

Put something like:
Sheets("Result").Cells(Rows.Count, "A").End(xlUp).Offset(1).Resize(, 9).value = Array(Cell, , , , , , "Close", Now, ws.name)

And then remove the copy/paste part completely, you should be able to run it almost instantly.


text:
Q: AccessibilityService can't receive onKeyEvent or onGesture I'm a Chinese student who is doing some research in Android security.(There may be have some grammar errors in my sentences) I wanna use the accessibility API to capture the user's behaviors such as clicking the keyboard of IME and selecting certain characters.. But when I tried this API, I could only obtain the text of the current window and the actions that the user performs instead of any events from the keyboard. Maybe I missed something.
(I can't receive any events from onKeyEvent and onGesture. But I can receive events from onAccessibilityEvent.)
I have created the following basic Accessibility Service.
package com.jack.accessibility;

import java.util.List;

import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.annotation.SuppressLint;
import android.util.Log;
import android.view.KeyEvent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;

@SuppressLint("NewApi")
public class MyAccessibilityService extends AccessibilityService {
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    String eventText = getTypeName(event.getEventType()) + "===="
            + event.getContentDescription();
    Log.e("------------------------", "-------------------------");
    Log.d("PackageName", event.getPackageName().toString());
    Log.d("EventName", eventText);
    traverseNode(getRootInActiveWindow());
    Log.e("------------------------", "-------------------------");
}

@Override
public void onServiceConnected() {
    Log.e("---------ServiceConnected--------------",
            "------------ServiceConnected------------");
    AccessibilityServiceInfo info = new AccessibilityServiceInfo();
    info.packageNames = new String[] { "com.android.mms" };
    info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
    info.notificationTimeout = 100;
    info.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN;
    info.flags = AccessibilityServiceInfo.FLAG_REQUEST_FILTER_KEY_EVENTS;
    setServiceInfo(info);
}

@Override
public boolean onKeyEvent(KeyEvent event) {
    Log.i("Key", ".....");
    return true;
}

@Override
public boolean onGesture(int gestureId) {
    Log.v("THEIA", String.format("onGesture: [type] %s", gIdToString(gestureId)));
    return false;
}

@Override
public void onInterrupt() {
    Log.e("---------Interrupt--------------",
            "------------Interrupt------------");
}

private void traverseNode(AccessibilityNodeInfo node) {
    if (null == node)
        return;

    final int count = node.getChildCount();
    if (count > 0) {
        for (int i = 0; i < count; i++) {
            AccessibilityNodeInfo childNode = node.getChild(i);
            traverseNode(childNode);
        }
    } else {
        CharSequence text = node.getText();
        Log.d("test", "Node text = " + text);
    }

}
private String getTypeName(int type) {
        switch (type) {
        case AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START:
            return "TYPE_TOUCH_EXPLORATION_GESTURE_START";
        case AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END:
            return "TYPE_TOUCH_EXPLORATION_GESTURE_END";
        case AccessibilityEvent.TYPE_TOUCH_INTERACTION_START:
            return "TYPE_TOUCH_INTERACTION_START";
        case AccessibilityEvent.TYPE_TOUCH_INTERACTION_END:
            return "TYPE_TOUCH_INTERACTION_END";
        case AccessibilityEvent.TYPE_GESTURE_DETECTION_START:
            return "TYPE_GESTURE_DETECTION_START";
        case AccessibilityEvent.TYPE_GESTURE_DETECTION_END:
            return "TYPE_GESTURE_DETECTION_END";
        case AccessibilityEvent.TYPE_VIEW_HOVER_ENTER:
            return "TYPE_VIEW_HOVER_ENTER";
        case AccessibilityEvent.TYPE_VIEW_HOVER_EXIT:
            return "TYPE_VIEW_HOVER_EXIT";
        case AccessibilityEvent.TYPE_VIEW_SCROLLED:
            return "TYPE_VIEW_SCROLLED";
        case AccessibilityEvent.TYPE_VIEW_CLICKED:
            return "TYPE_VIEW_CLICKED";
        case AccessibilityEvent.TYPE_VIEW_LONG_CLICKED:
            return "TYPE_VIEW_LONG_CLICKED";
        case AccessibilityEvent.TYPE_VIEW_FOCUSED:
            return "TYPE_VIEW_FOCUSED";
        case AccessibilityEvent.TYPE_VIEW_SELECTED:
            return "TYPE_VIEW_SELECTED";
        case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED:
            return "TYPE_VIEW_ACCESSIBILITY_FOCUSED";
        case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED:
            return "TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED";
        case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
            return "TYPE_WINDOW_STATE_CHANGED";
        case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED:
            return "TYPE_NOTIFICATION_STATE_CHANGED";
        case AccessibilityEvent.TYPE_ANNOUNCEMENT:
            return "TYPE_ANNOUNCEMENT";
        case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED:
            return "TYPE_WINDOW_CONTENT_CHANGED";
        case AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED:
            return "TYPE_VIEW_TEXT_CHANGED";
        case AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED:
            return "TYPE_VIEW_TEXT_SELECTION_CHANGED";
        case AccessibilityEvent.TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY:
            return "TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY";
        }
        return "Unknown";
    }

private String gIdToString(int gID) {
    switch (gID) {
    case 1:
        return "GESTURE_SWIPE_UP";
    case 2:
        return "GESTURE_SWIPE_DOWN";
    case 3:
        return "GESTURE_SWIPE_LEFT";
    case 4:
        return "GESTURE_SWIPE_RIGHT";
    case 5:
        return "GESTURE_SWIPE_LEFT_AND_RIGHT";
    case 6:
        return "GESTURE_SWIPE_RIGHT_AND_LEFT";
    case 7:
        return "GESTURE_SWIPE_UP_AND_DOWN";
    case 8:
        return "GESTURE_SWIPE_DOWN_AND_UP";
    case 9:
        return "GESTURE_SWIPE_LEFT_AND_UP";
    case 10:
        return "GESTURE_SWIPE_LEFT_AND_DOWN";
    case 11:
        return "GESTURE_SWIPE_RIGHT_AND_UP";
    case 12:
        return "GESTURE_SWIPE_RIGHT_AND_DOWN";
    case 13:
        return "GESTURE_SWIPE_UP_AND_LEFT";
    case 14:
        return "GESTURE_SWIPE_UP_AND_RIGHT";
    case 15:
        return "GESTURE_SWIPE_DOWN_AND_LEFT";
    case 16:
        return "GESTURE_SWIPE_DOWN_AND_RIGHT";
    }
    return "UNKNOWN";
}
}

AndroidManifest.XML:
<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="18" />

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.jack.accessibility.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <service android:label="@string/acc_service_name" android:name=".MyAccessibilityService" android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
        <intent-filter>
            <action android:name="android.accessibilityservice.AccessibilityService" />
        </intent-filter>
        <meta-data
            android:name="android.accessibilityservice"
            android:resource="@xml/phone_accessibility" />
    </service>

</application>

phone_accessibility.xml:
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service android:description="@string/accessibility_service_description"
     android:accessibilityEventTypes="typeAllMask"
     android:accessibilityFeedbackType="feedbackAllMask"
     android:notificationTimeout="100"
     android:canRetrieveWindowContent="true"
     android:canRequestTouchExplorationMode="true"
     android:canRequestEnhancedWebAccessibility="true"
     android:canRequestFilterKeyEvents="true"
     android:accessibilityFlags="flagDefault"
  xmlns:android="http://schemas.android.com/apk/res/android" />

A: Add this:
info.flags = AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE;

A: From AccessibilityService, i couldn't get the AccessibilityNodeInfo for the IME or Keyboard.
From what i understood, you are trying to log the keys; but this is not possible. You need to have your own keyboard in order to log the keys pressed on the Keyboard.
But from AccessibilityService, you can get text content from all EditText's except the Password EditText's (who have password as their inputType).
Since you have already figured that out, i won't write the code to get text from a node.
If this was possible, would have been a major security issue wouldn't it?!

A: Try to configure the Accessibility Service like this:
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:accessibilityEventTypes="typeContextClicked|typeViewClicked"
  android:packageNames="com.example.andres.eventcapture"
  android:accessibilityFlags="flagRequestFilterKeyEvents"
  android:accessibilityFeedbackType="feedbackAllMask"
  android:notificationTimeout="50"
  android:canRetrieveWindowContent="true"
  android:settingsActivity=""
  android:canRequestFilterKeyEvents="true"
/>

It worked good!


text:
Q: Catch all "subpaths" beloning to a certain controller Is it possible to catch all subpaths under a controller?
Under FooController and BarController I would like to redirect all links that doesn't have a matching method in it's controller to the Redirect method:
www.domain.com/Foo/WhatEver - call Foo.Redirect()
www.domain.com/Foo/WhatEver2 - call Foo.Redirect()
www.domain.com/Bar/WhatEver - call Bar.Redirect()
www.domain.com/Bar/WhatEver2 - call Bar.Redirect()

I know it's possible to catch it on 404 as explained here but I would like to catch them on a controller level.
Is this possible and if so how?

A: In App_Start.RouteConfig I added this:
routes.MapRoute(
                "Foo",
                "Foo/{*arg}",
                new { controller = "Foo", action = "Redirect", arg = "" }
            );

That redirects all sub-paths with MP2 in it i.e.:
www.domain.com/Foo/
www.domain.com/Foo/SubPath/
www.domain.com/Foo/SubPath/AnotherSubPath/

It also includes index. If I remove the asterisk it only redirects sub-paths:
routes.MapRoute(
                    "Foo",
                    "Foo/{arg}",
                    new { controller = "Foo", action = "Redirect", arg = "" }
                );

Redirects these to the "Redirect" method under the "Foo" controller:
www.domain.com/Foo/SubPath/

It does not redirect the Index or sub-paths to the sub-path.


text:
Q: ANSYS: Change working directory while executing a macro I have a macro which creates a new folder in the current working directory while running it.  Now what I want to do is as soon as the macro creates the new folder in the working directory, all the further files including .db and .rst should be saved to this new folder. I tried the save command but somehow it is not working.
Any help is appreciated.
Thanks.

A: Worked for me in ANSYS 15.0. Assuming you're talking about ANSYS APDL ("clasic").
/SYP,mkdir ,'mytest'  ! Create new working directory in the current WD
/CWD,'C:\default_workdir\mytest'   ! Change WD to the new one
save   ! save .db

If it doesn't work then simly issue all SAVE commands with specification of full path: SAVE, Fname, Ext
Read the ANSYS Help Doucmentation. It is a good one.


text:
Q: Is there a way to add children components to functional stateless components that are called as functions? I have a functional stateless component like so:
const Map = (props) => {
    ...
}

And I want to call it as a function inside of a container
{Map()}

Normally I know I can include children
<Map>
    <ChildComponent />
</Map>

Is there a way do the same thing while calling the component as a function?

A: I want to call it as a function, yes you can. But then you will have to restructure your components and it will come at come cost. You cannot use them interchangeably without some compromises.
Following is a sample:

const Parent = function(props){
  return (

 This is Parent

      {
        Array.isArray(props.children) ?
          props.children.map(x => typeof(x) === 'function' ? x() : x) :
          null
      }

  )
}

const Child = function(props){
  return (

This is Child! My name is {props.name}

  )
}

let JSX = Parent({
  children: [
    Child.bind(null, {name: 'foo'}),
    Child.bind(null, {name: 'Bar'})
  ]
});
ReactDOM.render(JSX, document.getElementById('content'));

let JSX2 = (
  <Parent>
    <Child name='Jon'/>
  </Parent>
)

ReactDOM.render(JSX2, document.getElementById('content2'));


text:
Q: How to find persons participating in all the films I can't formulate the following queries to save my life:
Who participated in all films, which film was shown in all cinemas, which cinemas show all films?
Given the following relations:
film: [ID, title, year, genre]
person: [ID, name, firstname]
cinema: [ID, name, city]
participation: [film, person, function ('actor', or 'director')]
show: [film, date, cinema]

Where film, person, and cinema are foreign keys in Participation and Show.
I'm also not sure if the ALL keyword is required, or if it can be done without it.

A: who participated in al films?
select person_id,count(*) as c
from participation
group by person_id
having c = (select count(*) from film)

You should be ok to get the rest now since it's the same procedure.
I did a little fiddle to try it: sqlfiddle

A:
How to find persons participating in all the films

One method is to count, for each person, a number of films that this person participaded in, and then compare with a total number of films
SELECT person_id
FROM participation
GROUP BY person_id
HAVING count( distinct film_id ) = (
          SELECT count(*) FROM film
)

A: These can be solved with sub-queries:
1) Who participated in all films
Select ID
From person as P1
where not exists
   (select distinct id
    from film
    difference
    select distinct film_id
    from participation as P2
    where P2.person_Id = P1.Id)

The subquery finds all movies in which the person participates, and takes the difference with all movies. If the person participates in all, then the result will be an empty set. The outer query finds that persons participate in all movies by checking that the subquery returns an empty set.
The pattern can be used to answers the other queries.


text:
Q: ReactiveCocoa observe two properties When observing just one property the following code works fine:
[[[[RACObserve(self, userName) ignore:nil]
           flattenMap:^(NSString *userName) {

               return [self authenticateUserWithUserName:userName andPassword:@"password"];

           }] deliverOn:RACScheduler.mainThreadScheduler]
         subscribeError:^(NSError *error) {

             // TODO: Propagate error

         }];

But when a try to observe two properties at the same time I don't get the results back:
 [[[RACSignal
            combineLatest:@[ [RACObserve(self, userName) ignore:nil],
                             [RACObserve(self, password) ignore:nil] ]
            reduce:^(NSString *userName,
                     NSString *password) {

                return [self authenticateUserWithUserName:userName andPassword:password];

            }]deliverOn:RACScheduler.mainThreadScheduler]
          subscribeError:^(NSError *error) {

              // TODO: Propagate error

          }];

Here is the rest of the code:
 @property (nonatomic, strong) PFPClient *client;

 -(RACSignal *)authenticateUserWithUserName:(NSString *)userName andPassword:(NSString *)password {

     return [[self.client authenticateUser:_userName withPassword:_password] doNext:^(PFPAccessToken *accessToken) {
         self.accessToken = accessToken;
     }];
      }

The client class:
 -(RACSignal *)authenticateUser:(NSString *)userName withPassword:(NSString *)password {

     NSString *urlString = [NSString stringWithFormat:@"https://xxxx?username=%@&password=%@", userName, password];
     NSURL *url = [NSURL URLWithString:urlString];

     return [[self fetchJSONFromURL:url] map:^(NSDictionary *json) {
         return [MTLJSONAdapter modelOfClass:[PFPAccessToken class] fromJSONDictionary:json error:nil];
     }];
      }

 -(RACSignal *)fetchJSONFromURL:(NSURL *)url {

     NSLog(@"Fetching: %@", url.absoluteString);

     // When observing two properties, next block is never executed...

     return [[RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {

         NSLog(@"Opening request...");
         NSURLSessionDataTask *dataTask = [self.session dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse
 *response, NSError *error) {

             NSLog(@"Request finished.");
             if (! error) {
                 NSError *jsonError = nil;
                 id json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&jsonError];
                 if (! jsonError) {
                     [subscriber sendNext:json];
                 }
                 else {
                     [subscriber sendError:jsonError];
                 }
             }
             else {
                 [subscriber sendError:error];
             }

             [subscriber sendCompleted];

         }];

         [dataTask resume];

         return [RACDisposable disposableWithBlock:^{
             [dataTask cancel];
         }];

     }] doError:^(NSError *error) {

         NSLog(@"%@",error);

     }]; }

Any idea of what I'm doing wrong?

EDIT. The call has to be done like this:
[[[[RACSignal
            combineLatest:@[ [RACObserve(self, userName) ignore:nil],
                             [RACObserve(self, password) ignore:nil] ]]
           flattenMap:^(RACTuple *userNameAndPassword) {

               RACTupleUnpack(NSString *userName, NSString *password) = userNameAndPassword;
               return [self authenticateUserWithUserName:userName andPassword:password];

           }]
          deliverOn:RACScheduler.mainThreadScheduler]
         subscribeError:^(NSError *error) {

             // TODO: Propagate error

         }];

A: [[[RACSignal
           combineLatest:@[ [RACObserve(self, userName) ignore:nil],
                            [RACObserve(self, password) ignore:nil] ]]
           flattenMap:^(RACTuple *userNameAndPassword) {
               RACTupleUnpack(NSString *userName, NSString *password) = userNameAndPassword;
               return [self authenticateUserWithUserName:userName andPassword:password];
           }]
           deliverOn:RACScheduler.mainThreadScheduler]
           subscribeError:^(NSError *error) {

               // TODO: Propagate error

           }];

A: With Swift is pretty simple
let emailSignal = self.textFieldEmail.reactive.continuousTextValues
let passwordSignal = self.textFieldPassword.reactive.continuousTextValues
emailSignal.combineLatest(with: passwordSignal).observeValues { (mail, password) in
    guard let mailText = mail, let passwordText = password else {
        self.buttonLogin.isEnabled = false
        return
    }
    self.buttonLogin.isEnabled = mailText.count > 0 && passwordText.count > 0
}


text:
Q: XSLT for-each statement not iterating proper amount of times I am having trouble with my XSLT for-each statements. When I run the XML through the XSLT, it only comes up with the first iteration of the list, and then stops. It doesn't post the values either. Here is the XML code.
<?xml version="1.0" encoding="UTF-8"?>
<template>
    <L>
        <Q>Hey</Q>
        <Q>There</Q>
        <Q>Thank
            <R>You</R>
            <R>For</R>
            <R>The</R>
            <R>Help</R>
            <R>I</R>
            <R>Hope</R>
            <R>This</R>
        </Q>
        <Q> will work!
        </Q>
    </L>
</template>

here is the xslt code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/template/L">

<xsl:for-each select="Q">

<xsl:value-of select="Q"/>

<xsl:for-each select="R">

<xsl:value-of select="R"/>

        </xsl:for-each>

</xsl:for-each>

</xsl:template>
</xsl:stylesheet>

the output should look like an unordered list with another list embedded inside of it (the R tags are the embedded list values). It should look something like this:

*

*Hey

*There

*Thank

*

*You

*For

*The

*Help

*I

*Hope

*This

*will work!

here

A: Try it this way?
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/template/L">

           <xsl:for-each select="Q">

                 <xsl:value-of select="text()"/>

                    <xsl:for-each select="R">

                          <xsl:value-of select="."/>

                    </xsl:for-each>

           </xsl:for-each>

</xsl:template>

</xsl:stylesheet>

Explanation:
When you are in the context of <xsl:for-each select="Q">, the instruction <xsl:value-of select="Q"/> does not select anything (unless the Q element has another Q element as a child). Similarly, <xsl:value-of select="R"/> does not select anything when the context is <xsl:for-each select="R">.
This is in addition to the comment regarding self-closing the xsl:for-each element.

the sub-list should only be created if the <Q> tag has a <R> tag child

I don't see what difference it makes (in HTML), but if you want, you can do:
<xsl:template match="/template/L">

           <xsl:for-each select="Q">

                 <xsl:value-of select="text()"/>
                 <xsl:if test="R">

                        <xsl:for-each select="R">

                              <xsl:value-of select="."/>

                        </xsl:for-each>

                 </xsl:if>

           </xsl:for-each>

</xsl:template>


text:
Q: Alert if anything inside the Form is used and not empty

$('form input').change(function(){
  if ($(this).val() != '') {
    alert('The Form Not Empty');
  } else {
    alert('The Form Empty')
  }
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form method='get' action=''>
  <input type='text'>
  <input type='number'>
  <input type='checkbox'>
</form>

I want to track the form inputs, If the entire form inputs are empty, i alert empty once, If a single input is not empty, I alert not empty
I keep getting Not Empty on the checkbox, But it works ok on the text inputs.
Can I just track the form itself if it is not totally empty or not instead of the inputs?

A: $(this).val() is not a good test for a checkbox, the value is always "on", which is not empty.
For checkboxes you need to use .prop()

$('form input').change(function(event) {
  console.log($(this).val())
  if (event.target.type === 'checkbox') {
    if ($(this).prop('checked') === true) {
      console.log('checked');
    } else {
      console.log('not checked');
    }
  }
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form method='get' action=''>
  <input type='text'>
  <input type='number'>
  <input type='checkbox'>
</form>

A: HTML has a build in feature called required to alert the user that the form should not be empty. For your form it should look like this:
<form method='get' action=''>
  <input type='text' required>
  <input type='number' required>
  <input type='checkbox' required>
</form>

A: You can use the required attribute for your form or inputs to make them mandatory, more informations here.


text: Q: Interpolated Line shows in EPSG:4326 but disappears in others I'm trying to stylize rivers but it's impossible since Interpolated Line ("tapered line") shows only in EPSG:4326 but disappears in EPSG:3857 and EPSG:25835. I have no idea why is that.


text:
Q: INSERT INTO Compare tables from 2 databases I am looking to compare 2 tables from 2 databases on the same server and insert that data into a 3rd table. I thought this would be easy but am not sure how to do this with 2 databases. The code below is not liked by SQL Server. Any help would be great.
INSERT INTO WaterAccounts (CaseNumberKey, MASTER_ACCOUNT,
                            OWNER_NAME, MAIL_NAME, ACCT_BALANCE)
   SELECT
      B.CaseNumberKey,
      C.MASTER_ACCOUNT,
      C.OWNER_NAME,
      C.MAIL_NAME,
      C.ACCT_BALANCE
   FROM
      newCityCollection.PropertyInformation B, DEM C
   WHERE
      B.Name = C.SERV_STREET
      AND B.DIRECTION = C.SERV_DIRECTION
      AND B.NUM = C.SERV_STREET_NO

A: If the newCityCollection is the other database, and PropertyInformation the table in it, you're missing the schema name. Assuming it's dbo (probably is), you shoud write something like this:
   INSERT INTO WaterAccounts (CaseNumberKey, MASTER_ACCOUNT, OWNER_NAME, MAIL_NAME, ACCT_BALANCE)
   SELECT
      B.CaseNumberKey, C.MASTER_ACCOUNT, C.OWNER_NAME,
      C.MAIL_NAME, C.ACCT_BALANCE
   FROM newCityCollection.dbo.PropertyInformation B
   INNER JOIN DEM C
      ON B.Name = C.SERV_STREET
        AND B.DIRECTION = C.SERV_DIRECTION
        AND B.NUM = C.SERV_STREET_NO


text:
Q: How to convert bytes to ndarray in python 3 using numpy.ndarray.toString() and numpy.fromString()? In order to save in lmdb , I use numpy.ndarray.toString() to convert an ndarray to a bytes object,and when I want to read the bytes to an ndarray with numpy.fromString(),I get an ndarray but the shape changed.So how to convert between them?
I have tried to use pickle with dumps() and loads(),but there was some exception in
_pickle.UnpicklingError: invalid load key, '?'.

save code here :
class face_lmdb:
    def add_embed_to_lmdb(self,id,vector):
        self.db_file=os.path.abspath(face_comm.get_conf('lmdb','lmdb_path'))
        id = str(id)
        evn = lmdb.open(self.db_file)
        wfp = evn.begin(write=True)
        print(vector.shape)# here is (512,)
        wfp.put(key=id.encode(), value=vector.toString())
        wfp.commit()
        evn.close()

load code here
    def create_index_from_lmdb(self):
        lmdb_file = self.lmdb_file
        if os.path.isdir(lmdb_file):
            evn = lmdb.open(lmdb_file)
            wfp = evn.begin()
            annoy = AnnoyIndex(self.f)
            for key, value in wfp.cursor():
                key = int(key)
                print(type(value))#here is bytes
                value = np.fromstring(value)
                print(value.shape)# here is (256,)
                annoy.add_item(key,value)

            annoy.build(self.num_trees)
            annoy.save(self.annoy_index_path)

I expect the shape is (512,),butI get (256,)


text:
Q: Access ViewBag from JavaScript I'm passing some value from the controller to the view with ViewBag, I am trying to access this value from JavaScript like:

Passing Data From Controller to View using ViewBag

Where Lon is propery of type int.
but when I run this code it doest shows the value I'm passing

A: Razor code can be added with Javascript
    var x=JSON.Parse(@ViewBag.objJson...)

A: Hi I've had a similar issue before and for a statistical table
so try using the code below I'm sure it will work.
var val = @html.Raw(ViewBag.Lon);


text:
Q: Using DataTrigger to change colour of ListView depending on value returned in ItemSource I have a XAML page with a listview. What I want to do is when the value of the first column "NumType" equals "S" the background colour for that row is set to a different colour.
I have been looking at using DataTriggers, but I'm not sure if this is the way to go.
Below is the code that I currently have.
?xml version="1.0" encoding="UTF-8"?>
<Grid        xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:MobileWarehouseXamarin.Controls"
             xmlns:ef="clr-namespace:MobileWarehouseXamarin.Effects"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             x:Class="MobileWarehouseXamarin.Controls.MW_AdjustmentsAwaiting_0"
             xmlns:vm="clr-namespace:MobileWarehouseXamarin.ViewModels;assembly=MobileWarehouseXamarin"
             x:Name="this"
             RowSpacing="0"
             ColumnSpacing="0"
             Padding="5,0,5,0">

    <Grid.RowDefinitions>
        <RowDefinition Height="30" />
        <RowDefinition Height="*" />
        <RowDefinition Height="35" />
    </Grid.RowDefinitions>

    <Grid Grid.Row="0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="70"/>
            <ColumnDefinition Width="100"/>
            <ColumnDefinition Width="80"/>
            <ColumnDefinition Width="80"/>
            <!--<ColumnDefinition Width="300"/>-->
        </Grid.ColumnDefinitions>
        <Label Grid.Column="0" Text="Location" Style="{StaticResource KeyValueSmall_Key}" />
        <Label Grid.Column="1" Text="Barcode" Style="{StaticResource KeyValueSmall_Key}" />
        <Label Grid.Column="2" Text="User" Style="{StaticResource KeyValueSmall_Key}" />
        <Label Grid.Column="3" Text="Date" Style="{StaticResource KeyValueSmall_Key}" />
        <!--<TextBlock Grid.Column="4" Text="Reason" Style="{StaticResource TextBlockLabel}" />-->
    </Grid>

    <ListView Grid.Row="1" x:Name="gridViewAwaitingAdjustmentDetails"  ItemsSource="{Binding AwaitingAdjustment}" SelectedItem="{Binding SelectedAdjustment, Mode=TwoWay}" >
        <!--Style="{StaticResource ListViewItemHighlighted}">-->
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="70"/>
                            <ColumnDefinition Width="100"/>
                            <ColumnDefinition Width="80"/>
                            <ColumnDefinition Width="80"/>
                            <!--<ColumnDefinition Width="300" />-->
                        </Grid.ColumnDefinitions>

                        <Label Grid.Row="0" Grid.Column="0" Text="{Binding NumType}" Style="{StaticResource KeyValueSmall_Value}" Margin="0,0,0,0" />
                        <Label Grid.Row="0" Grid.Column="0" Text="{Binding LocationCode}" Style="{StaticResource KeyValueSmall_Value}" Margin="0,0,0,0" />
                        <Label Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Text="{Binding Barcode}" Style="{StaticResource KeyValueSmall_Value}" Margin="0,0,0,0" />
                        <Label Grid.Row="0" Grid.Column="2" Text="{Binding UserName}" Style="{StaticResource KeyValueSmall_Value}" Margin="0,0,0,0" />
                        <Label Grid.Row="0" Grid.Column="3" Grid.RowSpan="2" Text="{Binding PickingAdjustementDate}" Style="{StaticResource KeyValueSmall_Value}" Margin="0,0,0,0" />

                    </Grid>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

</Grid>

Any thoughts or suggestions would be very much appreciated
I have looked at using the DataTrigger, but not sure how to go about it or would I be better off looking at Template Selectors?

A: There are several ways to achieve this.
A simple method is to add a field to the item of your ListView and bind it to the                         BackgroundColor of the item, for example:
public Color BgColor { get; set; } = Color.Yellow;

I created a simple demo and achieved this function,you can refer to the following code:
Item.cs
public class Item: INotifyPropertyChanged
    {
        public Color BgColor { get; set; } = Color.Yellow;

        private string _numType;
        public string NumType
        {
            get => _numType;
            set
            {
                SetProperty(ref _numType, value);

                setBgColor();// set BgColor
            }
        }

        private void setBgColor()
        {
            if (NumType != null && NumType.Equals("S")) {
                BgColor = Color.Green;
            }
        }

        public string LocationCode { get; set; }

        public string Barcode { get; set; }
        public string UserName { get; set; }

        public string PickingAdjustementDate { get; set; }

        bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
        {
            if (Object.Equals(storage, value))
                return false;

            storage = value;
            OnPropertyChanged(propertyName);
            return true;
        }

        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }

MyViewModel.cs
public class MyViewModel
    {
        public ObservableCollection<Item> Items { get; set; }

        public MyViewModel() {
         Items = new ObservableCollection<Item>();

            Items.Add( new Item { NumType = "S" , LocationCode = "0001"});
            Items.Add(new Item { NumType = "M", LocationCode = "0002" });
            Items.Add(new Item { NumType = "L", LocationCode = "0003" });

        }
    }

MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xamlistviewapp131="clr-namespace:XamListViewApp131"
             x:Class="XamListViewApp131.MainPage">

    <ContentPage.BindingContext>
        <xamlistviewapp131:MyViewModel></xamlistviewapp131:MyViewModel>
    </ContentPage.BindingContext>

    <StackLayout>
        <ListView Grid.Row="1" x:Name="gridViewAwaitingAdjustmentDetails"  ItemsSource="{Binding Items}"  >
            <!--Style="{StaticResource ListViewItemHighlighted}">-->
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <Grid BackgroundColor="{Binding BgColor}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="70"/>
                                <ColumnDefinition Width="100"/>
                                <ColumnDefinition Width="80"/>
                                <ColumnDefinition Width="80"/>
                                <!--<ColumnDefinition Width="300" />-->
                            </Grid.ColumnDefinitions>

                            <Label Grid.Row="0" Grid.Column="0" Text="{Binding NumType}" Margin="0,0,0,0" />
                            <Label Grid.Row="0" Grid.Column="0" Text="{Binding LocationCode}"  Margin="0,0,0,0" />
                            <Label Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Text="{Binding Barcode}"  Margin="0,0,0,0" />
                            <Label Grid.Row="0" Grid.Column="2" Text="{Binding UserName}"  Margin="0,0,0,0" />
                            <Label Grid.Row="0" Grid.Column="3" Grid.RowSpan="2" Text="{Binding PickingAdjustementDate}"  Margin="0,0,0,0" />

                        </Grid>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </StackLayout>

</ContentPage>


text:
Q: Str.split() en Python Estoy intentando separar en varias columnas los datos de la celda de una columna en concreto haciendo la separación por espacios en blanco. La cosa es que me gustaría que los nombres de las columnas en que se subdividan tengan todas el mismo nombre. El problema es que el número de datos en la celda a dividir es variable.
personas = pd.DataFrame({'Nombres': ['Jorge Sanz', 'Almudena Cid', 'Ernesto Alterio']})
personajes = personas.join(personas.pop('Nombres').str.split(expand=True))

    0   1
0   Jorge   Sanz
1   Almudena    Cid
2   Ernesto Alterio

El problemas es que quiero crear tantas columnas como apellidos aparezcan y que todas tengan el nombre Apellidos pero hay veces que vienen 3 apellidos o 4... y quiero que, para cada vez que corra el proceso, independientemente del número de apellidos que haya cree tantas columnas llamadas Apellidos como apellidos contengan los datos.
Gracias


text:
Q: How to edit file inside react-native project using appium I have a config file called app.config inside my react-native project.
I use this file to read configuration such as backend and other configuration details.
I am using appium for UI-testing my react native application.
Is it possible that I can dynamically change the app.config(example changing backend URL) file during testing using appium.

A: This should be possible, but you don't need to use appium. Use whatever test framework you are using to modify the file as part of the build process before launching the app and starting the appium session.


text:
Q: ASP.NET w-s ... consuming from Excel? We have a web-service within an existing ASP.NET website which works fine when accessed via other ASP.NET bits. I'd like to get Excel 2007 and 2003 to call the w-s and refresh part of a worksheet with the results using VBA.
Ideally I'd like a vanilla version of Excel to be able to do this (ie without the client having to install extra bits).
As a starter (in 2007) I tried Data->Get External Data->From Web. Pointed it at : http://myhost/myvirtdir/ABCInfoWS.asmx?WSDL&op=testwebservice1
Stuff appears in Excel (albeit with 'The Specified XML source does not refer to a schema' message) but it turns out that it's actually a description of all web-services offered under the same WSDL.
Can anyone tell me how I can get the data from testwebservice via VBA ?

A: Remove the ?WSDL part from the URL above.
EDIT: What does your webservice return?
Excel's Data -> Import Data expects a tabular structure built with tr & td to get the data in.
If your webservice returns XML, it should work as well.

A: Sorry it turns out I can't provide enough infromation via comments. This is what is appearing in Excel when I select SOAP 2 and XML:
Just responding to your edits my w-s returns XML and this is what it looks like - it doesn't contain tr/td because it's previously been used as a 'real' webservice .
I've realised that I'm not getting the actual data at all but instead a description of the data that the webservice provides - I guess my URL is still off the beat a bit ?
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetBookJobStatusResponse xmlns="http://www.protecttheguilty.com/">
<GetBookJobStatusResult>
<BookJobStatus>
<JobStatus>string</JobStatus>
<JobType>string</JobType>
<RequestTime>dateTime</RequestTime>
<StartTime>dateTime</StartTime>
<EndTime>dateTime</EndTime>
<PathToOutput>string</PathToOutput>
</BookJobStatus>
<BookJobStatus>
<JobStatus>string</JobStatus>
<JobType>string</JobType>
<RequestTime>dateTime</RequestTime>
<StartTime>dateTime</StartTime>
<EndTime>dateTime</EndTime>
<PathToOutput>string</PathToOutput>
</BookJobStatus>
</GetBookJobStatusResult>
</GetBookJobStatusResponse>
</soap12:Body>
</soap12:Envelope>


text:
Q: Undefined method Class `all' in Rails 4 app I have been following various Ruby on rails REST API tutorials, specifically those using the GRAPE gem. On all these attempts, I have been encountering a undefined method `all' error. I am new to RoR and have been relying on the generators for model generation. Here is the error and code in question:
undefined method `all' for API::V1::EmailAuth:Class
module API
  module V1
  class EmailAuth < Grape::API
    version 'v1' # path-based versioning by default
    format :json # We don't like xml anymore

    resource :email_auth do
      desc "Return list of email_auth"
      get do
        EmailAuth.all # obviously you never want to call #all here
      end
      end
    end
  end
end

The file structure can be seen here: http://imgur.com/A2VnevL
(My rep is too low to post images)
This is my first time actually posting something in stackoverflow, do let me know if I can refine the question.
Just a note: I have refered to Undefined method `all' for ActiveSupport in Rails 4.0.0 app and various similar questions regarding namespace issues, but can seem to resolve this issue.
Thanks!

A: If you have a class Grape::API::EmailAuth and in this class you want to load the active record class EmailAuth, then you need to reference it by two colons:
get do
  ::EmailAuth.all
end


text:
Q: How do I parse this JSON data in C# and would it be more benefical to simply switch over to javascript? I'm looking to parse this JSON and I've had nothing but problems. The link to the JSON is here. I'm trying to access the "href" field. While writing this up, I realized that that the data field is actually an array so that is part of my problem.
class Program
   {
       static void Main(string[] args)
       {
        var json = System.IO.File.ReadAllText(@"C:\Users\...\file.json");
        Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(json);
        var x = myDeserializedClass.result.extractorData.data;
        Console.Write(x.ToString());
    }

    public class Newcolumn
    {
        public string text { get; set; }
        public string xpath { get; set; }
        public string href { get; set; }
        public string filepath { get; set; }
        public string fileMimeType { get; set; }
        public int fileTotalBytes { get; set; }
        public string fileLastModifiedTime { get; set; }
    }

    public class Group
    {
        public List<Newcolumn> Newcolumn { get; set; }
    }

    public class Datum
    {
        public List<Group> group { get; set; }
    }

    public class ExtractorData
    {
        public string url { get; set; }
        public List<Datum> data { get; set; }
    }

    public class PageData
    {
        public int statusCode { get; set; }
        public long timestamp { get; set; }
    }

    public class Inputs
    {
        public string _url { get; set; }
    }

    public class Result
    {
        public ExtractorData extractorData { get; set; }
        public PageData pageData { get; set; }
        public Inputs inputs { get; set; }
        public string taskId { get; set; }
        public long timestamp { get; set; }
        public int sequenceNumber { get; set; }
    }

    public class Root
    {
        public string url { get; set; }
        public Result result { get; set; }
    }

}

This ends up returning: System.Collections.Generic.List`1[ConsoleApp3.Datum]

I notice that the field name data actually turns into an array though I'm not sure how to structure that. data.[0].new Column.[0].group.etc... does not work obviously. The space in the "new Column" field is also problematic. Additionally, when I debug and look at the JSON viewer, the "new column field is null. I also tried this code:
public static void Main()
{

    var json = System.IO.File.ReadAllText(@"C:\Users\...\file.json");
    dynamic stuff = JsonConvert.DeserializeObject(json);
    var a = stuff.result.extractorData.data;
    string b = a.ToString();
    Console.WriteLine(b);
    Console.WriteLine("Press any key to exit.");
    System.Console.ReadKey();
}

This actually does return the data field object however, if I do stuff.result.extractorData.data.group; I get this:
 Microsoft.CSharp.RuntimeBinder.RuntimeBinderException
  HResult=0x80131500
  Message='Newtonsoft.Json.Linq.JArray' does not contain a definition for 'group'
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

I assume that this is probably because of the array contained within the data field, regardless the "new Column' field is also an issue with this method due to the space.

A: in your above code
 public class ExtractorData
 {
     public string url { get; set; }
     public List<Datum> data { get; set; }
 }

where data is List and you are trying to access as string
 Console.Write(x.ToString());

in data variable Datum is List ( where your variable have multiple Data) and in every element there is a List. (Nestest List Concept Applied in This JSON)
Try to Add Break Point on below Line and check the line by line Excution of Code.
var a = stuff.result.extractorData.data;

After Looking Your JSON File Image Try This Code
Console.Write(a.FirstOrDefault()?.group.FirstOrDefault()?.Newcolumn.FirstOrDefault()?.href);


text:
Q: Pycharm : package Pycurl installed but not found (ModuleNotFoundError) I installed pycurl for python3
but when I want to import it to Pycharm and use it I get this error message:
Traceback (most recent call last):
  File "/home/cours/PycharmProjects/untitled2/venv/test.py", line 1, in <module>
    import pycurl
ModuleNotFoundError: No module named 'pycurl'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/home/cours/PycharmProjects/untitled2/venv/test.py", line 1, in <module>
    import pycurl
ModuleNotFoundError: No module named 'pycurl'

But when I install it with the Pycharm terminal (pip install pycurl) I get this message
Requirement already satisfied: pycurl in /usr/lib/python3/dist-packages (7.43.0.1)

I also already imported the package with : Settings -> Python Interpreter
And finally i also used : "Inherit global site-package" option of the project and the problem is the same
I have no idea what else i can do

A: use command this command to install package -
pip3 install pycurl
and also check the Pycharm python version in for code compile


text:
Q: WinCvs Client setup Dear all, I am using gcvs-1.11 version. My cvs server in RHEL ,i have some RHEL machines and some Windows Xp machines as client.RHEL cvs clients are working fine but from windows i couldn't able to access cvs server. In installed WinCvs 2.0.24 in windows. when i am trying to login from windows machine it doesn't respond for my request.I am getting
"Unable to initialize the CVS process: The system cannot find the file specified. The CVS used is : cvs.exe" as result. How to setup WinCvs client to access gcvs. Thanks in advance

A:
To resolve it I reinstalled CVSNT this time allowing the CVSNT Server to be installed.  This fixed the problem although I now had to manually disable the unwanted CVSNT services.

(I have not tried. Please let us know whether it successes or not.)
Reference: http://www.cvsnt.org/pipermail/cvsnt/2006-January/023339.html

A: Please try "Run as administrator". It works on Windows 7 when I experienced the same situation.


text:
Q: Updating values in 2 tables where values reference each other I have 2 tables which i am trying to insert values into.
Table 1:
CREATE TABLE `subusers` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`UserId` bigint(20) NOT NULL,
`BranchId` bigint(20) NOT NULL,
 `Username` varchar(30) NOT NULL,
`Password` char(64) NOT NULL,
`Salt` char(64) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB

Table 2:
CREATE TABLE `branch` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`BusinessId` bigint(20) NOT NULL,
`UserId` bigint(20) NOT NULL,
`Name` varchar(30) NOT NULL,
`Info` varchar(300) NOT NULL,
PRIMARY KEY (`id`),
KEY `UserId` (`UserId`),
KEY `BusinessId` (`BusinessId`)
) ENGINE=InnoDB
ALTER TABLE `branch`
ADD CONSTRAINT `branch_ibfk_1` FOREIGN KEY (`UserId`) REFERENCES `subusers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

I am trying to use an insert query to add values to the table, where i require the columns subusers.branchid=branch.id AND branch.userid=subuser.id . HOwever, upon insertion of the data via my query, the result i get is subuser.branchid=x-1 AND branch.userid=x-1 WHERE x is the id of the latest row inserted.
E.g
 Table SubUSers
----------------------------------------
|id |UserId|BranchId|Username|Password |
-----------------------------------------
|22 |    2  |    0   | Add    |  Add   |<--1st insert
---------------------------------------
| 23|    2  |    0   | Add    |  Add   |<--2nd insert(Branch id should be 23)
---------------------------------------
| 24|    2  |    23  | DER    |  DER   |<--3rd insert(Branch id should be 24)
---------------------------------------

Table Branch
-----------------------------------
|id |BusinessId|UserId|Name|Info  |
-----------------------------------
|NIL|  NIL  |    NIL  | NIL | NIL | <---First Insert
-----------------------------------
|23 |    1  |    22   | Add |  Add| <---2nd Insert(UserId should be 23)
-----------------------------------
|24 |    1  |    22   | DER |  DER| <---3rd insert(UserId should be 24)
-----------------------------------

On the first insert, i get the error:
 Cannot add or update a child row: a foreign key constraint fails (`kenced`.`branch`, CONSTRAINT `branch_ibfk_1` FOREIGN KEY (`UserId`) REFERENCES `subusers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)

While on the subsequent tries, the insert query works, but the values for Subusers.branchid and branch.userid are wrong.
My Code:

<?PHP
session_start();

if(@$_SESSION['Auth']!=="Yes" AND @$_SESSION['Type']!=="Admin")
{
echo"You are not authorised to view this page.Please click here to login.";
exit();
}
?>

<?PHP

if(@$_POST['adduser']=="Submit")
{
include("cxn.inc");
$userid=$_SESSION['UserId'];
$username=$_POST['username'];
$username=mysqli_real_escape_string($cxn,$username);
$password=$_POST['password'];
$password=mysqli_real_escape_string($cxn,$password);
$name=$_POST['name'];
$name=mysqli_real_escape_string($cxn,$name);
$info=$_POST['info'];
$info=mysqli_real_escape_string($cxn,$info);
//gets business id
$getbId="SELECT id FROM Business Where Userid='$userid'";
$runbId=mysqli_query($cxn,$getbId) or die (mysqli_error($cxn));
$fetchBid=mysqli_fetch_assoc($runbId);
$bId=$fetchBid['id'];
//get subuserid
$getsid="SELECT id FROM SubUsers WHERE UserId='$userid'";
$runsid=mysqli_query($cxn,$getsid) or die (mysqli_error($cxn));
$fetchsid=mysqli_fetch_assoc($runsid);
$sid=$fetchsid['id'];
//get BranchId
$getbrid="SELECT id FROM Branch WHERE UserId='$sid'";
$runbrid=mysqli_query($cxn,$getbrid) or die (mysqli_error($cxn));
$fetchbrid=mysqli_fetch_assoc($runbrid);
$brid=$fetchbrid['id'];

//adds to table subuser
$adduser="INSERT INTO SubUsers (BranchId,UserId,Username,Password) VALUES ('$brid','$userid','$username','$password')";
$runuser=mysqli_query($cxn,$adduser) or die(mysqli_error($cxn));
//adds to table branch
$addbranch="INSERT INTO Branch (UserId,BusinessId,Name,Info) VALUES ('$sid','$bId','$name','$info')";
$runbranch=mysqli_query($cxn,$addbranch) or die (mysqli_error($cxn));
//gives success message upon successfully adding the user
$success="User Successfully added";
}

?>

<link rel="stylesheet" type="text/css" href="style.css" />

<?PHP //include("AdminNav.php");?>
<form action="<?PHP echo $_SERVER['PHP_SELF']?>" name="AddUser" method="POST">

Username	<input type="text" name='username' size='38' maxlength='40'/>

Password	<input type="password" name="password" size="38" maxlength="64" />

Branch Name	<input type="text" name='name' size='38' maxlength='40'/>

Branch Info	<textarea name="info" rows="10" cols="30"></textarea>

<input type="Submit" name="adduser" value="Submit" />
<?PHP if(isset($success)){echo"$success";} ?>

</form>

i was considering using SELECT MAX(id) + 1, to get the current id.
From what i could make of LAST_INSERT_ID that i've read up on, it would not work as i'm using just 1 query to insert all the values at once, and as such, do not have a "last query".
Could someone kindly point me in the right direction?
Thanks
PS: I'm using PHP and MySQL.
EDIT:
I've tried adding seperating the queries, leaving the ids to be added last.This doesnt work however, as i am getting the error
Cannot add or update a child row: a foreign key constraint fails (`kenced`.`branch`, CONSTRAINT `branch_ibfk_1` FOREIGN KEY (`UserId`) REFERENCES `subusers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)

My code:
mysqli_autocommit($cxn,"FALSE");
//adds to table subuser
$adduser="INSERT INTO SubUsers (UserId,Username,Password) VALUES ('$userid','$username','$password')";
//$runuser=mysqli_query($cxn,$adduser) or die(mysqli_error($cxn));
//adds to table branch
$addbranch="INSERT INTO Branch (BusinessId,Name,Info) VALUES ('$bId','$name','$info')";
//$runbranch=mysqli_query($cxn,$addbranch) or die (mysqli_error($cxn));

$runuser=mysqli_query($cxn,$adduser) or die(mysqli_error($cxn));
$sid=mysqli_insert_id($cxn);
$runbranch=mysqli_query($cxn,$addbranch) or die (mysqli_error($cxn));
$brid=mysqli_insert_id($cxn);
$addsid="INSERT INTO Branch(UserId) VALUES ('$sid')";
$runsid=mysqli_query($cxn,$addsid) or die (mysqli_error($cxn));
$addbrid="INSERT INTO SubUsers(BranchId) VALUES ('$brid')";
$runbrid=mysqli_query($cxn,$addbrid) or die (mysqli_error($cxn));
if($runsid and $runbrid)
mysqli_commit($cxn);
else
{
mysqli_rollback($cxn);
echo"ROLLBACKED";
}
//gives success message upon successfully adding the user
$success="User Successfully added";

What i'm trying to do is to insert a query as well as the id of the query simultaneously.However, mysqli_insert_query fails as i get the error Cannot add or update a child row: a foreign key constraint fails (kenced.branch, CONSTRAINT branch_ibfk_1 FOREIGN KEY (UserId) REFERENCES subusers (id) ON DELETE CASCADE ON UPDATE CASCADE).
could anyone give me a hand here?
Much appreciated.


text:
Q: UIStoryboard constraint issue with safe area in iPhoneX (How can I create View with equal height of safe area?) I did this for bouncing effect in my view.
I have a UIViewController, I am placing scrollview in it and a content view (UIView) in scrollview. I have a "LETS GO" button (to go to next screen) at the bottom of content view. I wanted the content view to have height equal to height of UIViewController view's height. I did assign constraint from storyboard but the problem is, the Content View always has height greater than I expect, the button is hidden under the bottom of iPhone X screen, so that I always have to scroll to get that button in view. This is a problem due to safe area of iPhone X.
I tried to add constraint programmatically by reducing safe area's padding in height of UIViewController's view. But when I rotated screen, the problem existed. I want this to be solved from storyboard. How can I solve this issue?

A: I hope this is what you are asking for. When I'm adding scroll view, I do it like this: I place scroll view in the main vc's view, pin it to the Safe Area, then place UIView inside scroll view and pin it to the superview (so scroll view, see screenshot). It's good to work in iPhone X view in storyboard as you have more control where you pin the scroll view. Then I ctrl-drag from content view to vc's main view and do Equal widths, and ctrl-drag from content view to Safe Area and do Equal Heights, and change the priority of the constraint to 250 (in order to scroll vertically).


text:
Q: jQuery show() method not working with blockUI in IE8 or IE9 Title says it all. Works perfectly in any other browser, but in IE8 and IE9, the show() method isn't working...
Here's how the blockUI modal is set up in the code:
            $.blockUI({
                uniqueName: 'the-modal-that-will-not-show',
                focusInput: false,
                message: foo_html,
                css: {
                    padding: 0,
                    margin: 0,
                    top: '50%',
                    left: '50%',
                    'margin-top': '50px',
                    'margin-left': '275px',
                    textAlign: 'left',
                    color: '#000',
                    position: 'absolute',
                    width: '530px',
                    'z-index': 2300,
                    left: '0px',
                    top: '10px'
                },
                overlayCSS: {
                    'z-index': 2299,
                    opacity: 0.5
                }
            });

And no matter where I put
$('#the-modal-that-will-not-show').show()

...it just won't show. If I open the Javascript console in IE and actually type that command in, the modal will show up, but in the wrong place and with some of the inputs not formatted correctly.
And the weird thing is that I surrounded the .show() command with alerts that tell me whether the modal is visible. Before the .show() command, it tells me "false," and after it says "true", even though it's not actually appearing on the screen.
I also tried putting all the CSS stuff in quotes, like 'padding': '0', etc. Didn't make a difference.
Thoughts???

A: I found the issue:
The function that contains this modal is called immediately after there's an $.unblockUI command, and IE is executing the code before $.unblockUI is finished. If I put a delay in there, it works fine.