text:
Q: Using BC in shell If-statement throws integer expression expected i try to setup a little 3bit CPU Meter on my Raspberry Pi2 and after i found out, that the normal Shell doesn't like float, i stumbled across "BC"
After some hours of work i got my script to work, but the CPU usage is quit high because the Console always writes "integer expression expected"
I really don't know how to fix this or why this error even persists, the script works fine, but it hammers my CPU Cycles...
Can you have a look at my Script and maybe explain to my why it throws this error?
while :
do
sleep 0.5
var=$(egrep -o '([0-9]{1})\.[0-9]{2}' /proc/loadavg | head -1 )
c005=0.05
c10=1.0
c05=0.5
c006=0.06

if [ "$(echo "if (${var} < ${c005}) 1" | bc)" -eq 1 ] ; then
    gpio write 0 0
    gpio write 2 0
    gpio write 3 0

elif [ "$(echo "if (${var} > ${c10}) 1" | bc)" -eq 1 ] ; then
    gpio write 0 1
    gpio write 2 1
    gpio write 3 1

elif [ "$(echo "if (${var} > ${c05}) 1" | bc)" -eq 1 ] ; then
    gpio write 0 1
    gpio write 2 1
    gpio write 3 0

elif [ "$(echo "if (${var} > ${c006}) 1" | bc)" -eq 1 ] ; then
    gpio write 0 1
    gpio write 2 0
    gpio write 3 0

else
    gpio write 0 0
    gpio write 2 0
    gpio write 3 0

fi
done

Errors:
./cpu.proc: line 20: [: : integer expression expected
./cpu.proc: line 10: [: : integer expression expected
./cpu.proc: line 15: [: : integer expression expected
./cpu.proc: line 20: [: : integer expression expected
./cpu.proc: line 10: [: : integer expression expected
./cpu.proc: line 15: [: : integer expression expected
./cpu.proc: line 20: [: : integer expression expected
./cpu.proc: line 10: [: : integer expression expected
./cpu.proc: line 15: [: : integer expression expected
./cpu.proc: line 20: [: : integer expression expected
./cpu.proc: line 10: [: : integer expression expected
./cpu.proc: line 15: [: : integer expression expected
./cpu.proc: line 20: [: : integer expression expected
./cpu.proc: line 10: [: : integer expression expected
./cpu.proc: line 15: [: : integer expression expected
./cpu.proc: line 20: [: : integer expression expected
./cpu.proc: line 10: [: : integer expression expected
./cpu.proc: line 15: [: : integer expression expected
./cpu.proc: line 20: [: : integer expression expected
./cpu.proc: line 10: [: : integer expression expected
./cpu.proc: line 15: [: : integer expression expected

Thanks to anyone who is taking their time to look at this.
Best wishes!

A: If the if statements succeed you have bc printing 1, but when they fail it prints nothing. bash is complaining that "" isn't an integer.
if [ "$(echo "${var} < ${c005}" | bc)" -eq 1 ] ; then

You could pass just the relational expression to bc. It will naturally print a 1 or a 0 based on the result of the < operator.

A: gpio mode 0 out;
gpio mode 2 out;
gpio mode 3 out;
while :
do
sleep 1.2
var=$(egrep -o '([0-9]{1})\.[0-9]{2}' /proc/loadavg | head -1 )
c005=0.05
c10=1.0
c05=0.5
c006=0.06

if [ "$(echo "if(${var} < ${c005}) 1" | bc)" == "1" ] ; then
    gpio write 0 0
    gpio write 2 0
    gpio write 3 0

elif [ "$(echo "if (${var} > ${c10}) 1" | bc)" == "1" ] ; then
gpio write 0 1
gpio write 2 1
gpio write 3 1
elif [ "$(echo "if (${var} > ${c05}) 1" | bc)" == "1" ] ; then
gpio write 0 1
gpio write 2 1
gpio write 3 0
elif [ "$(echo "if (${var} > ${c006}) 1" | bc)" == "1" ] ; then
gpio write 0 1
gpio write 2 0
gpio write 3 0

else
gpio write 0 0
gpio write 2 0
gpio write 3 0

fi
done


text:
Q: Can I accept payments via email with Authorize.net just like with PayPal? As far as I can see this is not the case, however, I thought I would ask on SO to make absolutely sure.

A: You can't...
...unless you get really creative. You can always have the transaction emailed to you which is then piped to a server side script which parses the email for the transaction information and actually processes it. But it would be hackish and there would be PCI issues to deal with. But it still would be possible.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Should I use Drupal 6 or Drupal 7? As the title states:
Should I use Drupal 6 or Drupal 7?
See, the dilemma here is the usability. I have to develop a website for a client, and I've been running into quite a bit of difficulty with Drupal 7. A module not working there, an error displaying here, no available 7.x versions for needed modules and so on.
So, can anyone provide some concise points, to why I should, or should not use Drupal 7?
A list of Pros and Cons would be awesome too.
Thanks!

A: If you really want to develop and keep the maintenance minimum, stick to Drupal 6. It has been tested extensively by community and the API documentation is complete (So is Drupal 7s but with bugs). Even if you want to use the modules available, most of them are not going to be stable until a few months from now on. I am planning to make the switch at least 6 months after the release date, being the middle of this year. That is the great thing about Drupal: Upgrading is always supported and you never have to make an installation from scratch.
I'd suggest to keep an eye on the current bugs that are marked major and critical and then decide

A: I recommend listening to the Lullabot Podcast on the subject. Their upgrade chart provides some useful questions to ask when trying to decide.

A: We are sticking with D6 for the time being.  We are waiting for the Views and Panels modules to settle down some, and will then re-evaluate.
I think it really depends on whether you are making a site for yourself, or are making sites for clients who are paying a flat fee.  On flat-fee projects, D7 is still a bit of a risk until modules become more mature.


text:
Q: ADB recognize android without root access Why does the following list my Android device:
sudo /opt/adt-bundle-linux/sdk/platform-tools/adb start-server
/opt/adt-bundle-linux/sdk/platform-tools/adb devices
sudo /opt/adt-bundle-linux/sdk/platform-tools/adb kill-server

List of devices attached
SH176T501818    device

but the following doesn't list my Android device?:
/opt/adt-bundle-linux/sdk/platform-tools/adb start-server
/opt/adt-bundle-linux/sdk/platform-tools/adb devices
/opt/adt-bundle-linux/sdk/platform-tools/adb kill-server

List of devices attached
????????????    no permissions

I shouldn't need to run adb as root, should I?  What am I missing here?
$ ls -l /etc/udev/rules.d/51-android.rules
-rw-r--r-- 1 root root 67 Dec 24 20:36 /etc/udev/rules.d/51-android.rules
$ cat /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="dev"

UPDATE: On system boot, CentOS 5.8 mentions something about unknown attribute ATTR{idVendor} briefly before the boot completes.

A: Here is the .rules file in use on my system:
https://raw.github.com/M0Rf30/android-udev-rules/master/51-android.rules
If CentOS also complains about it's syntax, then maybe the .rules file isn't the problem.  I'm not sure why your's doesn't work.  Perhaps you can't leave the ATTR{idProduct} out?


text:
Q: Stack Exchange Data Explorer was not really updated The Stack Exchange Data Explorer page claims that the "English Language & Usage" data was last updated on March 21, but the data is much older than that.
One example of query where this is highlighted: https://data.stackexchange.com/english/qe/208/keystrokes-per-rep-point returns reputation for top users that is much lower than its actual value. For example, JSBangs has 8527 rep, but SEDE reports 5980.

A: Agreed: https://data.stackexchange.com/english/s/1132/last-vote-by-date

A: All data should be up to date now ... my import process runs in 2 phases:

*

*I export all public data to the current db (separate db per exported set)

*I detach all the dbs that were exported and attach them to a sandboxed db.

Step 2 did not run.


text:
Q: White space appeared below menu I don't know how but suddenly white space appeared under website menu.
Please check website www.quoteradar.co.uk and help me I'm worried and have spent many hours.

A: This is due to a break in your WordPress theme.
Your mobile navigation menu is being displayed by default and looking through your CSS, it shows that there is nothing in place to hide it until the device resolution hits a certain point.
Your best choice would be to email/phone/contact ElegantThemes who are the developers of the divi theme that you're using and to request a fix from them. Considering its a paid theme, id expect support to be available.
Other than that we can't really help you as you the CSS is minified and would take a large amount of CSS, media queries and trial and error to get the page to work as it should


text:
Q: DataGrip sort more rows than page size In JetBrains DataGrip, when I try to sort a column (descending for example), it only shows and sorts loaded rows - that means 500 (it's the set page size). Is it possible that it can sort all rows (in my table like 25 000)?
I don't want to manually type order by column_name desc everytime I want to sort something.
In DBeaver this kind of sorting works.

A: You need to turn Sort via ORDER BY option on. So it will concat the ORDER BY for you.

Alternatively, you can always fetch all rows (use the corresponding setting) and client-based sorting will also sort all rows :)


text:
Q: iPhone App: Check In using Facebook Graph API In my iPhone App I want to implement "Check in" feature (Facebook Places).
How can I check in using Facebook Graph API?

A: FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:@"me/checkins" withGetVars:nil];
NSLog(@"getMeButtonPressed:  %@", fb_graph_response.htmlResponse);

//parse our json
SBJSON *parser = [[SBJSON alloc] init];
NSMutableArray *facebook_response =(NSMutableArray *)[fb_graph_response.htmlResponse JSONValue];//[parser objectWithString:fb_graph_response.htmlResponse error:nil];
[parser release];

NSMutableArray *feed =(NSMutableArray *) [facebook_response valueForKey:@"data"];
NSLog(@"%@",feed);

In the feed you can find the jason data of the places you have checked in..
If you get the "nil" data that means you have not checked in to any places so you have to first checkin to some places using your profile and FB.but if it is coming nil in that case only
and I am using the example from this referance :-https://github.com/reallylongaddress/iPhone-Facebook-Graph-API
so adjust it as per your requirement


text:
Q: How do I determine the portal row number? How do I determine the portal row number when dragging a document into a container field in FileMaker? Dragging a document into a container field doesn't change focus, so Get(ActivePortalRowNumber) doesn't work.

A: Well, you could have a second relationship to the same related records sorted by the modification dates of the related records, most recent first. Then the record that had had the document dragged into the container field would appear as the first related record via that relationship, and you could grab an ID field from it.
Alternatively, each related record in the portal could contain an unstored calculation field set to "get(recordnumber)". Within a portal, that will evaluate to the portal row number of the record. Maybe you could use that somehow. Without more information on what you're trying to accomplish, though, it's tough to say.


text:
Q: Does this $n$-Ball 'grow' out of the unit box? Let $K_n(r) = [-r,r]\times[-r,r]\times\cdots\times[-r,r] \in\mathbb{R}^n$ be the $n$-Box of edge length $2r$. I think we can uniquely partition $K_n(1)$ into $2^n$ disjoint n-dimensional cubes, each of which are translates of $K_n(1/2)$. If so, then draw the largest $n$-Balls inscribed inside each of them. Now consider the central $n$-Ball which touches all these other balls externally. Let the radius of this ball be $r_n$. Below is an example when n=2. The coloured circle is the central circle, with radius $r_2=\frac{\sqrt{2}-1}{2}$.
It can be derived easily that for a general $n\in\mathbb{N}$ we have $r_n = \frac1 2(\sqrt{n}-1)$. (derivation)
 $^{\text{for n=2, }r_n \cong 0.2071}$
Intuitively it seems that the central ball should always stay inside
$K_n$. But for $n>9$, we get $$r_n = \frac12(\sqrt{n}-1) >\frac12(\sqrt9-1)=1$$
Doesn't this imply that the central ball is no more contained inside $K_n$ for $n>9$? Clearly I've made some mistake in my arguments. Can someone point it out? Thanks!


text:
Q: how change text direction(not paragraph alignment) in document in apache poi word?(XWPF) I'm trying to use Apache poi word 3.8 to create word document in persian/arabic language.
My question is: how change text direction in document? ( it means changing text direction not changing just paragraph text alignment)
In MS Word we could use Right-to-left text direction  to change text direction and Align Right to set alignment. What's equivalent of the first one in poi set property?

A: This is bidirectional text direction support (bidi) and is not yet implemented in apache poi per default. But the underlying object org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPrBase supports this. So we must get this underlying object from the XWPFParagraph.
Example:
import java.io.FileOutputStream;

import org.apache.poi.xwpf.usermodel.*;

import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;

public class CreateWordRTLParagraph {

 public static void main(String[] args) throws Exception {

  XWPFDocument doc= new XWPFDocument();

  XWPFParagraph paragraph = doc.createParagraph();
  XWPFRun run = paragraph.createRun();
  run.setText("Paragraph 1 LTR");

  paragraph = doc.createParagraph();

  CTP ctp = paragraph.getCTP();
  CTPPr ctppr;
  if ((ctppr = ctp.getPPr()) == null) ctppr = ctp.addNewPPr();
  ctppr.addNewBidi().setVal(STOnOff.ON);

  run = paragraph.createRun();
  run.setText("السلام عليكم");

  paragraph = doc.createParagraph();
  run = paragraph.createRun();
  run.setText("Paragraph 3 LTR");

  FileOutputStream out = new FileOutputStream("WordDocument.docx");
  doc.write(out);
  out.close();
  doc.close();
 }
}


text:
Q: Import font in Hummus Recipe I am developing a project on node and would like to know how to import a source such as a .ttf
const HummusRecipe = require('hummus-recipe');
const pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');
pdfDoc
    // edit 1st page
    .editPage(1)
    .text('Add some texts to an existing pdf file', 150, 300)
    .rectangle(20, 20, 40, 100)
    .comment('Add 1st comment annotaion', 200, 300)
    .image('/path/to/image.jpg', 20, 100, {width: 300, keepAspectRatio: true})
    .endPage()
    // edit 2nd page
    .editPage(2)
    .comment('Add 2nd comment annotaion', 200, 100)
    .endPage()
    // end and save
    .endPDF();

A: If you are developing on Mac rather than relative path using './' notation straight path works 'path/to/font'
const pdfDoc = new HummusRecipe(input, output);
pdfDoc.registerFont('My Font', 'path/to/font/file.ttf');

And then use this way.
pdfDoc
  // edit 1st page
  .editPage(1)
  .text(name, 'center', 219, {
    color: '#e5ae0b',
    fontSize: 30,
    font: 'My Font',
    align: 'center center',
    opacity: 0.8
  })
  .text(course, 240, 288)
  .endPage()
  // end and save
  .endPDF();

A: You can do either
const pdfDoc = new HummusRecipe(input, output, {
  fontSrcPath: './path/to/font/folder',
}

Or
const pdfDoc = new HummusRecipe(input, output)
pdfDoc.registerFont('My Font', './path/to/font/file.ttf')

See https://github.com/chunyenHuang/hummusRecipe/blob/master/tests/font.js


text:
Q: Why does PHP 7.3.2 show the wrong time and ignores timezone? Since I updated to PHP 7.3.2 a few hours ago (PHP 7.3.2-1+0~20190207180136.30+stretch~1.gbp501c1c), PHP always shows the wrong time when I call the "date" function. I set the timezone to "Europe/Berlin" and verified it by "phpinfo".
Even if I specify the timezone in a script using "date_default_timezone_set" and then call the "date" function, it shows 08:20 instead of 09:20 (one hour difference), so UTC instead of UTC +1...
I think, that must be a PHP 7.3.2 bug, because no matter what timezone I set, the time that php outputs is always the same (UTC). My system time on the server (Debian 9) is correct and I reproduced this problem on different servers just after I updated to PHP 7.3.2.
Does anyone else have this problem or is this already a known issue?

A: Official bug tracker
There seem to be known problems that seem to depend on your distribution/repository/way you installed PHP in relation to using timezones.


text:
Q: jquery wait for ajax select dropdown then fill its contents with $.deferred I got 2 selects and I need to fill in the second one after the first one is filled. So the real scenario is like the following:
1) Set #main_container dropdown to 2
2) fire ajax call and get the contents of child dropdown based on the value of #main_container (2 in our case)
3) show child dropdown 2 on the form
3) after all that, set the value of child dropdown 2 to 400 so the final result should be Bag Yellow, while it is showing me Bag Green
The problem is that my code is not waiting for the ajax call to finish and display the child dropdown 2, it is trying to set child dropdown 2 immediately, while I need to set it only after ajax call is done and child dropdown 2 is shown on the form. The logic of main_container is put in the onchange event and it only gets and shows dropdowns. It is NOT setting its values. As far as I know I can use $.deferred here but I cannot find out how to wait for promise outside onchange event.
Any ideas would be welcome. Thank you.
Consider the following simplified code:

$(document).ready(function(){
    $('#main_container').val(2);
    $('#main_container').trigger('change');// onchange event is triggered, waiting for child_2 dropdown
    $('#child_2').val(400);//setting child_2 value here (done immediately)
});

$('#main_container').change(function() {

  $('.child').hide();
  if($(this).val() == 1){
      $('#child_1').show(700); // AJAX call here in real
    }else if($(this).val() == 2){
      $('#child_2').show(700); // AJAX call here in real
   }else{
      $('#child_3').show(700); // AJAX call here in real
   }
});
div {
  padding: 5px 10px;
}

div.child {
  display: none
}

select {
  width: 200px;
}

  <select name="container" id="main_container" data-parent="true" data-parent_id="10">
  <option value="">--- Select a container---</option>
  <option value="1">Box</option>
  <option value="2">Bag</option>
  <option value="3">Pallet</option>
 </select>

  <select name="box color">
  <option value="100">Red</option>
  <option value="200">Blue</option>
 </select>

  <select name="bag color">
  <option value="300">Green</option>
  <option value="400">Yellow</option>
 </select>

  <select name="pallet color">
  <option value="500">Black</option>
  <option value="600">Yellow</option>
 </select>

A: I have updated the code and found a solution, pls see below:
    <!DOCTYPE html>

    <title></title>

            <select name="container" id="main_container">
                <option value="">--- Select a container---</option>
                <option value="1">Box</option>
                <option value="2">Bag</option>
                <option value="3">Pallet</option>
            </select>


text:
Q: Getting Error: Error: Build file build.js is malformed: TypeError: {(intermediate value)} is not a function at build.createConfig (r.js:29289:23) I am working on Advance JS bundling by following the below documentation:
https://experienceleague.adobe.com/docs/commerce-operations/performance-best-practices/performance-best-practices/advanced-js-bundling.html
But after running the below command, I am getting the an error as below:
r.js -o build.js baseUrl=pub/static/frontend/Magento/luma/en_US_tmp dir=pub/static/frontend/Magento/luma/en_US

Error: Error: Build file build.js is malformed: TypeError: {(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)} is not a function
at build.createConfig (r.js:29289:23)

Unable to find the proper resolution on google. Below is the content of my build.js file, unable to find the mistake:
({
  optimize: 'uglify2',
  inlineText: true,
  deps: [
    'fotorama/fotorama',
    'jquery/ui'
  ],
  shim: {
    'jquery/jquery.hashchange': ['jquery', 'jquery/jquery-migrate'],
    'fotorama/fotorama': ['jquery', 'jquery/jquery-migrate', 'magnifier/magnify'],
    MutationObserver: ['es6-collections'],
    tinymce: {
      exports: 'tinymce'
    },
    moment: {
      exports: 'moment'
    },
    matchMedia: {
      exports: 'mediaCheck'
    }
  },
  paths: {
    'jquery/ui': 'jquery/jquery-ui',
    'jquery/validate': 'jquery/jquery.validate',
    'jquery/hover-intent': 'jquery/jquery.hoverIntent',
    'jquery/file-uploader': 'jquery/fileUploader/jquery.fileupload-fp',
    'jquery/jquery.hashchange': 'jquery/jquery.ba-hashchange.min',
    'jquery/jquery-storageapi': 'jquery/jquery.storageapi.min',
    prototype: 'legacy-build.min',
    text: 'requirejs/text',
    domReady: 'requirejs/domReady',
    tinymce: 'tiny_mce/tiny_mce_src',
    'ui/template': 'Magento_Ui/templates',
    mixins: 'mage/requirejs/mixins'
  },
  map: {
    '*': {
      ko: 'knockoutjs/knockout',
      knockout: 'knockoutjs/knockout',
      mageUtils: 'mage/utils/main',
      rowBuilder: 'Magento_Theme/js/row-builder',
      toggleAdvanced: 'mage/toggle',
      translateInline: 'mage/translate-inline',
      sticky: 'mage/sticky',
      tabs: 'mage/tabs',
      zoom: 'mage/zoom',
      collapsible: 'mage/collapsible',
      dropdownDialog: 'mage/dropdown',
      dropdown: 'mage/dropdowns',
      accordion: 'mage/accordion',
      loader: 'mage/loader',
      tooltip: 'mage/tooltip',
      deletableItem: 'mage/deletable-item',
      itemTable: 'mage/item-table',
      fieldsetControls: 'mage/fieldset-controls',
      fieldsetResetControl: 'mage/fieldset-controls',
      redirectUrl: 'mage/redirect-url',
      loaderAjax: 'mage/loader',
      menu: 'mage/menu',
      popupWindow: 'mage/popup-window',
      validation: 'mage/validation/validation',
      welcome: 'Magento_Theme/js/view/welcome',
      uiElement: 'Magento_Ui/js/lib/core/element/element',
      uiCollection: 'Magento_Ui/js/lib/core/collection',
      uiComponent: 'Magento_Ui/js/lib/core/collection',
      uiClass: 'Magento_Ui/js/lib/core/class',
      uiEvents: 'Magento_Ui/js/lib/core/events',
      uiRegistry: 'Magento_Ui/js/lib/registry/registry',
      consoleLogger: 'Magento_Ui/js/lib/logger/console-logger',
      uiLayout: 'Magento_Ui/js/core/renderer/layout',
      buttonAdapter: 'Magento_Ui/js/form/button-adapter',
      rjsResolver: 'mage/requirejs/resolver',
      discountCode: 'Magento_Checkout/js/discount-codes',
      shoppingCart: 'Magento_Checkout/js/shopping-cart',
      regionUpdater: 'Magento_Checkout/js/region-updater',
      sidebar: 'Magento_Checkout/js/sidebar',
      checkoutLoader: 'Magento_Checkout/js/checkout-loader',
      checkoutData: 'Magento_Checkout/js/checkout-data',
      proceedToCheckout: 'Magento_Checkout/js/proceed-to-checkout',
      quickSearch: 'Magento_Search/form-mini',
      pageCache: 'Magento_PageCache/js/page-cache',
      wishlist: 'Magento_Wishlist/js/wishlist',
      addToWishlist: 'Magento_Wishlist/js/add-to-wishlist',
      wishlistSearch: 'Magento_Wishlist/js/search',
      requireCookie: 'Magento_Cookie/js/require-cookie',
      cookieNotices: 'Magento_Cookie/js/notices',
      compareList: 'Magento_Catalog/js/list',
      relatedProducts: 'Magento_Catalog/js/related-products',
      upsellProducts: 'Magento_Catalog/js/upsell-products',
      productListToolbarForm: 'Magento_Catalog/js/product/list/toolbar',
      catalogGallery: 'Magento_Catalog/js/gallery',
      priceBox: 'Magento_Catalog/js/price-box',
      priceOptionDate: 'Magento_Catalog/js/price-option-date',
      priceOptionFile: 'Magento_Catalog/js/price-option-file',
      priceOptions: 'Magento_Catalog/js/price-options',
      priceUtils: 'Magento_Catalog/js/price-utils',
      catalogAddToCart: 'Magento_Catalog/js/catalog-add-to-cart',
      loadPlayer: 'Magento_ProductVideo/js/load-player',
      fotoramaVideoEvents: 'Magento_ProductVideo/js/fotorama-add-video-events',
      bundleOption: 'Magento_Bundle/bundle',
      priceBundle: 'Magento_Bundle/js/price-bundle',
      slide: 'Magento_Bundle/js/slide',
      productSummary: 'Magento_Bundle/js/product-summary',
      checkoutBalance: 'Magento_Customer/js/checkout-balance',
      address: 'Magento_Customer/address',
      changeEmailPassword: 'Magento_Customer/change-email-password',
      passwordStrengthIndicator: 'Magento_Customer/js/password-strength-indicator',
      zxcvbn: 'Magento_Customer/js/zxcvbn',
      addressValidation: 'Magento_Customer/js/addressValidation',
      creditCardType: 'Magento_Payment/cc-type',
      addToCart: 'Magento_Msrp/js/msrp',
      giftMessage: 'Magento_Sales/gift-message',
      ordersReturns: 'Magento_Sales/orders-returns',
      downloadable: 'Magento_Downloadable/downloadable',
      orderBySkuFailure: 'Magento_AdvancedCheckout/js/order-by-sku-failure',
      fileChooser: 'Magento_AdvancedCheckout/js/file-chooser',
      configurable: 'Magento_ConfigurableProduct/js/configurable',
      fileElement: 'Magento_CustomerCustomAttributes/file-element',
      transparent: 'Magento_Payment/transparent',
      recentlyViewedProducts: 'Magento_Reports/js/recently-viewed',
      captcha: 'Magento_Captcha/captcha',
      catalogSearch: 'Magento_CatalogSearch/form-mini',
      giftOptions: 'Magento_GiftMessage/gift-options',
      extraOptions: 'Magento_GiftMessage/extra-options',
      taxToggle: 'Magento_Weee/tax-toggle',
      ticker: 'Magento_CatalogEvent/js/ticker',
      carousel: 'Magento_CatalogEvent/js/carousel',
      multipleWishlist: 'Magento_MultipleWishlist/js/multiple-wishlist',
      multiShipping: 'Magento_Multishipping/js/multi-shipping',
      orderOverview: 'Magento_Multishipping/js/overview',
      payment: 'Magento_Multishipping/js/payment',
      orderReview: 'Magento_Paypal/order-review',
      paypalCheckout: 'Magento_Paypal/js/paypal-checkout',
      editTrigger: 'mage/edit-trigger',
      addClass: 'Magento_Translation/add-class'
    }
  },
  modules: [
    {
      name: 'requirejs/require',
      include: [
        'mage/requirejs/mixins',
        'mage/common',
        'jquery/jquery.cookie',
        'jquery/jquery-storageapi',
        'jquery/jquery.mobile.custom',
        'jquery/jquery.hashchange',
        'jquery/ui'
      ],
      exclude: [
      ]
    },
    {
      name: 'mage/bootstrap',
      include: [
        'jquery',
        'knockoutjs/knockout',
        'mage/translate',
        'jquery/jquery-migrate',
        'jquery/jquery-ui-timepicker-addon',
        'mage/dataPost',
        'mage/translate-inline',
        'Magento_Theme/js/responsive',
        'Magento_Theme/js/theme',
        'text!ui/template/modal/modal-popup.html',
        'text!ui/template/modal/modal-slide.html',
        'text!ui/template/modal/modal-custom.html',
        'text!ui/template/tooltip/tooltip.html',
        'Magento_Ui/js/lib/key-codes',
        'Magento_Ui/js/modal/confirm',
        'Magento_Ui/js/modal/modal',
        'Magento_Ui/js/lib/core/class',
        'Magento_Ui/js/lib/knockout/template/observable_source',
        'Magento_Ui/js/lib/knockout/template/loader',
        'Magento_Ui/js/lib/knockout/template/renderer',
        'Magento_Ui/js/lib/logger/levels-pool',
        'Magento_Ui/js/lib/logger/logger',
        'Magento_Ui/js/lib/logger/entry',
        'Magento_Ui/js/lib/logger/entry-factory',
        'Magento_Ui/js/lib/logger/console-output-handler',
        'Magento_Ui/js/lib/logger/formatter',
        'Magento_Ui/js/lib/logger/message-pool',
        'Magento_Ui/js/lib/registry/registry',
        'Magento_Ui/js/lib/core/events',
        'Magento_Ui/js/lib/core/storage/local',
        'Magento_Ui/js/lib/logger/logger-utils',
        'Magento_Ui/js/lib/logger/console-logger',
        'Magento_Ui/js/lib/knockout/template/engine',
        'Magento_Ui/js/lib/view/utils/dom-observer',
        'Magento_Ui/js/lib/knockout/extender/bound-nodes',
        'Magento_Ui/js/lib/view/utils/bindings',
        'Magento_Ui/js/lib/view/utils/async',
        'Magento_Ui/js/lib/knockout/bindings/resizable',
        'Magento_Ui/js/lib/knockout/bindings/i18n',
        'Magento_Ui/js/lib/knockout/bindings/scope',
        'Magento_Ui/js/lib/knockout/bindings/range',
        'Magento_Ui/js/lib/knockout/bindings/mage-init',
        'Magento_Ui/js/lib/knockout/bindings/keyboard',
        'Magento_Ui/js/lib/knockout/bindings/optgroup',
        'Magento_Ui/js/lib/knockout/bindings/after-render',
        'Magento_Ui/js/lib/knockout/bindings/autoselect',
        'Magento_Ui/js/lib/knockout/bindings/datepicker',
        'Magento_Ui/js/lib/knockout/bindings/outer_click',
        'Magento_Ui/js/lib/knockout/bindings/fadeVisible',
        'Magento_Ui/js/lib/knockout/bindings/collapsible',
        'Magento_Ui/js/lib/knockout/bindings/staticChecked',
        'Magento_Ui/js/lib/knockout/bindings/simple-checked',
        'Magento_Ui/js/lib/knockout/bindings/bind-html',
        'Magento_Ui/js/lib/knockout/bindings/tooltip',
        'Magento_Ui/js/lib/knockout/extender/observable_array',
        'Magento_Ui/js/lib/knockout/bindings/bootstrap',
        'Magento_Ui/js/lib/knockout/bootstrap'
      ],
      exclude: [
        'requirejs/require'
      ]
    },
    {
      name: 'bundles/default',
      create: true,
      include: [
        'loaderAjax',
        'loader',
        'mage/cookies',
        'dropdown',
        'dropdownDialog',
        'text!Magento_Tax/template/checkout/minicart/subtotal/totals.html',
        'text!Magento_Captcha/template/checkout/captcha.html',
        'text!Magento_Checkout/template/minicart/item/price.html',
        'text!Magento_Catalog/template/product/image_with_borders.html',
        'text!Magento_Checkout/template/minicart/subtotal.html',
        'text!Magento_Msrp/template/checkout/minicart/subtotal/totals.html',
        'text!Magento_Checkout/template/minicart/item/default.html',
        'text!Magento_Ui/template/messages.html',
        'text!Magento_Customer/template/authentication-popup.html',
        'text!Magento_Checkout/template/minicart/content.html',
        'text!ui/template/collection.html',
        'text!ui/template/block-loader.html',
        'text!ui/template/modal/modal-custom.html',
        'text!ui/template/modal/modal-slide.html',
        'text!ui/template/modal/modal-popup.html',
        'text!ui/template/tooltip/tooltip.html',
        'Magento_Ui/js/core/app',
        'Magento_Customer/js/view/customer',
        'Magento_Msrp/js/view/checkout/minicart/subtotal/totals',
        'Magento_Tax/js/view/checkout/minicart/subtotal/totals',
        'Magento_Catalog/js/view/image',
        'uiComponent',
        'Magento_Checkout/js/view/minicart',
        'Magento_Ui/js/block-loader',
        'quickSearch',
        'Magento_Catalog/js/view/compare-products',
        'tabs',
        'menu',
        'Magento_Theme/js/view/messages',
        'Magento_Customer/js/view/authentication-popup',
        'Magento_Ui/js/view/messages',
        'Magento_Captcha/js/view/checkout/loginCaptcha',
        'Magento_Customer/js/section-config',
        'Magento_Customer/js/customer-data',
        'Magento_Customer/js/invalidation-processor',
        'Magento_Customer/js/invalidation-rules/website-rule',
        'pageCache',
        'validation',
        'Magento_Catalog/js/storage-manager',
        'Magento_Wishlist/js/view/wishlist',
        'Magento_Sales/js/view/last-ordered-items',
        'Magento_Ui/js/core/app',
        'Magento_Ui/js/view/messages',
        'Magento_Ui/js/form/form'
      ],
      exclude: [
        'requirejs/require'
      ]
    },
    {
      name: 'bundles/cart',
      create: true,
      include: [
        'Magento_Ui/js/form/element/abstract',
        'Magento_Ui/js/form/element/select',
        'Magento_Ui/js/form/element/region',
        'Magento_Checkout/js/view/cart/totals',
        'Magento_Tax/js/view/checkout/summary/subtotal',
        'Magento_Tax/js/view/checkout/cart/totals/grand-total',
        'Magento_SalesRule/js/view/cart/totals/discount',
        'Magento_Tax/js/view/checkout/cart/totals/tax',
        'Magento_Weee/js/view/cart/totals/weee',
        'Magento_Checkout/js/proceed-to-checkout',
        'Magento_Checkout/js/shopping-cart',
        'Magento_GiftMessage/js/view/gift-message',
        'Magento_GiftMessage/js/view/gift-message',
        'discountCode',
        'sticky',
        'text!Magento_Checkout/template/cart/totals.html',
        'text!Magento_Tax/template/checkout/summary/subtotal.html',
        'text!Magento_Tax/template/checkout/cart/totals/grand-total.html',
        'text!Magento_Tax/template/checkout/cart/totals/tax.html',
        'text!Magento_GiftMessage/template/gift-message-item-level.html',
        'text!Magento_GiftMessage/template/gift-message-form.html',
        'text!Magento_GiftMessage/template/gift-message.html',
        'text!Magento_GiftMessage/template/gift-message-form.html',
        'text!Magento_Weee/template/checkout/summary/weee.html',
        'text!Magento_SalesRule/template/cart/totals/discount.html',
        'text!ui/template/form/field.html',
        'text!ui/template/form/element/select.html',
        'text!ui/template/form/element/input.html'
      ],
      exclude: [
        'bundles/default',
        'bundles/catalog',
        'requirejs/require',
        'bundles/shipping',
        'mage/bootstrap'
      ]
    },
    {
      name: 'bundles/shipping',
      create: true,
      include: [
        'Magento_Checkout/js/model/shipping-rates-validator',
        'Magento_OfflineShipping/js/view/shipping-rates-validation/flatrate',
        'Magento_Shipping/js/view/checkout/shipping/shipping-policy',
        'Magento_Tax/js/view/checkout/shipping_method/price',
        'Magento_Tax/js/view/checkout/summary/shipping',
        'Magento_Checkout/js/view/shipping-information',
        'Magento_Checkout/js/view/shipping-information/list',
        'Magento_Checkout/js/view/shipping-information/address-renderer/default',
        'Magento_OfflineShipping/js/view/shipping-rates-validation/tablerate',
        'Magento_Checkout/js/view/shipping-address/address-renderer/default',
        'Magento_Dhl/js/view/shipping-rates-validation',
        'Magento_Fedex/js/view/shipping-rates-validation',
        'Magento_OfflineShipping/js/view/shipping-rates-validation/freeshipping',
        'Magento_OfflineShipping/js/view/shipping-rates-validation/flatrate',
        'Magento_OfflineShipping/js/view/shipping-rates-validation/tablerate',
        'Magento_Ups/js/view/shipping-rates-validation',
        'Magento_Usps/js/view/shipping-rates-validation',
        'Magento_Checkout/js/model/shipping-rates-validator',
        'Magento_Checkout/js/view/cart/shipping-rates',
        'Magento_Tax/js/view/checkout/shipping_method/price',
        'Magento_Checkout/js/view/cart/shipping-estimation',
        'Magento_Tax/js/view/checkout/cart/totals/shipping',
        'text!Magento_Checkout/template/shipping-information.html',
        'text!Magento_Checkout/template/shipping.html',
        'text!Magento_Checkout/template/shipping-address/list.html',
        'text!Magento_Checkout/template/shipping-address/form.html',
        'text!Magento_Shipping/template/checkout/shipping/shipping-policy.html',
        'text!Magento_Checkout/template/shipping-address/shipping-method-list.html',
        'text!Magento_Checkout/template/shipping-address/shipping-method-item.html',
        'text!Magento_Tax/template/checkout/shipping_method/price.html',
        'text!Magento_Checkout/template/shipping-address/address-renderer/default.html',
        'text!Magento_Checkout/template/shipping-information/address-renderer/default.html',
        'text!Magento_Checkout/template/shipping-information/list.html',
        'text!Magento_Tax/template/checkout/summary/shipping.html',
        'text!Magento_Checkout/template/cart/shipping-rates.html',
        'text!Magento_Checkout/template/cart/shipping-estimation.html',
        'text!Magento_Tax/template/checkout/shipping_method/price.html',
        'text!Magento_Tax/template/checkout/cart/totals/shipping.html'
      ],
      exclude: [
        'bundles/default',
        'bundles/catalog',
        'bundles/checkout',
        'bundles/cart',
        'requirejs/require',
        'mage/bootstrap'
      ]
    },
    {
      name: 'bundles/checkout',
      create: true,
      include: [
        'Magento_Customer/js/section-config',
        'Magento_Customer/js/customer-data',
        'Magento_Customer/js/invalidation-rules/website-rule',
        'checkoutLoader',
        'Magento_Payment/js/view/payment/payments',
        'Magento_OfflinePayments/js/view/payment/offline-payments',
        'Magento_Paypal/js/view/payment/paypal-payments',
        'Magento_Checkout/js/view/payment/email-validator',
        'Magento_CheckoutAgreements/js/view/agreement-validation',
        'Magento_Checkout/js/view/form/element/email',
        'Magento_Checkout/js/view/payment/list',
        'Magento_CheckoutAgreements/js/view/checkout-agreements',
        'Magento_Checkout/js/view/billing-address',
        'Magento_Ui/js/form/element/select',
        'Magento_Ui/js/form/element/region',
        'Magento_Ui/js/form/element/abstract',
        'Magento_Ui/js/form/components/group',
        'Magento_Checkout/js/view/billing-address',
        'Magento_SalesRule/js/view/payment/discount',
        'Magento_SalesRule/js/view/payment/discount-messages',
        'Magento_Checkout/js/view/payment',
        'Magento_Checkout/js/view/shipping',
        'Magento_Checkout/js/view/form/element/email',
        'Magento_Checkout/js/view/shipping-address/list',
        'Magento_Checkout/js/view/authentication',
        'Magento_Checkout/js/view/authentication-messages',
        'Magento_Checkout/js/view/progress-bar',
        'Magento_Checkout/js/view/estimation',
        'Magento_Checkout/js/view/sidebar',
        'Magento_Checkout/js/view/summary',
        'Magento_Checkout/js/view/summary/totals',
        'Magento_Tax/js/view/checkout/summary/subtotal',
        'Magento_Tax/js/view/checkout/summary/grand-total',
        'Magento_Tax/js/view/checkout/summary/tax',
        'Magento_Weee/js/view/checkout/summary/weee',
        'Magento_SalesRule/js/view/summary/discount',
        'Magento_Checkout/js/view/summary/cart-items',
        'Magento_Checkout/js/view/summary/item/details',
        'Magento_Checkout/js/view/summary/item/details/thumbnail',
        'Magento_Tax/js/view/checkout/summary/item/details/subtotal',
        'Magento_Weee/js/view/checkout/summary/item/price/row_incl_tax',
        'Magento_Weee/js/view/checkout/summary/item/price/row_excl_tax',
        'Magento_Checkout/js/model/payment/method-group',
        'mage/url',
        'Magento_Checkout/js/view/payment/default',
        'Magento_Checkout/js/action/redirect-on-success',
        'Magento_Checkout/js/action/place-order',
        'Magento_Ui/js/form/element/post-code',
        'text!Magento_Checkout/template/payment/before-place-order.html',
        'text!Magento_Checkout/template/estimation.html',
        'text!Magento_Checkout/template/sidebar.html',
        'text!Magento_Checkout/template/summary.html',
        'text!Magento_Checkout/template/summary/totals.html',
        'text!Magento_Checkout/template/onepage.html',
        'text!Magento_Customer/template/authentication-popup.html',
        'text!Magento_Checkout/template/authentication.html',
        'text!Magento_Checkout/template/progress-bar.html',
        'text!Magento_Checkout/template/summary/cart-items.html',
        'text!Magento_Checkout/template/payment.html',
        'text!Magento_Checkout/template/summary/item/details.html',
        'text!Magento_Checkout/template/form/element/email.html',
        'text!Magento_Checkout/template/payment-methods/list.html',
        'text!Magento_SalesRule/template/payment/discount.html',
        'text!Magento_Checkout/template/summary/item/details/thumbnail.html',
        'text!Magento_Tax/template/checkout/summary/item/details/subtotal.html',
        'text!Magento_Weee/template/checkout/summary/item/price/row_excl_tax.html',
        'text!Magento_Checkout/template/billing-address.html',
        'text!Magento_Checkout/template/billing-address/details.html',
        'text!Magento_Checkout/template/billing-address/list.html',
        'text!Magento_Checkout/template/billing-address/form.html',
        'text!Magento_Tax/template/checkout/summary/subtotal.html',
        'text!Magento_SalesRule/template/summary/discount.html',
        'text!Magento_Weee/template/checkout/summary/weee.html',
        'text!Magento_Tax/template/checkout/summary/tax.html',
        'text!Magento_Tax/template/checkout/summary/grand-total.html',
        'text!Magento_CheckoutAgreements/template/checkout/checkout-agreements.html',
        'text!ui/template/form/element/helper/tooltip.html',
        'text!ui/template/form/element/input.html',
        'text!ui/template/form/element/select.html',
        'text!ui/template/form/field.html',
        'text!ui/template/group/group.html',
        'priceUtils'
      ],
      exclude: [
        'bundles/default',
        'requirejs/require',
        'bundles/shipping',
        'mage/bootstrap'
      ]
    },
    {
      name: 'bundles/catalog',
      create: true,
      include: [
        'addToWishlist',
        'requireCookie',
        'priceBox',
        'Magento_Swatches/js/swatch-renderer',
        'Magento_Swatches/js/catalog-add-to-cart',
        'Magento_Wishlist/js/add-to-wishlist',
        'Magento_Catalog/js/catalog-add-to-cart',
        'productListToolbarForm',
        'accordion',
        'Magento_Catalog/js/validate-product',
        'Magento_ProductVideo/js/fotorama-add-video-events',
        'Magento_Review/js/error-placement',
        'Magento_Review/js/process-reviews',
        'Magento_Catalog/js/product/view/provider',
        'Magento_Catalog/js/price-box',
        'Magento_Catalog/js/validate-product',
        'Magento_Review/js/view/review',
        'Magento_Review/js/validate-review',
        'mage/gallery/gallery',
        'Magento_InstantPurchase/js/view/instant-purchase',
        'priceBundle',
        'priceUtils',
        'priceOptions',
        'sticky',
        'productSummary',
        'slide'
      ],
      exclude: [
        'requirejs/require',
        'bundles/default',
        'bundles/checkout',
        'bundles/cart',
        'bundles/shipping',
        'mage/bootstrap'
      ]
    }
  ]
})()


text:
Q: Counter-Clockwise Circulation and Parameterization: Reviewing Past Question and Answer In this question, I was trying to find the counter-clockwise circulation for the field $\mathbf{F}$ and curve $C$ in this image:

As you can see, Sorfosh kindly took the time to answer my question, but I am confused by his answer:

*

*The solution he got for the circulation was $\oint_{\partial D} (P\, dx+Q\, dy) =-4\pi$. However, according to my textbook, a counter-clockwise circulation should be a positive number; negative numbers indicate clockwise circulation. Since we're trying to find the counter-clockwise circulation, shouldn't we be getting a positive value?

*His parameterization is $x=\sqrt{2}\cos(t)$ and $y=\sin(t)$. But if we let $t = 0$, then we get $x = \sqrt{2}$ and $y = 0$, which is not the curve in the image? Should we not be parameterizing the curve $C$ in such a way as to get $x = 2$ and $y = 0$ when $t = 0$?
Thank you all for taking the time to help.

A: If we attack this directly.
$x = \sqrt 2 \cos t\\y = \sin t$
$\int_0^{2\pi} (\sqrt 2\cos t + 3\sin t, 2\sqrt 2\cos t -\sin t)\cdot(-\sqrt 2 \sin t, \cos t) \ dt\\
\int_0^{2\pi} -2\cos t\sin t - 3\sqrt 2\sin^2 t + 2\sqrt 2\cos^2 t -\cos t\sin t\ dt \\ -\sqrt 2\pi$
or we can use Greens theorem.
$\oint P\ dx + Q\ dy = \iint \frac{\partial Q}{\partial x} - \frac {\partial P}{\partial y} \ dx\ dy\\
Q = 2x-y, \frac {\partial Q}{\partial x} = 2\\
P = x+3y, \frac {\partial Q}{\partial y} = 3\\
\iint \frac{\partial Q}{\partial x} - \frac {\partial P}{\partial y} \ dx\ dy = \iint -1\ dx\ dy$
Or you can use Stoke theorem (which is essentially the same as Greens)
$\oint F\cdot dr = \iint \nabla \times F \ dV\\
\nabla \times F = -1\\
\iint -1\ dA$
And the area of the ellipse is $\sqrt 2 \pi$
If you reverse the direction you will change the signs of the integrals.  However, that doesn't mean that the that the result will always be positive if you travel in the counter-clockwise direction.  Particularly, if your vector field is curling in the opposite direction.


text:
Q: How to disable TinyMCE from auto formatting If I write the follow,

 data1
 data1
 data1

↓

data1data1data1

It's like this because of tinymce auto formatting.
there isn't
 tag.
In another case,if there is the block element in , all  element is vanished.
my configure is the follow. (tinymce 4.2.5)
tinymce.init({
    language: "ja",
    plugins: ["code link"],
    selector: ".tiny-mce",
    valid_elements: "*[*]",
    body_id: "wrapper",
    toolbar: " bold underline | formatselect | link unlink | code",
    menubar: false,
    height: 500,
    block_formats: "Paragraph=p;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6",
    relative_urls : false,
    content_css : ["/css/styles.css", "/js/admin/tinymce/skins/lightgray/content.min.css"],
});

Can I disable this function?
Thank you for your help.


text:
Q: DocuSign API Embedded in iFrame not updating parent url I have DocuSign embedded in iframe and on Finish the url of the parent is not updated.  How can i do so?
I am using twig tempting engine to render the page . if it causes any issues?

A: Often better to skip the iframe altogether. Use your software stack's session features to maintain state.


text:
Q: FFMPEG: change input without stoping proccess how i can change input on ffmpeg without stop process on linux Debian 9? im user decklink input and i need to change to file mp4 input.
ffmpeg -f decklink -i 'DeckLink Mini Recorder' -vf setpts=PTS-STARTPTS -pix_fmt uyvy422 -s 1920x1080 -r 25000/1000 -f decklink 'DeckLink Mini Monitor'

A: For any other person looking forward to this answer I got to the following solution (using python and CV2):
STEP 1:
Run your camera (or any other ffmpeg input) live locally
ffmpeg -i /dev/video0 -b 50k -r 20 -s 720x480 -f mpegts udp://127.0.0.1:2000

STEP 2:
Have the ad or video you want to be displayed with the resolution as your input and most importantly saved as a .3gp video file.
STEP 3: Write a switcher.py file in the same directory as your .3gp file
import cv2
import sys
def main(argv):
    adName = argv[0]
    cap = cv2.VideoCapture("udp://127.0.0.1:2000")
    showAd = 2
    while cap.isOpened():
        if showAd == 1:
        cap.release()
        del cap
        cap = cv2.VideoCapture(adName)
        showAd = 0
        if showAd == 2:
        cap.release()
        del cap
        cap = cv2.VideoCapture("udp://127.0.0.1:2000")
        showAd = 0

        ret, frame = cap.read()
        try:
            height, width, channels = frame.shape
        except:
        cap.release()
        del cap
        cap = cv2.VideoCapture("udp://127.0.0.1:2000")
        key = cv2.waitKey(33)
        if key==27:
        showAd = 1
        if key==32:
        showAd = 2

        if(ret):
        sys.stdout.write(frame.tostring())
        cv2.imshow("frame",frame)

    cap.release()

if __name__ == "__main__":
    main(sys.argv[1:])

STEP 5: Run the switcher.py with your ad name afterward and your output.
python switcher.py ad.3gp| ffplay -f rawvideo -pixel_format bgr24 -video_size 720x480 -i -

STEP 6:
Hit "Esc" to show your ad!
REMEMBER TO CHANGE THE SCREEN VALUES!
Hope I've helped someone! (Probably I'll do some edits to this post)

A: Hmmm, I can't understand your question very well...
If you are having problems in using DeckLink and ffmpeg those website might be useful:
https://www.ffmpeg.org/ffmpeg-devices.html#decklink
https://trac.ffmpeg.org/wiki/Capture/Blackmagic
If you are trying to switch from one DeckLink to a camera or other recording device, then I'm afraid to say you will need to code a "switcher" (probably, if streaming, the stream is going to stop). If you need any help with the coding e-mail me! (I don't have enough reputation to comment)


text:
Q: add remove class with time limit with jquery I have a search box that should only show when an icon is clicked.
After the box appears when an icon is clicked it should disappear in some interval of time (like 5 seconds), even when user clicks on the other part of the body.
$(".icon").click(function()){
    $("search-box").addClass("active");
});

A: Are you looking for this?
Jquery
var icon = $(".icon");
icon.click(function () {
    $(".search-box").addClass("active");
    setTimeout(function () {
        icon.fadeOut();
    }, 5000)
})

A: Do something like this

var box = $(".search-box");

// Code for closing if anywhere else is clicked
$(document).click(function() {
  box.removeClass('active');
});

$(".icon").click(function(e) {
  e.stopPropagation();
  // preventing parent click handler

  box.addClass("active");
  // Adding class to the box

  setTimeout(function() {
    box.removeClass('active');
  }, 5000)
  // Code for removing class after 5 second

})

box.click(function(e) {
  e.stopPropagation();
  // preventing parent click handler
});
.search-box {
  display: none
}
.active {
  display: block;
}

<button class="icon">click</button>

Box to display


text:
Q: "Rosetta" for switching to native CMake CUDA support I want to switch a CMake-based project of mine to using CMake 3.8 and up's native support for CUDA. I know that, basically, I enable_language(CUDA), then use the regular add_target and add_library instead of the cuda_xxx variants of the same.
However, I'm not sure how to rewrite my code exactly. How do I...:

*

*Set of global CUDA-related CMake variables , e.g. separable compilation, propagation of host flags?

*Invoke the CUDA equivalent of CMAKE_CXX_STANDARDand friends?

*Add dependencies on CUDA libraries which are not required by default (e.g. NVTX)

*... and everything else?

Is there some uniform method to all this, or do I just have to memorize a bunch of new commands?

A: CMake's native CUDA support works very much in the same way as it does for C and C++ projects.  Using CUDA instead of C++ is a similar process to using C instead of C++.
First of all, you should enable CUDA support in your project by adding:
project(myproject LANGUAGES CUDA)

This way, you shouldn't need to run enable_language, and your CMake cache will not be cluttered with the C and C++ compiler configuration generated by the default implied project(myproject LANGUAGES C CXX) you get when you write just project(myproject).
The equivalent of CMAKE_CXX_STANDARD for CUDA is CMAKE_CUDA_STANDARD, much like how there is also CMAKE_C_STANDARD.  Additionally, there is CMAKE_CUDA_EXTENSIONS which can be configured to enable / disable compiler specific extensions (i.e. whether to choose -std=c++14 or -std=gnu++14).  It's generally the case that if you see CMake variables of the form CMAKE_CXX_..... or CMAKE_C_....., there is an equivalent CMAKE_CUDA_......  And in general, where you see CXX or C in variables and properties, there may be a CUDA equivalent.
set(CMAKE_CUDA_STANDARD 11)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
set(CMAKE_CUDA_EXTENSIONS OFF)

One thing to note however, is that these particular variables have target-specific equivalents in the form of target properties (both for C++ and CUDA):
set_target_properties(
    myprojectlibrary PROPERTIES
    CUDA_STANDARD 11
    CUDA_STANDARD_REQUIRED ON
    CUDA_EXTENSIONS OFF)

As for CUDA-specific features like in the old FindCUDA, you should find these as more target properties just like those in the previous example:
set_target_properties(
    myprojectlibrary PROPERTIES
    CUDA_SEPARABLE_COMPILATION ON
    CUDA_RESOLVE_DEVICE_SYMBOLS ON)

Information about these target properties can be found here, searching on the page for "CUDA".
As for linking to third-party libraries, this can be done the same way as it is done for regular C++ projects:
target_link_libraries(myprojectlib nvtx)

Or if your library isn't defined as a first-class CMake target:
target_link_libraries(myprojectlib ${NVTX_LIBRARY})
target_include_directories(myprojectlib PRIVATE ${NVTX_INCLUDE_DIR})
target_compile_definitions(myprojectlib PRIVATE ${NVTX_DEFINES})

Lastly, if there are any specific nvcc flags required to build your project, these can be set as follows:
target_compile_options(myprojectlib PRIVATE --default-stream=per-thread)

Note that the global user-configurable nvcc flags are also available as the variable CMAKE_CUDA_FLAGS.
Also note that you may have to change PRIVATE to PUBLIC in places where you want particular flags / include directories / compile definitions to also be propagated to targets linking to your library, in the case that myprojectlib is a library and not an executable, which may or may not be desired depending on how your project is structured.


text: Q: Is there any CI/CD tool for flutter which allows me to pass dynamic Bundle ID and app icon I want CI/CD tool for flutter which allows me to pass dynamic Bundle ID and app icon, I also want to change other params such as theme colors etc.


text:
Q: How do I send a bunch of curl commands after publishing in Visual Studio 2017 I'm working on an ASP.net MVC project and I noticed that when the web app gets published, IIS doesn't build a cache or anything for the views until a controller has been hit. So in other words it can take a very long time for a visitor to get the page loaded if they happen to be the first person to visit the page after the whole project gets republished.
To counter this, I'd have to manually hit every endpoint with a view in the project once. When the project first started this was a simple task but as you can imagine right now this is not maintainable.
My question is how do I execute a batch of curl commands to the endpoints with views in the project? I'm not sure where to start. Is there a programmatic way to create the batch command and append it to the AfterPublish event?

A: The behaviour you're encountering is due to Application Pool Start Mode in IIS. Instead of implementing AfterPublish events, you're probably better off  configuring your Application Pool to do what you want it to do.

Start Mode
A few web applications take a significant amount of time to start up. IIS by default only launches a worker process when the first request for the web application is received. So for the web applications that require a longer time to initialize, users might see slow responses.
For such applications it is a good idea to launch the worker process as soon as IIS is started. The application pools have a startMode setting which when set to AlwaysRunning launches the worker process for the application pool as soon as IIS is started.
IIS 8 provides you this setting in the Application Pool Settings UI.
Source: https://blogs.msdn.microsoft.com/vijaysk/2012/10/09/iis-8-whats-new-application-pool-settings/

If you really want to run those actions after you publish the website, you'll have to learn more about the Visual Studio build process. This link can get you started: https://learn.microsoft.com/en-ca/visualstudio/msbuild/how-to-extend-the-visual-studio-build-process?view=vs-2017


text:
Q: Multiple dependent select boxes not working I'm looking to make a series of select boxes in html which show different options depending on what has already been selected. I can get the first two to work but can't work out why it's not injecting into the last box here, the #FCadultseats select box.
I basically want the FCadultseats box to be available only when the movie is in the big cinema (at 9pm).
Thanks a lot for any and all help. I've been trying for ages and dont know why this wont work.
Here's my code:
<form id = "booking" method = "POST" action = "testserver">
                    Day:
                    <select id = "dayselector" name = "day">
                        <option disabled selected> -- Select a Day -- </option>
                        <option value= "Monday">Monday </option>
                        <option value = "Tuesday">Tuesday</option>
                        <option value = "Wednesday">Wednesday</option>
                        <option value = "Thursday">Thursday</option>
                        <option value = "Friday">Friday</option>
                        <option value = "Saturday">Saturday</option>
                        <option value = "Sunday">Sunday</option>
                    </select>
                    <br>
                    Time and Cinema:
                    <select id ="timeselector" name ="time">
                        <option disabled selected> -- Select a Time -- </option>
                    </select>
                    First Class Adults: <select id ="FCadultseats">
                        <option disabled selected> -- Not Available -- </option>
                    </select>
</form>

$(document).ready(function(){
$("#dayselector").change(function(){
    var sel_day = $('option:selected').val();
    if (sel_day == "Saturday" || sel_day == "Sunday"){
        $("select#timeselector").html('<option disabled selected> -- Select a Time -- </option><option value ="9">9pm - Large Cinema</option><option value ="4">4pm - Small Cinema</option>');
    } else {
        $("select#timeselector").html('<option disabled selected> -- Select a Time -- </option><option value ="9">9pm - Large Cinema</option>');
    }
});

$("#timeselector").change(function(){
    var sel_time = $('option:selected').val();
    if (sel_time == 9){
    $("#FCadultseats").html('<option value ="0">0</option><option value ="1"></option><option value ="2">2</option><option value ="3">3</option><option value ="4">4</option><option value ="5">5</option><option value ="6">6</option><option value ="7">7</option><option value ="8">8</option><option value ="9">9</option><option value ="10">10</option><option value ="11">11</option><option value ="12">12</option>');
    }
});

});

A: Try changing
var sel_day = $('option:selected').val();

to
var sel_day = this.value;

and do that in both places.
$('option:selected') selects ALL the selected options on the page, for every select.


text:
Q: how to generate pdf file dynamically on click of a link button without loading the page I have a user control which has a panel used to display the information which I print when needed.
I have a grid view in which I get search result It has a link button clicking on which I want to open a pdf of that panel in the above one.

A: I have implemented this, and I hope someone else can do it as well. I have listed my code below.
    using iTextSharp.text;
    using iTextSharp.text.pdf;
    using iTextSharp.text.html;
    using iTextSharp.text.html.simpleparser;

Import the above DLL
string attachment = "attachment; filename=" + "File Name" + ".pdf";
    Response.ClearContent();
    Response.AddHeader("content-disposition", attachment);
    Response.ContentType = "application/pdf";
    StringWriter stw = new StringWriter();
    HtmlTextWriter htextw = new HtmlTextWriter(stw);
    htextw.AddStyleAttribute("font-size", "7pt");
    htextw.AddStyleAttribute("color", "Black");
    Page pg = new Page();
    HtmlForm frm = new HtmlForm();
    pg.EnableEventValidation = false;

    pg.RenderControl(htextw);
    Document document = new Document();
    document = new Document(PageSize.A4, 5, 5, 15, 5);
    FontFactory.GetFont("Arial", 50, iTextSharp.text.BaseColor.BLUE);
    PdfWriter.GetInstance(document, Response.OutputStream);
    document.Open();
    //This is how you can add text in div in a pdf
    Chunk c = new Chunk(TextHere + "\n", FontFactory.GetFont("Verdana", 15));
    Paragraph p = new Paragraph();
    p.Alignment = Element.ALIGN_LEFT;
    p.Add(c); p.Add(c1);
    // This is how you can generate table and can set proprties
    PdfPTable table = new PdfPTable(2);
    table.WidthPercentage = 100;
    //Bill No and Bill Date
    PdfPCell pdfcell1 = new PdfPCell(new Phrase("Text in TAble" + "TExt From Database"));
    pdfcell1.Border = iTextSharp.text.Rectangle.BOTTOM_BORDER | iTextSharp.text.Rectangle.TOP_BORDER;
    table.AddCell(pdfcell1);
    PdfPCell pdfcell = new PdfPCell(new Phrase("Text in TAble" + "TExt From Database"));
    pdfcell.Border = iTextSharp.text.Rectangle.BOTTOM_BORDER | iTextSharp.text.Rectangle.TOP_BORDER;
    pdfcell.HorizontalAlignment = Element.ALIGN_RIGHT;
    table.AddCell(pdfcell);

    document.Add(p);
    document.Add(table);
    document.Add(tablegrid);
    StringReader str = new StringReader(stw.ToString());
    HTMLWorker htmlworker = new HTMLWorker(document);
    htmlworker.Parse(str);

    document.Close();
    Response.Write(document);

A: I think you might run into some trouble on this one. You can't do this all client-side, since JavaScript can not manipulate files (by design).
So your options are:

*

*Full postback

*Ajax call

You could try an Ajax call to a custom handler (.ashx) file whick returns a response with the PDF file. I havn't tried this before, but it might work. How about opening another page with target="_blank" and it will run the server-side code and generate the PDF, while the original page remains where it was?


text:
Q: Custom context menu in Firefox with Add-on SDK? I wish to add a single menu item to the firefox context menu that shows up
only if the user right-clicks a specific url. I have a function to test the url.
I used to do this by subscribing to "popupshowing" event and:
var item = document.getElementById("custom-menu-id");
if (item) // show only for specific links
    item.hidden = gContextMenu.onLink && acceptableURL(gContextMenu.linkURL);

I'm trying now to use the Add-on SDK, but there I no longer have access to gContextMenu.
This snippet from the documentation doesn't work for me:
var cm = require("sdk/context-menu");
cm.Item({
    label: "Copy name to clipboard",
    context: cm.URLContext("http://scholar.google*"),
    contentScript: 'self.on("context", function(node) {return true; });'
});

Here I'd think that it should be possible to get something like node.URL and test that,
but it doesn't work. Maybe someone could suggest either how to get access to gContextMenu from the sdk or how to get URL from node or something else.

A: This code should only show the menu item when right-clicking on links directed at stackoverflow.com:
In your main module main.js:
exports.main = function() {
    require("sdk/context-menu").Item({
        label: "stack overflow link",
        context:  require("sdk/context-menu").SelectorContext("a[href]"),
        contentScriptFile: require("sdk/self").data.url("check-node.js"),
        onMessage: function(msg){},
    });
};

In your content script (or content script file; in this case, check-node.js):
self.on("click",function(node,data){
    self.postMessage("click");
});
self.on("context", function(node){
    if(node.href && node.href.match(/^https?:\/\/(\w+\.)*stackoverflow\.com(\/.*)?$/))return true;  //show in context menu if return value is true.
});

Re: Your sample code. You have URLContext which determines what pages your menu items show up on and this snippet self.on("context", function(node) {return true; }); causes the menu item to always show when URLContext conditions are met.  Use SelectorContext instead. And test the node.href as shown above, returning true only if you want the menu item to show.


text:
Q: Proving $\DeclareMathOperator{\Re}{Re}\DeclareMathOperator{\Im}{Im}\Re{(\cosh z}) = \cosh(\Re z)\cdot \cos(\Im z)$ I want to show $\Re{(\cosh z)}) = \cosh(\Re z)\cdot \cos(\Im z)$.
I did the following:
\begin{align*} \cosh(\Re z)\cdot \cos(\Im z) &= \frac {1}{2}(e^{\Re z}+e^{-\Re z})\cdot \frac {1}{2}(e^{i\Im z}+e^{-i\Im z}) \\& = \frac {1}{4}(e^{\Re z}+e^{-\Re z})\cdot (e^{i\Im z}+e^{-i\Im z}) \\
&= \frac {1}{4}(e^{\Re z}+e^{-\Re z}) \cdot 2\\
& = \frac {1}{2}(e^{\Re z}+e^{-\Re z}) \\
&= \frac {1}{2}\Re(e^z+e^{-z}) \\
&= \Re(\cosh z)
\end{align*}
Using: $\cosh(x) = \frac {1}{2}(e^x+e^{-x})$ and $\cos(x) = \frac {1}{2}(e^{ix}+e^{-ix})$.
I would be very glad if someone could tell me if this is correct!

A: As an alternative, but taking the path of OP so that his /her error can be seen:
$$ \cosh\left[\operatorname{Re}(z)\right] \cdot \cos\left[\operatorname{Im}(z)\right] = \left(\frac{e^{\operatorname{Re}(z)} + e^{-\operatorname{Re}(z)}}{2}\right) \left(\frac{e^{i\operatorname{Im}(z)} + e^{-i\operatorname{Im}(z)}}{2}\right)$$
$$ = \frac{e^{\operatorname{Re}(z) + i\operatorname{Im}(z)} + e^{\operatorname{Re}(z) - i\operatorname{Im}(z)} +  e^{-\operatorname{Re}(z) + i\operatorname{Im}(z)} + e^{-\operatorname{Re}(z) - i\operatorname{Im}(z)}}{4} $$
$$ = \frac{e^{\operatorname{Re}(z) + i\operatorname{Im}(z)} + e^{-\operatorname{Re}(z) - i\operatorname{Im}(z)} + e^{\operatorname{Re}(z) - i\operatorname{Im}(z)} +  e^{-\operatorname{Re}(z) + i\operatorname{Im}(z)} + }{4} $$
$$ = \frac{e^{Re(z) + i\operatorname{Im}(z)} + e^{-\operatorname{Re}(z) - i\operatorname{Im}(z)} + e^{\operatorname{Re}(z) - i\operatorname{Im}(z)} +  e^{-[\operatorname{Re}(z) - i\operatorname{Im}(z)]}}{4} $$
$$ = \frac{e^{\operatorname{Re}(z) + i\operatorname{Im}(z)} + e^{-[\operatorname{Re}(z) + i\operatorname{Im}(z)]}}{4} + \frac{e^{\operatorname{Re}(z) - i\operatorname{Im}(z)} + e^{-[\operatorname{Re}(z) - i\operatorname{Im}(z)]}}{4} = \frac{\cosh {z}}{2} + \frac{\cosh {\overline {z}}}{2}$$
$$  = \frac{\cosh {z} + \cosh {\overline {z}}}{2} = \frac{2\operatorname{Re}{\left[\cosh{z}\right]}}{2} = \operatorname{Re}{\left[\cosh{z}\right]}$$

A: Let $z=x+iy$, then we have that
$$\cosh z=\frac{e^z+e^{-z}}2=\frac12e^xe^{iy}+\frac12e^{-x}e^{-iy}=\frac12e^x(\cos y+i\sin y)+\frac12e^{-x}(\cos y-i\sin y) $$
$$ \implies \operatorname{Re}(\cosh z)=\frac12e^x\cos y+\frac12e^{-x}\cos y=\frac{e^x+e^{-x}}2\cos y=\cosh x \cdot\cos y$$

A: Using the sum of angles formulae,
$\cosh(x+iy)=\cosh(x)\cosh(iy)+\sinh(x)\sinh(iy)$
but $
\cosh(iy)=\cos(y)$ and $\sinh(iy)=i\sin(y)$
so:   $\cosh(x+iy)=\cosh(x)\cos(y) + i \sinh(x)\sin(y)$
QED


text:
Q: Add a check for php to see if data from database is stored as JSON in localStorge I'm trying to figure out a way to make php check if data from my database is stored into the clients localStorage. I know that we don't get any data sent to php in a header like it does with a cookie. But I hope there is a way to do this, I think it would make sense from a performance point of view on the server.
I'm basicly trying to accomplish this:
1) php connects to db.
2) php echo out content from my query and decode it to JSON
3) The JSON is stored into the clients localStorage.
And this is where I'm trying to figure out a way to check.
4) On page refresh, php checks if (maybe with some bool set to true). item from localStorage is added. If true, don't run db connection and query.
5) data from JSON is used to display my items for the client instead.
Anyone tried this before and maybe can give me some hints / documentation to solve this.


text:
Q: Encrypted shell script is showing in plain text while executing I run a encrypted shell script through crontab, while checking for process of script through ps -ef | grep script_name it is showing process along with script code in plain text
# ps -ef | grep test_script.x

root      5134  2901  0 12:16 pts/3    00:00:00 ./test_script.x -c

#!/bin/bash if [ `echo $?` == 0 ]; then echo "This is my test script"  apt-get update else echo "This is end test script" fi sleep 3    ./test_script.x

root      5164 15802  0 12:16 pts/0    00:00:00 grep --color=auto test_script.x


text:
Q: R script, how to group_by and max on factor values? For a reporting purposes, I've got a data frame which is defined like this:
Data:
V df_ischemia 12 obs. of 2 variables
  record_id : 'labelled' chr "1001" "1001" "1001" "1001" "1002" ...
  ..- attr(*, "label")= chr "Patient number"
  ischemic: Factor w/ 2 levels "Unchecked","Checked": NA NA 1 1 NA 2 NA 1 NA 2 ...
  ..- attr(, "redcapLabels")= chr [1:2] "Unchecked" "Checked"
  ..- attr(, "redcapLevels")= int [1:2] 0 1
  ..- attr(, "label")= chr "Complication(s): Ischemia"

The real data frame has a couple of hundred rows, but for this example let's say it's got just 12 rows like this:
   | record_id  | ischemic
 1 | 1001       | NA
 2 | 1001       | NA
 3 | 1001       | Unchecked
 4 | 1001       | Unchecked
 5 | 1002       | NA
 6 | 1002       | Checked
 7 | 1003       | NA
 8 | 1003       | Unchecked
 9 | 1004       | NA
10 | 1004       | Checked
11 | 1004       | Checked
12 | 1004       | Checked

And the goal is to group it for patients with a 'Checked' value, so the expected output should be like this:
  | record_id  | ischemic
1 | 1002       | Checked
2 | 1004       | Checked

I figured just use group_by and max
df_ischemia <- group_by(record_id) %>% max(df_ischemia$ischemic)
# Error object 'record_id' not found

df_ischemia <- group_by(df_ischemia$record_id) %>% max(ischemic)
# no applicable method for 'group_by_' applied to an object of class "c('labelled', 'character')"

df_ischemia <- group_by(record_id) %>% summarise(df_ischemia$ischemic=max(df_ischemia$ischemic))
# Error: unexpected '=' ..

But that doesn't work, however the factor does have int values so a max should be possible(?). I read somewhere that the factor should be ordered. It looks like it's orderd, but no clue how to check if that is the case, or how to set the order of an existing factor.

A: We need summarise in the first case
library(dplyr)
df_comp_lrcsp %>%
   group_by(record_id) %>%
    summarise(Max =  comp_lrcsp___1[which.max(as.integer(comp_lrcsp___1))]) )

The <- is at the wrong place i.e. the group_by is applied on a column 'record_id' without specifying the data 'df_comp_lrcsp',  after grouping, the max is done on the full column 'comp_lrscp__1'.  Also, the extraction may not work with function applied on top of it as well because of the chain.
In the second code, the same issue without the data and the max applied without summarise.  In the last, we have the 'data' not found issue along with the extraction of the full column.  $ extracts the full column breaking the grouping


text:
Q: Mongoose findOneAndUpdate don´t update and don´t throw an error i have a two documents < Users and Poles > stored in my database on mongodDB Cluster . so basically a poles act like a team of Users . what i want is every time when a user want to join a pole his name will be pushed into a members array so i created a nested route in express to do this the structure is will be /poles/:poleid/adduser/:userid and i hade a problem even when i tried with $addToSet instead of $push. so my problem is that mongoose don't throw an error and don't update and the console log "Successfully patched pole."
this is my Two Models
const mongoose = require("mongoose");
const Schema = mongoose.Schema;

const Pole = new Schema({
  name: {
    type: String,
    default: "",
  },
  members: [{
    id: {
        type: mongoose.Schema.Types.ObjectId,
        ref: "User"
    },
    username: String,
    role: String,
    joined : {
      type : Date,
      default : () => Math.floor(Date.now() / 1000)
    } ,
    approved : {
      type : Boolean,
      default : false
    }
}],
},
{ timestamps: true });

module.exports = mongoose.model("Pole", Pole);

 const mongoose = require("mongoose");
const Schema = mongoose.Schema;

const passportLocalMongoose = require("passport-local-mongoose");

const Session = new Schema({
  refreshToken: {
    type: String,
    default: "",
  },
});

const User = new Schema({
  firstName: {
    type: String,
    default: "",
  },
  lastName: {
    type: String,
    default: "",
  },
  email: {
    type: String,
    default: "",
  },
  authStrategy: {
    type: String,
    default: "local",
  },
  socialAccounts : [{
    type: String,
    default: "",
  }],
pole: {
       id:{
             type: mongoose.Schema.Types.ObjectId,
             ref: "Pole"
       },
       name: String,
  },
// many to many relationship
Project: [{
  id:{
        type: mongoose.Schema.Types.ObjectId,
        ref: "Project"
  },
  name: String,
}],
Event: [{
  id:{
        type: mongoose.Schema.Types.ObjectId,
        ref: "Event"
  },
  name: String,
}],
Training: [{
  id:{
        type: mongoose.Schema.Types.ObjectId,
        ref: "Training"
  },
  name: String,
}],
Task: [{
  id:{
        type: mongoose.Schema.Types.ObjectId,
        ref: "Task"
  },
  name: String,
}],
refreshToken: {
    type: [Session],
  },
},
{
 timestamps: {
    createdAt: 'created_at', // Use `created_at` to store the created date
    updatedAt: 'updated_at' // and `updated_at` to store the last updated date
  }
}
);
//Remove refreshToken from the response
User.set("toJSON", {
  transform: function (doc, ret, options) {
    delete ret.refreshToken;
    return ret;
  },
});

User.plugin(passportLocalMongoose);
module.exports = mongoose.model("User", User);

and this is my poles route
var express = require('express');
var router = express.Router();
var addUserRouter = express.Router();
var Pole = require("../models/pole");
var User = require("../models/user");

addUserRouter.route("/:userid")
.put((req, res)=>{
  const poleid = req.poleid ;
  console.log(`pole id is fetched from server as ${poleid}`)
  const userid = req.params.userid ;
  console.log(`pole id is fetched from server as ${userid}`)
  let username = null;
  User.findOne({_id: userid}, (err, foundUser)=>{
    if(foundUser){
      console.log(`firstname is fetched from server as ${foundUser.firstName}`);
      console.log(`lastname id is fetched from server as ${foundUser.lastName}`);
      username = `${foundUser.firstName} ${foundUser.lastName}`
    }else{console.log("No username matching that id was found.");}

  });
  Pole.findOneAndUpdate(
    {id: poleid},
    {$push: { members: {
      id : req.params.userid,
      name : username,
      role : "member",
    } }},
    {useFindAndModify:false},
    (err)=>{
      (!err)? console.log("Successfully patched pole."):console.log(err);
      }
  );

});
router.use('/:poleid/adduser', (req, res,next) => {
  req.poleid = req.params.poleid;
  next();
},addUserRouter);

and even whenn i try log  my react fetch response i don't get anything and when i stop the server i got
PUT http://localhost:8081/poles/6267fce2a05b99e4fe4687eb/adduser/625f63a90b054a02b75a05a4/ net::ERR_CONNECTION_REFUSED
    fetch(process.env.REACT_APP_API_ENDPOINT + `poles/${poleid}/adduser/${userid}/`, {
      method: "PUT",
      headers: {
        "Content-Type": "application/json",
      },
    }).then(async (response) => {
       console.log(response);
       if (response.ok) {
         console.log("successfuly sent")
       }
    }).catch(err => {
     <p>{err}</p>
   })

A: thank you guys for all of your comments it was the filter that I m using in findOneAndUpdate id instead of _id so the correct form is
Pole.findOneAndUpdate(
{_id: poleid},
{$push: { members:...


text:
Q: wkhtmltopdf html url encoding (german umlaut) encoding of the following .pdf conversion on the linux console fails with "ContentNotFoundError"
wkhtmltopdf --page-size A4 --encoding utf-8 --viewport-size 1024x768 http://localhost/möja.html /tmp/test.pdf

Same problem in lynx with enabled UTF-8 charset:
The requested URL /möja.html was not found on this server.

locale settings are in utf-8. Console is typing the german special chars correctly.
LANG=de_DE.UTF-8
LANGUAGE=
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

Accessing the page over the browser and with wkhtmltopdf on the development system (same debian wheezy distribution) is working as expected. pdf's would be created fine without german special chars in the url. I can't find any differences.
Thank you for every hint!

A: Apparently the server doesn't expect to see UTF-8 encoded characters, it probably expects Latin-1. URLs cannot contain non-ASCII characters to begin with. Encode the umlaut in the URL in percent encoding according to the expected character encoding. The Latin-1 (ISO-8859-1) percent encoded version would be:
http://localhost/k%F6nig.html


text:
Q: Programatically detect what breakpoint was reached with GDB I have a script which debugs my application and it does set 2 breakpoints. If I would be debugging it manually I would be able to see which one got triggered. But doing it in an automatic manner, I don't know which breakpoint was reached, is there a way to write if conditions or something to detect which one was reached?
If this feature is not possible with vanilla gdb but only with python gdb I would be happy to switch/upgrade the process.
Edit: With Tom's help I can have
break main
commands
  set $gdb_breakpoint=1
end

break main.cpp:4053
commands
  set $gdb_breakpoint=2
end

break fault_handler.cpp:55
commands
  set $gdb_breakpoint=3
end

break unit_tests_complete
commands
  set $gdb_breakpoint=4
end

And then when the breakpoints got triggered I can check the variable to know where I got halted. In a pure software context this could be easier and maybe multiple breakpoints wouldn't be needed to begin with. This is testing hardware where the fault could happen erratically then this approach should do the trick.

A: The gdb CLI provides a commands command which can be used to attach other gdb commands to a breakpoint.  So for example:
(gdb) break main
Breakpoint 1 at 0x40ce90: file ../../binutils-gdb/gdb/gdb.c, line 25.
(gdb) commands 1
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>print "hi"
>end

... will arrange to print "hi" when the breakpoint is hit.
If you prefer to use Python, then you can add a listener to the gdb.events.stop event, and look specifically for breakpoint stops.


text:
Q: Bernoulli's Second Problem - not the brachistochrone I had been reading up on the Brachistochrone problem, and what interested me was that Bernoulli actually put a second problem in his New Year's Day Programma. The Brachistochrone takes all the glory, but the following problem seems interesting:
``To find a curve such that the sum of the two segments $PK$ and $PL$, on a line drawn at random from a point $P$ to cut the curve in two points $K$ and $L$, though the two segments be raised to any power, is constant."
First, I am trying to even figure out what this is saying. So it seems necessary that the random line that is drawn through $P$ must intersect the curve at exactly 2 places, otherwise there's some ambiguity.
Second, does the constant they speak of vary depending on the point $P$? This also seems necessary, but I could be confused based on the curve at hand.
Third, assuming one understands the question, does anyone have a solution?
Any helpful hints, comments, or clarifications would be most helpful in allowing me to satisfy my curiosity. Thanks!


text:
Q: How to decompress gzip messages from a Kafka source in Flume I have a Flume agent with morphline interceptor that reads from a Kafka source with messages compressed in gzip.
Anyone knows how to decompress these messages before morphline process it?
Thanks!!


text:
Q: Fixing a user ID value in a computed field (Drupal 7) I have a content type in Drupal 7 for creating an article. I want a computed field, called 'author', that stores the user ID of whoever created the article, but which doesn't change to the user ID of anyone who subsequently edits the article. Therefore this, won't do because 'author' will re re-set according to the last user who saved the article:
  $entity_field[0]['value'] = $user -> uid;

The user ID of the originator, if you like. I thought the following, placed in the computed code section of the content type settings, would work: if 'author' doesn't contain anything then populate it with the user ID, if it does then do nothing.
if (!isset($entity -> field_author['und'][0]['value']) {
  global $user;
  $entity_field[0]['value'] = $user -> uid;
}

It doesn't work. My question: does this not work because I'm testing the existence of a value in a field of a record that has not yet been created? Thanks.

A: Solution: The user id does not change when a node is updated. So there is no need for a computed field like I thought I needed.


text:
Q: SQL conditional join with deifferent fields In my query i want to join two tables based on the value of a field (say field1). Depending on the value of the field1 the join would EITHER be:
field3 = field4  OR field5 = field6
Something like
join on
  CASE FIELD1
   When 1 THEN FIELD 2 = FIELD3
   When 2 THEN FIELD 4 = FIELD5
  END

I am doing something like this at the moment
 .... join on  (field1=1 AND field2=field3) OR (field1=2 AND field4=field5)

but it takes ages to run the query. The two conditions individually take less than 7 secs each
How can i do this?

A: I would highly recommend against this approach. You are forcing the db to run a query it can't do anything to optimise. Instead look at your tables and see if there isn't something that can be done to split the data so this conditional isn't needed.
Alternatively if you really need to do this then the fastest way to do it is run two queries and union the results:
select * from table as x where x.field1 = 1 AND x.field2 = x.field3
union [ALL]
select * from table as y where x.field1 = 2 AND y.field4 = y.field5

This should be far faster.

A: It takes ages because the or will not let you use indexes. The simplest solution what I can think of, is to make 2 selects and union them.
select ...
from ...
join ...
   on  (field1=1 AND field2=field3)
union
select ...
from ...
join ...
   on  (field1=2 AND field4=field5)

A: The problem with "or" in a join condition is that it impedes the use of indices and tends to encourage nested loop joins.  I would recommend doing the join twice:
from A left outer join
     B b1
     on a.field2 = b2.field3 left outer join
     B b2
     on a.field4 = b2.field5

The left outer joins make sure you keep all rows.  You can do additional logic in the SELECT or WHERE clauses to get the full logic you want.

A:
"it takes ages to run the query. The two conditions individually take
  less than 7 secs each"

When you run the individual queries the database can figure out a clear-cut execution path.  But they will be different execution paths for each condition.    When you attempt to combine the two conditions the database has no easy to reconcile them, so it does something slow - probably a full table scan.
How you solve this depends on your flavour of RDBMS and a whole host of other factors.   I will let other people give you sonme guesses about how to solve this.

A: SELECT *
FROM data_parent
WHERE pid =
CASE
WHEN pid =1
THEN (
SELECT id
FROM data_parent, test
WHERE data_parent.pid = test.id
)

data_parent and test are two tables
data_parent has column pid and test has an column rpid as foreign key.
This works and gives me the output.


text:
Q: Calling dictionary keys using another array I have a UIPickerView showing data from an Array of keys.
var pokemonData = ["Nidoran", "Clefairy", "Spearow", "Ivysaur", "Gengar", "Arcanine", "Gyarados", "Onix", "Pikachu", "Vaporeon"]

Also I have this Dictionary, but i want call each key to it shows in a label whenever i choose something on the picker.
var typeData = [

    "Nidoran" : "Type: Poison",
    "Clefairy" : "Type: Normal",
    "Spearow" : "Type: Normal, Flying",
    "Ivysaur" : "Type: Grass, Poison",
    "Gengar" : "Type: Ghost, Poison",
    "Arcanine" : "Type: Fire",
    "Gyarados" : "Type: Water, Flying",
    "Onix" : "Type: Rock, Ground",
    "Pikachu" : "Type: Electric",
    "Vaporeon" : "Type: Water"

]

How can I do that? I use this picker function to change the labels
func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {

    pokeLabel.text = pokemonData[row]

}

My second label is...
@IBOutlet weak var typeLabel: UILabel!

A: Just use that typeData Dictionary to get value for selected key.
func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
     pokeLabel.text = pokemonData[row]
     typeLabel.text = typeData[pokemonData[row]]
}


text:
Q: What's the dwell signals? Today When I was seeing this page(Digital multimeters (DMM or DVOM) part) I saw this part:

What does "automotive timing"? and What's the dwell signals? are these electronic concepts?

A: "Automotive timing" refers to the ignition system of a gasoline engine - making sure that the spark happens at the right time.  The "dwell time" is the length of time that the distributor points are closed, applying power to the spark coil.


text:
Q: Summing of adjacent cells in a single column that are <>0 I have a list of numbers (8780 values in  one column -- a sample is posted below) some of them are <> 0 and some of them are 0.

List of numbers:
  0
  0
  0
  0
  0,127227198
  0
  0
  0,229366036
  0,174893344
  0
  0,247079364
  0
  0,508165499
  0,380252705
  0,221018177
  0,703514629
  0
  0,49853953
  0,891621276
  1,795142292
  0
  0
  0
  0
  1,405576577
  0,965799766
  0,347987496
  0,15944612
  0,087348148
  0
  0

For each series of numbers adjacent that are <>0 I want to summarize those cell values and ad the sum in a separate cell in column B. How can I do that? Can I use an some combination of an if function in the B-column?
As you can see the numbers <> 0 appear randomly so I think need some kind of formula that checks if the row before or after is = 0 and if the row after is <> 0 it should start summing the numbers above.
So for instance I want to add the sum of the below numbers into one cell.
1,405576577
0,965799766
0,347987496
0,15944612
0,087348148

I really appreciate any help i can get! Hope this became clearer :)

A: For original data in A1:A25, you can use the following:
In B1 enter the following array formula by pasting into the formula bar and pressing Ctrl+Shift+Enter:
=SUMPRODUCT((MIN(IF($A1:$A$25=0,ROW($A1:$A$25),ROW($A$26)))>ROW($A1:$A$25))*($A1:$A$25))

This formula sums the values in A1 and below that occur before the first zero.
In B2 enter the similar array formula with an extra condition (also using Ctrl+Shift+Enter):
=IF(A1<>0,0,SUMPRODUCT((MIN(IF($A2:$A$25=0,ROW($A2:$A$25),ROW($A$26)))>ROW($A2:$A$25))*($A2:$A$25)))

This has a condition to check for a nonzero cell above in column A -- if it is nonzero, 0 will be returned. Otherwise, sum values that occur before the next zero.
Sample:


text:
Q: Why do I get a 404 error and what does no Firebase App '[DEFAULT]' mean? What does it exactly mean and how do I solve it?
Failed to load resource: the server responded with a status of 404 ()
firebaseNamespaceCore.ts:106 Uncaught FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase
App.initializeApp() (app/no-app).
     at f (https://www.gstatic.com/firebasejs/7.9.1/firebase.js:1:73499)
     at Object.i [as auth] (https://www.gstatic.com/firebasejs/7.9.1/firebase.js:1:73757)
     at https://superx-bcf15.web.app/:37:22

A: The error messages you provided are actually two separate errors.
The 404 Error
The first error message,
Failed to load resource: the server responded with a status of 404 ()

is caused by
<script src="js/app.js"></script>

where the file https://superx-bcf15.web.app/js/app.js doesn't exist.
The Firebase '[DEFAULT]' app
firebaseNamespaceCore.ts:106 Uncaught FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call FirebaseApp.initializeApp() (app/no-app).

This error message indicates that you haven't called firebase.initializeApp() to pass in the required configuration parameters before trying to use the SDK elsewhere.
In your code, you try to call firebase.auth() before calling firebase.initializeApp() here:
<script src="https://www.gstatic.com/firebasejs/7.9.1/firebase.js"></script>
<script>
    firebase.auth().onAuthStateChanged(function(user){
        if(user){
            window.location.href = "admin.html";
        }
    });
</script>

You need to change that to
<script src="https://www.gstatic.com/firebasejs/7.9.1/firebase.js"></script>
<script>
    firebase.initializeApp(/* your firebase config here */);
    firebase.auth().onAuthStateChanged(function(user){
        if(user){
            window.location.href = "admin.html";
        }
    });
</script>

These steps are well documented in the Getting Started documentation.
Because you are using Firebase Hosting, you can also use the built-in helper script to call initializeApp() with the configuration needed for your project automatically (as you can see here):
<script src="https://www.gstatic.com/firebasejs/7.9.1/firebase.js"></script>
<script src="/__/firebase/init.js"></script>
<script>
    firebase.auth().onAuthStateChanged(function(user){
        if(user){
            window.location.href = "admin.html";
        }
    });
</script>


text:
Q: custom styles maplotlib (.mplstyle) After building a custom style and saving it in a ".mplstyle" folder, I then import this mplstyle into a new script. Unfortunately I get some errors.
home/local/lib/python2.7/site-packages/matplotlib/__init__.py:1102: UserWarning: Bad val "[3.7, 1.6]" on line #183
    "lines.dashed_pattern : [3.7, 1.6]
"
    in file "/home/plotting_tools/codepan.mplstyle"
    Key lines.dashed_pattern: Could not convert all entries to floats
  (val, error_details, msg))
/home/local/lib/python2.7/site-packages/matplotlib/__init__.py:1102: UserWarning: Bad val "[1.0, 1.65]" on line #184
    "lines.dotted_pattern : [1.0, 1.65]
"
    in file "/home/plotting_tools/codepan.mplstyle"
    Key lines.dotted_pattern: Could not convert all entries to floats
  (val, error_details, msg))

AttributeErrorTraceback (most recent call last)
/home/local/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
    332                 pass
    333             else:
--> 334                 return printer(obj)
    335             # Finally look for special method names
    336             method = get_real_method(obj, self.print_method)

/home/local/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in <lambda>(fig)
    239
    240     if 'png' in formats:
--> 241         png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
    242     if 'retina' in formats or 'png2x' in formats:
    243         png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))

/home/local/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in print_figure(fig, fmt, bbox_inches, **kwargs)
    123
    124     bytes_io = BytesIO()
--> 125     fig.canvas.print_figure(bytes_io, **kw)
    126     data = bytes_io.getvalue()
    127     if fmt == 'svg':

/home/local/lib/python2.7/site-packages/matplotlib/backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
   2210                     orientation=orientation,
   2211                     dryrun=True,
-> 2212                     **kwargs)
   2213                 renderer = self.figure._cachedRenderer
   2214                 bbox_inches = self.figure.get_tightbbox(renderer)

/home/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in print_png(self, filename_or_obj, *args, **kwargs)
    511
    512     def print_png(self, filename_or_obj, *args, **kwargs):
--> 513         FigureCanvasAgg.draw(self)
    514         renderer = self.get_renderer()
    515         original_dpi = renderer.dpi

/home/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in draw(self)
    431             # if toolbar:
    432             #     toolbar.set_cursor(cursors.WAIT)
--> 433             self.figure.draw(self.renderer)
    434             # A GUI class may be need to update a window using this draw, so
    435             # don't forget to call the superclass.

/home/local/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
     53                 renderer.start_filter()
     54
---> 55             return draw(artist, renderer, *args, **kwargs)
     56         finally:
     57             if artist.get_agg_filter() is not None:

/home/local/lib/python2.7/site-packages/matplotlib/figure.pyc in draw(self, renderer)
   1470
   1471             if self.frameon:
-> 1472                 self.patch.draw(renderer)
   1473
   1474             mimage._draw_list_compositing_images(

/home/local/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
     53                 renderer.start_filter()
     54
---> 55             return draw(artist, renderer, *args, **kwargs)
     56         finally:
     57             if artist.get_agg_filter() is not None:

/home/local/lib/python2.7/site-packages/matplotlib/patches.pyc in draw(self, renderer)
    556             renderer = PathEffectRenderer(self.get_path_effects(), renderer)
    557
--> 558         renderer.draw_path(gc, tpath, affine, rgbFace)
    559
    560         gc.restore()

/home/local/lib/python2.7/site-packages/matplotlib/patheffects.pyc in draw_path(self, gc, tpath, affine, rgbFace)
    107     def draw_path(self, gc, tpath, affine, rgbFace=None):
    108         for path_effect in self._path_effects:
--> 109             path_effect.draw_path(self._renderer, gc, tpath, affine,
    110                                   rgbFace)
    111

AttributeError: 'unicode' object has no attribute 'draw_path'<Figure size 432x288 with 1 Axes>

I suspect it is something to do with how I format the ".mplstyle" file, but I'm not too sure. Let me know if you need further information about my computer or the script I'm running.
EDIT
Here's the code I use
# Example of Use
import matplotlib.pyplot as plt
#plt.style.use("codepan.mplstyle")
plt.style.use('ggplot')

n = 50
raw_data = np.random.randn(n)*10

plt.plot(raw_data)
plt.show()

Here's a snippet from the mplstyle file
lines.dashdot_pattern : [6.4, 1.6, 1.0, 1.6]
lines.dashed_pattern : [3.7, 1.6]
lines.dotted_pattern : [1.0, 1.65]

A: You want to remove the square brackets from those lines
i.e. they should look like:
lines.dashdot_pattern : 6.4, 1.6, 1.0, 1.6
lines.dashed_pattern : 3.7, 1.6
lines.dotted_pattern : 1.0, 1.65

See, for example, here in the classic.mplstyle example sheet.


text:
Q: Packaging WebForms ASCX Controls for Reuse I am trying to write some user controls that will potentially be reused across projects. However...
Let's say we want to write a control that will display a list of Foos in a
.
Consider this in the codebehind:
public partial class FooBar : UserControl
{
    protected List<Foo> Foos { get; set; }

    protected void Page_Load(object sender, EventArgs e)
    {
        Foos = Service.GetFoos();
    }
}

However I cannot then reference this property in the markup. I would expect this to work, but it will not compile:

<%
foreach (var i in Foos)
{
    %>

Name: <%: i.Name %>

    <%
}
%>

Error given is:
'System.Web.UI.UserControl' does not contain a definition for 'Foos'

I looked at using both WebServerControl and UserControl but neither seemed to let me 'design' (i.e use Markup) for what I wanted.

A: I'm not sure why this sample code is not working (because it should and it is if copied to the clean project) but you can alternatively switch to the Repeater control if you are just planning to display data without any fancy transformations:

    <asp:Repeater runat="server" ID="rptFoos">
        <ItemTemplate>

Name: <%#: Eval("Name") %>

        </ItemTemplate>
    </asp:Repeater>

And in codebehind:
public partial class FooBar : UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        rptFoos.DataSource = Service.GetFoos();
        rptFoos.DataBind();
    }
}

As I said both ways are working for me on clean project but I think that if you will try to use repeater, maybe you will spot the problem quicker.


text:
Q: searching by title,category,like,dislike and date release I want to have a possibility to search a picture by title,category,like,dislike and date release . By title and category is working correct but by like and dislike always when I start by project default is value 0 and I see only picture which have value of like and dislike equal 0-I do not know how I can change this ,searching by date return all pictures
View->Index
<form asp-controller="Memy" asp-action="Index" method="get">
    <p>

        <select asp-for="MemyCategory" asp-items="Model.Categorys">
            <option value="">All</option>
        </select>

        Title: <input type="text" asp-for="SearchString" />
        Date: <input type="text" asp-for="SearchDate" />
        Like: <input type="number" asp-for="like" />

        Dislike: <input type="number" asp-for="dislike" />
        <input type="submit" value="Filter" />
    </p>
</form>

Controller and method which I responsible for this
  public async Task<IActionResult> Index(string memyCategory,
              string searchString, DateTime? searchDate,
              int? like, int? dislike)
    {
        // Use LINQ to get list of genres.
        IQueryable<string> genreQuery = from m in db.Memy
                                        orderby m.Category
                                        select m.Category;

        var memyy = from m in db.Memy
                     select m;

        if (!string.IsNullOrEmpty(searchString))
        {
            memyy = memyy.Where(s => s.Title.Contains(searchString));
        }

        if (like!=null)
        {
            memyy = memyy.Where(s => s.Like==like);
        }
        if (dislike != null)
        {
            memyy = memyy.Where(s => s.Dislike == dislike);
        }
        if (searchDate!=null)
        {
            memyy = memyy.Where(s => s.releaseDate.ToString().Contains(searchDate.ToString()));

        }

        if (!string.IsNullOrEmpty(memyCategory))
        {
            memyy = memyy.Where(x => x.Category == memyCategory);
        }

        var memyCategoryyy = new MemyCategoryViewModel
        {
            Categorys = new SelectList(await genreQuery.Distinct().ToListAsync()),
            Memys = await memyy.ToListAsync()

        };

        return View(memyCategoryyy);
    }

A: Your Date compare could be modified as :
DbFunctions dfunc = null;
if (searchDate!= null)
{
    memyy = memyy.Where(s => SqlServerDbFunctionsExtensions
            .DateDiffDay(dfunc, s.searchDate, searchDate) < 1);

}

For like/dislike , directly put checkpoint at server side and check whether get correct value(0/1) in Index function .