Are there any advanced 12-string players who don't play folk?

Question: Since I switched exclusively to the 12-string about a year ago, I'm finding it hard to find a practitioner of the 12-string that I can listen to and aspire to imitate.
There are people like Lenny Breau and Ralph Towner, but they're so esoteric and original that it's not something realistic I can look forward to come close to mastering.
But there is a complete dearth of any material about 12 strings on the Internet except for how to tune them, and perhaps some videos of people playing the 12-string exactly like a 6-string, which to me, now, is almost a crime.
It's like a piano and a Hammond B3, really . . . you just have to have a complete different approach to the instrument, and aside from things like finger positions and chord structures there really is no resemblance.
Does anyone know of some tutorials on how to play 12 strings that are not just 6-string rejigged or some kind of total beginner stuff? I don't know what keywords to look for. "12-string jazz" doesn't turn up very much, except possibly an album by Joe Pass on 12 string.
That's a start, but . . . any 12-string pointers welcome!
-Nick
Comment: Jimmy Page from Led Zeppelin?
Comment: It's absolutely 100% confirmed that he used an electric 12 string on Stairway (at least two tracks of it), The Song Remains The Same, and others, as well as an acoustic 12 string on Over The Hills And Far Away. My question mark wasn't there to indicate I wasn't sure he used them, it was to ask if that's the kind of thing you're looking for. An electric 12 string was also used by David Gilmour on Wish You Were Here.
Comment: As long as you are aware of how distorted harmonies build, you can play a 12 string with distortion. And not just power chords. I think you will find a lot of bands, acoustic, electric, jazz, rock, blues, even metal, have used 12 strings at times. It's way more common than you think. I even do it with my band in our rock and folk variants.
Comment: Interesting reply. I think it's very possible that he used a 12-string on Stairway—in fact I would be very surprised if he didn't. And I think Steve Howe of Yes probably used a 12-string on several of their songs—it seemed to be in vogue with rock musicians due to Roger McGuinn and George Harrison's constant and pervasive use of them.
Comment: Yeah, again, I suspect that a 12-string electric is a completely different experience from 12-string acoustic. As I understand it, you can actually use .008s on an electric. And the action would probably me much lower. As for neck width, I don't think they can do too much about that, but . . . Okay, so we have a smattering of early users of electrics back at the Dawn of Rock, but I don't see too much contemporary use of 12-strings in non-folk players these days.
Comment: you might be interested to see Jimi playing blues on an acoustic 12 string https://www.youtube.com/watch?v=IPtv14q9ZDg
Comment: @Kamakiri A hammond vs a piano has a completely different timbre, a different attack and decay profile; other than the keyboard interface, the 2 instruments share almost nothing in common. A 12 string guitar is still a guitar. You have 4 strings courses in octaves, but other than that, there is no difference. You say you hate people "playing a 12 string exactly like a 6 string", but what do you mean by that? There isn't really all that much difference in technique; in playing single note lines you have to decide whether you want them to come out in octaves or not, but other than that what?
Comment: also check out lead belly https://www.youtube.com/watch?v=blI2dXHyBj0,that John Butler song https://www.youtube.com/watch?v=6VAkOhXIsI0 that everyone loves, and of course pink floyd's wish you were here
Comment: I'm sure that it shows up everywhere, and I know that Nels Cline has a few in his Wilco touring rig, and would guess that there's a Sonic Youth song that features an oddly-tuned 12-string. But I'm hard-pressed to name a post-1980 player who is known primarily for it.
Answer: There was more than just a smattering of early users of electrics back at the Dawn of Rock - the electric 12 string was used by some of the most important musicians of the '60s, and their novel and creative uses of the 12 string sound had great impact.
I'll list here 3 important 12 string players, in chronological order as they emerged into the forefront of the 60's music scene: George Harrison, Roger (Jim) McGuinn, Paul Kantner. Listening to them and learning about their music might help you - they exploited the 12 string sound and took it far beyond folk music. They played it electric and used it in rock/folk rock/acid rock in new ways - particularly McGuinn and Kantner - although Harrison was the first one there. ( I'd venture that all subsequent use of the 12 string in rock and pop derives from these three, particulary Harrison and McGuinn, who were far better known and more influential than Kantner.)

The Beatles' George Harrison, a serious student of musicology, particularly the guitar and related instruments, and the first guy (AFAIK) to use an electric 12
string in rock/pop, on some VERY BIG HITS, starting with A Hard Day´s Night. The song caused quite a stir at the time, particularly the opening chord and the fadeout, featuring the 12 string. (Harrison also brought the sitar into the Beatles' music, another innovation that led to endless imitation.) It sparked interest in the 12 string and spawned lots of imitators and acolytes, including McGuinn and Kantner. The Beatles' catalog in their Middle Period, from
'64 through '66, starting with A Hard Day's Night, includes songs
featuring Harrison on his semi-hollow electric Rickenbacker 12
string, including some that have guitar solos apparently played on the 12 string. The music is easy, the recordings are available and the sound is
great. Unfortunately, original Beatles recordings are extremely difficult to track down and post here.  Harrison with his Ric 12 string, 1964
Roger McGuinn of the Byrds also played a Rickenbacker electric 12 string.  McGuinn was originally a "folkie" but moved into 'folk
rock' and much more with the Byrds. His 12 string was a key component of the Byrds'
great, unmistakable, signature sound, starting with Mr.
Tambourine Man and Turn Turn Turn in 1965, both huge smash hits, in no small measure due to the unique 12 string sound. McGuinn apparently got the
electric 12 string idea from Harrison, but subsequently, Harrison copped some 12 string ideas from McGuinn. The Byrds and McGuinn with
his 12 string were one of the most influential of the 60's rock
bands, whose influence is still felt today. Here's an interesting
link:The 12-String Guitar of Roger McGuinn.
8 Miles high was the Byrds most famous 12 string showcase song - lip-synced    there but you    can see McGuinn and the 12 string. He said he was
listening to    Coltrane at the time and was trying to imitate him on
the guitar. Not sure how that worked out, but it's certainly
interesting. (Unfortunately, the dumb camera guy gave almost all the face time to David Crosby instead of McGuinn, because he looked weird and put on a show, although musically was not particularly important to that band - he was fired from the Byrds not long after that clip was made.) Here's the Byrds 23 years later, including McGuinn and his 12 string,  doing their biggest hit: Mr Tambourine Man with Byrds Reunion and Bob Dylan 1990
And here's another great Byrds' song, a hit at the time, with some nice
12 string work from McGuinn: The Byrds - So You Want To Be A Rock
'n' Roll Star (1967) .
      Like the Beatles, the Byrds' music is readily available in all forms,    and  much of their work has stood the test of time. Of the
three listed here, the Byrds are most closely linked to the 12 string
sound of McGuinn.  McGuinn with his Ric 12 string, circa
1966
Paul Kantner (RIP) of the Jefferson Airplane - low key on stage but    the JA's nominal leader, very important to their sound and their most prolific
songwriter. Like McGuinn, Kantner was a "folkie gone bad", who made some great
music with JA and others. On stage his main ax was a Rickenbacker electric 12 string, used to
great effect on the 2nd guitar parts here: Jefferson Airplane -
The Ballad of You & Me & Pooneil. Here's the same song done live, with Kantner
getting involved involved in some of the jamming: Jefferson Airplane
-1967- Ballad of You and Me and Pooneil . He used some very interesting chords, sounds and great timing on the electric 12 string that give the JA's music a slightly bizarre, sci-fi/"out there" sort of sound and feel. (He was a big Sci-Fi fan.) .  Jefferson Airplane - Watch Her Ride is a trademark Kantner song, a moderate hit in 1967 (too bottom heavy to chart big) with some very good 12 string electric chord work from Kantner.
12 twelve string is not prominent here, but nonetheless, it's
Kantners song... The House At Pooneil Corners - Jefferson
Airplane, 1968 - Schuyler Hotel, NYC.
Kantner's 12 string work permeates the JA's music throughout, but it's usually low key - he understood his role very well. You need
to listen attentively for Kantner, and it's rewarding when you do: Kantner was a fine musician who played with great subtlety, ingenuity, and taste, adding a great deal to the mix. (He was also an interesting an expressive vocalist who often took the lead vocals on songs that he wrote, such as Watch Her Ride.) The JAirplane is to a large extent a forgotten band today, unfortunately, overshadowed by the Grateful Dead, but their music is available if you look for it. Many who were "there" at the time consider them the best of the West Coast bands of the late '60s. They were loaded with talent and were often quite original, literate and sophisticated, musically speaking - far more than just endless one chord guitar vamps - and Kantner with his 12 string was integral to much of it. Some of their material still sounds "cutting edge" and original even today.  Kantner with his Ric 12 string, 1969

Not sure exactly what you're looking for and what you call "advanced", but if I ever took up 12 string guitar, I'd listen carefully to these three, and if I wanted to emulate someone on the 12 string electric, it might be the vastly under-appreciated Paul Kantner, a musician's musician.
Answer: You'd usually find Leo Kottke in the folk section of the record store (back when they had those), but he's really not like that.  Check out My Father's Face, One Guitar No Vocals, or maybe Leo Live.  Basically, if you start looking through his discography at about the mid 80s and move forward from there, there's a ton of cool-non-folky 12 string guitar.
Answer: In the Mahavishnu Orchestra, John Mclaughlin Does a lot of work with the 12 string. He used a double neck Gibson and switched back and forth.
Most of the rhythm and structural aspects of the pieces are using the 12-string.

As far as aspiring to imitate, you need to have 3 sets of goals: short term, on the horizon, and hope. There is no reason why you cannot break out the really hard stuff occasionally and focus on a phrase or two. The more you work short term, the more these phrases will open up to inquiry, and more importantly, the more fun you will have.
Answer: Check out one of my good friend's dad Tony Kaluarachchi play a Rory Gallagher piece on a 12 string acoustic. The audio quality isn't the greatest but the performance is second to none. I'm sure if you have a search you'll find some other jazz gems. He doesn't always play a 12 string, as far as I remember it's a Gibson. Based in Belfast, Ireland
Edit
Personally I think 6 and 12 strings are incredibly similar, in the same way acoustic and electric guitars are the same. Physically the fingerings are the same but they have to be payed with a slightly different approach to yield good results. I would never strum an electric the same way I would an acoustic but there are definitely overlaps between the two
Comment: @Kamakiri Regarding strumming a 12 string....uh what??? The huge sounding ending of Stairway is strummed 12 strings! I think you might not be aware of what you're hearing in some cases. Strummed 12 strings sound quite different from strummed 6 strings in at least three ways: extra notes (four of the courses are tuned in octaves), double the number of pick attack sounds per strum, and a chorus like shimmer from imperfect tuning. Plus the interactions with other elements of the signal chain and/or the room change. Cf. compression on the Stairway ending.
Comment: Wow! Anyone who's a friend of Rory's is a friend pf mine! Poor Rory . . . and yeah, they're almost identical if you consider the strings are tuned the same way. But playing single-note runs is well-nigh impossible
Comment: (cont.) (see Roger McGuinn and Eight Miles High—he fumbles the whole thing) so you're reduced to chording. And chords sound best on a 12-string if they are arpeggiated—strumming just sort of defeats the purpose because the extra strings just kind of get masked by the others. I'm looking for that sort of tutorial—arpeggios and fingering.
Comment: Not 12 string but more Gallagher related... Irish tour 1974... 'nuf said
Comment: @ToddWilcox Exactly, pretty much the most common use of 12 string guitars is to strum chords and get a big, chorussy sound.  Space oddity by Bowie for example
Answer: As nobody else seems to have mentioned them yet, Steve Hackett and Mike Rutherford used 12 string guitars a good deal in the Peter Gabriel-era Genesis.
As an aside I'm sure I heard an interview with Gabriel where he stated that he started introducing costumes, masks and characters into the show to cover up for the length of time it took to get the 12-string guitars in tune ...
Comment: Wow. I sure would hate to have to get a 12-string in tune in a hurry, and back then they had no silent or digital tuners. It must have been a nightmare; and knowing as I do that a freshly-strung 12-string is possibly even *more* difficult to tune than on an old, dull-string 12-string (the easiest time is about a month after a fresh restringing, or 30 sessions, whichever comes first) I really can't imagine what the pressure was like.

Poor old Peter Gabriel. But who knows, maybe 12-strings were indirectly responsible for creating the supergroup that Genesis eventually became!


Groovy++ error when adding @Typed

Question: I was interested in testing performance gain for groovy++ over plain groovy.
I found the script to test
class Chain
{
    def size
    def first

    def init(siz)
    {
        def last
        size = siz
        for(def i = 0 ; i < siz ; i++)
        {
            def current = new Person()
            current.count = i
            if (i == 0) first = current
            if (last != null)
            {
                last.next = current
            }
            current.prev = last
            last = current
        }
        first.prev = last
        last.next = first
    }

    def kill(nth)
    {
        def current = first
        def shout = 1
        while(current.next != current)
        {
            shout = current.shout(shout,nth)
            current = current.next
        }
        first = current
    }
}

class Person
{
    def count
    def prev
    def next

    def shout(shout,deadif)
    {
        if (shout < deadif)
        {
            return (shout + 1)
        }
        prev.next = next

        next.prev = prev
        return 1
    }
}

def main(args)
{
    println "Starting"
    def ITER = 100000
    def start = System.nanoTime()
    for(def i = 0 ; i < ITER ; i++)
    {
        def chain = new Chain()
        chain.init(40)
        chain.kill(3)
    }
    def end = System.nanoTime()
    println "Total time = " + ((end - start)/(ITER * 1000)) + " microseconds"
}

It works. But if I try to add
@Typed

before first class name and run I'm getting error:
#groovy groovy.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/home/melco/test/groovy.groovy: 18: Cannot find property next of class Object
 @ line 18, column 22.
                   last.next = current
                        ^

1 error

# groovy -version
Groovy Version: 1.7.5 JVM: 1.6.0_18
Any ideas why?
Answer: To enjoy statically typed compilation you need to provide at least some amount of type information.
Normally it is enough to define types of properties (next, prev in your case) and types of method parameters.
Comment: See https://github.com/alextkachman/groovypp/blob/master/Examples/src/Iterations.groovy
Comment: In general Groovy++ Google Group is more natural place for such questions. See http://groups.google.com/group/groovyplusplus?pli=1
Answer: All the variables you declare are of type java.lang.Object (Or grovy.lang.Object in this case). So they don't have the methods "next" etc.
Try to use Person current = new Person() and Cain current = first etc.

Groovy++ error when adding @Typed


How to customize munin alert message text

Question: So, I use munin to monitor a couple hundred servers and I love it. I am trying to tweak the alert text to look a little different however, and I'm not understanding how to get it to do what I want.
I have read http://guide.munin-monitoring.org/en/latest/tutorial/alert.html and http://munin-monitoring.org/wiki/MuninAlertVariables and have no problems with the variables etc. I want to change the syntax. More specifically, here is the default text formatting out of the perl module:
'${var:group} :: ${var:host} :: ${var:graph_title}${if:cfields \n\tCRITICALs:${loop<,>:cfields  ${var:label} is ${var:value} (outside range [${var:crange}])${if:extinfo : ${var:extinfo}}}.}${if:wfields \n\tWARNINGs:${loop<,>:wfields  ${var:label} is ${var:value} (outside range [${var:wrange}])${if:extinfo : ${var:extinfo}}}.}${if:ufields \n\tUNKNOWNs:${loop<,>:ufields  ${var:label} is ${var:value}${if:extinfo : ${var:extinfo}}}.}${if:fofields \n\tOKs:${loop<,>:fofields  ${var:label} is ${var:value}${if:extinfo : ${var:extinfo}}}.}\n',

as the above document states, this will output something like this:

dev :: hostname.dev :: Memory usage
          OKs: swap is 779112448.00.

I currently have rewritten the formatting as:
${if:cfields CRITICAL} ${if:wfields WARNING} ${if:fofields OK} '${var:group} :: ${var:host} :: ${var:graph_title}\n${if:cfields CRITICAL :${loop<,>:cfields  ${var:label} is ${var:value} (outside range [${var:crange}])${if:extinfo : ${var:extinfo}}}.\n\t}${if:wfields WARNING :${loop<,>:wfields  ${var:label} is ${var:value} (outside range [${var:wrange}])${if:extinfo : ${var:extinfo}}}.\n\t}${if:ufields UNKNOWN :${loop<,>:ufields  ${var:label} is ${var:value}${if:extinfo : ${var:extinfo}}}.\n\t}${if:fofields OK :${loop<,>:fofields  ${var:label} is ${var:value}${if:extinfo : ${var:extinfo}}}.}'

The reason behind this is that I want the Severity to show up first in order of most severe to least severe.
Output ends up looking like this, and then I can filter messages by their severity pretty nicely.:

'CRITICAL':'dev :: hostname.dev :: Memory usage CRITICAL : swap is 1706340352.00 (outside range [:1000000000]).'

This is "functioning" for what I want in terms of the severity, but I would like to make it prettier because some messages come through with both CRITICAL and WARNING and OK all at the same time and end up looking like this:

'WARNING':'OK dev :: hostname.dev .....

I know why this is, the logic in my format says "If there are cfield, output CRITICAL. Then if there are wfield, output WARNING..." etc. I would like it to only output the most severe of the three and not 2 or all three if they all exist.
In my brain I can come up with the logic for it (If there are cfields, output CRITICAL, if there aren't cfields, and there are wfields, output WARNING, if there aren't cfields or wfields, but there are fofields, then output OK.) However, I have no idea what format method or language this is written in. Munin the program is all written in Perl, but I can't find anything online referencing this syntax in Perl or any other language for that matter (my google fu must not be strong today).
So, does anyone know how to help me here? TLDR, in this syntax (where ${if:cfields CRITICAL} means IF cfields exist, then print CRITICAL) what is the correct way to write: IF cfields don't exist AND wfields exist THEN print WARNING.
TIA
Answer: The allowable syntax for the expansion can be seen in the message_expand function in LimitsOld.pm. As far as I can tell it doesn't implement enough control structures to do what you want.
Alternative approach would be to pass the notifications through an intermediary (Nagios for example or a script of your own devising) and apply logic/reformatting there.
Comment: Thanks for pointing out the source. That was very helpful. I'm moving on to reformatting by script afterwards.


Author Fields into a content type template

Question: I'm trying to load some of the information from the author into a node--article.html.twig. So I can provide some information like bio, social media,etc.
Similar to this...

I can easily get the author_name and the author_picture because these two are given by the template. I added extra field at admin/config/people/accounts/fields in this case the only extra field is field_bio

I try to use the include to add this user field into.
node--article.html.twig

{{ author_name }}

{% include('field--user--field-bio--user.html.twig') %}

This what I have on the field template - field--user--field-bio--user.html.twig

  {%- for item in items -%}
      {{ item.content }}
  {%- endfor -%}

Hello

The word "Hello" is been display on the node--article.html.twig; however, the item.content which is my field information is not been load. =(
I also try to dig up into the user variables by using {{ kint() }} to see if there is this information and I did not find it either.
I have seen some example with a module, which I have avoid them because this is for a contrib theme and I do not want to have any module dependency. I have done this many times with DS but I do not want to use any extra module.
So I have couple questions...

Should I use include for this use case or not ?

If I have too, what I'm doing wrong ? Why the item.content is not been load ?
If I should not use it in this use case, what should I do instead ?
Comment: You should pass the required arguments in a preprocess function
Comment: Why not make a block view and place an instance for pages that are of Article node type?
Comment: Check out in the Manage Display. Maybe this field is excluded. Otherwise, it should be there in the template as a variable. Have you tried dumping all the vars like here? https://www.drupal.org/node/1906780
Answer:
Should I use include for this use case or not ?

This is not possible, you can't mix different templates like node and field because they have different variables.

If I have too, what I'm doing wrong ? Why the item.content is not been
  load ?

item.content is only loaded in field, not in node template.

If I should not use it in this use case, what should I do instead ?

You should define the user field you need in preprocess, examples for the two fields already defined:
function template_preprocess_node(&$variables) {
  $variables['author_name'] = drupal_render($variables['elements']['uid']);
  $variables['author_picture'] = user_view($node->getOwner(), 'compact');

A basic example to use this in your own hook:
function mytheme_preprocess_node(&$variables) {
  $node = $variables['node'];
  $variables['user_field1'] = $node->getOwner()->field_field1->value;

And in twig
{{ user_field1 }}

Comment: @kenorb, this is a code example from core, so you should file an issue to change this
Comment: Btw. You should use `\Drupal::service('renderer')->renderRoot()` instead of deprecated `drupal_render()`.
Comment: @kenorb, renderRoot() is not a replacement for drupal_render().  This would be render().
Comment: Ok, good to know, as `drupal_render` or `render` just doesn't work sometimes properly, `render()` as well sometimes fails to render arrays, so my understanding that `renderRoot()` method is for final render to render everything just in case.
Comment: @kenorb, in cases where render() doesn't work properly the best solution is most times not to render at all. In D8 site building is done 99 % with unrendered render arrays. And yes, renderRoot() is for final render, but final means, you deliver it right away, like in a response.


Is there way a to pass URL values in html files in django templates using constant substitution?

Question: This is Django problem. I am a newbie to this.
This is my url.py file
from django.urls import path
from splunkAutomation.logic.Constants import Constants
from . import views

app_name = 'splunkAutomation'
urlpatterns = [
 path(Constants.URL_FOR_SEEING_ALL_SPLUNK_QUERIES,views.viewForSeeingAllSplunkQueries, name=Constants.NAME_OF_URL_FOR_SEEING_ALL_SPLUNK_QUERIES),
]

I want to be able to reference this name "Constants.NAME_OF_URL_FOR_SEEING_ALL_SPLUNK_QUERIES" in html template.
The following is the snippet from the html file

Check

Basically I want to use the constant substitution instead of {% url 'splunkAutomation:splunkQuerySpecific' query.id  %}
Is there a way to use this ?
Answer: I you add a name to the path:
path(Constants.URL_FOR_SEEING_ALL_SPLUNK_QUERIES,views.viewForSeeingAllSplunkQueries, name="url_link"),

You can use it like this:
Check

If you want to have a dynamic url, you can do this (example for class based views):
urlpatterns = patterns('',
    url(
        regex=r'^(?P<webaddress>\w+)/$',
        view=Mysite.as_view(),
    ),
)

And in your view you grap the parameter:
def dispatch(self, request, *args, **kwargs):
    self.webaddress= kwargs.get('webaddress', '')

In your template you can then access the value with
{{ view.webaddress }}

Comment: Hi @ger.s.brett, Thanks for the quick response.                         The constant 'name=Constants.NAME_OF_URL_FOR_SEEING_ALL_SPLUNK_QUERIES' has the value 'splunkQuerySpecific'. The reason i don't want to use it the you mentioned is because "Suppose if the name changes, then i will have to change it in all the places where its being referred (like in a href tag above). However if I refer it (if possible) by using 'Constant. NAME_OF_URL_FOR_SEEING_ALL_SPLUNK_QUERIES' at all the places then even if the name changes, the rest of the code will remain still neat and tidy. :)
Comment: But why would the name change? Names of URLs are constants.
Comment: Hi @DanielRoseman, For example, the functionality of a given page (like the above display all the splunk queries) in application changes (tomorrow I might want to add some resolution functionality to the same page), then in that case i would want to change the name of URL accordingly to give the reader some better context of what the page does.
Comment: This is not how you should do this (your solution will always demand server restart): if you want to do this dynamically you should catch the last part of the url and hand this over to the view - you would capture this part of the url as a parameter.
Comment: oh okay @ger.s.brett Guess its not a great use case. Anyway just to be clear, could you please elaborate when you say "your solution will always demand server restart" and "catch the last part of the url".
Comment: see edit above. The urls.py is just loaded on start of the django (production) server. Only the dev server loads it from time to time anew.
Comment: Oh okay. Got it. The new edit is helpful. I will try to implement it. Thank you :) .


virtual keyboard in JS but with images

Question: I want to make a virtual keyboard in HTML, CSS, and JavaScript. However, there is a twist. Instead of the letters on the keyboard, I would like to replace them with images of my own choice. So lets say,
instead of letter "a", i have an image of APPLE
instead of letter "s", I have an image of SNAKE

Was able to do it.
Comment: if everything on the keyboard is going to be represented by an image, replace the elements in keyLayout with src's to your images.  Then create your html and insert the src for each key
Comment: Could you show more of your code? It isn't clear how the bit you have shown is actually used/does anything.
Answer: You can use HTML AND CSS Grid to do that, you just need the images and a file you can take them out of, unless there is an interactiveness to your website you won't be needing javascript
Answer: is this what you had in mind?

var elements = document.getElementsByClassName("key");

var myFunction = function(event) {
let text = document.getElementById('text')
text.innerText = text.innerText + event.target.id

};

for (var i = 0; i < elements.length; i++) {
    elements[i].addEventListener('click', myFunction, false);
}
.keyboard{
display:flex;
justify-content:center;
}

img{
border:solid 2px green;
}

virtual keyboard in JS but with images


Objective-C - Strange getter methods

Question: For my property HomeButton*sharedHomeButtonInstance, when I type -getshared... in Xcode, it suggests this to me
- (void)getSharedHomeButtonInstance:(HomeButton **)buffer range:(NSRange)inRange {

}

Why does the getter method need a buffer and range, and what are they?
Comment: Getters typically don't start with 'get' so I suspect it's some custom method.  Try typing `shared...` instead.
Answer: The getter method you want is:
- (HomeButton *)sharedHomeButtonInstance
{
    return ...;
}

Objective-C - Strange getter methods


How can I simplify a function?

Question: I consider the following function;
$$f:\{1,-1\} \times \{0,1\} \ni (a,b) \to f(a,b) \in \{1,-1\}$$
satisfying
\begin{align*}
&f(a,b) = 1 \quad (a=1, b=0),\\
&f(a,b) = 1 \quad (a=1, b=1),\\
&f(a,b) = 1 \quad (a=-1, b=0),\\
&f(a,b) = -1 \quad (a=-1, b=1).
\end{align*}
Then would you give me some examples which simplify this function?
Comment: What do you mean simplify the function in this case?
Answer: This is just $f: \{-1,1\} \times \{0,1\} \rightarrow \{-1,1\}, \ (a,b) \mapsto a^b$

How can I simplify a function?


Drupal 7 form, query DB and results display

Question: I'm still somewhat new to Drupal but have a lot of experience programming in PHP. I'm looking for a list of modules in Drupal. I need to do this common list of tasks that are very typical of DB interaction:

Present a form to a user.
Do a query (select or insert) to one or many tables in a database in a custom DB or the one Drupal uses/
Present results in table form.

Please help me out thanks. Could anybody can give a sample examples.
Answer: This is what you need. Take a look into the Examples for Developers module. And Views of course. No need for handcrafted SQL.
Comment: Please provide me a sample examples.
Comment: Please look into the Examples Module. There are in there.


why $(1,1)$ have infinite order?

Question: Prove the set of elements of the direct product $\mathbb{Z} \times (\mathbb{Z} / n \mathbb{Z})$ of infinite order together with the identity is not a subgroup of $\mathbb{Z} \times (\mathbb{Z} / n \mathbb{Z})$.
My attempt : Answer  is given here see Page No .$2$
It is written that $(1,1)$ and $(-1,n)$ have  infinite order and the  product $(1,1) +(-1,0)=(0,1)$
have  finite order
My confusion : why $(1,1)$  have  infinite order ?
Here $(1,1)^n =(1,1)$   so  i think $(1,1)$ have finite order
Comment: $(1,1)^n = (n,0)$, not $(1,1)$. The operation is addition, not multiplication.
Answer: The group operation on $\mathbb{Z}\times(\mathbb{Z}/n\mathbb{Z})$ is componentwise addition. So e.g. setting $n=3$ we have $$(1,1)+(1,1)=(2,2)\mbox{ and } (1,1)+(1,1)+(1,1)=(3,0).$$
It should be clear that no matter what $n$ is, adding $(1,1)$ to itself over and over again will never reach the additive identity $(0,0)$ since the left coordinate will just keep growing. (Exponent notation makes this a bit less clear; typically, for groups known to be abelian we use multiplicative notation instead, so e.g. "$3(1,1)=(3,0)$" in the above exaple.)
In particular, adding $(1,1)$ to itself $n$ times in $\mathbb{Z}\times(\mathbb{Z}/n\mathbb{Z})$ will yield $$(n,0)$$ which is not the same as $(0,0)$.
Answer: For that example one is using addition on each factor of the direct product. Note you could deduce that multiplication was not the operation being used, since the first factor is not a group under multiplication.
Comment: Neither the second factor.
Comment: @jjagmath Yes, noticed that later. Under multiplication, second factor has no inverse for the zero element of $\mathbb{Z}/n \mathbb{Z}.$

why $(1,1)$ have infinite order?


How can I show that this sequence of integrals tends to the value $\infty$?

Question: For each $n \in \Bbb Z_+$, let $$I_n = \int_{-\infty}^\infty \frac{|\sin \left( \frac{x}{n} \right) \sin(x)|}{\frac{x}{n} x} \, dx.$$
I would like to show that $I_n \xrightarrow{n\to \infty} \infty.$
I have written the denominator in this odd form because I think it might be helpful.
I have tried using the inequality $|\sin(x)| \geq \sin^2(x)$, but the resulting integral converges independently of $n$.  Any ideas?
Answer: Note that
$$\int_0^{n\pi/3} \frac{|\sin(x/n)|}{x/n} \frac{|\sin x|}{x} \, dx \geqslant \sum_{k=1}^{n-1}\int_{k\pi/3}^{(k+1)\pi/3}\frac{|\sin(x/n)|}{x/n} \frac{|\sin x|}{x} \, dx \\ \geqslant \frac{3\sin(\pi/3)}{\pi}\sum_{k=1}^{n-1}\frac{1/2}{(k+1)\pi/3} \to \infty$$
With $0  \leqslant x  \leqslant n\pi/3$ we have
$$1 \geqslant \frac{\sin(x/n)}{x/n} \geqslant \frac{\sin(\pi/3)}{\pi/3}. $$
Also
$$\int_{k\pi/3}^{(k+1)\pi/3} \frac{|\sin x|}{x} \, dx \geqslant \frac1{(k+1)\pi/3}\int_{k\pi/3}^{(k+1)\pi/3} \frac{|\sin x|}{x} \, dx =  \frac{|\cos(k+1)\pi/3 - \cos k\pi/3|}{(k+1)\pi/3} \geqslant \frac{1/2}{(k+1)\pi/3}$$
Comment: Why not just say the expression is greater than

$$
\int_0^{n} \frac{|\sin(x/n)|}{x/n} \frac{|\sin x|}{x} \, dx > \sin (1) \int_0^{n} \frac{|\sin x|}{x} \, dx$$

for any $n,$ and use the well known fact that $\int_0^{\infty} \frac{|\sin x|}{x} \, dx = \infty.$
Comment: Uh, where does $\sin(1)$ come from?
Comment: I'm having trouble understanding the last inequality.
Comment: Right -- $x/n$ is not less than $1$ in this form.  Ill fix.
Comment: I did not see the trees for the forest. Thanks.
Comment: Still a helpful answer @RRL, wish I could thank you more!
Answer: For $0\lt x\le1$, $\frac{\sin(x)}x$ is decreasing,therefore, $\frac{\sin(x)}x\ge\frac{\sin(1)}1$. Thus, for $0\lt x\le1$,
$$
\sin(x)\ge x\sin(1)\tag{1}
$$
Since $\left|\,\sin\left(\frac xn\right)\sin(x)\,\right|\le1$, we have
$$
\begin{align}
n\int_n^\infty\left|\,\sin\left(\frac xn\right)\sin(x)\,\right|\,\frac{\mathrm{d}x}{x^2}
&\le n\cdot\frac1n\\
&=1\\[6pt]
&=O(1)\tag{2}
\end{align}
$$
Therefore,
$$
\begin{align}
n\int_{-\infty}^\infty\left|\,\sin\left(\frac xn\right)\sin(x)\,\right|\,\frac{\mathrm{d}x}{x^2}
&=2n\int_0^\infty\left|\,\sin\left(\frac xn\right)\sin(x)\,\right|\,\frac{\mathrm{d}x}{x^2}\\
&=2n\int_0^n\left|\,\sin\left(\frac xn\right)\sin(x)\,\right|\,\frac{\mathrm{d}x}{x^2}+O(1)\\
&\ge2\sin(1)\int_0^n\left|\,\sin(x)\,\right|\,\frac{\mathrm{d}x}{x}+O(1)\tag{3}
\end{align}
$$
and by Monotone Convergence,
$$
\begin{align}
\lim_{n\to\infty}\int_0^n\left|\,\sin(x)\,\right|\,\frac{\mathrm{d}x}{x}
&=\int_0^\infty\left|\,\sin(x)\,\right|\,\frac{\mathrm{d}x}{x}\\
&=\sum_{k=1}^\infty\int_{(k-1)\pi}^{k\pi}\left|\,\sin(x)\,\right|\,\frac{\mathrm{d}x}{x}\\
&\ge\sum_{k=1}^\infty\frac2{k\pi}\\[9pt]
&=\infty\tag{4}
\end{align}
$$
Comment: Rob.  Solid solution.  So, a +1 ... Just curious ... What was the purpose of analyzing the integral $\int_n^\infty$?  There's nothing wrong in the analysis, but inasmuch as the integrand is positive, that piece only adds to the integral from $0$ to $n$, which is unbounded.  - Mark
Comment: @Dr.MV: Just bounding it so that the triangle inequality can be used. As it is positive and the integral diverges, it is overkill, but when I computed it, I was not sure it diverged.
Comment: Thanks Rob.  Nice little exercise.


E flat to B flat on Flute?

Question: I'm playing the piece Menuet from L'Arlésienne Suite No.2 and there are multiple instances where E flat to B flat sixteenth notes are played. Obviously it is a possible transition to do, but I feel like the slur sounds rough when compared to the smoothness of the song. Are there any alternate fingerings on this part that I can use to improve the overall quality of the song?
Edit: For clarification this E flat 6 to B flat 5, the sixteenth notes are going from the E flat down to the B flat, not up.
Comment: Which fingering are you currently using?
Comment: I'm using the regular E flat fingering with all fingers down, and then the B flat fingering with first finger down on the left hand, regular thumb key, first finger down on right hand and then the right hand pinky key.
Answer: Unfortunately there's not a lot of choice for those two notes. You could use the thumb Bb instead which would allow your right hand to move more as one unit. You could also leave the Ab key pressed down and sacrifice some intonation (which on a trill isn't that important) allowing you to concentrate more on your other fingers. A combination of these two might help you smooth it out more. I'm kind of wondering why you aren't already using the thumb Bb in a piece like this.
For a more radical approach you could shift your left hand index finger over to hold down both C and the Bb key, but I'm not sure how much this would help.
Comment: Thank you! My flute is currently getting repaired, and I just received the piece when I first posted this. I was going to play around with the alternate fingerings once I got my flute back, but I figured it would be best to ask on here.

E flat to B flat on Flute?


Lotus Domino as Amazon IAM Identity Provider

Question: I am looking for the way to configure our corporate Lotus Domino server as an Idenity Provider of Amazon IAM service. Amazon supports SAML and OpenID Provider Types. Can I configure Domino server that way? Otherwise, are there other ways to configure Lotus Domino to be an Identity Provider of Amazon?
Answer: Domino is not a Identity Provider. You'll have to implement this on your own.


Windows Error Accessing a Network Share

Question: I go to start\run and type in an address for an existing network share for which I have valid permissions (it worked yesterday).
Today, I get the message: "The name limit for the local computer network adapter card was exceeded."
What does this mean?
Comment: http://www.google.com/#hl=en&source=hp&q=The+name+limit+for+the+local+computer+network+adapter+card+was+exceeded&aq=f&aqi=g1&aql=&oq=&gs_rfai=&fp=a2bb30ecf4f91972
Answer: Seems like an SMB issue, try to restart the "server" service on the fileserver or tweack the smb settings in the server registry. By the way, how is this server used? nb of users, connections?
Answer: This KB article seems to have quite a bit of info on this issue including ways to pin it down more definitively and resolve:
http://support.microsoft.com/kb/319504
(and El Otro Dan's google search link is full of links including this KB article)
Dan

Windows Error Accessing a Network Share


Functions like Focus() and properties like Focusable not available for silverlight, only .NET?

Question: Short version: Solutions like the following: How Do I Give a Textbox Focus in Silverlight?
Don't seem to work because functions like Focus and properties like Focusable DON'T EXIST for silverlight and only exist for .net apparently.
Background/Long Version: So I've been trying to get my XNA game to work on silverlight. Porting it was a nightmare but I managed to do it somehow. Currently I want to use ViewBox's so my game is as big as a players browser instead of a set size. When I tried to do it, it VISUALLY worked, but it was impossible to send any keyboard commands to the game. I'm pretty sure its preventing me from focusing it. When I google how to give focus, it gives me links like these where people are saying to use functions like .focus() which DON'T EXIST on silverlight 5 only .NET apparently. For example go here: http://msdn.microsoft.com/en-us/library/system.windows.controls.control(v=vs.110).aspx
It shows the .NET 4.5 version. If you change it to silverlight at the top, all the nice functions and settings disappear. Am I missing something here? How do I access the .Net versions of these classes in silverlight? If its not possible why are all those answers mentioned above use Focus() etc?
Comment: Maybe you looked too hastily. Look again, the method `Focus()` is available for `Control` and all derived types. The properties `Focusable` and `IsFocused` are not available, but you can implement them as `ExtensionMethods` and use them as if they were available.
Comment: Example `ExtensionMethod` usage: `if (myControl.IsFocused()) {...}` and definition somewhere else: `public static class MyControlExtensions { public static bool IsFocused(this Control control){ return ...FocusManager...magic... }}`
Comment: ...and there is a method `IsKeyboardFocusable()` you might be able to use, available via [automationpeer](http://msdn.microsoft.com/en-us/library/system.windows.automation.peers.automationpeer%28v=vs.95%29.aspx)
Comment: The derived types don't seem to useful for trying to run a game (text box, calendar etc..). What are extension methods exactly and how would I implement them? I'll try tinkering with automationpeer, are there examples for it that you know of? Thanks!
Comment: What is your top level Element of your SilverlightApplication? The one that hosts the `ViewBox` you mentioned. Isn't it derived from `Control` or `UserControl`? You can derive your own types (hosting your game's viewport) from `Control`.
Comment: I guess you are right, it is from control (the control page didn't list it my bad). I've never made a derived class from a silverlight class before what does that involve (I did a lot of XNA but barely any silverlight). Also For some reason (unrelated), I get a purple screen when I load my XNA game, I can sometimes screw with the xaml code and move the purple square away but it limits what I can do. Its actually a HUGE source of annoyance for me and I don't understand it at all, but I don't think many people are using silver light with XNA because googling gives me nothing.
Comment: I just saw your example comment I'll try stuff out.
Comment: By the way just to validate my original question, Viewbox (a control derivative) does NOT have a focus() method. I still don't understand how other people are using that.
Comment: Wow, you are quick to judge... and walk the developer earth with a bag full of wrong assumptions and conclusions. No, your Viewbox is no Control; Yes, other people are using it, maybe they place it inside a ViewboxHost derived from UserControl and can easily handle Keyboard input from there. Dunno.
Comment: I make many mentions that I don't know that much, why are you being rude? Thanks for the help though.
Comment: Sorry for my rude answer. Was a bit too heavy a response.
Comment: No problem, thanks for the help. I found a workaround to giving the view box focus, instead I just give a grid focus(which worked automatically) and put the grid inside the view box. I'll probably run into this again later and come back to your post, or get similar issues.
Answer: Assuming C#...
On your silverlight page, select yourPage_Created from write code menu
Add the following:
<code>partial void YourPage_Created() // this line should be autogenerated
{
this.FindControl("YourControl").ControlAvailable += YourFieldAvailable;
}

private void YourFieldAvailable(object sender, ControlAvailableArguments e)
{
((System.Windows.Controls.Control)e.Control).GotFocus += YourRoutine;
}

private void YourRoutine(object sender, System.Windows.RoutedEventArgs e)
{
// do your focus specific code in here
}
</code>
You will now have a custom focus event for the specified control.
Hope this helps :)
Comment: Thanks for the help this is really frustrating me. But doesn't this just add an event handler for when you get focus? I was probably unclear in my post, I was hoping to find a way to give the ViewBox focus (mainly keyboard focus), not do stuff after it got focus.
Comment: In that case, try: this.FindControl("YourControl").Focus() in the method you wish to have give focus to your viewbox. If you want contol 1 gaining focus to pass focus to contol 2, you would use the code above with the this.FindControl("YourControl").Focus()  in 'YourRoutine'
Comment: Those don't seem to be working for me in silverlight. So I tried doing .FindControl and even in a grid control object it didn't have the function. Even worse the Focus() function doesn't seem to exist for the default viewbox and grid classes. Its okay, I found a very weird workaround of just putting my drawing surface inside a grid, which is inside a view box. And just having the grid which DOES seem to be focusable by default, retrieve the keyboard input and attach to the drawingsurface game.


In epsilon delta method, is this possible?

Question: When we use the epsilon delta method, we use the Strictly inequality as follows:
function $f$ is continous at $x=a$ if and only if
For arbitrary $\epsilon$, there exist a $\delta$ such that
If $ | x-a | < \delta$ then $ | f(x) - f(a) | < \epsilon$
Is it possible to change the strictly inequality($<$ to inequality($\leq$) in the above expression?
If possible is this equivalent?
Comment: Yes, it is equivalent
Answer: Yes, it is possible, and is equivalent. For a function $f \colon \def\R{\mathbf R}\R \to \R$ and $a \in \R$, we will show that
$$ \forall \epsilon > 0\, \exists \delta > 0\, \forall x \in \R\, |x-a| < \delta \implies |f(x) - f(a)| < \epsilon \tag+$$
and
$$ \forall \epsilon > 0\, \exists \delta > 0\, \forall x \in \R\, |x-a| \le \delta \implies |f(x) - f(a)| \le \epsilon \tag{$*$}$$
Suppose $(+)$ holds, to prove $(*)$ let $\epsilon > 0$. Using $(+)$ we get a $\delta' > 0$ such that
$$ |x-a| < \delta' \implies |f(x) - f(a)| < \epsilon $$
Let $\delta := \frac{\delta'}2$. If $x \in \R$ is given with $|x-a| \le \delta$, then $|x-a| < \delta'$, hence $|f(x)-f(a)| < \epsilon$, which implies $|f(x)-f(a)| \le \epsilon$.
Now suppose $(*)$ holds and let $\epsilon > 0$. Apply $(*)$ with $\frac \epsilon2$ to obtain $\delta > 0$ with
$$ |x-a| \le \delta \implies |f(x) - f(a)| \le \frac\epsilon2 $$
If now $x \in \R$ with $|x-a| < \delta$ is given, then $|x-a| \le \delta$, hence, by the choice of $\delta$, $|f(x)-f(a)| \le \frac\epsilon2< \epsilon$.
Answer: Surely it is. Since the statement holds for all $\epsilon > 0$, then if we take fixed $\epsilon>0$, then clearly $\frac{\epsilon}{2}>0$ so the statement $|f(x)-f(a)|\leqslant\frac{\epsilon}{2}<\epsilon$ is true as well (but $\delta$ in definition will probably be even smaller than before).
The reverse implication $<\implies \leqslant$ is obvious.


Como obter o IP do dispositivo Android para ser usado no Socket() em java?

Question: Estou tentando implementar uma comunicação ponto à ponto(dispositivo à dispositivo) e preciso obter o IP real do dispositivo server para então inserir no client mas não consigo.
Estou usando:
ServerSocket server = new ServerSocket(8000);
Log.v("TAG", server.getInetAddress().getHostAddress().toString());

e me retorna apenas "::".
Answer: Você precisará fazer uma requisição para um servidor externo para saber o IP. Algo como isto:
https://github.com/kost/external-ip

================
No caso de IP Wi-Fi:
WifiManager wm = (WifiManager) getSystemService(WIFI_SERVICE);
String ip = Formatter.formatIpAddress(wm.getConnectionInfo().getIpAddress());

Ligando no manifesto:
ACCESS_WIFI_STATE


Regex that starts with IN and ends with eight digits

Question: I would like build a regular expression for "IN12345678" (i.e., starts with IN and ends with eight digit, totally 10).
Answer: The following regex will do what you require <code>^IN\d{8}$</code>
Answer: This regex works for your case
<code>/^IN[0-9]{8}$/
</code>


Moving Microsoft Terminal Services from one server to another

Question: What is the easiest way to move all settings and users' profiles from one terminal server to another one? Both on Windows Server 2008.
Answer: The "most supported" way would be to transition all the users to Terminal Services roaming user profiles, let them logon and logoff of the old server computer to cause their profiles to be copied up to the roaming share. Things will work "as normal" on the new server computer, then.
(I am assuming that the users are logging-on with domain accounts. If they're using local accounts on the server computer(s) then this is a whole different ballgame...)


Echo out from a multidimensional array

Question: I have this array:
Array
(
    [result] => Array
        (
            [lastModified] => 1465097340000
            [name] => Ulminia
            [realm] => Zangarmarsh
            [battlegroup] => Rampage
            [class] => 3
            [race] => 4
            [gender] => 1
            [level] => 100
            [achievementPoints] => 14915
            [thumbnail] => hellscream/74/113337162-avatar.jpg
            [calcClass] => Y
            [faction] => 0
            [items] => Array
                (
                    [averageItemLevel] => 710
                    [averageItemLevelEquipped] => 709
                    [head] => Array
                        (
                            [id] => 125899
                            [name] => Warmongering Gladiator's Helm
                            [icon] => inv_helm_mail_raidhunter_p_01
                            [quality] => 4
                            [itemLevel] => 710
                            [tooltipParams] => Array
                                (
                                    [transmogItem] => 71356
                                    [timewalkerLevel] => 100
                                )

I want to echo out from the [head] array the [id] and the [quality]. If i just echo out the [id] everything works, but if i want to echo out the [quality] too, it doesn´t work.
My code:
$items = $r['result']['items'];
echo 'Head: '.$items['head']['id']['quality']."\n";
foreach($items['head']['tooltipParams'] as $key => $value){
    echo 'head_'.$key.': '.$value.'\n';

}

Comment: do you need to echo all the values???
Answer: echo $items['head']['id']['quality'];

The above statement means you are printing out the subkey "quality" of key "id", which doesn't exist.
You need to concatenate both key values as follows:
echo $items['head']['id'] . ' ' . $items['head']['quality'];

... or
echo $items['head']['id'], ' ', $items['head']['quality'];

Answer: Notice that the id and the quality are in the same array.
//ID
echo $items['head']['id'];
//Quality
echo $items['head']['quality'];

Answer: $items['head']['id']['quality']."\n"; is trying to read the element with the key quality inside the array stored inside id. However, id is not an array, which is why this fails.
In order to read two fields, you need to read them seperately:
echo 'Head: ID=' . $items['head']['id'] . ', quality = ' . $items['head']['quality'] . "\n";

Comment: Thanks. Works perfectly.

Echo out from a multidimensional array


The 2D Array Index access, with step value

Question: I have an array like:
a =np.array([[1,2,3,5,8,7,2,1,3,5,1,2,20,21],[3,8,3,9,8,7,10,1,3,5,1,2,20,21]])

requirement:

need to access index value with given step. For an example step value 3.
Only index value not an elements value.

Required Output:
[[0,3,6,9,12],[0,3,6,9,12]]

Comment: What have you tried so far?
Comment: Repeat it in a list comprehension.
Comment: if you want you can add your code to the post and i'll help you :)
Comment: I tried with 1D array with range function. Its okay with 1D
Answer: Use a list comprehension to repeat the range for each row.
a =np.array([[1,2,3,5,8,7,2,1,3,5,1,2,20,21],[3,8,3,9,8,7,10,1,3,5,1,2,20,21]])
indexes = [list(range(0, a.shape[1], 3)) for _ in range(a.shape[0])]

Answer: You can do:
a = np.array([[1,2,3,5,8,7,2,1,3,5,1,2,20,21],[3,8,3,9,8,7,10,1,3,5,1,2,20,21]])
step = 3
indices = [np.arange(0, arr.size, step) for arr in a]

print(indices):
[array([ 0,  3,  6,  9, 12]), array([ 0,  3,  6,  9, 12])]

If you want lists instead of np arrays, just use .tolist() like:
[np.arange(0, arr.size, step).tolist() for arr in a]


How to Re-direct my blog http://subdomain.example.com to https://

Question: For redirecting my sub domain http: to https:
I used below code in .htaccess file but it didn't work.
RewriteEngine on

RewriteCond %{HTTP_HOST}  ^subdomain\.example\.com$ [NC]
RewriteRule ^$ https://subdomain.example.com/ [R=301,NE,NC,L]

Also, I have already changed from http to https in WordPress site URL, but still it is not working.
Please guide me how to fix it.
Comment: Possible duplicate of [Best Practice: 301 Redirect HTTP to HTTPS (Standard Domain)](https://stackoverflow.com/questions/29029049/best-practice-301-redirect-http-to-https-standard-domain)
Comment: Don't create duplicate questions. This has been asked a great many times already on this site.
Answer:
RewriteCond %{HTTP_HOST}  ^subdomain\.example\.com$ [NC]
RewriteRule ^$ https://subdomain.example.com/ [R=301,NE,NC,L]

This simply checks the host, not the SSL state (ie. HTTP or HTTPS). This also only redirects the site root and would result in a redirect loop.
Try the following instead. This will need to go before the existing (WordPress) directives in .htaccess:
RewriteCond %{HTTP_HOST} ^subdomain\.example\.com [NC]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,NE,L]

You will need to clear your browser cache before testing.


In a metric space $X$, a subset $S \subset X$ is relatively sequentially compact if and only if its closure $\overline{S}$ is sequentially compact.

Question:
Prove that in a metric space $X$, a subset $S \subset X$ is relatively sequentially compact if and only if its closure $\overline{S}$ is sequentially compact.

The terms relatively sequentially compact and sequentially compact are defined as follows for a general topological space $X$:

A subset $S \subset X$ is sequentially compact if each sequence in $S$ has a convergent subsequence in $X$ with a limit in $S$.
A subset $S \subset X$ is relatively sequentially compact if each sequence in $S$ has a convergent subsequence in $X$.

My attempt for proving the first implication is the following:

Suppose $S$ is relatively sequentially compact. Suppose $(x_n)_n \subset \overline{S}$ with $x_n \in S \subset \overline{S}$, for all $n$. Since $S$ is relatively sequentially compact and $\overline{S}$ is closed, the sequence $(x_n)_n$ has a convergent subsequence with limit in $\overline{S}$.

I have difficulties with completing the proof of this first implication. I think the converse implication is clear:

Suppose $\overline{S}$ is sequentially compact. Then, in particular, any sequence $(x_n)_n \subset S$ has a converging subsequence with limit in $\overline{S} \subset X$.

Any help, solutions or comments are highly appreciated.
Answer: The adherence $\bar S$ is the subset of limit points of $S$.
Suppose that $S$ is relatively sequentially compact and $(y_n)$ a sequence of elements of $\bar S$. There exists a sequence $(x^n_m\in S)$ which converges towards $y_n$. Choose $m(n)$ such that $d(y_n,x^n_{m(n)})<1/n$.
You can extract a sequence $(x^{f(n)}_{m(f(n)}$ which converges towards $y\in \bar S$ For every $c>0$ there exists $N>0$ such that $n>N$ implies that $d(y,x^{f(n)}_{m(f(n))})<c/2$ and $1/n<c/2$. $d(y,y_{f(n)})\leq d(y,x^{f(n)}_{m(f(n))})+d(x^{f(n)}_{m(f(n))},y_{f(n)})\leq c/2+c/2=c$. We deduce that $(y_{f(n)})$ converges towards $y$.
Comment: Thanks; I got it! Could you maybe confirm that my proof of the converse implication is correct?
Comment: Yes it is correct.


How to handle Unhandled exceptions in c# using TryParse

Question: if (response.ToLower() == "addition")
{
Console.Write("Enter a number: ");
double num1 = double.Parse(Console.ReadLine());
Console.Write("Enter another number: ");
double num2 = double.Parse(Console.ReadLine());
double addition = (num1) + (num2);
Console.WriteLine("The answer is {0}", addition);
if(!double.TryParse (num1, out addition))
     {
      Console.WriteLine("Try Again");
      tryAgain = true;
     }

I tried to use try parse to handle my unhandled exception and make the user go back and do it again if they dont input a number/ integer/ decimal. I am new to try parse and dont know how to use it properly, So i would like to ask for a way in which i could handle exceptions in the future as well

Here's an inline link to replit(https://replit.com/@NitikPaudel/Maths-Calculator-Upgraded#main.cs)
Comment: What errors are you getting? Can you explain what you are trying to do with TryParse, seems like Try/Catch would work better. Or a TryParse higher up instead of the double num1 = double.Parse(Console.ReadLine());  Also, believe TryParse needs a string, not a double, as the first param unless you are using a non-standard library.
Comment: cannot convert from double to system.ReadOnlySpan
Comment: i still dont know how to fix it using a string
Comment: I am new to try parse and one of my friends told me it is the best way to deal with unhandled exceptions
Comment: How can i use Try/Catch because that is another suggestion i got as well?
Answer: I'd try something like below:
    if (response.ToLower() == "addition")
    {
    double num1;
    double num2;
    Console.Write("Enter a number: ");
    if(!double.TryParse(Console.ReadLine().ToString(),num1)){
       Console.WriteLine("Try Again");
          tryAgain = true;
    };

    Console.Write("Enter another number: ");
    if(!double.TryParse(Console.ReadLine().ToString(),num2)){
       Console.WriteLine("Try Again");
          tryAgain = true;
    };

    double addition = (num1) + (num2);
    Console.WriteLine("The answer is {0}", addition);
}

Or if you would prefer a try/catch
if (response.ToLower() == "addition")
{
    try{
        Console.Write("Enter a number: ");
        double num1 = double.Parse(Console.ReadLine());
        Console.Write("Enter another number: ");
        double num2 = double.Parse(Console.ReadLine());
        double addition = (num1) + (num2);
        Console.WriteLine("The answer is {0}", addition);
    }
    catch(Exception e){
        Console.WriteLine("Try Again");
        tryAgain = true;
    }
}

Comment: And the Exception e has the error if you want to log that or write it.
Answer: The function TryParse is here to check if a value can be converted and to prevent the exception before it is thrown.
To handle exceptions, you can use try catch, example:
try {
    // do the work
}
catch (Exception ex) {
    // work with exception
}

View this documentation: https://www.tutorialsteacher.com/csharp/csharp-exception-handling


Convert Polymorphic C++ Object to Non-Polymorphic C Object

Question: Just a little background for the strange question: I have a network framwork (RTI DDS) which has a C serialisation function which takes a pointer and converts a C  struct to a string.
It also (and is also designed to work) with C++ classes. But if I make a C++ class polymorphic by adding a virtual function this serialisation funktion segfaults or sometimes even worse provides wrong output.
I assume that it internally makes assumptions about the memory layout of the struct.
Is it possible to get a raw C pointer from a polymorphic C++ object?
I know that I could just create every struct twice, once polymorphic and once non-polymorphic, but this would lead to an insane amount of glue code.
Currently I am out of ideas.
Some technical background: The C function is in the RTI DDS Source package:
DynamicData.c DDS_ReturnCode_t DDS_DynamicData_to_cdr_buffer(...) { ..
Comment: I don't think vtable implementation is standard across compilers. I think you have to know size of your class and exact offsets if you want to do it at run time. Just my logical guess.
Comment: `It also (and is also designed to work) with C++ classes` I find it hard to believe. In C++, unless a class/struct is standard layout, it is very easy to enter UB land once you start messing with the internal representation of the data.
Comment: I guess, the question is what is the polymorphic part there. Do you need it? If you do, I find it hard to believe any serialization trick will help you, because you will loose polymorphism. And if you do not need it, why do you have virtual functions in the first place?
Comment: @SergeyA: What have in DDS is some kind of union type. So I fill in in this union type all classes in the inheritance tree. Then I use typeid to compare the type of the input object with the classes in the union and then I dynamic cast to the correct type that then will be serialized.
Answer: You could add a non-virtual base struct containing only the data:
struct DataXYBase {
    int data1;
    double data2;
};

class VirtualBaseClass : public DataXYBase {
    virtual void Function1();
};

class DerivedClass : public VirtualBaseClass {
    virtual void Function1();
};

and then cast to DataXYBase before passing it to the serialization function.
Answer: I think you should bundle all data in POD structs (which probably can inherit from each other)  and all accessors/logic in polymorphic classes which contain the data structs either as members (or possibly even via inheritance). You would serialize only the data part and provide trivial constructors for your polymorphic classes from a data structure.
That should limit the amount of necessary glue and still retain the desired polymorphism in your code.


What are the ergonomic / playing differences between the guitar and the piano?

Question: The guitar and the piano are two of the most popular instruments which allow multiple notes to be played simultaneously.
The acoustic quality of the two instruments are, of course, different, but that is not the focus of this question.
The design of the two instruments affects what and how music are played. Here are some differences I have in mind:

All semitones are treated equally on the guitar. Guitar chords (other than the open chords) can be moved up and down the fretboard without changing the finger shape. This also allows the player to shift the key easily. On the piano, the same chord takes different shapes in different roots due to the presence of black and white keys.
Regarding playing multiple notes at the same time, the piano is more flexible than the guitar.

The pianist use ten fingers to play the notes, while the guitarist uses only four (or five if you use the thumb), and at most six notes can be played at the same time (using a bar)
Since you use two hands on the piano, it's easier to play rhythm and melody at the same time.
On a guitar you can only play one note on a string, so the possible voicing of chords is restricted. On the piano you can pretty much play any voicing.

Strings on the guitar can be bended, for example, to create a vibrating sound. I'm not aware of an equivalent technique on the piano.
The piano has a wider pitch range than the guitar.

Do you agree? What other important differences can you think of? What are the implications of these differences, if any?
Comment: Unlike the other questions with requests for CW, I think this is a perfect example of a good CW question.
Comment: The title reminds me of an old German joke with the following punchline: "Ein Klavier brennt länger."
Comment: It looks like I don't have enough reputation to make it a CW. How can we flag it for moderator attention?
Comment: The OP can no longer make a question CW. I did flag for moderator attention, but they don't seem to have done it. Oh well.
Comment: I might add that the piano is capable of considerably more volume than the guitar, assuming no electronic amplification.
Comment: I've read the answers and saw no mention of "cheating" by capo use on guitar, not for piano.
Comment: You can play the same note on two (often adjacent) different guitar strings. Not a very common technique, but I have encountered it in some songs. It creates an interesting chorus affect which a piano can certainly not recreate.
Answer: All of your points are good; one of the reasons guitar became so popular in western culture in the early days, is because its portable.
So it's sort of a travelling minstrel's piano.  During the late 19th/early20th centuries in America(post emancipation act), there were lots of travelling musicians who couldn't afford a piano; and even if they could, they couldn't have carried one since most of their travelling was done on foot, they would literally play for a couple of meals and a night under a roof.  These are the guys that brought us the earliest forms of blues, like the Delta blues; which were basically the old slave work songs Blues'd up (call and response etc.).
If you scout around you can find old photos of these guys with the most battered looking old instruments you can imagine.
However you want to look at it (poor man's piano/portable piano), the portability and relative cheapness (guys would knock them together out of bits of random wood), is a major difference which helped start the wheel of popular music/culture rolling.
Another practical one is that the piano has pedals which can help the player control various aspects of the sound (sustain/velocity/etc.).
Comment: Some reed organs were extremely portable as well.  I don't know if any non-electric units were quite as portable as a guitar, but I've seen pictures of some which could fold to look like an over-sized suitcase.
Answer: The piano has limited ability at expressiveness (maybe not the right word). With a piano you can control how hard you hit the note and have maybe three pedals. While these all affect the sonic characteristic of a piano (it's overtone series), it's a limited range of affects. Guitar, on the other hand, has you interact directly with the string, providing a much wider range of playing styles (pick, finger pick, scrape, tap, hammer on, pull off, bend, etc.). In this respect, the guitar is closer to a violin than a piano.
Comment: Don't forget [piano](http://en.wikipedia.org/wiki/Piano#Early_history) is shortened from pianoforte. It was being compared to the harpsichord which only has one volume. While the piano can be played at normal volume or "stronger" (louder). So it is all relative.
Answer: Another difference is that the two hands play quite similarly on the piano, but quite differently on the guitar.  Guitar hands specialize in rhythm (right hand) and pitch (left hand).  I play guitar and it always amazes me how impossible it is to play on a left-handed instrument.  My left hand has no rhythm and my right fingers don't go where I want them.
Answer: One thing not mentioned: the guitar is also used to provide percussion by "golpe", a big part of flamenco playing. Many sounds can be produced, depending on where the guitar is hit, and with what part of the hand it is done. I don't recall seeing anyone banging on the piano as part of the music, but can't say it hasn't been done.
Answer: Some things I've noticed:

If 'position' playing on a guitar where you assign one finger to each fret in a single position and allow for stretches of one fret with the index and pinky, you have access to two octaves plus a perfect 4th. This is 29 semitones under your fingers or about a third of a piano keyboard in a single position. That's a lot of notes...
Piano can get away with more dissonant voicings than a guitar without them sounding too unpleasant - I realise this is subjective (and I have a few theories as to why this may be, mainly concerning range) but I'm yet to meet someone who disagrees.

An implication of the transposing nature of the guitar which I didn't see mentioned is that transposing in semitones is easier on a guitar (just shift the pattern/chord shape(s) up or down a fret), and transposing in a cycle of 4ths/5ths is easier on a piano (just add one accidental at a time). Therefore the guitar would seem to be a more convenient choice of harmony instrument when comping for a vocalist, as singers often need to transpose up or down a semitone depending on their range that day.
Comment: Good points. I'm intrigued by what you said about dissonant voicings on the piano. Can you elaborate a bit?
Comment: At first I agreed with you on the dissonance comment, but after fooling around on my guitar, I think it depends on your ear… what you find pleasant, and also on the quality of the guitar, strings and tuning. I played on two different guitars, and my good one had some pleasant-sounding whole-step dissonances, whereas my dad's old chinese beater sounded terrible. In both cases, the dissonances needed to be on the highest three strings to not sound muddy, but the piano (for me) is the same way.
Comment: I think it probably is subjective. An example that's one of my favourites is to play a minor 2nd, say E & F, which on it's own is very dissonant, but then also play a D in the octave below (or even two octaves below). The resulting chord could be thought of as a Dmin9 (or Dmin(add9) as there's no 7th) and I think it's a truly beautiful sound. That said, this voicing works pretty well on piano and guitar. I think having the ability to space a voicing over several octaves as one can with a piano gives you more leeway with dissonances. Though, as I say, this is subjective.
Comment: Also, listen to some Thelonious Monk and maybe even some Cecil Taylor. Some of their favourite voicings when translated to guitar (where possible) sound much harsher to my ears. Monk particularly loves to grab just the tritone that is the 3rd and b7th of a dominant 7th chord. Hard to do this on a guitar as often as Monk did and pull it off, imo.   ... @Josh: I definitely agree it depends on one's ear/personal taste/listening experience.
Answer: All good points.  One thing to note is the commonality of those instruments: both are string instruments where you can control the volume of notes individually at the time of its attack but where the basically long decay is pretty much predetermined and you basically can only dampen the note at some point of time (the guitar has slightly more ways for that, though).
It is also interesting to consider a few chimeras: there is the fretted clavichord which has fewer than one string per note and thus can also only play a limited number of chords.  There is the autoharp which has dampers in chord arrangement but is strummed manually.
It is also worth noting that there are several piano keyboard arrangements which share the guitar's trait of transposability of chord shapes, like Janko keyboards, and the more ubiquitous chromatic button accordion keyboards.
Chromatic button keyboards (which are available as full-size keyboards with velocity control, like the old Ketron MS80) are not really suitable for "pianoforte" kind of play where an actual striking action is initiated by a key and the loudness depends on its force: due to the "shaping" your hand needs to do, controlling loudness in addition would be hard.  Similar to how it is done with guitars, loudness control on actual accordions (rather than accordion-style flat keyboards) is left to the other hand (in this case the left).  While the left hand also has to deal with chord buttons, their fingering is much more simplistic than that of the melody hand.
Another note: you point out that one can do pitch bending on a guitar in spite of its fretting.  One can also do vibrato (which is quite more subtle than on unfretted string instruments).  Surprisingly, a similar action on an acoustic piano key has a very very subtle but not entirely inaudible effect as well though probably not through pitch variation.  The same action on an accordion is (again somewhat misleadingly) called "vibrato", is less subtle and more obvious to understand since it obviously transfers to the bellows action.
And of course in some modern music, (grand) piano players are expected to pluck some strings manually as well.
At any rate, one distinguishing feature of the piano is that the sound production and its manipulation are separated through levers, making it possible to "design" the keyboard.  This separation is present in other instruments as well, like the celesta or the harmonium.  To some lesser degree, some monophonic wind instruments use an arrangement of holes and levers to give an approximation of a diatonic scale augmented with "black keys" (if the underlying scale is not C major, those tend to be a candidate for transposing notation).  Even things like xylophones tend to use a diatonic black/white arrangement of notes.
With the exception of the chromatic button accordion I don't really know any instrument with "decoupled keyboard" where a regular chromatic arrangement with constant chord shaping would be in significant use these days.  The diatonic+semitones arrangement seems to have won except where dictated by physics, like directly fingered string instruments.
A guitar is, for all its size, a very portable and versatile instrument.  Even the smallest accordions weigh a multiple.  The most portable instrument with a "keyboard" would likely be a hurdygurdy, but then they are not in much use any more.
Answer: The guitar provides access to variable pitches and pure tones.
Variable pitches As noted by prior answers, guitarists can bend fretted strings for this effect. However no answer has yet mentioned slide guitar. Playing with a slide -- creating your own fret  -- allows players to access all sorts of microtonal pitches, above AND below the equal-tempered frets. In this fashion, a slide may readily facilitate access to just-tempered pitches (in any key). The (mis-named) tremolo arm of an electric guitar can also bend pitches, but not with the finesse of a slide. Two modern slide players include Duane Allman and David Gilmour. Their dramatically different styles illustrate the versatility of the slide.
Pure tones These pure tones are more commonly called harmonics. The guitarist has ready access to the vibrating string(s) and can create pure tones by damping the string at a nodal point for one of the fundamental frequency's overtones. With a combination of left and right hands, harmonics may be produced for fretted notes as well. Steve Morse incorporates this technique into his playing style.
Answer: Everyone seems to be add a bit to this here and there so I will too.
The guitar has been called a mimic instrument.  It can imitate the tone and quality of many other instruments.  This alluded to in a previous answer.  In some classical guitar scores the notation will indicate what instrument to mimic as an indication to the guitarist how to attack the strings.
I am not sure if this has been mentioned but unlike the piano the guitar typically requires both hands to work in concert to product sound.  I say typically because we do have hammer on and pull off techniques that allow us to play whole scales or melodic lines completely with the left hand.  But in this case we don't usually do something different with left.  On the piano each finger of each hand works independently.  Guitarists need to synchronize their hands for different reasons that a piano player does.
Piano has dynamics and variable sustain but really only one attack mode.  A guitarist can attack the strings in many different ways, each producing a unique tone.  This is what makes the guitar a mimic instrument.  You can use it a a drum and tap out rhythms on the body.  But I suspect you could do that on a piano top.
Answer: Rasgueado (aka Rageo, Rajeo, Rasgueo, Rasgeo) is impossible on a piano. Clusters are barely possible on a guitar. A (non-electric) guitar glissando ends more quietly than it starts: on a piano it needn't. On a piano a note's harmonics can only be sounded by striking its fundamental while holding down the harmonic's key. Long trills are possible on a piano: on a guitar they have to be hammered and are therefore (on a non-electric) rather quiet. On a guitar you can cross one string under another and then pluck them to produce a buzzing, out-of-tune effect. On a piano that's impossible, but pianos can be prepared.


how to set the font size of textview for listview in file java?

Question: I wonder how to set the font size listview in java..
does anyone want to help?
here is my code for listview :

<code>    Categories weather_data[] = new Categories[]
            {
                new Categories(R.drawable.dokter, "Cardiology"),
                new Categories(R.drawable.dokter, "Dentistry"),
                new Categories(R.drawable.dokter, "Dermatology and Venereology"),
                new Categories(R.drawable.dokter, "Disgetive Surgery"),
                new Categories(R.drawable.dokter, "ENT")
            };

    CategoriesAdapter adapter = new CategoriesAdapter(this,R.layout.listcategoriesitem, weather_data);

    lvcategories = (ListView)findViewById(R.id.lvcategories);

   lvcategories.setBackgroundResource(R.drawable.bawah2);

    lvcategories.setAdapter(adapter);
</code>
thx you :)
Answer: you can use custom adapter:
<code>private class CategoriesAdapter extends ArrayAdapter<Categories> {

        public CategoriesAdapter (Context context, int textViewResourceId,
                ArrayList<Categories> items) {
            super(context, textViewResourceId, items);
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View v = convertView;
            if (v == null) {
                LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = vi.inflate(R.layout.row, null);
            }
            Categories o = this.getItem(position);
            if (o != null) {
                TextView tt = (TextView) v.findViewById(R.id.tvCategoryName);
                if (tt != null) {
                    tt.setText(o.getName());
                    tt.setTypeface(typeface);
                }
            }
            return v;
        }
    }
</code>


How to set dscp for incoming TCP connections to my server?

Question: I need to specify dscp settings for the incoming TCP connections to my server. What is the easiest way to do that?
Answer: I presume you run linux. With iptables you can specify the settings
<code>iptables -t mangle -A FORWARD -p tcp --dport 21 -j DSCP --set-dscp 1
iptables -t mangle -A FORWARD -p tcp --dport 21 -s 192.168.0.0/24 --j DSCP --set-dscp-class EF
</code>
Comment: I was specifically asking os-agnostic because I didn't have a good idea about it - so this answer is great to get, because it helps me in my search. However, frankly, this was a Windows 2008 problem.


d3 change class of clicked node text

Question: I'm trying to add a class to the label, that was clicked in my force diagram. For this I use a "click" function, which hands the clicked item to the update function (it updates the class of the item). I tried using this but then the console will report "nodeClicked.childNodes[1].classed is not a function".
Then I googled and tried to use "d3.select(this).select("text");" which does not report an error, nor update the text.
A node is a < g > Element which has two children: a circle and the text (the text I want to give a css class)
If you want to, you can look at my code snippet:
// Toggle children on click.
// Also save information about what was clicked and update the GUI
function click(d) {
    if (d.children) {
        d._children = d.children;
        d.children = null;
    }
    else{
        d.children = d._children;
        d._children = null;
    }
    // Save which node was just clicked now
    nodeClicked = d3.select(this).select("text");
    // Save the d3 data of this node
    nodeClickedData = d;
}

To change the class I tested both:
$(nodeClicked).addClass("nodeGreenMarked");

and:
nodeClicked.classed("nodeBlueMarked", true);

But none did anything. If I check in the console what content nodeClicked is, it tells me "Array[1]" and when I open it: "0:< text >"
Comment: Can you show a sample of the svg?
Comment: This is the one I used: http://bl.ocks.org/d3noob/8375092
Is the console output "Array" correct?
If I just used "this" there was the correct svg text element there, but also the error "classed is not a function"
Answer: You can add class in two ways.
d3.select(this).select("text").attr("class",className);

OR
d3.select(this).select("text").classed(className,true);

Working Snippet:

d3.selectAll(".node").on("click", function() {
  //check if node is already selected
  var text = d3.select(this).select("text");
  if (text.classed("selectedText")) {
    text.classed("selectedText", false);
    //Remove class selectedNode
  } else {
    text.classed("selectedText", true);
    //Adds class selectedNode
  }
});
.node {
  cursor: pointer;
}
.node circle {
  fill: #fff;
  stroke: steelblue;
  stroke-width: 3px;
}
.node text {
  font: 12px sans-serif;
}
.link {
  fill: none;
  stroke: #ccc;
  stroke-width: 2px;
}
.selectedText {
  fill: red;
}

<svg width="960" height="500">
  <g transform="translate(120,20)">
    <path class="link" d="M0,262.85714285714283C90,262.85714285714283 90,197.1428571428571 180,197.1428571428571"></path>
    <path class="link" d="M0,262.85714285714283C90,262.85714285714283 90,328.57142857142856 180,328.57142857142856"></path>
    <path class="link" d="M180,197.1428571428571C270,197.1428571428571 270,131.42857142857142 360,131.42857142857142"></path>
    <path class="link" d="M180,197.1428571428571C270,197.1428571428571 270,262.85714285714283 360,262.85714285714283"></path>
    <g class="node" transform="translate(180,328.5714416503906)">
      <circle r="10" style="fill: rgb(255, 255, 255);"></circle>
      <text x="13" dy=".35em" text-anchor="start" style="fill-opacity: 1;">Level 2: B</text>
    </g>
    <g class="node" transform="translate(180,197.14285278320312)">
      <circle r="10" style="fill: rgb(255, 255, 255);"></circle>
      <text x="-13" dy=".35em" text-anchor="end" style="fill-opacity: 1;">Level 2: A</text>
    </g>
    <g class="node" transform="translate(0,262.8571472167969)">
      <circle r="10" style="fill: rgb(255, 255, 255);"></circle>
      <text x="-13" dy=".35em" text-anchor="end" style="fill-opacity: 1;">Top Level</text>
    </g>
    <g class="node" transform="translate(360,262.8571472167969)">
      <circle r="10" style="fill: rgb(255, 255, 255);"></circle>
      <text x="13" dy=".35em" text-anchor="start" style="fill-opacity: 1;">Daughter of A</text>
    </g>
    <g class="node" transform="translate(360,131.42857360839844)">
      <circle r="10" style="fill: rgb(255, 255, 255);"></circle>
      <text x="13" dy=".35em" text-anchor="start" style="fill-opacity: 1;">Son of A</text>
    </g>
  </g>
</svg>
Comment: I also tried the "attr" command, and even the "style" command which did not work out. I guess when running the code, it is still somehow not adressing the correct element. Even I checked in the debugger a thousand times. It really is strange. But I found a solution using pure Javascript which finally worked for me! Thank you for your help. :)
Answer: D3 did somehow not correctly address the correct element (the text of the group element), no matter which of the possible methods I used (jQuery did somehow also fail). I must have keeping to oversee something really important, though I checked everything like 5 times.
No matter, I found a working solution: by adressing the DOM elements with pure javascript. The command I used to solve this and get the class applied correctly was
nodeClicked = this;
...
nodeClicked.classList.add("greenNode");

This adds the class greenNode to the group element. In my CSS file I wrote .nodeClicked text and put in the necessary CSS. So if you once also have problems addressing the correct element, you can also try to use this method.
Comment: I can not yet mark this one as "correct answer" - have to wait 2 days...
Comment: I don't know who downvotes a correct answer, but well... for me the pure Javascript solution worked.

d3 change class of clicked node text


saltstack/pacemaker: pcs module fails to create operations options

Question: I am trying to create a pacemaker resource following salt.states.pcs which works fine, until i try to set e.g. the monitor interval and timeout values (or any other op values).
E.g.: pcs resource create VirtualIP ocf:heartbeat:IPaddr2 cidr_netmask=24 ip=192.168.16.20 op monitor interval=30s start interval=0s timeout=20s stop interval=0s timeout=20s
works without any problem. When I then try to put this in a salt state like
pcs_resource_VirtualIP:
  pcs.resource_present:
    - resource_id: VirtualIP
    - resource_type: ocf:heartbeat:IPaddr2
    - resource_options:
        - cidr_netmask=24
        - ip=192.168.16.20
        - op monitor interval=30s
    - cibname: cib_for_VirtualIP

it always fails with
2022-10-13 13:33:47,167 [salt.loaded.int.module.cmdmod:881 ][ERROR   ][26701] stderr: Error: invalid resource option 'op monitor interval', allowed options are: 'arp_bg', 'arp_count', 'arp_count_refresh', 'arp_interval', 'arp_sender', 'broadcast', 'cidr_netmask', 'clusterip_hash', 'flush_routes', 'iflabel', 'ip', 'lvs_ipv6_addrlabel', 'lvs_ipv6_addrlabel_value', 'lvs_support', 'mac', 'network_namespace', 'nic', 'noprefixroute', 'preferred_lft', 'run_arping', 'send_arp_opts', 'trace_file', 'trace_ra', 'unique_clone_address', use --force to override
Error: Errors have occurred, therefore pcs is unable to continue

I already tried to start with just resource_option only op but then it fails with
2022-10-13 13:35:51,422 [salt.loaded.int.module.cmdmod:881 ][ERROR   ][26971] stderr: Error: When using 'op' you must specify an operation name and at least one option

In the documentation i couldn't find how to add the op values for a resource.
Versions i am using:
salt-master 3004.2
salt-minion 3004.2
pcs 0.10.12

Answer: Probably every argument needs to be passed separately:
pcs_resource_VirtualIP:
  pcs.resource_present:
    - resource_id: VirtualIP
    - resource_type: ocf:heartbeat:IPaddr2
    - resource_options:
        - cidr_netmask=24
        - ip=192.168.16.20
        - op
        - monitor
        - interval=30s
    - cibname: cib_for_VirtualIP

There's also the pcs.resource_op_defaults_to state function, which may be of use.


stone weierstrass approximation theorem for simple functions: does it exist?

Question: The most general version of the theorem (I have seen) states that a function from a compact metric space into reals can be approximated by an algebra of functions that maps in the same way, is continuous, separates points, is non-vanishing.
I wonder, apologies if the question is trivial (I am not a mathematician), what happens when the function of interest maps from a compact metric space into a finite set consisting of real numbers? I believe such functions are called simple functions (am not sure).
Is there a version of the theorem for such a case?
What worries me that such mappings look horribly non-continuous, and continuity seems to be a key requirement in all proofs of the theorem I've seen.
Note: I need to use the theorem in the way I presented (checkig for algebraic properties, separations property etc). Please try to suggest a similar formulation, if there is such.
An example: Imagine that I want to approximate a function f that takes a series of 100 numbers (each number from an interval [0,1]) and returns +1 if they are sorted, -1 if they are not. This is a complicated function though mathematically it is classified as a simple function (I think): it maps from a compact metric space (100-tuples or reals) into a finite set {-1,1}. At my disposal I have an algebra of functions I can use to carry out the approximation. What do I need to ask about that algebra in order to make sure I can find a good approximation for f? Should I proceede like usual as the SW instructs me to do (check separation property, etc) or do something else?
Best
Zoran
Answer: As has been described, you can't uniformly approximate simple functions via continuous functions. Simple functions are, true to name, probably the simplest discontinuous functions, so I wouldn't expect to get a uniform approximation result with other obvious candidates, but if you have a particular algebra in mind do tell us about it.
On the other hand, simple functions can be approximated by polynomials (so certainly by continuous functions) in a looser sense: if $f$ is simple there's a sequence of polynomials $g_n$ converging to it in terms of $\int_X |f-g_n|$. To make this detailed you have to have a finite measure on your metric space, but in some cases (subsets of $\mathbb{R}^n$) there's a reasonably obvious metric associated to the topology. This kind of approximation is good enough for many applications.
Comment: that won't work for me. the algebra that is to be used to approximate has a feel of the set of simple functions that map from a compact metric space. the algebra has nothing to do with polynomials. gee, this is turning really nastier than I though... the problem is that I am using simple functions (a class off) to approximate any simple function.
Comment: I have added an example.
Answer: The uniform limit of a sequence of continuous functions is continuous (at least for functions defined on a closed interval, and the same is probably true on any compact space) is itself continuous, so if you want to approximate all simple functions by continuous functions, you're out of luck.
If you drop the continuity requirement and just try to approximate using functions from some algebra, then the simple functions themselves are an algebra, so the question becomes trivial.
Comment: Imagine a situation where the algebra I want to use to carry out the approximation is a complicated beast. I can check it is an algebra, has the key properties (separation, etc). I would like to know whether I can approximate any function on a compact metric space which maps into a finite set of reals. Are you telling me that there is no need to check that I indeed have an algebra and, most importantly, that it has these key properties? Is it enough just to check that what I want to approximate with is an algebra? Please bear with me, I am not a mathematician.
Comment: @zorank I see, so you have a *particular* algebra (at least hypothetically) and want to check if it can approximate simple functions. In my second paragraph I was addressing the question "is there *any* algebra which can approximate simple functions", hence why I said that since simple functions are themselves an algebra, the question is trivial. But that doesn't really help in your case.
Comment: Indeed. This is exactly the problem. In fact, the algebra is very real and not at all hypothetical. I would like to gain some understanding of what I have to check with that algebra to make sure I can approximate simple functions that operate on compact metric spaces. I am curious if there is a theorem that might help. I think there are theorems that state that one can approximate any integrable function with simple functions. A simple function is certainly integrable. But then to use these theorems I would have to learn tons of other things. I'd like to stick to Stone-W. if possible.
Comment: I guess what I am asking is whether there is a version of SW theorem for piecewise continuous functions (never mind that the typical function of interest will be mostly constant on the interval).


Standard error logic

Question: Obviously the closer the standard error to zero the better. However, what if the values the in which the standard errors are from are extremely large and the standard errors are much higher than zero but proportionately small.
For example:
What if you have a model with a slope coefficient of 0.5 and the standard error was 0.05 and another model with a slope coefficient of 1000 and a standard error of 10.
Would the latter be considered a better standard error?
Comment: The better model is the model that is more correct. The standard error is meant to reflect the uncertainty in the parameter estimator. We don't want a model that makes it seem that the estimator is very precise, if in fact, for example if there are violations of model assumptions, the estimator may not be reliable at all. It is unclear whether you mean the theoretical or estimated standard error here; for sure if our estimator is indeed imprecise, we *want* the estimated standard error to be large so that we can see this correctly.
Answer: This could be where the p-value comes in.
In the first case, the estimated parameter is $10$ standard errors away from zero. This will result in a small p-value.
In the second case, the estimated parameter is $100$ standard errors away from zero. This will result in an even smaller p-value.
To some extent, this depends on the sample size (at least for t-stats, but not for z-stats), though that should not be much of an issue for so dramatic of a difference as $10$ and $100$.
Comment: Thanks Dave, I am new to stats. Is there a rule of thumb for how many standard errors from zero is good/acceptable?
Comment: It depends on your chosen $\alpha$-level ($0.05$ is common, for better or for worse), and your sample size. For a decent number of degrees of freedom, two standard errors roughly corresponds to a p-value of $0.05$. You can get finer details by consulting software or t-charts.

Standard error logic