text:
Q: How long can Moderator Resignation notices be featured? How long are moderator resignation posts allowed to be featured in the sidebars of our sites?

A: Moderators are high-visibility community figureheads. They're usually well-respected, often well-liked, and on some sites are the center of their communities. I've seen it on a number of sites: from Worldbuilding, where the mods grew the community and earned the respect and trust they were given because of it, to Stack Overflow the behemoth, where the responsibility itself confers respect - and, for those who frequent Meta and get further into the community, where interactions with the moderators raise them as the best the community has to offer.
Their departures are - if not a momentous occasion - certainly not something insignificant to a community. A moderator's resignation is certainly more important to the people on a site than other procedural matters. Procedure will wait; people don't tend to.
Why, then, should we attempt - why, then, would Stack Exchange be so foolish as to attempt - to restrict the community's chance to give back to their moderators what their moderators have offered them?

A: Presumably as long as the community thinks that they should be. I am not aware of any SE policy that dictates what or how long something can be featured. I would hope that SE would never be so foolish to try and regulate what content a community wishes to feature*
*As long as that content does not violate the CoC and is on topic.

A:
Lately, we have had an increase of resignation posts that have served to host combative and hurtful words to attack Stack employees, other mods, and teammates. We need to be mindful of this and limit the time the posts are featured.

You're doing it ridiculously wrong. Why don't you give up eating because you might choke? So then why are you removing features because it might attract attack? This is pretty counterproductive and illogical. You should focus on solving the problems themselves, not "solve" the place where problems may (but don't necessarily) arise. Doctors cure a patient's illness, not kill the patient altogether just because they're sick.

We still value people posting these when they're stepping away from the team. We also value folks being able to say their goodbyes, and we want to continue to feature these resignation posts.

You DON'T. By featuring resignation notices for longer, more users see it and have a chance to say thanks to the departing moderator. It's the matter of a community. You're showing blatant disrespect to the community and the people who devoted themselves to it by carrying this policy out.
It may be harsh to say, but what you value are your blog posts and product announcements, where the community can't even say a word. While this is purely an assumption, if one of the resignation notices resulted in millions of dollars in revenue, you would have featured it indefinitely. You no longer care about the community as you did at the inception of Stack Overflow, going back to the early part of this decade (the 2010s).

But we need to keep an eye on the length of time that these featured posts can be in the sidebar.

You said keep an eye on, which implies that you think having them featured for a prolonged period is something bad. This is also contrary to what the community thinks. Nevertheless, I'd say this is the only true statement in the whole of your answer. Good job, Stack Exchange, for being brave and stating it aloud.

A: Short of SE publicly requiring us to, I can't imagine any reason we would artificially shorten how long a resignation notice is featured.

A:
Lately, we have had an increase of resignation posts

Hint: great. You identified the most important symptom!
You are just one step away from identifying the root cause. As soon as you figure that root cause, you would be able to engage in activities to fix the root cause(s).
And guess what: without moderators (and ordinary users) resigning left and right, and slamming doors on their way out, there would be no need to worry about said individuals being upset and emotional, and (supposedly) losing their temper. Or other people reacting to such resignation notes in inappropriate ways.
But I don't want to talk away the amazing experience of SE Inc. solving that mystery about the root cause(s) themselves, but bonus hint: you might want to create a table and write down the reasons why aforementioned community members are walking away. And then see if you can spot some common, underlying themes.

A: The cat's out of the bag, so may as well post what prompted this here as well.
@JuanM posted the following in the moderator-only team yesterday:

Moderator resignation announcements have traditionally been encouraged as opportunities for former teammates to say a goodbye and have others wish them well. They are things we want the community to share in and respond to. Due to recent events however, these resignations have become more and more a place for people to post hurtful words and attack Stack employees, other mods, teammates, and community members.
We still value people posting these when they're stepping away from the team. We also value folks being able to say their goodbyes and we want to continue to feature these resignation posts. However, moving forward we can only allow them to be featured for a day. After that period, we ask that you un-feature the post or ping a CM to do it. The original posts will continue to be a part of Meta but they won't show in the sidebar.

A: As far as I know, there are no publicly stated rules regarding this issue (as of the time of posting). As such, the decision to feature or unfeature a post on a Meta site is left entirely in the hands of the moderators of those communities, as far as I know (and ostensibly SE would only have reason to intervene if the site were left with no active moderators). Intervention by staff to unfeature a post outside of such limited circumstances would likely be seen as a tone-deaf and bizarre move, and would be very obviously and widely unpopular.
Unless the tag is removed from a question early, it will automatically be removed by the Community user after approximately 30 days (though apparently this can sometimes take a few days longer). Whether a question with the tag appears in the "community bulletin" block of links seems to follow a slightly more complex set of rules, though a post could technically "featured" by virtue of having the tag even if it doesn't end up appearing in the community bulletin.
Given that changes in moderatorship are generally very significant occasions, especially moderator-initiated resignations, I generally see no reason why such a resignation post would (or should) be unfeatured early, i.e. before the approximate 30-day period has passed (after which the post would be unfeatured automatically).

A: When a moderator resigns, this is an important event for a site. It should have the highest visibility, so it should be featured as long as (or longer than) other posts, I should think.

A: Should be up to each site.
If any post attracts rude remarks, moderators can, & routinely do, delete them. If a post is thought especially liable to attract rude remarks, it can be locked, completely or with regard to  comments only; limiting the amount of time it's featured for isn't going to effectively put a stop to them. I'm racking my brains to think of another reason SE might not want posts about resignations to be featured ...

A: Elections for moderators are featured for about a month.
Featuring the opposite should be on the order of one week
Barring some exceptional circumstances like a new election or combination post addressing several changes together that is still featured or pinned. If the moderator is stepping down on principal or protest, perhaps err on the longer side to be sure the community can adjust.
If people are not civil in these posts, as with any other place here, that shouldn't change the length of featuring news about leadership changes. Handle directly source of acting out via edits, locks, coaching, moderation or votes and deletions as appropriate.

A: Good news: As of 2020-02-10, the moderator resignation posts follow the same guidelines as any other featured post.
Bad news: Very wide criteria for a post to be unfeatured including, but not limited to antagonistic posts, posts having usernames & real names, drawing disruptive behaviour or discussion. Moreover, special attention will be paid to the titles of potentially/currently featured posts.
The text below reflects the month-long reflection on the controversial 24-hour policy on moderator resignation posts that was applied once on StackOverflow.

Currently, the featured tag was removed from resignation notice of Madara Uchiha on StackOverflow after only 2 days: this revision #7 in particular and repeated in a rollback-revision #10
This is significantly LESS than the standard time
I strongly oppose the practice of limiting moderators' resignation notices to such a short period. I would consider that a moderator resigning from the position is an important enough event for a community – so that it is listed as featured the standard amount of time.
Making it listed as featured for a very short time means it is not important enough compared to other potential announcements. Which I doubt can even be the case for any community. Sorry for my slightly egoistic and biased view on that. Not everybody (even the most active community members) accesses the website every single day and it is strange to expect it.
Quote from Juan's answer:

Lately, we have had an increase of resignation posts that have served to host combative and hurtful words to attack Stack employees, other mods, and teammates. We need to be mindful of this and limit the time the posts are featured.

We can and should fight hurtful words and direct attacks on Stack employees and other community members, that's what moderation is for. We have mechanisms for that, so let's use it without limiting the respect to fellow moderators who decided to resign after doing it for a long time, after they already spend years of their life to actually fight with personal attacks and rudeness.
I strongly disagree with imposing any custom rule for these sorts of featureding.

A: I cannot in good conscience unfeature a post commemorating a member of the community who was a mod or otherwise contributed above and beyond to the community .  As far as MSE goes - hopefully there will be no further need for the mod team to feature posts of people leaving. As far as Super User goes I suspect we will discuss this when it comes to it.
While I respect the CMs we have left, I don't think its fair either to put them in a spot to do something I am personally uncomfortable with for matters of ethics and community.

Due to recent events however, these resignations have become more and more a place for people to post hurtful words and attack Stack employees, other mods, teammates, and community members.

As difficult as it is some days - dealing with this is part of the role of a Moderator. Unfortunately, it gets more difficult without support from the company and with actions that encourage the worst of us, and the loss of the more moderate voices.
If we fear our darkest impulses, and hide from them, in the dark, what hope is there for the light?

Moderator resignation announcements have traditionally been encouraged as opportunities for former teammates to say a goodbye and have others wish them well. They are things we want the community to share in and respond to.

We watch out for, and remember our own. If we're restricting this due to fear, we're lost. We have lost.
I suggest perhaps your bosses need to consider why the community has been growing increasingly hostile and combative, rather than try to muzzle us.

A: Featuring announcements and discussion questions for only one day misses the entire point. No one (to within rounding error) will see them.
The whole reason we feature these things is to ensure that they are visible to the community at large. Only the most highly dedicated members of our communities visit the site every day. This level of dedication is, in fact, so exceptional that we recognize it with two different badges: "Enthusiast" and "Fanatic". Featuring a post for only a day would mean that only this most dedicated subset of users see the announcement, effectively hiding it from everyone else.
Furthermore, these highly motivated users who visit the site every day are not who we're targeting with featured posts anyway (here I'm speaking of posts featured on per-site Metas; the global Meta may be different), since these highly invested users tend to read Meta anyway. The reason we feature posts is to ensure that folks who don't visit the site and read Meta every day will still hear about and be allowed to share feedback on the topic.
On Stack Overflow, when we have proposals to make major modifications to the tagging system (a process called "burnination", which implies a cleanup and retagging effort), we feature those discussion posts in order to ensure that the tag experts out there and others with a stake in the process will be sure to see them and, if they chose, provide their input. This input is extremely valuable to us as moderators, since we are not subject-matter experts on all topics covered on our site, and we want to know if what is being proposed would cause hardship or other inconvenience to the users who are actually providing answers to questions. In effect, it gives people a chance to say "no, don't do this" and/or to propose alternatives that we had not considered. At an absolute minimum, we require that these proposals be featured for 36–48 hours, not counting weekends. If they are controversial (i.e., strong consensus is not immediately obvious), then we will leave them featured even longer.
On Stack Overflow, when we announce things like the results of moderator elections, changes to site features, and so on, we typically leave them featured for 2 weeks. I don't know if this is just a custom, or if it was formally enshrined in site policy at any point, but it is definitely the custom that the Stack Overflow moderators follow.
You might argue that this duration of featuring is unnecessarily long, but I regularly see users showing up at the end of this two-week period posting new answers/feedback, obviously seeing it for the first time. Plenty of people don't even see it after two weeks. Not everyone is deeply committed to the site: some people just use it as a tool to get their job done. Yet, we should not assume that these people do not care about the site. Their voices still matter.
And that's Stack Overflow, without question the largest and highest-traffic site on the network. On smaller sites, visits are going to be even more sporadic.
For a company that claims to be dedicated to inclusivity and community, the policy proposed by Juan seriously misses the boat.
Juan claims that:

We still value people posting these when they're stepping away from the team. We also value folks being able to say their goodbyes and we want to continue to feature these resignation posts.

…but this rings hollow.
By insisting upon unfeaturing Madara Uchiha's resignation post on Stack Overflow over the strident objections of the current moderator team, Juan has disrespected, in particular, Madara himself, but also the rest of the community who has tirelessly built, nurtured, and advocated for these sites over the past decade.
Salt is rubbed into the gushing wound by the fact that "thank you" posts for Shog9 and Robert Cartaino continue to be featured here on Meta Stack Exchange. As much love as I have for both Shog and Robert, and as much as I'll miss them, I'll never be able to understand why they deserve more time in the spotlight than a long-serving, community-elected Stack Overflow moderator.
Shog and Robert aren't the only people to get special treatment, either. A post from called2voyage, announcing their "leave of absence from moderating" on the Astronomy Meta site has been featured for 2 full days. As has El'endia Starman's resignation announcement on the Christianity Meta site.
When the all of the evidence is considered, this is laid bare as nothing but a direct, shameful personal attack on Madara Uchiha and perhaps the rest of the Stack Overflow moderator team, who were previously told that they would have direct control over which posts were featured on their site.
As an attempt to justify this new "policy", Juan notes:

resignation posts […] have served to host combative and hurtful words to attack Stack employees, other mods, and teammates.

It's unclear to whom his use of the word "teammates" refers, but as other answers have pointed out, "combative and hurtful … attacks" are not appropriate in response to moderator resignation announcements or anything else. If these appear, they will—and, indeed, are—removed by moderators. I have been quite diligently monitoring Madara's resignation post on Meta Stack Overflow, and I think that the overall reception has been abundantly positive. Consider, for example, the following excerpt from ndugger's answer, among the top-scoring answers:

You have been the best moderator that I have interacted with on SO. I could always count on you to make the right decision, even when it came to kicking or muting me. You've done everything you could to hold down the fort. I have been generally impressed with how you deal with pressure, and how you decided to moderate a rowdy group of programmers.

High praise, indeed. It's difficult to see how content like this is creating a problem. Perhaps the concern is the posts that cite missteps on the part of Stack Overflow management, linking them to the resignation. However, these are not personal attacks on any individual. One of the purposes of Meta has always been to discuss site policies, and that includes disagreement with them, as long as said disagreement is civil. I submit that it has been.
Even putting on my cynic's hat for a moment, trying to put aside any emotions that this brings up for me and think about it strictly from the perspective of financially-motivated stakeholders in the company, the desire to suppress criticism of and negative publicity for the company is an understandable instinct. Yet, a policy like the one Juan announces serves only to make the problem worse. The phenomenon is well-documented, and known as the Streisand effect. By trying to censor these posts, Juan's actions have created a veritable firestorm—including this very discussion, this other one, and several more over on Meta Stack Overflow—all of which reflects far more negatively on the company than the resignation post itself.

A: The previous policy of only featuring them for 24 hours has been rescinded. Instead, now they are subject to the same guidelines as any other featured post and can be featured for longer.

Keeping the old answer below for context:

Moderator resignation posts will be featured for around 24 hours
  moving forward. We will not remove the posts from Meta but the
  featured tag needs to be removed after that time.
Lately, we have had an increase of resignation posts that have served
  to host combative and hurtful words to attack Stack employees, other
  mods, and teammates. We need to be mindful of this and limit the time
  the posts are featured.
We still value people posting these when they're stepping away from
  the team. We also value folks being able to say their goodbyes and we
  want to continue to feature these resignation posts. But we need to
  keep an eye on the length of time that these featured posts can be in
  the sidebar.


text:
Q: How to compose portion of letter recurrence in this code of C ++ will work? You can see here that the code has three parts. The primary portion and the moment portion inquired me to discover out the line and word number which I did. But when I call the third portion (i.e. letter_frequency function) that portion doesn't appear in the console. I looked at numerous places but did not discover a reply. I would have profited in case anybody may if it's not too much trouble reply.
Expected Output :
Enter Your String :
Hey Lisa
how are you doing#
The input has 2 lines, 7 words, and the following letter frequencies :
A:2 B:0 C:0 ...like this
Output Now :
Enter Your String :
Hey Lisa
how are you doing#
The input has 2 lines, 7 words, and the following letter frequencies :
#include <iostream>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<string>
#include<cstring>
void letter_frequency(char le[]);

    int main()
    {
        char str[400] = " ";
        int words = 1;
        int lines = 1;

        cout << "Enter Your String : ";
        cin.get(*str);

        while (*str != '#')
        {
            cin.get(*str);
            if (*str == ' ' || *str == '\n')
                words++;
            if (*str == '\n')
                lines++;
        }

        cout << "The input has " << lines << " lines, " << words
            << " words," << " and the following letter frequencies : \n";
        letter_frequency(str);

        return 0;
    }

    void letter_frequency(char le[])
    {
        //for Capitals
        int sum = 0;
        for (int i = 65; i <= 95; i++)
        {
            sum = 0;
            for (int j = 0; j < sizeof(le); j++)
            {
                if ( (int)le[j] == i)
                {
                    sum = sum + 1;
                }
            }

            if (sum > 0)
            {
                cout << (char)i << ": " << sum << "\t" << endl;
            }
        }
        //For Small
        for (int i = 97; i <= 122; i++)
        {
            sum = 0;
            for (int j = 0; j < sizeof(le); j++)
            {
                if ( (int)le[j] == i)
                {
                    sum = sum + 1;
                }
            }

            if (sum > 0)
            {
                cout << (char)i << ": " << sum << "\t" << endl;
            }
        }
    }

A: First, unless you are forced to use raw char arrays by your professor as a learning exercise, you should certainly be using std::string instead.
Second, without digging too much into whether the code actually does what it promises, the main error I suspect you are encountering is in your for loops:
for(int j=0; j<sizeof(le); j++)

The problem is that le is of type char[], which has no size baked into it and is another way of saying char*. Thus your use of the sizeof operator is really returning the size of a char* which is probably always 4 or 8, depending on your target architecture. What you need to do is either:

*

*Use std::string and then call the length() function (preferred option).

*Pass the size in with the string, e.g., make the signature: void letter_frequency(const char le[], const std::size_t len) and then pass the value as the second param. (const added since you don't want to modify those params within the function. The compiler can help you avoid mistakes.)

*Compute the size inside the function by calling std::strlen() or similar.

*Accept a known size: void letter_frequency(const char le[400])

*Use a template to deduce the size, and then your sizeof statements will work:

template<std::size_t N>
void letter_count( const char (&le)[N] )

redpajama_set_name: RedPajamaStackExchange


text:
Q: Joda-time: convert jodaTime with timezone Please help me with this case:

*

*pick a date from front-end, like 3/8/2016 05:53:00

*A user's timeZone is GMT-08:00, plus with 8 hours, save it to DB as 3/8/2016 13:53:00

*B user's timeZone is GMT-10:00, plus with 10 hours, save it to DB as 3/8/2016 15:53:00

*A and will see 3/8/2016 05:53:00 on page after we convert the date from Database.

I think we can write a util to convert datetime, plus or minus it.
Is there a stand way to implement it?

A: Pick the date and add the times one for the conversion.
All the Joda timezones are here:
Example:
final DateTime dt = new DateTime();
// translate to Honolulu local time
final DateTime dtVancouver = dt.withZone(DateTimeZone.forID("Etc/GMT+8"));
final DateTime dtHonolulu = dt.withZone(DateTimeZone.forID("Etc/GMT+10"));
System.out.println(dt);
System.out.println(dtVancouver);
System.out.println(dtHonolulu);


text:
Q: Input Pins having voltages (5V) I am currently working on a microcontroller based system, the issue i am facing is that my inputs pins 40 and 39 of atmega32 are somehow getting internally high, Pin40 shows 2.5 volts and Pin39 shows 5v on my voltmeter. As far as I understand the pins are getting high due to code but I have cross checked several times but still cant figure out the issue with my code.
I am including the circuit diagram and code as well. Can any one please point out how my input pins are showing voltages.

#ifndef F_CPU
#define F_CPU 16000000UL // 16 MHz clock speed
#endif

#define D0 eS_PORTD0
#define D1 eS_PORTD1
#define D2 eS_PORTD2
#define D3 eS_PORTD3
#define D4 eS_PORTD4
#define D5 eS_PORTD5
#define D6 eS_PORTD6
#define D7 eS_PORTD7
#define RS eS_PORTC6
#define EN eS_PORTC7

#include <avr/io.h>
#include <util/delay.h>
#include "lcd.h"

void Init_ADC(void)
{
ADMUX|=(1<<REFS0);
ADMUX&=~((1<<REFS1)|(1<<MUX0)|(1<<MUX1)|(1<<MUX2)|(1<<MUX3)|(1<<MUX4));
// SELECTING CHANNEL0
ADCSRA|=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS0);
// NORMAL CONVERSION WITHOUT INTERRUPT
ADCSRA&=~((1<<ADSC)|(1<<ADATE)|(1<<ADIF)|(1<<ADIE)|(1<<ADPS1));
// CLOCK/32 SPEED
}
unsigned int Read_ADC(uint8_t ch)
{
ADMUX&=0b11111000;
ch=ch&0b00000111;
ADMUX|=ch;
//Start Single Conversion

ADCSRA|= (1<<ADSC);
// Wait for conversion to complete
while(ADCSRA & (1<<ADSC));

// Clear ADIF by writing one to it
//ADCSRA|=(1<<ADIF);

return(ADCW);
}

void Wait()
{
uint8_t i;
for(i=0;i<20;i++)
_delay_loop_2(0);
}

int main(void)
{
int v,v1,v2,vref;
vref = 409;
DDRD = 0xFF;
DDRB = 0xFF;
DDRC = 0xFF;

Init_ADC();
Lcd8_Init();

while(1)
{
    v2 = Read_ADC(1);
    if(v2>=900)
    {
        Lcd8_Set_Cursor(1,1);
        vref = Read_ADC(0);
        Lcd8_Write_String(" Ref. Set");
        _delay_ms(2000);
        Lcd8_Clear();

    }
    else
    {
        Lcd8_Set_Cursor(1,1);

        v1=Read_ADC(0);

        if(v1>=1.05*vref)
        {
            v=0x01;
            Lcd8_Write_String(" HIGH");
        }
        else if(v1<=0.95*vref)
        {
            v=0x01;
            Lcd8_Write_String(" LOW");
        }
        else
        {
            v=0x00;
            Lcd8_Write_String(" OK");
        }
        PORTB=v;
        //Wait();
        _delay_ms(2000);
        Lcd8_Clear();
    }
}

}
Thnks everyone in advance !!

A: Setting PORTxn will enable the pullup on the associated input. Reset it in order to disable the pullup.


text:
Q: How to structure a Visual Studio 2012 Solution to host 2 Angular 1.x applications inside Asp.Net projects and yet a common library for Javascript? Our team is migrating two related applications form ASP.net to Angular~1.5. These two applications share the database and some code and, therefore, are part of the same solution.
To ease the server-side related issues, we created a folder on each site to hold its own app, as we're incrementally moving functionalities from Asp pages to Angular. Each app is built by its own copy of a gulp-based process.
We have this setup working and the apps build ok, but I'm not very happy with the location for the Javascript code that is shared between the apps. As VS2012 does not provide a better alternative, we've created a folder inside app1 for our shared code and reference it from both app1 and app2.
MySolution            (Visual Studio 2012 solution)
|-MyProject_1/        (legacy Asp.Net project)
|-|-MyAngularApp_1/
|-|-|-MyApp_1/        require("../MySharedDir")
|-|-|-MySharedDir/    <== shared library implemented here
|-|-|-package.json
|-|-|-gulpfile.js
|-|-- ...
|-MyProject_2/        (legacy Asp.Net project)
|-|-MyAngularApp_2/
|-|-|-MyApp_2/        require("../../MyProject_1/MyAngularApp_1/MySharedDir")
|-|-|-package.json
|-|-|-gulpfile.js
|-MyWebApi/           (WebApi project)
|-|-- ...

Is there a better way to organize the structure of the solution?


text:
Q: Fixing typescript error in the return type of my function I have this function that returns an array of strings or undefined, typescript correctly infers the return type :

However if I explicit state that return type in the function I get an error:

How can I fix this?

A: Typing the return value of an arrow function should be done after the parentheses, like this:
    const myFunction = (numbers: number[] | undefined): number[] | undefined => {
  return numbers?.filter(num => num !== 1)
}

You can read more about Function Types in the official documentation.

A: Check more about adding type for arrow function here
it should be:
export const getBannerImgsId = (componentSlot: ContentSlot): string[]|undefined => {
 // your codes
}

or
export const getBannerImgsId = (componentSlot: ContentSlot): (componentSlot: ContentSlot) => string[]|undefined => {
 // your codes
}

or for the way I'm doing. ( I think it would be better for teamwork )
type BannerFunction = (componentSlot: ContentSlot) => string[]|undefined;

export const getBannerImgsId = (componentSlot: ContentSlot): BannerFunction  => {
 // your codes
}


text:
Q: Invalid date format with a custom format for Firefox and .diff not working While testing my program I noticed that, while the date works well on Chrome and it gives me a valid one, for Firefox I receive an Invalid Date while trying to run the following code:
var dateToConvert = $filter('date')(resourcehelper.getLocalDate(jm.logging.subordinatedElements[i].logTime), 'yyyy-MM-dd HH:mm:ss:sss');
var dateWithDifference = moment(dateToConvert).subtract(hourDifference, 'hours').format('YYYY-MM-DD HH:mm:ss:SSS');

Where "jm.logging.subordinatedElements[i].logTime" is a date which is equal to an unix format like this one: 1545092400027
The "hourDifference" variable is calculated like this:
var differenceOfHours = moment.utc(moment(localDate, 'YYYY-MM-DD HH:mm:ss:SSS').diff(moment(serverDate, 'YYYY-MM-DD HH:mm:ss:SSS'))).format("HH");
return parseInt(differenceOfHours);

Where both the localDate and the serverDate have the following format:
"2018-12-18 02:20:00:043". The hourDifference always gives me "00", and 0 after parseInt, no matter the hour difference between two dates, on firefox.
While all of this works on Chrome without problems, as I said they don't do in firefox. My question is, how should I make my date be recognizable without changing the "2018-12-18 02:20:00:043" format? (since I must display the date in this format to the final user).

A: I fixed the problem in the end by changing the date format in an ISO compatible one. The reason for why the dates weren't working in firefox was because of the more restrictive date parsing that firefox has compared to chrome, so for firefox and momentJS a ISO or RFC2822 compatible format must be used.
I used for my dates this one 2013-02-08 24:00:00.000


text:
Q: mvc4 get image in view from controller First of all, i have used this way in another controller and it works perfectly, now i copied and paste it in another controller, but it didnt work.
i want to get an image from my controller.
i used this code in controller
[Authorize]
        [AcceptVerbs(HttpVerbs.Get)]
        public FileContentResult getPassportImg(int tenantID)
        {
            byte[] image = db.Tenants.Find(tenantID).passportImage;
            if (image != null)
            {
                return new FileContentResult(image, "image/jpeg");
            }
            else
            {
                return null;
            }
        }

and i make breakpoints throw it and the data is being retrieved correctly.
in the view i do this

but when i run my application, it's not get the image. Can you
Please help me resolve this


text:
Q: vertical alignment issue with two divs I have two divs within a datatable that I am trying to vertically align but having some issue. I would like to have them both aligned.
Here is a screenshot of the problem:

Each div has a class i.e. for export buttons .pull-left and for pagination .pull -right, css below:
I tried adding in vertical-align: middle or bottom etc but made no difference..
.pull-right {
    float:right;
    display: inline-block;
    position: relative;
}
.pull-left {
    float:left;
    display: inline-block;
    position: relative;
}

Here is a screenshot of the html code from the console, there is too much code to paste in here

Here is also the sDom parameter I am using with datatables:
"sDom": "<'row'<'col-sm-12'<'pull-right'p><'pull-left'B>r<'clearfix'>>>t<'row'<'col-sm-12'<'pull-left'i><'pull-right'><'clearfix'>>>",

A: There are some solution to fix the the problem. But I would like to share to you these easy solution.
First: Using bootstrap columns
`"sDom": '<"col-xs-6" B><"col-xs-6" p>'`

Second
$(document).ready(function() {
    $('#example').DataTable( {
        "dom": '<"toolbar">frtip'
    } );
    $("div.toolbar").html('<b>add your buttons here</b>');
} );

Third Alternatively you can also do it like this:
$(document).ready(function() {
    $('#example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            'copy', 'excel', 'pdf', 'print'
        ]
    } );
} );

Note: Remember to add the required scripts for the button to work.

Fourth using CSS:
.dt-buttons.btn-group {
  margin-bottom: -50px; //specify the margin here...
}

A: When you use float the display property is no longer inline-block.on current situation you have to specify the width.
like .pull-right {widht:30%} .pull-left {width:60%}
or just give them display inline-block without float.as long as they are not meet there edge they are on same line.

A: Instead of using pull-left & pull-right you can use col-md-6 class for both div tags.


text:
Q: Reding some lines of input in cpp I am trying to read the following input:
1.first line is some natural number q;
2.next q lines are either '+' or '-' or 'insert'+space+somecharacter
the cin doesn't work here of course because of space so i tried to use getline in the following way:
int q;

cin>>q;

getchar();

while(q--){

    string s;

    getline(cin,s);

}

but in this way I can't read the first line and if I delete getchar Ican't read the last line.The problem is probably that the program reads an additional '\n'(Printing the input shows this).How can I fix this?

A: You don't necessarily need to look for spaces, you may just read first thing, and if it's insert then you read once again:
int q;
cin>>q;
while(q--){
    string s;
    cin >> s;
    if (s == "insert") {
        char c;
        cin >> c;
        // do something with s == "insert", c == 'h'
    } else {
        // do something with s == "+" or s == "-"
    }
}


text:
Q: Google App Engine Admin SDK Reports API returning 403 Insufficient Permission error I started with some sample code for App Engine from Google.
My app needs to use the Directory API and the Reports API from the Google Admin SDK.
I have created a project in the API Console and turned on the Admin SDK in Services.
I added the scopes (the same ones as used in the code below) to the "Manage API client access" section of Advanced Tools in my domain's Google cpanel.
The call to the Directory API works.
After that, the call to the Reports API fails with the error message:
"HttpError: https://www.googleapis.com/admin/reports/v1/activity/users/all/applications/admin?alt=json returned "Insufficient Permission">"
Thanks much for the assistance.
import webapp2
import os
from apiclient.discovery import build
from oauth2client.appengine import OAuth2Decorator
from oauth2client.appengine import OAuth2DecoratorFromClientSecrets
from apiclient import errors
import logging
import json

decorator = OAuth2DecoratorFromClientSecrets(
  os.path.join(os.path.dirname(__file__), 'client_secrets.json'),
  'https://www.googleapis.com/auth/admin.directory.user.readonly')

directoryauthdecorator = OAuth2Decorator(
    client_id='123.apps.googleusercontent.com',
    client_secret='456-abc',
    callback_path='/oauth2callback',
    scope='https://www.googleapis.com/auth/admin.directory.user.readonly '
          'https://www.googleapis.com/auth/admin.reports.audit.readonly '
          'https://www.googleapis.com/auth/admin.reports.usage.readonly'
)

class MainHandler(webapp2.RequestHandler):
    def get(self):
        self.response.write('Hello world!')

class OAuthHandler(webapp2.RequestHandler):
    @directoryauthdecorator.oauth_required
    def get(self):
        users = []

        # Get the authorized Http object created by the decorator.
        auth_http = directoryauthdecorator.http()

        # Get the directory service
        service = build("admin", "directory_v1", http=auth_http)

        result = []
        page_token = None
        while True:
            try:
                param = {}
                param['domain'] = 'mydomain.com'
                if page_token:
                    param['pageToken'] = page_token

                files = service.users().list(**param).execute()
                result.extend(files['users'])
                page_token = files.get('nextPageToken')
                if not page_token:
                    break
            except errors.HttpError, error:
                print 'An error occurred: %s' % error
                break

        users = []
        for user in result:
            logging.info(user['primaryEmail'])
            users.append(user['primaryEmail'])

        param = {}
        param['userKey'] = 'all'
        param['applicationName'] = 'admin'

        service = build('admin', 'reports_v1', http=auth_http)

        # this call fails with the 403 Insufficient Permissions error
        results = service.activities().list(**param).execute()
        logging.info(results)

app = webapp2.WSGIApplication([
    ('/', MainHandler),
    ('/users', OAuthHandler),
    (directoryauthdecorator.callback_path, directoryauthdecorator.callback_handler()),
], debug=True)

A: I read this post and cleared the credentials from the datastore.
Hitting the /users url again I got the redirect_uri error message.
I went back to the API project, fixed the Redirect URIs, and downloaded the client_secrets.json file.
Now both calls work (one to Directory API, the other to Reports API).


text:
Q: "syntax error, unexpected $end" when compiling GLSL programs? I'm having trouble compiling shaders. I'm pretty sure the issue is with my file loading code.
These are the relevant functions:
char* loadShader(char* filename){
    char* buffer = 0;
    long length;
    FILE* f = fopen (filename, "rb");
    if(!f){
        // error reading file
        printf("failed to open file\n");
    }

    if (f){
        fseek (f, 0, SEEK_END);
        length = ftell (f);
        fseek (f, 0, SEEK_SET);
        buffer = malloc (length+1);
        if (buffer){
            fread (buffer, 1, length, f);
        }
        fclose (f);
    }
    return buffer;
}

Renderer* initRenderer(){
    Renderer* renderer = malloc(sizeof(Renderer));
    //renderer->vertices[0] = -0.5f;
    float verts[] = {
        -0.5f, -0.5f, 0.0f,
        0.5f, -0.5f, 0.0f,
        0.0f,  0.5f, 0.0f
    };
    for(int i = 0; i < 9; i++){
        renderer->vertices[i] = verts[i];
    }
    glGenBuffers(1, &renderer->VBO);
    glBindBuffer(GL_ARRAY_BUFFER, renderer->VBO);
    glBufferData(GL_ARRAY_BUFFER, sizeof(renderer->vertices), renderer->vertices, GL_STATIC_DRAW);
    GLchar* vst = (GLchar*)loadShader("game_data/assets/shaders/simple_vert.glsl");
    GLchar* fst = (GLchar*)loadShader("game_data/assets/shaders/simple_frag.glsl");
    const GLchar* vertexShaderSource = vst;
    const GLchar* fragmentShaderSource = fst;
    if(vst){free(vst);}
    if(fst){free(fst);}
    int  success;
    char infoLog[512];
    unsigned int vertexShader;
    vertexShader = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);
    glCompileShader(vertexShader);
    glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);
    if(!success)
    {
        glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);
        printf("ERROR::SHADER::VERTEX::COMPILATION_FAILED\n");
        printf("%s\n", infoLog);
        //std::cout << "ERROR::SHADER::VERTEX::COMPILATION_FAILED\n" << infoLog << std::endl;
    }
    unsigned int fragmentShader;
    fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
    glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);
    glCompileShader(fragmentShader);
    glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);
    if(!success)
    {
        glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);
        printf("ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\n");
        printf("%s\n", infoLog);
        //std::cout << "ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\n" << infoLog << std::endl;
    }

    return renderer;
}

The vertex shader:
#version 330 core
layout (location = 0) in vec3 aPos;

void main()
{
    gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);
}

The fragment shader:
#version 330 core
out vec4 FragColor;

void main()
{
    FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);
}

And finally the error message:
ERROR::SHADER::VERTEX::COMPILATION_FAILED
0:1(1): error: syntax error, unexpected $end

ERROR::SHADER::FRAGMENT::COMPILATION_FAILED
0:1(1): error: syntax error, unexpected $end

I'm sure I'm missing something simple with the strings. I looked at this answer with a similar problem but I wasn't able to glean anything from it.

A: Not an expert in file opening but your opening it in rb (read binary) mode, maybe try just opening it in r (read) mode.


text:
Q: SQL Server claims that transaction log is full, but it's not? I'm trying to do a large INSERT operation from a database to another. But I get an error message:

Msg 9002, Level 17, State 4, Line 1
      The transaction log for database '_ARCHIVE_mydatabase' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases

Things I've done so far:

*

*Checked that the disk has enough disk space

*checked that the transaction log file size is small (1024 KB)

*checked that the log_reuse_wait_desc was NOTHING

*checked that the recovery mode for _ARCHIVE_mydatabase is Simple

*restarted the server

I also tried to run the query from this SF answer:(
The Transactional Log is Full)
but it doesn't help.
Also we have many _ARCHIVE databases and all of them have the same error!
What else can I try and why is this happening?

A: Not to ask the obvious question, but have you checked to make sure that a log file size limit is not set? Or the option to auto-grow is not disabled..

A: The transaction log file shouldn't be small. It's "scratch space" for SQL transactions, and essential for SQL Server to function. Set it to something reasonable like 512MB or 1GB, then try the operation again.
On a side note, please don't run a production database on "Simple" recovery model. Full transaction logging helps SQL Server maintain internal transactional consistency in the event of the unexpected. You should observe the log file's growth, manually grow it to a reasonable size, then take regular backups of the transaction log (mine are set to hourly).

A: The problem was that our virtual server's hard drive had been corrupted. When I tried to run chkdsk I got an error "The type of the file system is RAW" (which means unformatted).
Our IT support fixed the drive and now everything works fine!


text:
Q: Use the default Python rather than the Anaconda installation when called from the terminal I recently installed the Anaconda version of Python. Now when I type python into the terminal it opens the Anaconda distribution rather than the default distribution. How do I get it to use the default version for the command python on Linux (Ubuntu 12.04 (Precise Pangolin))?

A: I faced the same issue and you can do the following.
Go into your .bashrc file and you will find a similar sort of line:
export PATH=~/anaconda3/bin:$PATH

You comment it out and instead type out:
alias pyconda='~/anaconda3/bin/python3'

Or whatever your path is. This worked out for me.

A: Anaconda adds the path to your .bashrc, so it is found first. You can add the path to your default Python instance to .bashrc or remove the path to Anaconda if you don't want to use it.
You can also use the full path /usr/bin/python in Bash to use the default Python interpreter.
If you leave your .bashrc file as is, any command you run using python will use the Anaconda interpreter. If you want, you could also use an alias for each interpreter.
You will see something like export PATH=$HOME/anaconda/bin:$PATH in your .bashrc file.
So basically, if you want to use Anaconda as your main everyday interpreter, use the full path to your default Python or create an alias. If you want it the other way around, remove the export PATH=.... from bashrc and use full path to Anaconda Python interpreter.

A: In the year 2020, Conda adds in a more complicated block of code at the bottom of your .bash_profile file that looks something like this:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/spacetyper/opt/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/spacetyper/opt/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/spacetyper/opt/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/spacetyper/opt/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

To use the default Python install by default: Simply move this section of code to the very top of your .bash_profile file.
To give yourself the option of using the Conda installed Python: Add this line below the Conda code block above.
alias pyconda="/Users/spacetyper/opt/miniconda3/bin/python3"

Now you should be able to call the system Python install with python and the Conda install with pyconda.

A: at 2020, like the @spacetyper mentioned, it acted differently. I've found a handy solution for that from this question: How do I prevent Conda from activating the base environment by default?
To disable automatic base activation:
conda config --set auto_activate_base false

it'll create a ./condarc in home directory after running the first time.

A: Having tried all the suggestions so far, I think modifying the export statement in file ~/.bashrc, as Piotr Dobrogost seems to suggest, is the best option considering the following:

*

*If you remove the whole statement, you have to use full paths for Conda binaries.

*Using Conda 4.4.10 links in the directory anaconda/bin/ point to binaries in the same directory, not the system ones in /usr/bin.

*Using this approach you get the system programs for all that have been previously included in $PATH and also the ones specific to anaconda without using full paths.

So in file ~/.bashrc instead of
# Added by the Anaconda3 4.3.0 installer
export PATH="/home/user/anaconda3/bin:$PATH"

one would use
export PATH="$PATH:/home/user/anaconda3/bin"

A: I found that, though I remove export=.../anaconda3/bin:$PATH, there is still .../anaconda3/envs/py36/bin(my virtual environment in Anaconda) in PATH, and the shell still uses Anaconda Python.
So I export PATH=/usr/bin:$PATH (/usr/bin is where system Python reside). Though there is already /usr/bin inPATH, we make it searched before the path of Anaconda, and then the shell will use the system Python when you key python, python3.6, pip, pip3 ....
You can get back to Anaconda by using an alias like mentioned above, or default to Anaconda again by comment export PATH=/usr/bin:$PATH.

A: There are python, python2 and python2.7 shortcuts in both the /home/username/anaconda/bin/ and /usr/bin/ directory. So you can delete any one of them from one folder and use that for the other.
I mean, if you delete the python2 shortcut from the Anaconda directory, you will have the Python for Anaconda version and
python2 for the default version in the terminal.

A: I use Anaconda sparingly to build cross-platform packages, but I don't want to use it as my daily driver for Python. For Anaconda, Ruby, and Node.js projects I've adopted to use environment sand-boxing, which essentially hides functionality behind a function away from your path until you specifically need it. I first learned about it from these two GitHub repositories:
https://github.com/benvan/sandboxd
https://github.com/maximbaz/dotfiles
I have a file of sandboxing functions that looks like this:
.zsh/sandboxd.zsh:
#!/bin/zsh
# Based on
#    https://github.com/maximbaz/dotfiles/.zsh/sandboxd.zsh
# which was originally adapted from:
#    https://github.vom/benvan/sandboxd

# Start with an empty list of all sandbox cmd:hook pairs
sandbox_hooks=()

# deletes all hooks associated with cmd
function sandbox_delete_hooks() {
    local cmd=$1
    for i in "${sandbox_hooks[@]}";
    do
        if [[ $i == "${cmd}:"* ]]; then
            local hook=$(echo $i | sed "s/.*://")
            unset -f "$hook"
        fi
    done
}

# Prepares the environment and removes hooks
function sandbox() {
    local cmd=$1
    # NOTE: Use original grep, because aliased grep is using color
    if [[ "$(type $cmd | \grep -o function)" = "function" ]]; then
        (>&2 echo "Lazy-loading '$cmd' for the first time...")
        sandbox_delete_hooks $cmd
        sandbox_init_$cmd
    else
        (>&2 echo "sandbox '$cmd' not found.\nIs 'sandbox_init_$cmd() { ... }' defined and 'sandbox_hook $cmd $cmd' called?")
        return 1
    fi
}

function sandbox_hook() {
    local cmd=$1
    local hook=$2

    #echo "Creating hook ($2) for cmd ($1)"
    sandbox_hooks+=("${cmd}:${hook}")

    eval "$hook(){ sandbox $cmd; $hook \$@ }"
}

.zshrc
In my .zshrc I create my sandbox'd function(s):
sandbox_hook conda conda

This command turns the normal conda executable into:
conda () {
    sandbox conda
    conda $@
}

An added bonus of using this technique is that it speeds up shell loading times because sourcing a number of wrapper scripts (e.g. nvm, rvm, etc.) can slow your shell startup time.
It also bugged me that Anaconda installed its Python 3 executable as python by default, which breaks a lot of legacy Python scripts, but that's a separate issue. Using sandboxing like this makes me explicitly aware that I'm using Anaconda's Python instead of the system default.

A: Anaconda 3 adds more than a simple line in my .bashrc file.
However, it also backs up the original .bashrc file into a .bashrc-anaconda3.bak file.
So my solution was to swap the two.

A: For my case, when I had
alias python='/usr/bin/python3.6'

in the ~/.bashrc, it always called python3.6 inside and outside of Anaconda Virtual Environment.
In this setting, you could set the Python version by python3 in each Virtual Environment.


text:
Q: Instance variables in Angular component are not working from within a setInterval called function My Angular 13 component should show a progress bar while an audio file is being played.
I'm trying to increase the progress bar value (runs from 0 to 1) by a calculated interval in a function called with setInterval() to run every 1/100th of a second.
The called function is: progressTimeBar().
progressTimeBar(interval: number) {
    this.p_bar_value = Number(this.p_bar_value + interval);
    console.log('Advanced p_bar_value: ', interval, this.p_bar_value);
  }

The p_bar_value instance variable of the component is NOT accessible correctly from within progressTimeBar.
The console log renders it as NaN (that's why I tried to to force the Number() on its calculation - to no avail. Always NaN).
Console:
Advanced p_bar_value:  0.002 NaN

Btw, the there is an instance variable called interval as well, but accessing it directly in this function using this.interval yields the same results - NaN. That's why I am now passing it as an argument.
But I must advance the instance p_bar_value as it is bound to the template value of the progress bar!
Here's the component:
import { Component, Input } from '@angular/core';
import { VoiceService } from "../../services/voice.service";
import { StreamState } from "../../Utilities/stream-state";

@Component({
  selector: 'app-audioplayer',
  templateUrl: './audioplayer.component.html',
  styleUrls: ['./audioplayer.component.scss'],
  providers: [VoiceService]
})
export class AudioplayerComponent {

  @Input() url: string;

  audioDurationDisplay: string;
  state: StreamState;
  p_bar_value: number = 0;
  totalDuration: number = 0;
  playingNow: boolean;
  timerHandle: any;
  interval: number = 0;
  loaded: boolean = false;

  constructor(public audioService: VoiceService) {
    // listen to stream state
    this.audioService.getState().subscribe(state => {
      this.state = state;
      console.log('StreamState in Audioplayer updated: ', this.state);
      if (this.state.duration) {
        this.totalDuration = this.state.duration;
        this.interval = 0.01 / this.totalDuration;
        console.log('Updated TotalDuration from state: ', this.totalDuration);
      }
      if (this.state.ended) {
        clearInterval(this.timerHandle);
        this.p_bar_value = 0;
      }
    });
  }

  ngOnChanges() {
    if(this.url) {
      console.log('this.url received: ', this.url);
      this.CalcTotalDuration();
      this.loaded = true;
    }

  }

  CalcTotalDuration() {
    const durationRaw = this.url.slice(this.url.lastIndexOf(".")-4, this.url.lastIndexOf("."));
    this.audioDurationDisplay = durationRaw.slice(0, 1) + ":" + durationRaw.slice(-2);
    const arrRaw = this.audioDurationDisplay.split(":");
    this.totalDuration = (parseInt(arrRaw[0]) * 60) + (parseInt(arrRaw[1])); //Total in seconds
    this.interval = 0.01 / this.totalDuration;
    console.log('Calculated TotalDuration: ', this.totalDuration);
  }

playController() {
console.log('Calling progressTimeBar. totalDuration: ', this.totalDuration, Number.isNaN(this.totalDuration));
console.log('Calling progressTimeBar. interval: ', this.interval, Number.isNaN(this.interval));
console.log('Calling progressTimeBar. p_bar_value: ', this.p_bar_value, Number.isNaN(this.p_bar_value));
    clearInterval(this.timerHandle);
    this.timerHandle = setInterval(this.progressTimeBar, 10, this.interval);

    if (this.state.canplay) {
      this.play();
    } else {
      this.playStream();
    }

  }

  playStream() {
    this.audioService.playStream(this.url).subscribe(events => {
      this.playingNow = true;
    });
  }

  pause() {
    this.audioService.pause();
    clearInterval(this.timerHandle);
    this.playingNow = false;
  }

  //Restart playing again (resume after pause)
  play() {
    this.audioService.play();
    this.playingNow = true;
  }

  stop() {
    this.audioService.stop();
    clearInterval(this.timerHandle);
    this.playingNow = false;
    this.p_bar_value = 0;
  }

  progressTimeBar(interval: number) {
    this.p_bar_value = Number(this.p_bar_value + interval);

    console.log('Advanced p_bar_value: ', interval, this.p_bar_value);
  }

  ngOnDestroy() {
    clearInterval(this.timerHandle);
  }

}

What am I missing?

A: Could you try declaring progressTimeBar as an arrow function? We are using it as a callback and we lose this scope.
Either
    this.timerHandle = setInterval((interval) => { this.p_bar_value += interval }, 10, this.interval);

or
  const progressTimeBar = (interval: number) => {
    this.p_bar_value = Number(this.p_bar_value + interval);
  }

  this.timerHandle = setInterval(progressTimeBar, 10, this.interval);

should work


text:
Q: Prove $\int_0^1\frac{\text{Li}_2(-x^2)}{\sqrt{1-x^2}}\,dx=\pi\int_0^1\frac{\ln\left(\frac{2}{1+\sqrt{1+x}}\right)}{x}\,dx$ I managed here to prove $$\int_0^1\frac{\text{Li}_2(-x^2)}{\sqrt{1-x^2}}\,dx=\pi\int_0^1\frac{\ln\left(\frac{2}{1+\sqrt{1+x}}\right)}{x}\,dx$$
but what I did was converting the LHS integral to a series then converting the series to the RHS integral. Is it possible to relate the two integrals without going through the series?

A: First consider the following definition:
$$\operatorname{Li}_2\left(x\right)=-\int _0^x\frac{\ln \left(1-t\right)}{t}\:dt.$$
This means that:
$$\int _0^1\frac{\operatorname{Li}_2\left(-x^2\right)}{\sqrt{1-x^2}}\:dx=-\int _0^1\frac{1}{\sqrt{1-x^2}}\underbrace{\int _0^{-x^2}\frac{\ln \left(1-t\right)}{t}\:dt}_{y=-\frac{t}{x^2}}\:dx$$
$$=-\int _0^1\frac{1}{y}\int _0^1\frac{\ln \left(1+yx^2\right)}{\sqrt{1-x^2}}\:dx\:dy.$$
Now if we use differentiation under the integral sign for that integral we obtain:
$$=-\int _0^1\frac{1}{y}\left(\pi \ln \left(\frac{1+\sqrt{1+y}}{2}\right)\right)\:dy.$$
Therefore:
$$\boxed{\int _0^1\frac{\operatorname{Li}_2\left(-x^2\right)}{\sqrt{1-x^2}}\:dx=\pi \int _0^1\frac{\ln \left(\frac{2}{1+\sqrt{1+y}}\right)}{y}\:dy.}$$

A: From the linked post we know that:
$$I=\int_0^1\frac{\operatorname{Li}_2\left(-x^2\right)}{\sqrt{1-x^2}} dx=\pi\int_0^1\frac{\ln y}{2y}\left(1-\frac{1}{\sqrt{1+y}}\right)dy$$
So we just need to integrate by parts. We have:
$$\int \frac{1}{2y}\left(1-\frac{1}{\sqrt{1+y}}\right)dy\overset{\sqrt{1+y}= u}=\int\frac{du}{1+u}=\ln(1+\sqrt{1+y})+C$$
However, if we would use the above when integrating by parts we would run into divergence issues as
$\lim\limits_{y\to 0} \, \ln y\,  \ln(1+\sqrt{1+y})$ is not nice.
Therefore we will first substract $\ln 2$ from that and get $\lim\limits_{y\to 0} \, \ln y\, (\ln(1+\sqrt{1+y})-\ln 2)=0$.
$$\Rightarrow I=\pi\int_0^1 \ln y\,(\ln(1+\sqrt{1+y})-\ln 2)' dy\overset{IBP}=\pi\int_0^1\frac{\ln 2-\ln(1+\sqrt{1+y})}{y}dy$$


text:
Q: Can't maintain session on NSURLConnection I am trying to connect and login with my username and password by using NSURLConnection. I can make post request and also receive response but I can't maintain session. After I make my request I receive this message from the web site:

This system requires the use of HTTP cookies to verify authorization information.
                                       Our system has detected that your browser has disabled HTTP cookies, or does not support them.
                                       Please refer to the Help page in your browser for more information on how to correctly configure your browser for use with this system.

My code to make connection is here:
NSMutableURLRequest *request = nil;
request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://loginsite.com"]];
[[NSHTTPCookieStorage sharedHTTPCookieStorage]setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];

NSString *post = [NSString stringWithFormat:@"username=username&pass=password"];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
[request setValue:[NSString stringWithFormat:@"%d", [postData length]] forHTTPHeaderField:@"Content-Length"];
[request setTimeoutInterval: 15];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:postData];

_urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[_urlConnection start];

I would be glad if someone can help me.

A: they likely check the user agent header you sent . which is none in this case....
1) add a compatible header
    NSString *myAgent = @"SOME AGENT StRING";
    [request setValue:myAgent forHTTPHeaderField:@"User-Agent"];

e.g. an agent string from AFNetworking
    #if __IPHONE_OS_VERSION_MIN_REQUIRED
        // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
        [self setDefaultHeader:@"User-Agent" value:[NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleIdentifierKey], (__bridge id)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey) ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] ? [[UIScreen mainScreen] scale] : 1.0f)]];
    #elif __MAC_OS_X_VERSION_MIN_REQUIRED
        [self setDefaultHeader:@"User-Agent" value:[NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleIdentifierKey], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]]];
    #endif

2) take the response cookies and use them in future requests to main session
nextR.requestCookies = rLogin.responseCookies.mutableCopy;


text:
Q: python: how to convert json to dataframe Hi I am trying to convert a json file into python DataFrame. Ideally, the columns could be:
[ideal dataframe format][1]
As the screenshot shows, there is lots of "useless" information that I'd like to discard.
I have tried df = pd.DataFrame.from_dict(data, orient='columns')
But it turns out to be very far off.
Would appreciate it if you could help out! Thanks a lot!
The json file is as follows:
{
  "aspectSet": "article",
  "modelVersion": "1",
  "id": "573abb42-139a-11e9-a581-4ff78404524e",
  "apiUrl": "https://api.ft.com/content/573abb42-139a-11e9-a581-4ff78404524e",
  "title": {
    "title": "AQR announces job cuts after disappointing 2018"
  },
  "lifecycle": {
    "initialPublishDateTime": "2019-01-09T00:55:24Z",
    "lastPublishDateTime": "2019-01-09T00:55:24Z"
  },
  "location": {
    "uri": "https://www.ft.com/content/573abb42-139a-11e9-a581-4ff78404524e"
  },
  "summary": {
    "excerpt": "AQR, the quantitative investment group founded by billionaire Clifford Asness, says it is making "small reductions" to..."
  },
  "editorial": {
    "subheading": "Quantitative investment group's biggest public funds hit amid market volatility",
    "byline": "Robin Wigglesworth in New York"
  }
}

A: You need to use json module.
Try this
    import json
    raw_json = {
      "aspectSet": "article",
      "modelVersion": "1",
      "id": "573abb42-139a-11e9-a581-4ff78404524e",
      "apiUrl": "https://api.ft.com/content/573abb42-139a-11e9-a581-4ff78404524e",
      "title": {
        "title": "AQR announces job cuts after disappointing 2018"
      },
      "lifecycle": {
        "initialPublishDateTime": "2019-01-09T00:55:24Z",
        "lastPublishDateTime": "2019-01-09T00:55:24Z"
      },
      "location": {
        "uri": "https://www.ft.com/content/573abb42-139a-11e9-a581-4ff78404524e"
      },
      "summary": {
        "excerpt": "AQR, the quantitative investment group founded by billionaire Clifford Asness, says it is making "small reductions" to..."
      },
      "editorial": {
        "subheading": "Quantitative investment group's biggest public funds hit amid market volatility",
        "byline": "Robin Wigglesworth in New York"
      }
    }
    object_json = json.dumps(raw_json)
    pd.read_json(object_json)

A: see if json_normalize works for you :
data = {
  "aspectSet": "article",
  "modelVersion": "1",
  "id": "573abb42-139a-11e9-a581-4ff78404524e",
  "apiUrl": "https://api.ft.com/content/573abb42-139a-11e9-a581-4ff78404524e",
  "title": {
    "title": "AQR announces job cuts after disappointing 2018"
  },
  "lifecycle": {
    "initialPublishDateTime": "2019-01-09T00:55:24Z",
    "lastPublishDateTime": "2019-01-09T00:55:24Z"
  },
  "location": {
    "uri": "https://www.ft.com/content/573abb42-139a-11e9-a581-4ff78404524e"
  },
  "summary": {
    "excerpt": "AQR, the quantitative investment group founded by billionaire Clifford Asness, says it is making "small reductions" to..."
  },
  "editorial": {
    "subheading": "Quantitative investment group's biggest public funds hit amid market volatility",
    "byline": "Robin Wigglesworth in New York"
  }
}

from pandas import json_normalize
json_normalize(data).filter(regex="Url|title|summary|subheading|Date")


text:
Q: Are there graphs embeddable on $S^2$ but not on $\mathbb{R}^2$? The answer is No for finite graphs, of course, via the stereographic projection. But we need a free point on $S^2$ for that to work. Let $\mathfrak{c}$ denote the cardinality of the continuum.
I can embed the edgeless graph $\overline{K_\mathfrak{c}}$ on $S^2$ by covering each point of it, making a stereographic projection impossible, so there exists embeddings that cannot be transferred to $\mathbb{R}^2$ via the stereographic projection. (Let's point out here that I'm speaking about combinatorical immersions, not topological ones, see here, here and end of post, the example should have made that clear.) But on the other hand I could also embed $\overline{K_\mathfrak{c}}$ on any smaller closed (or open) neighborhood of $S^2$, and I can project.
Another example could be the biparite graph $K_{2,\mathfrak{c}}$, with the two vertices at the poles and the others at the equator, all connected with geodesic lines, covering the whole sphere. But then again I could also just use half the equator and get a free half sphere for the projection.
Another idea would be the dipole graph $D_\mathfrak{c}$ (multigraphs are allowed) covering the sphere, but that can be solved just like the other two examples.
So, my initial guess was that I can't get the graph enough connected to make another easier embedding impossible while keeping it embeddable to the sphere. But I don't know how to show that.
Then I stumbled upon John Sample's answer here, but I doubt both methods provided (blow up a vertex and blowing up an edge (in the comments)), due to a lack of understanding.

*

*Blowing up a vertex seems to assume that the disk will have "free points" not connected to an edge, but I don't see this to be true if e.g. the vertex is the center of a disk embedding of the star $K_{1,\mathfrak{c}}$. The construction wouldn't change anything and not create free space using the Cantor fan.

*Concerning the edge, I just don't understand what "Just grab an arc and peel the space open a bit along it." is supposed to mean.

I would like you to prove that any graph with a spherical (combinatorical) embedding also has one on $\mathbb{R}^2$ (or provide a counterexample), either completely by yourself or expanding/explaining John's answer.
Definition of embedding to be used:
A multigraph $G=(V,E,S,T)$ can be embedded (in the sense of this question) on a surface $S$ if there are injective functions $\phi:V\rightarrow S$, $\psi:E\rightarrow C([0,1],S)$ (the curves on $S$) with the following properties:

*

*$\forall e\in E:\phi(S(e))=(\psi(e))(0)$ and $\phi(T(e))=(\psi(e))(1)$, i.e. the endpoints of the curve representations of the edges are the corresponding representation of the vertices.

*$\forall e,f\in E, s,t\in[0,1]:e\neq f \wedge (\psi(e))(s) = (\psi(f))(t) \implies s,t\in\{0,1\}$, i.e. the presentations of two edges only intersect in vertices. This results in a planar drawing in case of $S=\mathbb{R}^2$.

In case of infinite graphs this definition can lead to embeddings which are not topological isomorphic to the topological space generated by the graph. This is explicitly allowed in this question.
Why this should not be treated as a duplicate of this question:

*

*The other question wasn't clear on which kind of embedding to use, resulting in confusion. I'm very clear.

*John's answer has many comments and several edits, not really helping my case, which is why I doubt further prodding would improve the answer's structure, a new one would be better.

*If in doubt, my question is a proof verification of John's answer and I don't see why MSE answers couldn't be explained like statements in papers.


text:
Q: On Using Thanks a Pile As a non-native speaker of English, I am not quite sure whether or not I can use the phrase Thanks a pile to tell someone I am pleased for something good they have done.
Is this phrase commonly used in everyday spoken English?

A: I have never come across " Thanks a pile " in the UK.
There are a whole bunch of very similar sayings: "thanks a million", "thanks a bunch", even: "thanks a lot"  but when written down they all suffer the same issue, which is that they are just as frequently used in a sarcastic manner, so you need to be VERY clear in your context that you mean it in a positive way.


text:
Q: Android Studio 2.3.1 - editing build.gradle file causes IDE to freeze for 20 seconds (or more) The past few days, I've experienced some unusual problems in Android Studio 2.3.1; the IDE freezes whenever I edit the build.gradle (module) file.

*

*My Project-level gradle settings are Use default gradle wrapper (recommended)

*gradle-wrapper.properties is as follows:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

*My local Gradle version (defined by GRADLE_USER_HOME) is Gradle 3.5

*Android Studio does not have a proxy server setting enabled as described in this post Android Studio gradle takes too long to build

*my gradle.properties file is as follows
org.gradle.daemon=true
org.gradle.parallel=true

*my build.gradle file is as follows
apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "app.com.eventfull.waterjam"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dataBinding.enabled=true
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',         {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:appcompat-v7:25.3.1'

    compile 'com.google.firebase:firebase-auth:10.0.1'
    compile 'com.firebaseui:firebase-ui-database:1.0.0'
    compile 'com.google.firebase:firebase-database:10.0.1'

    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'

I tried toggling the offline work option in Global Gradle Settings (Settings > Preferences > Build, Execution, Deployment > Gradle), but this has no effect; IDE still hangs up when editing the build.gradle file.  Thoughts?

EDITS:
Here are my custom VM OPTIONS.
-Xms512m
-Xmx2g
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=240m
-XX:+UseCompressedOops

A complete un-install & re-install seems to have fixed this issue.
I dislike resorting to such measures - I'd rather know the why - but it was nonetheless effective.

UPDATES on 6.25.2017
Despite uninstalling & reinstalling Android Studio, Gradle, rebooting my system, cleaning various system caches a few times...Android Studio still freezes for
~30s to 60secs upon editing a gradle file. I've taken to editing the gradle files in an external text editor & Sync Project with Gradle Files. It helps, but Android Studio still seems to freeze intermittently for ~20secs or longer after doing this. Toggling the "offline mode" in gradle settings does nothing.
I'm using...

*

*Android Studio 2.3.3 (for production apps)

*Android Studio 3.0 canary 4 (for experimenting & ideas).

*'com.android.tools.build:gradle:2.3.3' is the gradle android build tools in Android 2.3.3

*Macbook Pro (Mid 2015), Core-i7, 16GB RAM, Sierra 10.12.5
Let me know if someone has any suggestions...

UPDATE 4/02/2018
The problem has disappeared since Google added a special repository for Android Studio users, that is, the embedded Maven repository for Android Studio 3+.
Android Studio 2.3.3 and lower doesn't have this.
INSTRUCTIONS

*

*Open Android Studio's Preferences - ⌘, (mac) or CTRL ALT S (win)

*search for 'embedded'

*click Enable embedded Maven repository


text:
Q: What should PHP's variable-length argument `...` token be referred to as? I recently learned about PHP's ... token (reference the docs) which is used to support variable-length argument lists.  What is the term for this token or how is it pronounced?  If it doesn't have a name, is their any similar functionality in another language which has a name?

A: TL;DR: The tokens name is 'T_ELLIPSIS', used in a function declaration makes this function 'variadic', used when calling a function with an array holding the parameters, it's called 'argument unpacking'.

Its name is T_ELLIPSIS, I found that out using token_get_all and token_name in a psysh-session:
>>> token_get_all('<?php function testit(...$a) { echo $args;}')
=> [
 [
   379,
   "<?php ",
   1,
 ],
....
 [
   391,
   "...",
   1,
 ],
....
>>> token_name(391)
=> "T_ELLIPSIS"
>>>

Edit: I understood you possibly too literally -- I thought you asked for the token-name, but given the downvote(s), I suspect you meant, how do programmers refer to it in speech and writing (apparently "splat", according to the comments)
Edit 2: Used in a function definition before the last parameter, in other languages a function defined with an ellipsis in PHP, would be called a 'variadic function':
>>> function f(...$a) { return $a; }
>>> f(1, 2, 3, 4)
=> [
     1,
     2,
     3,
     4,
   ]
>>>

Edit 3: Finally: If you have an array holding values you want to pass to a function, you can use ... to achieve "Argument Unpacking"
>>> function f($a, $b, $c) { return "{$a}-{$b}-{$c}"; }
>>> f(...[1,2,3]);
=> "1-2-3"
>>>


text:
Q: OutOfMemory error when using Apache Commons lineIterator I'm trying to iterate line-by-line a 1.2GB file using Apache Commons FileUtils.lineIterator. However, as soon as a LineIterator calls hasNext() I get a java.lang.OutOfMemoryError: Java heap space. I've already allocated 1G to the java heap.
What am I doing wrong in here? After reading some docs, isn't LineIterator supposed to be reading the file from the file system and not loading it into memory?
Note the code is in Scala:
  val file = new java.io.File("data_export.dat")
  val it = org.apache.commons.io.FileUtils.lineIterator(file, "UTF-8")
  var successCount = 0L
  var totalCount = 0L
  try {
    while ( {
      it.hasNext()
    }) {
      try {
        val legacy = parse[LegacyEvent](it.nextLine())
        BehaviorEvent(legacy)
        successCount += 1L
      } catch {
        case e: Exception => println("Parse error")
      }
      totalCount += 1
    }
  } finally {
    it.close()
  }

Thanks for your help here!

A: The code looks good. Probably it does not find an end of a line in the file and reads a very long line which is larger than 1Gb into memory.
Try wc -l in Unix and see how many lines you get.


text:
Q: The problem of Free Variables in natural deduction rules ($\forall$, $\exists$, =). I am in need of some clarification relating to the rules mentioned. I am doing two different courses on Logic (Philosophy / Computer Science departments) and unforunately they use slightly different vocab for different words.
I was working on the proof for $\exists x\,(x=b\;\land\; P(x))\vdash P(b)$, where $b$ is understood to be some term and $x$ is some "variable". I first wrote the following proof
$\begin{array}{ccc}
1 & &\exists x\,(x=b\;\land\; P(x)) &\text{Premise}\\
2 &|& b=b\land P(b)  &\text{Assumption}\\
3 &|& P(b)  &\land\text{-elimination (2)}\\
4&&P(b) &\exists\text{-elimination (2-3)}
\end{array}$
I understand the $\exists$-elimination rule comes with the side condition that the variable you "assume" exists must be free - but I'm not sure the precise condition. The definitions for this course are:
A variable $x$ is free in $\phi$ if it is not within the scope of a quantifier.
A term $t$ is free for $x$ in $\phi$ if nowhere in $\phi$ does an $x$ variable occur within the scope of any variable that occurs in $t$.
$$
\frac{\begin{array}{ccc}
&&\phi[x_0/x]\\
&&\vdots\\
\exists x\phi&&\psi
\end{array}}{\psi}\exists\text{-elim}
$$
I thought the condition was that we needed $b$ to be free for $x$ in $\phi$, but this seems too easy? The philosophy department only put requirements on $x$ not being a free variable in $\psi$ and the assumptions needed "along the way" in the $\vdots$-bit, and even says that $x$ can be a free variable in $\phi$, totally contradictory to the computer science department...!

My questions are

*

*Is my deduction valid as it is?

*What are the precise side conditions of the $\exists$-elim and $\forall$-intro rules, using the definitions I mention?

*Are there any side conditions on the $=$ rules? My lecture notes don't mention any but I thought they did? Specifically this one:
$$\frac{t_1=t_2\quad \phi[t_1/x]}{\phi[t_2/x]}=\text{-elim}$$
for $t_1,t_2$ terms, $x$ a variable.
Thanks!
(edit, I meant to say: the Term* you "assume" exists [...])

A: Comments
Term is a more general syntactical object than variable : a term is a variable or a constant or a "complex" term built-up from "simpler" terms with a function symbol, like $x+1$ in arithmetic, where $x$ is a variable, $1$ is a constant and $+$ is a (binary) fucntion symbol.

Free and free for are two different concepts :

*

*an occurrence of a variable is free in a formula if it is not in the scope of a quantifier : in the formula $\exists y(y=x+1)$ we have that the occurrence of $y$ into $(y=x+1)$ is bounded by the leading quantifier $\exists y$ while the occurrence of $x$ is free;

*a variable $z$ (or a term $t$) is free for $x$ in $\phi$ if there are free occurrences of $x$ in $\phi$ and if the replacement of all occurrences of $x$ in $\phi$ with $z$ (or with $t$) will cause no "capturing" of $z$ (or of variables occurring in $t$) by some quantifier already present into $\phi$. I.e. if we consider again the formula $\exists y(y=x+1)$, we have that $z$ is free for $x$ in it, because the result of the replacement is $\exists y(y=z+1)$ and we have no "capturing", but the $y$ is not for $x$ in it, because the result will be : $\exists y(y=y+1)$ that does not have the same "meaning".

In the $\exists$-elimination rule :
$$
\frac{\begin{array}{ccc}
&&\phi[x_0/x]\\
&&\vdots\\
\exists x\phi&&\psi
\end{array}}{\psi}\exists\text{-elim}
$$
the proviso is :

$x_0$ does not occur in $\psi$, $\phi$ or any undischarged assumption of the subderivation of $\psi$, except $\phi[x_0/x]$.

Of course, if you use a constant $c$ in place of $x_0$, the proviso is the same.

In the $\forall$-introduction rule :
$$
\frac{\phi(x)}{\forall x\phi(x)}\forall\text{-intro}
$$
the proviso is :

the variable $x$ may not occur free in any hypothesis on which $\phi(x)$ depends.

Here is an example showing the need for the proviso :
1) $x=0$ --- assumed
2) $\forall x(x=0)$ --- $\forall$-intro : illegal !
3) $x=0 \to \forall x(x=0)$ --- $\to$-intro, discharging 1)
4) $\forall x[x=0 \to \forall x(x=0)]$ --- $\forall$-intro : correct ! there are no assumptions left
5) $0=0 \to \forall x(x=0)$ --- $\forall$-elim.
The conclusion is clearly false in $\mathbb N$.

Here is an example showing the need for the proviso in the $\exists$-elim rule :
1) $\exists x(x=0)$ --- assumed
2) $(x=0)$ --- assumed for $\exists$-elim
3) $x=0$ --- from 2) and 1) by $\exists$-elim, discharging 2) : illegal ! $x=0$ is "the $\psi$" and we have the variable $x$ used in the $\exists$-elim application free in it
4) $\forall x(x=0)$ --- $\forall$-intro : correct ; there are no free occurrence of $x$ in the only assumption left, i.e. into 1)
5) $\exists x(x=0) \to \forall x(x=0)$ --- $\to$-intro.
The conclusion is clearly false in $\mathbb N$.

Regarding your proof, it can be easily "restored" :
$\begin{array}{ccc}
1 & &\exists x\,(x=b\;\land\; P(x)) &\text{Premise}\\
2 &|& y=b\land P(y)  &\text{Assumption for } \exists\text{-elimination : y new}\\
3 &|& P(y)  &\land\text{-elimination (2)}\\
4 &|& y=b  &\land\text{-elimination (2)}\\
5&&P(b) &=\text{-elimination (3-4)}\\
6&&P(b) &\exists\text{-elimination (2-5) : y not occurring in it}
\end{array}$

A: *

*No, that is not valid. In the $\exists$-elimination rule, $x_0$ cannot be an arbitrary term, but must be a new variable that is not free in $\psi$. That means you cannot use $b$ as $x_0$ -- first, $b$ might not even be a variable (it could be a constant symbol or even a term containing function symbol); second, even if $b$ is a variable it is not free in $\psi$ which is $P(b)$ in your attempted application.

*You need side conditions that prevent $x_0$ from occurring free in either $\phi$ or $\psi$. If you allow $\phi$ to contain $x_0$ you can derive nonsense by first proving (from whatever set of axioms you're using) that $\exists x.x\ne x_0$, then use $\exists$-elimination to assume $x_0\ne x_0$, derive a contradiction and hence any nonsense you want as $\psi$.
On the other hand it is right that $x$ (but not $x_0$) can be free in $\phi$ (if it didn't the rule would not be much fun at all).

*The $=$ rule you show does not need any side conditions.

A: The key here is to derive a universal that implies the desired result. I'll prove it as an implication since it's a bit cleaner. Note I'm using a Hilbert-style system, so instead of using the Existential Elim rule, I'm using the axiomatic version.

*

*(x=b & Pb)⊃Pb  (& Elim. Right)

*∀x((x=b & Pb)⊃Pb)⊃(∃x(x=b & Pb)⊃Pb)       (∃ Elim)

*∀x((x=b & Pb)⊃Pb)  (1, Gen.)

*∃x(x=b & Pb)⊃Pb  (2,3 MP)


text:
Q: ansible playbook multiple when condition with include option I am creating playbook where i am taking input from user of which software version need to download as input and passing into tasks/main.yml
ansible-playbook -i inventory.txt --extra-vars 'git_version=2.7.1'
tasks/main.yml :
---
  - name: git
    include: ../../deploy/templates/git/git.yml
    when: git_version == "1.7.4" or
          git_version == "2.7.1"

  - name: ant
    include: ../../deploy/templates/ant/ant.yml
    when: ant_version == "1.10.3" or
          ant_version == "1.10.4"

git.yml :

- name: Download Software
  get_url:
     url: "/Linux/git/{{ git_version }}/git-{{ git_version }}.tar.gz"
     dest: "{{ Tools }}"
     mode: 0755

So when i run playbook i am getting below error as syntax problem my requirement is take user input of which software he need to download and using multiple when condition with different include /import_task option to download software
TASK [Gathering Facts] ***************************************************************************************************
    ok: []

    TASK [rtt : Download Software] ********************************************************************************************
    skipping: []

    TASK [rtt : Unarchive software] *******************************************************************************************
    skipping: []

    TASK [rtt : Delete the tar file] ******************************************************************************************
    skipping: []

    TASK [rtt : Download Software] ********************************************************************************************

A: To the best of my knowledge, Ansible doesn't allow you to have when: conditions for undefined variables, with one exception:
when: variable_name is defined

For your purposes, it may be simpler to just set empty defaults, e.g. create defaults/main.yml with the following content:
---
ant_version: ''
git_version: ''

This allows the role to execute and tasks are only run when user's override the default variables (e.g. when user adds --extra-vars 'git_version=2.7.1' to playbook command).


text:
Q: styled-components - how to set styles in form When using styled-components in my React app, how do I set FormTitle styles like this?
Expected Output:

I want to do FormTitle and FormDescription are separate in the new line?
Code snippet: (DEMO)
https://codesandbox.io/s/friendly-currying-533zce?file=/src/App.js
What should I change in my code? Can anyone help me? Thanks

A: You can use Phil's solution, or you can add flex-wrap: wrap; to ReccuringFormRow and width: 100%; to ReccuringFormHeaderCell.


text:
Q: Proving a set is Lebesgue Measurable Measure is a serious weak point of mine, and I cannot figure out this problem:
Let $E \subset \mathbb{R}$ be Lebesgue measurable. Suppose that for all open intervals $I$, we have $m(E\cap I) \leq \frac{1}{2} m(I)$, where $m$ denotes Lebesgue measure. Prove that $m(E)=0$.
Any help is greatly appreciated!

A: We can assume that $m(E)<\infty$ by first considering the sets $E\cap[n,n+1]$, $n\in\mathbb{Z}$, which would satisfy the same properties. Suppose on the contrary that $m(E) = \alpha>0$. Then there exists an open set $V$ (which we could write as a countable union of disjoint intervals $V = \cup{I_k}$) such that $E\subset V$ and $m(V) < 2\alpha$. Now
$$ m(E) = m(E\cap V) = m(E\cap(\cup{I_k})) = m(\cup{(E\cap I_k)}) = \sum{m(E\cap I_k)}.$$
Derive a contradiction.

A: Since $E \subset \mathbb{R}$ is Lebesgue measurable, there exists pairwise disjoint interval $I_i$ such that
$$
E\subset \bigcup_{i=1}^{\infty} I_i\quad\text{ and }\quad m(E)=\inf{ \sum_{i=1}^{\infty} m(I_i)}\tag{1}
$$
Since
$$
\quad E=E\cap\bigcup_{i=1}^{\infty} I_i=\bigcup_{i=1}^{\infty} (E\cap I_i)
$$
By Lebesgue measure
$$
m(E)\leqslant\sum_{i=1}^{\infty} m(E\cap I_i)\leqslant \frac1{2}\sum_{i=1}^{\infty}m(I_i)
$$
By (1), we have
$$
m(E)\leqslant \frac1{2}m(E)
$$
Thus  $m(E)=0$.


text:
Q: How to programmatically create roles in AWS organisation member accounts I want to separate out AWS resources for a multi-tenanted SaaS into separate accounts under an AWS Organization.

*

*I have multiple OUs, split by function, e.g. logs, audit, compute.  I will have SCPs associated with each OU.

*Each tenant will have an account under each OU, which means as I add new tenants, each account will inherit the respective SCP to that OU.

To enable the developers to build out the platform and to be able to debug the running system, I want to use a hub-and-spoke type approach to access control using a federated IdP, similar to that described here: https://segment.com/blog/secure-access-to-100-aws-accounts/.
Specifically, I will have an identity account that will be bound to Okta.  Users will authenticate into this account and then use sts:assume-role to escalate to roles in other accounts.  Note that I want a separate identity account and not have users authenticate to the master account in the organization (thus within the organization, we have master and identity accounts, plus the OUs each with their respective accounts).
In order to programmatically create a new tenant, I need to create the tenant's accounts and place them in the correct OU, and therefore this needs to be done in the master account.  I can do this by creating a role within the master account and having developers assume that role from the identity account.
How do I create roles in the new accounts that developers can assume from the identity account?  Member accounts have a role called OrganizationAccountAccessRole automatically created (see here for details), but that is set to only be accessible from the master account and it enables access to everything in that account.  How can I enable a developer within the identity account to programmatically create new accounts and the roles within them without granting such all-powerful permissions (they should have no more permissions to perform this task than necessary).  I don't think I can assume a role in the master account from the identity account and then further assume a role in a third account?
EDIT: I am really only interested in answers that address the steps/configuration needed to achieve the solution I describe.

A: Cloudformation StackSets addresses this problem.
Basically, the steps are:

*

*Set up roles in the child accounts that have permissions to deploy resource with a trust relationship to the role of the parent account (which you're deploying from)

*Create a StackSet in parent account and deploy a Cloudformation template into it to selected accounts or Organizational Units (OU) or whole organization
StackSets supports AWS Organizations so you can select OU's instead of selecting individual accounts.

A: I would put forward that an elegant solution is to use the AWS Service Catalog product which allows you to create and manage catalogs of services that are approved for use in your AWS environment.  As a matter of fact, the setup described in this AWS blog post can be customized to achieve what you want.  It provides an example for creating an Account Builder product that when launched by your end users, uses an AWS Lambda script to:

*

*Provision an AWS member account

*Assume the Organizational Role for the account

*Use a CloudFormation template to customize the account (in your case, to create the additional IAM roles)

You can customize it further to even delete the Organizational Role account when it's done.
Source code for the Lambda function along with the CloudFormation templates is provided that you can tweak to produce the exact behavior you are looking for.
Hope this helps.


text:
Q: Three js shadows I've been working on scene in tree.js to help understand how to create a scene similarly to how I would in 3dsMax. I'm at the point where I'm trying to add shadows.
From what I've read I should be seeing a shadow on the ground, cast by lightSpot_Right, and barStool being the occlusion object. But I'm not! If anyone has any suggestions it would be much appreciated!
///webGL - Locking down the Basics
/////////////////////////////////////////////////////////////Environment Settings///////////////////////////////////////////////////////////////////////
///Renderer
var scene = new THREE.Scene();

var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);

renderer.shadowMapEnabled = true;

document.body.appendChild(renderer.domElement);

///Camera's
var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
scene.add(camera);

var cubeCamera = new THREE.CubeCamera(1, 1000, 256); // parameters: near, far, resolution
cubeCamera.renderTarget.texture.minFilter = THREE.LinearMipMapLinearFilter; // mipmap filter
scene.add(cubeCamera);

camera.position.set(0, 16, 25);
camera.rotation.x += -0.32;

///Controls

///Lights

var lightSpot_Right = new THREE.SpotLight(0xffffff);
lightSpot_Right.position.set(50, 50, 0);
lightSpot_Right.castShadow = true;
lightSpot_Right.shadowMapWidth = 1024;
lightSpot_Right.shadowMapHeight = 1024;
lightSpot_Right.shadowCameraNear = 500;
lightSpot_Right.shadowCameraFar = 4000;
lightSpot_Right.shadowCameraFov = 30;
scene.add(lightSpot_Right);

var lightDirect_Left = new THREE.DirectionalLight(0xffffff, 0.25);
lightDirect_Left.position.set(-1, 0, 0);
scene.add(lightDirect_Left);

//var lightAmb = new THREE.AmbientLight(0x262626); // soft white light
//scene.add(lightAmb);

///Loaders
var loadTexture = new THREE.TextureLoader();
var loader = new THREE.JSONLoader();

///skyBox
var imagePrefix = "textures/";
var directions = ["skyboxRight", "skyboxLeft", "skyboxTop", "skyboxBottom", "skyboxFront", "skyboxBack"];
var imageSuffix = ".jpg";

var skyMaterialArray = [];
for (var i = 0; i < 6; i++)
    skyMaterialArray.push(new THREE.MeshBasicMaterial({
        map: new THREE.TextureLoader().load(imagePrefix + directions[i] + imageSuffix),
        side: THREE.BackSide
    }));
var skyMaterial = new THREE.MeshFaceMaterial(skyMaterialArray);

var skyGeometry = new THREE.CubeGeometry(500, 500, 500);
var skyBox = new THREE.Mesh(skyGeometry, skyMaterial);
scene.add(skyBox);

var groundPlaneMat = new THREE.MeshPhongMaterial({

})

////////////////////////////////////////////////////////Object Settings//////////////////////////////////////////////////////////////////

//Textures
var seatTexture = loadTexture.load("textures/Maharam_Mister_Notice_Diffuse.jpg");

var conceteDiffuse = loadTexture.load("textures/Contrete_Diffuse.jpg");
var conceteNormal = loadTexture.load("textures/Contrete_Normal.jpg");
var conceteSpecular = loadTexture.load("textures/Contrete_Specular.jpg");

///Materials
var seatMaterial = new THREE.MeshLambertMaterial({
    map: seatTexture,
    side: THREE.doubleside
});
var frameMaterial = new THREE.MeshPhongMaterial({
    envMap: cubeCamera.renderTarget,
    color: 0xcccccc

});
var frameHardwareMat = new THREE.MeshPhongMaterial({
    color: 0x000000
});
var feetMat = new THREE.MeshPhongMaterial({
    color: 0x050505,
    shininess: 99
});

var sphereMat = new THREE.MeshPhongMaterial({
    envMap: cubeCamera.renderTarget

});

var groundMat = new THREE.MeshPhongMaterial({
    map: conceteDiffuse,
    specularMap: conceteSpecular
});

///Geometry and Meshes
var barStool = new THREE.Object3D();
scene.add(barStool);
barStool.castShadow = true;

var seatMesh;
loader.load("models/stoolSeat.js", function (geometry, material) {
    seatMesh = new THREE.Mesh(geometry, seatMaterial);
    seatMesh.scale.set(.5, .5, .5);
    barStool.add(seatMesh);

});

var frameMesh;
loader.load("models/stoolFrame.js", function (geometry, material) {
    frameMesh = new THREE.Mesh(geometry, frameMaterial);
    frameMesh.scale.set(.5, .5, .5);
    barStool.add(frameMesh);

});

var frameFeetMesh;
loader.load("models/stoolFeet.js", function (geometry, material) {
    frameFeetMesh = new THREE.Mesh(geometry, feetMat);
    frameFeetMesh.scale.set(.5, .5, .5);
    barStool.add(frameFeetMesh);
});

var frameHardwareMesh;
loader.load("models/stoolHardware.js", function (geomtry, material) {
    frameHardwareMesh = new THREE.Mesh(geomtry, frameHardwareMat);
    frameHardwareMesh.scale.set(.5, .5, .5);
    barStool.add(frameHardwareMesh);
});

var sphereGeo = new THREE.SphereGeometry(2.5, 50, 50);
var sphereMesh = new THREE.Mesh(sphereGeo, sphereMat);
scene.add(sphereMesh);

sphereMesh.position.set(-10, 5, 0);

var groundGeo = new THREE.PlaneGeometry(100, 50, 1);
var groundMesh = new THREE.Mesh(groundGeo, groundMat);
scene.add(groundMesh);

groundMesh.rotation.x = -90 * Math.PI / 180;
groundMesh.receiveShadow = true;

///Render Scene

var render = function () {

    requestAnimationFrame(render);
    barStool.rotation.y += 0.01;

    sphereMesh.visible = false;
    cubeCamera.position.copy(sphereMesh.position);
    cubeCamera.updateCubeMap(renderer, scene);
    sphereMesh.visible = true;
    /*
    frameMesh.visible = false;
    cubeCamera.position.copy(frameMesh.position);
    cubeCamera.updateCubeMap(renderer, scene);
    frameMesh.visible = true;
    */
    renderer.render(scene, camera);
};

render();

A: I figured it out!  I should of been assigning .castShadow = true; to the mesh objects instead of setting it to barStool which is an empty Object3D whom is the parent of the meshes that contain the stool.