text:
Q: Fundamental solution of Helmholtz equation in $L^p$? why? Let $N \geq 2$ an natural number and let $k>0$. Consider de equation defined on $\mathbb{R}^N\setminus \{0\}:$
$$\Delta u(x)-k^2u(x)=0.$$
It is known that if $k=1$ then $E_N(x)=\gamma_N |x|^{1-N/2}K_{\frac{N}{2}-1}(|x|)$ is solution of the equation above where $\gamma_N =(2 \pi)^{-N/2}$ and $K_{\frac{N}{2}-1}$ is the modified Bessel function of second kind of order $N/2-1$. for general $k>0$ is an
fact that $E_N^k(x)=k^{N-2}E_N(kx)$ solves the above equation too. In what follows $l_q:=2^{q-1}\Gamma(q)$. Here are some facts about the fundamental solution $E_N^k$:

*

*$E_N^k \in C^{\infty}(\mathbb{R}^N \setminus \{0\}),$

*$E_N^k(x)>0,$

*$\lim_{|x| \to 0}\frac{E_2^k(x)}{-\ln(k|x|)}=\frac{1}{2 \pi l_1},$

*For $N \geq3$ follows that $\lim_{|x|\to 0}|x|^{N-2}E_N^{k}(x)=\gamma_N l_{\frac{N}{2}-1},$

*For $N \geq2$ follows that $\lim_{|x| \to 0}|x|^{N-1}|\nabla E_N^k(x)|=\gamma_N l_{\frac{N}{2}},$

*$\lim_{|x| \to \infty}e^{k|x|}E_N^{k}(x)=0$ and $\lim_{|x| \to \infty}e^{k |x|}|\nabla E_N^{k}(x)|=0.$
The properties above they are all very clear for me and with a lot of work I was able to prove each one of them. What I wish to understand is the following: How can I use the properties of $E_N^k$ stated above to prove that

*

*$E_2^k \in L^p(\mathbb{R}^N)$ for $1 \leq p <\infty,$

*$E_N^k \in L^{p}(\mathbb{R}^N)$ for $1 \leq p <\frac{N}{N-2}$ for $N \geq3,$

*$\partial_iE_N^{k} \in L^{p}(\mathbb{R}^N)$ for $1 \leq p<\frac{N}{N-1}$
for $N \geq 2$ and $i=1,2,\dots,N.$
I think that is useful in this context the use of the coarea formula which can be found here:https://en.wikipedia.org/wiki/Coarea_formula. But i'm having no success in the application of the formula because I'm having difficulty in using the properties above, the reason is I have no idea on how to make the terms $|x|^{N-2}$ or $e^{k |x|}$ to appear and apply the limits above. That is the reason why I need help and hints on how to proceed, every idea will be very useful and I will read and learn with care, thank you so much for the attention.


text:
Q: iOS binding project - Error MSB6006: "zip" exited with code 255 I have been trying to bind the PayPalHereSDKv2 from this cocoa pod. I have, I think, bound the project and its dependencies but now when I go to build I am getting this error:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.ObjCBinding.CSharp.targets(3,3): Error MSB6006: "zip" exited with code 255. (MSB6006) (PayPalHereSDKv2.PodBinding.iOS)

Not to sure where to go from here? has anyone ever seen this?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Random record selection and pagination in rails 4 I need to select random 5 records in sqlite3 and paginate them.
def test
    add_breadcrumb "Age Test", ages_test_url
    @posts = Age.limit(5).order('RANDOM()')
    @posts = @posts.page(params[:page]).per_page(2)
end

The above code displays all the record but I need only 5.

A: Try alternative syntax:
Age.paginate(:page => params[:page], :per_page => 2).order('RANDOM()').limit(5)

However, what is the point of paginating a random set of elements. Every time a user visits the first "page" s/he will see elements other than s/he saw the first. The idea of paginating a randomized elements doesn't seem logical.


text:
Q: How can I determine if a Zip Bomb error thrown when retrieving an Excel files Styles Table is legitimate? I've got a piece of code which is erroring when I attempt to get the Styles Table for an Excel file, using Apache POI's XSSFReader. All I do, involving the file, is shown below:
XSSFReader reader = new XSSFReader(OPCPackage.open(excelFile.getPath(), PackageAccess.READ));
StylesTable table = reader.getStylesTable();

I get the following error:

Caused by: java.io.IOException: Zip bomb detected! The file would
exceed certain limits which usually indicate that the file is used to
inflate memory usage and thus could pose a security risk. You can
adjust these limits via setMinInflateRatio() and setMaxEntrySize() if
you need to work with files which exceed these limits. Counter:
1644067, cis.counter: 16384, ratio: 0.009965530601855033Limits:
MIN_INFLATE_RATIO: 0.01, MAX_ENTRY_SIZE: 4294967295

How can I tell if this is a false positive (opening the file in Excel it seems fine), and if so how can I appropriately deal with this?

A: These checks are mainly intended for cases where you accept documents from untrusted peers, e.g. when users on your website can upload arbitrary documents for processing via your service.
In this case you want to avoid receiving documents which can blow up your server due to excessive memory usage.
Therefore Apache POI has default limits that the developers deemed "sane" to allow processing of almost all valid documents, but should block all maliciously formatted documents.
Whenever you know where the document originates and you trust the source to not produce malicious documents, you can safely set higher limits if necessary. In your case the size of the compressed data is much lower than the expanded data, which is deemed suspicious, thus by setting a lower minimum inflation ratio, e.g. ZipSecureFile.setMinInflateRatio(0.009), prior to loading the document you should be able to make it work for you.


text:
Q: Flagging Pandas row based on same and other row I would like to add a new column to flag rows in a dataframe. The flag is supposed to be done on the following logic:

*

*Rows with the same ID belong together and should be flagged in the same way

*The flag is constructed from four cells with different combinations of "receive" then "float" or "fixed" followed by ", pay" and then "float" or "fixed"

I think an example might make this more clear. This would be the original data frame.
df = pd.DataFrame(data=[[2, 'fix','receive'], [2, 'float','pay'], [3, 'fix','receive'], [3, 'fix','pay'], [7, 'float','pay'], [7, 'float','receive']], columns=["ID", "Structure","Leg"])

And this should be the result after applying the above logic and creating a new column that flags each row:
df["Flag"] = ["Receive fix, pay float", "Receive fix, pay float", "Receive fix, pay fix","Receive fix, pay fix","Receive float, pay float","Receive float, pay float"]

So, my main questions is how I can loop through the dataframe to find two rows with the same ID and then use information from those two rows to create the same flag for each of the two rows. Thanks a lot for your ideas.
I don't know if this goes into the right direction, but this is my attempt. The problem remains as to how to get the data from the second row that has the same ID.
df["Flag"] = "???"
for index, row in df.iterrows():
    if row["Leg"] == "receive":
        df.at[index, "Flag"] = row["Leg"] + " " + row["Structure"] + ", pay ?"

A: First sorting by DataFrame.sort_values by both columns, then create new column and last use GroupBy.transform with join for new column:
df = df.sort_values(['ID','Leg'], ascending=[True, False])
df['new'] = df["Leg"] + " " + df["Structure"]
df["Flag"] = df.groupby('ID')['new'].transform(', '.join)
print (df)
   ID Structure      Leg                      Flag            new
0   2       fix  receive    receive fix, pay float    receive fix
1   2     float      pay    receive fix, pay float      pay float
2   3       fix  receive      receive fix, pay fix    receive fix
3   3       fix      pay      receive fix, pay fix        pay fix
5   7     float  receive  receive float, pay float  receive float
4   7     float      pay  receive float, pay float      pay float

Solution with helper Series:
df = df.sort_values(['ID','Leg'], ascending=[True, False])
s = df["Leg"] + " " + df["Structure"]
df["Flag"] = s.groupby(df['ID']).transform(', '.join)
print (df)
   ID Structure      Leg                      Flag
0   2       fix  receive    receive fix, pay float
1   2     float      pay    receive fix, pay float
2   3       fix  receive      receive fix, pay fix
3   3       fix      pay      receive fix, pay fix
5   7     float  receive  receive float, pay float
4   7     float      pay  receive float, pay float


text:
Q: Skip link cutting off top of header across website I'm trying to implement a skip link on a site with a fixed header. Whenever I activate the skip link (using an anchor link), the top of the page then gets cut off.

This is happening across the site, wherever the ID main-content has been indicated.
I have considered adding the anchor to a span element, but this would go against best practices and be unhelpful for screen reader users. I also don't think this would resolve the issue.
I have tried adding padding and margins to the ID, but with no luck.
Here's the HTML in the theme file:
Skip to main content

And here's the CSS:
.button--skip-link:not(:focus):not(:hover) {
    -webkit-transform: translateY(-4em);
    -ms-transform: translateY(-4em);
    transform: translateY(-4em);
    opacity: 0;
}

button:focus,
.button:focus {
    border-color: #062434;
}

button:hover, button:focus,
.button:hover, .button:focus {
    background-color: #08364E;
    text-decoration: none;
    color: #fff;
}

.button--skip-link {
    margin: 0 auto;
    position: absolute;
    z-index: 20;
    left: 0;
    right: 125em;
    top: 1em;
    width: 10em;
    opacity: 1;
}

I expect the Skip Link to bring the anchor link into focus (as it does). But I also expect the top of the header to not be cut off when the Skip Link has been activated.

A: I didn't get much clearer what you're trying to achieve, but from what I got, see if that's what you're wondering to happen :

#header {
  position: fixed;
}

#blue {
  background-color: blue;
  width: 100%;
  height: 600px;
}

#red {
  background-color: red;
  width: 100%;
  height: 600px;
}

  Click here to go to red and jump blue

A: Make the skip link always visible. Do not be ashamed of being accessible.
Your skip link is hidden. It will have no utility for a vast majority of users who want direct visual access to that information (without having to focus the link)

*

*using touch screen (smartphone),

*eye tracking devices,

*screen magnifiers,

*people with physical disabilities who have difficulty to use a mouse

*voice recognition....

Screen reader users will ear something they can't view on the screen; because screenreader users are not all blind : people with  cognitive disabilities  (post stroke disorders for instance like aphasia), illiterate, non-native speakers, ...


text:
Q: Execute all unit test using a function C# Is there a way to execute all of the C# unit tests (xUnit) within the console application? So that the end user can see the results while running the program?
Let's say that we have simple switch case menu like:

*

*Do something,

*Do something different

*Run unit tests.

So that when the input from user's keyboard equals 3 all of the unit tests from the project are executed and the result is printed?
Thanks in an advance for the help

A: Assuming that your tests live in a C# project called MyTest.csproj, you'd start them from the CLI via dotnet test MyTest.csproj.
If you want to do this from within your own application, you could use Process.Start like this:
if (chosenMenuItem == 3)
  Process.Start("dotnet", "test MyTest.csproj");

That will start the test run.
If you want to get the test output as well, you could follow this great answer: https://stackoverflow.com/a/4291965/4919526


text:
Q: how can i change the navigation bar of MFMailComposeViewController? i want to change the navigation bar of MFMailComposeViewController to black color.
how can i change.

A: Note that MFMailComposeViewController inherits from UINavigationController so it also has navigationBar property.
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.navigationBar.barStyle = UIBarStyleBlack;

A: I know this post is quite dated but for someone who might find it useful, try:
MFMailComposeViewController *mailController  = [MFMailComposeViewController new];

[mailController.navigationBar setTintColor:[UIColor colorWithHue:240.0f/359.0f
                                                      saturation:85.0f/100.0f
                                                      brightness:60.0f/100.0f
                                                           alpha:0.0f]];


text:
Q: How can i change the application name in xamarin android? Explaination
The icon label is being overwritten by the Label specified on my Main Activity Label.
My AndroidManifest.xml has:
<manifest>
<application android:label="@string/app_name" />
</manifest>

My AssemblyInfo.cs has:
#if DEBUG
[assembly:Application(Debuggable=true, Label="@string/app_name")]
#else
[assembly:Application(Debuggable=false, Label="@string/app_name")]
#endif

My String.xml has:
<string name="app_name">MyApp</string>

My MainActivity.cs has:
[Activity (Label = "Demo App")]

When I email the apk to the phone, gmail asks me to install 'MyApp', which appears to be coming from the manifest or the Assembly. However, the icon on the App Launch screen shows 'Demo App', which is coming from the MainActivity.cs.
Question
I want the Label from the Activity to be appearing as the title of the app(Demo App), whereas I want the App launch name to be 'MyApp'. Can I override the title somehow to get this working?
Answer
My AndroidManifest.xml has:
<manifest>
<application android:label="@string/app_name" android:icon="@drawable/AppIcon"/>
</manifest>

In String.xml has:
<string name="app_name">MyApp</string>
<string name="Home">Demo App</string>

In  MainActivity.cs:
Instead of this
[Activity (Label = "Demo App")]

use ActionBar to set title,icon. Then you will get different name in app launch screen and home screen.
[Activity(MainLauncher = true, LaunchMode = Android.Content.PM.LaunchMode.SingleTop,)]
public class MainActivity : Activity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        SetContentView(Resource.Layout.main);
        ActionBar.SetIcon(Resource.Drawable.Icon);
        ActionBar.SetTitle(Resource.String.Home);
    }
}

A:
I want the Label from the Activity to be appearing as the title of the app(Demo App), whereas I want the App launch name to be 'MyApp'.

Remove the Label of the MainActivity, set the application in the Manifest.xml via UI or code:
<manifest ...>
    <application android:label="@string/app_name" />
</manifest>

If your MainActivity is AppCompatActivity, you could use Toolbar to display the Activity label:
[Activity(MainLauncher = true, LaunchMode = Android.Content.PM.LaunchMode.SingleTop, Icon = "@drawable/icon")]
public class MainActivity : AppCompatActivity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        SetContentView(Resource.Layout.main);
        var toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
        if (toolbar != null)
        {
            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "Demo App";
        }
    }
}

Effect
Update:
Here is my toolbar.axml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:minHeight="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

main.axml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <include
        android:id="@+id/toolbar"
        layout="@layout/toolbar" />
</RelativeLayout>


text:
Q: What's the correct plural of Jedi and Sith? Lots of times, I see people using "Jedis" and "Siths" (I also use that), but it doesn't feel right. Or, maybe, it's correct.
Is there official word on this? What's the correct plural of Jedi and Sith?

A: Jedi:

Mace Windu: ...you must realize there aren't enough Jedi to protect the Republic. We are keepers of the peace, not soldiers. -- Episode II

Sith:
It's difficult to find conclusive proof that the plural of "Sith" is "Sith" because (a) there are so few Sith and (b) the plural is usually given as "Sith Lords". These are the best I can find in the scripts:

Yoda: Destroy the Sith, we must. -- Episode III

and

Anakin: The Sith rely on their passion for their strength. They think inward, only about themselves. -- Episode III

Yoda and Anakin may be referring to the Sith Order rather than multiple Sith (Sidious and Vader in Yoda's case). In Anakin's case in particular, though, he uses the plural "their", "they", and "themselves" in the two sentences, so it's quite possible he is referring to individual members of the Sith Order. It would also make little sense to say that the Sith Order has "passion for their strength", so it's more likely he's referring to individual Sith members.
Also, this archived page from starwars.com describes the Sith and says:

Power-hungry Sith practitioners fought amongst themselves and dwindled their numbers. Weakened by infighting, the Sith were easily wiped out by the Jedi.

Again, this may refer to the Sith Order rather than multiple Sith, but the previous sentence refers to Sith practitioners rather than the order.
As @Richard noted in a comment, there is no use of "Jedis" or "Siths" in any of the scripts (even in the non-dialogue scene descriptions).

A: The correct answer is "Jedi" and "Sith".

Obi-Wan: But he still has much to learn, Master. His abilities have made him... well arrogant.
Yoda: Yes. Yes. A flaw more and more common among Jedi. Too sure of themselves they are. Even the older, more experienced ones.

Obi-Wan: You were the chosen one! It was said that you would destroy the Sith, not join them. You were to bring balance to the force, not leave it in darkness.
Anakin Skywalker: [shouts] I hate you.

A: Pre-Visla:
You're not Jedi, so what are you?
Darth Maul:
We are Sith.
Pre-Visla:
Do you serve Count Dooku?
Darth Maul:
I serve no one.
Pre-Visla:
I thought there can only be two Sith: a master and an apprentice?
INDISPUTABLE EVIDENCE!

A: "The Jedi" refers collectively to the group. You can probably go either way with the plural: "There are 3 Jedi(s) in the next room" / "There are 3 Jedi masters in the next room".
"Siths" sounds like you have a speech impediment.
And don't quote Yoda here. Bad example his grammar is, mmmmmyesssssssss.


text:
Q: Can't get facebook user age_range public value I have an issue with grabbing facebook user details from my MVC web application. I want to grab the age_range value (which is public value and is included public_profile) or the user_birthday value, which is giving it's value only to the app administrator.
var x = new FacebookAuthenticationOptions();
            x.Scope.Add("user_birthday");
            x.Scope.Add("email");
            x.Scope.Add("public_profile");
            x.Scope.Add("user_friends");
            x.Scope.Add("age_range");

            x.AppId = "....";
            x.AppSecret = "....";
            x.Provider = new FacebookAuthenticationProvider()
            {
                OnAuthenticated = async context =>
                {
                    context.Identity.AddClaim(new System.Security.Claims.Claim("FacebookAccessToken", context.AccessToken));
                    foreach (var claim in context.User)
                    {
                        var claimType = string.Format("urn:facebook:{0}", claim.Key);
                        string claimValue = claim.Value.ToString();
                        if (!context.Identity.HasClaim(claimType, claimValue))
                            context.Identity.AddClaim(new System.Security.Claims.Claim(claimType, claimValue, "XmlSchemaString", "Facebook"));
                    }
                }
            };

            x.SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie;
            app.UseFacebookAuthentication(x);

and another code chunk, which is grabbing the values.
var firstNameClaim = info.ExternalIdentity.Claims.First(c => c.Type == "urn:facebook:first_name");
                var lastNameClaim = info.ExternalIdentity.Claims.First(c => c.Type == "urn:facebook:last_name");
                var DOBClaim = info.ExternalIdentity.Claims.First(c => c.Type == "urn:facebook:birthday");
                var ageRange = info.ExternalIdentity.Claims.First(c => c.Type == "urn:facebook:age_range");

So can anyone help me to grab the user age_range value ??


text:
Q: How to make Bibliography in style
I have read and watch some tutorial "how to make bibliography" like the picture. But, I can't understand how to make it. please give me with some codes (tex and bib files) which I can edit for my purposes.


text:
Q: Button not working in certain parts of my HTML I have a button id="getstarted" located near the top and the bottom of my HTML. The button near the top works, but the one near the bottom does not work. They are formatted exactly the same. I want both buttons to work.
Here is my code.
**edited code. I added onclick="window.location.href = 'getstarted.html';" to my buttons. now the first button works, but the second one does not work. how do I get the second button to work?

$(document).ready(function() {
  $(window).scroll(function() {
    if ($(this).scrollTop() > 70) {
      $('#header').fadeIn(500);
    } else {
      $('#header').fadeOut(500);
    }
  });

});

$(document).ready(function() {
  $(window).scroll(function() {
    if ($(this).scrollTop() > 70) {
      $('#pricing').css("color", "#000");
    } else {
      $('#pricing').css("color", "#FFF");
    }
  });

});

// slideshow
$(document).ready(function() {
  $("#laptopslideshop > div:gt(0)").hide();

  setInterval(function() {
    $('#laptopslideshop > div:first')
      .fadeOut(500)
      .next()
      .fadeIn(500)
      .end()
      .appendTo('#laptopslideshop');
  }, 3000);
});
@import url('https://fonts.googleapis.com/css?family=Nunito+Sans');
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#header {
  position: fixed;
  top: 0px;
  width: 100%;
  height: 84px;
  background-color: #FFFFFF;
  color: #000;
  z-index: 1;
  display: none;
}

@media (max-width: 768px) {
  #header {
    height: 60px;
  }
}

#main {
  height: 100vh;
  width: 100%;
  background: url(Images/teamchat.jpg) no-repeat center;
  background-size: contain;
  background-size: cover;
}

.headerContents {
  text-align: right;
  height: 100%;
  width: 100%;
  float: right;
  z-index: 2;
  position: fixed;
}

.headerpandc {
  margin-right: 18%;
  margin-top: 17px;
  position: relative;
}

@media (max-width: 768px) {
  .headerpandc {
    margin-right: 4%;
    margin-top: 14px;
  }
}

#pricing {
  font-family: Nunito Sans;
  margin-right: 55px;
  font-weight: 800;
  letter-spacing: 0.1em;
  font-size: 18px;
  text-decoration: none;
  color: #FFF;
  transition: 0.6s;
}

@media (max-width: 768px) {
  #pricing {
    font-size: 12px;
    margin-right: 3%;
  }
}

@media (max-width: 355px) {
  #pricing {
    display: none;
  }
}

#pricing:hover {
  text-decoration: underline;
}

#pricing:active {
  color: #000;
}

#getstarted {
  font-family: Nunito Sans;
  background-color: #5a52ff;
  border-radius: 10px;
  border: none;
  color: white;
  padding: 11px 25px;
  text-align: center;
  font-size: 18px;
  transition: 0.3s;
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.05em;
  outline: none;
}

@media (max-width: 768px) {
  #getstarted {
    padding: 8px 15px;
    font-size: 12px;
  }
}

#getstarted:hover {
  background-color: #3d33ff;
}

#getstarted:active {
  transform: translateY(2px);
  box-shadow: 0 1px #666;
}

#telosdesignlogo {
  float: left;
  height: 30px;
  margin-left: 18%;
  margin-top: 6px;
}

@media (max-width: 768px) {
  #telosdesignlogo {
    margin-left: 4%;
    height: 23px;
  }
}

/*main text*/

#mainbox {
  height: 470px;
  width: 500px;
  text-align: left;
  position: relative;
  top: 250px;
  left: 28%;
  font-family: Nunito Sans;
  color: #FFF;
}

#hitelos {
  font-size: 2.5em;
  font-weight: lighter;
}

#maintext {
  font-weight: 800;
  font-size: 3.5em;
}

#mainpricing {
  z-index: 5;
}

/* Laptop slideshow begins */

#laptopslideshop {
  position: relative;
  margin-top: 50px;
  width: 240px;
  height: 240px;
  padding: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}

.mySlides {
  position: absolute;
  width: 100%;
}

    Pricing<button id="getstarted" onclick="window.location.href = 'getstarted.html';">Get Started</button>

      Hi! We're Telos.

      Beautiful websites tailored to your unique business.

    <button id="getstarted" onclick="window.location.href = 'getstarted.html';">Get Started</button>

A: id should be unique to an element(just one), use a class instead
In your code you use javascript(jquery) to control href, not html, see onclick.
<button id="getstarted" onclick="window.location.href = 'getstarted.html';">

The javascript is taking in consideration only the first element because no other element with the same id should exist.
--
I see that you have also:

What this code is doing ?
Check the web browser console for JavaScript errors from other sources/code.

A: Try with this code

 Pricing
 <button id="getstarted">Get Started</button>


text:
Q: Проблема с Newtonsoft.Json Для парсинга json использую библиотеку Newtonsoft.Json, был рабочий код:
dynamic json = JsonConvert.DeserializeObject<dynamic>(rawJson);
return json.services;

Все было ок, но вот на днях понадобилось доделать этот проект, добавил фичу, скомпилил, и вдруг получаю Exception в этом коде!
"Newtonsoft.Json.Linq.JObject" не содержит определения для "services"

Использую MS VS 2012 Json.Net ставил через NuGet
P.S. находил похожую проблему на просторах интернета, помогло переустановка винды и студии, не хочю так, да и странно как то...
A: Во первых, воспользуйтесь отладчиком, чтобы проверить что-же там есть внутри объекта json. Можно в Locals, QuickWatch или Watch посмотреть значение json.ChildrenTokens - там будет то, что действительно распарсилось.
Если services там нет, то есть два варианта:

*

*там есть что-то другое, и у вас все таки другой json

*у вас подгрузилась какая-то кривая версия json.net

Проверить можно на минимальном примере (который должен быть у вас в вопросе, раз вы просите помочь с отладкой):
string rawJson = "{ \"currentVersion\" : \"10.02\", \"folders\" : [ \"DAP\", \"DASP\" ], \"services\" : [ {\"name\" : \"AdmDelenie\", \"type\" : \"MapServer\"}, {\"name\" : \"Administr\", \"type\" : \"MapServer\"} ] }";

dynamic json = JsonConvert.DeserializeObject<dynamic>(rawJson);
var services = json.services;

Если этот пример работает - то у вас другой json. Этот вы привели в комментариях. Ищите разницу.
Если этот пример не работает - значит или у вас какая-то древняя битая версия json.net, или подгружется что-то кривое, напрмиер, не из папки bin, а из gac.
Проверить можно в окне Debug / Windows / Modules - найдите там newtownsoft.json и посмотрите откуда он загружен. Автор newtownsoft.json злоупотребляет релизом версий без увеличения assembly version, так что вполне возможно что у вас загружается что-то совсем не той версии (например, что-то древнее с багом в парсинге dynamic).
Кстати, в студии есть встроенный генератор классов из JSON: Edit/Paste special/JSON as Classes. Пользуйтесь ими вместо dynamic:
// переименовать в что-то более осмысленное
public class Rootobject
{
    public string currentVersion { get; set; }
    public string[] folders { get; set; }
    public Service[] services { get; set; }
}

public class Service
{
    public string name { get; set; }
    public string type { get; set; }
}

Rootobject stronglyTyped = JsonConvert.DeserializeObject<Rootobject>(rawJson);

A: Не хочу показаться кэпом, но наверно причина в том, что json объект не содержит свойства services. Вообще юзать dynamic не стоит, тормозная это штука, лучше парсить json в строго типизированный объект.
A: Как-то так:
// Получаем JObject.
public JObject GetJson()
{
    var serializer = JsonSerializer();

    // В качестве параметра конструктора, поток содержащий данные json.
    using(var sr = new StreamReader(new MemoryStream()))
    {
        using(var jtr = JsonTextReader(sr))
        {
            string json = serializer.Deserialize(jtr).ToString();

            return JObject.Parse(json);
        }
    }
}

// Получаем объект JObject.
var myObj = GetJson();

// Получаем значение.
var value = myObj["currentVersion"].ToString(); // 10.02


text:
Q: Programming in c using cygwin I was planning to program in c using cygwin on windows. Does this have any performance drawbacks when compared to using gcc in ubuntu?

A: I've used Cygwin on Windows 7 and Windows 2008 R2 for C development.  The experience was painful: not only slow, but I never did manage to get my preferred editor (Emacs) working properly in Cygwin.
You could try a live distro of Linux that you could boot from a USB memory stick.  That way you could program in C to your heart's content without having to install any software on your PC.  I'd recommend Puppy Linux if you took that approach.
Alternatively, you could install a virtualisation product (like VirtualBox) and create a Linux VM.  In that case, I'd suggest using Ubuntu.
My experience is that either the live distro or VM approach would be better than using Cygwin as a development environment.

A: You won't get the exact same performance.  But whether this is a drawback or not depends on what you are doing.

A: Few more things to understand:
GCC-Cygwin:
Pros -

*

*Compiling C code using gcc under cygwin would generate a windows executable, which uses the cygwin.dll(Posix emulation layer) linked dynamically into your app/code. So if you need to execute this app from some other path or other windows machine, that should have cygwin installed and in its path  else you get error.

*Cygwin provides a benefit in that, if you have a POSIX compliant code developed on Linux-gcc you can compile it with no changes at all(very little changes in some case) on windows. So it kind of provides Posix compatibility on windows.
Cons -

*

*If you are going to run some which is going to consume heavy system resources(memory,CPU) then not sure how cygwin would scale up as compared to a native executable on Linux.

*Sometimes, Debugging using ddd on cygwin, I have found some weird crashes/hang of the ddd.
GCC-Linux:

*

*If your final app is going to be executing on Linux, it makes sense to compile, and debug it under the same environment. Linux-gcc.

*For Debugging , linux would provide you lot of tools (gdb/ddd, valgrind), etc.

*If you want to accelerate some critical protion of code, using inline assembly with gcc under linux is nicely defined and has no issues working.(Udner Cygwin, i have faced sometimes that getting a inline assembly compiled was a problem)

*If you want to add multiple threads for execution on multiple processors/cores, then pthreads comes to your help(Not sure about the same udner cygwin)


text:
Q: Lucene query parser not parse field as expected I want to parse a simple query using lucene (3.0.3):
title:(+return +"pink panther")

Just like in the documentation example.
The expected result is:
+title:return +title:"pink panther"

But instead i get:
+title:return +title:"itle return pink panther"

The code is very simple (c#):
Query query =
    new QueryParser(
        Lucene.Net.Util.Version.LUCENE_30,
        "content",
        new Lucene.Net.Analysis.Standard.StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30))
    .Parse("title:(+return +\"pink panther\")");

A: I'm unable to reproduce this. Does this still occur for you?
I'm thinking that it may be some display artifacts from the output window. Is this from the Immediate Window, the Watch Window or a call to Console.WriteLine?

A: Sorry for the trouble, the issue was a custom-modified Lucene.Net assembly...


text:
Q: Can any object in a Cartesian Closed Category regarded as a binary product? Suppose there is an object $Z$ in a CCC, can we regard it as $Z \times 1$ where $1$ is the terminal product? Why it is true or otherwise?

A: Yes, up to isomorphism. You don't even need your category to be cartesian closed, all you need is for it to have a terminal object.
To see this, it is easy to prove that $Z$ satisfies the universal property of the product $Z \times 1$ using the fact that there is a unique morphism from any object to $1$. Since $Z$ satisfies the universal property, it must be isomorphic to $Z \times 1$.


text:
Q: Chess app for iPhone and iPad? I want to improve my chess skills with my iPhone 5s and iPad 3. There are too many chess apps on the App Store for me to test. My ideal app should be free, strong, offers suggestion, nice graphics, adjust level of play etc. The app must play strong chess otherwise I don't learn anything from my games.
Any suggestions? At least I can't find one now.

A: You can try the Chess Free  and Chess * apps, both are free, compatible with iPhone 5S and iPad 3 and top in downloads.
If you want to learn about chess, there are some ebooks like Learn Chess available in app store and you may also try Chess - Play & Learn which was developed for both iPhone and iPad.

A: Stockfish Chess
I think this app has a decent reputation. That's based on my perusal of reviews of chess apps some time ago.


text:
Q: sequential numbering of rows I have to customize a SQL view to be able to perform a system integration test. One table keeps track of the transactions and the LINE ITEMS per transactions (for example, transaction 2 has three items, so there are three consecutive rows corresponding to the same transaction number) What I need to accomplish is to get a column where I keep track of the number of items for THAT transaction, always starting from 1 for each transaction.
For example, the first column is TransactionNumber and the second is DesiredOutput:
1                    1
1                    2
2                    1
2                    2
2                    3
3                    1
4                    1
4                    2

ETC...
I know how to number consecutive rows on the WHOLE table, but I cannot find any reference to this numbering that depends on a value on another row.

A: For SQL Server 2005+ and Oracle you can use the following:
SELECT TransNumber, ROW_NUMBER() OVER(PARTITION BY Transnumber ORDER BY Something) [DESIRED COLUMN OUTPUT]
FROM YourTable


text:
Q: jQueryUI Draggable how do I change object inserted into sortable dynamically I am struggling to find the right way to change the object jQuery UI droppable inserts into the target div.
I have been playing with the stop even but I can not figure out how to change the item's html.
It is a complicated piece of html that I am dragging and I need to take it's ID and send it to a factory function and use the received object for the actual insertion rather than the object dragged and dropped.
I am using draggable with sortable and wiring it with the connect to sortable.
I am using jQuery 1.8.3 and jQuery UI 1.9.2.
Thanks!!
Here is what the code I have looks like:
$(".class").on("dragstop", function (event, ui) {
    var id= ui.helper[0].id;

    var o = $(snippetFactory(id));
   //  I Want "o" to be inserted instead of the object dragged.

});

A: You can use
var id= ui.helper[0].id;
var o = $(snippetFactory(id));
ui.item.replaceWith(o);

A: The event receive in the sortable is your friend (http://api.jqueryui.com/sortable/#event-receive)

*

*ui.item refers to the source-object that is draggable.

*ui.helper gives you the dropped object

So you can do
$(".selector").sortable({
  receive: function(event, ui) {
    var id= ui.helper[0].id;
    var o = $(snippetFactory(id));
    $(ui.helper[0]).replaceWith(o);
  }
});


text:
Q: Why is this happening only on ipad? jQuery reveal dropdown happening twice I have a dropdown which is dynamic so the height should match the content and remain responsive.
It works on everything except ipads (tested on ipad 2 and 3), chrome and safari exhibit same behavior on it. I don't think its a double click issue.
Here is the jfiddle to see the issue:
<!DOCTYPE html>

Test dropdown

The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div.

Any help appreciated.

A: You might not need touchend event listener. Try
$(".byline").on("click", function () {
//e.preventDefault();
//e.stopPropagation();
    var $dd = $(this).next('.toggle_content');
    if ($dd.hasClass("is-visible"))
        $dd.hideMe();
    else
        ($dd.showMe());
        $(".toggle_content").not($dd).hideMe();
});

A: Used the animate function for this issue in the end. It now works on all devices!
https://jsfiddle.net/Bassquake/q2zo6e7b/
I should note, the reason why Im using this kind of dropdown is because I couldnt use anything that used display:none or max-height as the dropdowns content was dynamic.
<!DOCTYPE html>

Test dropdown

The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div. The contents of my div.


text:
Q: Is it possible to change user with Sublime SFTP plugin I use Sublime SFTP plugin to connect to a server as user my.name.
When using Terminal (in ssh session) I have to change my role with sudo -iu project.user to be able to change/update project code.
Is there some trick that would let me change user through Sublime SFTP plugin so that I can update the code, as in "normal" SSH scenario where login user has granted permissions to change the code?


text:
Q: Beginner - Do While loop and Smallest/Largest entry I'm having a problem that I can't figure out, so I am posting my code for some help.   I am a beginner at this and have just addressed do-while loops, so have pity! :)  The assignment was to write an integer entry program that stored smallest and largest, took count of entries and terminated at an entry of -99.   I've found that if I enter some integers, the count is wrong, while others are right.   The data: 15, 30, 25, 20...  comes up as "You've entered 2 numbers".  Other entries come up correct.   I would greatly appreciate anyone telling me what I'm missing.
import java.util.Scanner;

public class LargestSmallest {
public static void main(String[] args)
{
    int entry, smaller=0, larger=0,count=0;
    boolean again=true;
    Scanner input = new Scanner(System.in);

    do
    {System.out.print("Enter your integer: ");
        entry = input.nextInt();

        if (count==0 && entry !=-99)
        {
          larger = entry;
          smaller = entry;
          count +=1;
        }
        else
        {

          if (entry < smaller && entry!=-99 )
          {
              smaller = entry;
              count+=1;
          }
          else if (entry > larger && entry !=-99)
          {
              larger = entry;
              count+=1;
          }
        }

           if (entry == -99)
           again = false;
     }
    while (again);

   if (count >1)
   {
    System.out.println("You entered "+count+" numbers.");
    System.out.println("Your smallest number is: "+ smaller);
    System.out.println("Your largest number is: "+larger);
   }
}

}

A: You are only incrementing count in cases where the smaller or larger numbers are updated. you need to take count += 1; out of the if statements and do it all the time.

A: Since you are incrementing the count only if the condition is satisfied,your count value wont be right if you dont get an entry smaller than the existing smallest or larger than the existing largest.
you have to change as folllows:
 else
            {

              if (entry < smaller && entry!=-99 )
              {
                  smaller = entry;

              }
              else if (entry > larger && entry !=-99)
              {
                  larger = entry;

              }
              count+=1;

            }

               if (entry == -99) {
               again = false;
               count --;
               }

Since you are checking the -99 condition only after the count has been incremented, if the user enters -99 , you have to decrease the counter by 1


text:
Q: hi guis iwant to help me
indeed help me in this problem when I write new subsection enter as shown in table belwo

A: The text seems to be set in two-column mode. Then the star form of the float environments use both columns at the top or bottom of the page, example:
\documentclass[12pt,twocolumn]{article}
\usepackage{lipsum}
\usepackage[a5paper,hmargin=10mm,vmargin=10mm,includefoot]{geometry}
\usepackage{xcolor}

\begin{document}
\begin{table}
  \textcolor{gray}{\rule{12cm}{6cm}}
  \caption{Table too large}
\end{table}

\begin{table*}
  \textcolor{gray}{\rule{12cm}{6cm}}
  \caption{Table spanning both columns}
\end{table*}

\lipsum[2-6]
\end{document}


text:
Q: Access "Exchange Web Services" from Outlook Mobile (failing that, Outlook)? I am aware that there are various protocols by which MS Exchange exposes access to services - including:

*

*EAS : Exchange Active Sync - A proprietary protocol that appears to be the default option for access to Exchange from mobile devices.

*EWS : Exchange Web Services - An openly documented SOAP protocol- a standard Web Service with a WSDL definition.

*Exchange Outlook Anywhere (also known as RPC/HTTP) ...now deprecated in favour of MAPI over HTTP?

If I only have access to Exchange Web Services, for a particular Exchange Server, is there any way to access those services using Outlook Mobile (on Android, iOS or Win-10-phone)?
If direct access is not viable, is there such a thing as an Exchange-Active-Sync (client-side) to Exchange-Web-Services (server-side) bridge?
If no bridge between EAS and EWS exists, is it feasible to deploy Outlook Web App to present EWS services in web browsers on phones? (Essentially, can Outlook Web App be configured to, exclusively, communicate with Exchange using EWS via a Web Proxy?)
If none of the above are feasible, can I use Outlook (on a Windows laptop) to connect to the EWS Service?

A: 1# General mobile devices use ActiveSync to connect to Exchange server.
2# No such bridge between different services.
3# Different protocols are for different services. For example, EWS service is mainly responsible for free/busy, OOF, mailtips and Outlook for Mac connection. ActiveSync is for mobile devices to access. RPC/HTTP and MAPI/HTTP are for Outlook connection. But it doesn't mean that only one protocol is needed for a specific client. For example, even when the Outlook connects to Exchange via RPC/HTTP, it will connect to EWS service when querying free/busy data.
Actually, all of the protocols you mentioned above are based on HTTPS, they use the same port TCP 443 and same certificate(binding with IIS service on Exchange server). And we always use the same namespace for Outlook Anywhere, ActiveSync, EWS service, OAB virtual directory and MAPI/HTTP, such as mail.domain.com.
For the internal clients, there would be no need to limit these services.
For the external clients, make sure to publish the namespace autodiscover.domain.com, mail.domain.com, and the MX records. If you have firewall or proxy server, you may need to set the rule to publish these services. You can google the document related to the firewall/proxy setting you plan to use.
Here is a blog about client access in Exchange 2013, for your reference:
https://blogs.technet.microsoft.com/exchange/2013/01/25/exchange-2013-client-access-server-role/
Hope the above information helps.:)


text:
Q: How to get all values from list inside a dictionary, I need to get title for every item How to get all values from list inside a dictionary? I need to get title for every item.
{'results': [{'id': 654959, 'title': 'Pasta With Tuna', 'image': 'https://spoonacular.com/recipeImages/654959-312x231.jpg', 'imageType': 'jpg'}, {'id': 511728, 'title': 'Pasta Margherita', 'image': 'https://spoonacular.com/recipeImages/511728-312x231.jpg', 'imageType': 'jpg'}, {'id': 654812, 'title': 'Pasta and Seafood', 'image': 'https://spoonacular.com/recipeImages/654812-312x231.jpg', 'imageType': 'jpg'}, {'id': 654857, 'title': 'Pasta On The Border', 'image': 'https://spoonacular.com/recipeImages/654857-312x231.jpg', 'imageType': 'jpg'}, {'id': 654883, 'title': 'Pasta Vegetable Soup', 'image': 'https://spoonacular.com/recipeImages/654883-312x231.jpg', 'imageType': 'jpg'}, {'id': 654928, 'title': 'Pasta With Italian Sausage', 'image': 'https://spoonacular.com/recipeImages/654928-312x231.jpg', 'imageType': 'jpg'}, {'id': 654926, 'title': 'Pasta With Gorgonzola Sauce', 'image': 'https://spoonacular.com/recipeImages/654926-312x231.jpg', 'imageType': 'jpg'}, {'id': 654944, 'title': 'Pasta With Salmon Cream Sauce', 'image': 'https://spoonacular.com/recipeImages/654944-312x231.jpg', 'imageType': 'jpg'}, {'id': 654905, 'title': 'Pasta With Chickpeas and Kale', 'image': 'https://spoonacular.com/recipeImages/654905-312x231.jpg', 'imageType': 'jpg'}, {'id': 654901, 'title': 'Pasta With Chicken and Broccoli', 'image': 'https://spoonacular.com/recipeImages/654901-312x231.jpg', 'imageType': 'jpg'}], 'offset': 0, 'number': 10, 'totalResults': 210}

A: Try this:
# Get all json objects.
for my_dict in data['results']:
   # Get title.
   print(my_dict["title"])

A: You can use a list comprehension:
d = {'results': [{'id': 654959, 'title': 'Pasta With Tuna', 'image': 'https://spoonacular.com/recipeImages/654959-312x231.jpg', 'imageType': 'jpg'},
                 {'id': 511728, 'title': 'Pasta Margherita', 'image': 'https://spoonacular.com/recipeImages/511728-312x231.jpg', 'imageType': 'jpg'},
                 {'id': 654812, 'title': 'Pasta and Seafood', 'image': 'https://spoonacular.com/recipeImages/654812-312x231.jpg', 'imageType': 'jpg'},
                 {'id': 654857, 'title': 'Pasta On The Border', 'image': 'https://spoonacular.com/recipeImages/654857-312x231.jpg', 'imageType': 'jpg'},
                 {'id': 654883, 'title': 'Pasta Vegetable Soup', 'image': 'https://spoonacular.com/recipeImages/654883-312x231.jpg', 'imageType': 'jpg'},
                 {'id': 654928, 'title': 'Pasta With Italian Sausage', 'image': 'https://spoonacular.com/recipeImages/654928-312x231.jpg', 'imageType': 'jpg'},
                 {'id': 654926, 'title': 'Pasta With Gorgonzola Sauce', 'image': 'https://spoonacular.com/recipeImages/654926-312x231.jpg', 'imageType': 'jpg'},
                 {'id': 654944, 'title': 'Pasta With Salmon Cream Sauce', 'image': 'https://spoonacular.com/recipeImages/654944-312x231.jpg', 'imageType': 'jpg'},
                 {'id': 654905, 'title': 'Pasta With Chickpeas and Kale', 'image': 'https://spoonacular.com/recipeImages/654905-312x231.jpg', 'imageType': 'jpg'},
                 {'id': 654901, 'title': 'Pasta With Chicken and Broccoli', 'image': 'https://spoonacular.com/recipeImages/654901-312x231.jpg', 'imageType': 'jpg'}],
 'offset': 0, 'number': 10, 'totalResults': 210}

titles = [i['title'] for i in d['results']]
print(titles)

Output:
['Pasta With Tuna', 'Pasta Margherita', 'Pasta and Seafood', 'Pasta On The Border', 'Pasta Vegetable Soup', 'Pasta With Italian Sausage', 'Pasta With Gorgonzola Sauce', 'Pasta With Salmon Cream Sauce', 'Pasta With Chickpeas and Kale', 'Pasta With Chicken and Broccoli']

Explanation:

*

*First, the way a list comprehension works is like this:

[i for i in d['results']] returns the same result as d['results'].

*Now, you want the value of the 'title' key fr each dictionary in the d['result'] list, so change the i to i['title']:

[i['title'] for i in d['results']]

A: You can iterate over the results list with a simple list comprehension:
results_dict = {'results': [{'id': 654959, 'title': 'Pasta With Tuna', 'image': 'https://spoonacular.com/recipeImages/654959-312x231.jpg', 'imageType': 'jpg'}, {'id': 511728, 'title': 'Pasta Margherita', 'image': 'https://spoonacular.com/recipeImages/511728-312x231.jpg', 'imageType': 'jpg'}, {'id': 654812, 'title': 'Pasta and Seafood', 'image': 'https://spoonacular.com/recipeImages/654812-312x231.jpg', 'imageType': 'jpg'}, {'id': 654857, 'title': 'Pasta On The Border', 'image': 'https://spoonacular.com/recipeImages/654857-312x231.jpg', 'imageType': 'jpg'}, {'id': 654883, 'title': 'Pasta Vegetable Soup', 'image': 'https://spoonacular.com/recipeImages/654883-312x231.jpg', 'imageType': 'jpg'}, {'id': 654928, 'title': 'Pasta With Italian Sausage', 'image': 'https://spoonacular.com/recipeImages/654928-312x231.jpg', 'imageType': 'jpg'}, {'id': 654926, 'title': 'Pasta With Gorgonzola Sauce', 'image': 'https://spoonacular.com/recipeImages/654926-312x231.jpg', 'imageType': 'jpg'}, {'id': 654944, 'title': 'Pasta With Salmon Cream Sauce', 'image': 'https://spoonacular.com/recipeImages/654944-312x231.jpg', 'imageType': 'jpg'}, {'id': 654905, 'title': 'Pasta With Chickpeas and Kale', 'image': 'https://spoonacular.com/recipeImages/654905-312x231.jpg', 'imageType': 'jpg'}, {'id': 654901, 'title': 'Pasta With Chicken and Broccoli', 'image': 'https://spoonacular.com/recipeImages/654901-312x231.jpg', 'imageType': 'jpg'}], 'offset': 0, 'number': 10, 'totalResults': 210}

print([result['title'] for result in results_dict['results']])


text:
Q: C char array is not a string pattern? I am having a compilation error on the following code:
printf((char *) buffer);
and the error message that I am getting is:
cc1: format not a string literal and no format arguments...
I suspect there are some libraries that I forgot to install, as I was able to compile and run the code without an error on the other machine...
PS: The question rises with the fact that I was able to run the same code on some other machine... I suspect a difference in gcc version might cause a problem like this?

A: Newer GCC versions try to parse the format string passed to printf and similar functions and determine if the argument list correctly matches the format string.  It can't do this because you've passed it a buffer for the first argument, which would normally be a format string.
Your code is not incorrect C, it's just a poor usage of C.  As others mentioned you should use "%s" as a format string to print a single string.  This protects you from a class of errors that involve percentage signs in your string, if you don't control the input.  It's a best practice to never pass anything but a string literal as the first argument to the printf or sprintf family of functions.

A: try
printf("%s", (char*) buffer);
;-)

A: This warning is generated by gcc if
-Wformat-nonliteral

is set. It's not part of -Wall or -Wextra (at least for version 4.4.0), so just drop it if you want the code to compile warning-free.

A: This is a warning for your safety, not an error. This new compiler is apparently being more strict about it. I don't think it's actually illegal in C, so the compiler should have an option to disable treating this as an error.
However, you pretty much never want to pass anything other than a string literal as the first argument to printf. The reason that doing so is such a horrible idea that the compiler has a special built-in check to warn you about it is this: Suppose the non-literal string that you pass as the first argument to printf happens to contain printf formatting characters. printf is then going to try to access second, third, fourth, etc, arguments that you didn't actually pass in, and may well crash your program by trying to do so. If the non-literal first argument is actually user-supplied, then the problem is even worse since a malicious user could crash your program at will.


text:
Q: Difference in Engaged Users (Facebook page) and Engaged Users (Insights API) We have a tool connecting with the Facebook Insights API to grab various metrics (Likes, Comments, etc).
One such metric is the Lifetime Engaged Users.
However, we've looked at many FB pages (not going through the API) and the insights numbers seem to be different.
I have used the Graph Explorer to check if there is an error in our request, and this is not the case. For example, in one case, the call returns "13480".
Here is the screenshot from the Insights page:
FB Insights Page
I may not be checking at the correct numbers, but can someone help me out?
I would like to figure out how I can find this particular metric, other than using our tool or using the Graph Explorer.
Thank you!

A: Try this: go recheck your call to API, remove that S from "metricS=metricName".
I met this problem today, and find that there are two ways to get object insight data:

*

*object-id/insights/metricNameA,metricNameB

*object-id/insights/?metric=metricNameA,metricNameB

I happened to use the 2nd way, and wrongly typed metricS instead of metric, which led to return an array of data for all metrics, and my code data[0].values[0].value therefore got the first metric in that array which is "post_story_adds_unique", if you have same mistake as mine, that 13480 could be this 1st metric return by default from FB.


text:
Q: Cannot access hard disks from FreeBSD installation CD I have been using GNU/Linux for several years and now I am giving FreeBSD a try.
Yesterday I managed to install FreeBSD 10.2 on an old computer using a 5 GB partition. I only installed the base system and a few programs and everything seems to work fine. The disk on which I installed FreeBSD contains another primary partition which is used by GNU/Linux.
Today I wanted to try installing FreeBSD on a 43 GB spare disk on another computer. The disk has three primary (empty) partitions already. Using fdisk under GNU/Linux I set the type of one partition to a5 (FreeBSD): I wanted to install FreeBSD on this partition / slice. I then booted the FreeBSD installation CD and expected I would only need to create labels inside the FreeBSD slice, but the FreeBSD fdisk that is started by the installer won't see any partition at all! It reports the whole disk as unused and offers to create a new slice.
For me it is OK to use the whole disk, but why doesn't fdisk see the existing slices? Note that on the older computer I was able to see and use a 5 GB partition using the same installation CD.
Am I overlooking something?
EDIT
I found out there are problems when trying to access the two disks from FreeBSD. After booting the installation CD I opened a shell. I looked for my two disks. If I understood correctly, they are
/dev/ad0           # Blank 43 GB disk where I want to install FreeBSD
/dev/ad2           # 60 GB disk with working Debian 8 on it

When I try to access both disks from the shell with
# diskinfo -c ad0
# diskinfo -c ad2

I get error messages:
(ada1:ata1:0:0:0) READ_DMA. ACB: c8 00 00 00 00 40 00 00 00 01 00
(ada1:ata1:0:0:0) CAM status: ATA Status Error
(ada1:ata1:0:0:0) ATA status: 51 (DRDY SERV ERR), error: 84 (ICRC ABRT )
(ada1:ata1:0:0:0) RES: 51 84 00 00 00 00 00 00 00 00 00
(ada1:ata1:0:0:0) Error 5, Retries exhausted
diskinfo: read: Input/output error

Note that I get the same error on both disks while I can access both disks from Debian. The only thing I can think of is that I need to change some BIOS setting, but I have no idea what the problem could be.
EDIT 2
Booting with
hw.ata.ata_dma=0

seems to solve the problem. I got the hint from here. Still, I am not sure what the problem is and why setting this variable would solve it.
IMO the problem should not be caused by a bad drive because at least one of the disks has no errors (checked it recently for bad blocks). I will check the other disk now.

A: The "geom disk list" command will show you which disk is which.  The problem in dmesg looks like a disk problem, but if the hw.ata.ata_dma=0 workaround worked, then it's probably something between the driver and the controller.


text:
Q: Second JPanel and JTexField look too cramped I have an application where I use two JPanels. One of them is a PaintPanel. The second panel,the jtextfield and the jtextarea work fine but they look too cramped against the right side. I tried changing the sizes with setSize() but it didn't work.
The code for the paintpanel
public void center() {
        jpCenter = new PaintPanel();
        jpCenter.addMouseListener(this);
        jpCenter.setSize(100, 100);
        jpCenter.setBackground(Color.white);
        add(jpCenter, BorderLayout.CENTER);
    }

The code for the panel of the chatbox
public void east() {

        // CREATE EAST Panel
        gl = new GridLayout(4, 1);
        jpEast = new JPanel();
        jpEast.setSize(200, 200);
        jpEast.setLayout(gl);
        jpEast.setBackground(Color.white);

        label = new JLabel("Number of shapes: ");
        jpEast.add(label);
        // ADD TEXT FIELD
        jtf = new JTextField();
        jtf.setText("");
        jtf.setSize(200, 200);
        jpEast.add(jtf);

        // ADD BUTTON
        jbSend = new JButton("Send");
        jbSend.setEnabled(false);
        jbSend.setSize(20, 60);
        jpEast.add(jbSend);
        jbSend.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                send(jtf.getText());
                jtf.setText("");
            }
        });

        // ADD TEXT AREA
        jta = new JTextArea("");
        jta.setSize(100, 100);
        jpEast.add(jta);

        // ADD EAST panel
        add(jpEast, BorderLayout.EAST);
    }

A: Avoid setting the size of components since it can make them not work well on all platforms, and with JTextArea in particular, it will not allow it to expand correctly if held within a JScrollPane (which is where a JTextArea belongs). Note also that most layout managers don't even respect a component's size but rather its preferred size.
Instead, set the row and column properties of your JTextAreas (done most easily via the JTextArea(int row, int column) constructor), the column property of your JTextField, the font sizes of other components (if need be). Then allow your container (JPanel) layout managers and component's own preferred sizes size all appropriately when you call pack() on your top-level window (often a JFrame), after adding all components but before setting it visible.
For more specific help, consider posting an image of the GUI you're getting vs. the one you're trying to achieve.


text:
Q: Write to File in Computer running IAR Workbench I am currently writing and testing an embedded system in which I need to collect data from an accelerometer over a period of time.
I already have functions that can read the data at a point in time during the system's execution. At the moment, the way I was considering writing the data was through a series of printf statements; I know that IAR gives access to an I/O console where the output can be shown. What I was going to do then, was simply perform a series of printfs, ensure the data appears in the console, and after a round of testing, exit the program and copy+paste the data into a file.
This seems like kind of a hack, and I was wondering if it was possible to access the C Standard Libraries like fwrite to create/write a file on the computer IAR is running  and write to it. This way, I don't have to rely on printf statements and can then format the code as I write it to a file.


text:
Q: API Bitfinex: how to place order I am looking to place an order on Bitfinex, somewhere along the line I am doing something wrong (python 3.6.2). Anyone has any idea?
    #PYTHON 3.4
import requests
import json
import base64
import hashlib
import time
import hmac

bitfinexURL = 'https://api.bitfinex.com/v1/order/new'
bitfinexKey = 'xxx'
bitfinexSecret = b'xxx' #the b is deliberate, encodes to bytes

def start():
    payloadObject = {
            'request':'/v1/order/new',
            'nonce':str(time.time() * 100000), #convert to string
            'symbol': 'BTCUSD',
            'amount': '0.01',
            'price': '3000',
            'side': 'SELL',
            'type': 'limit',
    }
    payload_json = json.dumps(payloadObject)
    payload = base64.b64encode(bytes(payload_json, "utf-8"))
    m = hmac.new(bitfinexSecret, payload, hashlib.sha384)
    m = m.hexdigest()
    #headers
    headers = {
          'X-BFX-APIKEY' : bitfinexKey,
          'X-BFX-PAYLOAD' : base64.b64encode(bytes(payload_json, "utf-8")),
          'X-BFX-SIGNATURE' : m
    }

    r = requests.post(bitfinexURL, data={}, headers=headers)
    return
start()

Thanks for the help in advance!


text:
Q: Strings, how to recognize letters I am a beginner in java and my questions might seem a little hideous, help would be appreciated though!
Anyways my question well the question in the book is :
"Write a program that prompts the user to provide a single character from the alpha bet. Print Vowel or Consonant, depending on the user input. If the user input is not a letter (between a and z or A and Z), or is a string of length > 1, print an error message.
How can you detect if the input is not a letter or not, help would be appreciated!
Thanks!

A: input in most common languages is in ACII. to see what an ascii, look at this table

(source: cdrummond.qc.ca)
when you receive a letter from the user, you get a char. this char contains a number which is a letter, in respect to the ASCII table, meaning that if you have 75 in your char, you have a 'K'
now, to know if you got a letter, all you need to do is:
char c;// Your char

Scanner scan = new Scanner (System.in);
c = scan.nextChar();

if((c>= 'a' && c<= 'z') || (c>= 'A' && c<= 'Z'))
{
  // you got a letter
}
else
{
  //That's not a letter
}

you can do that, because the letter are one after the other, but you can't do
if(c>= 'A' && c<= 'z')

because there are several signs between them

A: Maybe you can look into regular expressions (not my favorite approach if I'm honest), but it's short and it does the job (also it might give you a different prospective):
String letterPattern = "^(?i)[a-z]$";
String vowelPattern = "^(?i)[aeoui]$";
String test = "A";

if(test.matches(letterPattern)) {
    if(test.matches(vowelPattern)) {
        System.out.println("This is a vowel!");
    }
    else {
        System.out.println("It's not ...");
    }
}
// you get the idea ...

A: The simple one would be like this
public static final int VOWEL = 0;
public static final int CONSONANT = 1;
public static final int OTHER = 2;

public int getCharType(char c) {
  switch(c) {
    case 'a':
    case 'A':
    case 'e':
      ...
      return VOWEL;

    case 'b':
    case 'B':
    case 'c':
      ...
      return CONSONANT;

    default:
      return OTHER;
  }
}

A: I'm going to skip over the part where you read a single character, but what you're looking for probably looks like this:
if (!chr.isLetter()) {
    // error
} else if ("aeiou".contains(chr.toLowerCase()) {
    // vowel
} else {
    // consonant
}

Handling non-ascii letters, locales, etc. is also left as an exercise to the reader.


text:
Q: min.js* how does that work? I'm new to this so hope you understand my question.
I'm working on AngularJS based app on visual studio. Whenever i modify something in my controller, seems like none of the changes are reflected when the app is run. I've noticed that same code is in project.min.js* with bunch of other code and whenever you modify that only then you can see the changes.
How does this work? If you make a change to your controller, do you repeat that change in project.js and project.min.js* or is there any more convenient way to update everything at once?

A: AngularJS minifies your source files. This creates a min.js-file for every conventional js file.
minifying is the process of removing any unneccesary information from your source code (like spaces, line breaks,...). It also shortens variable names and so on.
This is done so that the resulting, minified script file consumes as few space as possible, which allows the web page to load faster (less network traffic).
Minifying should be done automatically, and there is no need to make your code changes multiple times. never.
If that "automatic process" is not working for you, you should post a different question (something like AngularJS minification not working)


text:
Q:  display broken img on ie 10 <ng-src> display as broken image on ie 10
actually i noticed that if i open the url of the img
the image display with error img also ,
FYI : img url is correct and working fine on all browser
is there a solution for this is


text:
Q: Trying to build Jest is throwing "Caching was left unconfigured." I have the following .babelrc.js in the root folder:
{
       "plugins": [
           "@babel/plugin-transform-flow-strip-types",
           "@babel/plugin-transform-modules-commonjs",
           "@babel/plugin-transform-async-to-generator",
           "@babel/plugin-transform-strict-mode",
           "@babel/plugin-transform-runtime"
       ],
       "cache": "true"
}

but when it tries to run node ./packages/jest-cli/bin/jest.js I see:

Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured
      for various types of caching, using the first param of their handler functions:

What am I missing?

A: Use new babel.config.js
https://new.babeljs.io/docs/en/next/babelconfigjs.html
module.exports = function(api) {
  api.cache(true)
  return {
    plugins: [
      "@babel/plugin-transform-flow-strip-types",
      "@babel/plugin-transform-modules-commonjs",
      "@babel/plugin-transform-async-to-generator",
      "@babel/plugin-transform-strict-mode",
      "@babel/plugin-transform-runtime"
    ]
  }
}


text:
Q: Set the minimum for HTML input type time I am trying to set the minumum for the time input type.
But it won't let me set it to a value for the minutes, like: 09:30.
Then it sets to 09:00.
This is my HTML:
<input type="time" min="09:30" max="17:30" step="300">

Thanks!

A: It will actually work, with a validation error should you try to submit the form with a time earlier than 09:30.
It would seem browsers don't start the minutes stepping from 30 though, probably because users may need to enter any value between 0 and 59 for the valid range of hours.

A: correct values format: min="00:00:00" max="23:59:59"
First group of 2 digits represents hours, second group of 2 digits represent minutes and third group of 2 digits represents seconds.
The "step" option represents the increment/decrement of the time value in seconds.

A: You are probably using FireFox, input type time isn't supported.
Your code works in Chrome.


text:
Q: Reduce a function on a grouped column in mutate I have a function which finds a sort of intersection of two strings of prose:
# Function to get intersection of words
str_intersect_by_word_list <- function(string1, string2){
  map2_chr(str_split(string1, '\\s'), str_split(string2, '\\s'),
           ~str_c(intersect(.x, .y), collapse = " "))
}

and a table with strings to match on:
# Sample data
my_df <- tibble(
  grp = rep(LETTERS[1:3], each = 3),
  strng = c(
    "Hi I'm Abe",
    "Hi I'm Beau",
    "Hi I'm Cat",
    "Hi there I'm Doug",
    "Hi there I'm Emily",
    "Hi there I'm Finn",
    "Hi it's nice to be here",
    "Hi it's nice to meet you",
    "Hi it's nice outside"
  )
)

If I want to create a column with the common string, I can do so like this:
# This works as expected
my_df %>%
  mutate(
    common_string = my_df %>%
      pull(strng) %>%
      reduce(str_intersect_by_word_list)
  )

which gives
# A tibble: 9 x 3
  grp   strng                    common_string
  <chr> <chr>                    <chr>
1 A     Hi I'm Abe               Hi
2 A     Hi I'm Beau              Hi
3 A     Hi I'm Cat               Hi
4 B     Hi there I'm Doug        Hi
5 B     Hi there I'm Emily       Hi
6 B     Hi there I'm Finn        Hi
7 C     Hi it's nice to be here  Hi
8 C     Hi it's nice to meet you Hi
9 C     Hi it's nice outside     Hi

I would like to create a column with the string that is common to each group.  However, inside the grouping, I can only access either the entire columns worth of strng, which gives the same output as above, or the current value of strng, which causes an error since my function str_intersect_by_word_list expects two inputs.
I tried referencing cur_data_all, but I don't think this is how that function was intended to be used, and it gives me the same results as above anyway.
# This fails.
my_df %>%
  group_by(grp) %>%
  mutate(
    grp_string = cur_data_all() %>%
      pull(strng) %>%
      reduce(str_intersect_by_word_list)
  )

The expected output would be
# A tibble: 9 x 3
  grp   strng                    grp_string
  <chr> <chr>                    <chr>
1 A     Hi I'm Abe               Hi I'm
2 A     Hi I'm Beau              Hi I'm
3 A     Hi I'm Cat               Hi I'm
4 B     Hi there I'm Doug        Hi there I'm
5 B     Hi there I'm Emily       Hi there I'm
6 B     Hi there I'm Finn        Hi there I'm
7 C     Hi it's nice to be here  Hi it's nice
8 C     Hi it's nice to meet you Hi it's nice
9 C     Hi it's nice outside     Hi it's nice

How can I get the common words from each group?

A: Please consider doing:
my_df %>%
   group_by(grp) %>%
   mutate(common_string = str_c(reduce(str_split(strng, "\\s+"), intersect),collapse = ' '))

# A tibble: 9 x 3
# Groups:   grp [3]
  grp   strng                    common_string
  <chr> <chr>                    <chr>
1 A     Hi I'm Abe               Hi I'm
2 A     Hi I'm Beau              Hi I'm
3 A     Hi I'm Cat               Hi I'm
4 B     Hi there I'm Doug        Hi there I'm
5 B     Hi there I'm Emily       Hi there I'm
6 B     Hi there I'm Finn        Hi there I'm
7 C     Hi it's nice to be here  Hi it's nice
8 C     Hi it's nice to meet you Hi it's nice
9 C     Hi it's nice outside     Hi it's nice

A: I mostly just rearranged code from the original question and borrowed a suggestion from @Martin Gal regarding rep.
library(dplyr, warn.conflicts = FALSE)

# Function to get intersection of words
str_intersect_by_word_list <- function(string1, string2){
  purrr::map2_chr(stringr::str_split(string1, '\\s'),
                  stringr::str_split(string2, '\\s'),
           ~stringr::str_c(intersect(.x, .y), collapse = " "))
}

# Sample data
my_df <- tibble(
    grp = rep(LETTERS[1:3], each = 3),
    strng = c(
      "Hi I'm Abe",
      "Hi I'm Beau",
      "Hi I'm Cat",
      "Hi there I'm Doug",
      "Hi there I'm Emily",
      "Hi there I'm Finn",
      "Hi it's nice to be here",
      "Hi it's nice to meet you",
      "Hi it's nice outside"
    )
  )

my_df %>%
  group_by(grp) %>%
  mutate(grp_string = purrr::reduce(strng, str_intersect_by_word_list))
#> # A tibble: 9 x 3
#> # Groups:   grp [3]
#>   grp   strng                    grp_string
#>   <chr> <chr>                    <chr>
#> 1 A     Hi I'm Abe               Hi I'm
#> 2 A     Hi I'm Beau              Hi I'm
#> 3 A     Hi I'm Cat               Hi I'm
#> 4 B     Hi there I'm Doug        Hi there I'm
#> 5 B     Hi there I'm Emily       Hi there I'm
#> 6 B     Hi there I'm Finn        Hi there I'm
#> 7 C     Hi it's nice to be here  Hi it's nice
#> 8 C     Hi it's nice to meet you Hi it's nice
#> 9 C     Hi it's nice outside     Hi it's nice

Created on 2021-07-12 by the reprex package (v2.0.0)
And here's a variant that puts all the details in a single function:
library(dplyr, warn.conflicts = FALSE)

# Function to get intersection of words
str_intersect <- function(str_vec) {

  str_intersect_by_word_list <- function(string1, string2){
    purrr::map2_chr(stringr::str_split(string1, '\\s'),
                    stringr::str_split(string2, '\\s'),
                    ~stringr::str_c(intersect(.x, .y), collapse = " "))
  }
  purrr::reduce(str_vec, str_intersect_by_word_list)
}

# Sample data
my_df <- tibble(
    grp = rep(LETTERS[1:3], each = 3),
    strng = c(
      "Hi I'm Abe",
      "Hi I'm Beau",
      "Hi I'm Cat",
      "Hi there I'm Doug",
      "Hi there I'm Emily",
      "Hi there I'm Finn",
      "Hi it's nice to be here",
      "Hi it's nice to meet you",
      "Hi it's nice outside"
    )
  )

my_df %>%
  group_by(grp) %>%
  mutate(grp_string = str_intersect(strng))
#> # A tibble: 9 x 3
#> # Groups:   grp [3]
#>   grp   strng                    grp_string
#>   <chr> <chr>                    <chr>
#> 1 A     Hi I'm Abe               Hi I'm
#> 2 A     Hi I'm Beau              Hi I'm
#> 3 A     Hi I'm Cat               Hi I'm
#> 4 B     Hi there I'm Doug        Hi there I'm
#> 5 B     Hi there I'm Emily       Hi there I'm
#> 6 B     Hi there I'm Finn        Hi there I'm
#> 7 C     Hi it's nice to be here  Hi it's nice
#> 8 C     Hi it's nice to meet you Hi it's nice
#> 9 C     Hi it's nice outside     Hi it's nice

Created on 2021-07-12 by the reprex package (v2.0.0)

A: TLDR
Your workflow seems fine! Your sample data is responsible for the bad results. Use my original suggestion (approved here) to generate the correct sample data via grp = rep(LETTERS[1:3], each = 3).
What Went Wrong
When generating your sample data
# Sample data
my_df <- tibble(
  grp = rep(LETTERS[1:3], 3),
  strng = c(
    "Hi I'm Abe",
    "Hi I'm Beau",
    "Hi I'm Cat",
    "Hi there I'm Doug",
    "Hi there I'm Emily",
    "Hi there I'm Finn",
    "Hi it's nice to be here",
    "Hi it's nice to meet you",
    "Hi it's nice outside"
  )
)

you incorrectly used rep(LETTERS[1:3], 3), which takes the entire vector c("A", "B", "C") and repeats it 3 times:
#   1     2     3
# |---| |---| |---|
  A B C A B C A B C

The result is an incorrect grp column in my_df
# A tibble: 9 x 2
  grp   strng
  <chr> <chr>
1 A     Hi I'm Abe
2 B     Hi I'm Beau
3 C     Hi I'm Cat
4 A     Hi there I'm Doug
5 B     Hi there I'm Emily
6 C     Hi there I'm Finn
7 A     Hi it's nice to be here
8 B     Hi it's nice to meet you
9 C     Hi it's nice outside

Now, even a perfect workflow will give you undesired results. When grouping by grp, here is group "A":
  grp   strng
  <chr> <chr>
1 A     Hi I'm Abe
4 A     Hi there I'm Doug
7 A     Hi it's nice to be here

Naturally, the only thing these strngs have in common — their only "intersection" — is the prefix "Hi".
  grp   strng                   grp_string
  <chr> <chr>                   <chr>
1 A     Hi I'm Abe              Hi
4 A     Hi there I'm Doug       Hi
7 A     Hi it's nice to be here Hi

Since the same goes for the other groups "B" and "C", then — by sheer coincidence — each group happens to independently have "Hi" as its "intersection".  The result is a grp_string column populated exclusively by "Hi", whose (grouped) results
# A tibble: 9 x 3
# Groups:   grp [3]
  grp   strng                    grp_string
  <chr> <chr>                    <chr>
1 A     Hi I'm Abe               Hi
2 B     Hi I'm Beau              Hi
3 C     Hi I'm Cat               Hi
4 A     Hi there I'm Doug        Hi
5 B     Hi there I'm Emily       Hi
6 C     Hi there I'm Finn        Hi
7 A     Hi it's nice to be here  Hi
8 B     Hi it's nice to meet you Hi
9 C     Hi it's nice outside     Hi

look identical to the (ungrouped) results of your ungrouped attempt:
# A tibble: 9 x 3
  grp   strng                    grp_string
  <chr> <chr>                    <chr>
1 A     Hi I'm Abe               Hi
2 B     Hi I'm Beau              Hi
3 C     Hi I'm Cat               Hi
4 A     Hi there I'm Doug        Hi
5 B     Hi there I'm Emily       Hi
6 C     Hi there I'm Finn        Hi
7 A     Hi it's nice to be here  Hi
8 B     Hi it's nice to meet you Hi
9 C     Hi it's nice outside     Hi

How to Fix It
Instead of using rep(LETTERS[1:3], 3), you should use rep(LETTERS[1:3], each = 3), which repeats each element in the vector 3 times:
# 1 2 3 1 2 3 1 2 3
  A A A B B B C C C

By correcting this one oversight when generating my_df
# Sample data
my_df <- tibble(
  grp = rep(LETTERS[1:3], each = 3),
  #                       ^^^^^^^^
  strng = c(
    "Hi I'm Abe",
    "Hi I'm Beau",
    "Hi I'm Cat",
    "Hi there I'm Doug",
    "Hi there I'm Emily",
    "Hi there I'm Finn",
    "Hi it's nice to be here",
    "Hi it's nice to meet you",
    "Hi it's nice outside"
  )
)

you will produce the correct grp column in my_df:
# A tibble: 9 x 2
  grp   strng
  <chr> <chr>
1 A     Hi I'm Abe
2 A     Hi I'm Beau
3 A     Hi I'm Cat
4 B     Hi there I'm Doug
5 B     Hi there I'm Emily
6 B     Hi there I'm Finn
7 C     Hi it's nice to be here
8 C     Hi it's nice to meet you
9 C     Hi it's nice outside

and your original code
# Function to get intersection of words
str_intersect_by_word_list <- function(string1, string2){
  map2_chr(str_split(string1, '\\s'), str_split(string2, '\\s'),
           ~str_c(intersect(.x, .y), collapse = " "))
}

# ...

my_df %>%
  group_by(grp) %>%
  mutate(
    grp_string = cur_data_all() %>%
      pull(strng) %>%
      reduce(str_intersect_by_word_list)
  )

will produce your intended results:
# A tibble: 9 x 3
# Groups:   grp [3]
  grp   strng                    grp_string
  <chr> <chr>                    <chr>
1 A     Hi I'm Abe               Hi I'm
2 A     Hi I'm Beau              Hi I'm
3 A     Hi I'm Cat               Hi I'm
4 B     Hi there I'm Doug        Hi there I'm
5 B     Hi there I'm Emily       Hi there I'm
6 B     Hi there I'm Finn        Hi there I'm
7 C     Hi it's nice to be here  Hi it's nice
8 C     Hi it's nice to meet you Hi it's nice
9 C     Hi it's nice outside     Hi it's nice

Note
While your workflow does work here, it's certainly worth exploring the alternatives by Onyambu or Ian Gow, which might prove cleaner, more efficient, or more extensible.


text:
Q: Spark Tuple get details/rdd per key I have these Rows:
(key1,Illinois|111|67342|...)
(key1,Illinois|121|67142|...)
(key2,Hawaii|113|67343|...)
(key1,Illinois|211|67442|...)
(key3,Hawaii|153|66343|...)
(key3,Ohio|193|68343|...)

(1) How do I get the unique keys?
(2) How do I get the number of rows PER key (key1 - 3 rows, key2 - 1 row, key 3 - 2 rows... so the output would be: 3,1,2)
(3) How do I get the byte size of rows PER key (5MB,2MB,3MB)

EDIT 1. this is my new code:
val rdd : RDD[(String, Array[String])] = ...
val rdd_res = rdd.groupByKey().map(row => (row._1, row._2.size, byteSize(row._2)))

val rddKeys = rdd_res.map(row => row._1)
val rddCount = rdd_res.map(row => row._2)
val rddByteSize = rdd_res.map(row => row._3)

How do I implement the byteSize? I want to get the size that will be saved to disk.

EDIT 2.
  val rdd_res : RDD[(String, (Int, Int))] = rdd.aggregateByKey((0,0))((accum, value) => (accum._1 + 1, accum._2 + size(value)), (first, second) => (first._1 + second._1, first._2 + second._2))

  val rdd_res_keys = rdd_res.map(row=>row._1).collect().mkString(",")
  val rdd_res_count = rdd_res.map(row=>row._2).collect().map(_._1).mkString(",")
  val rdd_res_bytes = rdd_res.map(row=>row._2).collect().map(_._2).mkString(",")

A: For distinct keys, you should switch the order:
rdd.keys.distinct.collect

But you technically get this from counting the keys into a map...via countByKey which returns a map of key->count
rdd.countByKey

And, to get the byte size, then you should review this SO question, as it is going to be dependent on decoding. But, once you've decided on a size method, then you can get it via:
rdd.aggregateByKey(0)((accum, value) => accum + size(value), _ + _)

Or, you can do it all in one:
rdd.aggregateByKey((0,0))((accum, value) => (accum._1 + 1, accum._2 + size(value), (first, second) => (first._1 + second._1, first._2 + second._2))

Which should yield an RDD[(String, (Int, Int))] where the first item in the tuple is the key count, and the second is the key size

A: Considering you have a pair RDD of (key, value).
You can get key and count using below
rdd_res = rdd_inp.countByKey

You can list of size for a key using below
rdd_size_res = rdd_inp.groupByKey().map((a,b)=>(a,size(b)))

def size(src: List[String]):List[String] = {

    src.map(a =>  (32 + a.length() * 2).toString())

  }

Please check if the above works for your scenario.


text:
Q: How to display a video from camera on jupyter notebook I've written a Jupyter notebook application to capture video from a camera and perform face detection and display it on the jupyter notebook using gstreamer framework with Python bindings. However, the video is very slow because I've to convert that into jpeg before displaying it on the notebook.
How can the performance be improved so that it will be close to real time?
How can I display it without converting into jpeg. I'm using BGR format.
In C++ based gstreamer applications, it opens OpenGL renderer which supports wide range of formats. How do we integrate that in jupyter notebook if that method can improve performance?
Please guide regarding this.


text:
Q: JWT Access token and Refresh token security I'm creating an app using for front-end Reactjs and for back-end SpringBoot(REST).
I want to use JWT tokens for security. Because of the security issues that stealing a JWT refresh token may imply, I thought to ask you if the following scenario is a valid one:

*

*Back-end

*

*on login create access-JWT and refresh-JWT

*in both in payload section set the same unique UUID(so I create a "link" between them).

*save the hashCode of refresh-JWT in DB (for future validity check)

*return as response in body access-JWT and as cookie refresh-JWT.

*Front-end

*

*Store access-JWT in local storage

*Store refresh-JWT as cookie

Now on every request from front-end I will aspect both tokens (access-JWT in header and refresh-JWT as cookie). I check both of them if they have same unique UUID. If they do I will continue the validating process for them.
Doing this I'm hopping to eliminate XSS and CSRF attacks assuming that those won't be done simultaneous. So if access-JWT is stolen the attacker won't have refresh-JWT and vice-versa.
Please share your thoughts. Thank you.

A: You should avoid inventing your own authentication/session management scheme since tiny details can undermine the security of the whole system.
Quoting from Auth0's Which OAuth 2.0 flow should I use?

Also, it should be noted that Implicit Grant does not return a Refresh Token because the browser cannot keep it private (read the SPAs and Refresh Tokens panel for a workaround).

I would suggest going with a standard OpenID Connect (or OAuth 2.0) flow - in your case the implicit flow.


text:
Q: 404 with URL Rewrite Module in IIS7 on windows 7 I am trying to rewrite the URL through "Using URL Rewrite Module" on IIS7 (windows 7).
URL: http://localhost/AIM/group-discussion/videos.aspx?id=4&title=some-title
Rewrite URL: http://localhost/AIM/group-discussion/videos/4/some-title
Rewrite rule:
<rewrite>
            <rules>
                <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                    <match url="^AIM/group-discussion/videos/([^/]+)/([^/]+)/?$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="AIM/group-discussion/videos.aspx?id={R:1}&title={R:2}" />
                </rule>
            </rules>
        </rewrite>

I am getting 404 error while accessing rewrite URL (http://localhost/AIM/group-discussion/videos/4/some-title)
following error log through "Failed request tracing" in IIS7
MODULE_SET_RESPONSE_ERROR_STATUS

ModuleName="IIS Web Core", Notification="MAP_REQUEST_HANDLER", HttpStatus="404", HttpReason="Not Found", HttpSubStatus="0", ErrorCode="The system cannot find the file specified.
 (0x80070002)", ConfigExceptionInfo=""

I am running site in "Integrated Pipe mode"


text:
Q: How to: read/write Dbase III files (.dbf) C# VS 2010 using Visual FoxPro OLE DB Driver I have been unable to find any complete example or guide to use Visual FoxPro OLD DB driver with Visual Studio 2010 to read and write data to/from .DBF files.
I found some info for VS 2005 but it doesnt seem to work w/ VS2010.
When I open Server Explorer and try to add a new Data Connection, the Visual FoxPro Driver is not listed.
Based on reading and searching for several days now it appears that this driver is the best way to go for handling DBF's but I am not necessarily tied to it=  I am open to ANY solid, fast solution.
Any direction most appreciated.
Thanks

A: Install VFPOLEDB provider, and then you'll be able to connect to DBF files.

A: Your could create a Linked Server to this Foxpro Database from SQL Server. That will make the Foxpro data accessible.


text:
Q: Java: Binding the XML Schema itself to classes i know that you can generate Java classes from an XSD file with JAXB or similar methods and then use them with your resulting XML files. That's not what i'm looking for though.
I was wondering if it is possible to generate a generic Java representation of the XSD itself and if there are programs that parse any random XSD and fill the Java classes with it.
For example, let's take this short excerpt from an XSD:
<xs:complexType name="pc-type">
    <xs:sequence>
        <xs:element name="name" type="xs:string"/>
        <xs:element name="manufacturer" type="xs:string"/>
    </xs:sequence>
    <xs:attribute name="id" type="xs:integer"/>
</xs:complexType>

A Java representation could be something like:
public class ComplexType{
    String name;
    List<Attribute> attributes;
    List<Element> elements;
    ...
}

Does something like this exist?

A: There is a XSD for XSD. You can generate the JAXB classes from this xsd.xsd.