text:
Q: Geochart - mark one country with a special color There is a standard example of Google Geochart, countries have a scale color depends on value. My question is how to mark one country, for example Canada, with an red one, but leave another countries like before. It is ok if Canada will be without value, just how to mark it in another color?
https://jsfiddle.net/8wowo9xc/
 google.setOnLoadCallback(drawRegionsMap);

  function drawRegionsMap() {

    var data = google.visualization.arrayToDataTable([
      ['Country', 'Popularity'],
      ['Germany', 200],
      ['United States', 300],
      ['Brazil', 400],
      ['Canada', 500],
      ['France', 600],
      ['RU', 700]
    ]);

    var options = {};

    var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));

    chart.draw(data, options);
  }

The desire result:

A: If you specify the defaultColor and give Canada no value, this will do exactly what you want.
So something like:
  google.setOnLoadCallback(drawRegionsMap);

  function drawRegionsMap() {

    var data = google.visualization.arrayToDataTable([
      ['Country', 'Popularity'],
      ['Germany', 200],
      ['United States', 300],
      ['Brazil', 400],
      ['Canada', null],
      ['France', 600],
      ['RU', 700]
    ]);

      var options = {defaultColor: 'red'};

    var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));

    chart.draw(data, options);
  }

A: try   :
var data = google.visualization.arrayToDataTable([
  ['Country', 'Popularity'],
  ['Canada', 500]
]);

for other country or other color simply try this:
function drawRegionsMap() {

  var data = google.visualization.arrayToDataTable([
      ['Country', 'Popularity'],
      ['Ireland', 200],

  ]);

  var options = {
    //region: 'IT',
    //displayMode: 'markers',
    colorAxis: {colors: ['red']}
  };

Or for your last request try:
google.setOnLoadCallback(drawRegionsMap);

function drawRegionsMap() {

  var data = google.visualization.arrayToDataTable([
      ['Country', 'Popularity'],
      ['Canada', 100],
      ['US', 1000],
      ['Russia',500]

  ]);

  var options = {
    //region: 'IT',
    //displayMode: 'markers',
    colorAxis: {colors: ['red', 'green', 'lightgreen']}
  };

  var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));

  chart.draw(data, options);
}

Final consideration:
To use the polygons should already have polygons of various states with coordinates. and however it comes to writing a little program in JavaScript. If all you need is a data presentation with a state highlight (red) and the other with two colors (a darker green an a   lighter green) you better take advantage of the numerical value as I did in the example.  Create the list of states that interest you and state that you weaves mo put in evidence with the lowest value so that it is red, and intermediate value by displaying an intermediate color and so on.
The way forward is very dependent on your experience as a programmer.


text:
Q: Severe (in my eyes at least) issue with positioning (turtle module) I made a simple game, where the user needs to get back to the same position in a specified number of moves. However, the code to do with the positioning that recognises whether the user has returned to the initial position does not seem to work.
This is the code that specifies the starting positioning of the turtle just in case:
my_turtle.setposition(0.00, 0.00)

Here is that code (only the part that deals with the positioning):
if my_turtle.position() == (0.00, 0.00) and tries == score:
    print("Well done")
        break
elif my_turtle.position() == (0.00, 0.00) and (tries > score or score > tries):
    print("Return to original position in exactly moves")

A: The reason might be because it is very difficult to get the turtle to go to point (0,0) exactly, so it might be better to set boundaries instead:
if 10>my_turtle.xcor()>-10 and 10>my_turtle.ycor()>-10 and tries == score:
    print("Well done")
    break
elif 10>my_turtle.xcor()>-10 and 10>my_turtle.ycor()>-10 and tries != score:
    print("Return to original position in exactly moves")

A: Turtles wander a floating point plane.  As your turtle moves beyond home (0, 0) about the screen and eventually returns, it can accumlate some floating point noise, e.g. (0.0001, -0.000).  So using an integer comparison like == won't work.  Instead we can use the distance() method:
if my_turtle.distance(0, 0) < 10:

    if tries == score:
        print("Well done")
        break

    print("Return to original position in exactly moves")

The distance() method is flexible in that along with separate coordinates, it can also accept a tuple coordinate, or even another turtle!

redpajama_set_name: RedPajamaStackExchange


text:
Q: Trying to generalize this script I have written the following PS script:
cmdkey /add:pcname /user:network\username /pass:password
New-PSDrive -Name "E" -Root "\\vm-beta\ShareOne" -Persist -PSProvider "FileSystem"

This will save the given NAS user's login credentials in windows Credential Manager and then map the given network share in windows file explorer as a local drive
My problem is this isn't generic enough. I'm trying to generalize this script in that once the given user's login credentials - for the NAS - are typed into and saved in the Credential Manager, the rest of the script will get all the network shares - on the NAS - the given user has access to  and map every one of them in windows File Explorer as a local drive.
For this purpose so far I've written this script that isn't working:
# Prompt user for NAS credentials and save in Credential Manager
$credential = Get-Credential -Message "Enter NAS Login Credentials"
cmdkey /add:NAS /user:$($credential.Username) /pass:$($credential.Password)

# Get all network shares accessible to the given user on the NAS
$networkShares = Get-SmbShare -CimSession NAS -Credential $credential

# Map all network shares as drives in Windows File Explorer
foreach ($share in $networkShares) {
    New-PSDrive -Name $share.Name -Root $share.Path -Persist -PSProvider "FileSystem" -Credential $credential
}

How can I create that script? I've been trying to fix this for hours
above is what im trying to do


text:
Q: Vertical Text in button look neat I have a div(which I want to look like a button) and I am displaying the text in it vertically. I want the text to look neat. How can I do it? FIDDLE

Hide Menu

CSS:
    #btn-toggle-menu {
       position:fixed;
       width:10.9px;
       line-height:25px;
       cursor:pointer;
       border:1px solid #333;
       background-color:#ccc;
       text-align:center;
       font-weight:bold;
       font-size:20px;
       word-wrap: break-word;
   }

A: I guess, your problem solved. try this
HTML:

        Hide Menu

CSS:
#btn-toggle-menu {
    position:fixed;
    width:25px;
    line-height:25px;
    cursor:pointer;
    border:1px solid #333;
    background-color:#ccc;
    text-align:center;
    font-weight:bold;
    font-size:20px;
    word-wrap: break-word;
    padding-left:8px;
}

Live Demo

A: Try using this  DEMO

H
 i
 d
 e

 M
 e
 n
 u

CSS:
    #btn-toggle-menu {
      position:fixed;
      top:0;
      left:0;
      width:20px;
      cursor:pointer;
      border:1px solid #333;
      background-color:#ccc;
      text-align:center;
      white-space: pre;
   }

A: The first thing that comes to mind is to use the width = 1em (one width of letter M) and use white-space in pre-mode:
#btn-toggle-menu {
    text-align: center;
    width:1em;
    word-wrap: pre;
}

Text is aligned to the center.
Demo: http://jsfiddle.net/6v2Cm/5/


text:
Q: BroadcastReceiver Doesnt work if I close Recent Apps I am Trying to make an app which app will be called if a particular thing triggered. In my App this thing is sms.. When a new Sms Receiving I Read its contents and i Look for a Specific Content If it presents an alarm will goes on.
If the App is opened its just working fine. The receiver triggers good... but when i clear recent apps receiver not triggering. I searched a lot here.. and Most of us saying that when an app in STOPPED_STATE it wont receive any notification that the particular thing happened.
I have an android device Hauwei and android version 4.4.4 and when i clear my recent application it completely destroy my app. the receiver stopped working.
I have tried to make an service and return start_sticky and for me its only possible with foreground process not for background tasks. But i don't want to push a notification which says myApplication running in your device.
Now What i want is I need A receiver which should receive SMS_RECEIVED even if the app is closed (here I am not talking about the STOPPED_STATE OF THE APP).
After clearRecentApps myApp is in STOPPED_STATE (i can see it in settings myApps FORCE_STOP button disabled).  but at the same time WATSAPP , FACEBOOK AND CLASSOFCLANS are not it STOPPED_STATE( in settings those FORCE_STOP BUTTONS ARE ENABLED ONLY). without any foreground notifications.
How do they doing... Please help me guys... this taking lot of days for me..
If i am wrong let me Know. Iam New to android.. Any Help would be appreciated..

A: This may be a work around but to keep your service running even when your app is closed, you have to start your service again in your service's onDestroy() method.
@Override
public void onDestroy() {
    super.onDestroy();
    startService(new Intent(this, YourServiceClass.class));

}


text:
Q: Why is my convex hull algorithm returning the wrong points? I'm writing some Python for Autodesk Maya that should return the 2D convex hull for a given 3D polygon.  More specifically, I want to flatten a 3D polygon by throwing out the height coordinates, and create a convex hull for the "flattened" 2D representation of said polygon.
For example, if it is given a list of vertices, the expected result should only be the vertices in the outermost edge loop.  There are a total of 400 vertices in a basic torus(just an example polygon), and the outer edge loop is made up of 20 of those vertices, but I end up getting 216 vertices back when calculating the convex hull; those vertices include ones that are in the innermost edge loops, which shouldn't happen.
The algorithm is based on code here:
https://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain#Python
Note that I am using X and Z coordinates, not X and Y.  I don't think that this should be a problem as long as Z is used in the same way as Y, but correct me if I'm wrong.  You may also be wondering why I don't just look for vertices that have a height of 0; that would indeed work for the torus, but not for other polygons that are moving(animated) and do not have an "equator" that also happens to be the convex hull.
Here are some screenshots of the torus polygon.  The vertices highlighted in yellow are what I would expect the convex hull to be, given that we flattened the polygon by ignoring Y.

Here is a representation of my computed hull points.

As you can see, most of the vertices are selected.
Here is the code, though I re-wrote it so that it just takes arrays of vertex coordinates rather than depend on the Maya API.  Some things, like the Vertex class, may seem pointless here but that's because code was removed from the original version that doesn't have to do with the convex hull calculation.  Tested with Python 2.7.
class PolyFence(list):
  def __init__(self, vertices):
    self.compute_convex_hull(vertices)

  def intersects(self, polygon):
    for coordinate in self:
      if coordinate.within(polygon):
        return True
    return False

  def compute_convex_hull(self, vertices):

    def cross(o, a, b):
      return (a.x - o.x) * (b.z - o.z) - (a.z - o.z) * (b.x - o.x)

    def build_hull(sorted_points):
      hull = []
      for p in sorted_points:
        while len(hull) >= 2 and cross(hull[-2], hull[-1], p) <= 0:
          hull.pop()
        hull.append(p)
      return hull

    sorted_points = sorted(set(vertices))

    # Build lower hull
    lower = build_hull(sorted_points)
    # Build upper hull
    upper = build_hull(reversed(sorted_points))

    c_hull_points = lower[:-1] + upper[:-1]

    ordered_hull_points = sorted(c_hull_points, key=lambda k: (-k.x, -k.z))
    ordered_hull_points[-2], ordered_hull_points[-1] = ordered_hull_points[-1], ordered_hull_points[-2]

    self += ordered_hull_points

class Vertex:
  def __init__(self, pair):
    self.x = pair[0]
    self.z = pair[1]
  def __getitem__(self, idx):
    if idx == 0:
      return self.x
    if idx == 1:
      # this is so we don't sort by values we aren't using
      return self.z
    return None

torus_coords = [(0.4755285680294037, -0.1545085906982422), (0.4045087695121765, -0.2938928008079529), (0.2938928008079529, -0.4045087397098541), (0.154508575797081, -0.4755285084247589), (0.0, -0.5000002384185791), (-0.154508575797081, -0.4755284786224365), (-0.2938927412033081, -0.40450865030288696), (-0.4045086205005646, -0.2938927114009857), (-0.47552838921546936, -0.1545085310935974), (-0.5000001192092896, 0.0), (-0.47552838921546936, 0.1545085310935974), (-0.4045085906982422, 0.29389268159866333), (-0.29389268159866333, 0.4045085608959198), (-0.1545085310935974, 0.4755283296108246), (-1.4901161193847656e-08, 0.5000000596046448), (0.15450848639011383, 0.4755282998085022), (0.29389262199401855, 0.4045085310935974), (0.404508501291275, 0.29389265179634094), (0.4755282700061798, 0.15450850129127502), (0.5, 0.0), (0.4988026022911072, -0.16207078099250793), (0.42430683970451355, -0.3082769513130188), (0.3082769513130188, -0.42430680990219116), (0.16207076609134674, -0.4988025426864624), (0.0, -0.5244719982147217), (-0.16207076609134674, -0.49880251288414), (-0.308276891708374, -0.424306720495224), (-0.4243066906929016, -0.30827686190605164), (-0.49880242347717285, -0.16207072138786316), (-0.5244718790054321, 0.0), (-0.49880242347717285, 0.16207072138786316), (-0.4243066608905792, 0.30827683210372925), (-0.30827683210372925, 0.42430663108825684), (-0.16207072138786316, 0.4988023638725281), (-1.5630476468686538e-08, 0.5244718194007874), (0.16207067668437958, 0.4988023340702057), (0.3082767724990845, 0.42430660128593445), (0.42430657148361206, 0.30827680230140686), (0.4988023042678833, 0.16207069158554077), (0.5244717597961426, 0.0), (0.5663464665412903, -0.1840171068906784), (0.48176309466362, -0.3500213325023651), (0.3500213325023651, -0.4817630648612976), (0.1840170919895172, -0.5663464069366455), (0.0, -0.5954918265342712), (-0.1840170919895172, -0.5663463473320007), (-0.35002127289772034, -0.48176294565200806), (-0.48176291584968567, -0.35002124309539795), (-0.5663462281227112, -0.18401704728603363), (-0.5954916477203369, 0.0), (-0.5663462281227112, 0.18401704728603363), (-0.4817628860473633, 0.35002121329307556), (-0.35002121329307556, 0.4817628562450409), (-0.18401704728603363, 0.5663461685180664), (-1.7747030511827688e-08, 0.5954915881156921), (0.18401698768138885, 0.5663461685180664), (0.3500211238861084, 0.4817627966403961), (0.48176276683807373, 0.3500211834907532), (0.5663461089134216, 0.18401700258255005), (0.5954915285110474, 0.0), (0.6715484857559204, -0.21819931268692017), (0.57125324010849, -0.4150397479534149), (0.4150397479534149, -0.57125324010849), (0.21819929778575897, -0.6715483665466309), (0.0, -0.7061077356338501), (-0.21819929778575897, -0.6715483069419861), (-0.41503965854644775, -0.5712530612945557), (-0.5712530612945557, -0.41503962874412537), (-0.6715481877326965, -0.218199223279953), (-0.7061075568199158, 0.0), (-0.6715481877326965, 0.218199223279953), (-0.5712530016899109, 0.4150395691394806), (-0.4150395691394806, 0.5712529420852661), (-0.218199223279953, 0.6715481281280518), (-2.1043639719664498e-08, 0.7061074376106262), (0.21819916367530823, 0.671548068523407), (0.4150395095348358, 0.5712529420852661), (0.5712528824806213, 0.4150395393371582), (0.671548068523407, 0.21819917857646942), (0.7061073780059814, 0.0), (0.8041107654571533, -0.2612714171409607), (0.6840174794197083, -0.49696773290634155), (0.49696773290634155, -0.6840174198150635), (0.2612713873386383, -0.8041106462478638), (0.0, -0.8454919457435608), (-0.2612713873386383, -0.804110586643219), (-0.4969676434993744, -0.6840173006057739), (-0.6840172410011292, -0.4969675838947296), (-0.8041104674339294, -0.26127129793167114), (-0.8454917073249817, 0.0), (-0.8041104674339294, 0.26127129793167114), (-0.6840171813964844, 0.4969675540924072), (-0.4969675540924072, 0.6840171217918396), (-0.26127129793167114, 0.8041103482246399), (-2.5197611108751516e-08, 0.8454916477203369), (0.26127123832702637, 0.8041102886199951), (0.4969674348831177, 0.6840170621871948), (0.68401700258255, 0.49696749448776245), (0.8041102290153503, 0.26127126812934875), (0.8454915285110474, 0.0), (0.9510571360588074, -0.3090171813964844), (0.809017539024353, -0.5877856016159058), (0.5877856016159058, -0.8090174794197083), (0.309017151594162, -0.9510570168495178), (0.0, -1.0000004768371582), (-0.309017151594162, -0.951056957244873), (-0.5877854824066162, -0.8090173006057739), (-0.8090172410011292, -0.5877854228019714), (-0.9510567784309387, -0.3090170621871948), (-1.000000238418579, 0.0), (-0.9510567784309387, 0.3090170621871948), (-0.8090171813964844, 0.5877853631973267), (-0.5877853631973267, 0.8090171217918396), (-0.3090170621871948, 0.9510566592216492), (-2.9802322387695312e-08, 1.0000001192092896), (0.30901697278022766, 0.9510565996170044), (0.5877852439880371, 0.8090170621871948), (0.80901700258255, 0.5877853035926819), (0.9510565400123596, 0.30901700258255005), (1.0, 0.0), (1.098003625869751, -0.35676300525665283), (0.9340177178382874, -0.6786035299301147), (0.6786035299301147, -0.9340176582336426), (0.35676294565200806, -1.0980035066604614), (0.0, -1.15450918674469), (-0.35676294565200806, -1.0980033874511719), (-0.6786034107208252, -0.9340174198150635), (-0.9340173602104187, -0.6786032915115356), (-1.0980032682418823, -0.3567628562450409), (-1.1545088291168213, 0.0), (-1.0980032682418823, 0.3567628562450409), (-0.9340173006057739, 0.6786032319068909), (-0.6786032319068909, 0.9340172410011292), (-0.3567628562450409, 1.0980030298233032), (-3.440703721935279e-08, 1.1545087099075317), (0.35676273703575134, 1.0980030298233032), (0.6786031126976013, 0.9340171217918396), (0.9340170621871948, 0.6786031723022461), (1.0980029106140137, 0.3567627966403961), (1.1545085906982422, 0.0), (1.2305657863616943, -0.3998350501060486), (1.0467817783355713, -0.7605314254760742), (0.7605314254760742, -1.0467817783355713), (0.3998350203037262, -1.2305656671524048), (0.0, -1.2938932180404663), (-0.3998350203037262, -1.2305655479431152), (-0.7605313062667847, -1.0467815399169922), (-1.0467814207077026, -0.7605312466621399), (-1.2305653095245361, -0.39983490109443665), (-1.2938929796218872, 0.0), (-1.2305653095245361, 0.39983490109443665), (-1.0467814207077026, 0.7605311274528503), (-0.7605311274528503, 1.046781301498413), (-0.39983490109443665, 1.2305651903152466), (-3.856100505572613e-08, 1.293892741203308), (0.3998347818851471, 1.230565071105957), (0.7605310082435608, 1.0467811822891235), (1.0467811822891235, 0.7605310678482056), (1.230565071105957, 0.3998348116874695), (1.2938926219940186, 0.0), (1.3357678651809692, -0.4340173006057739), (1.1362720727920532, -0.8255499005317688), (0.8255499005317688, -1.1362719535827637), (0.43401724100112915, -1.3357677459716797), (0.0, -1.4045093059539795), (-0.43401724100112915, -1.3357676267623901), (-0.8255497813224792, -1.1362717151641846), (-1.1362717151641846, -0.8255496621131897), (-1.335767388343811, -0.4340171217918396), (-1.4045089483261108, 0.0), (-1.335767388343811, 0.4340171217918396), (-1.136271595954895, 0.8255496025085449), (-0.8255496025085449, 1.1362714767456055), (-0.4340171217918396, 1.3357672691345215), (-4.1857617816276615e-08, 1.4045087099075317), (0.43401700258255005, 1.335767149925232), (0.8255494236946106, 1.136271357536316), (1.136271357536316, 0.8255494832992554), (1.3357670307159424, 0.43401703238487244), (1.4045085906982422, 0.0), (1.4033117294311523, -0.4559636116027832), (1.1937283277511597, -0.8672943115234375), (0.8672943115234375, -1.1937282085418701), (0.4559635818004608, -1.4033116102218628), (0.0, -1.4755290746688843), (-0.4559635818004608, -1.4033114910125732), (-0.8672941327095032, -1.193727970123291), (-1.1937278509140015, -0.8672940731048584), (-1.4033112525939941, -0.4559634327888489), (-1.4755287170410156, 0.0), (-1.4033112525939941, 0.4559634327888489), (-1.1937278509140015, 0.8672939538955688), (-0.8672939538955688, 1.193727731704712), (-0.4559634327888489, 1.403311014175415), (-4.3974171859417766e-08, 1.4755284786224365), (0.4559633135795593, 1.403311014175415), (0.8672937750816345, 1.1937276124954224), (1.1937274932861328, 0.8672938942909241), (1.4033108949661255, 0.4559633433818817), (1.475528359413147, 0.0), (1.4265857934951782, -0.46352580189704895), (1.2135263681411743, -0.8816784620285034), (0.8816784620285034, -1.2135263681411743), (0.46352577209472656, -1.4265856742858887), (0.0, -1.5000008344650269), (-0.46352577209472656, -1.4265855550765991), (-0.8816782832145691, -1.2135260105133057), (-1.2135260105133057, -0.8816782236099243), (-1.42658531665802, -0.4635256230831146), (-1.5000004768371582, 0.0), (-1.42658531665802, 0.4635256230831146), (-1.2135258913040161, 0.8816781044006348), (-0.8816781044006348, 1.2135257720947266), (-0.4635256230831146, 1.426585078239441), (-4.470348713425665e-08, 1.5000003576278687), (0.4635255038738251, 1.4265849590301514), (0.8816779255867004, 1.213525652885437), (1.213525652885437, 0.88167804479599), (1.4265849590301514, 0.46352553367614746), (1.5000001192092896, 0.0), (1.4033117294311523, -0.4559636116027832), (1.1937283277511597, -0.8672943115234375), (0.8672943115234375, -1.1937282085418701), (0.4559635818004608, -1.4033116102218628), (0.0, -1.4755290746688843), (-0.4559635818004608, -1.4033114910125732), (-0.8672941327095032, -1.193727970123291), (-1.1937278509140015, -0.8672940731048584), (-1.4033112525939941, -0.4559634327888489), (-1.4755287170410156, 0.0), (-1.4033112525939941, 0.4559634327888489), (-1.1937278509140015, 0.8672939538955688), (-0.8672939538955688, 1.193727731704712), (-0.4559634327888489, 1.403311014175415), (-4.3974171859417766e-08, 1.4755284786224365), (0.4559633135795593, 1.403311014175415), (0.8672937750816345, 1.1937276124954224), (1.1937274932861328, 0.8672938942909241), (1.4033108949661255, 0.4559633433818817), (1.475528359413147, 0.0), (1.3357678651809692, -0.4340173006057739), (1.1362720727920532, -0.8255499005317688), (0.8255499005317688, -1.1362719535827637), (0.43401724100112915, -1.3357677459716797), (0.0, -1.4045093059539795), (-0.43401724100112915, -1.3357676267623901), (-0.8255497813224792, -1.1362717151641846), (-1.1362717151641846, -0.8255496621131897), (-1.335767388343811, -0.4340171217918396), (-1.4045089483261108, 0.0), (-1.335767388343811, 0.4340171217918396), (-1.136271595954895, 0.8255496025085449), (-0.8255496025085449, 1.1362714767456055), (-0.4340171217918396, 1.3357672691345215), (-4.1857617816276615e-08, 1.4045087099075317), (0.43401700258255005, 1.335767149925232), (0.8255494236946106, 1.136271357536316), (1.136271357536316, 0.8255494832992554), (1.3357670307159424, 0.43401703238487244), (1.4045085906982422, 0.0), (1.2305659055709839, -0.39983507990837097), (1.0467818975448608, -0.7605315446853638), (0.7605315446853638, -1.0467818975448608), (0.3998350501060486, -1.2305657863616943), (0.0, -1.2938933372497559), (-0.3998350501060486, -1.2305656671524048), (-0.7605313658714294, -1.0467816591262817), (-1.0467815399169922, -0.7605313062667847), (-1.2305654287338257, -0.39983493089675903), (-1.2938930988311768, 0.0), (-1.2305654287338257, 0.39983493089675903), (-1.0467814207077026, 0.7605311870574951), (-0.7605311870574951, 1.0467814207077026), (-0.39983493089675903, 1.2305653095245361), (-3.8561008608439806e-08, 1.2938928604125977), (0.3998348116874695, 1.2305651903152466), (0.7605310678482056, 1.046781301498413), (1.0467811822891235, 0.7605311274528503), (1.2305651903152466, 0.39983487129211426), (1.293892741203308, 0.0), (1.098003625869751, -0.35676300525665283), (0.9340177178382874, -0.6786035299301147), (0.6786035299301147, -0.9340176582336426), (0.35676294565200806, -1.0980035066604614), (0.0, -1.15450918674469), (-0.35676294565200806, -1.0980033874511719), (-0.6786034107208252, -0.9340174198150635), (-0.9340173602104187, -0.6786032915115356), (-1.0980032682418823, -0.3567628562450409), (-1.1545088291168213, 0.0), (-1.0980032682418823, 0.3567628562450409), (-0.9340173006057739, 0.6786032319068909), (-0.6786032319068909, 0.9340172410011292), (-0.3567628562450409, 1.0980030298233032), (-3.440703721935279e-08, 1.1545087099075317), (0.35676273703575134, 1.0980030298233032), (0.6786031126976013, 0.9340171217918396), (0.9340170621871948, 0.6786031723022461), (1.0980029106140137, 0.3567627966403961), (1.1545085906982422, 0.0), (0.9510571360588074, -0.3090171813964844), (0.809017539024353, -0.5877856016159058), (0.5877856016159058, -0.8090174794197083), (0.309017151594162, -0.9510570168495178), (0.0, -1.0000004768371582), (-0.309017151594162, -0.951056957244873), (-0.5877854824066162, -0.8090173006057739), (-0.8090172410011292, -0.5877854228019714), (-0.9510567784309387, -0.3090170621871948), (-1.000000238418579, 0.0), (-0.9510567784309387, 0.3090170621871948), (-0.8090171813964844, 0.5877853631973267), (-0.5877853631973267, 0.8090171217918396), (-0.3090170621871948, 0.9510566592216492), (-2.9802322387695312e-08, 1.0000001192092896), (0.30901697278022766, 0.9510565996170044), (0.5877852439880371, 0.8090170621871948), (0.80901700258255, 0.5877853035926819), (0.9510565400123596, 0.30901700258255005), (1.0, 0.0), (0.8041106462478638, -0.2612713575363159), (0.6840173602104187, -0.4969676733016968), (0.4969676733016968, -0.6840173006057739), (0.2612713575363159, -0.8041105270385742), (0.0, -0.8454918265342712), (-0.2612713575363159, -0.8041104674339294), (-0.4969675838947296, -0.6840171813964844), (-0.6840171217918396, -0.49696752429008484), (-0.8041103482246399, -0.26127126812934875), (-0.8454915881156921, 0.0), (-0.8041103482246399, 0.26127126812934875), (-0.6840170621871948, 0.49696746468544006), (-0.49696746468544006, 0.68401700258255), (-0.26127126812934875, 0.8041102290153503), (-2.5197607556037838e-08, 0.8454915285110474), (0.261271208524704, 0.8041101694107056), (0.4969673752784729, 0.68401700258255), (0.6840169429779053, 0.4969674348831177), (0.8041101098060608, 0.261271208524704), (0.8454914093017578, 0.0), (0.6715483069419861, -0.2181992530822754), (0.5712531208992004, -0.41503965854644775), (0.41503965854644775, -0.5712530612945557), (0.2181992381811142, -0.6715481877326965), (0.0, -0.7061075568199158), (-0.2181992381811142, -0.6715481877326965), (-0.4150395691394806, -0.5712529420852661), (-0.5712528824806213, -0.4150395095348358), (-0.6715480089187622, -0.21819917857646942), (-0.7061073780059814, 0.0), (-0.6715480089187622, 0.21819917857646942), (-0.5712528824806213, 0.4150394797325134), (-0.4150394797325134, 0.5712528228759766), (-0.21819917857646942, 0.6715479493141174), (-2.104363439059398e-08, 0.7061072587966919), (0.21819910407066345, 0.6715478897094727), (0.41503939032554626, 0.5712527632713318), (0.571252703666687, 0.41503942012786865), (0.6715478897094727, 0.21819913387298584), (0.7061071991920471, 0.0), (0.5663461685180664, -0.18401701748371124), (0.4817628562450409, -0.3500211834907532), (0.3500211834907532, -0.4817628264427185), (0.18401700258255005, -0.5663461089134216), (0.0, -0.5954915285110474), (-0.18401700258255005, -0.5663460493087769), (-0.350021094083786, -0.48176270723342896), (-0.48176267743110657, -0.3500210642814636), (-0.5663459897041321, -0.18401695787906647), (-0.595491349697113, 0.0), (-0.5663459897041321, 0.18401695787906647), (-0.4817626476287842, 0.35002103447914124), (-0.35002103447914124, 0.4817625880241394), (-0.18401695787906647, 0.5663458704948425), (-1.774702163004349e-08, 0.5954912900924683), (0.1840168982744217, 0.5663458704948425), (0.3500209450721741, 0.481762558221817), (0.48176252841949463, 0.35002100467681885), (0.5663458108901978, 0.18401691317558289), (0.5954912304878235, 0.0), (0.4988022744655609, -0.16207067668437958), (0.42430657148361206, -0.3082767426967621), (0.3082767426967621, -0.4243065416812897), (0.16207066178321838, -0.49880221486091614), (0.0, -0.524471640586853), (-0.16207066178321838, -0.49880218505859375), (-0.3082766830921173, -0.4243064522743225), (-0.42430639266967773, -0.3082766532897949), (-0.4988020956516266, -0.1620706170797348), (-0.5244715213775635, 0.0), (-0.4988020956516266, 0.1620706170797348), (-0.42430636286735535, 0.30827662348747253), (-0.30827662348747253, 0.42430633306503296), (-0.1620706170797348, 0.4988020062446594), (-1.5630465810545502e-08, 0.5244714617729187), (0.16207057237625122, 0.49880197644233704), (0.30827656388282776, 0.42430630326271057), (0.4243062734603882, 0.30827659368515015), (0.49880194664001465, 0.16207058727741241), (0.5244714021682739, 0.0)]
torus        = [Vertex(coord) for coord in torus_coords]

fence = PolyFence(torus)

expectation_coords = [(1.4265857934951782, -0.46352580189704895), (1.2135263681411743, -0.8816784620285034), (0.8816784620285034, -1.2135263681411743), (0.46352577209472656, -1.4265856742858887), (0.0, -1.5000008344650269), (-0.46352577209472656, -1.4265855550765991), (-0.8816782832145691, -1.2135260105133057), (-1.2135260105133057, -0.8816782236099243), (-1.42658531665802, -0.4635256230831146), (-1.5000004768371582, 0.0), (-1.42658531665802, 0.4635256230831146), (-1.2135258913040161, 0.8816781044006348), (-0.8816781044006348, 1.2135257720947266), (-0.4635256230831146, 1.426585078239441), (-4.470348713425665e-08, 1.5000003576278687), (0.4635255038738251, 1.4265849590301514), (0.8816779255867004, 1.213525652885437), (1.213525652885437, 0.88167804479599), (1.4265849590301514, 0.46352553367614746), (1.5000001192092896, 0.0)] #
expectation        = [Vertex(coord) for coord in expectation_coords]

assert(sorted(fence) == sorted(expectation))

A: @Sneftel was right; my code wasn't actually sorting the points lexographically because my vertices are not lists or tuples, which are ordered per-property by Python.
This is how I changed the call to sorted to get the correct result:
sorted_points = sorted(set(self.vertices()), key=lambda v: (v.x(), v.z()))

Basically, I'm translating my object to a tuple for it to have something to sort by.
And here's the result. :)


text:
Q: How to transpose a formattable in R Shiny? is there anyone who could help me with transposing a formattable? Below is some code that illustrates the problem. The script works fine if DF is used in formattable() but not if the transpose (tDF) is used. Any suggestions are more than welcome.
library(formattable)
DF <- data.frame(Ticker=c("", "", "", "IBM", "AAPL", "MSFT"),
                 Name=c("Dow Jones", "S&P 500", "Technology",
                        "IBM", "Apple", "Microsoft"),
                 Value=accounting(c(15988.08, 1880.33, NA,
                                    130.00, 97.05, 50.99)),
                 Change=percent(c(-0.0239, -0.0216, 0.021,
                                  -0.0219, -0.0248, -0.0399)))

tDF <- t(DF)

formattable(tDF, list(
  Name=formatter(
    "span",
    style = x ~ ifelse(x == "Technology",
                       style(font.weight = "bold"), NA)),
  Value = color_tile("white", "orange"),
  Change = formatter(
    "span",
    style = x ~ style(color = ifelse(x < 0 , "red", "green")),
    x ~ icontext(ifelse(x < 0, "arrow-down", "arrow-up"), x)))
)

A: The transpose turned the DF data frame into a matrix: documentation. Does this help you?
tDF <- as.data.frame(t(DF))

I am not an expert on this package, still the output of your original code is obvious:
> class(DF)
[1] "data.frame"
> class(tDF)
[1] "matrix"


text:
Q: How to find alternative value for particular id in FROM clause query? Please find detailed requirement and details are as below. The given query is giving results for the quote_revision_id available in Query A but if quote_revivsion_id is not present in Query but the other quote_reivsion_ids present in other than Query A then all the details should display for those quote_revision_id.
I have already mentioned in my expected result like from the given query I need the results for Quote_revision_id 5 & 6 also but with my given query those records are not coming.
Oracle Version: 12.1.0
Please find below the detailed requirement and necessary details,
Tables:
create table t1 (quote_revision_id number, qty number,item_parts
varchar2(100),cost number, resale number, item_tag varchar2(10))
/
create table t2 (opportunity_id number,rebate number)
/
create table t3 (revision_id number,quote_id number)
/
create table t4 (quote_id number,opportunity_id number)
/
create table t5 (opportunity_id number,shipping_fee_taxes number,
agent_commissions number, total_program_costs number, service_fees number)

/
Insert:
insert into t1 values (1,10,'P1',100,100,null)
/
insert into t1 values (2,20,'P2',110,110,null)
/
insert into t1 values (3,10,'P3',120,120,null)
/
insert into t1 values (4,30,'P4',130,130,null)
/
insert into t1 values (5,20,'P5',140,null,null)
/
insert into t1 values (6,10,'P6',150,150,'5.0')
/

insert into t2 values (100,10)
/
insert into t2 values (101,20)
/
insert into t2 values (102,10)
/
insert into t2 values (103,0)
/
insert into t2 values (104,20)
/
insert into t2 values (105,10)
/

insert into t3 values (1,10)
/
insert into t3 values (2,20)
/
insert into t3 values (3,30)
/
insert into t3 values (4,40)
/
insert into t3 values (5,50)
/
insert into t3 values (6,60)
/

insert into t4 values (10,100)
/
insert into t4 values (20,101)
/
insert into t4 values (30,102)
/
insert into t4 values (40,103)
/
insert into t4 values (50,104)
/
insert into t4 values (60,105)
/

insert into t5 values (100,1,2,3,4)
/
insert into t5 values (101,1,2,3,4)
/
insert into t5 values (102,1,2,3,4)
/
insert into t5 values (103,1,2,3,4)
/
insert into t5 values (104,1,2,3,4)
/
insert into t5 values (105,1,2,3,4)
/

commit
/

Query:
SELECT ROUND(SUM(NVL(a.total_resale,0)),2) total_resale,
     ROUND(SUM(NVL(a.total_cost,0)),2) total_cost,
     ROUND(SUM(nvl(e.total_adjustments,0)),2) total_adjustments,
       a.quote_revision_id,
     CASE WHEN SUM(NVL(a.total_resale,0)) <> 0  THEN
        ROUND(((SUM(NVL(a.total_resale,0)) -
               SUM(NVL(a.total_cost,0))) /
               SUM(NVL(a.total_resale,0))*100),2)
        ELSE 0
     END parts_margin,
     ROUND(SUM(nvl(a.net_margin,0)),2) net_margin,
     SUM(nvl(c.total_no_of_parts_requested,0))  total_no_of_parts_requested,
     SUM(nvl(d.total_no_of_parts_quoted,0)) total_no_of_parts_quoted,
     (SUM(nvl(c.total_no_of_parts_requested,0))-
SUM(nvl(d.total_no_of_parts_quoted,0))) total_no_of_part_not_quoted
FROM
(SELECT  SUM(NVL(t1.resale,0) * NVL(t1.qty,0)) total_resale,
              SUM(NVL(t1.cost,0) * NVL(t1.qty,0)) total_cost,
              t1.quote_revision_id quote_revision_id,
              CASE WHEN (SUM(nvl(t1.resale,0) * nvl(t1.qty,0)) +
                         SUM(nvl(t5.service_fees,0))) <> 0 THEN
                (((SUM(NVL(t1.resale,0) * NVL(t1.qty,0)) +
                    SUM(NVL(t5.service_fees,0))) -
                    (SUM(NVL(t1.cost,0) * NVL(t1.qty,0)) +
                     (SUM(NVL(t2.rebate,0) + NVL(t5.shipping_fee_taxes,0) +
                         NVL(t5.agent_commissions,0) +
    NVL(t5.total_program_costs,0)))- (sum(nvl(t5.service_fees,0))))) /
                  (SUM(NVL(t1.resale,0) * NVL(t1.qty,0)) +
                   SUM(nvl(t5.service_fees,0))) *100)
              ELSE 0 END net_margin
         FROM t1 ,
              t2,
              t3,
              t4,
              t5
        WHERE t1.quote_revision_id = t3.revision_id AND
              t3.quote_id = t4.quote_id AND
              t2.opportunity_id = t4.opportunity_id AND
              t5.opportunity_id = t4.opportunity_id AND
              t1.resale is not null AND
              ((t1.item_tag <> '5.0' and t1.item_tag <> 5) or (t1.item_tag
       is null)) --added constraint for excluding parts with item_tag 5 for
       both alphanumeric and number values of item tag
     GROUP BY t1.quote_revision_id)a,
     (SELECT  t2.opportunity_id,
              MAX(t1.quote_revision_id) quote_revision_id
        FROM  t2,
              t4,
              t3,
              t1
       WHERE  t2.opportunity_id = t4.opportunity_id AND
              t4.quote_id = t3.quote_id AND
              t3.revision_id = t1.quote_revision_id
    GROUP BY  t2.opportunity_id) b,
    (SELECT  t1.quote_revision_id,
              COUNT(t1.item_parts) total_no_of_parts_requested
        FROM  t1
    GROUP BY  t1.quote_revision_id) c,
    (SELECT  t1.quote_revision_id,
            COUNT(t1.item_parts)
         total_no_of_parts_quoted
        FROM  t1
        where t1.COST is not null
        and t1.RESALE is not null
    GROUP BY  t1.quote_revision_id) d,
            (SELECT  t2.opportunity_id,
             ((SUM(NVL(t2.rebate,0) +
                  NVL(t5.shipping_fee_taxes,0) +
                  NVL(t5.agent_commissions,0) +
                  NVL(t5.total_program_costs,0))) -
              SUM(nvl(t5.service_fees,0))) total_adjustments
              FROM  t2,
              t5
        where t2.opportunity_id = t5.opportunity_id
    GROUP BY  t2.opportunity_id
    ) e

  where a.quote_revision_id  = b.quote_revision_id AND
   c.quote_revision_id(+) = b.quote_revision_id AND
   d.quote_revision_id(+) = b.quote_revision_id AND
   e.opportunity_id(+) = b.opportunity_id
 group by a.quote_revision_id
  order by a.quote_revision_id;

Expected Result:
+--------+------+------+--------------+----+--------+----+----+-----+
| RESALE | COST | Adj. | Quote_Rev_id | PM |   NM   | PR | PQ | PNQ |
+--------+------+------+--------------+----+--------+----+----+-----+
|   1000 | 1000 |   12 |            1 |  0 |   -0.8 |  1 |  1 |   0 |
|   2200 | 2200 |   22 |            2 |  0 |  -0.82 |  1 |  1 |   0 |
|   1200 | 1200 |   12 |            3 |  0 |  -0.66 |  1 |  1 |   0 |
|   3900 | 3900 |    2 |            4 |  0 |   0.05 |  1 |  1 |   0 |
|      0 |    0 |    0 |            5 |  0 |      0 |  1 |  0 |   1 |
|      0 |    0 |    0 |            6 |  0 |      0 |  1 |  1 |   0 |
+--------+------+------+--------------+----+--------+----+----+-----+

Actual Result:
+--------+------+------+--------------+----+-------+----+----+-----+
| RESALE | COST | Adj. | Quote_Rev_id | PM |  NM   | PR | PQ | PNQ |
+--------+------+------+--------------+----+-------+----+----+-----+
|   1000 | 1000 |   12 |            1 |  0 |  -0.8 |  1 |  1 |   0 |
|   2200 | 2200 |   22 |            2 |  0 | -0.82 |  1 |  1 |   0 |
|   1200 | 1200 |   12 |            3 |  0 | -0.66 |  1 |  1 |   0 |
|   3900 | 3900 |    2 |            4 |  0 |  0.05 |  1 |  1 |   0 |
+--------+------+------+--------------+----+-------+----+----+-----+

Please suggest how to achieve expected result from the given query.
Thanks


text:
Q: Getting Exception-java.lang.IllegalStateException: getOutputStream() has already been called for this response I am new to jsp,when I try to invoke a jsp page by some parameters named cId and passWord,I getting this error,The code I have been trying is given below,I have already gone through the same error which have been seen by googling,but still I am getting the same issue.
The code is:
<body>
        <%

        String cidMessage = "cID";
        String passEncrypted = "passWord";
        System.out.println("CID ISSSSSSSSSSSS"+cId);
        if ((cId.equals(cidMessage)) && (passWord.equals(passEncrypted))) {
                        System.out.println("Validation Correct"+cId);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = new Date();
            String time = sdf.format(date.getTime());
            String xmlOutput = "<smsreport>"
                    + "<date>" + time + "</date>"
                    + "<result>" + "SUCESS" + "</result>"
                    + "<msgid>" + currentTimeMillis() + "</msgid>"
                    + "<msgparts>" + "1" + "</msgparts>"
                    + "</smsreport>";

            try {
                byte[] contents = xmlOutput.getBytes();
                response.setContentType("text/xml");
                response.setContentLength(contents.length);
                response.getOutputStream().write(contents);
                response.getOutputStream().flush();
            } catch (Exception e) {
                throw new ServletException(e);
            }
        } else {
                           System.out.println("Validation Wrong"+cId);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = new Date();
            String time = sdf.format(date.getTime());
            String xmlOutput = "<smsreport>"
                    + "<date>" + time + "</date>"
                    + "<result>ERROR</result>"
                    + "<msgid>" + "ErrorCode" + "</msgid>"
                    + "<msgparts>" + "ErrorMessage" + "</msgparts>"
                    + "</smsreport>";

            try {
                byte[] contents = xmlOutput.getBytes();
                response.setContentType("text/xml");
                response.setContentLength(contents.length);
                response.getOutputStream().write(contents);
                response.getOutputStream().flush();
            } catch (Exception e) {
                throw new ServletException(e);
            }

        }
    %>
</body>

A: *

*If you check the documentation of getOutputStream() method: It mentions

Throws:IllegalStateException - if the getWriter method has been called on this response .

*

*This means that you can call either getWriter() or getOutputStream() methods.

*Now in JSP (and eventually in compiled servlet), there is an implicit variable defined called out . This is nothing but an instance of PrintWriter class. This means that on the response object, getWriter() is already called and hence on calling getOutputStream() you get IllegalStateException

*Now as solution for this problem, as some people have pointed out, move this code into a servlet where you have full control and use the outputstream the way you want.

A: This is a JSP with scriplet which is converted into a Servlet file. You dont need to call explicitly the response object. If you need to see how a compiled JSP looks like when its deployed , search (Google) how to look for the compiled class(Servlet generated out of JSP) on the server. Since you have already called the method on the response a second invocation is Illegal on the response object

A: You shouldn't try and do this inside a JSP. The JSP will already have obtained an output stream to write it's output. You need to use a servlet to return your XML.
When you call response.getOutputStream, it is conflicting with the fact that the JSP (which will be compiled into a servlet) already obtained an output stream. This is why it is resulting in the IllegalStateException.


text:
Q: Beamer Sectionpage for \section*{} command In Beamer one can get a section slide every time the \section{} command is called. However, I would like that not to happen when I use the \section*{} command.
So in the example below, I would like there to be no section page for the Overview section. (In my real template the section title shows up in the bottom left corner, so I do need the \section command.)
\documentclass{beamer}

\usetheme{Ilmenau}

\defbeamertemplate*{section page}{ifttheme}%[1][]
{\vbox{}\vskip-3.2cm%
\begin{beamercolorbox}[sep=0.3cm,ht=0.5\paperheight,wd=\paperwidth]{red}
    \begin{center}
        \begin{minipage}[c]{0.55\paperwidth}
        \centering\insertsection%\par
        \end{minipage}
    \end{center}
\end{beamercolorbox}
}

\AtBeginSection{\frame{\sectionpage}}

\begin{document}

\section*{Overview}

\begin{frame}{Lorem}
\begin{itemize}
\item Ipsum
\item Dolor
\item Sit
\item \dots
\end{itemize}
\end{frame}

\section{Lorem Ipsum}

\subsection{Dolor sit amet}

\begin{frame}{Using a bilinear approximation}
bla
\end{frame}

\end{document}

A: Use an empty optional argument for the optional argument of \AtBeginSection, as in
\AtBeginSection[]%<- do nothing for starred sections
  {\frame{\sectionpage}}

A complete example:
\documentclass{beamer}

\usetheme{Ilmenau}

\defbeamertemplate*{section page}{ifttheme}%[1][]
{\vbox{}\vskip-3.2cm%
\begin{beamercolorbox}[sep=0.3cm,ht=0.5\paperheight,wd=\paperwidth]{red}
    \begin{center}
        \begin{minipage}[c]{0.55\paperwidth}
        \centering\insertsection%\par
        \end{minipage}
    \end{center}
\end{beamercolorbox}
}

\AtBeginSection[]{\frame{\sectionpage}}

\begin{document}

\section*{Overview}

\begin{frame}{Lorem}
\begin{itemize}
\item Ipsum
\item Dolor
\item Sit
\item \dots
\end{itemize}
\end{frame}

\section{Lorem Ipsum}

\subsection{Dolor sit amet}

\begin{frame}{Using a bilinear approximation}
bla
\end{frame}

\end{document}


text:
Q: Display json array data in grid in angular 4 I want to display my data in html which is coming from service.
Below is my component.ts code
url:string="http://localhost:63563/Api/user/GetCheckBoxes";
ErrorMessage : boolean = false;

userdata(){
    this.http.get(this.url).subscribe((res)=>{
        this.arrBirds = res.json() as Application[];
        console.log(this.arrBirds)
    });
}

the response which I am getting from service is below
"Table": [
    {
      "intUserId": 1109,
      "vcrFirstName": "sdvlbs",
      "vcrLastName": "dsbvsdfn",
      "vcrLoginName": "!@#DBASDI?\"|}",
      "vcrPassword": "twst#123",
      "vcrStatus": "InActive",
      "vcrIsClient": "eClerx",
      "vcrEmail": "sdvlbs.dsbvsdfn@test.com",
      "vcrRole": "Analyst,Auditor,Team Lead,Manager",
      "Agreements_Selected": "ISDA,CSA,Repo,SLA,PBA"
    },
    {
      "intUserId": 1121,
      "vcrFirstName": "(*&&)!",
      "vcrLastName": "@%52",
      "vcrLoginName": "!E@DFWFG#^^^#TGE&^$",
      "vcrPassword": "test#123",
      "vcrStatus": "InActive",
      "vcrIsClient": "eClerx",
      "vcrEmail": "saasdasdmple.user@test.com",
      "vcrRole": "Analyst",
      "Agreements_Selected": "ISDA"
    }
  ]
}

Below is my HTML code for rendering data which I am getting from service.

             Login Name
            First Name
            Last Name
            Role

                    {{char.vcrFirstName}}

                  {{char.vcrLastName}}

                  {{char.vcrLoginName}}

                  {{char.vcrPassword}}

the error which I am getting is below.
    ERROR Error: Error trying to diff '{
  "Table": [
    {
      "intUserId": 1109,
      "vcrFirstName": "sdvlbs",
      "vcrLastName": "dsbvsdfn",
      "vcrLoginName": "!@#DBASDI?\"|}",
      "vcrPassword": "eclerx#123",
      "vcrStatus": "InActive",
      "vcrIsClient": "eClerx",
      "vcrEmail": "sdvlbs.dsbvsdfn@eClerx.com",
      "vcrRole": "Analyst,Auditor,Team Lead,Manager",
      "Agreements_Selected": "ISDA,CSA,Repo,SLA,PBA"
    },
    {
      "intUserId": 1121,
      "vcrFirstName": "(*&&)!",
      "vcrLastName": "@%52",
      "vcrLoginName": "!E@DFWFG#^^^#TGE&^$",
      "vcrPassword": "eclerx#123",
      "vcrStatus": "InActive",
      "vcrIsClient": "eClerx",
      "vcrEmail": "saasdasdmple.user@eclerx.com",
      "vcrRole": "Analyst",
      "Agreements_Selected": "ISDA"
    }
  ]
}'. Only arrays and iterables are allowed
    at DefaultIterableDiffer.push../node_modules/@angular/core/fesm5/core.js.DefaultIterableDiffer.diff (core.js:5528)
    at NgForOf.push../node_modules/@angular/common/fesm5/common.js.NgForOf.ngDoCheck (common.js:3134)
    at checkAndUpdateDirectiveInline (core.js:9038)
    at checkAndUpdateNodeInline (core.js:10299)
    at checkAndUpdateNode (core.js:10261)
    at debugCheckAndUpdateNode (core.js:10894)
    at debugCheckDirectivesFn (core.js:10854)
    at Object.eval [as updateDirectives] (UsergridComponent.html:42)
    at Object.debugUpdateDirectives [as updateDirectives] (core.js:10846)
    at checkAndUpdateView (core.js:10243)

can someone please help me in how to display data in my grid.
I am struggling since 2 days.


text:
Q: akka.dispatch.Future not found I am trying to import akka.dispatch.Future in my class but the compiler is unable to find that particular package. The one that it's able to find is akka.dispatch.Futures.
Can somebody point out what I might be doing wrong? My build.sbt is as follows:
name := "SomeApp"

version := "0.1"

scalaVersion := "2.10.1"

libraryDependencies ++= Seq("com.typesafe.akka" %% "akka-actor" % "2.1.2")

A: It's all in the docs: http://doc.akka.io/docs/akka/2.1.2/project/migration-guide-2.0.x-2.1.x.html
See the "Pieces Moved to Scala Standard Library" section.


text:
Q: TCPClient TwitchBot The I/O operation has been aborted because of either a thread exit or an application request I made a Twitch chat bot based on this example: https://medium.com/swlh/writing-a-twitch-bot-from-scratch-in-c-f59d9fed10f3
It works great except for one small exception that occurs usually when I first run the application for the first time every day:
Exception Type: System.IO.IOException
Exception Message: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
Stack Trace:    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token)
at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](TIOAdapter adapter, Memory`1 buffer)
at System.IO.StreamReader.ReadBufferAsync(CancellationToken cancellationToken)
at System.IO.StreamReader.ReadLineAsyncInternal()
at ChatBot.Start()
Additional Info: System.IO.IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request.
I can get around the issue by just looking for this error and then restarting the app but in a real-time environment, I'd like to avoid having to restart the application anytime this happens.
For reference, this is built into my .NET Core 5 Windows Forms app.
public async Task Start()
        {
            try
            {
                tcpClient = new TcpClient();
                await tcpClient.ConnectAsync(ip, port);
                SslStream sslStream = new SslStream(tcpClient.GetStream(), false, ValidateServerCertificate, null);
                await sslStream.AuthenticateAsClientAsync(ip);

                streamReader = new StreamReader(sslStream);
                streamWriter = new StreamWriter(sslStream) { NewLine = "\r\n", AutoFlush = true };

                await streamWriter.WriteLineAsync($"PASS {password}");
                await streamWriter.WriteLineAsync($"NICK {nick}");
                IsStarted.SetResult(true);

                System.Threading.ThreadPool.QueueUserWorkItem(async delegate (object unused)
                {
                    while (true)
                    {
                        string line = await streamReader.ReadLineAsync();
                        if (!String.IsNullOrEmpty(line))
                        {
                            if (line.EndsWith("Welcome, GLHF!"))
                                IsConnected.SetResult(true);

                            if (line.StartsWith("PING"))
                            {
                                string[] split = line.Split(" ");
                                await streamWriter.WriteLineAsync($"PONG {split[1]}");
                            }
                            else if (line.StartsWith("@badge-info") && (line.Contains("PRIVMSG") || line.Contains("msg-id=submysterygift")))
                            {
                                if (Properties.Settings.Default.DEBUG_MODE)
                                    logger.Info(JsonConvert.SerializeObject(line));

                                TwitchChatMessage msg = GetTwitchMessage(line);
                                OnMessage(this, msg);
                            }
                            else
                            {
                                if (Properties.Settings.Default.DEBUG_MODE)
                                    logger.Info(JsonConvert.SerializeObject(line));
                            }
                        }
                        else
                            OnError?.Invoke(this, EventArgs.Empty);
                    }
                });
            }
            catch (Exception ex)
            {
                logger.Error(ex);

                if (!Dashboard.IsFormClosing)
                {
                    if (ex.Message.Contains("The I/O operation has been aborted because of either a thread exit or an application request"))
                        OnRestartNeeded?.Invoke(this, EventArgs.Empty);
                    else
                        OnError?.Invoke(this, EventArgs.Empty);
                }
            }
        }

It seems to throw the error when it hits:string line = await streamReader.ReadLineAsync();
Any suggestions would be appreciated.
TIA


text:
Q: Configuring HTTP Request Methods in Symfony? I'm trying to get into Symfony for a project and I (sort of) have trouble figuring out how things work in Symfony. I've done these things a couple of times in Java Spring Boot before but this project needs me doing stuff in PHP and I want to learn too.
What I have basically done is create an Entity, Repository, Service and now I'm working on the controller.
I made the entity, repo and controller using make:entity (or make:controller)
The Service is supposed to wrap the repository and further abstract things.
My questions:

*

*In the Controller I have a constructor. Is that one actually called? I need it to initialize the Service it is used in

*How do I define what HTTP Request method needs to be used? I know how to specify routes, but how do I define if it is to be accessed as GET, POST, PUT, DELETE? The Symfony doc about controllers does not specify this.

*I have to find this out later so I think I'll ask here: If I want to persist an item through the api, I just pass the objects as json? (For example if I'm testing with postman)
Here's my Entity:
?php

namespace App\Entity;

use App\Repository\FahrzeugRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity(repositoryClass=FahrzeugRepository::class)
 */
class Fahrzeug
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=255)
     */
    private $fahrgestellnummer;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    private $tueren;

    /**
     * @ORM\Column(type="string", length=255)
     */
    private $modellbezeichnung;

    /**
     * @ORM\ManyToMany(targetEntity=Person::class, mappedBy="faehrt")
     */
    private $gefahren_von;

    /**
     * @ORM\ManyToOne(targetEntity=Marke::class, inversedBy="produziert")
     * @ORM\JoinColumn(nullable=false)
     */
    private $stammt_von;

    public function __construct()
    {
    $this->gefahren_von = new ArrayCollection();
    }

    public function getId(): ?int
    {
    return $this->id;
    }

    public function getFahrgestellnummer(): ?string
    {
    return $this->fahrgestellnummer;
    }

    public function setFahrgestellnummer(string $fahrgestellnummer): self
    {
    $this->fahrgestellnummer = $fahrgestellnummer;

    return $this;
    }

    public function getTueren(): ?int
    {
    return $this->tueren;
    }

    public function setTueren(?int $tueren): self
    {
    $this->tueren = $tueren;

    return $this;
    }

    public function getModellbezeichnung(): ?string
    {
    return $this->modellbezeichnung;
    }

    public function setModellbezeichnung(string $modellbezeichnung): self
    {
    $this->modellbezeichnung = $modellbezeichnung;

    return $this;
    }

    /**
     * @return Collection|Person[]
     */
    public function getGefahrenVon(): Collection
    {
    return $this->gefahren_von;
    }

    public function addGefahrenVon(Person $gefahrenVon): self
    {
    if (!$this->gefahren_von->contains($gefahrenVon)) {
        $this->gefahren_von[] = $gefahrenVon;
        $gefahrenVon->addFaehrt($this);
    }

    return $this;
    }

    public function removeGefahrenVon(Person $gefahrenVon): self
    {
    if ($this->gefahren_von->removeElement($gefahrenVon)) {
        $gefahrenVon->removeFaehrt($this);
    }

    return $this;
    }

    public function getStammtVon(): ?Marke
    {
    return $this->stammt_von;
    }

    public function setStammtVon(?Marke $stammt_von): self
    {
    $this->stammt_von = $stammt_von;

    return $this;
    }
}

My Repo:
<?php

namespace App\Repository;

use App\Entity\Fahrzeug;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

/**
 * @method Fahrzeug|null find($id, $lockMode = null, $lockVersion = null)
 * @method Fahrzeug|null findOneBy(array $criteria, array $orderBy = null)
 * @method Fahrzeug[]    findAll()
 * @method Fahrzeug[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
 */
class FahrzeugRepository extends ServiceEntityRepository
{
    public function __construct(ManagerRegistry $registry)
    {
    parent::__construct($registry, Fahrzeug::class);
    }

    // /**
    //  * @return Fahrzeug[] Returns an array of Fahrzeug objects
    //  */
    /*
    public function findByExampleField($value)
    {
    return $this->createQueryBuilder('f')
        ->andWhere('f.exampleField = :val')
        ->setParameter('val', $value)
        ->orderBy('f.id', 'ASC')
        ->setMaxResults(10)
        ->getQuery()
        ->getResult()
    ;
    }
    */

    /*
    public function findOneBySomeField($value): ?Fahrzeug
    {
    return $this->createQueryBuilder('f')
        ->andWhere('f.exampleField = :val')
        ->setParameter('val', $value)
        ->getQuery()
        ->getOneOrNullResult()
    ;
    }
    */
}

My Service
<?php

namespace App\Service;

use App\Entity\Fahrzeug;
use App\Repository\FahrzeugRepository;
use Doctrine\ORM\EntityManagerInterface;

class FahrzeugService {

    private FahrzeugRepository $fahrzeugRepository;

    public function __construct() {
    $this->injectRepository();
    }

    private function injectRepository() {
    $this->fahrzeugRepository = $this->getDoctrine()->getManager()->getRepository(Fahrzeug::class);
    }

    public function findById(int $id): Fahrzeug {
    return $this->fahrzeugRepository->find($id);
    }

    //Returns an array
    public function findAll(): array
    {
    return $this->fahrzeugRepository->findAll();
    }

    public function save(Fahrzeug $fahrzeug): Fahrzeug {
    $this->fahrzeugRepository->persist($fahrzeug);

    //TODO: gucken ob persist reicht oder ob man eine neue instanz erzeugen muss

    $this->fahrzeugRepository->flush();
    return $fahrzeug;
    }

    //TODO UPdate - kann man das auch mittels save machen?

    public function delete(Fahrzeug $fahrzeug): Fahrzeug {

    /*TODO: Herausfinden was auf der anderen Seite passiert
    Idealerweise wird auf der anderen Seite das Feld genullt
    */

    $this->fahrzeugRepository->remove($fahrzeug);
    $this->fahrzeugRepository->flush();
    return $fahrzeug;
    }
}

My Controller I'm working on:
<?php

namespace App\Controller;

use App\Entity\Fahrzeug;
use App\Service\FahrzeugService;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class FahrzeugController extends AbstractController
{

    private FahrzeugService $fahrzeugService;

    //TODO wird der Controller initialisiert?
    public function __construct() {
    $this->fahrzeugService = new FahrzeugService();
    }

    #[Route('/fahrzeugIndex', name: 'fahrzeug')]
    public function index(): Response
    {
    return $this->render('fahrzeug/index.html.twig', [
        'controller_name' => 'FahrzeugController',
    ]);
    }

    #[Route('/fahrzeug/{id}', name: 'fahrzeug')]
    public function findById(int $id): Fahrzeug {
    return $this->fahrzeugService->findById($id);
    }

    #[Route('/fahrzeug', name: 'fahrzeug')]
    public function findAll(): array {
    return $this->fahrzeugService->findAll();
    }

    #[Route('/fahrzeugIndex', name: 'fahrzeug')]
    public function save(Fahrzeug $fahrzeug): Fahrzeug {
    return $this->fahrzeugService->save($fahrzeug);
    }

    public function delete(Fahrzeug $fahrzeug): Fahrzeug {
    return $this->fahrzeugService->delete($fahrzeug);
    }
}

A: Dependency Injection in PHP/Symfony works different than in Java/Spring. If you want to inject a dependency, you have to add it to the constructor. That dependency will be automatically constructed using the dependency-injection-container built in symfony.
private FahrzeugService $fahrzeugService;
public function __construct(FahrzeugService $fahrzeugService)
{
   $this->fahrzeugService = $fahrzeugService;
}

You don't have to specify a method which injects the service. It is possible to change how your class (Controller/Service/etc.) is being created, but that's not the case here.
Once that's done, you can call methods in your FahrzeugService using
$this->fahrzeugService->[method]()

So in your case, you can use:
<?php

namespace App\Service;

use App\Entity\Fahrzeug;
use App\Repository\FahrzeugRepository;

class FahrzeugService {

    private FahrzeugRepository $fahrzeugRepository;

    public function __construct(FahrzeugRepository $fahrzeugRepository) {
       $this->fahrzeugRepository = $fahrzeugRepository;
    }

    //...
}

You don't have to get the repository from the EntityManager. It is possible, but you don't have to.
For your HTTP methods. You can specify the method in your annotations. Since you are already using the new annotations, you can use
#[Route('/fahrzeugIndex', name: 'fahrzeug', methods:['GET', 'POST'])]


text:
Q: What is meant by "A List is an ordered Collection..."? I am new to Collections and I am sorry in advance for the trivial question but I have been pondering on a one sentence I have read in Java tutorial that

A List is an ordered Collection (sometimes called a sequence).

What I have understood from it is that as I put elements in a list, it does automatic ordering for me and since I ran a simple code, it proved I was wrong:
List <String> list = new ArrayList<String>();

list.add("Chris");
list.add("Brian");
list.add("Matt");
list.add("Greg");

for (Iterator<String> it = list.iterator();it.hasNext();) {
    System.out.print(it.next()+"\n");
}

which resulted in this not being ordered in any way:
Chris
Brian
Matt
Greg

So my question is What is meant by "A list is an ordered collection" ?
Thanks

A: Ordered doesn't mean sorted, it means that the items will show up in the order you put them in.
This is in contrast to, say, a SortedSet where the items will not be ordered in the order you put them in, they will be sorted according to whatever sort criteria you put, or a HashMap, where they might show up in any order at all, depending on the hash function.

A:
A List is an ordered Collection (sometimes called a sequence).

This means that a List maintains the order of the elements.  In other words, the first element you add remains at index 0.  The second element you add remains at index 1.  And so forth.
If you remove an element, the rest of the elements remain in the same order, although the elements after the removed element change their index positions.

A: By ordered, it means that each element is assigned an index and can be referenced by that index.  In a Set, things don't have an index.

A: They are ordered in the order you put them in.  Not sorted as in alphabetically or numerically.  An unordered list (collection) would be like grabbing marbles out of a bag.

A: It simpy means if you put objects in in a certain order they will remain in that order. Note how your names come out in the same order as you put them in.
Compare this to a set (annother type of collection) in which they come out in a random order (because internally the set has no order). This can give performance advantages and if order is unimportant its usual to use a set, if it is important use a list.


text:
Q: Screen orientation in tablet I am using the same code for both tablets and mobile, and I want to write an app for Xlarge screens with landscape. I wrote one condition but when I am rotating into portrait it generates an exception.
I have declared the condition:
final boolean isPortrait = getResources().getConfiguration().orientation ==Configuration.ORIENTATION_PORTRAIT;

I want code with if else condition using xlarge and landscape orientations but it should work for only tablets but while coming to mobile it should not work.

A: There are two methods to make an application full screen. The first simply states the application supports a specific dpi. The following code in the Manifest supports all dpis.
 <supports-screens android:smallScreens="true"
              android:normalScreens="true"
              android:largeScreens="true"
              android:xlargeScreens="true"
              android:anyDensity="true" />


text:
Q: How many quanta can travel at light speed relative to each other simultaneously?
How many quanta can travel at light speed relative to each other simultaneously?

I know the concept of being "simultaneous" breaks down at a distance so let's assume for the sake of argument that all of the quanta pass within an arbitrarily close distance of each other at some "moment in time".
In classical mechanics, we can ask the slightly different question of "how many paths can be orthogonal to each other simultaneously?" the answer seems fairly obviously "three" because of the three dimensions we perceive.
But I'd like to understand whether there are different answers in other representations of the universe, such as quantum theory, general relativity, the standard model and supersymmetry.  What's the maximum number of quanta which can all be all travelling orthogonal to each other, and does this change with the added condition that they be travelling at light speed?

A: As the comments point out, there's no measuring velocity from the frame of something traveling at $c$. The question becomes non-relativistic if we take a single reference point not traveling at c and measure the rate of change of displacement (our proper length) with respect to time (our proper time) between the quanta, rather than asking the unanswerable question of relative velocity from the point of view of something traveling at $c$.
If we represent our $d\vec s/dt$ vectors graphically, we're just trying to find a configuration of vertices with equal lengths between all vertices. In two dimensions, this is an equilateral triangle. In three dimensions, it's an equilateral tetrahedron (a triangular pyramid).
So, the number of quanta between which we can measure a rate of change of displacement equal to c is four, one for each vertex.
One example, with three massless quanta and one massive quanta, would be three receding at c away from us along the near edges of an equilateral tetrahedron (60 degrees of angular distance between each of the three paths), and one stationary next to us.
We can also do this with four massive quanta. In that case, again, this is a non-relativistic problem. Set it up by starting us at the center of an equilateral tetrahedron. We fire one bullet towards each vertex at velocity $dr/dt = v$. The displacement vector between each bullet is the long edge of a 30-30-120 triangle with a short edge of length v, so the long edge has a length of $\sqrt {3} v$. Solve for v to get $c = ds/dt = \sqrt{3} v \implies v = c/\sqrt{3}$
Now we can give all four quanta any additional velocity $\vec u$ relative to us that we want provided that $|\vec v + \vec u| < c$. In fact, the first case turns out to be just a special case of the four-massive-quanta case at the limit of
$|\vec v_1 + \vec u| \to c$
$|\vec v_2 + \vec u| \to c$
$|\vec v_3 + \vec u| \to c$
$|\vec v_4 + \vec u| \to 0$
The other possibilities: all four massless, two massive and two massless, just one massless, are no good.

Extra notes
We can measure from the point of view of the massive quanta in this set up, since measuring from the point of view of something is the same as setting choosing a frame from which its velocity is zero. Note, however, that for the case of four massive quanta, our quanta will not agree with us about their relative rates of change of displacement unless we are already in their rest frame. Switching between non-comoving frames means you must lorentz transform, which will change the angles and displacements, squashing your equilateral tetrahedron.
Note that of course the speed limit of the rate of change of displacement between two objects as measured from the frame of a third is 2c, since we can point a beam of light in one direction and point a different beam of light in the opposite direction. The number of things that can have that, obviously, is 2. If we put ourselves at the center of a tetrahedron and shoot a laser out through each vertex, $ds/dt$ of the edges is $\sqrt{3}c$.


text:
Q: Running task periodicaly(once a day/once a week) I want to run some task (i.e. get my web site news page) periodically (once a week/ a day), even if my application is closed. Is it possible?

A: Yes it is, you need to look at the AlarmManager to setup a reoccurring "Alarm". This is better for battery life on the device, as unlike a service it does not run constantly in the background. The Alarm triggers a broadcast receiver which will execute your custom code.
As a final note - there are enum values for the timing of the Alarm including daily, half daily and many more although you can just set an actual value.
A good example can be found in the follow SO post:
Alarm Manager Example
Update
Newer features have been added to Android. If you are reading this then I would advise you now look into GcmNetworkManager. This optimises battery life and works pre-lollipop. For Lollipop onwards you can use JobScheduler. I would advise using these classes over the AlarmManager.

A: I think the best fit is GcmNetworkManager. Basically it has everything you need from AlarmManager plus persistence, so job can proceed executing after reboot.
Example:
PeriodicTask task = new PeriodicTask.Builder()
        .setService(MyTaskService.class)
        .setTag(TASK_TAG_PERIODIC)
        .setPeriod(5L)
        .build();

mGcmNetworkManager.schedule(task);

A: As an alternative I'm comparing the current week:
Calendar cal = Calendar.getInstance();
int currentWeekOfYear = cal.get(Calendar.WEEK_OF_YEAR);

SharedPreferences sharedPreferences= this.getSharedPreferences("appInfo", 0);
int weekOfYear = sharedPreferences.getInt("weekOfYear", 0);

if(weekOfYear != currentWeekOfYear){
    SharedPreferences.Editor editor = sharedPreferences.edit();
    editor.putInt("weekOfYear", currentWeekOfYear);
    editor.commit();
    // Your once a week code here
}

I'm not advocating this is better than the Alarm solution. I'm just showing a different approach.


text:
Q: C# PDF Generation (using IronPDF on Azure) I am generating PDF documents successfully in an Azure Web Application written using IronPDF as our PDF rendering engine.  The use case is generate PDFs of financial statements and invoices in C# as part of a wider closed business application.
Everything is working well in local development and HTML To PDF document generator functionality is exactly as we needed. Taking the PDF generator into staging we are noticing slow rendering times.
 These sometimes cascade into a backlog of PDFs in a request queue which can lead to timeouts from web requests when the wait goes over 30 seconds. Our code is not unusual and carefully follows steps in the Ironpdf C# PDF creation tutorial: https://ironpdf.com/tutorials/html-to-pdf/
PM> Install-Package IronPdf
var Renderer = new IronPdf.HtmlToPdf();
Renderer.RenderHtmlAsPdf(templateHTML);

templateHTML is unique for each render, and contains links to CSS and images.
How can our developers enhance PDF rendering performance and enable multithreading for the IronPdf.HtmlToPdf PDF generator class?
Are there known limitations for using IronPdf to generate a PDF file in C# on Azure in .NET?
To be clear, I am not soliciting advice on other 3rd party C# PDF libraries, simply how to best implement and optimize our chosen solution.
To clarify the question given clear context:

*

*Which Azure web application or function plan will give optimal HTML to PDF generation performance using IronPDF in .NET Core

*How can I render multiple PDF documents simultaneously using IronPDF on Azure

A: I work for IronSoftware as a QA engineer and find myself uniquely able to provide advice on this question about the IronPDF Nuget Packages for .NET.
Which Azure Plan: PDF File Rendering on Azure
For bulk Generating Pdf files in bulk, IronPdf in .NET applications on Azure I would highly recommend using the Basic B1 tier or higher, or the Premium Plan. The Free and Shared tiers, and the Consumption Plan, are not suitable for PDF rendering.  The reason for this is that it uses a complete web browser to create PDF files from HTML code.
We need to provision enough resources to treat each render as your browser would treat any web page - it can take a second or two. The IronPDF library works in Azure WebApps, Functions and WebJobs. It works in both Linux and Windows variants, although I would recommend Windows variant Functions and WebApps as significantly better tested and easier to install.
This is simply because Linux support for .NET is more recent. Windows has a longer history and is easier to configure permissions for a PDF generator use case!
Caveat: Rendering SVG fonts into a PDF Document
One known limitation for generating PDF files using C# we have found is that Azure hosting platform does not support servers loading SVG fonts, such as Google Fonts, in their shared web-app tiers. This is because these shared hosting platforms are not allowed to access windows GDI+ graphics objects for security reasons. These restrictions are not present in Linux, or Windows in Docker containers however. Docker containers can be a great way to go.
Reference: https://ironpdf.com/docs/questions/azure/
Multithreaded PDF Generation
At the date of writing IronPdf is thread safe, but not truly multithreaded.
Only one PDF file can be rendered at a time per .NET process. It has been a major drawback on PDF document creation performance until 2021.For example this will run one-by-one even though its called in parallel to generate pdf documents simultaneously.
// using System.Linq;
// using System.Threading.Tasks;

var Renderer = new IronPdf.HtmlToPdf();
// Where Htmls is an iEnumerable of HTML strings

Parallel.ForEach(Htmls, html =>
  {
   Renderer.RenderHtmlAsPdf(html);
   // works but not faster than formal foreach
  }

A solution is found by updating to IronPDF 2021.9 and above:

*

*Install it via Nuget https://www.nuget.org/packages/IronPdf

*API Documentation: https://ironpdf.com/object-reference/api/ (C# and VB.NET)
// PM> Install-Package IronPdf
// using System.Linq;
// using System.Threading.Tasks;IronPdf.Installation.DefaultRenderingEngine = IronPdf.Rendering.PdfRenderingEngine.Chrome;var Renderer = new IronPdf.HtmlToPdf();Parallel.ForEach(Htmls, html =>
  {
   Renderer.RenderHtmlAsPdf(html);
   // works in multiple threads !!
  }

In short: remove the old IronPDF Nuget package and replace it with IronPDF 2021.9 or above
IronPd 2021.9  is a ground up rebuild of our .NET PDF rendering technology:
Providing effortless multithreading and Async, using as many CPU cores as you wish. For SAAS and high-load applications this may be an order of magnitude faster; outperforming direct browser usage and web-drivers. You can also use the new 2021 API:
// using IronPdf;
// PM> Install-Package IronPdf
ChromePdfRenderer Renderer = new ChromePdfRenderer();
Renderer.RenderingOptions.FitToPaper = true;
Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Screen;
Renderer.RenderingOptions.PrintHtmlBackgrounds = true;
Renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
var doc = await Renderer.RenderHtmlAsPdfAsync ("
Hello world!
");

Azure is a first class citizen of the new IronPDF renderer which is based on the latest "Blink!" HTML string to pdf file rendering! Choose from Chrome Identical PDF creation or Enhanced rendering settings - which we find more accurate and easy to code for than Chrome.
We also recommend this route because it adds Section 508 accessibility compliance in C# PDF Generator : Producing accessible PDFs using the PDF(UA) tagged PDF standard.
The IronPDF team have maintained and improved full support for: .Net 5, Core and Framework 4.0+ support. We also tested it with 1156 green unit & integration tests in the current release (2021.9)

A: Usually you want to make it async by writing the request into a storage queue, and return immediately. Using Azure function(which is highly scalable) to process the requests from the queue.
Depending on the type of app, you can use a signalR channel to notify the UI that the pdf generation is  completed


text:
Q: iOS UIWebView goback or goforward always reload webView automatically, How can I stop the webview reload? iOS UIWebView goback or goforward always reload webView automatically, How can I stop the webview reload? Because some urls like "https://www.sina.cn/", If the webview request the url ,You'll notice that the webview can't goforward. And how do I deal with this situation?
You can see my code at https://github.com/misscxuan/WebBackTest

A: if the webview request the url as "https://www.sina.cn/", and request another url, then webview goback, you'll find webview can't goforward.

A: You could stop the load task in the UIWebviewDelegate Method - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType.


text:
Q: How to get Flask to see Vue build files without using webpack? I'm pretty new to Vue and modern web development in general, so I apologize in advance. Here's the situation.
I'm trying to make a simple Flask app that uses Vue and Vuetify on the frontend. When I look up tutorials for how to marry Flask to Vue (like this one), it relies on webpack, and I can get it working just fine. When I tried to add Vuetify to the project based on the instructions of their Quick start guide, I discovered that it requires you must follow the Existing Applications guide since the project was not initialized using vue-cli3 (see bug report here). I tried following those instructions but gave up after a few confusing hours with no results.
After reading up on webpack, I've decided that for my specific application, I can afford not to use it. So I went back to the Vuetify Quick Start guide and followed the New Applications instructions, fired up Flask and this is what I get:
127.0.0.1 - - [21/May/2019 18:31:20] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/May/2019 18:31:20] "GET /js/app.c12f4ec0.js HTTP/1.1" 404 -
127.0.0.1 - - [21/May/2019 18:31:20] "GET /css/chunk-vendors.b7bc2226.css HTTP/1.1" 404 -
127.0.0.1 - - [21/May/2019 18:31:20] "GET /js/chunk-vendors.2eb58769.js HTTP/1.1" 404 -
127.0.0.1 - - [21/May/2019 18:31:21] "GET /js/app.c12f4ec0.js HTTP/1.1" 404 -
127.0.0.1 - - [21/May/2019 18:38:22] "GET /index.html HTTP/1.1" 404 -

The code in question:
from flask import Flask, render_template

app = Flask(__name__,
            static_folder="./test/dist",
            template_folder="./test/dist")

@app.route('/')
def index():
    return render_template("index.html")

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=5000, debug=True)

For the most part the Vue code is just a new project with Vuetify installed. The only change I made was in main.js where I changed what the delimiters would be so that they don't conflict with Jinja2.
import Vue from 'vue'
import './plugins/vuetify'
import App from './App.vue'

Vue.config.productionTip = false

new Vue({
  render: h => h(App),
  delimiters: ["[[", "]]"],
}).$mount('#app')

My three main questions are:

*

*What's wrong with the path the Flask is using to look for the static and template files?

*Is it possible to use Vue with Flask without webpack?

*If it is not possible, would someone kindly do an eli5 of how to integrate Vuetify into a webpack based Vue project?

Thanks in advance!

A: Okay so I found the answer, and it turned out to be way easier than I was making it out to be. To make it easier to replicate my steps, I'm going to start from the top.
app.py
from flask import Flask, render_template

app = Flask(__name__,
            static_folder="./test/dist", # place that webpack builds to
            template_folder="./test/dist")

@app.route('/')
def index():
    return render_template("index.html")

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=5000, debug=True)

In the same directory as app.py run these commands (assuming you already have vue-cli installed):
$ vue init webpack vue-app-name
$ cd vue-app-name
$ yarn add vuetify # or use npm install vuetify --save

Now you basically just follow the instructions from the Existing Applications section of the Vuetify Quick Start page:
Top of main.js
import Vue from 'vue'
import App from './App'
import Vuetify from 'vuetify'
import 'vuetify/dist/vuetify.min.css' // Ensure you are using css-loader

Vue.config.productionTip = false
Vue.use(Vuetify)

<head> section of index.html
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <title>frontend</title>
  <link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons' rel="stylesheet">
</head>

And finally in the build section of index.js change the directory that web pack outputs its build to:
// Template for index.html
index: path.resolve(__dirname, '../../dist/index.html'),

// Paths
assetsRoot: path.resolve(__dirname, '../../dist'),

At this point, if you run
$ yarn build # or npm run build
$ cd ..
$ python app.py

and pop open your web browser, you should see the default Vue HelloWorld page, and you have Flask working with Vue, Vuetify and webpack all in one.
This is where I got confused. If you follow the instructions for a new Vuetify project and run the dev server, they have their own custom Hello World page. However because the Hello World page was still the default Vue page, I took it to mean that Vuetify was not installed. Really what's happening is that they have different App.vue and HelloWorld.vue files. If you replace the regular App.vue and HelloWorld.vue files with the Vuetify ones, copy the logo.svg file into the assets folder and rerun the dev server, you will get the Vuetify landing page.
Anyways, I feel like an idiot, but hopefully, this helps out another Flask/Vue/Vuetify/Webpack newbie.
This was done using python 3.7.3 and vue-cli 3.7.0

A: I have multiple projects with Vue and Flask and have found that webpack is the best approach. I disliked the Vue-CLI becuase it was too difficult to specify the paths of local files and bundled files on build. I know it is a learning curve at first but worth the day or two if you invest the time.
You should use Flask-Webpack to allow flask to locate assets which have been hashed and bundled. Along with a webpack plugin to create the manifest JSON that provides the link. When using flask webpack you also need to specify you folder paths directly as you have done.
I have this setup in my webpack config:
const ManifestPlugin = require('webpack-manifest-plugin')
...
plugins: [
    new ManifestPlugin({
      writeToFileEmit: true,
      seed: {
        publicPath: '/'
      },
      generate: (seed, files) => ({
        ...seed,
        'assets': files.reduce((manifest, { name, path }) => ({ ...manifest,
        [name]: path }), {})
      })
   })
]

this creates a manifest.json file which looks like this:
{"assets":{"base_css.css":"static/css/base_css.1bf3ff18.css",
           "base_css.js":"static/js/base_css.1e6b291b.js",
           "chunk-vendors.js":"static/js/chunkvendors.f92da40c.js",},
 "publicPath":"/"}

Having setup your project I envision it is fairly straight forward to add Vuetify following the add to existing project using npm and imports.

Do note that when using Vue-Cli and/or webpack you cannot change the vue delimiters. From the API docs on delimiters: "Restrictions: This option is only available in the full build, with in-browser compilation."

But this last point shouldn't be a problem since your html templates and vue templates will be separately decoupled so the {{ }} crossovers wont matter, they are contextual.

A: I was facing a similar issue. The answer provided by @clayton-ramstedt provided 200 status code but it was loading a blank page instead of the required static UI. Reason being that the index.html referred various other JS and CSS files and the above answer returned index.html for all of them.
The below code worked for me.
from flask import Flask, send_from_directory
import os

app = Flask(__name__,
            static_folder="./test/dist",
            template_folder="./test/dist")

@app.route("/", defaults={"path": ""})
@app.route("/<path:path>")
def serve_frontend(path):

    if path != "" and os.path.exists(app.static_folder + '/' + path):
        return send_from_directory(app.static_folder, path)
    return send_from_directory(app.static_folder, 'index.html')

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=5000, debug=True)

This will render JS and CSS files properly and when we hit some other routes (like /login or /dashboard) those will be handled by index.html accordingly.
Make sure to provide path converter type because the default string type will not render the JS and CSS files which contain slashes.


text:
Q: Move validator message inside function I have a custom validator. I want to move the validator message inside the my_validator hook function.
$this->validate($request, [
            'package_name' => 'required',
            'package_version' => 'required|my_validator'
        ],
        [
            'my_validator' => 'Some custom message.'
        ]);

A: There are only two ways to add your validation message:

*

*Using the $message array when using the validate function (as you've already done).

*Adding your message to the resources/lang/en/validation.php lang file, as below:

return [
    // ...
    'my_validator' => 'Some custom message.',
    // ...
];


text:
Q: bootloader printing on video memory 0xb8000 I am 3-4 days old in assembly programming. trying to print a string in video memory and running through qemu.
I expected this program to print Hallo world. But it prints nothing. qemu window prints "Booting From Hard Disk ..." Nothing else
Is it only 16 bit that is allowed in bootloader ? in that case how will I do MMIO ? I was following actual page 32 [ENTERING 32-BIT PROTECTED MODE] of http://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf
[bits 32]
[org 0x7c00]

loop:
    mov edx, 0xb8000
    mov ah,  0x0f

    mov ebx, message
    mov ecx, 0x0
    call draw_string

    ;jmp self_loop
    ;jmp loop

self_loop:
    jmp self_loop

; take the stream begining from ebx
draw_string:
    mov al, [ebx]
    mov ah,  0x0f

    mov [edx], ax
    add ebx, 1
    add edx, 2

    cmp al, 0

    jne draw_string
    ret

message:
    db 'Hallo World', 0x0

times 510 -( $ - $$ ) db 0  ; When compiled , our program must fit into 512 bytes ,
                ; with the last two bytes being the magic number ,
                ; so here, tell our assembly compiler to pad out our
                ; program with enough zero bytes (db 0) to bring us to the
                ; 510th byte.
dw 0xAA55           ; Last two bytes (one word) form the magic number ,
                ; so BIOS knows we are a boot sector.

A: Example for the 16 bit realmode segmented addressing at CPU startup, where the default segment size is limited to 64 KB. In the real mode we can use 32 bit offset register(80386+), but an offset-address have to be pointed inside of the 64 KB size of the segment limit and can not be pointed to an address outside of the 64 KB segment size. (Because we do not need 32 bit offset register for to access an offset between 0 to FFFF, i use 16 bit offset register for this example.) For to access more than only 64 KB we can use an other segment register and/or we can store an other segment address into a segment register.
...
Because the bytes of the hello world message are placed into the code segment, we want to use the same segment address for the data segment register, for to get each byte of the message.
mov ax,cs
mov ds,ax

Now we store the segment address of the textmode video buffer in the extra segment register.
mov ax,0xb800  ; = this is a segment address and not a linear offset address
mov es,ax

lea bx,message ; Now we get the source address in BX
mov di,0x0     ; and the target address for output (upper left corner) in DI

call draw_string

self_loop:
jmp self_loop

; take the stream begining from DS:bx
draw_string:
mov al,[bx]    ; load a byte from the address of DS:BX
mov ah,0x0f

mov es:[di],ax ; store a word to the address of ES:DI
add bx,1
add di,2       ; increasing the target offset address

cmp al,0
jne draw_string
ret


text:
Q: How to convert this string to a javascript array? I am getting this error when I try to JSON.parse this string "['Answer 1', 'Answer 2']"
Uncaught SyntaxError: Unexpected token ' in JSON at position 1
    at Object.parse (<anonymous>)
    at <anonymous>:1:6

Can anybody tell me how to do it?

A: You need to replace all single quote(') into double quote(") to parse to javascript array.

const input = "['Answer 1', 'Answer 2']";
const output = JSON.parse(input.replaceAll("'", '"'));
console.log(output);


text:
Q: How to move a gameobject using movetowards How do I make my GameObject move towards another GameObject using Vector3.MoveTowards method?
Heres my current code:
void update()
{
    TargetObject.transform.position = Vector3.MoveTowards (TargetObject.transform.position, Cube.transform.position , MaxDistanceDelta);
}

A: void Update() {
    myGameObject.transform.position = Vector3.MoveTowards(myGameObject.transform.position, targetObject.transform.position, Time.deltaTime * speed);
}

*

*myGameObject - object you want to move

*targetObject - object you are moving to

*speed - float value to set the speed

A: First, let's see the details and parameters of the method:
MoveTowards(Vector3 current, Vector3 target, float maxDistanceDelta);

Understanding the parameters

*

*Vector3 current: 3D vector of the object position (example: new Vector(0,0,1))

*Vector3 target: 3D vector of the target position (example: new Vector(3,4,5))

*maxDistanceDelta: maximum distance that the object will move when the method is called. (Example: if maxDistanceDelta is 1, the object will move 1 unit every time it's called. In case we are not using Time.deltaTime it would move 50 units a second if the frame rate is 50)

Note: If the actual distance remaining is less than maxDistanceDelta, it will be placed on target position. Meaning the object will  no longer move unless the target position changes.
Example:
Declaring the variables:
public float speed;
public Transform target;

Using the method:
transform.position = Vector3.MoveTowards(
      transform.position,
      target.position,
      speed * Time.deltaTime
);


text:
Q: Greatest relativistc mass possible for a single photon I have been told that photons can not be blue shifted to the point where they become black holes, although a photon with a Planck scale wavelength would also have a relativistic mass equal to a black hole with a Schwarzschild radius on the scale of its wavelength.  (Imagine a photon stuck in a loop around its own relativistic mass).
So my question now is, what are the limits of relativistic mass or momentum that a single photon could have?
Also, by extension, how short a wavelength could it have?  If the wavelength gets to the Planck scale does it become a particle, or matter?

A: In modern terminology, mass means invariant mass. See Why is there a controversy on whether mass increases with speed? . The mass of a photon is zero. So to make this question more intelligible based on modern usage, a better title would be "Greatest energy possible for a single photon."

I have been told that photons can not be blue shifted to the point where they become black holes

This is true because the criterion for being a black hole (light can't escape to infinity) is observer-independent. It doesn't mean that there's a limit on how much of a blueshift you can have. There is no such limit. Although it is true for a collapsing star, in its rest frame, that $r/m \lesssim G/c^2$ is a criterion for being a black hole, this is not true in other frames of reference. It would make sense in terms of Newtonian mechanics if the criterion was $r/m \lesssim G/c^2$, but general relativity is different because in GR the source of gravity isn't mass, it's the stress-energy tensor.

Also, by extension, how short a wavelength could it have.

We don't have a theory of quantum gravity, so we don't know for sure how to interpret the Planck length. However, it probably shouldn't be interpreted as a minimum length scale. That would violate Lorentz invariance.

If the wavelength gets to the Plank scale does it become a particle, or matter?

A photon is both a wave and a particle regardless of its wavelength. Modern physicists don't really use the term "matter" much, but to the extent that they do, they mean fermions. A photon is a boson regardless of its wavelength.


text:
Q: how livereload builded file with SASS on sublime text 4? I install sublime text plugin :
SublimeOnSaveBuild
LiveReload
SASS Build

I have livereload plugin on navigator, it's works fine on .css file
now, I want works with .sass file, so I add my own buildscript :
{

  "cmd": [
    // "/home/matrix/.rbenv/shims/sass",
    // "--update",
    // "--stop-on-error",
    // "--no-cache",
    // "--style", "compressed",
    // "--sourcemap=none",
    // "--load-path", "${file_path}",
    // "$file:${file_path}/../css/${file_base_name}.min.css",

    // "&",

    // "sass",
    "/home/matrix/.rbenv/shims/sass",
    "--watch",
    // "--update",
    "--stop-on-error",
    "--no-cache",
    "--sourcemap=none",
    "--load-path", "${file_path}",
    "$file:${file_path}/../css/${file_base_name}.css"
  ],

  "selector": "source.sass, source.scss",
  "line_regex": "Line ([0-9]+):",

  "osx":
  {
    "path": "/usr/local/bin:$PATH"
  },

  "windows":
  {
    "shell": "true"
  }

}

I don't find how include /home/matrix/.rbenv/shims/ in PATH, so I put here, it's works fine, with SublimeOnSaveBuild it generate .css from .sass each time I save.
If I change and save .css, liveReload continue to works fine, but there is no cascading trigger reload, so when I save .sass, it make .css but nothing was reload on browser, if I go in .css generated and save it, it will realod.
My problem is : how tell to livereload watching css file ?
I tried to change --update to --watch in script but nothing change
BONUS problem : if I tried to launch both cmd (commented), the & cause an syntax error, so I don't know how make min and normal file at same time
BONUS problem 2 : unminimified css file look like :
#formulaire fieldset {
   background-color: rgba(40, 160, 0, 0.2);
   font-size: 17px; }

how can I configure output syntax, with brcket at the line, like :
#formulaire fieldset
{
   background-color: rgba(40, 160, 0, 0.2);
   font-size: 17px;
}

A: You can use Gulp live-reload

*

*Install gulp live-reload npm install gulp gulp-sass gulp-livereload express --save-dev
Futher i leave it to you


text:
Q: No inline css, simple css file? I'm struggling HARD to simply adjust css.
Wordpress creates a lot of unneccessary inline css, with styles for every block of content. As of right now we're up to '.wp-block-78' or something like that, while I'd love to have a way of having no inline css, with a css file which has the properties for classes like h2 or custom classes. Is that possible? Thank you in advance!
As an example of what I'd love the html and css to look like I dug out this: https://www.styleshout.com/demo/?theme=augustine

A: It depends on the theme, but you should be able to target all h2s in content with a selector like .entry-content h2, or manually add classes and target those. (Just make sure to use a consistent class name.)


text:
Q: My Service is not working on Android, why? It's code here:
public class MyServeice extends Service
{
    private Timer pushTimer;
    private final int NOTEF_ID = 1234;
    NotificationManager manager;

    @Override
    public IBinder onBind(Intent arg0)
    {
        return null;
    }

    @Override
    public void onCreate()
    {
        Log.i("MyActivity", "1");
        //pushTimer = new Timer();
        manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
    }

    @Override
    public void onDestroy()
    {
        Log.i("MyActivity", "2");
        //pushTimer.cancel();
    }

    @Override
    public void onStart(Intent intent, int startid)
    {
        Log.i("MyActivity", "3");
        //pushTimer.schedule(new TimerTask()
        //{
        //  @Override
        //  public void run()
        //  {
                Notification not = new Notification(R.drawable.ic_launcher, "Custom notification", System.currentTimeMillis());
                PendingIntent notIntent = PendingIntent.getActivity(this , 0, new Intent(this, MainActivity.class), 0);
                not.setLatestEventInfo(this,  "Title", "Text", notIntent);
                manager.notify(NOTEF_ID, not);
                manager.cancel(NOTEF_ID);
        //  }
        //}, 0L, 60L * 1000);
    }

}

I try to start it from my MainActivity activity class (before I thought that problem is in timer, but now I comment it).
Starting code here:
startService(new Intent(this, MyServeice.class));
Log from Service class is not shown, so I decided that Service is not started at all. Application doesn't crash and started normaly. Can you check my code?

A: You made a mistake in MyServeice Class
You use
 @Override
 public void onStart(Intent intent, int startid)

& in Service Life cycle there is no onStart(..) Method
Try this method instead of above
  @Override
  public int onStartCommand(Intent intent, int flags, int startId)

EDIT:
& second One you have to declare service in Manifest File Like:
<manifest ... >
  ...
  <application ... >
      <service android:name=".MyServeice" />
      ...
  </application>
</manifest>

For more Information About Service Refer this Documentation
 http://developer.android.com/guide/components/services.html

A: Use this method :
@Override
public int onStartCommand(Intent intent, int flags, int startId) {}

Here is good tutorial about services : Click here !

A: Question closed. Adding info about my service class into manifest  solved my problem.