Dashed label underline in QGIS

Question: Is it possible to create a dashed underline for labeling in QGIS? I have one capital city which for used underline for the name of this city. and now I need dashed underline to a name of the province, how to create dashed underline for the name of the cities in qgis?
Comment: According to https://gis.stackexchange.com/questions/158810/rule-based-labels-using-qgis (bottom comment) dashed underlines are no option in QGIS 2.x. Maybe QGIS 3 can help you out. Or you use the print composer and label each province manually.
Answer: Here is a workaround for 2.x.
Having a point shape-file with an attribute city you can label the cities like:
 "city"  || '\n' ||  rpad( '-', length("city") + 5,  '-')

BEST FIT - additional lpad (extend to the left) without addition of a distinct value:
"city"  || '\n' ||  rpad('-',length("city"),'-') ||  lpad('-',length ("city"),'-')

First argument is the city name, then follows a line break, then we us a hypen and extend (rpad and/or lpad) it with the length of the city names (length("city") and/or add a distinct value to stretch the concatenation of hyphens.

EDIT - Using other Unicode characters
You could also use Unicode symbols directly (see https://gis.stackexchange.com/a/90126). Using a fullwidth hyphen-minus from http://jkorpela.fi/dashes.html (lowermost entry in the first column of the table), the dashed line looks even better. Just copy/paste it in the Expression Dialog. I've shortened it a little bit (-2).
"city"  || '\n' ||  rpad('-',length("city")-2, '-')

Label lookalike with katakana-hiragana double hyphen:

Additionally you have to decrease the line height in the Labels > Formatting. So the dash line is closer to the city name. Also use Center as Alignment to center both lines.
Usage in the Layer Properties:

Result

I think you have to play around a little bit with the distinct value for stretching the concatenation of hyphens.
EDIT
If there is an attributes that distinguish if the city is a capital or not then you can use Rule-based labeling.
In my case I have an attribute table as follows:

Rule-based labeling in this case:

Result (cities which are not capitals have a normal underline (defined within in the label settings):
Answer: You can probably achieve it by using an SVG label background (Shape in the dialog) and constructing the SVG in a way that the end result appears as a dashed line.

Dashed label underline in QGIS


Student's t-test versus Wilcoxon signed-rank test

Question: Trying to understand when to use which test, am I correct when saying both these tests, test whether two samples could be taken from the same distribution, but the difference is that the student's t-test assumes that the distributions that are tested have a normal distribution (Gauss distribution), while the Wilcoxon signed-rank test accept any type of distribution?
Comment: Are you referring to the paired or the independent sample situation?
Answer: There are three t-tests:

One sample
Independent samples
Paired samples

Since Wilcoxon signed rank is about paired samples, I will assume you are comparing it to a paired sample t-test.
The paired sample t-test does not assume the distributions are normal, it assumes the differences are normal. Then it sees if the differences are different from 0 (usually; it is possible to change this); essentially. Wilcoxon, on the other hand, tests whether the mean ranks are different.
Neither one tests the rather general proposition that you state: "from the same population". For instance, suppose you have two samples, both from populations with mean = 10, but one with sd = 2, the other with sd = 100. Neither t nor Wilcoxon will show a difference:
set.seed(1234)
x1 <- rnorm(1000, 10, 2)  #Normal, mean = 10, sd = 2, N = 1000
x2 <- rnorm(1000, 10, 10) #Normal, mean = 10, sd = 1-0, N = 1000

t.test(x1, x2, paired = TRUE) #t = -0.32, df = 999, p = 0.53
wilcox.test(x1, x2, paired = TRUE) #V = 243625 p = 0.40

You could even have much more different distributions:
x3 <- runif(1000, 0, 20)
t.test(x1, x3, paired = TRUE) #t = 1.25, df = 999, p = 0.21
wilcox.test(x1, x3, paired = TRUE) #V = 242525 p = 0.40

But if you do plot any pair of variables, you will see they are very different. E.g.
boxplot(x1, x2)
qqplot(x1,x2)
abline(a = 0, b = 1)


Formation of ἔλδωρ, a wish

Question: Beekes says that ἔλδωρ/ἐέλδωρ comes from ἐϝέλδομαι, without commenting on the suffix. Is this a case where the agent-noun suffix -τωρ (a.k.a. -τήρ) was applied, but then ἔλδτωρ got automatically simplified for phonetic reasons? On the model of θηράτωρ, I would have expected something more like ἔλδάτωρ. Beekes says the PIE root is h1ueld, whereas other people seem to think it's welh1, which would make it cognate with English 'will.' On the latter hypothesis, I'm not sure why ἐέλδομαι would have the δ.
Comment: The etymology of this word seems to be very unclear -- note that Beekes says "no cognates outside Greek", which makes positing a PIE form rather pointless. But it pretty clearly doesn't contain the agent suffix, which wouldn't fit either formally or semantically.
Comment: @TKR: Is the semantic fit really not good enough if we think of a wish as "that which causes us to wish (for it)?" I suppose there could also be some hypothetical form such as ἐλδήρ, which would then morph into ἔλδωρ by whatever process caused ἀνήρ -> εὐνωρ.
Comment: These  -τωρ / -τηρ nouns always refer to human agents (at least I can't think of any exception), and their semantics aren't causative, so the meaning in that case would have to be "person who desires".
Answer: The etymology of ἔλδωρ/ἐέλδωρ is difficult, but it almost certainly doesn't contain the agent suffix -τωρ.
Beekes and LIV both reconstruct a *h₁u̯eld- which would have no cognates outside Greek (which makes positing a PIE root rather moot). Chantraine connects it with Latin velle, from PIE *u̯el- or *u̯elh₁-; in this case the -d- would be a "root extension" (these are poorly understood, but were definitely a thing in PIE; the semantically close ἐλπίς may be from the same root with a different extension). In either case it seems hard to account for the existence of both variants, in e- and ee-.
But whatever root it's from, the word is unlikely to contain the agent suffix, for two reasons:

Phonologically, a form like (w)eld-tōr would almost certainly not give ἔλδωρ. The regular reflex of -dt- in Greek is -στ-. It's true that no Greek word seems to contain the sequence -λστ-, so arguably we don't know what the reflex of -ldt- would be. But a simplification to -ld- seems unlikely -- if anything, you'd expect -lt-.
Semantically, the -tōr suffix forms human agent nouns, "person who does X", not abstract nouns. So if it contained this suffix, ἔλδωρ would have to mean "person who desires".

Where the -ωρ does come from is unclear. There are a handful of other Greek words which seem to contain the same suffix, including ὕδωρ and the rarer τέκμωρ and πέλωρ. But I don't think it's clear what the source of that suffix is or whether it's really the same suffix in all these cases.
(BTW, the reason θηράτωρ has an alpha is that it's formed from the verb θηράω -- the vowel is from the verb stem.)

Formation of ἔλδωρ, a wish


Why do we believe space and time are intertwined? What is the idea behind it? And how do we arrive at this conclusion?

Question: What led us to believe that space and time are actually interconnected? How did the idea actually originate? why do we believe that this concept is true?
Comment: What aspect of special relativity would you like to focus on?
Answer: Relativity tells us that when under high enough gravitational fields or high enough speeds, the dynamic nature of time arises. That means that for an observer, you could be in some place in space (that seems normal) but also in some place in time (which is the counterintuitive part).
Therefore, you would have coordinates not only for space, but also in time (search for "spacetime diagram").
Having another coordinate means having another dimension, so we consider time to be another dimension, all of that is motivated by it's dynamic nature.
On the other hand, Newton considered time to be absolute for everybody, that means that everybody would have the same coordinate in time, thus, it makes no sense to consider it another dimension.


How to use getopt in bash command line with only long options?

Question: There is a getopt command in bash command line. getopt can used with short options (such as getopt -o axby "$@"), and can be used with both short and long options (such as getopt -o axby -l long-key -- "$@"), but now I need only long options (i.e. short options don't exist at all), however the command getopt -l long-key -- "$@" doesn't parse --long-key option correctly. So how can I use getopt command with only long options? Or is it impossible or is it just a bug of the getopt command?
Comment: You tag for the internal `getopts`, but you are using the `/usr/bin/getopt` command.
Comment: @Anthon  Sorry, I have used the wrong tag, but I haven't got enough reputations to add another tag, which needs 300 reputations. However, I have deleted the wrong tag just now.
Answer: getopt is perfectly fine with having no short options. But you need to tell it that you have no short options. It's a quirk in the syntax — from the manual:

If no -o or --options option is  found  in the first part, the first parameter of the second part is used as the short options string.

That's what's happening in your test: getopt -l long-key -- --long-key foo treats --long-key as the list of options -egklnoy and foo as the sole argument. Use
getopt -o '' -l long-key -- "$@"

e.g.
$ getopt -l long-key -o '' -- --long-key foo
 --long-key -- 'foo'
$ getopt -l long-key -o '' -- --long-key --not-recognized -n foo
getopt: unrecognized option '--not-recognized'
getopt: invalid option -- 'n'
 --long-key -- 'foo'

Comment: Did the OP's mixing of `getopts` and `getopt` infect to your answer? You start with commenting `getopts` then only mention `getopt`.
Comment: @Anthon All my answer is about the `getopt` program from GNU coreutils which is what the question is about. I've fixed the text that said `getopts`. Thanks. `getopts` doesn't even do long options, so none of this would apply to `getopts`.
Comment: The OP originally had the `getopts` tag. I did not want to change your answer, because you normally know much better than I what you are writing about :-)
Comment: I lost almost an hour trying to figure this out. You just saved me a few vain coffee sips. Thanks... lets put this coffee to a better use now. ☕
Comment: Why do you put the symbol `--` after `-o ' '`
Answer: Dunno about getopt but the getopts builtin can be used to handle only long options like this:
while getopts :-: o
do  case "$o$OPTARG" in
(-longopt1) process ;;
(-longopt2) process ;;
esac; done

Of course, as is, that doesn't work if the long-options are supposed to have arguments. It can be done, though, but, as I've learned working on this. While I initially included it here I realized that for long-options it doesn't have much utility. In this case it was only shortening my case (match) fields by a single, predictable character. Now, what I know, is that it is excellent for short options - it is most useful when it is looping over a string of unknown length and selecting single bytes according to its option-string. But when the option is the arg, there's not a lot you're doing with a for var do case $var in combination that it could do. It is better, I think, to keep it simple.
I suspect the same is true of getopt but I don't know enough about it to say with any certainty. Given the following arg array, I will demonstrate my own little arg parser - which depends primarily on the evalation/assignment relationship I've come to appreciate for alias and $((shell=math)).
set -- this is ignored by default --lopt1 -s 'some '\''
args' here --ignored   and these are ignored \
--alsoignored andthis --lopt2 'and

some "`more' --lopt1 and just a few more

That's the arg string I'll be working with. Now:
aopts() { env - sh -s -- "$@"
} <<OPTCASE 3<<\OPTSCRIPT
acase() case "\$a" in $(fmt='
        (%s) f=%s; aset "?$(($f)):";;\n'
        for a do case "$a" in (--) break;;
        (--*[!_[:alnum:]]*) continue;;
        (--*) printf "$fmt" "$a" "${a#--}";;
        esac;done;printf "$fmt" '--*' ignored)
        (*) aset "" "\$a";;esac
shift "$((SHIFT$$))"; f=ignored; exec <&3
OPTCASE
aset()  {  alias "$f=$(($f${1:-=$(($f))+}1))"
        [ -n "${2+?}" ] && alias "${f}_$(($f))=$2"; }
for a do acase; done; alias
#END
OPTSCRIPT

That processes the arg array in one of two different ways depending on whether you hand it one or two sets of arguments separated by the -- delimiter. In both cases it applies to sequences of processing to the arg array.
If you call it like:
: $((SHIFT$$=3)); aopts --lopt1 --lopt2 -- "$@"

Its first order of business will be to write its acase() function to look like:
acase() case "$a" in
    (--lopt1) f=lopt1; aset "?$(($f)):";;
    (--lopt2) f=lopt2; aset "?$(($f)):";;
    (--*) f=ignored; aset "?$(($f)):";;
    (*) aset "" "$a";;esac

And next to shift 3. The command-substitution in the acase() function definition is evaluated when the calling shell builds the function's input here-documents, but acase() is never called or defined in the calling shell. It is called in the subshell, though, of course, and so this way you can dynamically specify the options of interest on the command line.
If you hand it an un-delimited array it simply populates acase() with matches for all arguments beginning with the string --.
The function does practically all of its processing in the subshell - iteratively saving each of the arg's values to aliases assigned with associative names. When it is through it prints out every value it saved with alias - which is POSIX-specified to print all saved values quoted in such a way that their values can be reinput to the shell. So when I do...
aopts --lopt1 --lopt2 -- "$@"

Its output looks like this:
...ignored...
lopt1='8'
lopt1_1='-s'
lopt1_2='some '\'' args'
lopt1_3='here'
lopt1_4='and'
lopt1_5='just'
lopt1_6='a'
lopt1_7='few'
lopt1_8='more'
lopt2='1'
lopt2_1='and

some "`more'

As it walks through the arg list it checks against the case block for a match. If it finds a match there it throws a flag - f=optname. Until it once again finds a valid option it will add each subsequent arg to an array it builds based on the current flag. If the same option is specified multiple times the results compound and do not override. Anything not in case - or any arguments following ignored options - are assigned to an ignored array.
The output is shell-safed for shell-input automatically by the shell, and so:
eval "$(: $((SHIFT$$=3));aopts --lopt1 --lopt2 -- "$@")"

...should be perfectly safe. If it for any reason is not safe, then you should probably file a bug report with your shell maintainer.
It assigns two kinds of alias values for each match. First, it sets a flag - this occurs whether or not an option precedes non-matching arguments. So any occurrence of --flag in the arg list will trigger flag=1. This does not compound - --flag --flag --flag just gets flag=1. This value does increment though - for any arguments that might follow it. It can be used as an index key. After doing the eval above I can do:
printf %s\\n "$lopt1" "$lopt2"

...to get...
8
1

And so:
for o in lopt1 lopt2
do list= i=0; echo "$o = $(($o))"
        while [ "$((i=$i+1))" -le "$(($o))" ]
        do list="$list $o $i \"\${${o}_$i}\" "
done; eval "printf '%s[%02d] = %s\n' $list";  done

OUTPUT
lopt1 = 8
lopt1[01] = -s
lopt1[02] = some ' args
lopt1[03] = here
lopt1[04] = and
lopt1[05] = just
lopt1[06] = a
lopt1[07] = few
lopt1[08] = more
lopt2 = 1
lopt2[01] = and

some "`more

And to args which did not match I would substitute ignored in the above for ... in field to get:
ignored = 10
ignored[01] = this
ignored[02] = is
ignored[03] = ignored
ignored[04] = by
ignored[05] = default
ignored[06] = and
ignored[07] = these
ignored[08] = are
ignored[09] = ignored
ignored[10] = andthis


Is it normal to keep a reference to other viewcontrollers?

Question: Is it worth storing references to other viewcontrollers that the current viewcontroller opens? If I have one viewcontroller displaying a screen with a button that opens a popoverviewcontroller, should I then keep a reference to it and then check afterwards to see if the variable is nil to only make the popoverviewcontroller once? Or is it unnecessary? It lead to many extra variables in some cases, and additional code, but it would be great if someone could say if this is unnecessary or not.
if (self.popoverVC == nil) {
    UIPopoverController *popVC = [[UIPopoverController alloc] initWithContentViewController:self.configureTest];
    popVC.popoverContentSize = CGSizeMake(320.0, 460.0);
    popVC.delegate = self;

    self.popoverVC = popVC;
    [popVC release];
}

Answer: Storing references to other controllers is fine with me and I do it whenever it seems reasonable to me. Think of the delegate pattern as a way to model the interaction between your controllers.
There are alternatives, though.
In you specific case, instead of storing the reference to the controller, you could set a flag (but I don't know if this makes sense for your specific workflow) specifying that the button was pressed.
Not applicable in your case but possibly useful in general is accessing the "parent" hierarchy of UIViewControllers. This is not explicitly maintained by UIKit, so either you set the parentViewController property or you can go from one controller to its parent navigating the UIResponder hierarchy. This is not applicable to your case, it seems to me, because communication would be initiated by the child controller (in your case you are interested in the opposite). Anyway, google for it, if you are interested.
Another option you have is using notifications: one controller can register for notifications, another can observe it.
  [[NSNotificationCenter defaultCenter] postNotificationName:@"notifName" object:self];

 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reactToNotif:) name:@"notifName" object:nil];

This is a bit more expensive than a function call, but it requires no ivar and no coupling between controllers.
Answer: That's perfectly sensible, especially if you want popVC to maintain its state between appearances.
It would be wise to release inactive vc's when you get a memory warning.
Answer: The reason for keeping a reference to UIPopoverController (btw it's not a subclass of UIViewController, it's a subclass of NSObject) is a slightly different one than for keeping a reference to a UIViewController.
When you present a UIPopoverController it is not automatically retained. So you have to retain it yourself.
Compared to UIViewController that are automatically retained when you present (or push) them.
There were tricks that just retained the controller without keeping a reference and released it in the delegate method that informed you that the popover was dismissed.
For me, those tricks felt always a little bit dirty. For example you didn't have the option to manually dismiss the popover.

Since ARC is publicly documented on the LLVM page I can tell you that those tricks stop to work if you use ARC. You have to keep a reference otherwise the compiler will release it immediately after you have left the method that presents the popover.


HAS-A, IS-A terminology in object oriented language

Question: I was just reading through the book and it had the terms, "HAS-A" and "IS-A" in it. Anyone know what they mean specifically? Tried searching in the book, but the book is 600 pages long.
Comment: "Is-a" it's reuse of code by inheritance, "has-a" - by delegation.
Answer: This is object-oriented programming and UML terminology, not Java-specific. There are actually three cases you should be aware of:

A House is a Building (inheritance);
A House has a Room (composition);
A House has an occupant (aggregation).

The difference between (2) and (3) is subtle yet important to differentiate. Together they are  forms of association. What's the difference? Composition implies the child object cannot live out of the context of the parent (destroy the house and rooms disappear) whereas aggregation implies the child can exist on its own (destroy the house and the occupant goes elsewhere).
Comment: 4. A House **uses an** internet provider (association).
Comment: This is not right. Composition DOES NOT imply dependence. A car *has an* engine, but if the car gets wrecked you can pluck out the engine and use it somewhere else. Happens all the time.
Comment: I think there's a 'missing' relationship - 'collaborates with.'  That seems to line up relatively well with your 3rd definition.  The primary difference that I see between definitions 2 and 3 is one of ownership.
Comment: A Point has an x & y coordinate. That's a has-a relation that is composition in your terms. But now if I change the implementation of the Point class to be based on r,theta then the x/y still exist as methods but now they involve computation rather than simply returning a data member. Is there a generalized concept for this sort of access?
Answer: A Car has-a Wheel.
A Sparrow is-a Bird.
Academically, the terms are used to decide between composition and inheritance.
Comment: @BurakKarakuş: Then it may be wrong. Isa/Hasa is a question you ask yourself to decide whether inheritance is the right answer. Maybe your Door should `have a` Home, not `be a` Home.
Comment: Do they have to have a real is-a relationship? I mean I have a Doors class which extends Home class, but a Door is not a Home practically, but it extends the Home class programmatically.
Answer: Has-a means that the Class in question 'has a' field of a type.
Is-a means that the Class extends from a superclass or implements an interface.  The instanceof operator would return true if tested against a class in the this case.
Answer: The names pretty much imply all.
An IS-A class can be thought of as specialized reference to an instance of another class that inherits all its attributes.
If a class called Vehicle exists. Then any type of vehicle may inherit the attributes of this super-class. For example Police Car will inherit all the attributes of Vehicle because it is a specialization of the latter.

On the other hand, an HAS-A class has a reference to another class or an instance of another class. In other words, it shares an association with another class. There are two types of HAS-A classes, aggregation meaning the class can exist independently, and composition, meaning the class can only exist along side the one it shares an association with.
It is important to know when to classify an object as a composition class or simply as an attribute of another class.
Taking the Vehicle Class again, a Driver class would be considered an aggregation because the Driver class can exist as an independent entity even if the Vehicle class ceases to exist.
Whereas an Engine class cannot exist if a Vehicle class is non-existent, because the Engine cannot exist outside the scope of the Vehicle.
Answer: "IS A" : Establishes relation between related objects. You can use inheritance to establish the relation.
"HAS A": Defines a capability for possibly unrelated objects. You can use interface to define the capability.
Example:
Dog IS A Animal. It HAS A capability to Learn.
Man IS Not A Animal. He HAS A capability to Learn,Think,Climb and Apply.
Answer: This isn't java specific, it's OO specific.
IS-A means you can have a class that "is a" something. Like a student "IS-A" person. This is used to describe one object being a subclass of another.
Sometimes there isn't a IS-A relationship between two classes, but a "HAS-A" is more appropriate. Example, a chair "HAS-A" leg. or several. this is called aggregation, as opposed to inheritance.
I wont go into the details of when to use each, because it depends on how the classes are being used and even if that is known there is so much to consider, a new question for a specific case would be more appropriate.
Comment: And yet even things like 'Student IS-A person' tend to be very problematic, for instance in cases when a Student happens to later become a Professor.  I generally prefer not to attack OO problems based upon the structure of things, but rather on their behaviors and how they transform data.  I almost never use inheritance for that kind of structural work, only for values (a Name is a type of String), or for reusing template code.
Answer: Is a = Special kind of e.g. Car is special kind of Vehicle.
Has a = It physically has something, e.g Car has an engine.
Answer: as cletus points out, is-a is different. but be careful with has-a. this can mean composition (lifetime responsbility), aggregation (part-of something), or simply uses-a (has a reference to, knows how to build one or find one). the latter is just an association.
Comment: For mutable entities, 'uses-a' is probably the most important relationship, and the one that gets the least thought.
Answer: IS-A, HAS-A etc. are not really very OO. Instead, Liskov substitution principle is OO.
Uncle Bob sheds some light on the history of IS-A at http://www.hanselminutes.com/default.aspx?showID=163

Robert C. Martin: The word "ISA" crept into our vocabulary and by the way that's one word ISA, it crept into our vocabulary through a circuitous route and became very important in object oriented circles, but it didn't start out that way. It crept in the 80's through the AI crowd who had created these wonderful knowledge nets, you might remember this, all the hype about Artificial Intelligence in the late 80's, early 90's, and then created these structures that would walk knowledge nets these inference engines, and the relationships between the entities and the knowledge nets with things like, is like a, tastes like a, smells like a ISA, all of these –A relationships is a, like a, has a and when the AI crowd lost it's funding, and all those funding drives, they kind of looked over and said, "Oh, there's this other stuff, it's kind of cool. Look, there's these relationships like has on and is on, it's real similar, we ought to just move in." And they kind of did and the vocabulary transitioned over. That's interesting, it's also a little unfortunate because inheritance is not ISA. Inheritance, if you look at it with a very jaded eye, inheritance is the declaration of methods and variables in a subscope and it has nothing to do with ISA whatever, and the notion of ISA can be very confounding. Simple example, an integer is a real number and a real number is a complex number. You could draw that in your UML, it'd very simple with all the inheritance there and so forth, but think about trying to compile it. An integer we would hope would be 16 or maybe 64 bits but if it were to derive from the real number, a real number has two integers in it, a mantissa and a characteristics, the exponent and they used, they implied binary points inside them to make these floating-point number. The floating-point number, the real number, derives from complex but the complex has two real numbers in it, the imaginary and the real part. If you were to think about writing that in C++ or in Java, you would write a structure that could not be compiled because it has infinite thought. Makes perfect sense in English makes no sense at all in software.
Answer: If you develop a Collection Class called "School". You would have "teachers" and "students" in the school. You develop a "person" class and both "student" and "teacher" would inherit from the "Person" class since both are --"is a" person. Both the Student and Teacher each have a birthday. You would create a "Date Class" since both the teacher and student "have" or "has a" birthday inside the "Person Class". This is "containership"
In summary "is a person" uses inheritance
"has a" uses containership


Matching a packet in OVS

Question: I'm new to OVS and I'm working on an OVS project, and i read a lot of documents about it but i didn't find anything that can make things clear to me about matching a packet and in userspace and datapath and if there is a match then what the ovs do ?
Thank you.
Comment: Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
Answer: Things happens in kernel module(datapath) are very fast compared to userspace.
First packet hits the kernel module, at very first time there will be no cache. It will send the packet to userspace, then the packet is routed. In this process, the kernel module make hash cache of the header of packet.
So, the subsequent packet hits the kernel module, then OVS calculate the hash for the header of the subsequent packet and checks whether that hash already present or not. If it is there, it will route or send it to userspace. Check this video and PPT

Thanks!
Answer: Packets received into OVS hit the datapath module first. If there is an entry in the flow cache, corresponding action is applied on the packet. If there is no entry, an "upcall" happens and the packet is sent to the user space over netlink protocol via the dpif interface. Actually there are queues present to buffer upcalls to the userspace where the handling is done.
Thanks.

Matching a packet in OVS


Automatic updates on OS X Leopard

Question: Is it possible to set OS X Leopard to update my system automatically at a specific time, just like Windows does? Right now the Updater randomly pops up when there are updates and I have to manually 'approve' them for download.
Answer: You can set up a cron job to do this. Let me find the command to run.
Look up the command softwareupdate and schedule a cron job to run it.
http://www.thexlab.com/faqs/maintscripts.html -- Info on cron jobs.
Comment: What is the exact command I should use? I am not all the familiar with
cron
Answer: As root you can do:
crontab -e

Add this to install updates every Monday at 5PM:
# m  h  dom mon dow   command
  0 17   *   *   1   /usr/sbin/softwareupdate -i -a  >> /dev/null 2>&1

Answer: If you go to System Preferences -> Software Update you can schedule how often to run. By default it will do an auto-update check once a week.

Automatic updates on OS X Leopard


Information about independent variables in poisson regression

Question: Can independent variables in Poisson model, Negative binomial model and Hurdles model be categorical ?
Answer: Yes, they can be categorical ... as in all linear and generalized linear models. In fact, you can continue generalizing/extending the family of regression models, and it will still be true. As long as your model uses a matrix of predictor variables, all the coding trick you have learnt for usual linear regression can be applied. You can represent categorical variables via dummys (also known as one-hot encoding), use polynomials, splines, and so on.
This is the beauty of generalizing regression models, all the tricks you have learnt in the simplest setting can still be applied.  You can find many examples in this posts.
Answer: Yes it can and you can encode it using an indicator variable. Basically you have a variable that is 1 when the data point is in a certain category and 0 if it is not. Wikipedia provides a nice explanation and example:
https://en.wikipedia.org/wiki/Dummy_variable_(statistics)
For a more specific example/elaboration please see here:
https://newonlinecourses.science.psu.edu/stat504/node/168/
If your variables are all categorical then the convention is to call this a log-linear model: https://newonlinecourses.science.psu.edu/stat504/node/117/


Is loving someone essentially selfish?

Question: Isn't loving someone ultimately selfish simply because you take pleasure from that relationship? Is there any kind of relationship in the world in which one does not expect to get pleasure when they invest emotion, love, time, etc? I did not mean that as rhetoric, it is an actual follow up question. This is in slight connection with Ayn Rand's view. Does selfless love actually exist?
Comment: A thought-experiment: would you enjoy a relationship in the same way if you knew the other person didn't enjoy it at all, was just maintaining a relationship with you out of obligation, but was exceedingly good at acting the way they might act if they were with someone they *did* enjoy being around? If the mere knowledge that they were putting on an act and didn't really enjoy it would sour the relationship for you, I think that suggests that your own enjoyment of the relationship can't be called purely selfish, it depends on some sense of a feedback loop where you each make the other happier.
Comment: Everything we are doing is selfish because, after all, we are doing it, so we "like" it enough for that. Using "selfish" this way makes the word vacuous, and is not how it is conventionally used.
Comment: Not if love is defined as making sacrifices for others.
Comment: Agree with @Conifold - outside of compelled acts, even seemingly selfless acts are in some way done for yourself. If I take a bullet for a loved one, it's because I fulfill my own moral code by doing so, which I must prefer to not taking the bullet - otherwise, I wouldn't have done it. If an act helps someone else and harms myself, there seemingly must be an internal calculus that makes the action "worth it" to make up the difference.
Comment: Research shows that having children lowers people's lifetime happiness. (Shhh! Don't let *that* get out)
Answer: John Piper tells this analogy about love and satisfaction in relation to God, but I think the principle applies to any human relationship:

I buy — because we're in our 50th year of marriage now, okay, even though it's 49th — and I hold this bundle of roses. They cost $200, right, give or take. I hold this huge bundle of roses behind my back and instead of walking in my front door, I ring the doorbell, which is unusual. She comes to the door and looks puzzled, and I say, "Happy anniversary, Noël."
She says, "Oh, Johnny. They're beautiful. Why did you go to such an expense?" Suppose I said, "It's my duty. I read it in a book. This is what husbands do." What's wrong with that answer? You're shaking your head. That's right. You should be shaking your head. Okay, I'll show you what's wrong with the answer.
We'll just rewind. Ding-dong. "Happy anniversary, Noël." "Oh, Johnny. They're beautiful. Why did you go to such an expense?" "Well, I couldn't help myself. In fact, I've got a plan for this evening. I want you to go put on something nice because we're going out. Because there's nothing I'd rather do than spend the evening with you. It would make me very happy."
Do you think that at that moment, she would say, "It would make you happy? You're always thinking about what makes you happy. What about me, your wife?" Do you think she'd say that when I said, "This evening spent with you, as an all-satisfying person in my life tonight, would make me happy." Do you think she'd say, "All you ever think about is what makes you happy"?
Why? Because she is glorified when I'm satisfied in her. You know this. You know this in your experience. What you find is she or he in whom you find pleasure makes them your treasure. That's what they feel. I feel treasured right now because you are finding your joy in me.

Love isn't selfish, but neither does the one who loves get no benefit out of it. It's not a zero-sum game, it's win-win. The one who loves and the one who is loved both have their lives enriched: the one who is loved by being honoured, praised, and treasured etc, and the one who loves by being satisfied in the beloved. The stronger the love, the more this is true, the more the lover lives a satisfied life, and the more the beloved is honoured, treasured, and cherished.
Comment: Yes! Non-zero sum! "*Shared sorrow is half sorrow. Shared joy is twice joy.*"
Answer: Any action can be described as 'selfish' if that just means that one derives pleasure or satisfaction from it or if one argues in a closed circle of motivation that one must have derived (or expected to derive) pleasure or satisfaction from it else why would one do it? The key point is whether (intentional) benefit to another, without any necessary (non-accidental) benefit to onself, is intrinsic to one's motivation.
If I love X and, because X is ill I nurse and tend X, just because X is my friend, then this is an act of love. I derive no benefit from this action, or if I do I not do it for the sake of the benefit. It is hard to see where pleasure or satisfaction come in if looking after my friend is an extreme inconvenience and in the event, despite all my endeavours, my friend dies.
The question's approach to selfishness was adequately dealt with by the 18th-century moral philosopher, Bishop Joseph Butler, Sermons on Human Nature, XI, in his critique of psychological egoism.
References
J. Butler, Five Sermons, ed. Stephen Darwall (Indianapolis: Hackett, 1983). The edition contains the Preface, Sermons I - III, XI and XII.
Richard Henson, 'Butler on Selfishness and Self-Love', Philosophy and Phenomenological Research, 49, No. 1 (September 1988).
Comment: Yes. I like the definition of Love from the catechism: "To will the good of another". Pretty comprehensive.
Answer: Since you mention that this question is in connection to Ayn Rand, she most certainly did not think that something is selfish merely because you take pleasure from it.  Indeed, Rand went to great pains to argue that rational selfishness may require you to eschew situations where you gain some immediate or even extensive pleasure at the expense of long-term flourishing.  She referred to the ethics of following your pleasure as "whim worshipping" and she differentiated her own ethics from this.  Rand argued that rational selfishness requires you to make decisions for your own long-term flourishing, and this would lead to long-term pleasure, contentment, happiness, etc.  While selfishness should be expected to be correlated with long-term pleasure, the latter is not definitive of any given situation.
Rand also rejected the notion that merely because behaviour is motivated, that it is selfish (and she therefore rejected the argument that every action is definitionally selfish because you chose to do it).  She viewed people as having the free will to follow whichever ethical principle they so adopted, and she argued in favour of the ethics of egoism (rational selfishness) as the correct approach to adopt.  She was well aware that people could perform their actions and lives according to her preferred ethics or according to a contrary ethics.  Thus, she would not think that a person must be selfish to be in a relationship (though she would certainly advocate that they should be), nor that the person is selfish if they gain pleasure from the relationship.  Objectivists sometimes encapsulate these things by saying "It is hard to be selfish".
Answer: The question is interesting and is a matter of debate : https://plato.stanford.edu/entries/love/#LoveUnio

Suppose A loves B .
It means that A wants B's good for the sake of B, not for A's sake. Love implies true benevolence. (Aquinas)
It therefore means that A takes pleasure/ finds joy  in B's happiness (as if it were A's own happiness). (Leibniz)
It consequently means that A finds his own pleasure in the very fact of forgetting himself.

So, love, though not being incompatible with self-love, is
  incompatible with selfish self-love. (On the distinction betweeen
  good and bad self-love , Aristotle, Nic. Ethics.)

As says La Rochefoucauld in  Moral Maxims (this author being known for claiming that all our actions and apparent moral "virtues" are are rooted in self-interest):

"We can love nothing but what agrees with us, and we can only follow
  our taste or our pleasure when we prefer our friends to ourselves;
  nevertheless it is only by that preference that friendship can be true
  and perfect."

So love is the pleasure we have in preferring the Others to ourselves.
If one wants to express this paradoxically, one can say:

love is the selfish pleasure of overcoming one's selfishness.
Comment: Suppose someone offered A a drug so that harming B would cause as much pleasure as not harming B.  Do you think A would take it?  This shows that the pleasure is the side effect and not the true purpose.
Comment: But if A loves B, A takes pleasure from the relationship they share and so one can assume that since any harm done to B will affect the relationship, A wants B's good. What makes you say that A wants B's good for B's sake?
Comment: Suppose someone tells you " I hope you will recover from this disease, because playing tennis with you is good for me and I can't play tennis as long as you are ill". Would you consider that this person " loves" you in any way ( although, true, she actually desires you to recover)? This is a counterexample aiming at showing that  A cannot love B without desiring B's good for B's sake. In other words, *benevolence* is arguably a defining feature of love. ( Traditionnaly, this is how love is defined).
Answer: Is there any kind of relationship in the world in which one does not expect to get pleasure when they invest emotion, love, time, etc? ..its called marriage https://www.youtube.com/watch?v=bcYppAs6ZdI
This is a difficult question to answer with a lot to unpack. Their are various forms of "Love", which makes love more of a situational problem rather than something we can generally address. Understanding the different forms of love can teach us how to better understand how/why people act the way they do. here's a link to different forms of love:
https://plato.stanford.edu/entries/love/
..Philosophers are going to define "selfish acts" differently than what most people colloquially mean when they describe selfish acts. As Conifold stated in the comments, Everything we are doing is selfish because, after all, we are doing it, so we "like" it enough for that.  ..You mentioned Is there any kind of relationship in the world in which one does not expect to get pleasure when they invest emotion, love, time, etc? and I would follow up by asking, is there anything which we should expect to get pleasure? ..You might get a completely different response from a psychologist or sociologist, you should continue to pursue this question further.
--
"It started with Sartre not wanting to commit to one girlfriend, but grew into a whole philosophy. He would say to his girlfriends: freedom is the most beautiful gift we can give one another. They all went along with it for a little while, but gave up on him eventually. Then when he met Simone de Beauvoir, she embraced it. But the thing was, it wasn't just about the freedom to have sex with other people, because they thought that would be a cheap and meaningless form of freedom. They wanted to be braver and give each other the freedom to fall in love with other people... ...Sartre didn't really like sex anyway: he preferred croissants. Some people have suggested that's why Beauvoir went along with it, because she had desires that Sartre couldn't fulfill"
Comment: Expecting pleasure from a good relationship, A is going to conduct B's marriage. B is A's son.
Answer: You can also turn the question around. Is loving someone truly altruisic in Nature? Will the loved one experience pleaure or whatever good feeling from my actions? If so, then it is altruistic. So not selfish.
Are genes selfish (as Dakins claims in the selfish gene). No. Because they offer other genes a base for existence. Also the carriers of the genes are not selfish if they love the other one. Together they have children that spring from love. Just as animmals or whatever living being.
You can say that every action is basically selfish or altruistic. But this robs them from meaning. Why speak about selfish action if all actions are already selfish. They derive their meaning from the other. Without selfishness no altruism and vice-versa. Without the both no love. Taking the bullet for someone might be selfish but it was not dine the other would be dead. Isn't that purely altruistic?
Comment: Yes, it is important to bring a wider perspective to these questions, and avoid "the Tyranny of Concepts" that often arises.
Answer: An psychological egoist would claim that if a person takes an action to build or maintain a loving relationship, then that person must benefit more from the relationship than it costs them to preform that act.
Consider this hypothetical:

Alice and Ben are in a romantic relationship. Alice frequently takes
actions with the intention that they cause Ben happiness, such as
cooking all of Ben's meals. Ben rarely takes actions with the
intention that they cause Alice happiness. In fact, many of Ben's
actions cause Alice physical and mental harm. Ben is eventual
convicted of domestic abuse and Alice spends several years in therapy
to overcome her trauma.

Does Alice love Ben?
If the egoist said that Alice does love Ben (even though Ben does not love Alice), then I have a counter-example to their initial claim. The benefits Alice receives are trivial compared to the costs, so her motivation for being in this relationship cannot be selfish.
If the egoist said that Alice does not love Ben, then then they need to explain why without referencing the fact that Alice is not benefiting from the relationship i.e. the relationship is abusive. I do not see how they can do this.
If they do reference that Alice is not benefiting from the relationship while Ben is, then they are effectively making the claim that if someone is in a loving relationship, then they gain benefits from this relationship at least equivalent to the costs. This means that they have defined love in such a way that it must be selfish, even though their initial claim is that loving relationships are always selfish. This is called the Begging the Question fallacy.

Is loving someone essentially selfish?


which XML write/parse/modify is good for android

Question: I need to parse and modify the XML in android ..Can any one suggest which XML parser is better to parse and modify the XML in android ..?
Currently I'm using XMLpullparser but using this i'm not able to modify the XML...
Answer: Xpath is available for Android developers I believe. I use that all the time for any XML parsing really.
Answer: If the XML has a simple structure then you can deserialize the file into an object. You modify some properties of that object and serialize it to XML afterwards.
XStream is a simple library to serialize objects to XML and back again. It can be found here.
I think this is a clean way, but it isn't the easiest way if the XML file is very complex (because you have to map its structure to a Java class).
Answer: XMLPullParser isn't really designed for complex tasks AFAIK. SAX Parser is much better for advanced tasks, but it's also not as easy to use.
For manipulating XMLs, you could use SAX Filters. Look at this tutorial (IBM tutorials are great!): http://www.ibm.com/developerworks/xml/library/x-tipsaxfilter/


Reports using different interfaces

Question: I have created a report using classic but when another user creates the same report in lightning, some records are not displayed.
Comment: Can you add the steps to reproduce this behavior? Do you see any pattern of records not being displayed?
Answer: There are basically 3 reasons why something doesn't show up in a Report or Dashboard:

It does not meet the scope or filter criteria of the Report
The User does not have at least Read access to it
It does not exist

Bases on the documentation
try these suggestions:-

(1) Is the appropriate Report Type selected? If you have multiple
relationships built between two objects you will need to select the
appropriate one to get the correct results. Example: If you are using
an "Opportunities with Contact Roles" report type, any Opportunity
without a Contact Role will not appear.
(2) Verify that the records expected fall into the TIME FRAME
identified on the report. If you do not see any records that fall
within the defined reporting time frame, then no records will be
displayed on the report.
(3) Verify that the records expected fall into the FILTER CRITERIA
section on the report. Example: If the record is an Opportunity that
is "Closed/Won" and the Opportunity Status in the filter is "Open,"
that record will not be displayed. You will also want to review the
built-in filters such as "All opportunities" or "My team's
opportunities".
(4) Have fields from a Child Object been selected to be displayed,
filtered upon, or summed? Adding a field from a Child Object may
result in the report dropping rows for which no related record exists.
(5) Does every user have a role? (displayed on user records) Activity
and Opportunity reports rely on the Role or Territory Hierarchy to
determine what records should be accessible to a user. Users without a
Role assigned will not have their records displayed within these
reports. This also applies for System Administrators, though as an
Administrator you will be permitted to click through the "Organization
Drill Down."
(6) Reports created using a Custom Report Type do not follow the
sharing rules on the Opportunity and Activity objects. Example: When
running an "Opportunities with Products" report, if there are no
Product or Pricebook fields selected to be displayed, the report type
will be treated as an "Opportunities" report. Once a field is used
from either of these child objects, it will require that relationship
be defined. When using the standard report type "Activities with
Cases," Activities will not show up unless it has a populated Contact
Name field, even if it is related to a case. This usually occurs when
an Activity is created through Email.  When using the custom report
type "Case with Activities," Activities related to a Case will show up
on the report, even without relation to a Contact. (7) Reports based
on a "with" Custom Report Type may show varying results depending on
fields that are selected to be displayed.   Please view the following
article for more details: Report 'Record Count' changes when 'Details'
are hidden or exposed.
(8) Check your personal Time Zone setting.  Users based in different
Time Zones may see different results within reports. When comparing
the results you see in a report against the results a co-worker sees,
be sure you are both assigned the appropriate Time Zone within your
User Detail.
(9) Verify access to filtering fields.   If your profile does not have
"Read" access to the fields used as report filters, these filters will
not be applied when you are viewing a report. This may lead to
different results returned for different users. Contact your System
Administrator if you think you should have access to a specific field
that is not currently visible.
(10) An "Accounts" Standard Report Type uses a "My territories'
accounts" or "My territory team's accounts" filter.  If an Account
belongs to multiple Territories to which the running user also
belongs, then the Account will appear multiple times in the report.
Using "My territory team's accounts" will result in similar behavior
when an Account belongs to multiple Territories for which the running
user belongs or any descendant territories. If you would like Accounts
to return a single row in such a report, consider using a Custom
Report Type.

Reports using different interfaces