text:
Q: Build Next.JS and tailwindcss I use TailwindCSS and NextJs for my app.
Everything is working when I npm run dev but when I npm run build then npm run start I have some classes that aren't working. For exemple in this code, h-20 / text-white don't work but other tailwind classes are perfectly working...

Acheter 200 €

There is my confs :
//next.config.js

module.exports = {
    images: {
      domains: ["picsum.photos"],
    },
    env: {
      customKey: 'my-value',
    }
  }

//postcss.config.js

module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
}

//tailwind.css

module.exports = {
  purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {
      backgroundColor: theme => ({
        ...theme('colors'),
        'blue-primary': '#A9C4D2',
        'blue-secondary': '#bbd9e8',
        'blue-hover': '#74afcd',
        'alert-info': '#d5e9f3',
        'alert-warning': '#ffd585',
        'alert-danger': '#ffb3b3'
      }),
      textColor: theme => ({
        ...theme('colors'),
        'blue-primary': '#A9C4D2',
        'blue-secondary': '#bbd9e8',
        'blue-hover': '#74afcd',
        'alert-info': '#d5e9f3',
        'alert-warning': '#ffd585',
        'alert-danger': '#ffb3b3'
      }),
    },
    flex: {
      '1': '1 1 0%',
      '2': '2 2 0%',
      '3': '3 3 0%',
      '4': '4 4 0%',
      '5': '5 5 0%',
      auto: '1 1 auto',
      initial: '0 1 auto',
      inherit: 'inherit',
      none: 'none',
    }
  },
  variants: {
    extend: {},
  },
  plugins: [],
}

//jsconfig.json

{
    "typeAcquisition": {
        "include": ["jest"]
    }
}

//_app.js

import Navigation from '../componsants/navigation/Navigation'
import '../styles/globals.css'
import 'tailwindcss/tailwind.css'

function MyApp({ Component, pageProps }) {

  return (
    <>

        <Navigation />
        <Component {...pageProps} />

    </>
  )
}

export default MyApp

I don't know if you have any ideas ?
I followed tailwind docs, but it looks like it's not enough ahah
Thx

A: I found the answer in an other post and testing
Because I have some components that are on conditionnal rendering and while building my app tailwind don't create the classes
To solve this you can :

*

*Delete the purge in tailwind conf (but it should be temporary)

*Create components and declaring all the classes you have to

A: If some classes are not working, and another working = check your tailwind.css
Also, you have the example Nextjs - Tailwind
P.S. Your code test


text:
Q: Escape special characters in Apache pig data I am using Apache Pig to process some data.
My data set has some strings that contain special characters i.e (#,{}[]).
This programming pig book says that you can't escape those characters.
So how can I process my data without deleting the special characters?
I thought about replacing them but would like to avoid that.
Thanks

A: Have you tried loading your data?  There is no way to escape these characters when they are part of the values in a tuple, bag, or map, but there is no problem whatsoever in loading these characters in when part of a string.  Just specify that field as type chararray.
The only issue you will have to watch out for here is if your strings ever contain the character that Pig is using as field delimiter - for example, if you are USING PigStorage(',') and your strings contain commas.  But as long as you are not telling Pig to parse your field as a map, #, [, and ] will be handled just fine.

A: Easiest way would be,
input = LOAD 'inputLocation' USING TextLoader() as unparsedString:chararray;

TextLoader just reads each line of input into a String regardless of what's inside that string. You could then use your own parsing logic.

A: When writing your loader function, instead of returning tuples with e.g. maps as a String (and thus later relying on Utf8StorageConverter to get the conversion to a map right):
Tuple tuple = tupleFactory.newTuple( 1 );
tuple.set(0, new DataByteArray("[age#22, name#joel]"));

you can create and set directly a Java map:
HashMap<String, Object> map = new HashMap<String, Object>(2);
map.put("age", 22);
map.put("name", "joel");
tuple.set(0, map);

This is useful especially if you have to do the parsing during loading anyway.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Matrices and linear maps End($V$) of infinite dimension I am struggling to understand the following concept required to solve a task that I found in my Algebra book.
The task: Let $V$ be (a possibly infinite-dimensional) vector space and $A$ an endomorphism. Furthermore let $\sigma(A)$ be the set of Eigenvalues of $A$ (analogously for the endomorphism $B$). Show that $\sigma(AB)\setminus\{0\}=\sigma(BA)\setminus\{0\}$.
My initial instinct was to represent $A$ and $B$ as $n\times n$ matrices and do some brute-force calculation and show that the characteristic polynomials of $AB$ and $BA$ are similar. However, I am having second doubts regarding the representation of $A$ and $B$ as $n\times n$ matrices as I cannot represent the basis of $V$ in only $n$ variables (it might be infinite-dimensional).
This concern left me in doubt whether I should solve it with matrices at all or somehow express the eigenvalues through $(A\circ B)(v)=\lambda v$. Any clarification would be much appreciated!

A: The idea or motivation from the finite dimensional case is that $AB$ and $BA$ are "almost similar." Like, we have $B(AB)B^{-1} = BA$ except $B$ might not be invertible. So you have to work around the non-invertibility by assuming you're not in $\ker B$ or something like that.
So suppose $v$ is an eigenvector of $AB$ corresponding to a non-zero eigenvalue $\lambda$. Then what we would like to do is define a vector $w$ such that $B^{-1}w = v \iff w = Bv$ and then we have
$$BAw = B(AB)B^{-1}w = B(AB)v = B(\lambda v) = \lambda Bv = \lambda w.$$
Now this works fine if $B$ is invertible. If $B$ is not invertible then all we need to do to fix this is to cut out the second expression:
$$BAw = B(AB)v = B(\lambda v) = \lambda Bv = \lambda w.$$
Therefore $\lambda$ is an eigenvalue of $BA$ corresponding to the non-zero (!!) eigenvector $w = Bv$.


text:
Q: Execute async method inside onLocationChanged() I have a class which extends from AsyncTask and gets data in JSON format from a web service. My android app has to retrieve data asynchronously whenever the location is changed. My android activity implements LocationListener and I am invoking the asynchronous execution in onLocationChanged() method. I have tried setting zero for both minTime and minDistance parameters of requestLocationUpdates() method but the data which is to be retrieved asynchronously is never retrieved.
The code for my onCreate() and onLocationChanged() methods is given below
@Override
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_nearby);

        locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);

        // Hashmap for ListView
        albumsList = new ArrayList<HashMap<String, String>>();
    }

@Override
    public void onLocationChanged(Location location) {

        latitude = String.valueOf(location.getLatitude());
        longitude = String.valueOf(location.getLatitude());

        new MyAsyncTask().execute();
    }

The latitude and longitude variables are used in the MyAsyncTask class for getting data with respect to user's current location.
Please tell me what's wrong with my code. I have been looking for the solution since last week but haven't found any.

A: did tried debugging??
 or
Log??
 are you getting any error???
sometimes the location.getLatitute() and location.getLatitute() returns null which may cause null pointer Exception..
that may stopped  reaching the MyAsyncTask()
check this may help you..
@Override
    public void onLocationChanged(Location location) {
       double latit =null;
       double longi =null;
       do
       {
         latit=location.getlatitude();
         longi=location.getlongitude();
       }while(latit!=null && longi!=null);

       latitude = String.valueOf(location.getLatitude());
       longitude = String.valueOf(location.getLatitude());

       new MyAsyncTask().execute();
    }

The getlatitude() and getlongitude() function will return double value check this documentation
http://developer.android.com/reference/android/location/Location.html#getLatitude()

A: oke, a little bit confused but let me understand it. You retrieve the data in onLocationChanged() ? example long=111 lat=222 and with your Asyntask you make a GET request to a WS with a json parameter probably long and lat and some other stuff in it ? and if you try to debugg it there are some values in logcat ? or some error ? or did you put the permision in the manifest file ? or in the phones settings ?

A: Oops My Bad!
The correct code is
@Override
public void onLocationChanged(Location location) {

    latitude = String.valueOf(location.getLatitude());
    longitude = String.valueOf(location.getLongitude());

    new MyAsyncTask().execute();
}


text:
Q: While using bash script to edit file works but at last shows error as "sed: can't read "No such file or directory" I am editing a file using bash script as below.
I have the file 'input.env' and I am editing certain key-value pairs using the below code
#! /usr/bin/bash
INPUTFILEPATH="/config/input.env"
DEVICEID=$(uuidgen)
echo "Device Id generated is: $DEVICEID"
sed -i "s/^DEVICE_ID.*/DEVICE_ID=$DEVICEID/" $INPUTFILEPATH

echo -n "Select the Environment: "
cat << EOF
1. ABC
2. DEF
EOF
read ENV

case $ENV in
  1)
    DPSHOST="abc.com"
    ACTIVEMQURL=178.25.11.5
    ;;

  2)
    DPSHOST="def.com"
    ACTIVEMQURL=178.27.1.9
    ;;
  *)
    echo "wrong choice of env and DPS HOST, ACTIVEMQURL not set"
    ;;
esac

echo "Setting DPSHOST as $DPSHOST"
sed -i "s/^DPS_PROVISIONING_HOST.*/DPS_PROVISIONING_HOST=$DPSHOST/" $INPUTFILEPATH

echo "Setting ACTIVEMQURL as $ACTIVEMQURL"
sed -i "s/^ACTIVEMQ_URL.*/ACTIVEMQ_URL=$ACTIVEMQURL/" $INPUTFILEPATH

echo "ALL ENV VARIABLES SET"

echo "Start to run setup"
sudo bash /setup_script/setup.sh

The last command could not run which triggers 'setup.sh'. All the variables are set right as per script but the error is shown as
Start to run setup
sed: can't read ../config/input.env: No such file or directory
sed: can't read ../config/input.env: No such file or directory
grep: ../config/input.env: No such file or directory
grep: ../config/input.env: No such file or directory

What could be the issue?

A: Just check the file exists and it's writeable before attempting to edit it
if [[ -w "$INPUTFILEPATH" ]]
then
    echo "Setting DPSHOST as $DPSHOST"
    sed -i "s/^DPS_PROVISIONING_HOST.*/DPS_PROVISIONING_HOST=$DPSHOST/" $INPUTFILEPATH

    echo "Setting ACTIVEMQURL as $ACTIVEMQURL"
    sed -i "s/^ACTIVEMQ_URL.*/ACTIVEMQ_URL=$ACTIVEMQURL/" $INPUTFILEPATH
else
    echo "Cannot write $INPUTFILEPATH"
fi


text:
Q: Escaping curly braces with angular.jstemplating in HTML  environment I've found a strange, weird behavior with the
 tag in HTML when used in conjunction with angular.js' method of data binding via curly braces. Given the data binding foo = 'bar', I want to write

{{{foo}}}

such that it prints

{bar}

within the
 environment.

It's no good to print { bar }, with the spaces. (This is ultimately used to generate BibTeX.) I've tried using the html entities { and }, as well as the <xmp> environment.

Any idea what's going on here? Thanks in advance.

A: You can try quoting the brackets:
{{ "{" + foo + "}" }}

Demo: http://plnkr.co/edit/4LG6jfAAzzcw4tQuoTSw?p=preview
You also might try making a function:
$scope.q = function(s) {
   return "{" + s + "}";
 }

{{ q(foo) }}

A: I had the same issue in one of my Angular pages, and even using the suggestion in Angular's own error message didn't help me.
What did work was simply to replace the opening curly bracket with { like this:

.popup {
    transform: translate(-50%, -50%);
    position: absolute;
    top: 50%;
    left: 50%;
}

This now shows the
 perfectly:

(By the way, this is the CSS you can use to easily vertically and horizontally center a
 in the middle of your browser !)


text:
Q: Chainsaws in Die2nite How do I make a chainsaw in Die2Nite? Or is it something that I have to pick up?

A: You have to find the incomplete chainsaw.  Then you also have to find an incomplete engine and build that.  Then you combine the two.  The net cost is 2 nuts & bolts plus a handful of other items, which is hard for a lot of people to swallow for a simple weapon.  But man does it rip through zombies.  Each attack kills 3 zombies, and you need to feed it a new battery about 1 in 3 attacks.  Best of all, after you've spent the batteries, your inventory is now free to carry back items.


text:
Q: D3.js MIndMap Layers so i have this script

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">

    <title>MMM PROJECT</title>

    <style>

 .node {
  cursor: pointer;
 }
 .node circle {
   fill: #fff;
   stroke: coral;
   r: 20 ;
   stroke-width: 3px;
 }
 .node text {
   font: 12px sans-serif;
 }
 .link {
   fill: none;
   stroke: #287233;
   stroke-width: 2px;
 }

    </style>

  </head>

  <body>

<!-- load the d3.js library -->
<script src="http://d3js.org/d3.v3.min.js"></script>

<script>
var treeData =[{"name" : "Master",
  "children" : [

    {"name" : "C++BIO",
     "parent" : "Master",
     "children" : [

      {"name" : "Semestre 7",
       "parent" : "C++BIO",
       "children" : [

          {"nane" : "UEs Obligatoires",
           "parent" : "Semestre 7",
           "children" : [
        {"name" : "Anglais",
         "parent" : "UEs Obligatoires"
         },
         {"name" : "Algo",
         "parent" : "UEs Obligatoires"
         },
         {"name" : "Unix",
          "parent" : "UEs Obligatoires"
         }
         ]
         },

          {"name" : "UEs Facultatives",
           "parent" : "Semestre 7",
           "children" : [
        {"name" : "Imagerie",
         "parent" : "UEs Facultatives"
         },
         {"name" : "Physique",
          "parent" : "UEs Facultatives"
          }
          ]
          }
          ]
          },

      {"name" : "Semestre 8",
       "parent" : "C++BIO",
       "children" : [

          {"nane" : "UEs Obligatoires",
           "parent" : "Semestre 8",
           "children" : [
          {"name" : "Allemand",
         "parent" : "UEs Obligatoires"
         },
         {"name" : "Truc",
         "parent" : "UEs Obligatoires"
         },
         {"name" : "Logiciel",
          "parent" : "UEs Obligatoires"
         }
         ]
         },

          {"name" : "UEs Facultatives",
           "parent" : "Semestre 8",
           "children" : [
        {"name" : "Maison",
         "parent" : "UEs Facultatives"
         },
         {"name" : "Dark Vador",
          "parent" : "UEs Facultatives"
          }
          ]
          }
          ]
          }
          ]
          },

  {"name" : "parcours 2",
     "parent" : "Master",
     "children" : [

      {"name" : "Semestre 7",
       "parent" : "C++BIO",
       "children" : [

          {"nane" : "UEs Obligatoires",
           "parent" : "Semestre 7",
           "children" : [
        {"name" : "Anglais",
         "parent" : "UEs Obligatoires"
         },
         {"name" : "Algo",
         "parent" : "UEs Obligatoires"
         },
         {"name" : "Leia",
          "parent" : "UEs Obligatoires"
         }
         ]
         },

          {"name" : "UEs Facultatives",
           "parent" : "Semestre 7",
           "children" : [
        {"name" : "Cheval",
         "parent" : "UEs Facultatives"
         },
         {"name" : "poney",
          "parent" : "UEs Facultatives"
          }
          ]
          }
          ]
          },

      {"name" : "Semestre 8",
       "parent" : "C++BIO",
       "children" : [

          {"nane" : "UEs Obligatoires",
           "parent" : "Semestre 8",
           "children" : [
          {"name" : "patate",
         "parent" : "UEs Obligatoires"
         },
         {"name" : "cornichon",
         "parent" : "UEs Obligatoires"
         },
         {"name" : "courgette",
          "parent" : "UEs Obligatoires"
         }
         ]
         },

          {"name" : "UEs Facultatives",
           "parent" : "Semestre 8",
           "children" : [
        {"name" : "Julie",
         "parent" : "UEs Facultatives"
         },
         {"name" : "Khaoula",
          "parent" : "UEs Facultatives"
          }
          ]
          }
          ]
          }
          ]
          }
          ]
          }
          ]
;
// ************** Generate the tree diagram  *****************
var margin = {top: 20, right: 120, bottom: 20, left: 120},
 width = 960 - margin.right - margin.left,
 height = 500 - margin.top - margin.bottom;

var i = 0,
 duration = 750,
 root;
var tree = d3.layout.tree()
 .size([height, width]);
var diagonal = d3.svg.diagonal()
 .projection(function(d) { return [d.y, d.x]; });
var svg = d3.select("body").append("svg")
 .attr("width", width + margin.right + margin.left)
 .attr("height", height + margin.top + margin.bottom)
  .append("g")
 .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
root = treeData[0];
root.x0 = height / 2;
root.y0 = 0;

update(root);
d3.select(self.frameElement).style("height", "500px");
function update(source) {
  // Compute the new tree layout.
  var nodes = tree.nodes(root).reverse(),
   links = tree.links(nodes);
  // Normalize for fixed-depth.
  nodes.forEach(function(d) { d.y = d.depth * 180; });
  // Update the nodes…
  var node = svg.selectAll("g.node")
   .data(nodes, function(d) { return d.id || (d.id = ++i); });
  // Enter any new nodes at the parent's previous position.
  var nodeEnter = node.enter().append("g")
   .attr("class", "node")
   .attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
   .on("click", click);
  nodeEnter.append("circle")
   .attr("r", 1e-6)
   .style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; });
  nodeEnter.append("text")
   .attr("x", function(d) { return d.children || d._children ? -13 : 13; })
   .attr("dy", ".35em")
   .attr("text-anchor", function(d) { return d.children || d._children ? "end" : "start"; })
   .text(function(d) { return d.name; })
   .style("fill-opacity", 1e-6);
  // Transition nodes to their new position.
  var nodeUpdate = node.transition()
   .duration(duration)
   .attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; });
  nodeUpdate.select("circle")
   .attr("r", 10)
   .style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; });
  nodeUpdate.select("text")
   .style("fill-opacity", 1);
  // Transition exiting nodes to the parent's new position.
  var nodeExit = node.exit().transition()
   .duration(duration)
   .attr("transform", function(d) { return "translate(" + source.y + "," + source.x + ")"; })
   .remove();
  nodeExit.select("circle")
   .attr("r", 1e-6);
  nodeExit.select("text")
   .style("fill-opacity", 1e-6);
  // Update the links…
  var link = svg.selectAll("path.link")
   .data(links, function(d) { return d.target.id; });
  // Enter any new links at the parent's previous position.
  link.enter().insert("path", "g")
   .attr("class", "link")
   .attr("d", function(d) {
  var o = {x: source.x0, y: source.y0};
  return diagonal({source: o, target: o});
   });
  // Transition links to their new position.
  link.transition()
   .duration(duration)
   .attr("d", diagonal);
  // Transition exiting nodes to the parent's new position.
  link.exit().transition()
   .duration(duration)
   .attr("d", function(d) {
  var o = {x: source.x, y: source.y};
  return diagonal({source: o, target: o});
   })
   .remove();
  // Stash the old positions for transition.
  nodes.forEach(function(d) {
 d.x0 = d.x;
 d.y0 = d.y;
  });
}
// Toggle children on click.
function click(d) {
  if (d.children) {
 d._children = d.children;
 d.children = null;
  } else {
 d.children = d._children;
 d._children = null;
  }
  update(d);
}
</script>

  </body>
</html>

can anybody help me with making an arc for each layer to hold the nodes so it will be one link at each level holding the arc (and the arc holding the nodes of each level).. so it would be more like this picture:
mindMap I'm using the D3.js library !! if you have any similar codes it would be great too


text:
Q: Replaces the space with %20 while using css Sorry that the title is not accurate, but there's my problem:
I'm trying to set a background-image using css in code behind, and I want to add to that image a linear-gradient, something like that:
Image1.Style["background-image"] = "linear-gradient(toright, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 50%), url(URLImage)";

but when I run the page, it replaces the space in the code with %20, so it doesn't work Url(linear-gradient(toright,%20rgba(0,0,0,0.8)%200%,%20rgba(0,0,0,0)%2050%),%20url(........)
*I'm setting the Image on code-behind aswell
I've tried to use @, but it didn't work
Can someone please help me? thank you

A: Escaping the spaces with a backslash should work here.
Image1.Style["background-image"] = "linear-gradient(toright,\ rgba(0,0,0,0.8)\ 0%,\ rgba(0,0,0,0)\ 50%),\ url(URLImage)";


text:
Q: Compile-time detection of vtable Is there a way to detect at compile-time if a class has a vtable or not? I am trying to ensure
a class is aligned to 64-byte boundaries and is 64 bytes in length. Adding a vtable increases
the class size to 128 bytes.
class __attribute__((aligned(64))) C
{
private:
    int64_t iValue;
    char iPadding[64 - sizeof(int64_t)];
};

This is fine. However
class __attribute__((aligned(64))) C
{
public:
    virtual ~C() {}

private:
    int64_t iValue;
    char iPadding[64 - sizeof(int64_t)];
};

screws things up.
Answer: aligned also pads, not just controls location. __declspec(align()) seems to do the same!
Edit: Still bamboozled. After putting a check in the constructor of C that checks that this is divisible by 64 and throw an exception if it's not, I'm getting exceptions. Initially I though it might have to do with having instances of C on the stack, but after changing them to being heap-based the alignment check is still failing. I'll just fall back to a factory function that calls posix_memalign and do in-place new (which is probably what std::aligned_storage eventually does)

A: Yes you can; use std::is_polymorphic.
If you're trying to align something though, use std::aligned_storage with placement new:
std::aligned_storage<sizeof(C), 64> as;
C* c = new (&as) C;

// use c...

c->~C(); // call destructor ourselves

A: Instead of adding padding bytes manually, why not just use __attribute__((aligned(64))) and let the compiler align it for you whether or not there's a vtable present? Then you'll always get 64 byte alignment with no other work needed, and it removes the dependency on knowing the size of the vtable.

A: Stop trying to manually add padding bytes.  Just define the variable you want to be aligned with the aligned attribute, like this:
class C
{
public:
    virtual ~C() {}

//private:
    __attribute__((aligned(64))) int64_t iValue;
};

void printAddr(C* a, int i)
{
    printf("&a[%d] = %p   &a[%d].iValue = %p\n", i, &a[i], i, &a[i].iValue);
}

int main()
{
    C a[8];
    printf("\nsizof(C) is: %d\n\n", sizeof(C));
    for (int i=0; i<sizeof(a)/sizeof(a[0]); ++i)
        printAddr(a, i);

    printf("\n");
}

If your class has a vtable, that will of course enlarge the size of the class, but the compiler will insert the necessary padding for you, and also adjust the alignment requirement of the encompassing class as necessary to ensure that the member with the strictest (largest) alignment will be properly aligned.  BTW, the vtable is not stored in an object, only a vtable pointer.  So if you're on a 32-bit system, the vtable pointer takes up only 4 bytes.  The rest of the sizeof(C)=128 that you were seeing was padding that the compiler added to ensure that an array of objects of type C would be aligned, but it was shifting the variable that you care about out of alignment: assuming you actually need iValue aligned on a 64-byte boundary, it's no longer aligned on such a boundary.

OR....  If you don't actually have to have iValue itself aligned on a 64-byte boundary, and you just need your class aligned on a 64-byte boundary but you don't want to unnecessarily add bulk to the class, the answer is simpler:
STOP ADDING YOUR OWN PADDING BYTES!  Just do this:
class __attribute__((aligned(64))) C
{
public:
    virtual ~C() {}

//private:
    int64_t iValue;
};

void printAddr(C* a, int i)
{
    printf("&a[%d] = %p   &a[%d].iValue = %p\n", i, &a[i], i, &a[i].iValue);
}

int main()
{
    C a[8];
    printf("\nsizof(C) is: %d\n\n", sizeof(C));
    for (int i=0; i<sizeof(a)/sizeof(a[0]); ++i)
        printAddr(a, i);

    printf("\n");
}

Note that if you do it this way, the iValue member is no longer aligned on 64-byte boundaries, but they are all 64-bytes away from their neighbor's iValue.


text:
Q: JS when user click show different colors When you enter the page, the first div #faqBasics, should be in a different color.
If the user click in one of the other two div's, that should be in different color, where the other's muts be in the original color.
If the user click in some question, that question should be in a different color. But if he clicks in other questions, the first one should be with the original color.
FIDDLE DEMO
HTML:

BASICS
 |
NETWORKING
 |
COMPRESSION

Question?

                        text

Question?

                        text

Question?

                        text

Question?

                        text

Question?

                        text

Question?

                        text

Question?

                        text

Question?

                        text

Question?

                        text

Question?

                        text

CSS:
#faqBasics, #faqNetworking, #faqCompression {
display:inline;
cursor: pointer;
}

li {
list-style: none;
overflow: hidden;
cursor: pointer;
color:#c8c8c8;
margin-bottom: 15px;
}

li.active {
color: #c8c8c8;
}

JS:
$(document).ready(function() {
$('li').each(function() {
    var tis = $(this), state = false, answer = tis.next('.basicsAnswers, .networkingAnswers, .compressionAnswers').hide().css('height','auto').slideUp();
    tis.click(function() {
        state = !state;
        $('.basicsAnswers, .networkingAnswers, .compressionAnswers').hide();
        $(this).css("color", "#6001ff");
        answer.slideToggle(state);
        tis.toggleClass('active',state);
    });
}
);
$(".faqBasics").show();
$(".faqNetworking,.faqCompression").hide();
$("#faqBasics,#faqNetworking,#faqCompression").click(function(){
    $(this).css("color", "#6001ff");
    $(".faqBasics,.faqNetworking,.faqCompression").hide();
    $("div."+$(this).attr("id")).show();
});
});

Any ideas what I'm missing?

A: Try this code:
jsfiddle
you forgot to remove blue color from all li
 $('li').css('color','black');


text:
Q: iOS CGFloat Semantic Issues --Invalid Operands In my interface there are two CFFloat properties.  I am attempting to use them in a gesture recognizer but I continue to get the errors "invalid operands to binary expression float and double.." in the if statement with the "allTouchesAreOnPreviewLayer".  I'm unsure of how to properly fix this.  Let me know if you need more information.  I'm attempting to implement a pinch to zoom on a UIView.
Interface properties:
CGFloat *startingScale;
CGFloat *effectiveScale;

Implementation methods:
-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
 {
 if ([gestureRecognizer isKindOfClass:[UIPinchGestureRecognizer class]]) {

    startingScale = effectiveScale;
}

return YES;
}

-(IBAction)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer
{
NSLog(@"Pinched View");

BOOL allTouchesAreOnThePreviewLayer = YES;
NSUInteger numTouches = [recognizer numberOfTouches], i;
for ( i = 0; i < numTouches; ++i ) {
    CGPoint location = [recognizer locationOfTouch:i inView:imagePreview];
    CGPoint convertedLocation = [captureVideoPreviewLayer convertPoint:location fromLayer:captureVideoPreviewLayer.superlayer];
    if ( ! [captureVideoPreviewLayer containsPoint:convertedLocation] ) {
        allTouchesAreOnThePreviewLayer = NO;
        break;
    }
}

//ERRORS ARE HERE:
if ( allTouchesAreOnThePreviewLayer )
{
    effectiveScale = startingScale * recognizer.scale;
    if (effectiveScale < 1.0)
        effectiveScale = 1.0;
    CGFloat maxScaleAndCropFactor = [[stillImageOutput connectionWithMediaType:AVMediaTypeVideo] videoMaxScaleAndCropFactor];
    if (effectiveScale > maxScaleAndCropFactor)
        effectiveScale = maxScaleAndCropFactor;
    [CATransaction begin];
    [CATransaction setAnimationDuration:.025];
    [captureVideoPreviewLayer setAffineTransform:CGAffineTransformMakeScale(*(effectiveScale), *(effectiveScale))];
    [CATransaction commit];
}

}

A: CFGloat is a primitive type, not a class. Get rid of the asterisks in the declarations. You want:
CGFloat startingScale;
CGFloat effectiveScale;


text:
Q: Embed Index in created PDF? Acrobat Pro offers the functionality to embed a search Index into a PDF. Is there a way to do this via Tex functionalities without the need to buy the official Acrobat Pro license to embed search index INTO an existing PDF?
Thanks!
EDIT
I mean the Embedded Search Index Feature:
http://www.peachpit.com/articles/article.aspx?p=1809120&seqNum=2

A: The search index is implemented with a /PieceInfo entry in the catalog:
/PieceInfo
<<
/SearchIndex
<<
/PDXFile 13 0 R
/ModID (215673870f8f9142afe419c9ca1a4620)
/Index1File 14 0 R
/IndexFile 15 0 R
>>
>>

The index files it points to are binary streams.
The description of the /PieceInfo dictionary in the pdf reference says:

PDF writers can use this dictionary as a place to store private data
  in connection with that document, page, or form. Such private data can
  convey information meaningful to the PDF processor that produces it
  [...] but can be ignored by general-purpose PDF processors.

This means that the content and the format of this index is acrobat specific. To be able to create such an index with tex you would need to know the specification, which probably isn't public.
Even if the specification were known I doubt that it would make sense to include this in the tex compilation - it would slow down it a lot. It would make more sense to postprocess only the final pdf.


text:
Q: Windows 7 Visual Styles Unable to Install completely I am trying to get some visual styles working completely on my computer.
They say I need to patch some files, install the theme, and to get the style working 100%, I also need to replace explorer.exe, shell32.dll, and a few other files.
The problem is, when I do this, after restarting, the computer gives a shell32.dll is missing error and won't load. I have restored my computer to a working state, but that's not the problem. The problem is I want the visual style to work completely, all bells and custom start button included.
If this is a duplicate(I couldn't find a question similar to this on Google or Super User with an answer), please link me in a comment.

A: If the visual style operates by hacking the shell, and the hack failed, it's unlikely that it's going to work on your computer. My guess is that whatever custom theme you're using is built for x86 and you're running x64, or vice versa.
Either way, what you're doing is not supported by Windows. You'll have to contact whoever built the theme and ask why their hack is not working.

A: I have never faced any problems (Windows 7, 64-bit) when trying many of the themes that require such replacements. However, I can still think of a few things you can try:
Make sure your archiving program is 64-bit. If not, it will end up extracting the files into the virtual storage folder SysWOW64 instead of System32. I recommend 7-Zip.
If you cannot obtain a 64-bit version of your archiving program, extract the files to another folder (Desktop works best), and copy them using Windows Explorer.
In the off-chance that this fails as well, or if you do not want to risk compromising your system, you can also use something like Anolis Resourcer to extract the relevant resources from the patched system files, and add them to your versions. This may also reduce incompatibilities with Service Packs or other updates between your computer and the theme author's computer.

A: Have you tried the Uxtheme Multi Patcher?, usually works for me.


text:
Q: Synergy maps the space bar to character "s" I have Synergy 1.4.12 with Windows7 as server and Mac OSX Mountain Lion as client.
While focusing the Mac screen, if I press the space bar, the Mac interpret it as an "s" in all apps.
I confirmed this with the keyboard viewer: when pressing space bar, it highlights the "s" key.

A: I couldn't find a fix for this.
I ended up uninstalling synergy in the MacBook (client) and installing SynergyKM. I didn't get the weird behavior anymore.
I hope this helps anyone with a similar problem.


text:
Q: DeviceIoRequest to get STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR for USB storage fails I am trying to get the STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR for storage devices by querying IOCTL_STORAGE_QUERY_PROPERTY IOCTL with a properly filled out STORAGE_PROPERTY_QUERY struct. This works fine for non-USB storage, but for USB storage, this fails with ERROR_INVALID_FUNCTION.
I also checked if that property exists by setting QueryType to PropertyExistsQuery and not providing an output buffer. Turns out, it exists. I don't see why it would fail with ERROR_INVALID_FUNCTION.
Here is a cut-down version of the code I used (no error handling, etc):
#include <Windows.h>
#include <SetupAPI.h>
#include <stdio.h>

int main(void){
    HDEVINFO diskClassDevs;
    diskClassDevs = SetupDiGetClassDevs(&GUID_DEVINTERFACE_DISK,
                                        NULL,
                                        NULL,
                                        DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
    DWORD devIdx = 0;
    SP_DEVICE_INTERFACE_DATA devInterfaceData;
    devInterfaceData.cbSize = sizeof(devInterfaceData);
    while(SetupDiEnumDeviceInterfaces(diskClassDevs,
                                      NULL,
                                      &GUID_DEVINTERFACE_DISK,
                                      devIdx,
                                      &devInterfaceData)){
        devIdx++;

        DWORD requiredSize;
        DWORD result = SetupDiGetDeviceInterfaceDetail(diskClassDevs,
                                                       &devInterfaceData,
                                                       NULL,
                                                       0,
                                                       &requiredSize,
                                                       0);
        SP_DEVICE_INTERFACE_DETAIL_DATA *devInterfaceDetailData;
        devInterfaceDetailData = malloc(requiredSize);
        devInterfaceDetailData->cbSize = sizeof(*devInterfaceDetailData);
        SP_DEVINFO_DATA devInfoData;
        devInfoData.cbSize = sizeof(devInfoData);
        result = SetupDiGetDeviceInterfaceDetail(diskClassDevs,
                                                 &devInterfaceData,
                                                 devInterfaceDetailData,
                                                 requiredSize,
                                                 NULL,
                                                 &devInfoData);

        HANDLE devHandle;
        devHandle = CreateFile(devInterfaceDetailData->DevicePath,
                               GENERIC_READ,
                               FILE_SHARE_READ | FILE_SHARE_WRITE,
                               NULL,
                               OPEN_EXISTING,
                               0,
                               NULL);

        STORAGE_DESCRIPTOR_HEADER diskDescriptorSizeInfo;
        diskDescriptorSizeInfo.Version = sizeof(diskDescriptorSizeInfo);

        STORAGE_PROPERTY_QUERY diskProperty;
        diskProperty.QueryType = PropertyStandardQuery;
        diskProperty.PropertyId = StorageDeviceProperty;
        result = DeviceIoControl(devHandle,
                                 IOCTL_STORAGE_QUERY_PROPERTY,
                                 &diskProperty,
                                 sizeof(diskProperty),
                                 &diskDescriptorSizeInfo,
                                 sizeof(diskDescriptorSizeInfo),
                                 &requiredSize,
                                 NULL);

        STORAGE_DEVICE_DESCRIPTOR *diskDescriptor;
        diskDescriptor = malloc(diskDescriptorSizeInfo.Size);

        diskDescriptor->Version = diskDescriptorSizeInfo.Size;
        result = DeviceIoControl(devHandle,
                                 IOCTL_STORAGE_QUERY_PROPERTY,
                                 &diskProperty,
                                 sizeof(diskProperty),
                                 diskDescriptor,
                                 diskDescriptorSizeInfo.Size,
                                 &requiredSize,
                                 NULL);

        printf("Bus Type: %s\n", (diskDescriptor->BusType == 7 ? "USB" : "not USB"));

        //GET STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR HERE
        diskProperty.PropertyId = StorageAccessAlignmentProperty;
        STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR diskAlignment;
        diskAlignment.Version = sizeof(diskAlignment);
        result = DeviceIoControl(devHandle,
                                 IOCTL_STORAGE_QUERY_PROPERTY,
                                 &diskProperty,
                                 sizeof(diskProperty),
                                 &diskAlignment,
                                 sizeof(diskAlignment),
                                 &requiredSize,
                                 NULL);
        if(!result){
            printf("IOCTL_STORAGE_QUERY_PROPERTY failed (Error: %lu)\n", GetLastError());
        }else{
            printf("Physical sector size: %lu\n", diskAlignment.BytesPerPhysicalSector);
        }
        printf("----------------\n");
    }
}


text:
Q: Get target filename without extension with CMake How can I get the basename of a target library with CMake?
I'm creating a library with the CMake variable name ${lib} as in
set(lib lib)
add_library(${lib} ...

I need the basename of the generated library file.
CMake will create a library with the filename <prefix>lib.<extension> where both <prefix> and <extension> are platform specific.
I've tried the generator $<TARGET_FILE_NAME:${lib}> which gives me the full name, which works because I'm needing this in a COMMAND, which is one of the few places where CMake allows generators.
To remove the extension using CMake I need to use GET_FILENAME_COMPONENT as in
GET_FILENAME_COMPONENT(<var> <filename> NAME_WE)

but this is used to set the variable <var> (in normal CMake fashion) and generators don't work there.
(The CMake language is an irregular abomination, if you ask me. CMake, as a concept, is pretty cool.)

A: I used get_property with get_filename_component and this worked for me:
get_property(lib_loc TARGET lib PROPERTY LOCATION)
get_filename_component(lib_we ${lib_loc} NAME_WE)

A: Query the target's OUTPUT_NAME property:
get_target_property(_baseName lib OUTPUT_NAME)

A: If you don't want the prefix, you can simply do $<TARGET_FILE_BASE_NAME:${lib}>
e.g.
add_custom_target(
  create_txt
  DEPENDS ${lib}
  COMMAND ${CMAKE_COMMAND} -E touch $<TARGET_FILE_BASE_NAME:${lib}>.txt)

If you want the prefix, you can also do $<TARGET_FILE_PREFIX:${lib}>$<TARGET_FILE_BASE_NAME:${lib}>
e.g.
add_custom_target(
  create_txt
  DEPENDS ${lib}
  COMMAND ${CMAKE_COMMAND} -E touch $<TARGET_FILE_PREFIX:${lib}>$<TARGET_FILE_BASE_NAME:${lib}>.txt)


text:
Q: Unable to run WebDriverIo tutorial I'm trying to follow the WebDriverIo tutorial at http://webdriver.io/guide.html .
After setting up the Selenium server, when I try executing the test node script (step 7 in the tutorial), selenium warns me of some errors (see screenshot for full log), and I don't get any output returned.
Steps to reproduce:
I start the Selenium server

When I try running the node script, this happens (clock to zoom):

At this point a Firefox window opens automatically, and remains blank.
I'm running Firefox v52 and Selenium 3.0.1. I downloaded Geckodriver from https://github.com/mozilla/geckodriver/releases
Any obvious thing that I'm missing? I'm very new to Selenium and browser automation, forgive the generic input :)

A: If you have been here to get your Windows release of gecko driver : https://github.com/mozilla/geckodriver/releases, you may have miss this message :

"IMPORTANT: If you use geckodriver with Selenium, you must upgrade to
  Selenium 3.3 since this release aligns HTTP responses with the
  WebDriver standard."

(I can see you are in v3.0.1).


text:
Q: Access Bamboo secret/password variable? My team has some old bamboo pipelines, where secret and password are configured in bamboo variables and bamboo masks these values with ***** nobody knows the passwords now and it has not been documented.
Is there any way to access/print and see the values in bamboo [secret/password] variable?

A: There's a trick to read secret variables:
Create a Script task with content
echo ${bamboo_password_variable} > text.txt

Add artifact definition for *.txt pattern for a Job
Run build and look at text.txt artifact content.


text:
Q: How can I get multiple/nested class return values from deserializing json.net in unity? Some background: My json data is coming from a php script that queries a mysql database. I have a class for the results of the command, such as success or failure. I have another class that will contain the actual results of the query.
public class jsonResults {
    public int success { get; set; }
    public string message { get; set; }
    public ArrayList resultArray { get; set; }
}

public class HeroDetails {
    public int id { get; set; }
    public string name { get; set; }
}

I think I should be able to iterate over the jsonResults results arraylist to populate a new HeroDetails but I can't seem to find how.
example json data
{
    "success": 1,
    "message": "Data Available!",
    "resultArray":[
        { "id": "26", "name": "Hero1" },
        { "id": "13", "name": "Hero2" },
        { "id": "1", "name": "Hero3" },
        { "id": "18", "name": "Hero4" }
    ]
}

This code lets me access the success and message but I'm not finding any way to get the array results into my list.
        List<HeroDetails> heroList = new List<HeroDetails>();
        jsonResults r = JsonConvert.DeserializeObject<jsonResults>(json));

        Debug.Log("Success: " + r.success);
        Debug.Log("Message: " + r.message);

A: you have a problem in your arraylist !! you can use json2csharp .
public class ResultArray
{
    public string id { get; set; }
    public string name { get; set; }
}

public class RootObject
{
    public int success { get; set; }
    public string message { get; set; }
    public List<T> resultArray { get; set; }
}

A: You JSON response can contain generic data and so you need a generic result class.
public class jsonResults<T> {
    public int success { get; set; }
    public string message { get; set; }
    public List<T> resultArray { get; set; }
}

Also you have to know what kind of type you are expecting from the request to deserialize it.
jsonResults<HeroDetails> r = JsonConvert.DeserializeObject<jsonResults<HeroDetails>>(json);


text:
Q: Dare + have done Here is an example from an old book. I know it's old but it can't be simply discarded, I hope.

"I never dare have spoken — never dare have told you that my love for you was killing me"

So, I wonder if the following three all mean the same thing?

*

*I never dare have told you.

*I never dared to have told you.

*I didn't ever dare to have told you.
I would like to know how popular in terms of the usage frequency the combination of dare and a perfect infinitive is.

A: This is a very rare usage and cannot be regarded as idiomatic today.
Dare is an odd word—it wanders back and forth between performing as an ordinary lexical verb and as a sort of modal.  For instance, it is used with both marked and unmarked infinitives, and it may be used with or without DO-support:

I dare tell you so. ... I dare to tell you so.
  I dare not tell you so. ... I do not dare tell you so.
  Dare I eat a peach?  ... Do I dare to eat a peach?

I dare have spoken/told is a use consistent with treatment as a full modal—except that every instance of such use I find (in a quick-and-dirty survey on Google Books) employs the present form in a past sense, as your example does. This suggests that the few authors who used it (all such uses I found appeared in the last half of the 19th century) were influenced—and somehow confused!—by the conventional of use of the "perfect infinitive" to backshift past modals employed in a present sense, as when "I might do this" is backshifted as "I might have done this".
It's a fascinating phenomenon, and I am glad to have had it drawn to my attention. But it was never common, and for practical purposes you may ignore it.

A: Those now all sound wrong to the modern ear.  In contemporary English, that  should just be one of:

*

*I never dared to tell you.

*I never dared tell you.

*I dared never tell you.

Of those, the second may be preferable.  Notice how dare can be used without a to-infinitive but just a bare infinitive, where it acts more like a modal verb.
The OED gives only one citation using a "perfect infinitive" with dare, and this citation is with a bare infinitive (not a to-infinitive) complement:

*

*1790 Cowper Let. to Mrs. Bodham 21 Nov. — Such as I dared not have given.

Perhaps it is more normal to say to have dared do something than to say dare (to) have done something.

*

*I've never dared tell you.

*I've never dared tell you.

Dare is actually a somewhat complicated verb with a complex history.  The OED says of it:

Etymology:  One of the interesting group of Teutonic preterite-present verbs, of which the extant present is an original preterite tense: see can, dow, etc.
[. . .]
The original 3rd sing. pres. he dare, and pa. t. durst, remained undisturbed to the modern period, in which the transitive senses (B. II.) were developed; but early in the 16th c. the new forms dares, dared, appeared in the south, and are always used in the transitive senses, and now also in the intransitive sense when followed by to. In the original construction, followed by the infinitive without to, dare, durst are still in common use (esp. in the negative 'he dare not', 'he durst not'); and most writers prefer 'he dare go', or 'he dares to go', to 'he dares go '. The northern dialects generally retain 'he dare, he durst', and writers of northern extraction favour their retention in literary English when followed by the simple infinitive without to.

Dare has an irregular simple past tense durst that you will sometimes read in literature but which is today preserved mostly in regional English only.

*

*I durst never tell you.

In older works you can also find durst used as a past participle, or used in places traditionally analysed as past subjunctive or conditional.
The OED also notes that the present-tense form dare is occasionally "carelessly used for the past dared or durst".  This seems to have been more common during the 19th century.  Some of the OED citations from then of this are:

*

*1811 A. Bell in Southey Life (1844) II. 651 — I wish I dare [= durst] put them down among our books.

*1847 Marryat Childr. N. Forest vii, — He told me he dare not speak to you on the subject.

*1857 Kingsley Two Y. Ago I. 214 — She was silent; for to rouse her tyrant was more than she dare do.

*1857 Kingsley Two Y. Ago 298 — But she went into no trance; she dare not.

I would advise against using dare as a past tense form. If you still wanted an old-time feel to it, you could use durst.  You can find durst have used in the 17th and again in the 19th centuries.  The 17th-century data isn't very good, but here is a Google N-Gram starting from the 18th:

However, once you add have dared to the mix, everything else flatlines:


text:
Q: Can a Docker container uses the full CPU power and memory of the host OS? I am new to Docker, but I have experience of using VM and hypervisor. Referring to Docker introduction and this image, Docker containers are isolated but share the same host OS.
If we deploy only 1 Docker container (e.g. LAMP app) in a host OS, can the Docker container uses the full CPU power and memory of the host OS?
Is there any performance difference between a LAMP app running in a Docker container and a LAMP app running in the host OS directly?

A: tl;dr: There is a difference but generally so small that it's not worth worrying about.
For the most part, containers can use the full CPU and RAM of the host system. There is a little bit of CPU overhead to actually run a container but it's small enough that it's generally considered to be zero. RAM usage is in the same boat. The docker server does require a certain amount of CPU and RAM. Both are pretty small when compared to running the app in a VM.


text:
Q: What does commonwealth mean in US English? I have always understood commonwealth to be an association of countries. The most famous example being: "The Commonwealth of Nations, generally known simply as the Commonwealth, is a political association of 54 member states, nearly all former territories of the British Empire."
But in US TV they refer to the commonwealth of Kentucky or Pennsylvania.  What does that mean and what does it derive from?

A: Despite the literal definitions, the etymology, and the example labelings (the former colonies associated with the UK, the 4 US states), like many political terms it doesn't mean what it says.
'Commonwealth' means whatever the labelers want it to be. At most it means 'some kind of government where we want people other than an aristocracy to have some sort of rights, and maybe some organization'. If there is any technical meaning, it gets it only from the very precise situation in which it is used. Though it sounds like there is some vague socialist ideal in it, hardly any examples of commonwealths seem to imply any kind of collective economies or coordinated planned markets.
In other words, you can't take the dictionary definition or any particular examples and then point at a new situation and say 'Oh yeah this is definitely a commonwealth' or 'Wow, no way is this a commonwealth because it violates this one single part of the definition.'. Hm, no, you're right, dictatorships tend not to be easily called commonwealths. But that's about it.
Etymonline says it best:

In the U.S., it forms a part of the official name of ...(irrelevant state names elided)... but has no special significance.

In other words, in the US, 'commonwealth' just means 'government of a particular entity synonymous with 'state'.

A: The idea behind Commonwealth is in its etymology:
OED:

Etymology: In its history, like common weal n.; wealth , Middle English welthe , being a later formation, in same sense as weal, Old English wela . The two words were used indiscriminately [...]; but in the 16th cent. commonwealth became the ordinary English term in sense 2 [...].

In commonwealth, "common" = of the people; of the community, and "wealth (n.)" = a [large or entire] quantity.
Thus

2. The whole body of people constituting a nation or state, the body politic; a state, an independent community, esp. viewed as a body in which the whole people have a voice or an interest.

And thus

3.a. A state in which the supreme power is vested in the people; a republic or democratic state.
a1618   W. Raleigh Maxims of State (1651) 8   A Common-wealth is the swerving or depravation of a Free, or popular State, or the Government of the whole Multitude of the base and poorer Sort, without respect of the other Orders.

And thus as the states of America originated as autonomous entities:

3b. A state of the United States of America, esp. in the official titles of Kentucky, Massachusetts, Pennsylvania, and Virginia.
1779   Pennsylvania Gaz. 24 Mar. 4/3   All the best Whigs in the Commonwealth.
1870   J. R. Lowell Among my Bks. (1873) 1st Ser. 228   The sturdy commonwealths which have sprung from the seed of the Mayflower.
1967   Boston Herald 1 Apr. 3/1   The Commonwealth has been married to the Sales tax a year Saturday. Like many marriages, it hasn't lived altogether up to expectations but it's become essential anyway.

and, historically, the first "Commonwealth"

4.a. English History. The republican government established in England between the execution of Charles I in 1649 and the Restoration in 1660.

A: As Wikipedia says:

A commonwealth is a traditional English term for a political community founded for the common good. Historically it has sometimes been synonymous with "republic". The noun "commonwealth", meaning "public welfare general good or advantage", dates from the 15th
century.

The British Commonwealth (also known as The Commonwealth of Nations) is the biggest and most important commonwealth, so absent context indicating some other Commonwealth, anyone who says "the Commonwealth" is usually talking about the British Commonwealth.

A: For the US states that use the term, it's a bit more specific than the ordinary meaning. Specifically, it means a representative democracy.
For people living in or near those states, we learn the specific meaning in grade school and then immediately forget it, so that it becomes just a meaningless word in the name of the state. There's no practical difference between being a commonwealth vs a state. (Or at least, I learned the meaning in grade school and then immediately forgot it.)
From virginia.gov:

Why is Virginia called a commonwealth? What other states are commonwealths?

According to the Hornbook of Virginia History, 4th ed., page 88:

"A commonwealth is 'a state in which the supreme power is vested in the people.' The term as an official designation was first used in Virginia during the Interregnum (1649-1660), the period between the reigns of Charles I and Charles II during which parliament's Oliver Cromwell as Lord Protector established a republican government known as the Commonwealth of England. Virginia became a royal colony again in 1660, and the word commonwealth was dropped from the governor's full title. When Virginia adopted its first constitution in 1776, the term commonwealth was reintroduced, most likely to emphasize that Virginia's new government was based upon the sovereignty of the people united for the common good, or common weal. The designation commonwealth of Virginia has been used in official records ever since. Three states beside Virginia adopted the appellation commonwealth: Kentucky, Massachusetts, and Pennsylvania."

From mass.gov:

Adams wrote: "There is, however, a peculiar sense in which the words republic, commonwealth, popular state, are used by English and French writers; who mean by them a democracy, or rather a representative democracy; a 'government in one centre, and that centre the nation;' that is to say, that centre a single assembly, chosen at stated periods by the people, and invested with the whole sovereignty, the whole legislative, executive, and judicial power, to be exercised in a body, or by committees, as they shall think proper." (Adams, John, and Charles Francis Adams. The Works of John Adams, Second President of the United States: with a Life of Author, Notes and Illustrations. Charles C. Little and James Brown, 1850-56, vol. 5, p. 454)

A: According to the Lexico online dictionary there are many definitions of the word 'commonwealth'. They all do, however, have a relationship to the original 16th century phrase 'common wealth' from which the word was derived.
At first reading the word could be taken to be a proto-socialist or early Christian concept following the idea that the members of a community 'held all things in common' as the Acts of the Apostles says that the members of the early church did but, in practice, actual 'commonwealths' did not do this.
Arguably the oldest, and certainly one of the most famous political entities to be called a 'commonwealth' was the rule of England under Oliver Cromwell as Lord Protector following the Civil War and the execution of Charles I. The idea behind  this naming was that the country was ruled for the benefit of all its citizens rather than for the benefit of the royal family but private property was certainly not abolished and small political groups such as The Levellers and The Diggers who attempted to bypass individual ownership of land were severely put down very soon after the end of the Civil War.
It is this concept of 'commonwealth' that seems to be behind the naming of Pennsylvania, Massachusetts, Virginia and Kentucky. The idea is that first the colony and later the state exists for the benefit of its citizens, not for the benefit of anyone else, such as a king.
Another major meaning of 'commonwealth' is that of a voluntary grouping of nation states with no one state being dominant. This is the concept behind the Commonwealth of Nations (originally the British Commonwealth) which was set up after WW2 to preserve and foster links between the UK and its former imperial colonies as they gained independence.
This meaning is also older than many people think. For instance the former alliance of Poland and Lithuania under a single elected king which existed from 1569 to 1793 is referred to in English as a 'commonwealth'
As I said there are other meanings of 'commonwealth' but most of them are variations on these two themes.


text:
Q: basic CLI program in C Okay so overall im trying to complete a basic CLI C program which will complete functions such as clear, quit, cd, ls, help (bring up the unix man) etc.. i altered my code and so far i have this, im getting segmination error when trying to execute the cd command part of the program, (im very new to c btw);
    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
    #include<unistd.h>

    int main (int argc, char *argv[])
    {
      char input[] = " ";
      char *argument;
     while(strcmp(input, "quit")!= 0)
      {

      printf("$");
      scanf ("%s", input);

     if(strcmp(input,"clear") == 0)
     {
       printf("\e[1;1H\e[2J");
      }

    else if(strcmp(argv[1],"cd") == 0)
     {

      if(chdir(argv[2]) == -1)
      {
         printf("\n directory does not exists");
       }

     }

    else if(strcmp(input, "echo") == 0)
     {
    char str[50];
    scanf("%[^\n]+", str);

    printf(" %s", str);
     }

  }

 }

A: input is declared as a ' ' (space) character. It will never match 'cd'.
This is probably more along the lines of what you want to achieve, where the first parameter is the command (cd), and the second will be the directory:
int main (int argc, char *argv[])
  {

    char *argument;

  if(strcmp(argv[1],"cd") == 0)
 {

    if(chdir(argv[2]) == -1)
    {
       printf("\n directory does not exists");
    }

  }

Edit Also please note that there is no need for the else satement. If chdir does not return an error, it will change the directory, thus no need to call it again in an else.
Additionally, another tip for using system calls in general, it would be of great help if you print the error number returned by the system upon a failure in system call. This will make things easier when things start going wrong. To do this simply include <errno.h>' and modify the printf to printerrno` which gives specific details about the error:
printf("Chdir error: %d", errno);

For instance chdir() does not only return an error when the directory does not exist, but also for example if you do not have permissions to view the contents of the directory. See the man page for a list of possible errors.

A: To implement your own shell, you need to take input directly from stdin, not from command-line arguments (argv) from another shell. The basic pattern is like this:

*

*Read input

*Execute command

*Print results

*Loop back to step 1


text:
Q: Как скрыть бесконечный батник? Написал простенький зацикленный батник - запрещает создавать в определённой папке файлы конкретного расширения, то есть работает по принципу наподобие этого:
@echo off
for /l %%переменная in (0) do if exist *.расширение (del *.расширение)

При его запуске открывается пустое окно cmd, вечно мозолящее глаза и в принципе мешающее, допустим, мисскликами по нему в панеле задач. Есть ли способ не запускать/скрыть это назойливое окошко, например, через какой-то атрибут команды start в другом батнике?


text:
Q: Understanding project dependencies in Gradle I have two projects:

*

*project A -- this one has the main code

*project B -- this one has the test code

(for some reason I have to keep test code in a separate project for a while)
Now in project B, I am adding a testCompile dependency configuration on project A. I want to understand the difference between these dependency configuration statements:
dependencies {
    testCompile project(":ProjectA")
    testCompile project(":projectA").sourceSets.main.output
    testCompile project(path: "projectA", configuration: "compile")
}

I am asking this question because I actually want to pull in all the compile time dependencies of project A into the testCompile dependency of project B and I can't figure out how to do that. I assumed
testCompile project(path: "projectA", configuration: "compile")

will work, but it doesn't.
Any help will be appreciated.

A: In projectB's build.gradle, you can add this:
dependencies{
    compile project(':projectA')
    testCompile 'junit:junit:4.12'
}

This tells gradle to use the main code of projectA in projectB. Then you can write tests against projectA in projectB.
You can do this to get more information about a dependency:
task print << {
    println project(":projectA").getClass() //Output: org.gradle.api.internal.project.DefaultProject_Decorated
    println project(":projectA").sourceSets.main.output.getClass() //Output: org.gradle.api.internal.tasks.DefaultSourceSetOutput_Decorated
    println project(path: "projectA", configuration: "compile").getClass() //This doesn't work in gradle 3.0
}

Both a project or a source set can be input to a configuration in the dependencies{} block


text:
Q: Mostar dados da tabela SQLite Quando apaga uma linha da base de dados, quando volto a atualizar, não mostra numa tabela que imprimo os resto das linhas, caso seja apagado no meio dos dados.
O problema é que tenho um for que corre todas as linhas da tabela pelo seu id, e caso por exemplo o id=3 for apagado, e tiver mais registos, como id=4,5,etc só me vai mostrar ate o id=2 porque tenho um select feito pelo id. Como posso resolver isso?
for($i=1;$i<=10;$i++){

        $requete    =   "SELECT * FROM contact WHERE (id=$i)";
        $resultat   =   $base_hndl->query($requete);    //
        $affiche    =   $resultat->fetchArray();
        echo "
";

            echo "$affiche[id]	";
            echo "$affiche[nom]	";
            echo "$affiche[prenom]	";
            echo "$affiche[fonction]	";
            echo "$affiche[societe]	";
            echo "$affiche[mobile]	";
            echo "
";

    }//fin de for


text:
Q: How to diagnose dependency injection error in Angular Library I have an Angular library - all Angular 14.1.0, (which I have inherited), which includes a single project of UI elements, and then at the root level an "app" for testing the UI components.
One of the components of a popup messagebox, and one of the dependencies injected is ngx-translate (https://github.com/ngx-translate/core) which we use everywhere, no problems.
This morning the I could ng serve the test project and invoke this dialog. However after a small css modified, I reran it, and now I get an injection error. I have undone all my changes, and I still get it. I also deleted ALL node_modules and redid an npm i and everything came down, and when I build it all builds with no errors.
However, when I run and try to open this component, I get the following
    ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError[n -> n -> tE -> tE -> tE]:
      NullInjectorError: No provider for tE!
    NullInjectorError: R3InjectorError[n -> n -> tE -> tE -> tE]:
      NullInjectorError: No provider for tE!
        at cw.get (core.mjs:6364:27)
        at _w.get (core.mjs:6791:33)
        at _w.get (core.mjs:6791:33)
        at _w.get (core.mjs:6791:33)
        at CI (core.mjs:4775:33)
        at J (core.mjs:4779:42)
        at n.ɵfac [as factory] (ngx-translate-core.mjs:16:103)
        at _w.hydrate (core.mjs:6892:35)
        at _w.get (core.mjs:6780:33)
        at _w.get (core.mjs:6791:33)
        at xe (zone.js:1262:35)
        at zone.js:1169:21
        at zone.js:1185:37
        at nE (asyncToGenerator.js:6:1)
        at a (asyncToGenerator.js:25:1)
        at asyncToGenerator.js:32:1
        at new b (zone.js:1351:25)
        at asyncToGenerator.js:21:1
        at n.show (message-box.ts:92:49)
        at n.alert (message-box.ts:38:21)

So it is something to do with ngx-translate-core which is a peer dependency in the library (https://angular.io/guide/creating-libraries), and is a dependency in the text project.
Also tried adding as a dev dependency in the library project, but made no difference.
The library module has
imports: [
    TranslateModule.forChild()
    ...

and the host test project module has
imports: [
  TranslateModule.forRoot({
        loader: {
            provide: TranslateLoader,
            useFactory: () => new CustomNgxLoader(),
        },
        missingTranslationHandler: { provide: MissingTranslationHandler, useClass: CustomNgxMissingTranslationHandler },
        useDefaultLang: false
    }),

I am at an end, I have no idea why this has started happening or how to diagnose it.
I am running using ng serve but Angular tools reports I am running in production...

so I can't us it for anything.
When I look at each call in the error call stack, the code look minimized and incomprehensible.
How can I track this down?

A: Here is a partial answer. My lesson here, is to make sure you are running in development mode!
I added
 "sourceMap": true,
 "optimization": false,
 "aot": false,
 "buildOptimizer": false,

to architect/build/options in angular.json  (so it must not default to these)
And now the error message was at least more meaningful...
    ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError[TranslateService -> TranslateService -> TranslateStore -> TranslateStore -> TranslateStore]:
      NullInjectorError: No provider for TranslateStore!
    NullInjectorError: R3InjectorError[TranslateService -> TranslateService -> TranslateStore -> TranslateStore -> TranslateStore]:
      NullInjectorError: No provider for TranslateStore!
        at NullInjector.get (core.mjs:6364:27)
        at R3Injector.get (core.mjs:6791:33)
        at R3Injector.get (core.mjs:6791:33)

So now I can see it is TranslateStore that is the problem, so now searching for this I find this post, and adding the providers:[TranslateStore ] to the library module as suggested in the second answer fixed it for me (as far as I can see)
I have no idea why I get this now, where we never used to have to do this.


text:
Q: Graylog is not showing logs with log4net and .NET Core Application I am trying to configure my .NET Core Application with Graylog v2.5. I am using log4net to log messages.
I have used below configuration to setup the environment. I have intentionally raised exception in my WebAPI controller to validate Graylog setup.
<appender name="AsyncGelfUdpAppender" type="Gelf4Net.Appender.AsyncGelfUdpAppender, Gelf4Net">
<!-- Number of log lines to buffer for async send. Defaults to 10-->
<bufferSize value="20" />
<!-- Number of tasks to use for the async appender. 0 or fewer indicates one task per processor-->
<threads value="2" />
<remoteAddress value="127.0.0.1" />
<remotePort value="6789" />
<layout type="Gelf4Net.Layout.GelfLayout, Gelf4Net">
  <param name="AdditionalFields" value="app:AsyncUdpAppender,version:1.0,Environment:Dev,Level:%level" />
  <param name="Facility" value="RandomPhrases" />
  <param name="IncludeLocationInformation" value="true" />
  <param name="SendTimeStampAsString" value="true" />
</layout>

I am not getting any error. At the same time, I am not getting any output. Below is the output shown in browser.

Can anyone please suggest me what I am doing wrong? What do I need to do to be able to show log messages in the Graylog interface? Where exactly I can see the log messages? I could not get any help from Google and I am pretty new to Graylog.

A: Make sure you are using the rules used by the Stream setup in Graylog.
For example, in this Stream, the property AppName must match exactly the same name as defined in Graylog (MyAppName).
Also, make sure your computer was given permission to write to that stream in Graylog.

Solution 1:
Add field to AdditionalFields
 <log4net>
...
  <param name="AdditionalFields" value="app:DotnetcoreUdpAppender,version:1.0,Environment:Dev,AppName:MyAppName" />
                ...
 </log4net>

Solution 2: Add field to data object:
protected static readonly ILog log = LogManager.GetLogger("GelfUdpAppender");

         Dictionary<string, string> logData = new Dictionary<string, string>
         {
            {"AppName", "MyAppName"}, // pass your property rule here
            {"Message", message},

         };
         log.Info(logData);

<log4net>
      <appender name="GelfUdpAppender" type="Gelf4Net.Appender.GelfUdpAppender, Gelf4Net.UdpAppender">
         <remoteAddress value="server-name" />
         <remotePort value="12201" />
         <layout type="Gelf4Net.Layout.GelfLayout, Gelf4Net.UdpAppender">
            <param name="AdditionalFields" value="app:DotnetcoreUdpAppender,version:1.0,Environment:Dev" />
            <param name="Facility" value="test" />
            <param name="IncludeLocationInformation" value="true" />
         </layout>
      </appender>
      <root>
         <level value="ALL" />
         <appender-ref ref="GelfUdpAppender" />
      </root>
   </log4net>


text:
Q: Python - get all possible sums of elements inside n 1d arrays Given an integer n, and an array a, I would like to return an array with all the possible values of sums of a with itself n times.
Example: n = 3, a = [1, 2, 3, 4, 5, 6]

Output: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]

First element is from 1+1+1, second is 1+1+2 etc.
Is there any elegant way to do that? I've tried loops, but since n isn't known in advance, I don't know how many loops I need to make.
Thanks in advance

A: Generate all possible 3-element combinations, then sum them:
from itertools import combinations_with_replacement

n = 3
li = [1, 2, 3, 4, 5, 6]

print([sum(comb) for comb in combinations_with_replacement(li, n)])

# [3, 4, 5, 6, 7, 8, 5, 6, 7, 8, 9, 7, 8, 9, 10, 9, 10, 11, 11, 12, 13, 6, 7, 8, 9, 10, 8, 9, 10, 11, 10, 11, 12, 12, 13, 14, 9, 10, 11, 12, 11, 12, 13, 13, 14, 15, 12, 13, 14, 14, 15, 16, 15, 16, 17, 18]

Since you seem to be interested in the unique sums, use a set:
print(set(sum(comb) for comb in combinations_with_replacement(li, n)))

# {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18}

Note that there is no guarantee whatsoever that these will be ordered. If you want ordered output be explicit about it:
print(sorted(set(sum(comb) for comb in combinations_with_replacement(li, n))))

A: An alternative solution could be to use itertools.product. Here you first generate pairs of 3 elements from a and then sum them. To get rid of the duplicates, you use set { } and the summation is done usingn list comprehension. Here I am using *[a]*n to make it more general for any value of n.
import itertools
n = 3
totals = {sum(item) for item in itertools.product(*[a]*n)}
# {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18}

Another readable way to do it would be to use a variable lists and then pass it to itertools.product
lists = [a]*n
totals = {sum(item) for item in itertools.product(*lists)}

To get all the possible sums including the duplicates, simply use [ ] instead of { }.

A: This will work for you and give you a set as the output to ensure unique sum values. n and a can be any integer or list, respectively.
import itertools

n = 3
a = [1, 2, 3, 4, 5, 6]
b = [a for _ in range(n)]
sums = set(sum(_b) for _b in itertools.product(*b))

A: A pure-Python implementation:
def comb_sum(arr, n):
    if n == 1:
        [(yield a) for a in arr]
    else:
        for i, a in enumerate(arr):
            [(yield a + b) for b in comb_sum(arr[i:], n-1)]

my_list = [1, 2, 3, 4, 5, 6]
n = 3
sums = set([c for c in comb_sum(my_list, n)])

A: using map and lambda,
n = 3
a = [1, 2, 3, 4, 5, 6]
print(list(set(map(lambda k:sum(k), combinations_with_replacement(a, n)))))


text:
Q: ¿Comillas dobles o comillas simples en HTML? Personalmente me gusta utilizar comillas dobles sobre atributos/valores del HTML, pero he visto códigos donde el uso de la comillas simples es lo que predomina sobre el documento ¡e incluso! algunos con ausencia de comillas.
<input type="text" name="age" />
<input type='text' name='age' />
<input type=text name=age />

Fuera de saber la compatibilidad de su uso hay con navegadores, me gustaría conocer ¿cuál de esas formas usar y por qué? ¿hay alguna implicación funcional que afecte el rendimiento?
Ejemplo:
En muchos lenguajes de programación; la diferencia entre comillas simples y dobles para declarar las cadenas de texto, es la interpolación, pero está demás discutir eso sobre HTML pues sabemos no entra en dicha categoría. Pero ¿existe algún comportamiento que altere la forma de presentar los datos?

A: Resumen
Se utilizan comillas dobles ya que en los inicios del lenguaje de etiquetado (SGML), los autores podían hacer uso de caracteres especiales (que eran a veces difíciles de introducir, si no es que imposibles a través del teclado) con solo escribir su referencia, p. ej.:

*

*"&lt;" representa el signo <.

*"&gt;" representa el signo >.

*"&quot;" representa el signo ".

*"&#229;" (en decimal) representa la letra a con un pequeño círculo sobre ella.

*Entre otros...

En pocas palabras, al igual que algunos lenguajes de programación, gozaban de una funcionalidad enriquecida a comparación de las comillas simples.
Fuente: W3C - HTML4.

Explicación
El documento oficial de la W3C (sobre sintáxis HTML5) marca que es perfectamente correcto el uso de la pareja atributo-valor con comillas simples, comillas dobles o incluso con ausencia de comillas; ¡claro! cada uno con ciertas reglas.
Valor del atributo sin comillas

El nombre del atributo, seguido de uno o más caracteres de espacio, seguido de un único caracter U+300D EQUAL SIGN (signo de igual), seguido de uno o más caracteres de espacio, seguido del valor del atributo, el cuál, adicional a los requerimiento brindados..., deberá prescindir de cualquier caracter de espacio literal, de cualquier U+0022 QUOTATION MARK (comillas simples), U+0027 APOSTROPHE (apostrofe), U+003D EQUALS SIGN (símbolo de igual), U+003C LESS-THAN SIGN (menor que), U+003E GREATER-THAN SIGN (mayor que) o U+0060 GRAVE ACCENT (acento grave), y no deberá ser una cadena vacía.

Valor del atributo con comillas simples

El nombre del atributo, seguido de uno o más caracteres de espacio, seguido de un único caracter U+300D EQUAL SIGN (signo de igual), seguido de uno o más caracteres de espacio, seguido de U+0027 APOSTROPHE (apostrofe), seguido del valor del atributo, el cuál, adicional a los requerimiento brindados..., deberá prescindir de cualquier caracter de U+0027 APOSTROPHE (apostrofe literal) y finalmente seguido de otro U+0027 APOSTROPHE (apostrofe).

Valor del atributo con comillas dobles

El nombre del atributo, seguido de uno o más caracteres de espacio, seguido de un único caracter U+300D EQUAL SIGN (signo de igual), seguido de uno o más caracteres de espacio, seguido de U+0022 QUOTATION MARK (comilla inglesa), seguido del valor del atributo, el cuál, adicional a los requerimiento brindados..., deberá prescindir de cualquier caracter de U+0022 QUOTATION MARK (comilla inglesa) y finalmente seguido de otra U+0022 QUOTATION MARK (comilla inglesa).

Derivado de todo ello (y probablemente la costumbre) la W3C utiliza en sus ejemplos las comillas dobles o sin comillas, es por comodidad y en ocasiones buenas prácticas promover aquello mismo que la documentación oficial te insta a hacer a base de sus ejemplos, hacer lo contrario es como tratar de talar un árbol, yendo en contra de la veta de la madera.


text:
Q: @DataProvider returns 100 column values I am using TestNG framework for my automation. DataProvider method returns 100 column values(data needed for test) for each row from Excel sheet.I need to use them in my @Test. How do i pass 100 parameters in @Test method?Is there any easy way to do it? It is difficult to write 100 parameters in @Test method. Any other way of doing it?
@DataProvider(name="InputData")
public Object[][] InputData() throws IOException
{
    Object[][] data = testData(dataFile,"Sheet1");
    return data;
}

@Factory(dataProvider = "InputData")
public A_Test(String a,String b, , , , , , , , , , , )
{

        this.stream=a;
        this.Keyword=b;

}

A: Just pass varaggs String... str
@Factory(dataProvider = "InputData")
public A_Test(String... str) {
}

Some things to consider
1. Big, unreadable test reports
Every invocation is logged separately, with all parameters. It becomes unreadable even with about 5 parameters and about 50 invocations.
2. Exception handling
Doing complex logic in data provider is not an good idea. When exception occurs in @DataProvider all tests using it are skipped.
When you read Excel file in @DataProvider it may fail because of file not found, file too big, wrong file format, etc.
Most likely, you prefer those tests to fail, so your build would fail too. See http://rolf-engelhard.de/2011/10/fail-instead-of-skip-a-test-when-testngs-dataprovider-throws-an-exception/ for possible solutions. For me Solution 1 (test for data provider) or 2 (return empty array on exception) makes most sense.


text:
Q: PDF created by iText7 with Header is not accessible I created a pdf with iText7. The pdf has a header on each page which consists of two (sometimes more) rows. I added them as in the jump start tutorial, chapter 3.
The problem is, that there are no tags generated, so the screenreader (JAWS) does'nt find the header and blind users can not access it.
I tried to add some tags manually to mimic a table, but that seems to be ignored completly.
Here is my code to create the pdf:
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;

import com.itextpdf.io.font.PdfEncodings;
import com.itextpdf.kernel.events.Event;
import com.itextpdf.kernel.events.PdfDocumentEvent;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.geom.PageSize;
import com.itextpdf.kernel.pdf.*;
import com.itextpdf.kernel.pdf.canvas.PdfCanvas;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.pdfa.PdfADocument;

public class ITextHeader {
    private PdfADocument pdf;
    private PdfFont bf;

    public static void main(String[] args) throws Exception {
        new ITextHeader().createPdf();
    }

    private void createPdf() throws Exception {
        PdfWriter writer = new PdfWriter(new FileOutputStream("header.pdf"));
        InputStream icm = new FileInputStream("sRGB_CS_profile.icm");
        pdf = new PdfADocument(writer, PdfAConformanceLevel.PDF_A_1A,
                new PdfOutputIntent("Custom", "", null, "sRGB IEC61966-2.1", icm));
        pdf.setTagged();
        bf = PdfFontFactory.createFont("arial.ttf", PdfEncodings.IDENTITY_H);
        try (Document pdfDocument = new Document(pdf, PageSize.A4, true)) {
            pdfDocument.setMargins(100, 15, 50, 15);
            pdf.addEventHandler(PdfDocumentEvent.START_PAGE, this::createHeader);

            pdfDocument.add(new Paragraph("Here is the content").setFont(bf).setFontSize(10));
        }
    }

    public void createHeader(Event event) {
        PdfDocumentEvent docEvent = (PdfDocumentEvent) event;
        PdfPage page = docEvent.getPage();
        PdfCanvas pdfCanvas = new PdfCanvas(
                page.newContentStreamBefore(), page.getResources(), pdf);
        pdfCanvas.beginText()
                .setFontAndSize(bf, 10)
                .beginMarkedContent(PdfName.Table)
                .moveText(15, 804)
                .beginMarkedContent(PdfName.TR)
                .beginMarkedContent(PdfName.TD)
                .showText("My Title")
                .endMarkedContent() // TD
                .moveText(466, 0)
                .beginMarkedContent(PdfName.TD)
                .showText("Date: 01.01.2022")
                .endMarkedContent() // TD
                .endMarkedContent() // TR
                .moveText(-466, -14)
                .beginMarkedContent(PdfName.TR)
                .beginMarkedContent(PdfName.TD)
                .showText("My Subtitle")
                .endMarkedContent() // TD
                .moveText(466, 0)
                .beginMarkedContent(PdfName.TD)
                .showText("Time: 12:30")
                .endMarkedContent() // TD
                .endMarkedContent() // TR
                .endMarkedContent() // TABLE
                .endText();
    }
}

This is the structure of the pdf as shown by PDF Accessibility Checker:

The Accesibility Checker also complains about not tagged content:

A: We solved the issue with the following workaround: the header on the first page is rendered as a PDF table, on the following pages we use the canvas to display the text.
This solution is somewhat ankward because we have to implement the headers twice with different techniques, but now JAWS finds at least the header on the first page.


text:
Q: Retrieving token on Swagger I need to retrieve token from link.
But when I enter valid username and password I do not see any token. Also I tried to retrieve it in my C# Android program.
`var client = new RestClient("https://networkrail-uk-qa.traffilog.com/swagger/ui/index#!/User/User_LoginData");
request.AddParameter("username", login);
request.AddParameter("password", password);
IRestResponse response = client.Execute(request);
var content = response.Content;`

There are a lot of data in output but there is no token. How can I get deal with it?

A: The request URL is wrong.
https://networkrail-uk-qa.traffilog.com/swagger/ui/index#!/User/User_LoginData

is just a documentation page (aka Swagger UI), not the actual request URL.
To find out the actual URL, use Swagger UI's "Try it out" feature: fill out the operation parameters and click "Try it out". It looks like the correct URL is
https://networkrail-uk-qa.traffilog.com/UK/api/User/Login?username={login}&password={password}

where the login and password need to be URL-encoded.

Also note the request HTTP method (POST), and that the parameters need to be passed in the query string. With all that in mind, your code should be:
var client = new RestClient("https://networkrail-uk-qa.traffilog.com");
var request = new RestRequest("UK/api/User/Login", Method.POST);
request.AddQueryParameter("username", login);
request.AddQueryParameter("password", password);

IRestResponse response = client.Execute(request);


text:
Q: The meaning and the usage of the expression "Don't you dare" To me, "Don't you dare!" is an expression that communicates a warning to someone. For instance:

*

*Don't you dare talk to me like that!

*Don't you dare follow me! (ete...)

But I wonder if you could paraphrase these examples with so that I could understand the precise meaning that appears to your minds after hearing this structure.
I think it can have two different meanings, (but I'm not sure):

*

*You don't have the right to....

*If you have enough courage, ...

I wonder how does it sound to you?
Please note that I have read the similar thread on the forum   three times before posting my question, but as you know and all the dictionaries have mentioned, the two expressions "dare I say" and "I dare say" are two completely different statements with some AFAIC possible overlaps which I think that they should be analyzed differently with separated examples.
Meanwhile, comparing the two expressions: "don't you dare" and "don't you worry" in the addressed link above doesn't make any sense to me!
The only point that was close to my interpretation was @James k's one where he had mentioned that the construction at hand has a connotation of:

*

*How dare you behave that way.

Moreover, I need to know whether it is common in current English these days? Also, Americans use it too or it is more of a British term?
Also, Michael R mentioned in his answer that:

The expression "don't you dare do something" is just a variant, is an emphatic way to say don't even think about trying to do that.

But how much streas and emphasis?!
To discover these all, I think paraphrasing the examples would be the best solution.

A: There is an implicit suggestion that to do X ("Don't you dare X...") will provoke a negative reaction from the speaker; to do X is considered wrong by them. It isn't encouraging the receiver to do the thing but trying to strongly discourage them.


text:
Q: An .ascx user control page opens up as hex? I am not sure if this is related to this weird behavior I'm experiencing: Why is my ASP.NET MVC project saving several copies of itself?
But I'm completely stumped.
My solution (asp.net mvc application) currently resides on the thumbdrive (cruzer micro 4gb), all the files were fine as of last night, this morninig I open one of a .ascx, and God almighty, it loads itself into the hex editor, why? what the heck?
I open this same user control in notepad and it's full of crazy random characters.
Somehow it turns itself, a plain text file, into a binary file?
Anyone run into this? I don't have backup (my fault, I should know better), is this reversable?

A: It could be that you saved the file and somehow triggered a different encoding to be used.
I believe I've seen something similar a couple of times.
Does it compile anyway? If not then it's not readable by VS either and you're probably screwed.


text:
Q: How can I store data from app engine datastore into csv file? I need to store the list of values querying from the datastore into a csv file
Here is my code that I am trying
//WriteCsvFileHandler is to
func WriteCsvFileHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
    kinDiagnosisList := []Diagnosis{}
    context := appengine.NewContext(r)

    //Getting Namespace
    namespace := ps.ByName("namespace")
    ctx, err := appengine.Namespace(context, namespace)
    if err != nil {
        log.Infof(ctx, "Namespace error from GetAllDiagnosisForEncounterHandler")
        RespondErr(w, r, http.StatusInternalServerError, err.Error())
        return
    }
    file, err := os.Create("result.csv")
    checkError("Cannot create file", err)
    defer file.Close()

    writer := csv.NewWriter(file)
    defer writer.Flush()

    q := datastore.NewQuery("Diagnosis")
    data, err := q.GetAll(ctx, &kinDiagnosisList)
    if err != nil {
        log.Infof(ctx, "Keys generation error from GetAllDiagnosisForEncounterHandler")
        RespondErr(w, r, http.StatusInternalServerError, err.Error())
        return
    }

    for _, value := range  {
        err := writer.Write(value)
        checkError("Cannot write to file", err)
    }
}

func checkError(message string, err error) {
    if err != nil {
        log.Fatal(message, err)
    }
}

How can I store the list of diagnosis coming from datastore into csv file?

A: Is there an error you are experiencing?
How large is the set of entities you need to be able to output?
The robust answer is to use Google Dataflow, but you'd have to write that job in java or python.
Otherwise, if you need a solution that is less involved, you'd have to build the file in memory before your handler serves it. If the request timeout is your issue, you could call that handler via Google TaskQueue to get the timeout bumped up to 10 minutes and write the file to Google Cloud Storage.


text:
Q: Unable to return using post method in an html form. what am i doing wrong? I am new to programming, i have been learning django for the first time. I created a form using home.html file an i requested using POST method, but in the error it is giving the request method as GET. When I remove the method="POST" and put request.GET in views file, it is working fine. What am I doing wrong here?
home.html
< form action="add" method="POST">

    {% csrf_token %}

    Enter 1st number : <input type="text" name="num1">

    Enter 2nd number : <input type="text" name="num2">

    <input type="submit">

</form>

views.py
def add(request):

    val1= int(request.POST['num1'])
    val2= int(request.POST['num2'])
    res= val1 +val2

    return render(request, 'result.html' ,{'result': res})

I am getting the following error:
MultiValueDictKeyError at /add
'num1'
Request Method:   GET
Request URL:    http://127.0.0.1:8000/add?num1=17&num2=4
Django Version: 4.0.1
Exception Type: MultiValueDictKeyError
Exception Value:
'num1'

A: Views.py
def add(request):
    if request.method == "POST":
        #LOGIC AS TO WHAT TO SERVE WHEN THIS VIEW RECIEVES A POST REQUEST
        val1= int(request.POST.get('num1'))
        val2= int(request.POST.get('num2'))
        res= val1 +val2
        return render(request, 'result.html' ,{'result': res})

    else:
        #serves non POST request , ie GET in this case
        ...your GET REQUEST LOGIC
        return render(request, 'GETREQUESTPAGE.html' ,{'param1': paramval})

urls.py:
# blog.urls
from django.urls import path

from . import views
#example consider a url for app named blog... mention the app name in the urls.py as below
app_name = 'blog'
urlpatterns = [
    path('', views.index(), name='add'),
]

home.html :
if you want to the view called "add" in the app blog to handle the POST request, then ...
< form action="{% url blogs.add %}" method="POST">

    {% csrf_token %}

    Enter 1st number : <input type="text" name="num1">

    Enter 2nd number : <input type="text" name="num2">

    <input type="submit">

</form>


text:
Q: SystemVerilog - Value of member class are not updated I have the following base class:
class base_transaction extends uvm_sequence_item();

   int rand_int_list [$];
   bit rand_bit_list [$];

   bit [31:0] data [$];

   //uvm_object_utils\
   `uvm_object_utils(base_transaction)

   //constructor
   function new(string name = "base_transaction");
      super.new(name);
   endfunction: new

   //add to list functions
   function void add_rand_int(ref int  mem);
      $display("array size is %d before push", rand_int_list.size());
      rand_int_list.push_back(mem);
      $display("array size is %d after push", rand_int_list.size());
      //rand_int_list[rand_int_list.size()] = mem;
   endfunction: add_rand_int

   function void add_rand_bit(ref bit mem);
     // rand_bit_list.
      rand_bit_list[rand_bit_list.size()] = mem;
   endfunction: add_rand_bit

   //function my_randomize
   function int my_randomize(int seed);
      int temp, success;
      if (rand_int_list.size > 0)
    begin
       for (int i = 0; i < rand_int_list.size(); i++)
         begin
        // temp = $urandom_range(1,11);
        temp = (($urandom(seed)) + 1);
        rand_int_list[i] = temp - 1;
        success = (temp && success);
         end
       if(success == 0)
         return 0;
    end
      if (rand_bit_list.size() > 0)
    begin
       for (int i = 0; i < rand_bit_list.size(); i++)
         begin
        // temp = $urandom_range(1,11);
        temp = (($urandom(seed)) + 1);
        rand_bit_list[i] = temp - 1;
        success = (temp && success);
         end
       if(success == 0)
         return 0;
       else
         return 1;
    end
   endfunction: my_randomize

endclass: base_transaction

I have the following class which extend the base class:
class tx_transaction extends base_transaction;
   bit [15:0]  data_xi;
   bit [15:0]  data_xq;
   int mem_int = 2, mem_int_a = 5;  //TODO- delete

   //uvm_object_utils\
   `uvm_object_utils(tx_transaction)

   //constructor
   function new(string name = "tx_transaction");
      super.new(name);
   endfunction: new

   function void add_rand_macro();
      add_rand_int(mem_int);
      add_rand_int(mem_int_a);
   endfunction: add_rand_macro

   //TODO - DELETE
   function void foo();
      $display("rand mem int: %d %d", mem_int, mem_int_a);
   endfunction: foo

endclass: tx_transaction

I call the following function from the sequence (tx_trx - is tx_transaction instance, and i is iterator):
     tx_trx.add_rand_macro();
     tx_trx.my_randomize(i+1);
     tx_trx.foo();

For some reason the foo function display allwas 2 5 (memt_int, mem_int_a), though those values are updated by the my_randomize function (which random the array which the member class are passed by ref)

A: Issue here is that your rand_int_list is a queue containing int values not reference to int varibles. So though you have passed mem as a ref, but still it's current value will be stored in the queue, not it's reference.
A workaround to this can be to keep track of location where you have pushed back the value and then use that location to retrieve the randomized values.
Your code may look like this.
//add to list functions
function int add_rand_int(ref int  mem);
  $display("array size is %d before push", rand_int_list.size());
  rand_int_list.push_back(mem);
  $display("array size is %d after push", rand_int_list.size());

  return (rand_int_list.size() - 1);
endfunction: add_rand_int

class tx_transaction extends base_transaction;
   bit [15:0]  data_xi;
   bit [15:0]  data_xq;
   int mem_int = 2, mem_int_a = 5;  //TODO- delete
   int location[string]; // An associative array to hold location of variables in rand_int_list queue

   //uvm_object_utils\
   `uvm_object_utils(tx_transaction)

   //constructor
   function new(string name = "tx_transaction");
      super.new(name);
   endfunction: new

   function void add_rand_macro();
      location["mem_inst"] = add_rand_int(mem_int);
      location["mem_inst_a"] = add_rand_int(mem_int_a);
   endfunction: add_rand_macro

   //TODO - DELETE
   function void foo();
      $display("rand mem int: %d %d", rand_int_list[location["mem_int"]], rand_int_list[location["mem_int_a"]]);
   endfunction: foo

endclass: tx_transaction


text:
Q: Excel Interop - get table style colors I work with Excel Interop, I try to get color of rows from specyfic Table Style.
I get name of Table Style like that:
var TableStyle = table.TableStyle.Name.ToString();

But I haven't got idea how get colors from known style.

A: I soloved my problem.
If somebody will have similar in the future.
You can access to table in that way:
var tse = table.TableStyle.TableStyleElements;
double rs1 = ((TableStyleElement)tse[5]).Interior.Color;
double rs2 = ((TableStyleElement)tse[6]).Interior.Color;

when indexes of tse is an enum:
https://learn.microsoft.com/en-us/dotnet/api/microsoft.office.interop.excel.xltablestyleelementtype?view=excel-pia
But If you need create new style, you should copy existing and edit.
https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2010/hh273483(v=office.14)?redirectedfrom=MSDN


text:
Q: updating custom variable value programatically I want to update the value of a custom variable programmatically, I am using magento 1.9.2
I have tried the solution given at programmatically create a custom variable but this is for creating custom variable but I want to update the value of an existing variable, and also this solution is not working in magento 1.9.2
Any help regarding this issue?
thanks

A: try this:
$code = 'variable-code';
$variable = Mage::getModel('core/variable')->loadByCode($code);
$variable->setName('Variable Name')
        ->setHtmlValue('Html Value')
        ->setPlainValue('Plain Value')
        ->save();

A: Magento 2 answer
For Magento 2+ you can use this in UpgradeData or UpgradeSchema:
// include the model
use Magento\Variable\Model\VariableFactory;

public function __construct(
      VariableFactory $varFactory
) {
      $this->varFactory = $varFactory;
}

// in your function or version_compare
$variable = $this->varFactory->create();
$code = 'variable-code';
$variable->loadByCode($code);
$variable->setName('Name Value, old or new')
         ->setHtmlValue('HTML Value, old or new')
         ->setPlainValue('Plain Value, old or new')
         ->save();


text:
Q: Click event is not firing in PowerBuilder on single line edit control In child window of my application, I have placed one single line edit control named as sle_name. Its tab order is 1.
Below that control I have placed DataWindow having formatted as free form style.
When I run the app, if my focus is in sle_name, and I click on sle_name then rbuttondown event is triggered. Then I move my focus to DataWindow(dw_account). Once I got focus on dw_account and then if I try to click on sle_name, my focus is not moving on sle_name and neither I can run rbuttondown event on sle_name.
What is the reason for this problem?
One more thing: when I start this window my focus in set in sle_name, from that control if I press tab key then my focuse moves to dw_account and if I press again shift+tab then my focus is moved back to sle_account.
But if I try to set focus from dw_account to sle_account using mouse pointer it is not moving focus.
What is the reason behind this behaviour?

A: I had the same behavior in a child window.
It was fixed when disabled the 'ControlMenu' and 'TitleBar' properties in the window. (It's so strange).
Hope it helps
Juanma

A: This isn't natural behaviour, so the cause is likely something you've scripted. Depending on your architecture, the culprit code could be a number of places (e.g. framework objects). If this were my problem, I'd run with the PBDEBUG trace turned on (a System Option in the IDE, or /PBDEBUG on the command line after the deployed EXE name), and see what is firing when you try to move back to the SLE.
I'd also be using PBL Peeper to see the trace and the code side-by-side, so it's easier to see what code is being executed (the trace only shows you script name and line number).
Good luck,
Terry.

A: you must have to create the event ID pbm_lbuttonup, with the same parameter as rbuttondown event. Then in the code you write this.setfocus()