text:
Q: "Anti-private" property of setter method Getter methods can be used without an explicit receiver unless there is a local variable with the same name:
class A; attr_reader :foo end
A.new.instance_eval do
  @foo = :foo
  p foo
end
# => :foo

This will not hold when there is a local variable with the same name, due to the principle that interpretation as a local variable has priority than as a method call whenever there is an ambiguity.
class A; attr_reader :foo end
A.new.instance_eval do
  foo = :bar
  @foo = :foo
  p foo
end
# => :bar

However, setter methods cannot be used without an explicit receiver even when a local variable with the same name is not assigned prior to the expression in question:
class A; attr_writer :foo end
A.new.instance_eval do
  foo = :foo  # <= No local variable named `foo` has been assigned before this point
  p @foo
end
# => nil

How is this "anti-private" property of setter method justified?

A: If ruby interpreted your assignment in your last statement as an assignment to self, you would have no way left to set a local variable.
The way it is leaves no ambiguity for the interpreter to deal with: assignments without self are always local variables, assignments to self are always trying to use a writer on the object.

If it were the other way around
The interpreter would have to look up the contexts writer methods and assign it via the writer if there is one, which almost certainly would have a negative impact on performance
class A
  attr_writer :foo
end

A.new.instance_eval do
  # for each of these assignments, the interpreter has to look up if there's
  # a writer method defined
  foo = 'bar'
  bar = 'baz'
  fib = 'buz'
end

It would also leave the programmer with the rather stupid task to find out every setter method of the context he's in before assigning local variables to make absolutely sure he does not unintentionally use a setter.
class C
  attr_writer :something
end

class B < C
  attr_writer :foo
end

class A < B
  attr_writer :bar
end

A.new.instance_eval
  something = 'something'
  #you just (almost certainly with no intention) assigned a value to an attribute
end

Also, your question reads:

setter methods cannot be used without an explicit receiver even when a
  local variable with the same name is not assigned prior to the
  expression in question:

If it were the other way around, you could not assign a local variable with the same name prior to the expression in question, because the assignment would use the setter (as stated in the first paragraph of this answer)
Concerning the implementation / the access to variables the attribute methods use: Getter and Setters work with instance variables. So, for example attr_accessor actually defines something like this:
 def foo
   @foo
 end

 def foo=(data)
   @foo = data
 end

So, the attribute is declared as a instance variable and not as a local variable, why should the programmer be able to assign it like a local variable? This would leave the wrong impression that you could assign instance variables of an object via assigning local variables. If ruby would do this, it would almost certainly lead to a serious memory management problem. To make it short: foo = 'bar' and @foo = 'bar' are not the same, and exactly because the attr methods use @foo = 'bar', you can not call them via using foo = 'bar'.

A: I think @sawa finally clarified what is meant by "anti-private".
sawa's comment:

Private means it cannot have an explicit receiver. Negation of that would be that it may have an explicit receiver, which is not what I am mentioning. I am mentioning a case where a method must have an explicit receiver, which is against private. I think you are confused.

I was confused, apparently along with all the other commenters, because "anti-private" and "against private" aren't standard terminology, nor was the meaning immediately obvious.
I think the meaning of the original question is: "Since setters require an explicit receiver, and private forbids explicit receivers, how can I call a private setter?" In other words, "anti-private" means "incompatible with private", or "unusable with private".
Jörg W Mittag eloquently explains an exception to the normal private rules. Basically, setters can be called on self even if they are private, because there's no other way to call them (unless you use the cumbersome send).
So, a setter's requirement of an explicit receiver is perfectly compatible with the setter being private, only because of the exception to the rule.

A: Beat Richartz's answer is pretty complete already, but I want to highlight one point about the behavior you're proposing.
In your question you have this sample code:
class A; attr_writer :foo end
A.new.instance_eval do
  foo = :foo  # <= No local variable named `foo` has been assigned before this point
  p @foo
end

You are proposing that the assignment call the setter method. And you want this to happen if the local-variable foo hasn't been assigned yet.
But what syntax would you use to assign the local before that point?
If the receiverless assignment foo = :foo means call the setter (when it exists), you'd need yet another syntax construct to mean "assign this local-variable, disregarding whether there is a setter".
I honestly do want to hear your proposal (I'm not being sarcastic) if you have one. It would be interesting to hear alternative views on language design.
I'm not saying your way would be necessarily "worse" than the current ruby way. But at some point a language designer has to decide default behaviors for ambiguous situations, and Matz decided that receiverless assignment assigns the local.


text:
Q: Fine tune without using pointers ** To print repeated elements from an user defined array
//print repeated elements from an array

#include<iostream>
using namespace std;

int main()
  {
   int p,n;

   cout<<"enter no. of elements in array: "<<endl;
   cin>>n;
   int a[n],b[n];
   int z=0;
   cout<<"enter elements of array:"<<endl;
   for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int j=0;j<n;j++)
    {
        for(int k=j;k<=n;k++)
        {
            if(j==k)
            {
                continue;
            }
            else if(a[j]==a[k])
            {
                b[z]=a[j];
                ++z;
                a[k]=a[k+1];        //deleting the array element which repeats
                a[n-1]=0;           //settng last element as 0
                --n;                //reducing the size of array
                break;
            }
            int d=z;
            if(b[j]==b[k])
            {
                b[j]=b[j+1];
                b[n-1]=0;
                n--;
            }
        }
    }
    if(z==0)
    {
        cout<<"No Elemnts in the array is repeated"<<endl;
    }
    else
    {
        cout<<"repeated elements are: "<<endl;
        for(p=0;p<z;p++)
            {
                cout<<b[p]<<" ";
            }
    }

return 0;
}

How to fine tune this program so as it displays correct output? When we enter 3 similar elements it repeats itself twice and also has problem reading the last element.
Thanks

A: You should rewrite your algorithm. Something like that should work:
  std::vector<int> a;

  /* fill a */

  std::sort(a.begin(), a.end());
  std::vector<int> unique_elements;
  std::unique_copy(a.begin(), a.end(), std::back_inserter(unique_elements));

  std::vector<int> b;
  std::copy_if(unique_elements.begin(), unique_elements.end(), std::back_inserter(b), [&](int n)
  {
    return std::count(a.begin(), a.end(), n) >= 2;
  });

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why does the DOM remain unchanged, even though the console outputs what the correct result should be when trying to change link attributes? function makeLinks(context, url) {
    var sets = context ? $(context + ' a') : $('a'),
        prot = url || window.location.protocol;
    if(prot.match(/https/)){
        lockup(sets);
    }

    function lockup(elem) {
        elem.each(function(){
            var self = $(this),
                href = self.attr('href');
            if(href.match(/http[^s]/)){

                // This logs the correct output
                console.log(href.replace('http','https'));

                // This fails
                href.replace('http','https');
            }
        });
    }
}

The purpose of the function is to check the current protocol of the window object.
If it is 'https:', then I want the anchors that have a href of 'http' to be 'https'.
The function is called like this: makeLinks('#wrapper', 'https:');
The second parameter is just for testing, otherwise it would use window.location.protocol
Currently, when I call this function on markup that looks like this:

The console logs exactly what I want to happen, however, the actual href remains unchanged inside of the DOM.
I've tested this out in Chrome and Firefox with the same result
I'm pretty sure that my logic is wrong somewhere (or everywhere)
If someone can help me understand why, I would be very appreciative :)

A: You're not doing anything with the result of the .replace().
You need to set the new value.
  self.attr('href', href.replace('http','https'));

or a nicer way is like this:
function lockup(elem) {
    elem.attr('href', function(i, href) {
        return href.match(/http[^s]/) ? href.replace('http','https') : href;
    });
}

A: Should this not be something Like Below
            if(href.match(/http[^s]/)){
            // This logs the correct output
            console.log(href.replace('http','https'));

            // This fails
            href.replace('http','https');
        }
    });

Change to:
    if(href.indexOf('https') == -1) {
       console.log(href.replace('http','https'));

       href.replace('http', 'https');

    }


text:
Q: How do you use copyToRealmOrUpdate for a list? This is some code in my Android App:
public class Offer extends RealmObject {
    @PrimaryKey
    private long id;

}
In my service class:
  RealmList<Offer> currentLocalMerchantOfferList = currentLocalMerchant.getOffers();
   RealmList<Offer> findIncomingMerchantOfferList = findIncomingMerchant.getOffers();
                                if (!EqualsUtil.areEqual(currentLocalMerchantOfferList, findIncomingMerchantOfferList)) {
                                    currentLocalMerchant.setOffers(findIncomingMerchantOfferList == null ? null : realm.copyToRealmOrUpdate(findIncomingMerchantOfferList));
                                }

I get compile error:
error: incompatible types: bad type in conditional expression
                                currentLocalMerchant.setOffers(findIncomingMerchantOfferList == null ? null : realm.copyToRealmOrUpdate(findIncomingMerchantOfferList));

Am I using copyToRealmOrUpdate correctly? If not, how do you use it correctly?

A: realm.copyToRealmOrUpdate(findIncomingMerchantOfferList) returns a List<T> and not a RealmList<T>.
RealmList represents many-relationship to another object type. Therefore, these randomly inserted objects aren't a many-relationship, therefore they are not RealmList.
In fact, they are internally returned as an ArrayList.
The way you can change your code to accomodate is by:
currentLocalMerchant.getOffers().clear();
currentLocalMerchant.getOffers().addAll(realm.copyToRealmOrUpdate(findIncomingMerchantOfferList));

A: I think you don't need to use copyToRealmOrUpdate method to set value. Just set the value that you have
 if (!EqualsUtil.areEqual(currentLocalMerchantOfferList, findIncomingMerchantOfferList)) {
                                        currentLocalMerchant.setOffers(findIncomingMerchantOfferList)
                                    }

If findIncomingMerchant.getOffers() back to you persistent data than it will work perfectly.


text:
Q: Applications not installing due to unmet dependencies I was running Apache on Linode. I recently shifted to Lighttpd and removed apache, now whenever I try to install any application I get the following error.
    ivineet:~# apt-get install subversion
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run `apt-get -f install' to correct these:
The following packages have unmet dependencies:
  libapache2-mod-php5: Depends: apache2-mpm-prefork (> 2.0.52) but it is not going to be installed or
                                apache2-mpm-itk but it is not going to be installed
  subversion: Depends: libsvn1 (= 1.6.12dfsg-6) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
ivineet:~#

A: As the output suggests it, try to execute apt-get -f install in order to solve the dependency problem. As soon as it is fixed, installing the subversion package again should be working.


text:
Q: Querying a second model with django haystack I would like to add a field from a second model to a django-haystack query. I have two models that have the following structure:
class Product(models.Model):
    created_date = models.DateField(auto_now_add=True)
    name = models.CharField(max_length=254)
    summary = models.CharField(null=True, blank=True, max_length=255)
    ....

class Color(models.Model):
    product_color = models.CharField(max_length=256,  blank=True, null=True)
    created_date = models.DateField(auto_now_add=True)
    slug = models.SlugField(max_length=254)
    product = models.ForeignKey('Product')

I have the following search_index.py:
from django.utils import timezone
from haystack import indexes
from .models import Product
from .models import Color

class ProductIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True, use_template=True)

    def get_model(self):
        return Product

    def index_queryset(self, using=None):
        """Used when the entire index for model is updated."""
        return self.get_model().objects.filter(
            created_date__lte=timezone.now())

How can I add the Color model's product_color to the search index so that if someone includes a partial portion of a product_color in a search query it will return a Product that has a ForeignKey relationship to the color?

A: Use MultiValueField which will store all colors associated with product:
product_colors = indexes.MultiValueField()

Prepare it:
def prepare_product_colors(self, obj):
    return [o.product_color for o in obj.color_set.all()]

And use that field directly to filter by product color. Or If you don't want to use search on specific field rather do an auto query then append the product colors to the final indexed text:
def prepare(self, obj):
    prepared_data = super(SlateUpIndex, self).prepare(obj)
    prepared_data['text'] += ' '.join(self.prepare_product_colors(obj))
    return prepared_data

Instead of doing all the above things just add the colors in the template search/indexes/{app_label}/{model_name}_{field_name}.txt:
{% for color in object.color_set.all %}
    {{ color.product_color }}
{% endfor %}

A: Do products have multiple colors? If not, i'd FK to 'Color' from the 'Product' model.
As-is, you can add a MultiValue Field to your index and prepare the values using a 'prepare_foo' function that is a built-in helper a-la 'clean_foo' in django forms.
See the docs for more info: SearchIndex Api
For example:
colors = indexes.MultValueField()
def prepare_colors(self, obj):
    return [color.product_color for color in obj.color_set.all()]


text:
Q: Proof for hamiltonian cyclein grids having even no. of nodes How can I go about proving that an undirected graph having even no. of nodes (at least one of the rows or columns are even - excluding line graphs of course) have a hamiltonian cycle?
I have  managed to come as far as to prove that it is a bipartite graph and (as a result ) has all cycles of even length.
But exactly how can I show that at least one such cycle exists that covers all the available nodes?


text:
Q: How to display faint gray "ghost text" in a JTextField? I don't know if I got the right name for it, but I'm looking to see if there is a specific way to implement a text field so that while it doesn't have focus and is empty, a faint gray string of text is displayed in the field. When the field is clicked, the text should go away, exactly like how the Search bar like that of StackOverflow works. I know that I can change use setForeground() and focus listeners to accomplish this, but I was just wondering if anyone knew of some Java implementation that could handle this for me.

A: Thank you very much Guillaume, this is very good!
I just changed a few things for ease of use:

*

*used JTextComponent instead of JTextField so it works with all text
inputs

*took out the test class and made it public and non-static to make it stand-alone

Here is the code:
import java.awt.Color;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.JTextComponent;

public class GhostText implements FocusListener, DocumentListener, PropertyChangeListener
{
    private final JTextComponent textComp;
    private boolean isEmpty;
    private Color ghostColor;
    private Color foregroundColor;
    private final String ghostText;

    public GhostText(final JTextComponent textComp, String ghostText)
    {
        super();
        this.textComp = textComp;
        this.ghostText = ghostText;
        this.ghostColor = Color.LIGHT_GRAY;
        textComp.addFocusListener(this);
        registerListeners();
        updateState();
        if (!this.textComp.hasFocus())
        {
            focusLost(null);
        }
    }

    public void delete()
    {
        unregisterListeners();
        textComp.removeFocusListener(this);
    }

    private void registerListeners()
    {
        textComp.getDocument().addDocumentListener(this);
        textComp.addPropertyChangeListener("foreground", this);
    }

    private void unregisterListeners()
    {
        textComp.getDocument().removeDocumentListener(this);
        textComp.removePropertyChangeListener("foreground", this);
    }

    public Color getGhostColor()
    {
        return ghostColor;
    }

    public void setGhostColor(Color ghostColor)
    {
        this.ghostColor = ghostColor;
    }

    private void updateState()
    {
        isEmpty = textComp.getText().length() == 0;
        foregroundColor = textComp.getForeground();
    }

    @Override
    public void focusGained(FocusEvent e)
    {
        if (isEmpty)
        {
            unregisterListeners();
            try
            {
                textComp.setText("");
                textComp.setForeground(foregroundColor);
            }
            finally
            {
                registerListeners();
            }
        }

    }

    @Override
    public void focusLost(FocusEvent e)
    {
        if (isEmpty)
        {
            unregisterListeners();
            try
            {
                textComp.setText(ghostText);
                textComp.setForeground(ghostColor);
            }
            finally
            {
                registerListeners();
            }
        }
    }

    @Override
    public void propertyChange(PropertyChangeEvent evt)
    {
        updateState();
    }

    @Override
    public void changedUpdate(DocumentEvent e)
    {
        updateState();
    }

    @Override
    public void insertUpdate(DocumentEvent e)
    {
        updateState();
    }

    @Override
    public void removeUpdate(DocumentEvent e)
    {
        updateState();
    }

}

A: For what it's worth, I found it interesting to actually implement it, so I thought to share it with you (I am not looking for votes).
It's really non-invasive since all you have to do is call new GhostText(textField, "Please enter some text here...");. The rest of the code is only to make it run.
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

public class Test {

    public static class GhostText implements FocusListener, DocumentListener, PropertyChangeListener {
        private final JTextField textfield;
        private boolean isEmpty;
        private Color ghostColor;
        private Color foregroundColor;
        private final String ghostText;

        protected GhostText(final JTextField textfield, String ghostText) {
            super();
            this.textfield = textfield;
            this.ghostText = ghostText;
            this.ghostColor = Color.LIGHT_GRAY;
            textfield.addFocusListener(this);
            registerListeners();
            updateState();
            if (!this.textfield.hasFocus()) {
                focusLost(null);
            }
        }

        public void delete() {
            unregisterListeners();
            textfield.removeFocusListener(this);
        }

        private void registerListeners() {
            textfield.getDocument().addDocumentListener(this);
            textfield.addPropertyChangeListener("foreground", this);
        }

        private void unregisterListeners() {
            textfield.getDocument().removeDocumentListener(this);
            textfield.removePropertyChangeListener("foreground", this);
        }

        public Color getGhostColor() {
            return ghostColor;
        }

        public void setGhostColor(Color ghostColor) {
            this.ghostColor = ghostColor;
        }

        private void updateState() {
            isEmpty = textfield.getText().length() == 0;
            foregroundColor = textfield.getForeground();
        }

        @Override
        public void focusGained(FocusEvent e) {
            if (isEmpty) {
                unregisterListeners();
                try {
                    textfield.setText("");
                    textfield.setForeground(foregroundColor);
                } finally {
                    registerListeners();
                }
            }

        }

        @Override
        public void focusLost(FocusEvent e) {
            if (isEmpty) {
                unregisterListeners();
                try {
                    textfield.setText(ghostText);
                    textfield.setForeground(ghostColor);
                } finally {
                    registerListeners();
                }
            }
        }

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            updateState();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            updateState();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            updateState();
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            updateState();
        }

    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                init();
            }
        });
    }

    public static void init() {
        JFrame frame = new JFrame("Test ghost text");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JPanel panel = new JPanel();
        JTextField textField = new JTextField();
        JButton button = new JButton("Grab focus");
        GhostText ghostText = new GhostText(textField, "Please enter some text here...");
        textField.setPreferredSize(new Dimension(300, 24));
        panel.add(textField);
        panel.add(button);
        frame.add(panel);
        frame.pack();
        frame.setVisible(true);
        button.grabFocus();
    }
}


text:
Q: How do i make the for loop return the value from a function So I have tried different methods of returning the data using data from a JSON file running in a loop.
The idea is that I have a config.json file with ip`s that need to be feed to the function when its called upon.
{
    "ip1" : "10.0.0.111",
    "ip2" : "10.0.0.112"
  }

import json
import urllib.request

with open('config.json') as config_file:
    data = json.load(config_file)

def temprature(v):

    urlData = f"http://{v}:8080/getdevice?device=type28_1"
    #print(urlData)
    webURL = urllib.request.urlopen(urlData)
    data = webURL.read()
    encoding = webURL.info().get_content_charset('utf-8')
    tempData = json.loads(data.decode(encoding))
    return tempData["Celsius"]

for (k, v) in data.items():
   #print("Key: " + k)
   temprature(v)
   #print(str(v))

I can`t see or figure out how I can fetch the tempdata and save it to an external variable. I have tried to make a variable that calls the for loop but that failed for me as well.
Edit:
Being referred to as a duplicate of This post. But this does not cover the return from a for loop.

A: You need to save the value to some data structure - list, dictionary, whatever:
temperature_data = []
for (k, v) in data.items():
   #print("Key: " + k)
   temperature_data.append(temprature(v))
   #print(str(v))
    print(temprature(v))

print(temperature_data)

temperature_data = {}
for (k, v) in data.items():
   #print("Key: " + k)
   temperature_data[k] = temprature(v)
   #print(str(v))
   print(temprature(v))

print(temperature_data)

as @ggorlen mentioned, it seems that printing the results is what you'd like to ultimately do, so I added a print statement in the loop.
Make sure to establish the data structure outside of the loop, because otherwise, you'll be writing over the variable on each loop.


text:
Q: Simultaneous equation with 6 equations, 6 unknows and a degre of 5 How do I solve this simultaneous
$$a + b + c = 2\to (1)$$
$$ax + by + cz = 0\to (2)$$
$$ax^2 + by^2 + cz^2 = \frac{2}{3}\to (3)$$
$$ax^3 + by^3 + cz^3 = 0\to (4)$$
$$ax^4 + by^4 + cz^4 = \frac{2}{5}\to (5)$$
$$ax^5 + by^5 + cz^5 = 0\to (6)$$
This simultaneous has 6 equations, 6 unknown and some variables are raised to the power of 5.
I have been battling with this question for days now...
The best is could come up with
Multiplying equation (2) by $x^2$

$$ax^3 + byx^2 + czx^2 = 0\to (7)$$
Then (7) - (4) becomes

$$by(x^2 - y^2) + cz(x^2 - z^2) = 0\to (8)$$
    Multiplying equation (2) by x^4 then subtracting (6) I have:
$$by(x^4 - y^4) + cz(x^4 - z^4) = 0$$
 Which then leads to:

$$y^2 = z^2$$
$$Conclusively, y = \pm z$$
Aside from this, every other thing I have tried is looking way off.
Is there any better way of doing this? Maybe a matrix or something.
Thanks in advance.


text:
Q: female, male symbols no vector font with wasysym I need the \female and \male symbols in my document. However, by using the code below I only get pixel symbols in the pdf. Looking at the font in Acrobat Reader it says font F30 type 3 not embedded. I'm using MiKTeX 4.0.1.
Is there any other font (preferably lmodern) which includes these symbols as vector symbols?
\documentclass [] {article}

\usepackage{wasysym}
\begin{document}
    \mars%
    \female%
\end{document}

A: The "complete" wasy fonts consist of three different CTAN packages:
https://ctan.org/pkg/wasy
https://ctan.org/pkg/wasysym
https://ctan.org/pkg/wasy-type1
The first one provides the Metafont sources for the fonts and basic support for plain TeX (with wasyfont.tex).
The second one provides LaTeX support for the fonts (with wasysym.sty and related .fd files).
The third one provides the Type1 (scalable) version of the fonts.
Unless you install the last one, the fonts will be bitmaps. The reason for the separation is that the three packages are by different people.

A: Try a different package, in this case, marvosym.
\documentclass{article}
\usepackage{marvosym}
\begin{document}
    A\Male%
    \Female%
\end{document}

A: With fontspec, you can load them from any Unicode font that contains them, such as
\usepackage{fontspec}
\newfontfamily\symbolfont{DejaVu Sans}[
  Scale=MatchUppercase]

\newcommand\Male{{\symbolfont\symbol{"2642}}}
\newcommand\Female{{\symbolfont\symbol{"2640}}}

You could set the ♀ and ♂ Unicode characters active with newunicodechar.


text:
Q: How to enable user via LDAP in AD? In my program (jldap-based) I trying to enable user in AD by setting userAccountControl value to 512.
User created with following attributes:
objectClass=user
cn=username
name=username
userAccountControl=512
userPassword={BASE64}<base64 encoded password>
sAMAccountName=username
distinguishedName=username,CN=Users,DC=company,DC=com

But I get exception:
LDAPException: Unwilling To Perform (53) Unwilling To Perform
LDAPException: Server Message: 0000052D: SvcErr: DSID-031A0FC0, problem 5003 (WILL_NOT_PERFORM), data 0

May be anybody can tell me where I'm making an error? Maybe I forgot some required attribute?
EDIT:
My code (It is trivial and I think that no errors in it):
LDAPConnection connection;
LDAPMessageQueue messageQueue;
...
LDAPAttributeSet attributes = new LDAPAttributeSet();
attributes.add(new LDAPAttribute("objectClass", "user"));
attributes.add(new LDAPAttribute("cn", "username"));
attributes.add(new LDAPAttribute("name", "username"));
attributes.add(new LDAPAttribute("userAccountControl", "512"));
attributes.add(new LDAPAttribute("userPassword", "{BASE64}<base64 encoded password>"));
attributes.add(new LDAPAttribute("sAMAccountName", "username"));
attributes.add(new LDAPAttribute("distinguishedName", "username,CN=Users,DC=company,DC=com"));

LDAPEntry entry = new LDAPEntry("CN=username,CN=Users,DC=company,DC=com", attributes);
connection.add(entry);

A: This error can arise when the password is not correctly encoded. Make sure it's a Base64 encoded UTF-16LE string.
Example (if you are using Oracle JVM)
String pass = "password";
sun.misc.BASE64Encoder enc = new sun.misc.BASE64Encoder();
String encoded = enc.encode(pass.getBytes("UTF-16LE"));

UPDATE 1:
Have you tried running your code without the userAccountControl attribute (to rule in or out that it's actually that attribute that is causing problems)?
I noticed that your distinguished name attribute looks a bit strange, as well. It should probably look something like CN=username,OU=Users,DC=company,DC=com.
UPDATE 2: see Adding a user with a password in Active Directory LDAP. WILL_NOT_PERFORM can be returned if you are trying to set password for an entry (which you are, since you're creating it) over a non-SSL connection. You need to make sure you are connecting to the AD server over SSL (and set up certificates as required).


text:
Q: How do I parse rtf text using ruby and parslet? I have the following data from a rich text format (RTF) file:

{\rtf1\ansi\deff3\adeflang1025\n{\fonttbl{\f0\froman\fprq2\fcharset0
  Times New Roman;}{\f1\froman\fprq2\fcharset2
  Symbol;}{\f2\fswiss\fprq2\fcharset0
  Arial;}{\f3\froman\fprq2\fcharset128 Times New
  Roman;}{\f4\fswiss\fprq2\fcharset128
  Arial;}{\f5\fnil\fprq2\fcharset128 Droid Sans
  Fallback;}{\f6\fnil\fprq2\fcharset128 DejaVu
  Sans;}{\f7\fswiss\fprq0\fcharset128 DejaVu
  Sans;}}\n{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}\n{\stylesheet{\s0\snext0\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f3\fs24\lang1033
  Default;}\n{\s15\sbasedon0\snext16\sb240\sa120\keepn\hich\af5\dbch\af6\afs28\loch\f4\fs28
  Heading;}\n{\s16\sbasedon0\snext16\sb0\sa120 Text
  body;}\n{\s17\sbasedon16\snext17\sb0\sa120\dbch\af7
  List;}\n{\s18\sbasedon0\snext18\sb120\sa120\noline\i\dbch\af7\afs24\ai\fs24
  Caption;}\n{\s19\sbasedon0\snext19\noline\dbch\af7
  Index;}\n}{\info{\creatim\yr2018\mo7\dy15\hr11\min52}{\revtim\yr0\mo0\dy0\hr0\min0}{\printim\yr0\mo0\dy0\hr0\min0}{\comment
  OpenOffice}{\vern4140}}\deftab709\n\n{\*\pgdsctbl\n{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0
  Default;}}\n\formshade\paperh15840\paperw12240\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\sectunlocked1\pgndec\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc\n\pgndec\pard\plain
  \s0\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f3\fs24\lang1033{\rtlch
  \ltrch\loch\nI like to read.}\n\par }

Following the example from "Text Processing with Ruby" by Rob Miller, I have the following Parslet Parser:
require "parslet"

class Rtf < Parslet::Parser

   rule(:space)                    { str(" ") }

   rule(:hypen)                    { str("-") }

   rule(:integer)                  { match["0-9"].repeat(1) }

   rule(:newline)                  { str("\n") }

   rule(:slash)                    { str("\\") }

   rule(:letter_sequence)          { match["a-z"].repeat }

   rule(:special_chars)            { match["\\\\{}"] }

   rule(:unformatted_text)         { ( special_chars.absent? >> any ).repeat(1).as(:text) }

   rule(:control_word)             { ( slash >>
                                       letter_sequence.as(:word) >>
                                       control_delimiter.maybe.as(:delimiter)
                                     ).as(:control_word)
                                   }

   rule(:control_delimiter)        { space | ( hypen.maybe >> integer ) | str(";") }

  rule(:group)                     {
                                      (
                                         str("{") >>
                                         newline.maybe >>
                                         content >>
                                         newline.maybe >>
                                         str("}")
                                      )
                                   }

  rule(:content)                   {
                                     (
                                        unformatted_text | control_word | group
                                     ).repeat
                                   }

  rule(:header)                    {
                                      ( slash >> str("rtf") >> integer.maybe.as(:version) ).as(:rtf) >>
                                      ( slash >> letter_sequence.as(:charset) ) >>
                                      ( slash >> str("deff") >> integer.maybe ).maybe.as(:deff) >>
                                      color_table.maybe.as(:color_table) >>
                                      newline.maybe
                                   }

  rule(:color_table)               {
                                      newline.maybe >>
                                      str("{") >>
                                      ( slash >> str("colortabl;") ) >>
                                      color_definition.repeat(1).as(:colors) >>
                                      str("}") >>
                                      newline.maybe
                                   }

  rule(:color_definition)          {
                                      slash >> str("red") >> (intger.as(:int)).as(:red) >>
                                      slash >> str("green") >> (intger.as(:int)).as(:green) >>
                                      slash >> str("blue") >> (intger.as(:int)).as(:blue) >>
                                      str(";")
                                   }

  rule(:file)                      {
                                      str("{") >>
                                      header.as(:header) >>
                                      content.as(:document) >>
                                      str("}") >>
                                      newline.maybe
                                   }

  root :file

end

Parsing the rtf file with the above Parslet yields:

(byebug) parsed {:header=>{:rtf=>{:version=>"1"@5},
  :charset=>"ansi"@7, :deff=>"\deff3"@11, :color_table=>nil},
  :document=>[{:control_word=>{:word=>"adeflang"@18,
  :delimiter=>"1025"@26}}, {:text=>"\n"@30}, {:text=>"\n"@374},
  {:text=>"\n"@431}, {:control_word=>{:word=>"deftab"@1050,
  :delimiter=>"709"@1056}}, {:text=>"\n\n"@1059}, {:text=>"\n"@1191},
  {:control_word=>{:word=>"formshade"@1193, :delimiter=>nil}},
  {:control_word=>{:word=>"paperh"@1203, :delimiter=>"15840"@1209}},
  {:control_word=>{:word=>"paperw"@1215, :delimiter=>"12240"@1221}},
  {:control_word=>{:word=>"margl"@1227, :delimiter=>"1134"@1232}},
  {:control_word=>{:word=>"margr"@1237, :delimiter=>"1134"@1242}},
  {:control_word=>{:word=>"margt"@1247, :delimiter=>"1134"@1252}},
  {:control_word=>{:word=>"margb"@1257, :delimiter=>"1134"@1262}},
  {:control_word=>{:word=>"sectd"@1267, :delimiter=>nil}},
  {:control_word=>{:word=>"sbknone"@1273, :delimiter=>nil}},
  {:control_word=>{:word=>"sectunlocked"@1281, :delimiter=>"1"@1293}},
  {:control_word=>{:word=>"pgndec"@1295, :delimiter=>nil}},
  {:control_word=>{:word=>"pgwsxn"@1302, :delimiter=>"12240"@1308}},
  {:control_word=>{:word=>"pghsxn"@1314, :delimiter=>"15840"@1320}},
  {:control_word=>{:word=>"marglsxn"@1326, :delimiter=>"1134"@1334}},
  {:control_word=>{:word=>"margrsxn"@1339, :delimiter=>"1134"@1347}},
  {:control_word=>{:word=>"margtsxn"@1352, :delimiter=>"1134"@1360}},
  {:control_word=>{:word=>"margbsxn"@1365, :delimiter=>"1134"@1373}},
  {:control_word=>{:word=>"ftnbj"@1378, :delimiter=>nil}},
  {:control_word=>{:word=>"ftnstart"@1384, :delimiter=>"1"@1392}},
  {:control_word=>{:word=>"ftnrstcont"@1394, :delimiter=>nil}},
  {:control_word=>{:word=>"ftnnar"@1405, :delimiter=>nil}},
  {:control_word=>{:word=>"aenddoc"@1412, :delimiter=>nil}},
  {:control_word=>{:word=>"aftnrstcont"@1420, :delimiter=>nil}},
  {:control_word=>{:word=>"aftnstart"@1432, :delimiter=>"1"@1441}},
  {:control_word=>{:word=>"aftnnrlc"@1443, :delimiter=>nil}},
  {:text=>"\n"@1451}, {:control_word=>{:word=>"pgndec"@1453,
  :delimiter=>nil}}, {:control_word=>{:word=>"pard"@1460,
  :delimiter=>nil}}, {:control_word=>{:word=>"plain"@1465, :delimiter=>"
  "@1470}}, {:control_word=>{:word=>"s"@1472, :delimiter=>"0"@1473}},
  {:control_word=>{:word=>"nowidctlpar"@1475, :delimiter=>nil}},
  {:control_word=>{:word=>"cf"@1529, :delimiter=>"0"@1531}},
  {:control_word=>{:word=>"kerning"@1533, :delimiter=>"1"@1540}},
  {:control_word=>{:word=>"hich"@1542, :delimiter=>nil}},
  {:control_word=>{:word=>"af"@1547, :delimiter=>"5"@1549}},
  {:control_word=>{:word=>"langfe"@1551, :delimiter=>"2052"@1557}},
  {:control_word=>{:word=>"dbch"@1562, :delimiter=>nil}},
  {:control_word=>{:word=>"af"@1567, :delimiter=>"6"@1569}},
  {:control_word=>{:word=>"afs"@1571, :delimiter=>"24"@1574}},
  {:control_word=>{:word=>"lang"@1577, :delimiter=>"1081"@1581}},
  {:control_word=>{:word=>"loch"@1586, :delimiter=>nil}},
  {:control_word=>{:word=>"f"@1591, :delimiter=>"3"@1592}},
  {:control_word=>{:word=>"fs"@1594, :delimiter=>"24"@1596}},
  {:control_word=>{:word=>"lang"@1599, :delimiter=>"1033"@1603}},
  {:text=>"\n"@1643}, {:control_word=>{:word=>"par"@1645, :delimiter=>"
  "@1648}}]}

None of the text that is in the RTF file, i.e. "I like to read.", is parsed and i have no clue why.  Any guidance will be appreciated.

A: It's because you are missing all the groups.
rule(:group)                     {
                                  (
                                     str("{") >>
                                     newline.maybe >>
                                     content >>
                                     newline.maybe >>
                                     str("}")
                                  ).as(:group)
                               }

Add the 'as(:group)'
Now you get
{:header=>
      {:rtf=>{:version=>"1"@5},
       :charset=>"ansi"@7,
       :deff=>"\\deff3"@11,
       :color_table=>nil},
     :document=>
      [{:control_word=>{:word=>"adeflang"@18, :delimiter=>"1025"@26}},
       {:control_word=>{:word=>"n"@31, :delimiter=>nil}},
       {:group=>
         [{:control_word=>{:word=>"fonttbl"@34, :delimiter=>nil}},
          {:group=>
            [{:control_word=>{:word=>"f"@43, :delimiter=>"0"@44}},
             {:control_word=>{:word=>"froman"@46, :delimiter=>nil}},
             {:control_word=>{:word=>"fprq"@53, :delimiter=>"2"@57}},
             {:control_word=>{:word=>"fcharset"@59, :delimiter=>"0"@67}},
             {:text=>" Times New Roman;"@68}]},
          {:group=>
            [{:control_word=>{:word=>"f"@88, :delimiter=>"1"@89}},
             {:control_word=>{:word=>"froman"@91, :delimiter=>nil}},
             {:control_word=>{:word=>"fprq"@98, :delimiter=>"2"@102}},
             {:control_word=>{:word=>"fcharset"@104, :delimiter=>"2"@112}},
             {:text=>" Symbol;"@113}]},
          {:group=>
            [{:control_word=>{:word=>"f"@124, :delimiter=>"2"@125}},
             {:control_word=>{:word=>"fswiss"@127, :delimiter=>nil}},
             {:control_word=>{:word=>"fprq"@134, :delimiter=>"2"@138}},
             {:control_word=>{:word=>"fcharset"@140, :delimiter=>"0"@148}},
             {:text=>" Arial;"@149}]},
          {:group=>
            [{:control_word=>{:word=>"f"@159, :delimiter=>"3"@160}},
             {:control_word=>{:word=>"froman"@162, :delimiter=>nil}},
             {:control_word=>{:word=>"fprq"@169, :delimiter=>"2"@173}},
             {:control_word=>{:word=>"fcharset"@175, :delimiter=>"128"@183}},
             {:text=>" Times New Roman;"@186}]},
          {:group=>
            [{:control_word=>{:word=>"f"@206, :delimiter=>"4"@207}},
             {:control_word=>{:word=>"fswiss"@209, :delimiter=>nil}},
             {:control_word=>{:word=>"fprq"@216, :delimiter=>"2"@220}},
             {:control_word=>{:word=>"fcharset"@222, :delimiter=>"128"@230}},
             {:text=>" Arial;"@233}]},
          {:group=>
            [{:control_word=>{:word=>"f"@243, :delimiter=>"5"@244}},
             {:control_word=>{:word=>"fnil"@246, :delimiter=>nil}},
             {:control_word=>{:word=>"fprq"@251, :delimiter=>"2"@255}},
             {:control_word=>{:word=>"fcharset"@257, :delimiter=>"128"@265}},
             {:text=>" Droid Sans Fallback;"@268}]},
          {:group=>
            [{:control_word=>{:word=>"f"@292, :delimiter=>"6"@293}},
             {:control_word=>{:word=>"fnil"@295, :delimiter=>nil}},
             {:control_word=>{:word=>"fprq"@300, :delimiter=>"2"@304}},
             {:control_word=>{:word=>"fcharset"@306, :delimiter=>"128"@314}},
             {:text=>" DejaVu Sans;"@317}]},
          {:group=>
            [{:control_word=>{:word=>"f"@333, :delimiter=>"7"@334}},
             {:control_word=>{:word=>"fswiss"@336, :delimiter=>nil}},
             {:control_word=>{:word=>"fprq"@343, :delimiter=>"0"@347}},
             {:control_word=>{:word=>"fcharset"@349, :delimiter=>"128"@357}},
             {:text=>" DejaVu Sans;"@360}]}]},
       {:control_word=>{:word=>"n"@376, :delimiter=>nil}},
       {:group=>
         [{:control_word=>{:word=>"colortbl"@379, :delimiter=>";"@387}},
          {:control_word=>{:word=>"red"@389, :delimiter=>"0"@392}},
          {:control_word=>{:word=>"green"@394, :delimiter=>"0"@399}},
          {:control_word=>{:word=>"blue"@401, :delimiter=>"0"@405}},
          {:text=>";"@406},
          {:control_word=>{:word=>"red"@408, :delimiter=>"128"@411}},
          {:control_word=>{:word=>"green"@415, :delimiter=>"128"@420}},
          {:control_word=>{:word=>"blue"@424, :delimiter=>"128"@428}},
          {:text=>";"@431}]},
       {:control_word=>{:word=>"n"@434, :delimiter=>nil}},
       {:group=>
         [{:control_word=>{:word=>"stylesheet"@437, :delimiter=>nil}},
          {:group=>
            [{:control_word=>{:word=>"s"@449, :delimiter=>"0"@450}},
             {:control_word=>{:word=>"snext"@452, :delimiter=>"0"@457}},
             {:control_word=>{:word=>"nowidctlpar"@459, :delimiter=>nil}},
             {:group=>
               [{:control_word=>{:word=>[], :delimiter=>nil}},
                {:text=>"*"@472},
                {:control_word=>{:word=>"hyphen"@474, :delimiter=>"2"@480}},
                {:control_word=>{:word=>"hyphlead"@482, :delimiter=>"2"@490}},
                {:control_word=>{:word=>"hyphtrail"@492, :delimiter=>"2"@501}},
                {:control_word=>{:word=>"hyphmax"@503, :delimiter=>"0"@510}}]},
             {:control_word=>{:word=>"cf"@513, :delimiter=>"0"@515}},
             {:control_word=>{:word=>"kerning"@517, :delimiter=>"1"@524}},
             {:control_word=>{:word=>"hich"@526, :delimiter=>nil}},
             {:control_word=>{:word=>"af"@531, :delimiter=>"5"@533}},
             {:control_word=>{:word=>"langfe"@535, :delimiter=>"2052"@541}},
             {:control_word=>{:word=>"dbch"@546, :delimiter=>nil}},
             {:control_word=>{:word=>"af"@551, :delimiter=>"6"@553}},
             {:control_word=>{:word=>"afs"@555, :delimiter=>"24"@558}},
             {:control_word=>{:word=>"lang"@561, :delimiter=>"1081"@565}},
             {:control_word=>{:word=>"loch"@570, :delimiter=>nil}},
             {:control_word=>{:word=>"f"@575, :delimiter=>"3"@576}},
             {:control_word=>{:word=>"fs"@578, :delimiter=>"24"@580}},
             {:control_word=>{:word=>"lang"@583, :delimiter=>"1033"@587}},
             {:text=>" Default;"@591}]},
          {:control_word=>{:word=>"n"@602, :delimiter=>nil}},
          {:group=>
            [{:control_word=>{:word=>"s"@605, :delimiter=>"15"@606}},
             {:control_word=>{:word=>"sbasedon"@609, :delimiter=>"0"@617}},
             {:control_word=>{:word=>"snext"@619, :delimiter=>"16"@624}},
             {:control_word=>{:word=>"sb"@627, :delimiter=>"240"@629}},
             {:control_word=>{:word=>"sa"@633, :delimiter=>"120"@635}},
             {:control_word=>{:word=>"keepn"@639, :delimiter=>nil}},
             {:control_word=>{:word=>"hich"@645, :delimiter=>nil}},
             {:control_word=>{:word=>"af"@650, :delimiter=>"5"@652}},
             {:control_word=>{:word=>"dbch"@654, :delimiter=>nil}},
             {:control_word=>{:word=>"af"@659, :delimiter=>"6"@661}},
             {:control_word=>{:word=>"afs"@663, :delimiter=>"28"@666}},
             {:control_word=>{:word=>"loch"@669, :delimiter=>nil}},
             {:control_word=>{:word=>"f"@674, :delimiter=>"4"@675}},
             {:control_word=>{:word=>"fs"@677, :delimiter=>"28"@679}},
             {:text=>" Heading;"@681}]},
          {:control_word=>{:word=>"n"@692, :delimiter=>nil}},
          {:group=>
            [{:control_word=>{:word=>"s"@695, :delimiter=>"16"@696}},
             {:control_word=>{:word=>"sbasedon"@699, :delimiter=>"0"@707}},
             {:control_word=>{:word=>"snext"@709, :delimiter=>"16"@714}},
             {:control_word=>{:word=>"sb"@717, :delimiter=>"0"@719}},
             {:control_word=>{:word=>"sa"@721, :delimiter=>"120"@723}},
             {:text=>" Text body;"@726}]},
          {:control_word=>{:word=>"n"@739, :delimiter=>nil}},
          {:group=>
            [{:control_word=>{:word=>"s"@742, :delimiter=>"17"@743}},
             {:control_word=>{:word=>"sbasedon"@746, :delimiter=>"16"@754}},
             {:control_word=>{:word=>"snext"@757, :delimiter=>"17"@762}},
             {:control_word=>{:word=>"sb"@765, :delimiter=>"0"@767}},
             {:control_word=>{:word=>"sa"@769, :delimiter=>"120"@771}},
             {:control_word=>{:word=>"dbch"@775, :delimiter=>nil}},
             {:control_word=>{:word=>"af"@780, :delimiter=>"7"@782}},
             {:text=>" List;"@783}]},
          {:control_word=>{:word=>"n"@791, :delimiter=>nil}},
          {:group=>
            [{:control_word=>{:word=>"s"@794, :delimiter=>"18"@795}},
             {:control_word=>{:word=>"sbasedon"@798, :delimiter=>"0"@806}},
             {:control_word=>{:word=>"snext"@808, :delimiter=>"18"@813}},
             {:control_word=>{:word=>"sb"@816, :delimiter=>"120"@818}},
             {:control_word=>{:word=>"sa"@822, :delimiter=>"120"@824}},
             {:control_word=>{:word=>"noline"@828, :delimiter=>nil}},
             {:control_word=>{:word=>"i"@835, :delimiter=>nil}},
             {:control_word=>{:word=>"dbch"@837, :delimiter=>nil}},
             {:control_word=>{:word=>"af"@842, :delimiter=>"7"@844}},
             {:control_word=>{:word=>"afs"@846, :delimiter=>"24"@849}},
             {:control_word=>{:word=>"ai"@852, :delimiter=>nil}},
             {:control_word=>{:word=>"fs"@855, :delimiter=>"24"@857}},
             {:text=>" Caption;"@859}]},
          {:control_word=>{:word=>"n"@870, :delimiter=>nil}},
          {:group=>
            [{:control_word=>{:word=>"s"@873, :delimiter=>"19"@874}},
             {:control_word=>{:word=>"sbasedon"@877, :delimiter=>"0"@885}},
             {:control_word=>{:word=>"snext"@887, :delimiter=>"19"@892}},
             {:control_word=>{:word=>"noline"@895, :delimiter=>nil}},
             {:control_word=>{:word=>"dbch"@902, :delimiter=>nil}},
             {:control_word=>{:word=>"af"@907, :delimiter=>"7"@909}},
             {:text=>" Index;"@910}]},
          {:control_word=>{:word=>"n"@919, :delimiter=>nil}}]},
       {:group=>
         [{:control_word=>{:word=>"info"@923, :delimiter=>nil}},
          {:group=>
            [{:control_word=>{:word=>"creatim"@929, :delimiter=>nil}},
             {:control_word=>{:word=>"yr"@937, :delimiter=>"2018"@939}},
             {:control_word=>{:word=>"mo"@944, :delimiter=>"7"@946}},
             {:control_word=>{:word=>"dy"@948, :delimiter=>"15"@950}},
             {:control_word=>{:word=>"hr"@953, :delimiter=>"11"@955}},
             {:control_word=>{:word=>"min"@958, :delimiter=>"52"@961}}]},
          {:group=>
            [{:control_word=>{:word=>"revtim"@966, :delimiter=>nil}},
             {:control_word=>{:word=>"yr"@973, :delimiter=>"0"@975}},
             {:control_word=>{:word=>"mo"@977, :delimiter=>"0"@979}},
             {:control_word=>{:word=>"dy"@981, :delimiter=>"0"@983}},
             {:control_word=>{:word=>"hr"@985, :delimiter=>"0"@987}},
             {:control_word=>{:word=>"min"@989, :delimiter=>"0"@992}}]},
          {:group=>
            [{:control_word=>{:word=>"printim"@996, :delimiter=>nil}},
             {:control_word=>{:word=>"yr"@1004, :delimiter=>"0"@1006}},
             {:control_word=>{:word=>"mo"@1008, :delimiter=>"0"@1010}},
             {:control_word=>{:word=>"dy"@1012, :delimiter=>"0"@1014}},
             {:control_word=>{:word=>"hr"@1016, :delimiter=>"0"@1018}},
             {:control_word=>{:word=>"min"@1020, :delimiter=>"0"@1023}}]},
          {:group=>
            [{:control_word=>{:word=>"comment"@1027, :delimiter=>" "@1034}},
             {:text=>"OpenOffice"@1035}]},
          {:group=>
            [{:control_word=>{:word=>"vern"@1048, :delimiter=>"4140"@1052}}]}]},
       {:control_word=>{:word=>"deftab"@1059, :delimiter=>"709"@1065}},
       {:control_word=>{:word=>"n"@1069, :delimiter=>nil}},
       {:control_word=>{:word=>"n"@1071, :delimiter=>nil}},
       {:group=>
         [{:control_word=>{:word=>[], :delimiter=>nil}},
          {:text=>"*"@1074},
          {:control_word=>{:word=>"pgdsctbl"@1076, :delimiter=>nil}},
          {:control_word=>{:word=>"n"@1085, :delimiter=>nil}},
          {:group=>
            [{:control_word=>{:word=>"pgdsc"@1088, :delimiter=>"0"@1093}},
             {:control_word=>{:word=>"pgdscuse"@1095, :delimiter=>"195"@1103}},
             {:control_word=>{:word=>"pgwsxn"@1107, :delimiter=>"12240"@1113}},
             {:control_word=>{:word=>"pghsxn"@1119, :delimiter=>"15840"@1125}},
             {:control_word=>{:word=>"marglsxn"@1131, :delimiter=>"1134"@1139}},
             {:control_word=>{:word=>"margrsxn"@1144, :delimiter=>"1134"@1152}},
             {:control_word=>{:word=>"margtsxn"@1157, :delimiter=>"1134"@1165}},
             {:control_word=>{:word=>"margbsxn"@1170, :delimiter=>"1134"@1178}},
             {:control_word=>{:word=>"pgdscnxt"@1183, :delimiter=>"0"@1191}},
             {:text=>" Default;"@1192}]}]},
       {:control_word=>{:word=>"n"@1204, :delimiter=>nil}},
       {:control_word=>{:word=>"formshade"@1206, :delimiter=>nil}},
       {:control_word=>{:word=>"paperh"@1216, :delimiter=>"15840"@1222}},
       {:control_word=>{:word=>"paperw"@1228, :delimiter=>"12240"@1234}},
       {:control_word=>{:word=>"margl"@1240, :delimiter=>"1134"@1245}},
       {:control_word=>{:word=>"margr"@1250, :delimiter=>"1134"@1255}},
       {:control_word=>{:word=>"margt"@1260, :delimiter=>"1134"@1265}},
       {:control_word=>{:word=>"margb"@1270, :delimiter=>"1134"@1275}},
       {:control_word=>{:word=>"sectd"@1280, :delimiter=>nil}},
       {:control_word=>{:word=>"sbknone"@1286, :delimiter=>nil}},
       {:control_word=>{:word=>"sectunlocked"@1294, :delimiter=>"1"@1306}},
       {:control_word=>{:word=>"pgndec"@1308, :delimiter=>nil}},
       {:control_word=>{:word=>"pgwsxn"@1315, :delimiter=>"12240"@1321}},
       {:control_word=>{:word=>"pghsxn"@1327, :delimiter=>"15840"@1333}},
       {:control_word=>{:word=>"marglsxn"@1339, :delimiter=>"1134"@1347}},
       {:control_word=>{:word=>"margrsxn"@1352, :delimiter=>"1134"@1360}},
       {:control_word=>{:word=>"margtsxn"@1365, :delimiter=>"1134"@1373}},
       {:control_word=>{:word=>"margbsxn"@1378, :delimiter=>"1134"@1386}},
       {:control_word=>{:word=>"ftnbj"@1391, :delimiter=>nil}},
       {:control_word=>{:word=>"ftnstart"@1397, :delimiter=>"1"@1405}},
       {:control_word=>{:word=>"ftnrstcont"@1407, :delimiter=>nil}},
       {:control_word=>{:word=>"ftnnar"@1418, :delimiter=>nil}},
       {:control_word=>{:word=>"aenddoc"@1425, :delimiter=>nil}},
       {:control_word=>{:word=>"aftnrstcont"@1433, :delimiter=>nil}},
       {:control_word=>{:word=>"aftnstart"@1445, :delimiter=>"1"@1454}},
       {:control_word=>{:word=>"aftnnrlc"@1456, :delimiter=>nil}},
       {:control_word=>{:word=>"n"@1465, :delimiter=>nil}},
       {:control_word=>{:word=>"pgndec"@1467, :delimiter=>nil}},
       {:control_word=>{:word=>"pard"@1474, :delimiter=>nil}},
       {:control_word=>{:word=>"plain"@1479, :delimiter=>" "@1484}},
       {:control_word=>{:word=>"s"@1486, :delimiter=>"0"@1487}},
       {:control_word=>{:word=>"nowidctlpar"@1489, :delimiter=>nil}},
       {:group=>
         [{:control_word=>{:word=>[], :delimiter=>nil}},
          {:text=>"*"@1502},
          {:control_word=>{:word=>"hyphen"@1504, :delimiter=>"2"@1510}},
          {:control_word=>{:word=>"hyphlead"@1512, :delimiter=>"2"@1520}},
          {:control_word=>{:word=>"hyphtrail"@1522, :delimiter=>"2"@1531}},
          {:control_word=>{:word=>"hyphmax"@1533, :delimiter=>"0"@1540}}]},
       {:control_word=>{:word=>"cf"@1543, :delimiter=>"0"@1545}},
       {:control_word=>{:word=>"kerning"@1547, :delimiter=>"1"@1554}},
       {:control_word=>{:word=>"hich"@1556, :delimiter=>nil}},
       {:control_word=>{:word=>"af"@1561, :delimiter=>"5"@1563}},
       {:control_word=>{:word=>"langfe"@1565, :delimiter=>"2052"@1571}},
       {:control_word=>{:word=>"dbch"@1576, :delimiter=>nil}},
       {:control_word=>{:word=>"af"@1581, :delimiter=>"6"@1583}},
       {:control_word=>{:word=>"afs"@1585, :delimiter=>"24"@1588}},
       {:control_word=>{:word=>"lang"@1591, :delimiter=>"1081"@1595}},
       {:control_word=>{:word=>"loch"@1600, :delimiter=>nil}},
       {:control_word=>{:word=>"f"@1605, :delimiter=>"3"@1606}},
       {:control_word=>{:word=>"fs"@1608, :delimiter=>"24"@1610}},
       {:control_word=>{:word=>"lang"@1613, :delimiter=>"1033"@1617}},
       {:group=>
         [{:control_word=>{:word=>"rtlch"@1623, :delimiter=>" "@1628}},
          {:control_word=>{:word=>"ltrch"@1630, :delimiter=>nil}},
          {:control_word=>{:word=>"loch"@1636, :delimiter=>nil}},
          {:control_word=>{:word=>"n"@1641, :delimiter=>nil}},
          {:text=>"I like to read."@1642}]},
       {:control_word=>{:word=>"n"@1659, :delimiter=>nil}},
       {:control_word=>{:word=>"par"@1661, :delimiter=>" "@1664}}]}


text:
Q: PyCharm: "Simplify Chained Comparison" I have two integer value cnt_1 and cnt_2, and I write the following statements:
if cnt_1 < 0 and cnt_2 >= 0:
    # some code

This statement gets underlined, and the tooltip tells me that I must:

simplify chained comparison

As far as I can tell, that comparison is about as simple as they come. What have I missed here?
The question is a little different from link, there are different variables in comparison.

A: Pycharm is trying to tell you that the equation can be simplified. If you want to know what PyCharm would prefer it to be, PyCharm will help automate this fix. If you navigate your cursor to the underlined code and do:
Alt + Enter -> 'Simplify chained expression'
PyCharm will change this to:
if cnt_1 < 0 <= cnt_2:

The warning will now be gone. If you prefer the original code and are just wanting the warning to go away you can place your cursor on the warning and do
Alt + Enter -> 'Ignore...'
And this type of error will no longer be flagged. You can also access both of these options on a global scale by doing.
Code->"Inspect code..."-> (Choose the scope you'd like to inspect) -> Ok
This will give you a list of all the warnings in the scope you've selected and provide you with an automated method to fix many of them.

A: Your expression can be rewritten as:
if cnt_1 < 0 <= cnt_2:

This is called comparison chaining.


text:
Q: Creating Strikethrough Macro in Excel I'm a novice to VBA and I'm trying to make a simple macro where one can highlight a set of cells, click a button, and strikethrough the selected sells. After, you can select the cell again, click the same button, and remove the strikethrough.
I have been looking for decent documentation but, have yet to find anything.
Here's some code.
Also, I would love to know where the best documentation is on VBA.
Sub strikeOut()

Selection.Font.Strikethrough = True

End Sub

I also need help with the command button.
Thank you.

A: It looks like you're on the right path. Based on your code, I'm assuming you already have a command button created. If so try this:
Sub strikeOut()
    With Selection.Font
        .Strikethrough = Not .Strikethrough
    End With
End Sub

To create a command button:

*

*Excel 2003 and earlier:

*

*Open up the Visual Basic toolbar and activate the Control Toolbox button. Another box/toolbar should appear with different control options.

*Select the Button option and place it in the desired location.

*Excel 2007 and later:

*

*Click on the Developer tab/ribbon.

*Select Insert and select Button and place it in the desired location.

**The steps below apply to all versions from this point forward.

*

*Right-click on your new button and select Properties to give your button a name/caption.

*Right-click again and select View Code.

*In the ButtonName_Click() sub, add the strikeOut() call using either:

*

*Call strikeOut()

*or simply

*

*strikeOut
To answer the second part of your question, it's hard to say what is the 'best' but here are some links that may help:
Chip Pearson's site
MSDN
OZgrid


text:
Q: when do we need virtual function since we can get the same feel using simple single level inheritance? Though we can get the feel of virtual function by inheriting a class and enhancing the functionality of the function in the base class, when should we go for virtual function?

A: Virtual methods should be used when you want to provide default behaviour in the base class. The child classes can then override this function and provide their own, more specific behaviour.
For example:
  class Animal
  {
   public virtual void Say()
   {
      //default behaviour
      Console.WriteLine("Animal makes generic noise");
   }
  }

  class Dog : Animal
  {
    public override void Say()
    {
      //specific behaviour
      Console.WriteLine("Dog barks.");
    }
  }

A: To implement Polymorphism in OO hierarchies.


text:
Q: Is this correct "with my head faced up" "with my face faced up" I don't know if this expression is correct.
I looked up at the sky, with my face faced up.
I looked up at the sky, with my head faced up.

*

*with my face faced up

*with my head faced up


text:
Q: Minimizing a functional takes forever I need help with minimizing a functional in Mathematica.
I have a function $V(\xi)=\sum_{i=1}^\infty C_{3_i}J_0(\xi/C_i)+C_{4_i}Y_0(\xi/C_i),~~~\Sigma\leq\xi\leq\xi_1$, and want to find such $\{C_{3_i}\}$ and $\{C_{4_i}\}$ that $V(\xi)\equiv-1$. Here $\{C_i\}$ are known (see below), $J_0(x)$ and $Y_0(x)$ are Bessel functions. To do that, I take $\int\limits_\Sigma^{\xi_1}|V(\xi)+1|d\xi$ and minimize it whit respect to parameters $\{C_{3_i}\}$ and $\{C_{4_i}\}$. I don't know why, but it takes forever for Mathematica to minimize that functional (at least more than 14 hours). Probably that's because integration increases the number of summands adding some with $C_{3_i}C_{4_i}$ coefficients. Am I doing something wrong or is there a method for getting the $\{C_{3_i}\}$ and $\{C_{4_i}\}$ faster?
Important note: I take $V(\xi)\approx\sum_{i=1}^N C_{3_i}J_0(\xi/C_i)+C_{4_i}Y_0(\xi/C_i)$, where $N$ is length of $\{C_i\}$, and $\{C_i\}$ are eigenvalues of Sturm-Liouville problem (see the code for detailed information). $V(\xi)\equiv-1$ is actually obtained from initial condition for the initial function $F(\xi,\tau)=V(\xi)U(\tau)$.
xi1 = 10;
Sigma = 1;
nn = 1;
f3[z_] = BesselJ[1, nn*xi1/z]*BesselY[0, nn*Sigma/z] -
BesselJ[0, nn*Sigma/z]*BesselY[1, nn*xi1/z];
Plot[f3[z], {z, 0, 10*nn}]
NumberOfRoots = 0;
Timing[roots3 =
Reap[First[
  NDSolve[{x'[z] == f3'[z], x[1] == f3[1]}, {x}, {z, 1000, 0.1},
   Method -> {"EventLocator", "Event" -> x[z],
     "EventAction" :> {Sow[y /. FindRoot[f3[y], {y, z}]],
       NumberOfRoots++}}, MaxStepSize -> 0.1,
   MaxSteps -> 1000000]]][[2, 1]]];
NumberOfRoots
Min[Abs[f3 /@ roots3]]
Max[Abs[f3 /@ roots3]]
roots3 = Sort[roots3];

The code above finds $\{C_i\}$ - roots of equation given by boundary conditions $V(\Sigma)=0$ and $\frac{dV}{d\xi}(\xi_1)=0$
$$J_1(\xi_1/C)Y_0(\Sigma/C)-J_0(\Sigma/C)Y_1(\xi_1/C)=0.$$
I use the function
$$f_3(C)=J_1(n\xi_1/C)Y_0(n\Sigma/C)-J_0(n\Sigma/C)Y_1(n\xi_1/C),$$
where $n$ is a scale parameter. Bigger $n$ gives more roots. Thus, for $n=1$ we get 29 roots, $n=5$ - 143, $n=10$ - 286, etc. Then I print maximum and minimum values of $f_3(\{C_i\})$ to check if I really get zeros. For $n=1$ $\min f_3(\{C_i\})\sim2*10^{-19}$, $\max f_3(\{C_i\})\sim 2*10^{-15}$, which is really satisfactory.
Array[CCNew, NumberOfRoots]; (*CCNew=C*)
Array[C3, NumberOfRoots];
Array[C4, NumberOfRoots];
For[i = 0, i < NumberOfRoots, CCNew[i] = roots3[[i]]/nn, i++] (*here we take the scale into account*)
Clear[xi];
InitFunction[xi_] =
Sum[C3[i]*BesselJ[0, xi/CCNew[i]] +
C4[i]*BesselY[0, xi/CCNew[i]], {i, 1, NumberOfRoots}]; (*InitFunction=V*)
C5 = Join[Array[C3, NumberOfRoots], Array[C4, NumberOfRoots]];
Timing[Minimize[Integrate[Abs[InitFunction[xi] + 1], {xi, Sigma, xi1}], C5]]

And here it takes forever to find $\{C_5\}=\{C_3\}\cup\{C_4\}$.
Any help with this?


text:
Q: How to take a look at the next character in a stream in C?
Possible Duplicate:
C equivalent to fstream's peek

Say I have a file with characters in it. I want to look at what the next character is without moving the pointer, just to "peak" at it. how would I go about doing that?
FILE *fp;
char c, d;

fp = fopen (file, "r");

c = getc(fp);

d = nextchar?

How do I look at the character that comes next without actually calling getc again and moving the pointer?

A: You can simply use getc() to get the next character, followed by a call to ungetc().
Update: see @Jonathan's comment for a wrapper that allows for peeking past the end of the file (returning EOF in that event).
Update 2: A slightly more compact version:
int fpeek(FILE * const fp)
{
  const int c = getc(fp);
  return c == EOF ? EOF : ungetc(c, fp);
}


text:
Q: update one table from another I have two 2 tables in MySQL
The first one contains ID,name,address,phone
the second one Name and email
I want to update all email from table 2 to table 1 for same name
It's a very large database so i need to do it auto(more than 20k records)

A: The format for such updates in MySQL typically uses a join:
update table1 t1 join
       table2 t2
       on t1.name = t2.name
    set t1.email = t2.email;

I would caution you that matching on names can introduce complications -- with misspellings, middle initials, accented characters, and the like causing mismatches.


text:
Q: Modal Popup Extender animation in ASP.net I am currently developing an ASP.net c# application. I have a grid view which has bound link buttons inside. When the link button is pressed I want to display the modal popup using a fade in animation and a fade out animation when a button inside the modal popup is clicked.
I have added the animation extender into the code and set the TargetControlID to the ID of the link button, however, when I try to run the website it displays the error System.InvalidOperationException  the TargetControID of ModalPopupExtender is not valid. A control with ID 'sofLink' could not be found. sofLink is the ID of the LinkButton.
Below is the code for the grid view
<asp:GridView ID="tblSoftware" runat="server" Width="100%"
                        EnableModelValidation="True" AutoGenerateColumns="False"
                        onselectedindexchanged="tblSoftware_SelectedIndexChanged"
                        CellPadding="2">
                        <Columns>
                            <asp:TemplateField HeaderText="Software Name">
                                <ItemTemplate>
                                <asp:LinkButton ID="sofLink" Text='<%# Bind("sof_softwareName") %>'
                                 CommandName="sofID" OnCommand="GetSoftwareModal" CommandArgument='<%# Eval("sof_id") %>' runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="sof_platform" HeaderText="Platform" ReadOnly="True" SortExpression="sof_platform" />
                        </Columns>
                        <HeaderStyle CssClass="gridHeader" />
                        <PagerSettings Position="Bottom" />
                        <PagerStyle HorizontalAlign="Right" VerticalAlign="Middle" CssClass="gridPage" />
                        <AlternatingRowStyle BackColor="White"></AlternatingRowStyle>
                    </asp:GridView>

And below is the code for the ModalPopupExtender
<ajaxToolkit:ModalPopupExtender ID="mpe" runat="server" TargetControlID="sofLink"
                    PopupControlID="ModalPanel" DropShadow="true" Drag="true" OkControlID="OKButton" />

               <asp:Panel ID="ModalPanel"  runat="server" Width="500px" style="width: auto; height: auto;" CssClass="modalPopup">
                    <asp:Label ID="softwareTitle" Font-Bold="true" Font-Size="Medium" runat="server" Width="100%" style="text-align: center;" />

                    <asp:Literal ID="litSoftware" runat="server"></asp:Literal>
                    <asp:Button id="OKButton" runat="server" Text="Close" style="position: relative; right: 0px; width: 100px;" />
               </asp:Panel>

               <asp:ScriptManager ID="asm" runat="server" />

And below is the code for the animation
       <ajaxToolkit:AnimationExtender ID="popupAnimation" runat="server"
            TargetControlID="sofLink">

            <Animations>
                <OnClick>
                    <Parallel AnimationTarget="ModalPanel"
                    Duration="0.3" Fps="25">
                    <FadeIn />
                    </Parallel>
                </OnClick>
            </Animations>
       </ajaxToolkit:AnimationExtender>

Thanks for any help you can provide.

A: You could use a hidden button and use it's ID as TargetControlID of the ModalPopupExtender.
<asp:Button id="btnShowPopup" runat="server" style="display:none" />

Then you can call the button's click clientside if you want to show the popup immediately without postback in the follwoing way:
<asp:LinkButton ID="sofLink" runat="server" OnClientClick="javascript:document.getElementById('btnShowPopup').click();return false;">LinkButton</asp:LinkButton>

A: The TargetControlID (as far as I am aware) should be a control in the popup panel itself, not in the grid control. When I use the ModalPopupExtender I usually use  an asp:Button with 'display:none' as the TargetControlID. Eg,
<ajaxToolkit:ModalPopupExtender ID="mpe" runat="server" TargetControlID="btnPopup"
                PopupControlID="ModalPanel" DropShadow="true" Drag="true" OkControlID="OKButton" />
<asp:Panel ID="ModalPanel"  runat="server" Width="500px" style="width: auto; height: auto;" CssClass="modalPopup">
<asp:Button id="btnPopup" runat="server" style="display:none" />

In the code-behind you have to control the showing and hiding of the control base on an event, eg, GetSoftwareModal. You will also also to bind what you need if applicable.
Hope that helps.

A: I tried however my animation doesn't display.
I add databind into LinkButton:
<asp:LinkButton ID="sofLink" runat="server" OnClientClick="javascript:document.getElementById('DetailView1').databind();document.getElementById('btnShowPopup').click();return false;">LinkButton</asp:LinkButton>

I think because of databind of DetailView1, it need get data from database. If DetailView1 doesn't bind, the animation display normal.


text:
Q: Why we can have a semicolon in if but not in while loop Why can I do this:
if (int result=getValue(); result > 100) {
}

but cannot do this:
while (int result=getValue(); result > 100) {
}

Why discriminate against while? A condition is a condition. Why while cannot evaluate it like if can?
In order to achieve the desired behavior with while, I'd have to implement it this this way:
int result = getValue();
while (result > 100) {
    //do something
    result = getValue();
}

A: There are 3 reasons I can think of for not adding this syntax.

*

*There is a perfectly suitable construct, namely the for loop, that can be used for exactly this purpose.

*Adding any feature to the language is a lot of work, and a very strong case needs to be made for such a proposal. Given the first point, I don't see this happening.

*In my opinion this is the most important one: If this feature were added to the language (let's say for a convenient syntax, or something like that), then it can essentially never be removed from the language. This means that the while (;) syntax is forever banned, and there could very well be some other semantics that we would like to express using such a syntax, and giving up this option is not something that should be done without careful thought.

A: Because we already have a while-loop-with-initializer. It's spelled:
for (int result=getValue(); result > 100;) {
}


text:
Q: How can I sent an Azure app config value that contains an ampersand? I'm using Azure CLI to try to set an app config value to this URL:
az appconfig kv set --key "mykey" --value "https://fake.com/action?param1=a&param2=b" -n "test" --yes
I get the following result. Note that this is coming from the az command, not from the shell.
Please specify config store name or connection string(suggested).
'param2' is not recognized as an internal or external command,
operable program or batch file.

Is there some way to get az to take this URL as the value without having to resort to stupid stuff like URL encoding it? This seems broken to me.
Also note, the message Please specify config store name or connection string(suggested). is because it's failing to parse the command line properly because this is specified with -n. If I move the arguments around:
az appconfig kv set -n "test" --yes --key "mykey" --value "https://fake.com/action?param1=a&param2=b"
I now get this:
{
  "contentType": null,
  "etag": "zuspBqPBOHR1mXfcKCgORXHpAxB",
  "key": "mykey",
  "label": null,
  "lastModified": "2021-08-31T17:39:14+00:00",
  "locked": false,
  "tags": {},
  "value": "https://fake.com/action?param1=a"
}
'param2' is not recognized as an internal or external command,
operable program or batch file.

Which seems worse. It created the key value pair incorrectly then tried to run param2 as a command. WTF?

A: Following one of the links from @d-m got me to this:
https://github.com/Azure/azure-cli/blob/dev/doc/quoting-issues-with-powershell.md
That link fully explains it, but basically I need to use double quotes inside of single quotes because Powershell evaluates the arguments and then cmd evaluates them. So the single quotes are stripped off by powershell, then the double quotes are stripped by cmd and finally az gets the right argument.
This works:
az appconfig kv set -n "test" --yes --key "mykey" --value '"https://fake.com/action?param1=a&param2=b"'
{
  "contentType": "text/plain",
  "etag": "XugiNgxa2I04w0gaG2OBh9Jcj75",
  "key": "mykey",
  "label": null,
  "lastModified": "2021-08-31T18:20:44+00:00",
  "locked": false,
  "tags": {},
  "value": "https://fake.com/action?param1=a&param2=b"
}

A: The Azure CLI uses Bash by default.
& is a special character in Bash and must be escaped.
According to this answer You can do this directly with a backslash: "foo\&bar" or by wrapping the whole argument in single quotes: 'foo&bar'.
There shouldn't be a problem issuing either command from PowerShell since PowerShell uses backticks (`) to escape its special characters.


text:
Q: PHP - Display only the elements that time has not passed JSON FILE I have this json file:
Json Blob File
Every element has a property call time , so I just want display the elements in the array that time has not passed of today.
If in the array the element time is 12:00 PM, but the real time is 12:30 PM,
It means that it has already passed and can not be shown!


text:
Q: How to get image dimensions before it's lazy loaded using jQuery? The goal:
I have a set of images in a container which has a height of 0. When the trigger is clicked I want the container to slide down (animated) and lazy load the images in (using the lazy load jQuery plugin).
The Markup:
Trigger 1

Trigger 2

// ETC

The Problem:
In order to animate the container I need to give it a height. Currently I use jQuery quickly to get the height of the container, store it in a data-height attribute and then animate the height to zero. The problem is that it is getting the height based on the loading gif's inside when the image that will actually be loaded might be much taller. So the data-height attribute might be 600px when the fully loaded container will be 2000px.
Should/Can I:

*

*Get the height of the image stored in the data-src attribute before it is lazy loaded in, add those together, then set the container to that height.

*Keep the container closed, load in each image, once their loaded I can add them together, calculate the container height, then slide it down (not ideal as it'll be very slow).

*Any other suggestions?

The Kicker:
This site will be responsive so the fully loaded images' height will vary based on browser width as they have a max-width: 100%;

A:
Get the height of the image stored in the data-src attribute before it is lazy loaded in, add those together, then set the container to that height.

Yes, because it is given that the width does not change. If it saves your time, you can also investigate plugins like imagesloaded and lazyload.

A: You could lazy load the images into a div that's position fixed way off the user's browser window, then once the image has loaded, find it's height and give the div you want to fill the image with a height of zero, replace the background-image of that div, then animate it to the height you learned from the div offscreen


text:
Q: Iphone voice to text & back to voice API I want in my iphone app , Voice to Text and then back to Voice.
I tried searching on forum and Google and found some APIs like  OpenEars, Vocal Kit and tts , but these are all for English Languages and not for other languages like German , French and Spanish, Chinese, etc.
Is there any Free API for this and I am missing it on Google or there isn't any API for this? Please Help
The existing apps in App Store like Jibbigo and MLD are using such functionality , so what are they using??
ANSWER by Paul Dixon
The Nuance API is free for development but asks to purchase before going live in the APP Store, so it should be accepted that there is no free API ,,, please help guys

A: Nuance offers a speech recognition and TTS API for mobile devices.
http://dragonmobile.nuancemobiledeveloper.com/
According to this post speech recognition is available in eight languages and TTS in 35 languages.

A: OpenEars is free and they have some good support. As you've noted, it doesn't do multilingual.
A commercial tts product that does multilingual, since you'll probably never find a free open product with multilingual support, is Acapela.

A: I think iSpeech meets your requirement correctly.
It's a paid API but you will be provided with good support.
check the price list here  : https://www.ispeech.org/developer/purchase/plans
Also try "AT&T Speech API SDK for iOS" -  https://code-api-att.com/NativeSDK/PROD/docs/...

A: what about OpenEars?
Free and allows commercial use.

A: Try using VocalKit. Based of CMU Pocketsphinx and for the iPhone.

A: www.ispeech.org ...
It works against a server ( I think ) but depends on what you want to do it may be usefull to you!.

A: I conclude that there is no free and open project till now for my case


text:
Q: Convergence of integral involving the remainder of a Taylor series Consider the convolution
\begin{align}
\int_\mathbb{R}K(\xi)h\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X-\epsilon\xi\right)d\xi
\end{align}
where $ \psi $ is some sufficiently smooth function, $ h $ is periodic in the first variable and $ K $ decays sufficiently to ensure that $ K(x)h\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X-\epsilon\xi\right) \in L^1(\mathbb{R})$ for all $ X $ and $ \epsilon $. Also assume that $ K(\xi),\xi K(\xi) \in L^1(\mathbb{R}) $, and $ h $ has continuous derivatives up to order 2 or 3 in both variables. A Taylor expansion of $ h $ in the second variable yields
\begin{align}
h\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X-\epsilon\xi\right) = h\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X\right) - \epsilon\xi h_2\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X\right) + \epsilon\xi R\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X-\epsilon\xi\right),
\end{align}
where $ h_2 $ denotes a derivative w.r.t the second variable, and the last term is the Peano form of the remainder due to Taylor's theorem. We also know that $ R \in \mathrm{o}(1) $ as $ \epsilon\xi \rightarrow 0 $. This means that $ R \rightarrow 0 $ pointwise as $ \epsilon \rightarrow 0 $. My question is: what is the smallest set of assumptions to ensure that
\begin{align}
\int_\mathbb{R}\xi K(\xi)R\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X-\epsilon\xi\right)d\xi \in \mathrm{o}(1)
\end{align}
as $ \epsilon \rightarrow 0 $. It's easy to prove that the other terms will converge when integrated, since $ h\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X\right) $ is periodic and continuous and can be dominated by a constant. Similarly for $ h_2$. This means $ \epsilon\xi K(\xi)R\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X-\epsilon\xi\right) \in L^1 $. Apart from making restrictions on $ K $ or assuming $ R $ takes a certain form, I haven't been able to construct a dominating function. The simplest thing I've been able to deduce is:
let $ P(X-\epsilon\xi) = R\left(\theta,X-\epsilon\xi\right) $, where $ \theta $ maximizes $ R $ for fixed $X,\xi,\epsilon$. If $ \xi K(\xi)P(X-\epsilon\xi) \in L^1 $ and $P(X-\epsilon\xi) $ is increasing for all $|\xi| > a $ for some constant $ a $, then clearly $ P(X-\epsilon\xi)$ is dominated by $P(X-\xi)$ for all $ \epsilon < 1 $ and $ |\xi|> a $. For $ |\xi| < a $, $ P $ is bounded due to its continuity.
I don't have much experience with regard to uniform integrability and sufficient conditions for bringing a limit inside an integral. Any advice would be very welcome.


text:
Q: How to rename file on SVN whilst keeping history? Having some trouble renaming a file in SVN whilst keeping the history.
Used this thread, but I'm pretty sure I just made a new file, and deleted the old one... (How to rename a file using svn?)
And following the comments, I did create a new file with the new file name I wanted.
touch newfilename
svn rm newfilename --force
svn mv oldfilename newfilename

Which gave me:
A    newfilename
D    oldfilename

Using svnX 0.9.13

A: Since you have tortoisesvn tag in your question, this is how to do it using TortoiseSVN 1.9.7:

*

*in your working copy folder right click on the file you want to rename and select "TortoiseSVN > Repo-browser"

*in the Repo-browser window that opens, right click on the file you want to rename and select "Copy to..."

*a dialog box appears asking you for the new file name (the file is shown with its full path), don't change the path, just change the file name and click OK.

*still in the Repo-browser window, right click on the old file and select "Delete"
Done, the file was renamed and it kept all its history.

*go back to your working copy folder, right click on the folder and select "TortoiseSVN > Check for Modification", then click "Check repository" button, right click on the renamed file and select "Update"

A: Rename in Subversion is implemented as a copy with history (to create the new file) plus a delete (deleting the original).
If you run svn status, you should see the status of newfilename as A  + which indicates that newfilename has been added, but with history coming along for the ride.
If you're seeing that, then you've done it right and you can commit your changes. I recommend committing at the directory level, don't commit the individual files - that way, your rename operation is captured within a single revision.

A: If you execute this then you can easily rename your SVN files keeping its history.
svn move oldfilename newfilename
svn status
D      oldfilename
A +    newfilename

If you see this then the file changes history is preserved.


text:
Q: Vorticity constant along a streamline In the case of a 2D incompressible flow  $\omega  = - \nabla^2 \psi$ where $\psi$ is the stream function.
From the vorticity equation of motion I am able to find the following:
$$
\frac{\mathrm{d}\omega}{\mathrm{d}t} = \frac{\partial\omega}{\partial t} + (u\cdot\nabla) \omega = 0
$$
Is this meant to show that in the case of steady flow $\nabla^2 \psi$ is constant on a streamline?
How does this show this? I am very confused.

A: Presumably, this is inviscid flow since the viscous terms are absent in your vorticity equation. Since the flow is two-dimensional, there is only one non-zero vorticity component $\omega$ aligned in the direction normal to the plane of flow. Hence, there is no vortex-stretching term $\bf{\omega} \cdot \nabla\mathbf{u}$.
In steady flow, the vorticity equation reduces to $\mathbf{u}\cdot \nabla \omega = 0$.
The gradient $\nabla \omega$ is always oriented in a direction normal to a level curve $\omega = \text{constant}.$ The condition $\mathbf{u} \cdot \nabla \omega = 0$ implies that the velocity at a point is tangential to such a curve. Hence, level curves of $\omega$ correspond to streamlines.
Velocity field is tangential to streamlines (level curves of streamfunction)
In two-dimensional, incompressible flow we can define a stream function $\psi$ by a line integral along any path $C$ joining $(0,0)$ to $(x,y)$
$$\psi(x,y) = \int_C \mathbf{u} \cdot \mathbf{n} dl = \int_C u \, dy - v \, dx.$$
Using the incompressiblity condition $\nabla \cdot \mathbf{u} =  \frac{\partial u}{\partial x} + \frac{\partial v}{\partial y} = 0$ and Green's theorem it follows that the line integral is independent of path and $\psi$ is a well-defined function which is related to the velocity field by
$$u  = \frac{\partial \psi}{\partial y}, \,\,\,\ v  = -\frac{\partial \psi}{\partial x}. $$
Hence,
$$\mathbb{u} \cdot \nabla \psi = u \frac{\partial \psi}{\partial x} + v \frac{\partial \psi}{\partial y}= u(-v) + v(u) = 0.$$


text:
Q: How to sort by two values with same comparator I have two values that cannot be passed as var args:
sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, { it.lastName })

How can i add sorting by second field? I mean it.lastName and it.firstName.
This is not duplicate as this is with using same comparator String.CASE_INSENSITIVE_ORDER


text:
Q: GDAX Websocket API - Level 2 timestamp accuracy I'm currently using the level2 orderbook channel via the GDAX WebSocket API. Quite recently a "time" field started appearing on the l2update JSON messages and this doesn't appear to be documented on the API reference pages. Some questions:

*

*What does this time field represent and is it reliable enough to use? Is it message sending time from GDAX?

*If it is sending time, I am occassionally seeing latencies of up to two minutes - is this expected?

Thanks!

A: I am playing with the L2 api's right now and have the same question. I'm seeing a range of timestamps from 4000ms delayed to -300ms (in the future).
The negative number makes me feel that the time can't be trusted. I attempted connecting from 2 different datacenters and from home and I can replicate both sides of the problem.

A: I've been using this field reliably for a couple of months assuming it is the time the order was received, and it was typically coming out as a pretty consistent 0.05 second lag in relation to my system time; however, in the last few days, it's been increasing - over 1 second yesterday and 2.02 seconds right now. I note (https://status.gdax.com/) maintenance was carried out on May 9th, but it was fine for me after that for a few days.
To answer the question more directly, no 2 minute latencies are not expected. I would check your system time is correct. Quick google brings up https://time.is/.


text:
Q: Failed to lookup view "home" in view directory using handlebars Hola estoy usando node con express y handlebars pero cuando intento renderizar la vista me aparece el error mencionado.

Error: Failed to lookup view "home" in views directory
  "/home/joaquin/workspace/nodejs/EasyRcu/views"    at
  EventEmitter.render
  (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/application.js:579:17)
  at ServerResponse.render
  (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/response.js:960:7)
  at index
  (/home/joaquin/workspace/nodejs/EasyRcu/controllers/home.js:15:17)
  at e
  (/home/joaquin/workspace/nodejs/EasyRcu/controllers/index.js:17:13)
  at Layer.handle [as handle_request]
  (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/router/layer.js:95:5)
  at next
  (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/router/route.js:131:13)
  at Route.dispatch
  (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/router/route.js:112:3)
  at Layer.handle [as handle_request]
  (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/router/layer.js:95:5)
  at
  /home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/router/index.js:277:22
  at Function.process_params
  (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/router/index.js:330:12)

This is my code:
app.use(express.static(__dirname + '/public'));
    app.engine('.hbs', exphbs({ defaultLayout: 'main', extname: '.hbs' }));
    app.set('views', path.join(__dirname, '/views'));
    app.set('view engine', '.hbs');

And the request Handler:
index: (req, res,next)=>{
    console.log("entre");
    var markup = react_render.renderToString(index());
    console.log(markup);
    res.render('home', {
        markup: markup,
        state : {}
    });
}

A: Estas cambiando la extensión con la que el view engine busca busca los ficheros en la carpeta de las vistas.
Si escribes algo como
res.render('home', .....

El view engine busca home.hbs en la carpeta de las vistas, en tu caso /views
path.join(__dirname, '/views')

Si tienes home.handlebars no es el mismo fichero, de ahí el error.


text:
Q: PyGI emulating set_attribute / appropriate signal to emit? I have an existing project that I'm trying to build a GUI around (using PyGI + Gtk3). There are some native objects that I need to extend slightly to make them renderable. I've boiled the problem down to the simplified code here:
# Simplified Equivalent Code

from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import GdkPixbuf

# Pre-existing, complex object
class Move(object):
    def __init__(self, color):
        self.color = color

# Pre-existing, complex object
class Block(object):
    def __init__(self,move=None,**kwds):
        self.move = move

# New object created to help render a Block
class BlockGui(Block):
    pixbufs = {
            'empty' : GdkPixbuf.Pixbuf.new_from_file('block_empty.png'),
            'red' : GdkPixbuf.Pixbuf.new_from_file('block_red.png'),
            'blue' : GdkPixbuf.Pixbuf.new_from_file('block_blue.png'),
          }

    def __setattr__(self, name, value):
        super(BlockGui, self).__setattr__(name, value)

        if name == 'move':
            print "Need to emit a signal here"

    def get_pixbuf(self):
        try:
            return BlockGui.pixbufs[self.move.color]
        except AttributeError:
            return BlockGui.pixbufs['empty']

class BlockRenderer(Gtk.CellRendererPixbuf):
    __gproperties__ = {
            'block' : (GObject.TYPE_PYOBJECT,
                'block to render',
                'the block object to be rendered',
                GObject.PARAM_READWRITE)
            }

    def __init__(self):
        GObject.GObject.__init__(self)
        self.block = None

    def do_set_property(self, prop, value):
        # What is a GParamBoxed? Should I be checking if prop == 'block' from it somehow?
        if isinstance(value, BlockGui):
            self.block = value
            self.set_property('pixbuf', self.block.get_pixbuf())

GObject.type_register(BlockRenderer)

def destroy(widget, data=None):
    Gtk.main_quit()

# Normally do not have access to this assignment
def on_clicked(widget, liststore, treeview):
    treeiter = liststore.get_iter(2)
    block = liststore.get_value(treeiter, 1)
    block.move = Move('red')

def main():
    # 3x5 so this demo window has some size
    fmt = [GObject.TYPE_PYOBJECT] * 3
    liststore = Gtk.ListStore(*fmt)
    for r in xrange(5):
        liststore.append([BlockGui() for x in xrange(3)])

    treeview = Gtk.TreeView(liststore)

    for c in xrange(3):
        col = Gtk.TreeViewColumn(str(c))
        treeview.append_column(col)
        cell = BlockRenderer()
        col.pack_start(cell, True)
        col.add_attribute(cell, 'block', c)

    button = Gtk.Button("Change Color!")
    button.connect('clicked', on_clicked, liststore, treeview)

    vbox = Gtk.VBox()
    vbox.add(treeview)
    vbox.add(button)

    window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
    window.connect('destroy', destroy)
    window.add(vbox)
    window.show_all()

    Gtk.main()

if __name__ == '__main__':
    main()

When the current code is run, clicking the button yields no immediate result, but running the mouse over the changed row will cause the center square to turn red (as the hover over the row triggers a refresh). Normally, when a 'proper' GObject has a set_attribute called, it will emit some signals to notify the widgets containing it to re-render.
I need to know which signal that emits, to whom it's emitted, and how to emulate that behavior.

A: If you know the widget that must be redrawn, then you can just call queue_draw(), queue_draw_region() or queue_draw_area() for that widget.  That will invalidate that window area and it will be redrawn. If you want more fine grained control, you might want to use Gtk.DrawingArea.
You might want to check the documentation for The GTK+ Drawing Model.


text:
Q: How do I give a php element a css class? Here is the base php item i would like to add the class to:
<?php echo $nav_sub; ?>

Here is the class that I would like to add to the PHP element:
class="nav nav-pills nav-stacked"

A: Welcome to stackoverflow.
Your question doesn't make sense because CSS classes are applied to a specific piece of HTML DOM. PHP is only outputting the pieces of HTML DOM and therefore you can't apply CSS directly to PHP.
A better question might be: "How do I modify the contents of a PHP variable that contain HTML to append a CSS class?"
(Or potentially, how do I apply a CSS class to a piece of HTML DOM using JavaScript.)
Let's say $nav_sub contained a string:
Navigation Item

and you wanted it to contain:
Navigation Item

You could make this modification several ways. One way might be to replace <div with <div + your classes.
Specifically,
$nav_sub = '
Navigation Item
';
echo str_replace('<div' , '<div class="nav nav-pills nav-stacked"' , $nav_sub);


text:
Q: Searching on conjunction of tags where one of the terms is a wildcard? I want to search for two tags simultaneously using the /questions/tagged/<tag list> search method, and allow one tag to be a wildcard. Is this possible?
For example when searching for Actionscript mocking questions with the query https://stackoverflow.com/questions/tagged/actionscript%20mock* seems to be resolved, per the page <title> and sidebar as:

Highest Voted 'actionscript mocking or mockito or mockups or mockup-tool or mocking-framework or mockrunner or mockolate or mockrepository or mockme or mockjax or mockery' Questions - Stack Overflow

which returns loads of irrelevant results.
Presumably the wildcard is being expanded before building the predicate tree which is resulting in this unexpected behaviour.
Are there any ways to get around this behaviour at present?

A: Searching for [actionscript] ( [mock*] ) (note the parentheses and the spaces!) does the trick. For a Meta SE example, this search gives all questions which have both review and any tag matching the wildcard [badge*].
The parentheses appear to corral all of the wildcard's "or" expansion, and then the default "and" search kicks in to find the intersection of the first tag and the parentheses' expression. The space between the open parenthesis and the open square bracket keeps the wildcard search from being interpreted as text. (The space between the closing bracket and parenthesis is because I like symmetry; it can safely be removed.)
This does end up using /search instead of /tagged, but it has exactly the effect you're after.

A: Searching for [actionscript] mock* seems to return any question with actionscript having the mock* as the search condition
https://stackoverflow.com/search?q=%5Bactionscript%5D+mock*


text:
Q: How to use 'group_by()' in R to make sure columns are of equal length?
*

*I have a data frame with with stock market data in 3 columns: 1-Date, 2-Price, 3-Symbol.

*The Symbol column is different stock tickers.

*I am trying to get the Price ratio of any given two or more of Symbols for any given time frame.

*But, not all Symbols have data going back as far as others, so...

*Can I use something like, group_by(Data) then drop any ungrouped rows?
Here, allTickerData is the the main data frame and I filter that by the users choice of what ticker to be the denominator of our ratio.
DenominatedTicker <- allTickerData %>% dplyr::filter(., symbol == input$DenomTickerChoice)

Then we make a new column in our main data frame, RatioPrice that gets every ticker's price divided by the users choice of denominator.
But, I am trying to do this ONLY where the dates match and would like to drop any ungrouped dates (dates will already be sorted).
UserTickerChoices is a list of tickers selected by the user.
activeTickerDataByDate <- allTickerData %>% dplyr::filter(., symbol == input$UserTickerChoices) %>% group_by(., date) %>% dplyr::mutate(., RatioPrice=(Price/DenominatedTicker$Price))

Thank you!
> dput(head(allCoinData))
structure(list(slug = c("bitcoin", "bitcoin", "bitcoin", "bitcoin",
"bitcoin", "bitcoin"), symbol = c("BTC", "BTC", "BTC", "BTC",
"BTC", "BTC"), name = c("Bitcoin", "Bitcoin", "Bitcoin", "Bitcoin",
"Bitcoin", "Bitcoin"), date = structure(c(17167, 17168, 17169,
17170, 17171, 17172), class = "Date"), ranknow = c(1, 1, 1, 1,
1, 1), open = c(963.66, 998.62, 1021.6, 1044.4, 1156.73, 1014.24
), high = c(1003.08, 1031.39, 1044.08, 1159.42, 1191.1, 1046.81
), low = c(958.7, 996.7, 1021.6, 1044.4, 910.42, 883.94), close = c(998.33,
1021.75, 1043.84, 1154.73, 1013.38, 902.2), volume = c(147775008,
222184992, 185168000, 344945984, 510199008, 351876000), market = c(16050407461,
16429024775, 16786368910, 18571869009, 16300254795, 14513695758
), close_ratio = c(0.892969806219017, 0.722110118189679, 0.989323843416365,
0.95922448269866, 0.366823428815733, 0.112113955915761), spread = c(44.38,
34.69, 22.48, 115.02, 280.68, 162.87)), row.names = c(NA, 6L), class = "data.frame")

A: It is easier to answer if you share a  reproducible example. You can try the below answer :
library(dplyr)

DenominatedTicker <- allTickerData %>% filter(symbol == input$DenomTickerChoice)
#Get common dates
common_dates <- Reduce(intersect,split(allTickerData$Date, allTickerData$symbol))

#Filter those common_dates and then calculate the ratio.
result <- allTickerData %>%
            filter(Date %in% common_dates) %>%
            mutate(RatioPrice= Price/DenominatedTicker$Price)

A: Here is another solution that uses pivot_wider. First, we generate some random data (as you didn't share any):
library(tidyverse)
library(lubridate)

set.seed(0)

allTickerData = sample(fruit, 5) %>%
  map(~tibble(Symbol = .x,
              Price = abs(cumsum(rnorm(str_length(.x)))),
              Date = seq(today() - str_length(.x), today() - 1, length.out = str_length(.x)))) %>%
  bind_rows()

Then, we can use pivot_wider to pivot the data into a form where each ticker has its own column, where we can use filter(across()) to remove rows that contain NA. Afterwards, we use pivot_longer to get the original data shape back:
allTickerData %>%
    pivot_wider(id_cols = c(Symbol, Date),
                names_from = Symbol,
                values_from = Price) %>%
    filter(across(-Date, ~!is.na(.x))) %>%
    pivot_longer(-Date, names_to = "Symbol", values_to = "Price")

You can then use mutate on this to get your RatioPrice.


text:
Q: Automatización compilación de Python 3 Tengo una duda complicada, necesito saber si alguno de ustedes sabe como poder trabajarla.
Lo que pasa es qué tengo una base de datos muy grande (planilla CSV), que tiene alrededor de 45 mil filas. Para esto programé un desarrollo que cuenta elementos repetidos en relación a fechas de estos, de esta forma, varios elementos repetidos se consideran como historias, donde una historia se acaba cuando ocurre un repetido después de 30 días (para esto hice un diccionario).
Cada día se agrega nueva información a la base de datos (nuevas filas al CSV), por lo que compilar todo la hace muy lento. Me gustaría correr el archivo completo una vez, y luego este se compile (el día siguiente) desde donde quedó compilado el día anterior, o sea considerando historias que se puedan seguir trabajando.
Mi duda es si en Python es posible tener un código con memoria donde se considere lo de ayer para trabajar hoy.
Gracias!!