text:
Q: How can I pass specific attributes across several objects using SQLAlchemies association_proxy? I have two types of objects:

*

*divers ValueObjects that inherit from BaseValueObject, and

*Addendum-objects that carry annotations.

Addendum has specific annotations (attributes: name, description, flag) and general annotations ((badgetype, badgevalue)) where the badgevalue is stored in a Badge-object and the badgetype in anAddendumBadgeMap`-object.
Now, I would like to access

*

*name, description, and flag as attributes from ValueOjects and

*Badges directly from ValueOjects as a dictionary.

Here is an example implementation:
import sqlalchemy as sa
import sqlalchemy.orm as orm
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base

DBSession = scoped_session(sessionmaker())
Base = declarative_base ()

###### ValueObjects: ##########
class BaseValueObject(Base):
  __tablename__ = 'value_objects'
  id = sa.Column(sa.Integer, primary_key=True)
  vo_type = sa.Column (sa.String, nullable=False)
  __mapper_args__ = {'polymorphic_on': vo_type}

class ObjectOne(BaseValueObject):
  __tablename__ = 'objects_one'
  __mapper_args__ = {'polymorphic_identity': 'ObjectOne'}
  id = sa.Column(sa.ForeignKey('value_objects.id'), primary_key=True)
  any_attribute = sa.Column(sa.String)

class ObjectTwo(BaseValueObject):
  __tablename__ = 'objects_two'
  __mapper_args__ = {'polymorphic_identity': 'ObjectTwo'}
  id = sa.Column(sa.ForeignKey('value_objects.id'), primary_key=True)
  any_attribute = sa.Column(sa.String)
###############################

##### Addendum and Bagde ##########
class Addendum(Base):
  __tablename__ = 'addenda'
  __table_args__ = (
      sa.UniqueConstraint('name', 'id'),
      {}
      )
  id = sa.Column (sa.Integer, primary_key=True)
  name = sa.Column (sa.String, nullable=False, default='')
  description = sa.Column (sa.String, nullable=False, default='')
  flag = sa.Column ( sa.Boolean, nullable=False, default=False)
  value_object_id = sa.Column ( sa.ForeignKey ('value_objects.id'),
      unique=True)

class Badge(Base):
  __tablename__ = 'badges'
  id = sa.Column (sa.Integer, primary_key=True)
  value = sa.Column (sa.String)

class AddendumBadgeMap(Base):
  __tablename__ = 'addendum_badge_maps'
  __table_args__ = (
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('badge_id', 'badge_type'),
      {}
      )
  id = sa.Column('id', sa.Integer)
  addendum_id = sa.Column(sa.ForeignKey('addenda.id'), nullable=False)
  badge_id =  sa.Column(sa.ForeignKey('badges.id'), nullable=False)
  badge_type = sa.Column (sa.String)
###################################

if __name__ == '__main__':
  engine = sa.create_engine('sqlite:///:memory:', echo=True)
  DBSession.configure(bind=engine)
  Base.metadata.create_all(engine)
  session = DBSession()

  o1 = ObjectOne(any_attribute="test1")
  session.add(o1)
  session.commit()

What do I have to add that I can do the following:
o1.name = "my_name"
# => `Addendum` will be attached with `name="my_name"`
o1.description = "my_description"
# => `descrpiption` of the attached `Addendum` get's changed
o1.flag
# => same behavior (in general: there should be max. one `Addendum` per `ValueObject`)
o1.bagdes = {"file_origin": "/home/.."}
# => attach to the `Addendum` a `Badge` with `value="/home/.."` and
#    `AddendumBagdeMap.badge_type="file_origin"` (if `Addendum` does
#     not exist for this `ValueObject`: create it first)

A: One solution would need two parts of implementation:

*

*Implementing a composite-association-proxies at Addendum

*Make the new property from (1) Addendum.badges accessible from BaseValueObject
Part 1: Implementation of composite-association-proxy
Add the following properties to Addendum:
badges = association_proxy (
    'addendum_badge_maps',
    'badge_value',
    creator=lambda bt, bv:
      AddendumBadgeMap(badge_type=bt, badge_value=bv)
    )

and the following to AddendumBadgeMap:
addendum = orm.relationship(Addendum, backref=orm.backref(
    'addendum_badge_maps',
    collection_class = attribute_mapped_collection("badge_type"),
    cascade="all, delete-orphan")
  )

badge = orm.relationship('Badge',
    single_parent=True,
    )

badge_value = association_proxy ('badge', 'value')

Now, add a __init__-method to Badge:
def __init__(self, value):
  self.value = value

and add the following imports on top:
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm.collections import attribute_mapped_collection

Part 2: Accessing the badge-proxy from BaseValueObjects
Link Addendum-objects to BaseValueObjects via adding property to Addendum:
base_value_object = orm.relationship(
    "BaseValueObject",
    backref=orm.backref('addendum', uselist=False)
    )

In order to access badegs add the following to BaseValueObjects:
def add_badge(self, badge_dict={}, **kwargs):
  if self.addendum is None:
    self.addendum = Addendum()
  badge_dict.update(kwargs)
  self.addendum.badges = badge_dict

_name = association_proxy('addendum', 'name',
    creator=lambda name: Addendum(
      name=name, description='', flag=False))
_description = association_proxy('addendum', 'description',
    creator=lambda description: Addendum(
      name='', description=description, flag=False))
_flag = association_proxy('addendum', 'flag',
    creator=lambda flag: Addendum(
      name='', description='', flag=flag))

@property
def badges(self):
  try:
    return self.addendum.badges
  except AttributeError:
    "In case that there is no ``Addendum`` specified, yet."
    return None

@badges.setter
def badges(self, value):
  self.add_badge(value)

@property
def name(self):
  try:
    return self._name
  except AttributeError:
    "In case that there is no ``Addendum`` specified, yet."
    return ""

@name.setter
def name(self, value):
  self._name = value

@property
def description(self):
  try:
    return self._description
  except AttributeError:
    "In case that there is no ``Addendum`` specified, yet."
    return ""

@description.setter
def description(self, value):
  self._description = value

@property
def flag(self):
  try:
    return self._flag
  except AttributeError:
    "In case that there is no ``Addendum`` specified, yet."
    return ""

@flag.setter
def flag(self, value):
  self._flag = value

The complete code
import sqlalchemy as sa
import sqlalchemy.orm as orm
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm.collections import attribute_mapped_collection

DBSession = scoped_session(sessionmaker())
Base = declarative_base ()

###### ValueObjects: ##########
class BaseValueObject(Base):
  __tablename__ = 'value_objects'
  id = sa.Column(sa.Integer, primary_key=True)
  vo_type = sa.Column (sa.String, nullable=False)
  __mapper_args__ = {'polymorphic_on': vo_type}

  # Define Badge-Access:
  def add_badge(self, badge_dict={}, **kwargs):
    if self.addendum is None:
      self.addendum = Addendum()
    badge_dict.update(kwargs)
    self.addendum.badges = badge_dict

  _name = association_proxy('addendum', 'name',
      creator=lambda name: Addendum(
        name=name, description='', flag=False))
  _description = association_proxy('addendum', 'description',
      creator=lambda description: Addendum(
        name='', description=description, flag=False))
  _flag = association_proxy('addendum', 'flag',
      creator=lambda flag: Addendum(
        name='', description='', flag=flag))

  @property
  def badges(self):
    try:
      return self.addendum.badges
    except AttributeError:
      "In case that there is no ``Addendum`` specified, yet."
      return None

  @badges.setter
  def badges(self, value):
    self.add_badge(value)

  @property
  def name(self):
    try:
      return self._name
    except AttributeError:
      "In case that there is no ``Addendum`` specified, yet."
      return ""

  @name.setter
  def name(self, value):
    self._name = value

  @property
  def description(self):
    try:
      return self._description
    except AttributeError:
      "In case that there is no ``Addendum`` specified, yet."
      return ""

  @description.setter
  def description(self, value):
    self._description = value

  @property
  def flag(self):
    try:
      return self._flag
    except AttributeError:
      "In case that there is no ``Addendum`` specified, yet."
      return ""

  @flag.setter
  def flag(self, value):
    self._flag = value

class ObjectOne(BaseValueObject):
  __tablename__ = 'objects_one'
  __mapper_args__ = {'polymorphic_identity': 'ObjectOne'}
  id = sa.Column(sa.ForeignKey('value_objects.id'), primary_key=True)
  any_attribute = sa.Column(sa.String)

class ObjectTwo(BaseValueObject):
  __tablename__ = 'objects_two'
  __mapper_args__ = {'polymorphic_identity': 'ObjectTwo'}
  id = sa.Column(sa.ForeignKey('value_objects.id'), primary_key=True)
  any_attribute = sa.Column(sa.String)
###############################

##### Addendum and Bagde ##########
class Addendum(Base):
  __tablename__ = 'addenda'
  __table_args__ = (
      sa.UniqueConstraint('name', 'id'),
      {}
      )
  id = sa.Column (sa.Integer, primary_key=True)
  name = sa.Column (sa.String, nullable=False, default='')
  description = sa.Column (sa.String, nullable=False, default='')
  flag = sa.Column ( sa.Boolean, nullable=False, default=False)
  value_object_id = sa.Column ( sa.ForeignKey ('value_objects.id'),
      unique=True)

  # Properties:
  base_value_object = orm.relationship(
      "BaseValueObject",
      backref=orm.backref('addendum', uselist=False)
      )

  badges = association_proxy (
      'addendum_badge_maps',
      'badge_value',
      creator=lambda bt, bv:
        AddendumBadgeMap(badge_type=bt, badge_value=bv)
      )

class Badge(Base):
  __tablename__ = 'badges'
  id = sa.Column (sa.Integer, primary_key=True)
  value = sa.Column (sa.String)

  def __init__(self, value):
    self.value = value

class AddendumBadgeMap(Base):
  __tablename__ = 'addendum_badge_maps'
  __table_args__ = (
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('badge_id', 'badge_type'),
      {}
      )
  id = sa.Column('id', sa.Integer)
  addendum_id = sa.Column(sa.ForeignKey('addenda.id'), nullable=False)
  badge_id =  sa.Column(sa.ForeignKey('badges.id'), nullable=False)
  badge_type = sa.Column (sa.String)

  #Properties:
  addendum = orm.relationship(Addendum, backref=orm.backref(
      'addendum_badge_maps',
      collection_class = attribute_mapped_collection("badge_type"),
      cascade="all, delete-orphan")
    )

  badge = orm.relationship('Badge',
      single_parent=True,
      )

  badge_value = association_proxy ('badge', 'value')
###################################

if __name__ == '__main__':
  engine = sa.create_engine('sqlite:///:memory:', echo=True)
  DBSession.configure(bind=engine)
  Base.metadata.create_all(engine)
  session = DBSession()

  o1 = ObjectOne(any_attribute="test1")
  o1.name = "First Object"
  session.add(o1)
  session.commit()

  o1.badges = {'first name': 'Max'}
  o1.badges['last name'] = 'Mueller'
  session.commit()
  print o1.name
  print o1.description
  print o1.flag
  print o1.any_attribute
  print o1.badges


text:
Q: Telerik RadHtmlChart not a known element I have Telerik bar chart  code that I want to embed on my Visual Basic page
However  RadHtmlChart and it's sub-components are not known.How do I make telerik RadHtmlChart  work within VB page.If there is any other tool that I can use to embed bar graph,suggestions are welcome.
             <form id="form1" runat="server">

                 <telerik:RadScriptManager ID="RadScriptManager1" runat="server">

                </telerik:RadScriptManager>

            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <telerik:RadHtmlChart runat="server" Width="800px"
            </telerik:RadHtmlChart>

redpajama_set_name: RedPajamaStackExchange


text:
Q: Word for "running commentary while watching films or TV shows"? How do I describe someone who comments continually while watching movies / reality shows / films etc.?
E.g. Opining about the behavior of someone on TV.

A: The person you refer to is the living-room version of the guy or gal who comments on the sporting event as it unfolds on TV in real time:  a color commentator.

There's Smith on the 40-yard line.  He's wide open, but . . . Oh no, he's been tackled hard by number 63, Hulking Halfback, who caught him unawares.  The football falls to the ground.  Incomplete pass.  That's the fourth time in this game alone that Hulking Halfback has prevented a completed pass.  Looks like it's time for the QB to find a new receiver, and preferably a receiver who is, wherever Halfback is not.  I see a penalty flag has been dropped at the 40-yard line; Hulking Halfback has been caught--finally!  His coach should take him out of the game.  What poor sportsmanship!

Here's your family's color commentator, waxing eloquent during a primetime sitcom:

It's about time that nosy neighbor got put in her place.  What a busybody!  I'll bet she doesn't open her mouth again for the whole episode.  Just because she thinks Jimmie shouldn't be allowed to go to the party, doesn't mean Jimmie's parents have to feel the same way.  Geesh.
[After the first commercial:] Boy, I didn't expect the parents to let Jimmie to go to that party.  He's only 16.  You just know he has some mischief on his mind.  He'll probably get drunk, and when he comes home at three in the morning his parents will be waiting for him in the living room, eager to give him a good reprimand.
I wonder if his younger sister will find out?  Then the parents will need to teach her about the evils of teenage drinking.  That'll come after the commercial.
[After the commercial:]  Yep, I told ya.  Here's little Jimmie coming home drunk as a skunk.  Oh, I didn't expect this:  here's little sis toddling down the staircase as her brother pukes on the living room floor!  Ewww.  Gross.  Now the whole family will have to have a pow-wow.  Nope.  Didn't expect that!  They're sending Jimmie to bed and telling his sister that Jimmie isn't feeling well.  They'll probably straighten things out in the morning.
[The next morning:]  I knew it.  Jimmie was going to wake up with an awful hangover!  It's noon, and his parents are waiting for him to come downstairs.  Maybe that nosy neighbor was right:  Jimmie shouldn't have been allowed to go to the party.  Anyone feel like some popcorn?

And so on.

A: motormouth, as defined by Merriam-Webster

a person who talks excessively

Example sentence: I couldn't follow the plot of the show because of motormouth's yakking.
This would fit for TV, but not at the movies: a motormouth would be asked to put a sock in it or leave.


text:
Q: tomcat8 is running, but no pid file I recently started working on a project that is running in an AWS instance using tomcat. I need to restart tomcat every once in a while, and I was told by their original owners that the following command would do the trick
$ sudo service tomcat8 restart

Unfortunately it doesn't work, and I get the following error:
tomcat8 running, but no pid file^[[60G[^[[0;31mFAILED^[[0;39m]
Starting tomcat8: ^[[60G[^[[0;31mFAILED^[[0;39m]

More than just finding a workaround to restart it with other commands, I would like to know if there's a way to make that command work properly 'cause there must be something off and I don't seem to find what is it.

A: If you happen to run over the same issue, freeing up space might solve it, it did for me.


text:
Q: Run nightly jobs on multibranch pipeline with declarative Jenkinsfile without deprecated feature 'Suppress automatic SCM triggering' Jenkins ver. 2.150.3
I have a multi-branch pipeline set up. I am using a declarative Jenkinsfile. I have a set of jobs which take a long time to run. I want these to run over night for any branches which have changes.
In the past, one could use the 'Suppress automatic SCM triggering' option along with a cron trigger to achieve the nightly build for branches with changes. (See Run nightly jobs on multibranch pipeline with declarative Jenkinsfile
I no longer have access to the 'Suppress automatic SCM triggering' option.

The following trigger will run even if there are no changes to the code in the branch.
triggers {
    cron('H 0 * * * *')
}

The following code runs if there are changes in the branch. However, the Jenkins multibranch project seems to trigger from the push rather than the pollSCM. This doesn't seem to achieve my desired outcome of running once nightly per branch if there are changes.
triggers {
    pollSCM('H 0 * * * *')
}

How do I configure Jenkins to achieve the nightly jobs per branch only if changes exist in that branch?

A: Adding answer from comment to here.
You can achieve this by using the following script:
triggers {
  pollSCM ignorePostCommitHooks: true, scmpoll_spec: 'H H * * *'
}

With directive generator (available at <yourJenkinsUrl>/directive-generator/ you can generate scripts available in your instance + see some documentation, f.e.:

To allow periodically scheduled tasks to produce even load on the
  system, the symbol H (for "hash") should be used wherever possible.
  For example, using 0 0 * * * for a dozen daily jobs will cause a large
  spike at midnight. In contrast, using H H * * * would still execute
  each job once a day, but not all at the same time, better using
  limited resources.


text:
Q: Wso2 with jrockit JVM We are looking to run WSO2 with JRockit 1.6 JVM, are there any known issues or we need to use Hotspot JVM?
I could not find documentation if JRockit is supported, but wanted to check as we use JRockit in our Production for high performance.

A: WSO2 products only support Oracle and IBM JVMs. See http://docs.wso2.org/display/Carbon420/Installation+Prerequisites
This means that we cannot guarantee that WSO2 products will support JRockit. However you are welcome to try it out.
I hope you have a pre-production environment to test this.
I hope this helps.


text:
Q: Dynamically set choices in django model based on whether adding a new record or editing existing I'd like to have one set of choices if adding a new record and a different set if editing an existing record. I thought something like the following would work but it doesn't.
class MyModel(models.Model):
    CHOICES = (('1', 'Option 1'), ('2', 'Option 2'), ('3', 'Option 3'), ('4', 'Option 4'),)
    def test(self):
        if self.pk:
            return True
    if test is True:
        CHOICES = (('1', 'Option 1'), ('2', 'Option 2'),)
    my_field = models.CharField(max_length=1, choices=CHOICES)

A: Basically, your code is good enough to do the trick you're trying to;
Just a little mistake here:
if test is True: #NOT GOOD
instead it should be:
if test: #GOOD
Your code would become
if test: # the opposite is : if not test:
    CHOICES = (('1', 'Option 1'), ('2', 'Option 2'),)


text:
Q: How to access a inner nested function from outside? Here's a sample code of the situation that I'm stuck in:
    <script>
    var mod = (function(){
        var inn1;
        function innfunc(){

        }
    }()); //mod is self expression function
    </script>

Suppose that HTML includes this javascript code and I would like to open my Java console and call the innfunc() or the variable inn1, then what can I write?
perhaps something like: mod.innfunc()?

A: You have to expose a "public interface" by returning it from inside the function:
return {
    inn: inn1,
    innfunc: innfunc
}

Then you can access them using mod.inn and mod.innfunc.

A: try this:
 var mod = function(){

    this.inn1 = "Hello";

    this.innfunc = function(){
      console.log('Here');
    }

  };
  var x = new mod();
  console.log(x.inn1);
  x.innfunc();

you can use this to make variables and methods public

A: You have executed an anonymous function and assigned the result of that function to mod. You no longer have access to that anonymous function or any of its properties.
If you want to access any of its properties later, there are multiple ways to do this. One of them is:
Return an object having properties which you need outside of this function
var mod = (function() {
  var inn1 = 'somevalue';

  var innfunc = function() {
  };

  return {
    inn1: inn1,
    innfunc: innfunc
  };
}()); //mod is self expression function

Now, you can access it as mod.innfunc()

A: +1 to what the others have said. I guess they beat me to it, haha.
I've added an example of stuff you can keep private within the function as well:
var mod = (function() {

    var publicText = 'Public!';
    var privateText = 'Private';

    var func1 = function() {
        console.log('hi');
    };

    var func2 = function() {
        console.log('there');
    };

    return {
        hi: func1,
        there: func2,
        publicText: publicText
    };
})();

mod.hi();
mod.there();

console.log(mod.publicText);

// This will fail, since the object.key privateText was never defined
console.log(mod.privateText);

Hope this helps!


text:
Q: What is an opaque token? And what does it mean that they are in a "proprietary format"? I am reading about JWT refresh tokens and they are opaque tokens, but I don't understand the term.

A: A JWT has readable content, as you can see for example on https://jwt.io/.
Everyone can decode the token and read the information in it. The format is documented in RFC 7519.
An opaque token on the other hand has a format that is not intended to be read by you. Only the issuer knows the format.
The meaning of the word already gives a hint:

opaque
/ə(ʊ)ˈpeɪk/
adjective

not able to be seen through; not transparent.

Here's a quote from https://auth0.com/docs/tokens:

Opaque tokens: Tokens in a proprietary format that typically contain some identifier to information in a server's persistent storage. To validate an opaque token, the recipient of the token needs to call the server that issued the token.

A "opaque JWT refresh token" is a contradiction as per definition above. What actually is meant here is, that in some JWT frameworks only the authentication token is a JWT, but as refresh token they use opaque tokens.

A: Here, the term "opaque" means the string (that serves as token) is like a reference (in OOPs), or pointer (in C), or foreign keys (in relational DBs).
i.e. You need an external content to resolve it.
Simple versus Composite:
The string is a "simple" string, as opposed to JWS, where is "composite"; It has parts "inside" it.
Inside versus Outside:
You can extract a payload (with claims, etc) out of it without referring to an external server or storage, "outside" this string.
Since an opaque token is a simple string it is just a reference, hence, naturally, its format is entirely arbitrarily determined by the server that issues it (hence the term "proprietary format"). The token string is determined at the time of creation of the underlying (referred-to) content, i.e. when it is paired (associated) with the contents that this token (as the reference or foreign key) refers to.


text:
Q: How to create a parallax background attached to HTML tag? I saw the following post which is exactly what I need, except for my background image is not on the body tag it's on the html tag. I've tried all sorts to get it to work but can't figure out how to grab the html tag in jQuery.
Slow scrolling background in Javascript or CSS?
Is this something simple I'm missing?


text:
Q: how to grab button class name created in javascript var inputEl=document.querySelector("#input-bar");
    var addBtnEl=document.querySelector("#btn");
    var ulEl=document.querySelector("#output-line");
    // var list=document.querySelector(".list");
    console.log(inputEl);
    let savedIn=[];
    addBtnEl.addEventListener("click",function(){
        savedIn.push(inputEl.value);
        console.log(savedIn);
        console.log(savedIn.length);
        for(let i=0;i<savedIn.length;i++){
            var sample=`<li class="list">${savedIn[i]}</li><button class="tick"><span id="tick-span">✓</span></button><br>`;
            console.log("in for");
        }
        ulEl.innerHTML+=sample;
        // ulEl.innerHTML+=`<li>helloo</li><button>hiii</button>`;
    });
    // tickbtn.addEventListener("click",function(){
        //     // list.style.backgroundColor="blue";
        //     console.log("tick btn");

        // });
        var tickbtn=document.getElementsByClassName("tick");
console.log(tickbtn);

**

*

*i have create a button and added class name ="tick

"

*and i try to grab class name of button but its not grabbing and
logging out on console

*how do I grab button class name "tick"**

A: Try

var tickbtn=document.getElementsByClassName("tick")[0];

A: After testing your code on https://codepen.io/pen/ (which i recommend you to use for quick frontend stuff), I come up to the following solution :

var inputEl=document.querySelector("#input-bar");
var addBtnEl=document.querySelector("#btn");
var ulEl=document.querySelector("#output-line");
// var list=document.querySelector(".list");
console.log(inputEl);
let savedIn=[];

function f() {
  savedIn.push(inputEl.value);
  for(let i=0;i<savedIn.length;i++){
    var sample=`<li class="list">${savedIn[i]}</li><button class="tick"><span id="tick-span">✓</span></button><br>`;
    console.log("in for");
  }
  ulEl.innerHTML+=sample;
}
function g() {
  var tickbtn = document.getElementsByClassName("tick");
  console.log(tickbtn[0]);
}
<input type="text" id="input-bar">
<button id="btn" onclick="f(); g()">Click</button>

Like that the output won't be undefined anymore ; it will display the first button (tickbtn[0]). And as I told you above in the comments section, it's preferably to not use event listeners in this situation.
For any other problem, do not hesitate.


text:
Q: Swift: Auto layout and table view cells with dynamic heights I've created a test project to understand table cells with variable heights. I've read a number of tutorials on StackOverflow and elsewhere but I'm still doing something wrong, and I'm not quite sure what.
How do I ensure that regardless of the string length, the table cell's height changes to accommodate all of the text?
Here I set up my table view with an array of strings of various lengths.
Here's what my simulator shows, as well as my code:

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
    var items: [String] = ["We", "Aenean lacinia bibendum nulla sed consectetur.", "Vestibulum id ligula porta felis euismod semper. Maecenas sed diam eget risus varius blandit sit amet non magna. Sed posuere consectetur est at lobortis. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Cras mattis consectetur purus sit amet fermentum. Etiam porta sem malesuada magna mollis euismod. Sed posuere consectetur est at lobortis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.", "Blah", "one two three", "Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam.", "gum gum gum gum", "Blah", "one two three", "Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam.", "gum gum gum gum", "Blah", "one two three", "Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam.", "gum gum gum gum", "Blah", "one two three", "Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam.", "gum gum gum gum", "Blah", "one two three", "Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam.", "gum gum gum gum", "Blah", "one two three", "Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam.", "gum gum gum gum"]

    @IBOutlet var tableView: UITableView!

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return self.items.count
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell") as UITableViewCell

        cell.textLabel?.text = self.items[indexPath.row]

        return cell
    }

    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        println("You selected cell #\(indexPath.row)!")
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")

        self.tableView.rowHeight = UITableViewAutomaticDimension
        self.tableView.estimatedRowHeight = 130.0
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    override func prefersStatusBarHidden() -> Bool { return true }
}

In my storyboard, I have a single test cell set up with some constraints (which may be done incorrectly, not sure). Constraints seem to be the crux of nailing this implementation or totally screwing it up

Any help would be hugely appreciated. Thanks!

A: To use autolayout with multi-line labels, you need to set the preferredMaxLayoutWidth property (in viewDidLoad or elsewhere appropriately). This will cause autolayout to "do the right thing" and make your label expand to a multi-line label. See https://developer.apple.com/library/ios/documentation/UIKit/Reference/UILabel_Class/index.html#//apple_ref/occ/instp/UILabel/preferredMaxLayoutWidth
Note that for this to work properly inside a UITableViewCell, you should also response to heightForRowAtIndexPath - see https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITableViewDelegate_Protocol/index.html#//apple_ref/occ/intfm/UITableViewDelegate/tableView:heightForRowAtIndexPath:

A: PLease implement it as well
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath : NSIndexPath) -> CGFloat {
        return UITableViewAutomaticDimension
    }


text:
Q: Why does print line is invalid syntax? [python] #!/usr/bin/python
def creating_table():
mailingTable = open("mailingTable.txt", "r")
lines = mailingTable.readline()
for line in lines:
    print line
mailingTable.close()

It says print line is invalid syntax. Why? I m using python 3.3.5

A: In Python 3.x, you have to write print() as follows, because now it's a function:
print(line)

In Python 2.x it was possible to omit the (), but that's no longer the case.


text:
Q: How to transform the points assigned to a rigid body along side the body? To describe the problem, I bring an example here in figure below.
As can be seen, there is a line AB and its assigned point p1.
For this line I have a corresponding line, namely CD. I am looking for the coordinate of point p2. The relation between point p2 and line CD should be same as relation between point p1 and line AB (same distance d and same length m). I have the coordinate of points A, B, p1, C, D, and I am looking for p2. Generaly, d and m can accept a scale factor for line CD and point p2, which we know that already.
As you might know, the problem has another fake solution like p3 in the left side of line CD, which we should avoid that.
In my real problem I have 10 lines AB and around 500 point like p1 asigned to different lines AB. I have the ten corresponding lines CD, I am looking for the 500 cooresponding point p2.
Using the algebra and geometry it is possible to solve the problem, but I am looking for a fast and efficient method for implementation in C++.
Thanks very much for your comments and suggestions.

A: First of all, you need to represent any movement of AB as a rotation and translation about a single point, like point A for simplicity. Then, for any other point that needs to be rotated along with AB, you should move that point into the space of line AB by subtracting point A, and then transform it back into worldspace by adding the new point A back to it after the translation and rotation.
I dont have the formula on hand atm, but Ill try to dig up an example.
EDIT
Untested code:
void transform_points(const point2f &center, vector<point2f> &points, const point2f &offset, float angle)
{
    // transform points into a space where 'center' is the origin
    mat3f to_origin = mat3f(1, 0, -center.x,
                            0, 1, -center.y,
                            0, 0, 1);

    // rotate the points around the origin
    mat3f rot = mat3f(cos(angle), -sin(angle), 0,
                      sin(angle),  cos(angle), 0,
                      0, 0, 1);

    // move the points back into world space
    mat3f to_world = mat3f(1, 0, center.x,
                           0, 1, center.y,
                           0, 0, 1);

    // offset the points by 'offset'
    mat3f off = mat3f(1, 0, offset.x,
                      0, 1, offset.y,
                      0, 0, 1);

    // concatenate all transformations for efficiency
    mat3f xform = off * to_world * rot * to_origin;

    // this loop could be parallelized using SIMD or multiple cores
    for(auto &p : points)
        p = xform * p;
}


text:
Q: Python pandas idxmax for multiple indexes in a dataframe I have a series that looks like this:
            delivery
2007-04-26  706           23
2007-04-27  705           10
            706         1089
            708           83
            710           13
            712           51
            802            4
            806            1
            812            3
2007-04-29  706           39
            708            4
            712            1
2007-04-30  705            3
            706         1016
            707            2
...
2014-11-04  1412          53
            1501           1
            1502           1
            1512           1
2014-11-05  1411          47
            1412        1334
            1501          40
            1502         433
            1504         126
            1506         100
            1508           7
            1510           6
            1512          51
            1604           1
            1612           5
Length: 26255, dtype: int64

where the query is: df.groupby([df.index.date, 'delivery']).size()
For each day, I need to pull out the delivery number which has the most volume. I feel like it would be something like:
df.groupby([df.index.date, 'delivery']).size().idxmax(axis=1)

However, this just returns me the idxmax for the entire dataframe; instead, I need the second-level idmax (not the date but rather the delivery number) for each day, not the entire dataframe (ie. it returns a vector).
Any ideas on how to accomplish this?

A: Your example code doesn't work because the idxmax is executed after the groupby operation (so on the whole dataframe)
I'm not sure how to use idxmax on multilevel indexes, so here's a simple workaround.
Setting up data :
import pandas as pd
d= {'Date': ['2007-04-26', '2007-04-27', '2007-04-27', '2007-04-27',
             '2007-04-27', '2007-04-28', '2007-04-28'],
        'DeliveryNb': [706, 705, 708, 450, 283, 45, 89],
        'DeliveryCount': [23, 10, 1089, 82, 34, 100, 11]}

df = pd.DataFrame.from_dict(d, orient='columns').set_index('Date')
print df

output
            DeliveryCount  DeliveryNb
Date
2007-04-26             23         706
2007-04-27             10         705
2007-04-27           1089         708
2007-04-27             82         450
2007-04-27             34         283
2007-04-28            100          45
2007-04-28             11          89

creating custom function :
The trick is to use the reset_index() method (so you easily get the integer index of the group)
def func(df):
    idx = df.reset_index()['DeliveryCount'].idxmax()
    return df['DeliveryNb'].iloc[idx]

applying it :
g = df.groupby(df.index)
g.apply(func)

result :
Date
2007-04-26    706
2007-04-27    708
2007-04-28     45
dtype: int64

A: Suppose you have this series:
            delivery
2001-01-02  0           2
            1           3
            6           2
            7           2
            9           3
2001-01-03  3           2
            6           1
            7           1
            8           3
            9           1
dtype: int64

If you want one delivery per date with the maximum value, you could use idxmax:
dates = series.index.get_level_values(0)
series.loc[series.groupby(dates).idxmax()]

yields
            delivery
2001-01-02  1           3
2001-01-03  8           3
dtype: int64

If you want all deliveries per date with the maximum value, use transform to generate a boolean mask:
mask = series.groupby(dates).transform(lambda x: x==x.max()).astype('bool')
series.loc[mask]

yields
            delivery
2001-01-02  1           3
            9           3
2001-01-03  8           3
dtype: int64

This is the code I used to generate series:
import pandas as pd
import numpy as np

np.random.seed(1)
N = 20
rng = pd.date_range('2001-01-02', periods=N//2, freq='4H')
rng = np.random.choice(rng, N, replace=True)
rng.sort()
df = pd.DataFrame(np.random.randint(10, size=(N,)), columns=['delivery'], index=rng)
series = df.groupby([df.index.date, 'delivery']).size()

A: If you have the following dataframe (you can always reset the index if needed with : df = df.reset_index()   :
  Date  Del_Count  Del_Nb
0  1/1      14      19   <
1           11      17
2  2/2      25      29   <
3           21      27
4           22      28
5  3/3      34      36
6           37      37
7           31      39   <

To find the max per Date and extract the relevant Del_Count you can use:
df = df.ix[df.groupby(['Date'], sort=False)['Del_Nb'].idxmax()][['Date','Del_Count','Del_Nb']]

Which would yeild:
 Date  Del_Count  Del_Nb
0  1/1         14      19
2  2/2         25      29
7  3/3         31      39


text:
Q: Solve $e^x\sin y = 2$ How do I solve for $x$ and $y$ in $e^x\sin y = 2$
If $e^x = 2$ and $\sin y = 1$, I get $x = \ln2$ and $y = (4n-3)\frac{\pi}{2}$
But are these the only $x$? I don't think so.
Please help

A: If you want other real solutions, note that $e^x >0$ and $-1 \le \sin(y)\le 1$
so if their product is $2$ then you need $0 < \sin(y) \le 1$, i.e.

*

*any $y$ with $2n\pi < y \lt (2n+1)\pi$ for some $n$,

*giving
$x = \log_e\left(\frac{2}{\sin(y)}\right)$ which will be $\ge \log_e(2)$

A: For $x\ge\ln(2)$, $e^x\ge 2$, so any $y$ where $0\le\sin(y)\le 1$ is possible.  For a single range $0\le y\le \frac{\pi}{2}$

A: $2 = e^x\sin y = \Im(e^x(\cos y + i\sin y)) = \Im(e^{x+iy}) = \Im(e^z)$ where $z = x + iy$. Therefore, all $z=x+iy$ such that $\Im(e^z) = 2$ is solution.

A: Since one equation only is available when two are needed to solve fully.. we have intersections of a contour with a plane as $f(x,y)$ in the real.

In this case oscillatory sin function produces two intersections as seen in the 3d plot.


text:
Q: Combined Plot of a loop I want this program to plot to be combined into one plot - just can't seem to make it appear in one plot. Any suggestions?
n = -1; While[n < 3,
sol = NDSolve[{D[xtraj[t],
  t] == -(Sinh[
     2 xtraj[t] (-t + 2)]/
      (Cosh[2 xtraj[t] (-t + 2)])), xtraj[0] == n},
xtraj[t], {t, -4, 8}]; n = n + 0.25;
p = ParametricPlot[{t, xtraj[t]} /. sol, {t, -4, 8},
PlotRange -> All, PlotStyle -> {Blue, Full, Thick},
AxesStyle -> Thickness[.001], LabelStyle -> {Black, Medium}];
Print[p]]

A: Try this
Show[Table[
  sol = NDSolve[{D[xtraj[t],t] == -(Sinh[2 xtraj[t] (-t + 2)]/
    (Cosh[2 xtraj[t] (-t + 2)])), xtraj[0] == n},xtraj[t], {t, -4, 8}];
  ParametricPlot[{t, xtraj[t]} /. sol, {t, -4, 8},
    PlotRange -> All, PlotStyle -> {Blue, Full, Thick},
    AxesStyle -> Thickness[.001], LabelStyle -> {Black, Medium}],
  {n,-1,3-1/4,1/4}]]


text:
Q: Replace only hard returns between two tags using grep/regex I would all of the data between <item> and </item> in an .xml file to be on one line (i.e. replace each \r with \t). So instead of this:
    <item>
        <title>Image</title>
        <link>http://www.somewebsite.com/?post_type=acf-field&p=23</link>
        <pubDate>Thu, 06 Aug 2015 15:19:17 +0000</pubDate>
        <dc:creator><![CDATA[joey]]></dc:creator>
        <guid isPermaLink="false">https://www.somewebsite.com/?post_type=acf-field&p=23</guid>
        <description></description>
        <content:encoded><![CDATA[a:16:{s:4:"type";s:5:"image";s:12:"instructions";s:48:"Image size should be 1110px wide by 1154px tall.";s:8:"required";i:0;s:17:"conditional_logic";i:0;s:7:"wrapper";a:3:{s:5:"width";s:0:"";s:5:"class";s:0:"";s:2:"id";s:0:"";}s:13:"parent_layout";s:13:"55c37498bba7e";s:13:"return_format";s:2:"id";s:12:"preview_size";s:6:"medium";s:7:"library";s:3:"all";s:9:"min_width";s:0:"";s:10:"min_height";s:0:"";s:8:"min_size";s:0:"";s:9:"max_width";s:0:"";s:10:"max_height";s:0:"";s:8:"max_size";s:0:"";s:10:"mime_types";s:0:"";}]]></content:encoded>
        <excerpt:encoded><![CDATA[image]]></excerpt:encoded>
        <wp:post_id>23</wp:post_id>
        <wp:post_date>2015-08-06 15:19:17</wp:post_date>
        <wp:post_date_gmt>2015-08-06 15:19:17</wp:post_date_gmt>
        <wp:comment_status>open</wp:comment_status>
        <wp:ping_status>open</wp:ping_status>
        <wp:post_name>field_55c374e5aecef</wp:post_name>
        <wp:status>publish</wp:status>
        <wp:post_parent>22</wp:post_parent>
        <wp:menu_order>0</wp:menu_order>
        <wp:post_type>acf-field</wp:post_type>
        <wp:post_password></wp:post_password>
        <wp:is_sticky>0</wp:is_sticky>
    </item>

I would like this:
<item>  <title>Image</title>    <link>http://www.somewebsite.com/?post_type=acf-field&p=23</link>  <pubDate>Thu, 06 Aug 2015 15:19:17 +0000</pubDate>  <dc:creator><![CDATA[joey]]></dc:creator>   <guid isPermaLink="false">https://www.somewebsite.com/?post_type=acf-field&p=23</guid> <description></description> <content:encoded><![CDATA[a:16:{s:4:"type";s:5:"image";s:12:"instructions";s:48:"Image size should be 1110px wide by 1154px tall.";s:8:"required";i:0;s:17:"conditional_logic";i:0;s:7:"wrapper";a:3:{s:5:"width";s:0:"";s:5:"class";s:0:"";s:2:"id";s:0:"";}s:13:"parent_layout";s:13:"55c37498bba7e";s:13:"return_format";s:2:"id";s:12:"preview_size";s:6:"medium";s:7:"library";s:3:"all";s:9:"min_width";s:0:"";s:10:"min_height";s:0:"";s:8:"min_size";s:0:"";s:9:"max_width";s:0:"";s:10:"max_height";s:0:"";s:8:"max_size";s:0:"";s:10:"mime_types";s:0:"";}]]></content:encoded>   <excerpt:encoded><![CDATA[image]]></excerpt:encoded>    <wp:post_id>23</wp:post_id> <wp:post_date>2015-08-06 15:19:17</wp:post_date>    <wp:post_date_gmt>2015-08-06 15:19:17</wp:post_date_gmt>    <wp:comment_status>open</wp:comment_status> <wp:ping_status>open</wp:ping_status>   <wp:post_name>field_55c374e5aecef</wp:post_name>    <wp:status>publish</wp:status>  <wp:post_parent>22</wp:post_parent> <wp:menu_order>0</wp:menu_order>    <wp:post_type>acf-field</wp:post_type>  <wp:post_password></wp:post_password>   <wp:is_sticky>0</wp:is_sticky>  </item>

This post got me close but I am still learning regex commands and cannot figure it out.
Thank you in advance for your help!

A: Having that the item nodes don't appear nested, meaning item nodes doesn't contain other item nodes, you can use this sed command:
sed '/<item>/{:a;N;/<\/item>/!ba;s/\n/\t/g;}' file.xml

When the pattern <item> occurs in the file the block between the { ... } gets executed.
:a defines a label, N reads the next line and appends it to the pattern buffer. /<\/item>/ checks for the closing </item> node in the pattern buffer. If it is not found (!), ba branches back to the label a.
Once the closing <item> tag is reached, s/\n/\t/g replaces all newlines in the pattern buffer by tabs.


text:
Q: Solve the systems of equations for real numbers $x$, $y$, $z$ Solve the system of equations in real solutions:
$x+2y+z$ $=$ $5(x+y)(y+z)$,
$y+2z+x$ $=$ $7(y+z)(z+x)$,
$z+2x+y$ $=$ $6(z+x)(x+y)$,
I substituded $a=x+y$, $b=y+z$ and $c=z+x$ and got:
$5ab-a-b$ $=$ $0$,
$7bc-b-c$ $=$ $0$,
$6ac-a-c$ $=$ $0$, and got to the conclusion where all equals $0$, but can't prove it
Thank you for your help!

A: If one of $a$, $b$ and $c$ are zero, then they all are. So assume none of them are, and divide your three equations by $ab$ etc. to get
$$5=\frac1a+\frac1b,$$
$$7=\frac1b+\frac1c$$
and
$$6=\frac1a+\frac1c.$$
So three linear equations for $1/a$, $1/b$ and $1/c$. There ought to be a unique solution to this; I'll let you find it!

A: Considering $$5ab-a-b=0\tag 1$$ $$7bc-b-c=0\tag 2$$ $$6ac-a-c=0\tag 3$$ extract $b=\frac{a}{5 a-1}$ from $(1)$ (assuming $a\neq \frac 15$), $c=\frac{a}{6 a-1}$ from $(3)$ (assuming $a\neq \frac 16$). Replace in $(2)$ and simplify to get $$\frac{2 (1-2 a) a}{30 a^2-11 a+1}=0$$
Lord Shark's solution is better


text:
Q: Configuring redux to display on all browsers is not working correctly I followed the instructions over at the official docs; my app was working just fine in chrome, pointing to localhost:3000. However, now Im running into an issue, because it seems that if a browser doesnt have Redux extension, it won't work. According to the docs, I have written out:
import { createStore, applyMiddleware, compose } from "redux";
import thunk from "redux-thunk";
import rootReducer from "./reducers"; //we dont have to put index.js because its called index.js

const initialState = {};

const middleware = [thunk];

const store = createStore(
  rootReducer,
  initialState,
  compose(
    applyMiddleware(...middleware),
    window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
  )
); //spread operator '...'

export default store;

Am I missing something? It seems that others are running into the same issue and solutions seem unique per codebase.

Edit: I've also tried this solution, but Im getting an error TypeError: _store__WEBPACK_IMPORTED_MODULE_12__.default.dispatch is not a function

Edit 2: In chrome incognito mode (where the redux dev tool extension is not enabled), I run into the error,
TypeError: Cannot read property 'apply' of undefined
(anonymous function)
C:/Users/MishaFresh/Desktop/mern-app/MERN_app/client/node_modules/redux/es/redux.js:575
  572 |
  573 |   return funcs.reduce(function (a, b) {
  574 |     return function () {
> 575 |       return a(b.apply(void 0, arguments));
  576 |     };
  577 |   });
  578 | }

Likewise same error in Firefox.

My package.json:
"scripts": {
    "client-install": "npm install --prefix client",
    "start": "node server.js",
    "server": "nodemon server.js",
    "client": "npm start --prefix client",
    "dev": "concurrently \"npm run server\" \"npm run client\"",
    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"

  },

Edit 3:
New error after implementing the suggestion below:
TypeError: _store__WEBPACK_IMPORTED_MODULE_12__.default.dispatch is not a function
Module../src/App.js
C:/Users/Me/Desktop/my-app/app/client/src/App.js:40
  37 | //decode it
  38 | const decoded = jwt_decode(localStorage.jwtToken);
  39 | //set user and isAuthenticated
> 40 | store.dispatch(setCurrentUser(decoded));
     | ^  41 |
  42 | //check for expired token
  43 | const currentTime = Date.now() / 1000;

A: Try this:
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

export default () => {
  const store = createStore(
    combineReducers({
      // your reducers here...
    }),
    composeEnhancers(applyMiddleware(thunk))
  );

  return store;
};

From your link to the github issue the answer is provided and a good amount of discussion around it... (worth another read or two) That answer in turn links to the advanced setup


text:
Q: Open Graph Insights: Definitions of "Objects" and "Actions" When viewing insights for Open Graph, at the very bottom of the page we get the following:
1,193   App Created Actions?

The number of Open Graph Actions created by this application.

and:
50,808  App Created Objects?

The number of Open Graph Objects created by this application.

But what exactly are they, and how do they correlate? Actions are relatively obvious, they would cover the 'news.reads' and I had assumed objects would be the 'article' object you 'read'... but logic would dictate that you'd have a significantly lower number of objects than you would actions, rather than vice versa.
You'd think that 10 people might 'read' 1 article, thus giving you 10 actions against 1 object.
Have I misunderstood?


text:
Q: InnerHTML changes reverting on form submit I am trying to change the contents of a paragraph to the value of a text input field on the input field's submit. The paragraph will momentarily change and then the page will refresh and the changes will be reverted. How do I keep the changes? Thank you!
Here is my code:
<!DOCTYPE html>

    <form onsubmit = "myFunction()">
        <input id = "input" type = "text">
    </form>

 This should be changed on submit


text:
Q: Does the Darwin Lagrangian neglect deviations from the Coulomb field? The Darwin Lagrangian is said to describe the interaction between two charges to order $(v/c)^2$, and consists of a free part
$$L_0 = \sum_{i = 1, 2} \frac12 m_i v_i^2 + \frac{1}{8c^2} m_i v_i^4$$
and an interaction
$$L_{\text{int}} = - \frac{q_1 q_2}{r} + \frac{q_1 q_2}{r} \frac{1}{2 c^2} (\mathbf{v}_1 \cdot \mathbf{v}_2 + (\mathbf{v}_1 \cdot \hat{\mathbf{r}})(\mathbf{v}_2 \cdot \hat{\mathbf{r}})).$$
However, it appears to me that this interaction doesn't capture all of the $O(v^2)$ corrections. The first term is the $O(v^0)$ Coulomb potential, while the second term presumably captures the Lorentz force on one charge due to the magnetic field produced by the other; each of these are $O(v)$, giving an $O(v^2)$ effect.
However, another effect is that the electric field produced by a moving charge with uniform velocity differs from the Coulomb field at $O(v^2)$. This seems to imply that $L_{\text{int}}$ should include terms proportional to $v_1^2$ and $v_2^2$, but it doesn't.
I can think of a couple things that could be going on here.

*

*The Darwin Lagrangian just explicitly excludes this interaction. But then what do people mean when they say it's accurate to order $(v/c)^2$?

*Even though it looks like the required term isn't present in $L_{\text{int}}$, the desired contribution appears after one computes the complicated Euler-Lagrange equations. But this didn't seem to occur when I did it. The accelerations of the charges are quite complicated, but they don't contain any terms proportional to $q_1 q_2$ besides the magnetic term.

*This interaction cannot be included without accounting for retardation or radiation effects, which the Darwin Lagrangian explicitly excludes, since otherwise one would need to keep track of the field configuration. But the interaction is present even for charges which have had uniform velocity forever.

*The magnetic interaction somehow also accounts for the effect. I don't see how this could happen, because the magnetic force on charge $i$ vanishes when $v_i = 0$, and this effect doesn't.

What's going on here?

A:
… what do people mean when they say it's accurate to order $(v/c)^2$?

Lagrangian of relativistic particle carrying a charge $q_a$ in external EM field is given by:
$$
L_a = -m_a c^2  \sqrt{1-\frac{v_a^2}{c^2}} - q_a \varphi + \frac{q_a}{c} \mathbf{A}\cdot \mathbf{v}_a.
$$
As usual, we assume that the fields $\varphi$ and $\mathbf{A}$ are created by the rest of the charges in the system. We are formally expanding this Lagrangian in powers of $1/c$ (the actual small dimensionless quantity of the perturbation theory would be $v/c$). Radiative effects appear at order $c^{-3}$, so we could expect that if we keep only terms up to $1/c^2$ the resulting approximate Lagrangian would include relativistic corrections but would still correspond to a conservative system.
This means that in the interaction Lagrangian it is enough to calculate the scalar potential $\varphi$ up to $1/c^2$ terms, while vector potential  $\mathbf{A}$ only up to $1/c$ (since corresponding term in the Lagrangian already has $1/c$).

… another effect is that the electric field produced by a moving charge with uniform velocity differs from the Coulomb field at $O(v^2)$. This seems to imply that $L_{\text{int}}$ should include terms proportional to $v_1^2$ and $v_2^2$, but it doesn't.

Not necessarily. Note that the Lagrangian does not has "electric field" but only scalar and vector potentials. By imposing the Coulomb gauge condition ($\nabla \cdot \mathbf{A}=0$) the equation for scalar potential reads:
$$
\Delta \varphi = - 4 \pi \rho.
$$
This means that the scalar potential in this gauge for the system of moving charges is independent of velocity and do not contribute any $1/c^2$ terms to $L_\text{int}$:
$$
\varphi (\mathbf{r}) = \int \frac{\rho(\mathbf{r}') }{|\mathbf{r}'-\mathbf{r}|} \,d^3\mathbf{r}'
$$
Vector potential in Coulomb gauge satisfies the equation:
$$
\Delta \mathbf{A} - \frac{1}{c^2} \frac{\partial^2 \mathbf{A} }{\partial t^2} = -\frac{4 \pi}{c}\left(\mathbf{j}-\frac{1}{4 \pi}\nabla \frac{\partial \varphi}{\partial t}\right).
$$
Second time derivative on the left is proportional to $1/c^2$ so in our approximation it could be dropped: the vector potential could be taken as quasi-static. We also make use of charge conservation law:$$\frac{\partial \rho }{\partial t} + \nabla \cdot \mathbf{j} =0.$$
This allows us to write solution for the vector potential:
$$
\mathbf{A}(\mathbf{r})=\frac{1}{2c}\int \frac{\left[\mathbf{j}(\mathbf{r}')+\hat{\mathbf{r}}(\hat{\mathbf{r}}\cdot \mathbf{j}(\mathbf{r}'))\right]}{|\mathbf{r}'-\mathbf{r}|}d^3\mathbf{r}'.
$$
As expected, this expression is proportional to $1/c$.
If we assume that $\rho$ and $\mathbf{j}$ correspond to charge and current density  of all charges except $q_a$ the potentials would now read:
$$
 \varphi = \sum_b' \frac{q_b}{r_{ab}}, \qquad \mathbf{A} =\frac{1}{2c}\sum_b'
\frac{q_b[\mathbf{v}_b+\hat{\mathbf{r}}(\hat{\mathbf{r}}\cdot \mathbf{v}_b)]}{r_{ab}}.
$$
Inserting these expressions back into interaction Lagrangians would indeed produce the Darwin Lagrangian.
The takeaway here, is that this is wrong to call terms of $L_\text{int}$ magnetic and electric. Instead, they correspond to scalar and vector potential. Of course, for moving charge the vector potential does contribute to the perturbation of electric field due to the motion of the charge.


text:
Q: Adding custom data attributes rails image tag I need to add data-description and data-title for galleria in my rails application but I can't see how to do this with the image tag. So far I have this:
<div id="galleria">
<% @entries.each do |entry| %>
     <%= image_tag entry.filename, :title => "title", :class => "class", :data-description => entry.caption, :data-title => entry.caption  %>
 <% end %>
 </div>

But this raises the undefined local variable or method `description' error, so how would I do this in rails 3?

A: The correct syntax for this is
<%= image_tag entry.filename, :title => "title", :class => "class", :data => { :description => entry.caption, :title => entry.caption }  %>

A: As of rails 5.1, this syntax should work:
<%= image_tag entry.filename, title: "title", class: "class", data: {description: entry.caption, title: entry.caption} %>

Read more about attributes you can include in your image_tag under examples: rails api docs.


text:
Q: Making an image completely fill a div without tiling I am fairly new to html/css and I am coding a website for my mom. (Live example here: http://jleblanc.pancakeapps.com/core.html) and for the life of me I can't get the photos at the bottom to fill their respective divs! Do any of you guys have an idea? I don't care if the image is cut off.
HTML

CSS
.one {
    background:linear-gradient(rgba(255,0,0,0.45),rgba(255,0,0,0.45)),url(http://dash.ga.co/assets/firstcourse.jpg)
}

.two {
    background:linear-gradient(rgba(0,255,0,0.45),rgba(0,255,0,0.45)),url(http://dash.ga.co/assets/secondcourse.jpg)
}

.three {
    background:linear-gradient(rgba(0,0,255,0.45),rgba(0,0,255,0.45)),url(http://dash.ga.co/assets/dessertcourse.jpg)
}

A: You are using the CSS background property to set an image as your div's background. Try changing the background-size property:
.one {
  background-size: cover;
}


text:
Q: Am I planning my database/backend correctly? I'm an iOS developer and to be honest I'm not really looking to become a database expert right at this moment, but I do need to know how to properly plan out what I believe to be a pretty cookie cutter social network style backend/database.
I'll keep this short and sweet:
Social network app will have users, posts, comments, and favorites.
Using comments as an example:
Each comment is an object that has been created in my backend for a class called "Comments" (Is this overkill? I don't see how else it could be achieved but I just can't believe how a server would handle so many individual comment objects if an app became popular, but maybe I'm just underestimating the power of a good backend?)
A comment object consists of a URL for the commenter's avatar, the commenter's user ID, a unique object ID, the post object's ID that the comment is for, and the comment text.
Posts and Favorites would also be their own classes/objects in the backend and would follow the same model as comments in the example above.
So my main question is, am I on track with the above? I want to make sure I'm structuring my backend properly.
My second question is, how should the user should keep track of all of their posts, comments, and favorites?
My initial idea was to just have array fields for the User class and store the ID's of the posts, comments, and favorites eg. User class has an array field called "Posts" with ID's of post objects.
The thing that confuses me is, is it overkill to keep track of these in the User class, when I'm storing the User's ID on the post, comment, and favorite classes already? And then I would just query those classes and filter for the user's ID, but then I think about it and if the app had a ton of usage, it might take longer to query all those objects and filter by the user's ID when the user could just keep track of their objects via fields on the User class.
Last but not least, last week I read the following in some Parse.com (popular Backend as a Service) docs:
"When you're thinking about one-to-many relationships and whether to implement Pointers or Arrays, there are several factors to consider. First, how many objects are involved in this relationship? If the "many" side of the relationship could contain a very large number (greater than 100 or so) of objects, then you have to use Pointers."
I'm confused on what Pointers are in a backend?
I realize these are all pretty noob questions but I really want to make sure I setup my backend properly and make sure that it's structure makes sense.
Hopefully some of you guys will be willing to read this giant wall of text and help a brotha out.
Thanks for the help!

A: A bit about relational databases
One of the most powerful features of relational databases is the ability to connect sets of data through common points. In order to do this efficiently, a database should follow the rules of normalization. To sum those rules up, a database should have:

*

*No repeating elements or groups of elements

*No partial dependencies on a concatenated key

*No dependencies on non-key attributes

With these rules in mind, an example table for the comments could look like this:
----------------------------------------------------------------------
| comments                                                           |
|--------------------------------------------------------------------|
| comment_id (key, auto-increment) |  comment  | post_id |  user_id  |
|----------------------------------|-----------|---------|-----------|
| 1                                | <text...> |    1    |   123452  |
----------------------------------------------------------------------

Here, the comment_id is the 'key,' or unique identifier, of the table. It's also been set to 'auto increment,' which means that it will automatically increase its value as 'records,' or rows, are added to the table. As shown, the table containing information related to comments only knows what it needs to know. How, then, do you relate user-specific information to a comment? This is where the 'relational' part of 'relational database' comes into play:
--------------------------------------------|
| users                                     |
|-------------------------------------------|--------------------------------|
| user_id (key, auto-increment) |   avatar  | additional fields not shown... |
|-------------------------------|-----------|--------------------------------|
| 123452                        | <img_url> |
---------------------------------------------

Note that the user_id column contains the same data for both the comments table and the users table. This way, you can 'join' data from the two tables. For example, to get all of the comments made by a user, you could run the MySQL query:
SELECT comment_id, comment, post_id FROM comments NATURAL JOIN users WHERE user_id=123452;

This method also answers the question

how should the user should keep track of all of their posts, comments, and favorites?

The user table should not keep track of such information in itself, but rather the respective tables should contain references to a globally unique user ID.
Almost there
So basically, you were on the right track. The only real change from the model you specified was to move the user's avatar information to the table concerning users, instead of in the table concerning comments.
As you seem to be leaning away from using a raw SQL database, you could consider the tables to be classes, and use the rules of normalization as a design guideline.
Finally, the Pointers vs. Arrays thing: both of those are very specific to the Parse backend (and admittedly, neither are explained very well). The best comparison I can come up with is that Pointers would be like Lists (as in Java or C#), and Arrays would be like, well, Arrays. The difference between the two is that Arrays can only store a predetermined amount of data, while Lists (or Pointers, in Parse's case) can store an unspecified amount. In theory, the amount would be infinite, but in practice the amount is determined by the amount of space available in the heap. For more information about the difference between Lists and Arrays, see this question. If you are planning to use Parse, I would recommend using Pointers in conjunction with Join Tables (which are essentially wrappers around the SQL method I described above), as those are the options offering the most flexibility.


text:
Q: Python Pandas group by mean() for a certain count of rows I need to group by mean() for the first 2 values of each category, how I define that.
df like
category    value
-> a    2
-> a    5
a   4
a   8
-> b    6
-> b    3
b   1
-> c    2
-> c    2
c   7

by reading only the arrowed data where the output be like
category    mean
a   3.5
b   4.5
c   2

how can I do this
I am trying but do not know where to define the to get only 1st 2 observation from each categrory
output = df.groupby(['category'])['value'].mean().reset_index()

your help is appreciated, thanks in advance

A: Try apply on each group of values and use head(2) to just get the first 2 values then mean:
import pandas as pd

df = pd.DataFrame({
    'category': {0: 'a', 1: 'a', 2: 'a', 3: 'a', 4: 'b', 5: 'b',
                 6: 'b', 7: 'c', 8: 'c', 9: 'c'},
    'value': {0: 2, 1: 5, 2: 4, 3: 8, 4: 6, 5: 3, 6: 1, 7: 2,
              8: 2, 9: 7}
})

output = df.groupby('category', as_index=False)['value'] \
    .apply(lambda a: a.head(2).mean())

print(output)

output:
  category  value
0        a    3.5
1        b    4.5
2        c    2.0

Or create a boolean index to filter df with:
m = df.groupby('category').cumcount().lt(2)
output = df[m].groupby('category')['value'].mean().reset_index()
print(output)

  category  value
0        a    3.5
1        b    4.5
2        c    2.0

A: You can also do this via groupby() and agg():
out=df.groupby('category',as_index=False)['value'].agg(lambda x:x.head(2).mean())


text:
Q: Google API (gapi.js) in Lightning Web Components I need some help getting the Google API javascript library (taken from https://apis.google.com/js/api.js) running inside Lightning Web Components so I can do an OAuth authentication with Google (specifically for Google Calendar).
It's my understanding that I can't reference an external 3rd party library so I have downloaded the google api JS into a static resource, taken from here:
https://apis.google.com/js/api.js
This library is referenced in this sample code from Google:
https://developers.google.com/calendar/quickstart/js#python-3.x
Here's my LWC component that uses platformResourceLoader to load the static resource and call handleClientLoad()
import { LightningElement } from 'lwc';

import gapiLibrary from '@salesforce/resourceUrl/gapi';
import { loadScript } from 'lightning/platformResourceLoader';

export default class oauth extends LightningElement {

        renderedCallBackCalled = false;

        renderedCallback() {

            if (this.renderedCallBackCalled) {
                return;
            }

            try {
                this.renderedCallBackCalled = true;

                loadScript(this, gapiLibrary)
                    .then(() => {
                        this.handleClientLoad();
                    })
                    .catch(error => {
                        console.log('oauth.renderedCallback: error: ' + error);
                    });

            } catch (error) {
                console.log('oauth.renderedCallback: error: ' + error);
            }
        }

      // On load, called to load the auth2 library and API client library.
      handleClientLoad() {
        try {
            // Initializes the API client library and sets up sign-in state listeners
            gapi.load('client:auth2', function() {

                // Console Error: Access to XMLHttpRequest at 'https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en.FQMyBOWbNKQ.O/m=auth2,client/rt=j/sv=1/d=1/ed=1/am=wQ/rs=AGLTcCN26pA1ff1pmP_btrYNbcyVNWJGOQ/cb=gapi.loaded_0' from origin 'https://10724769canadainc-dev-ed.lightning.force.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

                });
        } catch (error) {
            console.log('oauth.handleClientLoad: error: ' + error);
        }
      }

}

I've added a CSP policy to https://apis.google.com but I'm getting a CORS error in the console:
Access to XMLHttpRequest at 'https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en.FQMyBOWbNKQ.O/m=auth2,client/rt=j/sv=1/d=1/ed=1/am=wQ/rs=AGLTcCN26pA1ff1pmP_btrYNbcyVNWJGOQ/cb=gapi.loaded_0' from origin 'https://10724769canadainc-dev-ed.lightning.force.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

A: This might seem dumb but when you're creating your "CSP Trusted Site Definition", try removing the "https://" so that it's just "apis.google.com". For some reason, this works for me when invoking resources from LWC, but using "https://" doesn't.


text:
Q: Is (countable) AC necessary for a useful theory of Lebesgue measure? I am working through some notes on the Lebesgue measure, and I noticed that the proof that $\lambda^*$ (the outer measure) is countably sub-additive requires countable choice. (Short version of the proof: There is an interval covering $(I_{mn})_{n\in\Bbb N}$ of $A_m$ for each $x>\lambda^*(A_m)$, so choose $I_{mn}$ such that $\sum_n|I_{mn}|<\lambda^*(A_m)+\frac\epsilon{2^m}$. Then the set $\{I_{mn}|m,n\in\Bbb N\}$ is a countable collection of intervals with total length at most $\sum_m\lambda^*(A_m)+\epsilon$, so $\lambda^*(\bigcup_mA_m)\le\sum_m\lambda^*(A_m)$.) Without this property, $\lambda$ will not be $\sigma$-additive, and suddenly the whole theory becomes much more trivial.
Is this usage of countable choice necessary? I know set theorists like to play with Lebesgue measurability in ${\sf\neg AC}$-land, but maybe that only applies to full ${\sf AC}$, not ${\sf CC}$. Can anyone help clear this up for me?

A: This is a bit tricky: In a sense, yes. It is consistent with set theory without choice that the set of reals is a countable union of countable sets. This makes it impossible to have a nontrivial measure that vanishes on singletons.
On the other hand, countable choice suffices for the development of Lebesgue measure and its basic properties. It is more natural and comfortable to work with the stronger axiom of dependent choices, but one can make do with countable choice.
However, one may still want to develop as much of the theory as possible in a choiceless setting, taking into account the limitations that the first paragraph above highlights. The standard approach then is not to work directly with Borel sets but rather with their codes. A code for a Borel set is a real (or a sequence of integers, or a certain tree) that specifies (via some fixed convention) witnesses to the set being Borel: Enumerate the basic open sets. An open set is union of some of them, so it can be specified by a list of the indices of these basic open sets. A closed set is a complement of one of these, so the code could begin with a number that we understand is our convention for "complement", and then a list of basic open sets. An $F_\sigma$ set is a countable union of closed sets, so it would begin with a number representing "union", and then interleave (in some fixed fashion) codes for the countably many closed sets. Etc. This is more robust than having simply the Borel sets, as the lack of choice may prevent certain possibilities. For instance, one can show that there is no code for $\mathbb R$ witnessing that it is a countable union of countable sets.
We can develop measure theory on the codes, in a sufficiently robust way to recover enough of the properties of Lebesgue measure that the function we end up with would be recognized as such. Countable additivity, for instance, would only be with respect to coded sequences of disjoint sets, etc. And (any code for) $\mathbb R$ is assigned infinite measure, as expected (rather than measure zero, as it would have been the case if we tried to work directly with the sets).
(For a quick idea of what goes on in here, take a look at how Solovay develops and uses codes in his paper on the consistency of "all sets of reals are Lebesgue measurable".)
The only reference that I know of for this is Volume 5 of Fremlin's monograph on Measure theory. Fremlin's notation and style may take some getting used to, but the presentation is very clear and thorough, the relevant subtleties are pointed out, and the differences and limitations of the choiceless setting versus the usual approach are indicated clearly.

A: There is a model of ZF (without choice) where the reals are a countable union of countable sets.  I don't see how Lebesgue measure can be countably additive there.  I recall this from the book "The Axiom of Choice" by ... Jech?   Theorem 10.6.  This theorem is followed by "It follows from Theorem 10.6 that without the Countable Axiom of Choice it is impossible to define satisfactorily Lebesgue measure, or even Borel sets."


text:
Q: anchor tag pops up a div instead of a new page I was wondering how to implement a popup div that had its own address. The example in question is the Chrome Extensions Store: https://chrome.google.com/webstore/category/extensions
If you click a tile on that site, not only will the content pop up in form of a div, but it'll also have its own address. So if I copy the address and paste it onto a new window, it goes to the same popup. Not only that, if you click back button (or backspace), it closes the pop-up div instead of going back to previous page.
If there is no simple way to implement this, I'd like to know what javascript object or something I'd have to learn about to do this.
I'm not sure if this is the right S.E. forum to ask, but I had to ask someone.

A: You can use bootstrap modal. It's very good
here is the code,

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

<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

        <button type="button" class="close" data-dismiss="modal">×</button>

Modal Header

Some text in the modal.

        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

A: I didn't see the link you are talking about but I think they are hack the behavior of the link and instead of going to the clicked url show it'e content on an popup div. in jquery you can do it by something like preventDefault

A:
If you click a tile on that site, not only will the content pop up in
  form of a div, but it'll also have its own address. So if I copy the
  address and paste it onto a new window, it goes to the same popup.

This is called stateless UI which can easily be achieved with for example router in Angular or Ember.
The idea is that every state in your application has its own address. If for example, your application has an entity user then the url to see a specific user would be
http://example.com/user/12345

Where 12345 is userId
At the same time to open an edit form for this object you might use
http://example.com/user/12345/edit

Irrelevant of when you get to the latter, your application will always open an edit form for user with id=12345
To understand this better you need to get acquainted with some principles of MVC and perhaps examine ui-router tutorial as an example of implementation


text:
Q: Html5 video, using php variable as source <!DOCTYPE HMTL>

<?php
$movie1 = 'movie1.mp4';
echo $movie1;
echo '';
echo '<video width="600" height="300" controls>';
echo '<source src= "$movie1" type="video/mp4">';
echo "Your browser does not support the video tag.";
echo '</video>';
?>

I'm learning php and html now and I was wondering why it can't recognize the variable $movie1. The video player only shows blank.
I tried putting the "movie1.mp4" directly as source and it works fine.
Is there something I'm missing here? thanks in advance

A: use double quote to show the $movie1 var:
echo "<source src= \"$movie1\" type=\"video/mp4\">";

or echo '<source src= "' . $movie1 . '" type="video/mp4">';

A: First, an HTML stickler. You have a typo in HMTL and should read as HTML and you'll get a warning about that.
Then you need to concatenate your variable "$movie1" to "'.$movie1.'".
You should use proper HTML markup also, as in adding <title> tags if you're going to learn HTML. You also had a missing closing  tag, but that won't stop it from working, but should be using a
 to align it with and closing the div.
Here's a rewrite:
<!DOCTYPE HTML>

<title>Your title</title>

<?php
$movie1 = 'movie1.mp4';
echo $movie1;
echo '
';
echo '<video width="600" height="300" controls>';
echo '<source src= "'.$movie1.'" type="video/mp4">';
echo "Your browser does not support the video tag.";
echo '</video>';
echo '
';
?>

Plus, make sure you have a web server/PHP installed and accessing it as http://localhost(orYourHost)/file.php rather than a probable c:///file.php.
A web browser will not parse PHP directives if you're using c:///file.php directly into your web browser. You also need to make sure that it is a .php extension file. If you're using .html as a file extension, then that won't parse the PHP directives unless you instructed your system to treat .html files as PHP.

Footnotes:
The  tag has been deprecated/removed.
Consult:

*

*https://developer.mozilla.org/en-US/docs/Web/HTML/Element/center

"Deprecated
  This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time."


text:
Q: Custom File Properties I need to following:
In my application I have documents. Documents which need to be checked in and out all the time. When I check a Document out of my application I need to add Custom Properties to the file so I can identify it later when I'm going to checkin the document.
I've tried to use the OleDocumentProperties from DSOFile using the following code, but no success:
 // Adding custom properties to file (Parameters: FileName, custom property name, value, debug: true/false
 DocumentProperties.WriteDocumentProperty(filename, "dms_dossiernummer", _dossiernummer.ToString(), false);
 DocumentProperties.WriteDocumentProperty(filename, "dms_zaaknaam", ReturnZaaknaam(_dossiernummer), false);
 DocumentProperties.WriteDocumentProperty(filename, "dms_verantw_medew", ReturnVerantwMedew(_dossiernummer), false);
 DocumentProperties.WriteDocumentProperty(filename, "dms_document_path", path, false);
 DocumentProperties.WriteDocumentProperty(filename, "dms_bestandsnaam", bestandsNaam, false);
 DocumentProperties.WriteDocumentProperty(filename, "dms_bestands_id", bestandId, false);
 DocumentProperties.WriteDocumentProperty(filename, "dms_is_checkedout", "true", false);
 DocumentProperties.WriteDocumentProperty(filename, "dms_dossier_map_id", dossierMapId, false);
 DocumentProperties.WriteDocumentProperty(filename, "dms_bestand_versie_nummer", Queries.Dms.Selects.GetDocumentVersion(
                                                        Convert.ToInt32(bestandId)).ToString(), false);
 DocumentProperties.WriteDocumentProperty(filename, "dms_bestands_locatie", path, false);

Does anyone know another way to add Custom File Properties to a file?

A: An alternate data stream will allow you to store any data that you want.  Beware; if you copy the file to a non NTFS file system, the extra data will get stripped out.
Here is an article that should get you started
-- Edit 1/2/2014 --
Here are some more:
http://www.codeproject.com/Articles/2670/Accessing-alternative-data-streams-of-files-on-an
http://www.dreamincode.net/forums/topic/90666-reading-and-writing-alternate-streams-in-c%23/
NTFS Alternate Data Streams - .NET
And one for creating/viewing ADS from the command line:
http://www.undermyhat.org/blog/2012/05/copy-delete-or-rename-alternate-data-streams-using-only-standard-windows-command-prompt-tools/

A: Though any kind of file can be opened using DSOFile.dll, custom properties will not be persisted, except for files that are OLE Structured Storages / Ole Documents (http://en.wikipedia.org/wiki/COM_Structured_Storage) like older formats of Microsoft Office files (.doc, .xls, etc) and some CAD files.
As Brad wrote, you can go with alternate data streams, but that has a dependency too, the NTFS file system.
I don't recommend you to go these ways...
What if you used a new file ie. <original file>.props or such?

A: There are multiple options here.
As mentioned above, alternate data streams are a good option if you can guarantee your file will always be located on NTFS.
You can just write your custom properties as JSON, XML, serialized objects, or even a simple line + delimiter format.
Unfortunately these aren't fully available using .NET, you have to use P/Invoke and CreateFile.
[DllImport( "kernel32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall, SetLastError = true )]
    private static extern SafeFileHandle CreateFile(
          string lpFileName,
          uint dwDesiredAccess,
          uint dwShareMode,
          IntPtr SecurityAttributes,
          uint dwCreationDisposition,
          uint dwFlagsAndAttributes,
          IntPtr hTemplateFile
          );

You'll then have to create the data stream with the file path, followed by a colon, followed by the name of the stream as the filename and pass the SafeFileHandle returned by CreateFile to the constructor of FileStream. All the other options of CreateFile are as normal for opening a file via this API.
Note that if you want to write to an alternate data stream, you must have write access to the file.
Here's the reference for CreateFile. http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx
Here's some useful constants:
    private  const    uint     GENERIC_WRITE                 = 0x40000000;
    private  const    uint     GENERIC_READ                  = 0x80000000;

    private  const    uint     FILE_SHARE_READ               = 0x00000001;
    private  const    uint     FILE_SHARE_WRITE              = 0x00000002;

    private  const    uint     CREATE_NEW                    = 1;
    private  const    uint     CREATE_ALWAYS                 = 2;
    private  const    uint     OPEN_EXISTING                 = 3;
    private  const    uint     OPEN_ALWAYS                   = 4;

A method that doesn't require P/Invoke and is friendly to file systems other than NTFS is to create a second file with the full pathname of the original file + another extension added. Again, you can use your preferred method of storing the properties in this file. However, this has the disadvantage that if your user moves the files, they have to move the properties too.

A: What is a File?
Basically, a file is just a stream of bytes and some metadata that file file system associates with it.  In early file systems the metadata was basically just the file name and some date stamps.  Newer file systems like NTFS have the option of adding extra metadata.
Where do Document Properties Come From?
In Windows Explorer you can see quite a lot of document properties for many file types.  The nice, unified interface suggests that there is some unified property store.  That's not really the case.  The Explorer Shell has an extensible interface for Property Sheet Handlers that extract this information from various file types.  There is a handler for JFIF (JPEG) files, and there are handlers for OLE files (old Office formats), and the new Office formats too.
Where Should I Put My Metadata?
The conclusion is:

*

*If you can guarantee that you only need to handle certain file formats, investigate adding the metadata within the files.  For example,

*

*OLE properties if all your files are old-style Office documents (.doc)

*Using the Open XML API if all your documents are new-style Office documents (.docx)

*If you can guarantee that all installations will be on a specific file system, investigate features of the file system.  Other responses have considered how you could do this with NTFS.

*Otherwise you must devise your own data store.  Companion files are an obvious possibility; you could store the metadata in a database; or you could create one file per directory to hold all the metadata for files in that directory.  Consider whether you might face concurrency problems with multiple requests for the same file.  Using a database might make dealing with that more straightforward.


text:
Q: Multiple Applications Same Trunk? Best Practice help required I did a check if this has been asked before but the closest I found were questions around a single application with different branches for clients.
What is the best strategy for handling multiple applications in version control?  Say I have 5 completely separate applications that can require changes at any point.  Do I put them all under the same main trunk (origin/master if you will) then branch off as required or should they all get their own trunk?
Let me know if it's not described well and I can add more information.

A: You should see the Branch strategically:

When should the team add a branch?
You should create branches in the following situations:

*

*When you must release code on a different schedule/cycle than the
  existing branches.

*When your code requires a different branch policy. If you create a
  new branch that has the new policy, you can add strategic value to
  your project.

*When functionality is released to a customer and your team plans to
  make changes that do not affect the planned release cycle.
You should not create a branching for each user story because it
  creates a high integration cost. Although makes branching easy, the
  overhead of managing branches can become significant if you have many
  branches.

In you scenario, It's based on how do you want to manage the applications, different schedule/cycle ... then you need to track in another branch as David mentioned above. And if the size of applications are very large, you can even version control them separately in new team project.
This article for your reference : Branching and Merging: Ten Pretty-Good Practices


text:
Q: JSF throwing exception in cluster environment - Component ID j_idt311 has already been found in the view. I'm running GlassFish 3.1.2.2 in fail-over cluster. Session replication is configured and works perfectly. Project is in JSF and PrimeFaces using extensive AJAX. The problem is when server fails-over to another node on AJAX call I'm getting the exception:
java.lang.IllegalStateException: Component ID j_idt311 has already been found in the view.
    at com.sun.faces.util.Util.checkIdUniqueness(Util.java:846)
    at .....

Manually assigning IDs to every component on every page is impractical. Is there way to resolve the problem in more practical way?
Thank you.


text:
Q: What is the Query to filter the rows without Data(null) Is this correct if I want to filter the employee name which their leave column is null in Leaves table.....if it's not would you help me?
Select name from Leave where leave!=null;

A: You should use IS NOT NULL
 SELECT name FROM Leave WHERE leave IS NOT NULL;


text:
Q: Batch compare timer result to a number I have a batch timer (saw it in a different stackOverFlow post) and I need to compare the elapsed time to a number in order to know when 10 seconds are pass, however, I'm getting an error when trying to compare the two.
What am I doing wrong?
@set /A _tic=%time:~0,2%*3600^
            +%time:~3,1%*10*60^
            +%time:~4,1%*60^
            +%time:~6,1%*10^
            +%time:~7,1% >nul

echo RUN-KILL-WATCHDOG-THE-SMART-WAY

SETLOCAL EnableExtensions
set EXE=python.exe

:RUNNERON
FOR /F "skip=1" %%x IN ('wmic process where "CommandLine Like '%%forking import main%%' and Caption='python.exe'" get caption') DO for /F "delims=" %%j in ("%%x") do (
    echo The name of process who passed filter is: %%j Waiting for it to terminate...
    IF %%j == %EXE% (
        :: TOK
        set /A _toc=%time:~0,2%*3600^
                +%time:~3,1%*10*60^
                +%time:~4,1%*60^
                +%time:~6,1%*10^
                +%time:~7,1% >nul
        set /A _elapsed=%_toc%-%_tic
        :: echo %_elapsed% seconds.
        IF %_elapsed%==10 goto TIMEOUT :: EVERYTHING WORKS BUT THIS LINE
        goto RUNNERON
    ) ELSE (
        echo Entered "else" part - something went wrong.
    )
)
echo Runner is done - killing watchdog process
taskkill /F /im "python.exe"

: TIMEOUT
echo TIMEOUT

pause

when I run it I get the error:
"goto was unexpected at this time."
What am I missing?
Thank you


text:
Q: Veracode issue in JSP - Insertion of Sensitive Information Into Sent Data (CWE ID 201) Following is the piece of code
<jsp:useBean id="test1" scope="session" class="java.lang.String" />
<%=test1%>
In the line "<%=test1%>" I am getting the vera code issue . How to fix the issue.
Tried to fix with below code, It is showing another issue "Improper Handling of Invalid Use of Special Elements (CWE ID 159)"
<%= ESAPI.encoder().encodeForHTML(test1) %>


text:
Q: How can i get the same functionality as this .each() using a for loop? I have written this function to assign line-height to elements with different heights.Is there any possible way of doing this using a for loop ?
$(".portfolio-image-overlay").each(function(){
    "use strict";
    var height = $(this).siblings("img").height();
    var cheight = $(".item.active> a> img").height();
    $(this).css({"line-height":height+"px"});
    $(this).css({"line-height":cheight+"px"});
});

A: Yes you can:
var portfolio = $(".portfolio-image-overlay");
for(var i=0;i < portfolio.length;i++){
   var _this = portfolio.eq(i);
   var height = _this.siblings("img").height();
   var cheight = $(".item.active> a> img").height();
   _this.css({"line-height":height+"px"});
   _this.css({"line-height":cheight+"px"});
}

A: This is a for loop actually. The .each() function loops through the $(".portfolio-image-overlay") resultset.
You would be looking at something like this
var resultSet = $(".portfolio-image-overlay");
for (var i = 0; i < resultSet.length; i++) {
    console.log(resultSet[i]);
}

Also, its smart to store the jQuery pointers in variables; Calling $(this) three times is less efficient than
var that = $(this);

and using that 3 times.
I see you're also doing that with the active item;
$(".portfolio-image-overlay").each(function(){
    "use strict";
    var height = $(this).siblings("img").height();
    var cheight = $(".item.active> a> img").height();
    $(this).css({"line-height":height+"px"});
    $(this).css({"line-height":cheight+"px"});
});

This would be faster;
var activeItem = $(".item.active> a> img");
$(".portfolio-image-overlay").each(function(){
    "use strict";
    var that = $(this);
    var height = that.siblings("img").height();
    var cheight = activeItem.height();
    that.css({"line-height":height+"px"});
    that.css({"line-height":cheight+"px"}); //Don't know why you're doing this twice, maybe you've CSS animated it so i'll keep it there
});

EDIT:
Fastest would be as such;
var resultSet = $(".portfolio-image-overlay");
var cheight = $(".item.active> a> img").height();
for(var i = 0; i < resultSet.length; i ++){
    var current = resultSet.eq(i);
    var height = current.siblings("img").height();
    current.css({"line-height":height+"px"}).css({"line-height":cheight+"px"});
}


text:
Q: Problem when displaying hex bytes in Bless I've tried Bless. It worked fast and well. But it has a prolem. It does not display all the hex byte, like the picture below. I don't know how to fix this, could anyone help me?

I'm using lubuntu:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04 LTS
Release:    16.04
Codename:   xenial
$ uname -a
Linux ubuntu32 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:28 UTC 2016 i686 i686 i686 GNU/Linux


text:
Q: Unreadable Int16 from UInt8List, wrong data when cast asByteArray I tried to get int, short from data, the data get from websocket, but some thing is wrong, and when i cast from UInt8List -> Byte Data -> UInt8List, it add 2 new uint8 in my array. Any one suggest me how is correct way to get int from byte array. (It's big Endian, my code in Swift and the base write data in Dart still correct). Thank anyone for reading this.
I am using 'dart:typed_data'; and get data from WebSocket (dart:io)
print(responseData); // UInt8List: [0, 1, 0, 1, 0, 1, 49]
var byteData = responseData.buffer.asByteData();
var array = byteData.buffer.asUint8List();
print(array); // UInt8List: [130, 7, 0, 1, 0, 1, 0, 1, 49]
var shortValue = responseData.buffer.asByteData().getInt16(0);
print(shortValue); // -32249 ( 2 first byte: [0 ,1] so it must be 1 )

A: There's something else going on, because your code does not add any extra bytes - and actually, it doesn't use array.
This code:
import 'dart:typed_data';

void main() {
  Uint8List responseData = Uint8List.fromList([0, 1, 0, 1, 0, 1, 49]);
  print(responseData); // UInt8List: [0, 1, 0, 1, 0, 1, 49]
  var byteData = responseData.buffer.asByteData();
  //var array = byteData.buffer.asUint8List();
  //print(array); // UInt8List: [130, 7, 0, 1, 0, 1, 0, 1, 49]
  var shortValue = responseData.buffer.asByteData().getInt16(0);
  print(shortValue); // -32249 ( 2 first byte: [0 ,1] so it must be 1 )
}

prints (as expected)
[0, 1, 0, 1, 0, 1, 49]
1

EDIT - as suggested in the comment, the Uint8List you have is in fact a view on a ByteBuffer with a non-zero offset. So, responseData.buffer is that underlying buffer, which includes additional bytes. The simplest solution is to make a copy of the view.
import 'dart:typed_data';

void main() {
  Uint8List original = Uint8List.fromList([130, 7, 0, 1, 0, 1, 0, 1, 49]);
  print(original);

  Uint8List view = Uint8List.view(original.buffer, 2);
  print(view);
  print(view.buffer.lengthInBytes); // prints 9
  print(view.buffer.asByteData().getUint16(0)); // unexpected result

  Uint8List copy = Uint8List.fromList(view);
  print(copy.buffer.lengthInBytes); // prints 7
  print(copy.buffer.asByteData().getUint16(0)); // expected result
}


text:
Q: What is the minimal set of firmware files I need for my Hardware? So today I learned that my distro's linux-unfree-firmware package is 491 Mb in size. I'm pretty sure my hardware doesn't need all of these files. Hence I think I can reduce this disk usage if I'll only know what files I can exclude from there.
Is there any official documentation, that states exactly what files from https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/ are needed per device / computer model? Perhaps the official documentation of my Computer's hardware will state that? There's a Linux from scratch webpage that gives some info for popular hardware, but I'm wondering if there's a bit more "official" information available somewhere.

A: There is no "official" documentation for every piece of hardware there is and the firmware files that it requires, unfortunately. But, it is possible to know exactly what firmware files are needed by your hardware via hacking a bit on the Linux kernel build system.
More over, even if you do discover exactly what firmware files your hardware uses, you will get eventually a not-too-short list of files, that will need to be updated frequently - after pretty much every release (git tag) of https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/. This means that you won't be able to reliably filter out firmware files straight from the list that you'll soon learn to generate.
If you are still interested in this, follow this steps:

*

*Download the latest release of the kernel from https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ .

*Run: make localmodconfig.

*

*This will generate a .config file that will contain a list of build parameters according to your current kernel.

*Run make.

*

*This will build the kernel, so it might take a while.

*You'll might need to install some dependencies to make the build finish.

*After make will finish, you'll have a bunch of .ko files which are kernel module files.

*Run this command:

find -name '*.ko' -exec modinfo {} \; | awk '$1 == "firmware:" { print $2}'

The last command prints a list of firmware files which will probably be found in your distro's linux-unfree-firmware package. These are the files your hardware needs.
Credits: https://lists.kernelnewbies.org/pipermail/kernelnewbies/2020-May/020818.html

A: For this task, I like the exhaustive/insider method described in this approach.
But then when running a generic & modular kernel already,
narrowing down installed firmware blobs list using modinfo like you suggested,
here is a quick and dirty way:
lsmod | cut -d ' ' -f 1 | tr '_' '?' | xargs -I % find /lib/modules/ -name "%.*" | xargs -I % modinfo % | awk '$1 == "firmware:" { print $2}'

this:

*

*Lists loaded modules
(keep in mind any builtin kernel module that requires a firmware is left-out here)

*extract first column, and replace '_' in names with single-char wildcard,
as often filenames will instead use '-'

*find said module-file, and hand in to modinfo
to derive a list of firmware blobs like you suggested.


text:
Q: Regex french phone number I have an input I want to limit some phone number format like

0612352512 or 0125357878

but not

0025577787 or +3327487877 or nothing else.

My regex work for some caracter, but 0000000000 or 5555555555 is always accept...

$("#tel").focusout(function(){
  var numTel = $(this).val();
  // var rgxPhone = /(([0-9]{2})[-. ]?){5}/
  var rgxPhone = /(([0-9]{2})){5}/
  if ( !numTel.match(rgxPhone)){
    $(this).removeClass().addClass("error");
    $(".nope").css({
      color:'#F70421',
      "font-weight":"bold",
      display: 'block'
    });
    $(".oke").css({display: 'none'});
  }else{
    $(this).removeClass().addClass("ok");
    $(".oke").css({
      color:'#84BD00',
      "font-weight":"bold",
      display: 'block'
    });
    $(".nope").css({display: 'none'});
  }
});
input.defaut{
  border: #9B9697 1px solid;
}

input.error{
  border: #F70421 1px solid;
}

input.ok{
  border: #84BD00 1px solid;
}

.nope, .oke{
  display: none;
}

Numéro de téléphone
<input type="tel" id="tel" name="tel" size="11" maxlength="10" class="defaut check">

Nope !

Ok !

Do you have an idea?

A:
My rules ares Start by 0 Next is 1, 2, 3, 4, 5, 6, 7, 9 And the next
  is 8 digit suit

Use:
/0[1-9]\d{8}/

demo