text:
Q: Map not updating with the .putIfAbsent() method The items maps don't take any new values after I call the addItem() method.
Here is my provider:
import 'package:flutter/material.dart';

class CartItem {
  final String id;
  final String title;
  final int quantity;
  final double price;

  CartItem({
    required this.id,
    required this.title,
    required this.quantity,
    required this.price,
  });
}

class Cart with ChangeNotifier {
  Map<String, CartItem> _items = {};

  Map<String, CartItem> get items {
    return {..._items};
  }

  int get itemCount {
    return items.length;
  }

  void addItem({
    required String productId,
    required double price,
    required String title,
  }) {
    /*check if the items already exist in cart
    else add the item in cart with quantity one.*/
    if (items.containsKey(productId)) {
      // update the quantity
      items.update(
          productId,
          (existingCartItem) => CartItem(
                id: existingCartItem.id,
                title: existingCartItem.title,
                quantity: existingCartItem.quantity + 1,
                price: existingCartItem.price,
              ));
    } else {
      // add the new item to cart
      items.putIfAbsent(
        productId,
        () => CartItem(
          id: DateTime.now().toString(),
          title: title,
          price: price,
          quantity: 1,
        ),
      );
    }
    // notifying all the listners to update on changes.
    print(items);
    notifyListeners();
  }
}

Here is the Listener:
the badge() is an stateless widget for displaying the shopping cart icon with the number of items in the cart.
This is the badge() (at the top right corner.)
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../widgets/products_grid.dart';
import '../providers/cart.dart';
import '../widgets/badge.dart';

enum FilterOptions {
  favorite,
  all,
}

class ProductOverviewScreen extends StatefulWidget {
  @override
  State<ProductOverviewScreen> createState() => _ProductOverviewScreenState();
}

class _ProductOverviewScreenState extends State<ProductOverviewScreen> {
  var showFavs = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('My Shop'),
        centerTitle: true,
        actions: [
          PopupMenuButton(
            onSelected: (selectedValue) => setState(() {
              if (selectedValue == FilterOptions.favorite) {
                showFavs = true;
              } else {
                showFavs = false;
              }
            }),
            itemBuilder: (context) => [
              const PopupMenuItem(
                value: FilterOptions.favorite,
                child: Text("Only Favorites"),
              ),
              const PopupMenuItem(
                value: FilterOptions.all,
                child: Text("Show All"),
              ),
            ],
          ),

          // top shopping card icon button
          Consumer<Cart>(
            builder: ((context, cart, ch) => Badge(
                  value: cart.itemCount.toString(),
                  child: ch as Widget,
                )),
            // taking this out of the builder method as it doesn't need to be re-rendered.
            child: IconButton(
              icon: const Icon(Icons.shopping_cart),
              onPressed: () {},
            ),
          )
        ],
      ),
      body: ProductsGrid(showFavs),
    );
  }
}

This is the class where I call the addItem method:
The call is from the icon button at the trailing widget of the gridTile.
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../screens/product_detail_screen.dart';
import '../providers/product.dart';
import '../providers/cart.dart';

class ProductItem extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final product = Provider.of<Product>(context, listen: false);
    final cart = Provider.of<Cart>(context, listen: false);

    return ClipRRect(
      borderRadius: BorderRadius.circular(12),
      child: GestureDetector(
        onTap: () {
          Navigator.of(context).pushNamed(
            ProductsDetailScreen.routeName,
            arguments: product.id,
          );
        },
        child: GridTile(
          footer: GridTileBar(
            backgroundColor: Colors.black87,
            leading: Consumer<Product>(
              builder: (context, value, _) => IconButton(
                icon: Icon(
                  product.isFavorite ? Icons.favorite : Icons.favorite_border,
                  color: Colors.deepOrange,
                ),
                onPressed: () {
                  product.toggleFavorite();
                },
              ),
            ),
            title: Text(
              product.title,
              textAlign: TextAlign.center,
            ),
            trailing: IconButton(
              icon: Icon(
                Icons.shopping_cart_outlined,
                color: Theme.of(context).colorScheme.secondary,
              ),
              onPressed: () {
                cart.addItem(
                    productId: product.id,
                    price: product.price,
                    title: product.title);
              },
            ),
          ),
          child: Image.network(
            product.imageUrl,
            fit: BoxFit.cover,
          ),
        ),
      ),
    );
  }
}

And here is the main.dart file (in case needed) I am using multiprovider:
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shop/providers/cart.dart';
import 'package:shop/screens/product_detail_screen.dart';

import './providers/products.dart';
import './screens/product_overview_screen.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(
          create: (context) => Products(),
        ),
        ChangeNotifierProvider(
          create: (context) => Cart(),
        ),
      ],
      child: MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'My Shop',
        theme: ThemeData(
          primarySwatch: Colors.purple,
          colorScheme: const ColorScheme.light(secondary: Colors.deepOrange),
          fontFamily: 'Lato',
        ),
        home: ProductOverviewScreen(),
        routes: {
          ProductsDetailScreen.routeName: (context) =>
              const ProductsDetailScreen(),
        },
      ),
    );
  }
}

I tried clicking the shopping cart icon button. This is the debugger console:
Restarted application in 413ms.
2 I/flutter ( 5850): {}

2 because I clicked the shopping cart button twice. The 2 would increment by one as I click the shopping cart button. But items are not being added to the items map. The number on the shopping cart icon on the screen remains zero.
I expect to see the number in the shopping cart number update as the products get in the items map.


text:
Q: XML to DataSet conversion is giving me error I am converting XML data to dataset with following code:
Public Function ReadXML(ByVal xmlData As String) As DataSet
        Dim stream As StringReader = Nothing
        Dim reader As XmlTextReader = Nothing
        Try
            Dim xmlDS As New DataSet()
            stream = New StringReader(xmlData)
            ' Load the XmlTextReader from the stream
            reader = New XmlTextReader(stream)
            xmlDS.ReadXml(reader)
            Return xmlDS
        Catch
            Return Nothing
        Finally
            If reader IsNot Nothing Then
                reader.Close()
            End If
        End Try
    End Function

xmlData is parameter to function which gives path to xml file.
when the code is on line:
xmlDS.ReadXml(reader) it throws me error:
XMLException was caught: Data at the root level is invalid. Line 1, position 1.

I am not able to understand why is this happening.
Please help me, Answer in c# can also help me.
C# equivalent function for this:
 public DataSet ConvertXMLToDataSet(string xmlData)
  {
   StringReader stream = null;
   XmlTextReader reader = null;
   try
   {
    DataSet xmlDS = new DataSet() ;
    stream = new StringReader(xmlData);
    // Load the XmlTextReader from the stream
    reader = new XmlTextReader(stream);
    xmlDS.ReadXml(reader);
    return xmlDS;
   }
   catch
   {
    return null;
   }
   finally
   {
    if(reader != null) reader.Close();
   }
  }// Use this function to get XML string from a dataset

Please help me.
XML:
<?xml version="1.0" encoding="UTF-8"?>
-<movieinfo creationdate="8/30/2013 11:32:21 AM"> -<localizedtemplatetexts> <field label="Movie Details" id="ttMovieDetails"/> <field label="Cast" id="ttCast"/> <field label="Crew" id="ttCrew"/> <field label="Disc" id="ttDisc"/> <field label="Edition Details" id="ttProductDetails"/> <field label="Personal Details" id="ttPersonalDetails"/> <field label="Episodes" id="ttEpisodeDetails"/> <field label="Images" id="ttImageLinkDetails"/> <field label="Images" id="ttMCEToggleImages"/> <field label="List" id="ttMCEToggleList"/> <field label="First" id="ttFirst"/> <field label="Previous" id="ttPrev"/> <field label="Up" id="ttUp"/> <field label="Next" id="ttNext"/> <field label="Last" id="ttLast"/> <field label="Buy this movie online" id="ttBuyOnline"/> </localizedtemplatetexts> -<moviemetadata> <field label="Index" id="dfIndex" name="Index"/> <field label="Loaned To" id="dfLoaner" name="Loaned To"/> <field label="Loan Date" id="dfLoanDate" name="Loan Date"/> <field label="Due Date" id="dfDueDate" name="Due Date"/> <field label="Overdue" id="dfIsOverdue" name="Overdue"/> <field label="Return Date" id="dfReturnDate" name="Return Date"/> <field label="Loan Notes" id="dfLoanNotes" name="Loan Notes"/> <field label="Loaner Email" id="dfLoanEmail" name="Loaner Email"/> <field label="Loaner Address" id="dfLoanAddress" name="Loaner Address"/> <field label="Title" id="dfLoanTitle" name="Title"/> <field label="Title" id="dfTitle" name="Title"/> <field label="Title Sort" id="dfTitleSort" name="Title Sort"/> <field label="Title Extension" id="dfTitleExtension" name="Title Extension"/> <field label="Collection Status" id="dfCollectionStatus" name="Collection Status"/> <field label="Plot" id="dfPlot" name="Plot"/> <field label="Running Time" id="dfRunTime" name="Running Time"/> <field label="No. of Disks/Tapes" id="dfNrItems" name="No. of Disks/Tapes"/> <field label="Barcode" id="dfUPC" name="Barcode"/> <field label="Movie Release Date" id="dfReleaseDate" name="Movie Release Date"/> <field label="Release Date" id="dfDVDReleaseDate" name="Release Date"/> <field label="IMDb Number" id="dfIMDBNumber" name="IMDb Number"/> <field label="IMDb Rating" id="dfIMDBRating" name="IMDb Rating"/> <field label="TMDb ID" id="dfMovieDbID" name="TMDb ID"/> <field label="Color" id="dfColor" name="Color"/> <field label="Layers" id="dfLayers" name="Layers"/> <field label="Front Cover" id="dfCoverFront" name="Front Cover"/> <field label="Back Cover" id="dfCoverBack" name="Back Cover"/> <field label="Movie Poster" id="dfMoviePoster" name="Movie Poster"/> <field label="Backdrop" id="dfBackDrop" name="Backdrop"/> <field label="My Rating" id="dfMyRating" name="My Rating"/> <field label="Seen It" id="dfSeenIt" name="Seen It"/> <field label="Viewing Date" id="dfSeenWhen" name="Viewing Date"/> <field label="Viewing Year" id="dfSeenYear" name="Viewing Year"/> <field label="Seen Where" id="dfSeenWhere" name="Seen Where"/> <field label="Purchase Date" id="dfPurchaseDate" name="Purchase Date"/> <field label="Purchase Year" id="dfPurchaseYear" name="Purchase Year"/> <field label="Purchase Price" id="dfPurchasePrice" name="Purchase Price"/> <field label="Location" id="dfLocation" name="Location"/> <field label="Starting Position" id="dfStartPos" name="Starting Position"/> <field label="Tape Speed" id="dfTapeSpeed" name="Tape Speed"/> <field label="Notes" id="dfNotes" name="Notes"/> <field label="Links" id="dfLinks" name="Links"/> <field label="Movie Files" id="dfMovieLinks" name="Movie Files"/> <field label="Image Files" id="dfImageLinks" name="Image Files"/> <field label="Other Files" id="dfOtherLinks" name="Other Files"/> <field label="Trailer URLs" id="dfLinkTrailers" name="Trailer URLs"/> <field label="Trailer Files" id="dfTrailerFiles" name="Trailer Files"/> <field label="Quantity" id="dfQuantity" name="Quantity"/> <field label="Current Value" id="dfCurrentValue" name="Current Value"/> <field label="Storage Device" id="dfStorageDevice" name="Storage Device"/> <field label="Slot" id="dfStorageSlot" name="Slot"/> <field label="Episodes" id="dfEpisodes" name="Episodes"/> <field label="Chapters" id="dfChapters" name="Chapters"/> <field label="Extra Features" id="dfExtraFeatures" name="Extra Features"/> <field label="Actor" id="dfActor" name="Actor"/> <field label="Genre" id="dfGenre" name="Genre"/> <field label="Director" id="dfDirector" name="Director"/> <field label="Edition" id="dfEdition" name="Edition"/> <field label="Movie Release Year" id="dfReleaseYear" name="Movie Release Year"/> <field label="Format" id="dfFormat" name="Format"/> <field label="Region" id="dfRegion" name="Region"/> <field label="Release Year" id="dfDVDReleaseYear" name="Release Year"/> <field label="Series" id="dfSeries" name="Series"/> <field label="Box set" id="dfBoxSet" name="Box set"/> <field label="Audience Rating" id="dfMPAARating" name="Audience Rating"/> <field label="Studio" id="dfStudio" name="Studio"/> <field label="Distributor" id="dfDistributor" name="Distributor"/> <field label="Extras" id="dfExtras" name="Extras"/> <field label="Country" id="dfCountry" name="Country"/> <field label="Language" id="dfLanguage" name="Language"/> <field label="Plot Language" id="dfPlotLanguage" name="Plot Language"/> <field label="Original Title" id="dfOriginalTitle" name="Original Title"/> <field label="Screen Ratio" id="dfRatio" name="Screen Ratio"/> <field label="Packaging" id="dfPackage" name="Packaging"/> <field label="Subtitles" id="dfSubtitles" name="Subtitles"/> <field label="Audio Tracks" id="dfAudio" name="Audio Tracks"/> <field label="Store" id="dfStore" name="Store"/> <field label="Owner" id="dfOwner" name="Owner"/> <field label="Tape Label" id="dfTapeLabel" name="Tape Label"/> <field label="Condition" id="dfCondition" name="Condition"/> <field label="Tags" id="dfTag" name="Tags"/> <field label="Producer" id="dfProducer" name="Producer"/> <field label="Writer" id="dfWriter" name="Writer"/> <field label="Cinematography" id="dfCamera" name="Cinematography"/> <field label="Musician" id="dfMusic" name="Musician"/> <field label="User Credit 1" id="dfUserCredit1" name="User Credit 1"/> <field label="User Credit 2" id="dfUserCredit2" name="User Credit 2"/> <field label="Features" id="dfFeatures" name="Features"/> <field label="Title" id="dfEpisodeTitle" name="Title"/> <field label="Disc No." id="dfEpisodeDiscNr" name="Disc No."/> <field label="Plot" id="dfEpisodePlot" name="Plot"/> <field label="Running Time" id="dfEpisodeRunTime" name="Running Time"/> <field label="First Air Date" id="dfEpisodeFirstAirDate" name="First Air Date"/> <field label="Sequence No" id="dfEpisodeSequenceNr" name="Sequence No"/> <field label="Movie Link" id="dfEpisodeMovieLink" name="Movie Link"/> <field label="Internet Link" id="dfEpisodeLink" name="Internet Link"/> <field label="Image Link" id="dfEpisodeImageLink" name="Image Link"/> <field label="IMDB Number" id="dfEpisodeIMDBNumber" name="IMDB Number"/> <field label="Seen It" id="dfEpisodeSeenIt" name="Seen It"/> <field label="Viewing Date" id="dfEpisodeSeenWhen" name="Viewing Date"/> <field label="Seen Where" id="dfEpisodeSeenWhere" name="Seen Where"/> <field label="Disc No." id="strDiscNr" name="Disc No."/> <field label="Number Of Episodes" id="strNrEpisodes" name="Number Of Episodes"/> <field label="User Lookup 1" id="dfUserLookup1" name="User Lookup 1"/> <field label="User Lookup 2" id="dfUserLookup2" name="User Lookup 2"/> <field label="User Text 1" id="dfUserText1" name="User Text 1"/> <field label="User Text 2" id="dfUserText2" name="User Text 2"/> <field label="In Collection (0/1)" id="dfInCollectionBit" name="In Collection (0/1)"/> <field label="ID" id="dfID" name="ID"/> <field label="Last Modified" id="dfLastModified" name="Last Modified"/> <field label="Thumbnail" id="dfThumbFilePath" name="Thumbnail"/> <field label="Last Submission Date" id="dfSubmissionDate" name="Last Submission Date"/> <field label="Clz Movie ID" id="dfBPMovieID" name="Clz Movie ID"/> <field label="Clz Media ID" id="dfBPMediaID" name="Clz Media ID"/> <field label="BPOnline Movie Last Received Revision" id="dfBPMovieLastReceivedRevision" name="BPOnline Movie Last Received Revision"/> <field label="BPOnline Media Last Received Revision" id="dfBPMediaLastReceivedRevision" name="BPOnline Media Last Received Revision"/> <field label="Title First Letter" id="dfDynTitleLetter" name="Title First Letter"/> <field label="My Rating" id="dfDynRating" name="My Rating"/> </moviemetadata> -<movielist> -<movie> <id>701</id> <index>11</index> <coverfront>C:\Users\Administrator\Documents\Movie Collector\Images\Brave2012701_f.jpg</coverfront> <poster>C:\Users\Administrator\Documents\Movie Collector\Images\Brave2012701_p.jpg</poster> <backdropurl>C:\Users\Administrator\Documents\Movie Collector\Images\Brave2012701_d.jpg</backdropurl> <backgroundbackdrop>CLZBACKDROP</backgroundbackdrop> <imdburl>http://www.imdb.com/title/tt1217209</imdburl> <imdbnum>1217209</imdbnum> <imdbrating>7.3</imdbrating> <imdbvotes>66509</imdbvotes> <tmdbid>62177</tmdbid> <tmdburl>http://themoviedb.org/movie/62177</tmdburl> -<format> <displayname>Blu-ray Disc</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\bluray.jpg</templateimage> <scaledimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\bluray16x16.bmp</scaledimage> <sortname>Blu-ray Disc</sortname> </format> -<country> <displayname>USA</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\usa.jpg</templateimage> <scaledimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\usa16.jpg</scaledimage> <sortname>USA</sortname> </country> <collectionstatus listid="3">In Collection</collectionstatus> -<language> <displayname>English</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\uk.jpg</templateimage> <scaledimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\uk16.jpg</scaledimage> <sortname>English</sortname> </language> -<store> <displayname>Amazon</displayname> <sortname>Amazon</sortname> </store> <purchaseprice>$20.00</purchaseprice> <series/> <boxset/> -<purchasedate> -<year> <displayname>2012</displayname> </year> <month>12</month> <day>10</day> <date>12/10/2012</date> </purchasedate> -<owner> <displayname>John Doe</displayname> <sortname>John Doe</sortname> </owner> <title>Brave</title> <plot>Brave is set in the mystical Scottish Highlands, where Mérida is the princess of a kingdom ruled by King Fergus and Queen Elinor. An unruly daughter and an accomplished archer, Mérida one day defies a sacred custom of the land and inadvertently brings turmoil to the kingdom. In an attempt to set things right, Mérida seeks out an eccentric old Wise Woman and is granted an ill-fated wish. Also figuring into Mérida's quest — and serving as comic relief — are the kingdom's three lords: the enormous Lord MacGuffin, the surly Lord Macintosh, and the disagreeable Lord Dingwall.</plot> <myrating>9</myrating> -<myrating> <displayname>9</displayname> <sortname>9</sortname> </myrating> <seenit boolvalue="1">Yes</seenit> -<viewingdate> -<year> <displayname>2012</displayname> </year> <month>12</month> <day>10</day> <date>12/10/2012</date> </viewingdate> -<edition> <displayname>Collector's Edition</displayname> <sortname>Collector's Edition</sortname> </edition> -<condition> <displayname>Excellent</displayname> <sortname>090 Excellent</sortname> <lastname>090 Excellent</lastname> </condition> -<releasedate> -<year> <displayname>2012</displayname> </year> <date>2012</date> </releasedate> -<dvdreleasedate> -<year> <displayname>2012</displayname> </year> <month>11</month> <day>13</day> <date>11/13/2012</date> </dvdreleasedate> -<mpaarating> <displayname>PG (Parental Guidance)</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\pg.jpg</templateimage> <scaledimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\pg-16x16.jpg</scaledimage> <sortname>PG (Parental Guidance)</sortname> </mpaarating> <seenwhere>Home</seenwhere> <upc>786936828344</upc> <package/> -<location> <displayname>Moviebox 34</displayname> <sortname>Moviebox 34</sortname> </location> <tapelabel/> <runtime>93</runtime> <runtimeminutes>93 mins</runtimeminutes> <layersnum>1</layersnum> <layers listid="1">Single Side, Dual Layer</layers> <chapters>0</chapters> <nritems>5</nritems> <quantity>1</quantity> <color listid="0">Color</color> <tapespeed listid="0">N/A</tapespeed> -<genres> -<genre> <displayname>Action</displayname> <sortname>Action</sortname> </genre> -<genre> <displayname>Adventure</displayname> <sortname>Adventure</sortname> </genre> -<genre> <displayname>Animation</displayname> <sortname>Animation</sortname> </genre> -<genre> <displayname>Comedy</displayname> <sortname>Comedy</sortname> </genre> -<genre> <displayname>Family</displayname> <sortname>Family</sortname> </genre> </genres> -<cast> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Kelly MacDonald</displayname> <sortname>MacDonald, Kelly</sortname> <lastname>MacDonald</lastname> <url>http://www.imdb.com/name/nm0531808/</url> <firstname>Kelly</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/09/09_24708_4_KellyMacDonald.jpg</imageurl> </person> <character>Merida</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Billy Connolly</displayname> <sortname>Connolly, Billy</sortname> <lastname>Connolly</lastname> <url>http://www.imdb.com/name/nm0175262/</url> <firstname>Billy</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/b4/b4_3429_4_BillyConnolly.jpg</imageurl> </person> <character>Fergus</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Emma Thompson</displayname> <sortname>Thompson, Emma</sortname> <lastname>Thompson</lastname> <url>http://www.imdb.com/name/nm0000668/</url> <firstname>Emma</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/13/13_8549_4_EmmaThompson.jpg</imageurl> </person> <character>Elinor</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Julie Walters</displayname> <sortname>Walters, Julie</sortname> <lastname>Walters</lastname> <url>http://www.imdb.com/name/nm0910278/</url> <firstname>Julie</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/20/20_14643_4_JulieWalters.jpg</imageurl> </person> <character>The Witch</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Robbie Coltrane</displayname> <sortname>Coltrane, Robbie</sortname> <lastname>Coltrane</lastname> <url>http://www.imdb.com/name/nm0001059/</url> <firstname>Robbie</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/d0/d0_92_4_RobbieColtrane.jpg</imageurl> </person> <character>Lord Dingwall</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Kevin McKidd</displayname> <sortname>McKidd, Kevin</sortname> <lastname>McKidd</lastname> <url>http://www.imdb.com/name/nm0571727/</url> <firstname>Kevin</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/b8/b8_3557_4_KevinMcKidd.jpg</imageurl> </person> <character>Lord MacGuffin/Young MacGuffin</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Craig Ferguson</displayname> <sortname>Ferguson, Craig</sortname> <lastname>Ferguson</lastname> <url>http://www.imdb.com/name/nm0272401/</url> <firstname>Craig</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/17/17_17423_4_CraigFerguson.jpg</imageurl> </person> <character>Lord Macintosh</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Sally Kinghorn</displayname> <sortname>Kinghorn, Sally</sortname> <lastname>Kinghorn</lastname> <firstname>Sally</firstname> </person> <character>Maudie</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Eilidh Fraser</displayname> <sortname>Fraser, Eilidh</sortname> <lastname>Fraser</lastname> <firstname>Eilidh</firstname> </person> <character>Maudie</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Peigi Barker</displayname> <sortname>Barker, Peigi</sortname> <lastname>Barker</lastname> <firstname>Peigi</firstname> </person> <character>Young Merida</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Steven Cree</displayname> <sortname>Cree, Steven</sortname> <lastname>Cree</lastname> <firstname>Steven</firstname> </person> <character>Young Macintosh</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Steve Purcell</displayname> <sortname>Purcell, Steve</sortname> <lastname>Purcell</lastname> <firstname>Steve</firstname> </person> <character>The Crow</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Callum O'Neill</displayname> <sortname>O'Neill, Callum</sortname> <lastname>O'Neill</lastname> <firstname>Callum</firstname> </person> <character>Wee Dingwall</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Patrick Doyle</displayname> <sortname>Doyle, Patrick</sortname> <lastname>Doyle</lastname> <firstname>Patrick</firstname> </person> <character>Martin</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>John Ratzenberger</displayname> <sortname>Ratzenberger, John</sortname> <lastname>Ratzenberger</lastname> <url>http://www.imdb.com/name/nm0001652/</url> <firstname>John</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/d2/d2_14840_4_JohnRatzenberger.jpg</imageurl> </person> <character>Gordon</character> </star> </cast> -<crew> -<crewmember> <role id="dfDirector">Director</role> <roleid>dfDirector</roleid> -<person> <displayname>Steve Purcell</displayname> <sortname>Purcell, Steve</sortname> <lastname>Purcell</lastname> <url>http://www.imdb.com/name/nm0700760/</url> <firstname>Steve</firstname> <imageurl>http://clzimages.com/movie/banners/employees/small/0e/0e_3199_4_StevePurcell.jpg</imageurl> </person> </crewmember> -<crewmember> <role id="dfDirector">Director</role> <roleid>dfDirector</roleid> -<person> <displayname>Brenda Chapman</displayname> <sortname>Chapman, Brenda</sortname> <lastname>Chapman</lastname> <url>http://www.imdb.com/name/nm0152312/</url> <firstname>Brenda</firstname> <imageurl>http://clzimages.com/movie/banners/employees/small/32/32_6810_4_BrendaChapman.jpg</imageurl> </person> </crewmember> -<crewmember> <role id="dfWriter">Writer</role> <roleid>dfWriter</roleid> -<person> <displayname>Steve Purcell</displayname> <sortname>Purcell, Steve</sortname> <lastname>Purcell</lastname> <firstname>Steve</firstname> </person> </crewmember> -<crewmember> <role id="dfWriter">Writer</role> <roleid>dfWriter</roleid> -<person> <displayname>Brenda Chapman</displayname> <sortname>Chapman, Brenda</sortname> <lastname>Chapman</lastname> <firstname>Brenda</firstname> </person> </crewmember> -<crewmember> <role id="dfProducer">Producer</role> <roleid>dfProducer</roleid> -<person> <displayname>Andrew Stanton</displayname> <sortname>Stanton, Andrew</sortname> <lastname>Stanton</lastname> <firstname>Andrew</firstname> </person> </crewmember> -<crewmember> <role id="dfProducer">Producer</role> <roleid>dfProducer</roleid> -<person> <displayname>John Lasseter</displayname> <sortname>Lasseter, John</sortname> <lastname>Lasseter</lastname> <firstname>John</firstname> </person> </crewmember> -<crewmember> <role id="dfMusic">Musician</role> <roleid>dfMusic</roleid> -<person> <displayname>Patrick Doyle</displayname> <sortname>Doyle, Patrick</sortname> <lastname>Doyle</lastname> <firstname>Patrick</firstname> </person> </crewmember> </crew> -<regions> -<region> <displayname>Region 1</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\r-1.jpg</templateimage> <scaledimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\r-1-16x16.jpg</scaledimage> <sortname>Region 1</sortname> </region> -<region> <displayname>Region A</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\r-A.jpg</templateimage> <scaledimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\r-A-16x16.jpg</scaledimage> <sortname>Region A</sortname> </region> </regions> -<ratios> -<ratio> <displayname>Theatrical Widescreen (2.35:1)</displayname> <sortname>Theatrical Widescreen (2.35:1)</sortname> </ratio> </ratios> -<subtitles> -<subtitle> <displayname>English (Closed Captioned)</displayname> <sortname>English (Closed Captioned)</sortname> </subtitle> -<subtitle> <displayname>French</displayname> <sortname>French</sortname> </subtitle> -<subtitle> <displayname>Spanish</displayname> <sortname>Spanish</sortname> </subtitle> </subtitles> <features/> -<audios> -<audio> <displayname>Dolby Digital 5.1 [Spanish]</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\dolbydigital-51.png</templateimage> <sortname>Dolby Digital 5.1 [Spanish]</sortname> </audio> -<audio> <displayname>DTS [English]</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\dts.png</templateimage> <sortname>DTS [English]</sortname> </audio> -<audio> <displayname>DTS [French]</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\dts.png</templateimage> <sortname>DTS [French]</sortname> </audio> </audios> -<studios> -<studio> <displayname>Pixar</displayname> <sortname>Pixar</sortname> </studio> </studios> -<distributor> <displayname>Buena Vista</displayname> <sortname>Buena Vista</sortname> </distributor> <extras/> <tags/> <userlookup1/> <userlookup2/> -<links> -<link> <description>Amazon.com</description> <url>http://www.amazon.com/gp/search?keywords=786936828344+Brave&tag=collectorzapp-20&index=dvd</url> <urltype>URL</urltype> </link> -<link> <description>Movie Collector Connect</description> <url>http://connect.collectorz.com/movies/database/brave-2012</url> <urltype>URL</urltype> </link> -<link> <description>IMDB</description> <url>http://www.imdb.com/title/tt1217209</url> <urltype>URL</urltype> </link> -<link> <description>TheMovieDb.org</description> <url>http://www.themoviedb.org/movie/62177</url> <urltype>URL</urltype> </link> -<link> <description>Trailer</description> <url>http://www.youtube.com/watch?v=tYg0VgPy6Uk</url> <urltype>Trailer URL</urltype> </link> </links> <episodecount>0</episodecount> -<lastmodified> <date>12/10/2012 4:37:03 PM</date> </lastmodified> <thumbfilepath>C:\Users\Administrator\Documents\Movie Collector\Thumbnails\CBF03186E647BB05BC635F286DC84E34.jpg</thumbfilepath> <bpmovieid>140538</bpmovieid> <bpmediaid>496821</bpmediaid> <bpmovielastreceivedrevision>58</bpmovielastreceivedrevision> <bpmedialastreceivedrevision>0</bpmedialastreceivedrevision> <plotlanguage/> <storagedevice/> -<titlefirstletter> <displayname>B</displayname> <sortname>B</sortname> </titlefirstletter> -<discs> -<disc> <title>Disc 01</title> <features/> <storagedevice/> <episodes/> </disc> -<disc> <title>Disc 02</title> <features/> <storagedevice/> <episodes/> </disc> -<disc> <title>Disc 03</title> <features/> <storagedevice/> <episodes/> </disc> -<disc> <title>Disc 04</title> <features/> <storagedevice/> <episodes/> </disc> -<disc> <title>Disc 05</title> <features/> <storagedevice/> <episodes/> </disc> </discs> <submissiondate/> </movie> </movielist> </movieinfo>

A: http://www.amazon.com/gp/search?keywords=786936828344+Bravetag=collectorzapp-20&index=dvd
This URL Form xml file giving error.
Remember one thing XML not Accept "&"

A: Two things:
First, your XML contains a lot of - characters (maybe you copied these from a Xml-editor or viewer unintentional).
Second, your XML contains a some unescaped &s in URLs; these have to be escaped (use & instead of &). Take a look at the XML specification:

The ampersand character (&) and the left angle bracket (<) may appear in their literal form only when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they must be escaped using either numeric character references or the strings "&" and "<" respectively.

A: StringReader reads a literal string.
Use StreamReader instead.
Or use it like :
http://forums.asp.net/t/1247855.aspx/1 giving path

redpajama_set_name: RedPajamaStackExchange


text:
Q: Javascript match and regularexpression I've searched for an example, but I'm so bad at Regular Expressions that I really need an answer to my specific example.
I'm using JavaScript and have the following string as an example:
accountActivityStatus.transactionHistorys.0.activityAmt
I need to be able to match that any given string starts with accountActivityStatus and contains a number somewhere after that.
Any assistance would be greatly appreciated:

A: ^accountActivityStatus(?=.*\d).*$

Try this.See demo.
http://regex101.com/r/yZ7qJ6/7
var re = /^accountActivityStatus(?=.*\d).*$/gm;
var str = 'accountActivityStatus.transactionHistorys.0.activityAmt\naccountActivityStatus.transactionHistorys..activityAmt\naccountActivityStatus.transactionHistorys.4.activityAmt';
var m;

while ((m = re.exec(str)) != null) {
if (m.index === re.lastIndex) {
re.lastIndex++;
}
// View your result using the m-variable.
// eg m[0] etc.
}


text:
Q: How to send a email with Excel sheet through marco to multiple receivers with small modifications I have a excel sheet with a sale offer for multiple receivers each day.
The file has two tabs, Now I created a macro, to send the emails automatic.
The macro has a sub for each day.
Now one of the tabs is copied to a new worksheet than it changes one cell which has the name of the receiver in it.
After that, it sends the mail through outlook.
The sub begins with:
    ' Copy tab to a new worksheet

Sheets("Offer").Select
Sheets("Offer").Copy
    Cells.Select

    ' Copy worksheet with only results to replace formulas

Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    ' Change the color for cell A15:C15

Range("A15:C15").Select

With Selection.Interior
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    .Color = 14336204
    .TintAndShade = 0
    .PatternTintAndShade = 0
End With

    'Format the numbers to 2 numbers after the comma
Range("D20:D47").Select
Selection.NumberFormat = "_($* #,##0.00_);_($* (#,##0.00);_($* ""-""??_);_(@_)"

    ' Turn alerts off

Application.DisplayAlerts = False

    ' Set the author

ActiveWorkbook.BuiltinDocumentProperties("Author") = "Author name"

Then for each receiver, I have a block like this:
    ' email1

Range("D15:H15").Select
ActiveCell.FormulaR1C1 = "name1"

ActiveWorkbook.SaveAs Filename:= _
    "C:\Aanbod\Vrijdag\Filename_receivername1", _
    FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

    'send mail

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
    .to = "receiver1@domain.com"
    .CC = ""
    .BCC = ""
    .Subject = "subject here"
    .Body = ""
    .Attachments.Add ActiveWorkbook.FullName
    .Send
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

And to end the sub:
    ' Turn alerts back on

    Application.DisplayAlerts = True

    ' Close active window

    ActiveWindow.Close

    ' Go to tab1

    Sheets("tab1").Select

Now, this is working, but not really efficient. Also for some reason, it's not working entirely on one of the computers we use it on.
On that computer, it skips some of the receivers, so it doesn't send all emails.
Now I like to create an 3rd tab in the sales offer worksheet, with the email addresses in it, including the names of the receivers.
How can I do this?

A: So I rebuild the code now, so it uses a loop for generating the files and sending the mails.
This is what I got now:
    Sub Maakbestanden_maandag()
Dim Sh As Worksheet
Set Sh = ThisWorkbook.Sheets("Kopers-Maandag")

Dim Ab As Worksheet
Set Ab = ThisWorkbook.Sheets("Aanbod")

Application.ScreenUpdating = False

Application.DisplayAlerts = False

Sheets("Aanbod").Select
Sheets("Aanbod").Copy
    Cells.Select

Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

Range("A15:C15").Select

With Selection.Interior
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    .Color = 14336204
    .TintAndShade = 0
    .PatternTintAndShade = 0
End With

Range("D20:D49").Select
Selection.NumberFormat = "_($* #,##0.00_);_($* (#,##0.00);_($* ""-""??_);_(@_)"

Range("C20:C49").Select
Selection.NumberFormat = "@"

Range("E20:F49").Select
Selection.NumberFormat = "0"

Columns("E:E").ColumnWidth = 8
Columns("F:F").ColumnWidth = 6

ActiveWorkbook.BuiltinDocumentProperties("Author") = "AUTHOR NAME"

Range("G50").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-30]C:R[-1]C)"

Range("G51").Select
ActiveCell.FormulaR1C1 = "=R[-1]C/12"

Dim i As Integer
Dim last_row As Long

last_row = Application.WorksheetFunction.CountA(Sh.Range("A:A"))

For i = 2 To last_row

Range("D15:H15").Select
ActiveCell.FormulaR1C1 = Sh.Range("B" & i).Value

Range("D15:H15").Select

Application.ActiveWorkbook.SaveAs Filename:=Sh.Range("C" & i).Value, _
    FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

Next i

Application.DisplayAlerts = True

ActiveWindow.Close

MsgBox "Bestanden aangemaakt"

Call Verstuuremail_maandag

End Sub
and than to send the actual mails:
Sub Verstuuremail_maandag()

Dim Sh As Worksheet
Set Sh = ThisWorkbook.Sheets("Kopers-Maandag")

Dim OA As Object
Dim msg As Object

Set OA = CreateObject("Outlook.Application")

Dim i As Integer
Dim last_row As Long

last_row = Application.WorksheetFunction.CountA(Sh.Range("A:A"))

For i = 2 To last_row
Set msg = OA.createitem(0)

msg.To = Sh.Range("A" & i).Value
msg.Subject = "Sales offer"

msg.body = ""

If Sh.Range("C" & i).Value <> "" Then
msg.attachments.Add Sh.Range("C" & i).Value
End If

DoEvents
msg.send

Next i

MsgBox "E-mails voor maandag verstuurd"

Sheets("Veilprijzen").Select

End Sub

Now when I'm testing it, it works well, but still sometimes it stops at 2/3 of the way while sending the mails (generating the files works fully everytime).
When it stops, it's trowing the following error:
vba error 5 invalid procedure call or argument
VBA marks it at: msg.send
It's odd, sometimes we get a full run on the same day, with the very same code and customer information, and sometimes it doesn't go all the way.
Any recommendation to solve this?


text:
Q: Printing a simple webpage on a Dot Matrix printer I'm trying to figure out how to get a webpage (Specifically http://sandbox.daveblencowe.com/pos/invoice.html) to print on a Dot Matrix Printer (oki microline 1190). So far I've understood I need to convert the page to ASCII but I'm unsure how to do that and maintain the spacing (It's printing to a 3 part invoice template (DUKSA002)).
Any help would be greatly appreciated.

A: The Microline 1190 has a printwidth of 80 characters, so you need to wrap your page around a maximum width of 80 as well. Also, you need to find out the maximum rows you may add to one page. If you have a preprinted form, to which this needs to be printed, you should add or remove spaces, until it fits your form.


text:
Q: What (exactly) makes managed properties returning values in Display Template? My question is : What (exactly) makes managed properties returning values in Display Template ?
Examples :
I've a field which i can find in search but its mapped property is not searchable and its crawled property not included in full text, how this can be happen ? I would addn this field to Display Template and use the managed property that allow the fact that it is "searchable"
I've a field that i can't find in search but can be queryable with another managed property (not its managed propery) when using this managed propery in Display template it works !
- How can we query for a field using while we are not using its managed property
(I checked this : there are no relation!)
Any help would be appreciated


text:
Q: Laravel: How to solve my custom translation's fallback problem I know we can use {{ __(messages.welcome) }}. I think that it's troblesome to call by file path and word each and every time.
{{ __(sales.orders.id) }}
{{ __(sales.orders.code) }}
{{ __(sales.orders.first_name) }}
{{ __(sales.orders.last_name) }}

And it's too long.
So I invented a method.
use Lang;

class OrderController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        // Language
        $lang = (object)[];

        foreach (Lang::get('common/common') as $key => $value) {
            $lang->$key = $value;
        }

        foreach (Lang::get('sales/order') as $key => $value) {
            $lang->$key = $value;
        }

        $data['lang'] = $lang;

In blade:
{{ $lang->code }}
{{ $lang->first_name }}
{{ $lang->last_name }}

Now I found that this has no fallback function. If a string is translated in English, but not in other language, and I visit that language, error shows
Undefined property: stdClass::$first_name ...

Is there any other way to implement fallback translation?


text:
Q: Glossary deleting empty spaces and concepts appearing in italics Im working in my thesis. When I included the glossary and started using the \gls{} and \Gls{} commands, all the "concepts" in the definition appear without spaces and in italics. For instance, when I used the command \Gls{Learning Rate}, the result was the following:
LearningRate
The Latex document is using the default configuration of the glossary package, so this term should've appeared like:
Learning Rate
The glossary entry is defined as follows
\newglossaryentry{Learning Rate}
{
    name=Learning Rate,
    description={Parámetro que controla \say{la cantidad de cambio} que experimentan las constantes de la red neuronal en función de su error. Valores muy bajos pueden causar que el proceso de optimización se atore en valles de la función de costo, mientras que valores muy altos pueden llevar a la convergencia temprana del modelo empleando constantes sub-óptimas. Cuando se establece un \textit{Initial Learning Rate} se hace referencia a un valor inicial para el \textit{learning rate} que posteriormente será alterado durante el entrenamiento para auxiliar en el proceso de minimización del error \cite{brownlee_2020}}
}

All 9 definitions in my glossary appear like this, but Im unable to pinpoint the exact error. The best guess that I have is that the culprit is a conflict in packages but there isn't any warnings pointing to this being true. Can you help me out? Thanks!


text:
Q: "The application has stopped unexpectedly"- in case of google maps I have this code for displaying map on android device but the following error is displayed in dialog box "The application Maps  (process com.example.maps) has stopped unexpectedly.". Even after following step by step procedure as given on developer.google.com/maps the above given error displays.
package com.example.maps;

import android.os.Bundle;
import android.app.Activity;
//import android.view.Menu;
public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

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

here is the layout.....
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>

and here is the LogCat view.....
04-08 21:53:15.304:         D/AndroidRuntime(11290): Shutting down VM
04-08 21:53:15.304:         W/dalvikvm(11290): threadid=1: thread exiting with uncaught                                                                       exception (group=0x400205a0)
04-08 21:53:15.304:         E/AndroidRuntime(11290): FATAL EXCEPTION: main
04-08 21:53:15.304:         E/AndroidRuntime(11290): java.lang.RuntimeException: Unable to start activity ComponentInfo com.example.maps/com.example.maps.MainActivity}:                                                     android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1830)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1851)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.app.ActivityThread.access$1500(ActivityThread.java:132)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.os.Handler.dispatchMessage(Handler.java:99)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.os.Looper.loop(Looper.java:143)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.app.ActivityThread.main(ActivityThread.java:4277)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at java.lang.reflect.Method.invoke(Method.java:507)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at dalvik.system.NativeStart.main(Native Method)
04-08 21:53:15.304:         E/AndroidRuntime(11290): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at com.android.internal.policy.impl.PhoneWindow.setContentView
(PhoneWindow.java:239)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.app.Activity.setContentView(Activity.java:1742)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at com.example.maps.MainActivity.onCreate(MainActivity.java:12)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1794)
04-08 21:53:15.304:         E/AndroidRuntime(11290):    ... 11 more
04-08 21:53:15.304:         E/AndroidRuntime(11290): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader
dalvik.system.PathClassLoader[/data/app/com.example.maps-1.apk]
04-08 21:53:15.304:         E/AndroidRuntime(11290): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.view.LayoutInflater.createView(LayoutInflater.java:471)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView
(PhoneLayoutInflater.java:66)
04-08 21:53:15.304:         E/AndroidRuntime(11290): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
04-08 21:53:15.304:         E/AndroidRuntime(11290):    ... 19 more
04-08 21:53:17.406:         I/Process(11290): Sending signal. PID: 11290 SIG: 9
04-08 21:53:34.072:         D/AndroidRuntime(11403): Shutting down VM
04-08 21:53:34.072:         W/dalvikvm(11403): threadid=1: thread exiting with uncaught                                                                exception (group=0x400205a0)
04-08 21:53:34.082:         E/AndroidRuntime(11403): FATAL EXCEPTION: main
04-08 21:53:34.082:         E/AndroidRuntime(11403): java.lang.RuntimeException: Unable                               to start activity ComponentInfo   {com.example.maps/com.example.maps.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1830)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1851)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.app.ActivityThread.access$1500(ActivityThread.java:132)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.os.Handler.dispatchMessage(Handler.java:99)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.os.Looper.loop(Looper.java:143)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.app.ActivityThread.main(ActivityThread.java:4277)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at java.lang.reflect.Method.invoke(Method.java:507)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at dalvik.system.NativeStart.main(Native Method)
04-08 21:53:34.082:         E/AndroidRuntime(11403): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at com.android.internal.policy.impl.PhoneWindow.setContentView
(PhoneWindow.java:239)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.app.Activity.setContentView(Activity.java:1742)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at com.example.maps.MainActivity.onCreate(MainActivity.java:12)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1794)
04-08 21:53:34.082:         E/AndroidRuntime(11403):    ... 11 more
04-08 21:53:34.082:         E/AndroidRuntime(11403): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader
dalvik.system.PathClassLoader[/data/app/com.example.maps-2.apk]
04-08 21:53:34.082:         E/AndroidRuntime(11403): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.view.LayoutInflater.createView(LayoutInflater.java:471)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView
(PhoneLayoutInflater.java:66)
04-08 21:53:34.082:         E/AndroidRuntime(11403): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
04-08 21:53:34.082:         E/AndroidRuntime(11403):    ... 19 more

A: You are attempting to use MapFragment in a project running on a device that is Android 2.3 or lower. To use Maps V2 on Android 2.3 and lower, you need to use the fragments backport from the Android Support package and use SupportMapFragment.


text:
Q: AppSettings.*.json files not copied on Publish in ASP.NET CORE 1.1 I am publishing an ASP.NET Core 1.1 project with .csproj file ...
When I publish it the project is compiled and all the files, including the ones in wwwroot are copied, but all appsettings.*.json files are missing.
I am not sure why because I have the following:
<Content Include="**\*.json" />

What am I missing? Here is the complete .csproj file.
<Project>

  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="**\*.cs" />
    <Content Include="**\*.json" />
    <EmbeddedResource Include="**\*.resx" />
  </ItemGroup>

 <ItemGroup>
    <PackageReference Include="System.Runtime" Version="4.3.0" />
    <PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
    <PackageReference Include="Microsoft.NET.Sdk.Web" Version="1.0.0-alpha-20161104-2-112">
      <PrivateAssets>All</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Identity" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Tools" Version="1.1.0-preview4-final" />
    <PackageReference Include="Microsoft.AspNetCore.ResponseCaching" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="1.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Rewrite" Version="1.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild1-final" />
  </ItemGroup>

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

  <Target Name="Prepublish" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' ">
    <Exec Command="npm install" />
    <Exec Command="bower install" />
    <Exec Command="gulp build" />
  </Target>

</Project>

A: I had a similar issue with four json files I was using as translation files for angular-translate. What I did to include them was explicitly mark them as content.
<Content Include="Language\locale-en.json" />
<Content Include="Language\locale-fr.json" />
<Content Include="Language\locale-es.json" />
<Content Include="Language\locale-pt.json" />


text:
Q: Can I connect a SATA II SSD to my mainboard? I have the next mainboard:
Intel Desktop Board DX38BT - Mainboard – ATX - iX38 – LGA775 Socket – UDMA 100, Serial ATA 300 (RAID), eSATA – Gigabit Ethernet – Firewire – High definition audio (8 Channels)
I want to buy a Crucial M225 128GB 2.5" SATA-II SSD. Can I connect this new hard disk to the mainboard or this SATA II interface is not compatible?
Currently I have a:
WD Raptor WD1500 AHFD - Hard disk – 150 Gb intern 3.5" –10000 rpm buffer 16 Mb

A: I have the same disk and it has normal SATA connectors. The only thing is that it has 2.5" casing so you will need adapter to mount it in the PC HDD slot.


text:
Q: The Projection of Two Vectors
Problem:
For vectors $\mathbf{u}$ and $\mathbf{v}$, we have $ \mathbf{p} = \text{proj}_{\mathbf{v}}(\mathbf{u})$. If $\|\mathbf{u}\| = 11$ and $\|\mathbf{p}\| = 6$, find $\mathbf{p}\cdot\mathbf{u}$.

I don't understand how to do this problem because, to me, it seems like there isn't enough information, but I know that there is. I know that any vector and its projection either form the hypotenuse and a leg of a right triangle, or that they are equal. So I can figure out the cosine of the angle between $\mathbf{u}$ and $\mathbf{p}$. But, I don't know how exactly I would do that? Sorry, I'm just really confused. Any advice? Below is what one of my friends told me to do, but I don't get it.
$$ \mathbf{p} = \text{proj}_{\mathbf{v}}(\mathbf{u}) = \| \mathbf{u} \cos(\theta) \| \, \hat{v}$$
or that
$$\begin{align}
\|\mathbf{p}\| &= \|\mathbf{u}\|\cos(\theta) \\
\cos(\theta) &= \frac{\|\mathbf{p}\|}{\|\mathbf{u}\|}
\end{align}$$

A: Remember that the formula for vector projection is $$\mathrm{proj}_{\mathbf{v}}(\mathbf{u}) =\mathbf{p}=\left(\frac{\mathbf{u} \boldsymbol{\cdot} \mathbf{v}}{\| \mathbf{v} \| ^{2}}\right)\mathbf{v}$$
Supposing $\theta$ is the angle between $\mathbf{u}$ and $\mathbf{v}$, this can be written as $$\mathbf{p}=\left(\frac{\Vert \mathbf{u}\Vert \Vert \mathbf{v}\Vert \cos( \theta )}{\| \mathbf{v} \| ^{2}}\right)\mathbf{v}=\left(\frac{\Vert \mathbf{u}\Vert \cos( \theta )}{\| \mathbf{v} \| }\right)\mathbf{v}$$
Therefore $$\Vert \mathbf{p}\Vert =\left(\frac{\Vert \mathbf{u}\Vert \cos( \theta )}{\| \mathbf{v} \| }\right)\Vert \mathbf{v}\Vert =\Vert \mathbf{u}\Vert \cos( \theta )$$
Now, since $\mathbf{v}$ and $\mathrm{proj}_{\mathbf{v}}(\mathbf{u})$ point in the same direction, the angle between $\mathbf{u}$ and $\mathbf{p}$ is also $\theta$, therefore $$\mathbf{u} \boldsymbol{\cdot} \mathbf{p} =\Vert \mathbf{u}\Vert \Vert \mathbf{p}\Vert \cos( \theta ) =\Vert \mathbf{p}\Vert ^{2} .$$

A: Since the length of the projection of $u$ on $v$ is $6,$ and the length of $u$ is $11,$ then if the angle between $u$ and its protection $p$ on $v$ is $\phi,$ then we must have $$6=11\cos\phi.$$
Now since $p\cdot u=|p||u|\cos\phi, $ and we know $|p|=6,\,|u|=11$ and $\cos\phi=6/11,$ can you now finish it off?


text:
Q: "Redirect" HttpRequest on MVC to another server I could sucefully redirect WebAPI request to another server, can someone help me to do the same with MVC?
Its not really a redirect, its a new request to the other server
I would like to do same with MVC Controllers, but I have no idea on how to procced.
public class RedirecionarServidorPrincipalHandler : DelegatingHandler
{

    protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
    {
        if (myCondition)
        {
            var path = request.RequestUri.AbsolutePath;
            if (path.Contains("blabla"))
            {
                string url = request.RequestUri.OriginalString.Replace(request.RequestUri.Host, theOtherHost);

                var requisicao = new HttpRequestMessage(request.Method, new Uri(url))
                {
                    Version = request.Version,

                };

                if (request.Method.Method != "GET")
                    requisicao.Content = request.Content;

                foreach (var header in request.Headers)
                    requisicao.Headers.Add(header.Key, header.Value);

                foreach (var propertie in request.Properties)
                    requisicao.Properties.Add(propertie);

                using (var client = new HttpClient())
                {
                    var ret = await client.SendAsync(requisicao, cancellationToken);
                    var novoRetorno = new HttpResponseMessage(ret.StatusCode)
                    {
                        Content = ret.Content,
                        ReasonPhrase = ret.ReasonPhrase,
                        Version = ret.Version,
                        RequestMessage = request
                    };
                    foreach (var header in ret.Headers)
                        novoRetorno.Headers.Add(header.Key, header.Value);

                    return novoRetorno;
                }
            }
        }
        return await base.SendAsync(request, cancellationToken);
    }
}

A: Well, since I couldn't find a way to do that and wasn't a real need for the MVC controllers, I've changed them to WebApi controller, were just 2 and small ones, that solved my problem, but if anyone knows a way, post here to future visists.


text:
Q: How to add elements to a list only if not already in list (from multiple datasets) I am working with multiple data sets of gene expression data (one data set per patient). I am trying to make a matrix that has all of the genes as each column, with expression data for each patient under the gene.
The problem is that some of the datasets have genes missing or not listed, so I do not necessarily have a reference for all of the genes.
So I am essentially trying to write a code that would record all of the genes in a dataset, and then only add additional genes to that list if it is not already present.
See example below:
I would like to make a list of unique genes from the two data sets:
Dataset 1                   Dataset 2
Gene     expression         Gene     expression
a        0.3                a        0.1
b        0.1                c        -0.3
e        0.2                d        0.05
f        0.2                f        -0.1

Ideal Output:
Genes = (a,b,c,d,e,f)

Instead I have been getting this output
Genes = (a,a,b,b,c,c,d,d,e,e,f,f,)

When I attempt the code below, however, I get this warning message.
In if (!(copynumber_df$gene %in% genes)) { ... : the condition has length > 1 and only the first element will be used
Also, for some reason the output has every gene listed twice (so I end up with double from what I expected).
Why is each gene being added twice to the list?
copynumber_files <- list.files(data_dir) ###only 10 datasets/patients listed here

genes <- c()

for (copynumber_file in copynumber_files){
  copynumber_df <- read.csv(copynumber_file, sep="\t")
  for (i in 1:nrow(copynumber_df)){
    if (copynumber_df$gene %in% genes == FALSE){
      genes <- append(genes, copynumber_df$gene)
    }
    else {}
    }

}


text:
Q: Refreshing a textbox on screen I have a process that runs a series of tasks and with each tasks updates a text box, my issue is however that the screen doesnt load until all the tasks are done, and I need to see them as they happen. In my old language of VBA this would have been DoEvents or Me.Repaint. What am I doing wrong causing my text box to not show what is sent to it each time something is sent to it?
This is in ASP.net and C#. This is the aspx page:-
<%@ Page Title="ASC Open" Language="C#" AutoEventWireup="true" CodeBehind="ASC_OSC.aspx.cs" Inherits="HICS.ASC_OSC" %>

    <title>HICS</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <asp:PlaceHolder runat="server">
        <%: Scripts.Render("~/bundles/modernizr") %>
    </asp:PlaceHolder>
    <webopt:BundleReference runat="server" Path="~/Content/css" />

    <form id="main" runat="server">

Open Access Supply Chain

                    <asp:TextBox ID="TxtStatus" runat="server" Height="80%" Width="80%" ReadOnly="true" Wrap="true" AutoPostBack="false" TextMode="MultiLine"></asp:TextBox>

    </form>

And this is the snippet of C# (not all showing as it is representative), it is TxtStatus that I care about right now.
using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Web;
using System.Web.UI;
//using System.Web.UI.WebControls;
//using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace HICS
{
    public partial class ASC_OSC : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlDataReader RS;
            int     IntPort;
            int     IntEnvironment;
            bool    BlnOK;
            string StrEnvironmentName;
            string StrEnvironmentDB;
            Database DB_ASC = new Database();

            if (!IsPostBack)
            {
                BlnOK = true;
                TxtStatus.Text += "Getting Port: ";
                string StrReturn = home.Procs.UserSetting("ASC_Port");
                if (StrReturn == "" || StrReturn == "0")
                {
                    RS = home.DB_HICS.GetRS("SELECT MAX([ASC_Port]) FROM [Tb_Users]");
                    RS.Read();
                    IntPort = (RS.GetInt32(0) < 4444)? 4444 : RS.GetInt32(0) + 1;
                    home.Procs.UserSetting("ASC_Port", IntPort.ToString());
                    RS.Close();
                }
                else
                {
                    IntPort = Convert.ToInt32(StrReturn);
                }
                TxtStatus.Text += String.Concat(IntPort.ToString() , Environment.NewLine);

                TxtStatus.Text += "Getting Environment: ";
                IntEnvironment = 0;
                StrReturn = home.Procs.UserSetting("ASC_Environment");
                if (StrReturn == "" || StrReturn == "0")
                {
                    RS = home.DB_HICS.GetRS("SELECT MIN([ID]) FROM [Tb_ASC_Environments]");
                    RS.Read();
                    if (RS.IsDBNull(0))
                    {
                       BlnOK = false;
                    }
                    else
                    {
                        IntEnvironment = RS.GetInt32(0);
                        home.Procs.UserSetting("ASC_Environment", IntEnvironment.ToString());
                    }
                    RS.Close();
                }
                else
                {
                    IntEnvironment = Convert.ToInt32(StrReturn);
                    RS = home.DB_HICS.GetRS("SELECT COUNT([ID]) FROM [Tb_ASC_Environments] WHERE [ID] = " + IntEnvironment);
                    RS.Read();
                    if (RS.GetInt32(0)==0)
                    {
                        RS.Close();
                        RS = home.DB_HICS.GetRS("SELECT MIN([ID]) FROM [Tb_ASC_Environments]");
                        RS.Read();
                        if (RS.IsDBNull(0))
                        {
                            BlnOK = false;
                        }
                        else
                        {
                            IntEnvironment = RS.GetInt32(0);
                            home.Procs.UserSetting("ASC_Environment", IntEnvironment.ToString());
                        }
                    }
                    RS.Close();
                }
                TxtStatus.Text += String.Concat((BlnOK)?IntEnvironment.ToString():"Error", Environment.NewLine);

                if (BlnOK)
                {
                    RS = home.DB_HICS.GetRS("SELECT [Name],[Database] FROM [Tb_ASC_Environments] WHERE [ID] = " + IntEnvironment);
                    RS.Read();
                    StrEnvironmentName = RS.GetString(0);
                    StrEnvironmentDB = RS.GetString(1);
                    TxtStatus.Text += String.Concat("Environment Name: ", StrEnvironmentName, Environment.NewLine);
                    TxtStatus.Text += String.Concat("Environment Database: ", StrEnvironmentDB, Environment.NewLine);
                    TxtStatus.Text += "Connecting to ASC Database: ";

                }
            }
        }
    }
}

A: You need to understand that a web page is fundamentally different from a desktop client application where you can DoEvents and Repaint whenever you need. ASP.NET is executed server side and thus performs a full round trip between submitting a page and processing events on the server.
If you start a long running task and want to get progress information, you need to use AJAX.
See Introduction to the UpdateProgress Control for a older concept
or
track the progress of a database save in a "live" progress bar asp.net mvc for a modern approach
... you'll have to make a choice for your specific scenario.


text: Q: How to make an image act as hyperlink in pdf using pdfbox I want to add a "move up" image, clicking on which should take me to the first page of the pdf. I want to do this on click of an image and not on text or rectangle. Please help me with this.


text:
Q: Conditionally formating colors of tile plot in ggplot2 I have the following chart generated using ggplot2. I would like to find out how to conditionally format the color of each tile according to the following color hex codes and Value specifications
#0a5d00 if Value > 2
#0eff00 if Value > 1 and < 2
#ece75f if Value > 0 and < 1
#e6cc00 if Value > -1 and < 0
#ff0000 if Value > -2 and < -1
#7b0000 if Value < -2

data <- structure(list(Date = structure(c(18993, 19024, 19052, 19083,
19113, 19144, 19174, 19205, 19236, 19266), class = "Date"), Value = c(-3,
-2, -1.5, -1, -0.5, 0, 0.5, 1, 2, 3)), class = c("tbl_df", "tbl",
"data.frame"), row.names = c(NA, -10L))

library(tidyverse)

data %>%
  ggplot(aes(Date, Value, fill = Value)) +
  geom_tile()

A: Update adding scale_identity() thanks to @Tanga94:
library(tidyverse)

data %>%
  mutate(my_color = case_when(
     Value > 2 ~ "#0a5d00",
     Value > 1 & Value < 2 ~ "#0eff00",
     Value > 0 & Value< 1 ~ "#ece75f",
     Value > -1 & Value < 0 ~ "#e6cc00",
     Value > -2 & Value< -1 ~ "#ff0000",
     Value < -2 ~ "#7b0000",
     TRUE ~ NA_character_
  )) %>%
  ggplot(aes(Date, Value, fill = my_color)) +
  geom_tile() +
  scale_fill_identity()


text:
Q: Proof that $\sqrt{x}=-\sqrt{x}$ $\sqrt{x}=\sqrt{1\cdot x}=\sqrt{(-1)^2\cdot x} = \sqrt{(-1)^2} \cdot \sqrt{x} = (-1) \cdot \sqrt{x}=-\sqrt{x}$
The idea popped into my head while I was evaluating an integral. I have a feeling that I made some obvious mistake because the "proof" is so simple, but I don't see any flaw. Of course, there must be a flaw somewhere. What is it?

A: Most fake proofs involving square roots rest, at some point, on the false identity
$$\sqrt{a^2} = a$$
This identity seems natural and true, which is why it fools us.  The correct identity is
$$\sqrt{a^2} = |a|$$

A: $$\sqrt{(-1)^2} = \sqrt{(-1)(-1)} = \sqrt 1 = 1 \neq -1$$
Perhaps you are making the mistake of thinking $(\sqrt{(-1)^2} = (-1)^{2/2} = (-1)^{1} = -1$, but this too is mistaken because $(-1)^{1/2}$ does not exist in the real numbers, so $\Big((-1)^{1/2}\Big)^2$ does not exist, whereas $\Big((-1)^{2}\Big)^{1/2} = 1$ does indeed exist.

A: $\sqrt{(-1)^2 \cdot x}=\sqrt{(-1)^2}\cdot \sqrt{x}$and $\sqrt{(-1)^2}=-1$ are wrong.


text:
Q: Degree of curves is stable in parametrized families Let X , Y be projective varieties, and $C$ be a projective smooth curve. Suppose $f : C \times Y \to X$ is a morphism such that $\forall~ y \in Y$, $ f(-,y): C \to X$ does not contract $C$ to a point. Fix a very ample divisor $H$ in $X$, why $\forall~ y \in Y$, the intersection number $C \cdot f(-,y)^*H$ is a constant?

A: Since $f(-,y)^*H$ is just a divisor on $C$, I guess by $C \cdot f(-,y)^*H$ you just mean the degree of this divisor.
This is the same as the intersection number $(C \times y) \cdot f^*H,$ and so the question is why is this intersection number constant?  Well, it is an integer valued function that depends continuously on the parameter $y$, and so it must be constant (assuming that $Y$ is connected; if $Y$ were disconnected, then it wouldn't need to be constant).
A more formal way of phrasing this is to note that all the curves $C \times y$ on the variety $C \times Y$ are algebraically equivalent, and intersection number is invariant under algebraic equivalence of cycles.


text:
Q: How to get value from listbox in WordPress TinyMCE I have searched on forum and google but can't find solution. I want to get the value in the listbox but it always return text value (Yes/No instead of True/False). This is my code:
onclick: function () {
    ed.windowManager.open({
        title: 'A Grid based list of most recent blog posts.',
        body: [
            {
                type: 'listbox',
                name: 'posttileBox',
                label: 'Display post title',
                'values': [
                    {text: 'Yes', value: 'true'},
                    {text: 'No', value: 'false'}
                ]
            }
        ],
        onsubmit: function( e ){
            ed.insertContent( '[recentblog title="' + e.data.posttileBox + '"]');
        }
    });
}

Thanks for any help.
Regards, Hung The.

A: try getting the selected value via posttileBox.value()
like this:
onclick: function () {
     var posttileBox = null;
     ed.windowManager.open({
        title: 'A Grid based list of most recent blog posts.',
        body: [
            {
                type: 'listbox',
                name: 'posttileBox',
                label: 'Display post title',
                'values': [
                    {text: 'Yes', value: 'true'},
                    {text: 'No', value: 'false'}
                ],
                onPostRender: function( ){
                    posttileBox = this;
                }
            }
        ],
        onsubmit: function( e ){
            ed.insertContent( '[recentblog title="' + posttileBox.value() + '"]');
        }
    });
}

tinymce.ui.ListBox


text:
Q: Unable to read csv with line breaks and blank lines I have an excel with multiline values with blank lines and line breaks in it...
I can read the multilines without blank lines/line breaks between them, but unable to read read blank lines/line breaks
Appreciate any inputs.
Sample Input below:
"Testing performed
in
an excel file"
Desired output: Testing performed\n\n\nin\n\nan excel file
code:
using (TextFieldParser parser = new TextFieldParser(csv_file_path))
{
    parser.TextFieldType = FieldType.Delimited;
    parser.SetDelimiters(";");
    int headerrow = 0;
    while (!parser.EndOfData)
    {
        //Processing row
        string[] fields = parser.ReadFields();
        if (headerrow == 0)
        {
            foreach (string field in fields)
            {
                csvData.Columns.Add(field);
                //TODO: any logic
            }
            headerrow = 1;
        }
        else
        {
            csvData.Rows.Add(fields);
        }

    }
}

A: You need to Try/Catch malformed line exceptions


text:
Q: User comments count I found this code on the web. That was very useful but I need to display the User Comments Count near the Users' name.
What can I do?
$allUsers = get_users('orderby=comment_count&order=DESC');

$users = array();

// Remove subscribers from the list as they won't write any articles
foreach($allUsers as $currentUser)
{
    if(!in_array( 'administrator', $currentUser->roles ))
    {
    $users[] = $currentUser;
}
}

foreach($users as $user)
            {
<a href="<?php echo get_author_posts_url( $user->ID ); ?>"><?php echo $user->display_name; ?>

<?php echo get_avatar( $user->user_email, '128' ); ?>
}


text:
Q: Compute the integral $\int_0^{\pi/2}\sin(1+\cos^2x)\mathrm{d}x $ My attempt.
$$\int\limits_0^{\pi/2}\sin(1+\cos^2x)\mathrm{d}x $$
Let $t=1+\cos^2x \Rightarrow \mathrm{d}t -2\sin x\cos x~ \mathrm{d}x. $
We have $\cos^2x=t-1 \Rightarrow \cos x=\sqrt{t-1}$ and $\sin x = \sqrt{2-t}.$ So $$\mathrm{d}x = \frac{-\mathrm{d}t}{2\sqrt{2-t}\sqrt{t-1}}$$
Now,
$$\frac{1}{2}\int\limits_1^2\frac{\sin t}{\sqrt{2-t}\sqrt{t-1}}\mathrm{d}t$$
I tried substituting by parts letting $u=\sin t$, and $dv = \int \mathrm{d}t/(\sqrt{(2-t)(t-1)})$.
But the integral just gets more complicated.

A: $$
I=\Im\int_{0}^{\pi/2}e^{i(1+\cos^2(x))}=\Im \left(e^{i\frac 32}\int_{0}^{\pi/2}e^{\frac i2\cos(2x)}\right)=\frac{1}{4}\Im\left( e^{i\frac 32}\int_{-\pi}^{\pi}e^{\frac i2\cos(x)}\right)\underbrace{=}_{(\star)}\frac{\pi}{2}J_0\left(\frac{1}{2}\right)\Im (e^{i\frac 32})=\frac{\pi}{2}J_0\left(\frac{1}{2}\right)\sin\left(\frac{3}{2}\right)
$$
where $J_0(z)$ is a Bessel function of the first type and equation $(\star)$ frollows from here

A: Use the integral representations of the Bessel function of the first kind at $0$,
$$\int_{0}^{\pi/2}\cos\left(z\cos \theta\right)\,\mathrm{d}\theta=\frac{\pi}{2}J_0\left(z\right).$$
So,
$$\begin{align*}
\int_0^{\frac{\pi}{2}}\sin\left(1+\cos^2x\right)\mathrm{d}x&=\int_0^{\frac{\pi}{2}}\sin\left(\frac{1}{2}\cos\left(2x\right)+\frac{3}{2}\right)\mathrm{d}x\\
&=\sin\left(\frac{3}{2}\right)\int_{0}^{\frac{\pi}{2}}\cos\left(\frac{1}{2}\cos\left(2x\right)\right)\mathrm{d}x+\cos\left(\frac{3}{2}\right)\underset{0}{\underbrace{\int^{\frac{\pi}{2}}_{0}\sin\left(\frac{1}{2}\cos\left(2x\right)\right)\mathrm{d}x}}\\
&=\frac{\pi}{2}\sin\left(\frac{3}{2}\right)J_0\left(\frac{1}{2}\right)
\end{align*}$$

A: I took an approach (below) but then dropped the idea to continue since the other answers were so neat and beautiful to follow and mine was a lot of work, which I shall complete at a later point of time (I hope at least). I hence write what I have so far below
\begin{align}
\int_0^{\pi/2}\cos^{2n}(2x)dx&=\int_0^{\pi/2}\cos^{2n}(x)dx\\
&=\frac12\text{Beta}(\frac12,n+\frac12)
\end{align}
hence \begin{align}
\int_0^{\pi/2}\sin(1+\cos^2x)\mathrm{d}x &=\int_0^{\pi/2}\sum_{m=0}^{\infty}\frac{(-1)^m(1+\cos^2x)^{2m+1}}{(2m+1)!}\mathrm{d}x\\
&=\sum_{m=0}^{\infty}\frac{(-1)^m}{(2m+1)!}\int_0^{\pi/2}(1+\cos^2x)^{2m+1}\\
&=\sum_{m=0}^{\infty}\frac{(-1)^m}{(2m+1)!}\int_0^{\pi/2} \sum_{j=0}^{2m+1}{2k+1\choose j} \cos^{2j}(x) \mathrm{d}x\\
&=\sum_{m=0}^{\infty}\frac{(-1)^k}{(2m+1)!}\sum_{j=0}^{2m+1}{2m+1\choose j}\int_0^{\pi/2}  \cos^{2j}(x) \mathrm{d}x\\
&=\sum_{m=0}^{\infty}\frac{(-1)^k}{(2m+1)!}\sum_{j=0}^{2m+1}{2m+1\choose j}\frac12\text{Beta}(\frac12,j+\frac12)\\
&=\sum_{m=0}^{\infty}\frac{(-1)^k}{(2m+1)!}\sum_{j=0}^{2m+1}{2m+1\choose j}\frac12\pi\frac{(2j-1)!!}{2^jj!}\\
&=\frac12\pi\sum_{m=0}^{\infty}\sum_{j=0}^{2m+1}\frac{(-1)^k}{(2m+1-j)!}\frac{(2j-1)!!}{2^jj!^2}\\
\end{align}


text:
Q: Handle Multi Data Like Array in Form How Can I Send Form Data like Array
look at the below code , I Can't set Index in product_attribute['index must be here']['key']

    <input type="text" name="product_attribute['index must be here']['key']" value="" placeholder="attribute" class="form-control" autocomplete="off">

        <textarea name="product_attribute['index must be here']['value']" rows="5" cols="70" placeholder="text" class="form-control"></textarea>

A: You could bind it using v-bind:name or shortly :name as follows :
<input type="text" :name="product_attribute[index]['key']"  ...

and
  <textarea :name="product_attribute[index]['value']"


text:
Q: AWS - files from were deleted by the system I have a AWS accound and I have installed ES there under /dev/elk folder ..
It was fine for a long period of time but few days ago somehow the files were deleted.

A: I assume you mean that you have an EC2 and installed elasticsearch onto it.
What is the type of the root partition of your EC2?  Is it EBS or is it AWS Instance Store?  If it's Instance Store, then it is ephemeral and can go away at any time.
See here and here for a description of the differences between EBS and Instance Store.
Without more information about how you launched the ec2, how you provisioned it etc it is difficult to provide a more in-depth answer.


text:
Q: How to set reminder for facebook friends birthday in phonegap(android) The last task of my phonegap(android) project is to set the reminder for the birthdays of facebook friends list. i'm able to fetch facebook friends birthday list but stuck up with setting the reminder for upcoming birthday. searched alot in google but could not get any relevant solutions, please help me if anybody had done with this

A: For PhoneGap Android, you can use Notification API.
Reference


text:
Q: In what context is the plural of genius, "genii" acceptable to use in a sentence? How exactly can one acceptably use genii in a sentence? Can it be used in everyday language, or does it have a very specific ruleset about how and where it may be used?

A: The normal plural is "geniuses"; "genii" is not used in everyday language.
The word "genius" does come from Latin, but it's gone through a long journey to get to English and its meaning has shifted quite a bit along the way. So it is pluralized according to the normal English pattern.
The issue is complicated a bit by the fact that the Latin word, with the Latinate plural "genii", does continue to be used in English for some specialist meanings.
The Oxford Dictionaries online mark the plural "genii" as being used for the following senses of the word:

a guardian spirit associated with a person, place, or institution.

as well as

The prevalent character or spirit of something such as a nation or
  age:
  'Boucher's paintings did not suit the austere genius of neoclassicism'

However, they indicate the usual "geniuses" for the now rather rare and archaic meaning

A person regarded as exerting a powerful influence over another for
  good or evil:
  'he sees Adams as the man's evil genius'
  'this young man is my good genius, my guardian angel'

One last note: even when the English word is being used in one of its more common senses, "genii" might also be used as a joking plural, since using fancy Latinate plurals for ordinary words can sound funny to English speakers. I wouldn't consider that kind of joke "everyday language," though.

A: "Genii" has unfortunate collisions with the plural of "genie" (itself a  form of the Arabic jinn, an evil spirit) and of the Roman genius, a guardian spirit. Stick with "geniuses."

A: Yes, you use genii instead of geniuses when you don't want to be easily understood.

A: Both - Genii & Geniuses should be acceptable.
Geniuses is longer, Genii is frugal, follows logicaly, is easy to understand.
Genii does not clash with the plural of genie, which would be genies.
When spoken, geniuses can be retained, avoiding the cringeworthy
  factor associated with saying genii.


text:
Q: How to use relay connection in GraphQL Schema for mutation I am trying to use graphql-relay connectionDefinitions in GraphQL schema so as to add Edges & Nodes in my mutation calls.
My project context: I have custom field object that I need to update and show with below mutation call
    const CustomFieldDefinition = new GraphQLInputObjectType({
                name: 'CustomFieldDefinitions',
                fields: {
                    schem: {
                        type: GraphQLString
                    },
                    deleted: {
                        type: GraphQLBoolean
                    },
                    associatedEntityTypes: {
                        type: GraphQLString
                    },
                    name: {
                        type: GraphQLString
                    },
                    id: {
                        type: GraphQLID
                    }
                }
            })

    const { connectionType: Common_CustomFieldDefinitionConnection } =
            connectionDefinitions({
                   name: 'Common_CustomFieldDefinitionEdge',
                   nodeType: CustomFieldDefinition
        });

    const createCommon_CustomFieldDefinition = mutationWithClientMutationId({
        name: 'CreateCommon_CustomFieldDefinition',
        inputFields: {
            customFieldDefinition: {type: Common_CustomFieldDefinitionConnection},
            clientMutationId: {type: GraphQLString}
        },
        outputFields: {
            customFieldDefinition: {
                type: CustomFieldDefinition,
                resolve: (obj) => {
                    return (obj.customFieldDefinitions[obj.customFieldDefinitions.length-1])
                }
            }
        },
        mutateAndGetPayload: (params) => {
            return Promise.resolve(
                updateCustomField(params)   // Think of it as a method which update all custom fields.
            );
        }
    });

    const Mutation = new GraphQLObjectType({
            name: 'Mutation',
            fields: {
                createCommon_CustomFieldDefinition: createCommon_CustomFieldDefinition
            }
        });

    const mySchema = new GraphQLSchema({
        mutation: Mutation
    });

    module.exports = mySchema;

This is the Mutation call that I am trying to make work
mutation {
  createCommon_CustomFieldDefinition(input:{
    clientMutationId: "1442",
    commonCustomFieldDefinition: {
         name: "Vamsi_date",
         schem: "Anything",
         associatedEntityTypes :"CUSTOMER"
    }
 }) {
    clientMutationId
    commonCustomFieldDefinitionEdge{
      node{
        name
        id
        schem
       }
    }
  }
}

The problem that I am facing here is that whenever I start my server I get error as
Error: CustomFieldDefinition.customFieldDefinitions field type must be Input Type but got: Common_CustomFieldDefinitionEdgeConnection.

How can I resolve this? I think I am doing something wrong in below code.
const { connectionType: Common_CustomFieldDefinitionConnection } =
            connectionDefinitions({
                   name: 'Common_CustomFieldDefinitionEdge',
                   nodeType: CustomFieldDefinition
        });


text:
Q: how to extract data under a tag from website using bs4

  <title>Index of /pub/opera/desktop/</title>

Index of /pub/opera/desktop/

../
15.0.1147.130/                                     01-Jul-2013 15:18                   -
15.0.1147.132/                                     01-Jul-2013 15:18                   -
15.0.1147.138/                                     09-Jul-2013 12:11

I need to extract version which is 15.0.1147.130 and date which is 01-Jul-2013 15:18
However, using my code, it only gives me version
soup = BeautifulSoup(requests.get('https://get.geo.opera.com/pub/opera/desktop/').text, 'html.parser')
for item in soup.find('pre').find_all('a')[1:]:
    print(item)

what am I missing to get the date text too?

A: You get "A" tags, they dont contains Date
    soup = BeautifulSoup(requests.get('https://get.geo.opera.com/pub/opera/desktop/').text, 'html.parser')
    for item in soup.find_all('pre'):
    version = item
    print(version.getText().replace('/', "").replace('-', ""))

UPDADE
import requests
from bs4 import BeautifulSoup
import re

soup = BeautifulSoup(requests.get('https://get.geo.opera.com/pub/opera/desktop/').text, 'html.parser')
lines = soup.find('pre').getText().replace('/', "").replace('-', "").split('\r')

for line in lines[1:-1]:
    my_data = re.sub(' +', ' ', line).split(' ')
    geo = my_data[0]
    date = my_data[1]
    time = my_data[2]
    print(geo, date, time)


text:
Q: I got exception in camera2basic when using emulator I got the following exception
12-11 16:58:35.719 2514-2514/com.example.android.camera2basic E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.camera2basic, PID: 2514
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.camera2.CaptureRequest$Builder.set(android.hardware.camera2.CaptureRequest$Key, java.lang.Object)' on a null object reference
  at com.example.android.camera2basic.Camera2BasicFragment.lockFocus(Camera2BasicFragment.java:764)
  at com.example.android.camera2basic.Camera2BasicFragment.takePicture(Camera2BasicFragment.java:755)
  at com.example.android.camera2basic.Camera2BasicFragment.onClick(Camera2BasicFragment.java:864)
  at android.view.View.performClick(View.java:5198)
  at android.view.View$PerformClick.run(View.java:21147)
  at android.os.Handler.handleCallback(Handler.java:739)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:148)
  at android.app.ActivityThread.main(ActivityThread.java:5417)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

The code was working when I used the emulated camera but it is not working when I tried Webcam0


text:
Q: Atiyah-Bott fixed point formula; signs In classical paper by Atiyah-Singer on page 16 (or 560) stated formula $(3.1)$. It should give classical Lefschetz fixed-point formula if the operator is $d + d^* : \Omega^{even} \rightarrow \Omega^{odd}$. But classical Lefschetz formula involves some signs. I wonder how that signs appear from formula $(3.1)$.
By the way, I am not sure, shall I call formula $(3.1)$ as Atyah-Bott formula.

A: Let $g$ be an element of compact Lie group, acting on our manifold. $ dg_x $ is the differential of g at fixed point $x$. Sign of point $x$ is sign of $ \det (1 - dg)$ . Note that if this determinant is equal to 0 then intersection of graph with diagonal is not transversal and we are not allowed to use fixed point theorem.
If $g$ is an element of compact group then it preserves a positive definite metric (which can be obtained by averaging over group). Finally it is linear algebra exercise to show that $ \det (1 - dg) > 0$ for isometry $g$ without eigenvalues 1 (there is no 1 eigenvalues on fiber of normal bundle to fixed locus).
$$det \begin{pmatrix} 1 - cos{ \theta } &  - sin ( \theta )\\ sin \theta & 1 - cos  \theta  \end{pmatrix} = 2(1 - cos( \theta ))$$
$$det(1 - (-1)) = 2$$
So if $g$ is an element of compact group then we are in special case: each point has sign $+1$.


text:
Q: Passing value in method(java) as an argument I have created an Enum

public enum Fruit {
mango , banana , apple , guava;

}

I have a function in which I want to pass enum as an argument and use that parameter.
The function is like this

getFruits(Fruit.apple)  // calling function

public void getFruit( **What to write here to use that Fruit enum**) {
double sweetValue = sweetValueOfFruit( **how can i pass Fruit.apple here**)
}

Assume sweetValue function is defined somewhere.
Please help me in writing code for it (for all in between ** **).
Thanks, community :)

A: Fruit is enum so use create object of it same way as you do with class
public void getFruits( Fruit aFruit) {
    double sweetValue = sweetValueOfFruit( aFruit);
}

it recommended for naming convention to make all enum to be capital letter
so it be like that
public enum Fruit {
    MANGO , BANANA , APPLE , GUAVA;
}


text:
Q: Unable to init server: Could not connect: Connection refused. YOLO on Google Colab I'm trying to test out YOLO on google colab for the first time and keep running into this odd error:

This is the line of code that I run:
!./darknet detector test data/obj.data cfg/yolov3_custom.cfg /mydrive/yolov3/backup/yolov3_custom_last.weights /mydrive/images/I5.png -thresh 0.3

A: I also faced the same, but resolved by updating "config file".
There might be some unbalanced "[" or "#" characters.
Solution 1: Update your config file as in this format  https://github.com/pjreddie/darknet/blob/master/cfg/yolov3.cfg
Solution 2: For some, using -dont_show flag in detection command has worked.
eg: !./darknet detector test data/obj.data   cfg/yolov3_V1_config.cfg   /mydrive/yolov3_V1_config_last.weights /mydrive/yolov3/Poachers/pic2.jpg -thresh 0.3 -dont_show

A: In yolov3_custom.cfg file, uncomment the two lines under # Testing
# Testing
batch=1
subdivisions=1

A: -dont_show was the solution for me

A: Not sure what the error is because I am getting the same. If you write the following after the line of code you will be able to see the image:
imshow('predictions.jpg')


text:
Q: Returning host IP address into docker contain inside systemd configuration file Am working systemd configuration file, which needs a parameter of current docker host server. I tried following and it worked fine for me when i run directly
docker run -p 5555:5555 -e REMOTE_HOST="http://`/bin/hostname --ip-address`:5555" -e HUB_PORT_4444_TCP_ADDR=selhub.stage.internal -e HUB_PORT_4444_TCP_PORT=4444 --name=stage_selff stage_selff

But when I tried to add this into systemctl file,
[Unit]
Description=Selenium node container
Requires=docker.service
After=docker.service

[Service]
Restart=on-failure
RestartSec=10
ExecStartPre=-/usr/bin/docker kill stage_selff
ExecStartPre=-/usr/bin/docker rm stage_selff
ExecStart=/usr/bin/docker run -p 5555:5555 -e REMOTE_HOST="http://`/bin/hostname --ip-address`:5555" -e HUB_PORT_4444_TCP_ADDR=selhub.stage.internal -e HUB_PORT_4444_TCP_PORT=4444 --name=stage_selff stage_selff
ExecStop=-/usr/bin/docker stop stage_selff

[Install]
WantedBy=multi-user.target

Its not working, I cannot find clear logs why, but am guessing the ` operator is not accepted by systemctl
Here is what the systemctl logs says
Sep 15 01:27:06 docker[831]: 21:27:06.337 INFO - Launching a Selenium Grid node
Sep 15 01:29:06 docker[831]: 21:29:06.668 WARN - error getting the parameters from the hub. The node may end up with wrong timeouts.Connect
Sep 15 01:29:06 docker[831]: 21:29:06.675 INFO - Java: Oracle Corporation 25.45-b02
Sep 15 01:29:06 docker[831]: 21:29:06.678 INFO - OS: Linux 3.16.0-4-amd64 amd64
Sep 15 01:29:06 docker[831]: 21:29:06.690 INFO - v2.47.1, with Core v2.47.1. Built from revision 411b314
Sep 15 01:29:06 docker[831]: 21:29:06.735 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:

A: That construction wouldn't work, as ExecStart and it's siblings(like ExecStartPre, ExecStop, etc) don't use shell for operation, but rather execve(3) system call. That means that shell constructions like $(command), >, >>, < and others have no effect.
See Command lines for details.
You may try to employ Environment and EnvironmetFile options to pass values from outside of the unit file.