text:
Q: Plotting a graph with multiple geom_lines with loop I have a dataframe with different percent values of prices variation for a bunch of products over some months. The dataframe is something like this:
 DATA          P10          P25          P50          P75          P90
1  2011-03-01  0.034638180  0.086482130  0.133986300  0.177072700  0.233044900
2  2011-04-01 -0.185378000 -0.112070500 -0.064632480 -0.027086950  0.036643230
3  2011-05-01  0.008258164  0.053702510  0.094340370  0.137678700  0.270847900
4  2011-06-01 -0.105608500 -0.072065040 -0.019818160  0.018149950  0.069389460
5  2011-07-01 -0.080303930 -0.040885830 -0.006315288  0.030778970  0.084747610
6  2011-08-01  0.001524279  0.052229100  0.075928880  0.126691500  0.167735600
7  2011-09-01 -0.097216090 -0.066777680 -0.040682890 -0.014226140  0.034411750

And the code i wrote to create my plot is:
 ggplot()+
      geom_line(data = dataPerc, aes(x = dataPerc$DATA, y =dataPerc$P10,color="P10"),size=1)+
      geom_line(data = dataPerc, aes(x = dataPerc$DATA, y =dataPerc$P25,color='P25'),size=1)+
      geom_line(data = dataPerc, aes(x = dataPerc$DATA, y =dataPerc$P50,color = "P50"),size = 1)+
      geom_line(data = dataPerc, aes(x = dataPerc$DATA, y =dataPerc$P75,color= "P75"),size=1)+
      geom_line(data = dataPerc, aes(x = dataPerc$DATA, y =dataPerc$P90,color="P90"),size=1)+
      scale_x_date(date_labels="%b %y",date_breaks  ="1 month")+
      theme(axis.text.x = element_text(angle = 90))+
      labs(color='Percentile')+
      scale_y_continuous(labels = function(x) paste0(x*100, "%"))+
      xlab("Moth/Year")+
      ylab("% fat. ")

Basically, I want to create the same plot with a loop that substitute the sequence of geom_lines above. Thanks.

A: Don't use a loop - convert your data from wide to long.
long_data = tidyr::pivot_longer(your_data, -DATA, names_to = "Percentile")

ggplot(long_data, aes(x = DATA, y = value, color = name)) +
  geom_line(size = 1) +
  theme(axis.text.x = element_text(angle = 90)) +
  labs(x = "Month/Year", y = "% fat. ") +
  scale_y_continuous(labels = scales::label_percent(accuracy = 0.1))

Also, don't use data$column inside aes() - it expects unquoted column names.

A: Here's an answer without the loop you said you wanted. ggplot2 does not work well with loops.
# Read in your data - changed `DATA` to `date`
a <-
"date          P10          P25          P50          P75          P90
1  2011-03-01  0.034638180  0.086482130  0.133986300  0.177072700  0.233044900
2  2011-04-01 -0.185378000 -0.112070500 -0.064632480 -0.027086950  0.036643230
3  2011-05-01  0.008258164  0.053702510  0.094340370  0.137678700  0.270847900
4  2011-06-01 -0.105608500 -0.072065040 -0.019818160  0.018149950  0.069389460
5  2011-07-01 -0.080303930 -0.040885830 -0.006315288  0.030778970  0.084747610
6  2011-08-01  0.001524279  0.052229100  0.075928880  0.126691500  0.167735600
7  2011-09-01 -0.097216090 -0.066777680 -0.040682890 -0.014226140  0.034411750
"
df <- read.table(text = a, header = TRUE)
library(tidyr)
library(dplyr)
library(ggplot2)
# make the data tidy. ggplot2 needs tidy data (one observation per row)
df <- df %>% pivot_longer(cols = -date, names_to = "pct")
# format date as date
df$date <- as.Date(df$date)

ggplot(df, aes(x = date, y = value, color = pct)) +
  geom_line(size=1) +
    scale_x_date(date_labels="%b %y",date_breaks  ="1 month") +
  theme(axis.text.x = element_text(angle = 90)) +
  labs(color='Percentile') +
  scale_y_continuous(labels = function(x) paste0(x * 100, "%")) +
  xlab("Month/Year") +
  ylab("% fat. ")
```[![enter image description here][1]][1]

  [1]: https://i.stack.imgur.com/OCk8O.png

A: Once your data is in wide format, the possibilities are endless. I simplified your code a bit and faceted the data by your original column names (e.g., p10, p25, p50, etc.). This allows you to plot a separate line within each category—independently. Now you can observe the trend from March to September within each facet. I organized the facets into one column. Only the individual month names span the x-axis since you only have data for one year. Feel free to adjust the col = ... argument to find the proper presentation.
If faceting is not your style, then drop the call to facet_wrap() altogether and try inserting col = factor(perc) inside of aes(). This will stack the lines on top of each other on one plot; you also get a nice legend for free. I will demonstrate both methods below.
# Here is how to avoid looping and layering on multiple geoms

library(tidyverse)
library(lubridate)

df <- tribble(
  ~date, ~p10, ~p25,  ~p50, ~p75, ~p90,
  "2011-03-01", 0.034638180, 0.086482130, 0.133986300, 0.177072700, 0.233044900,
  "2011-04-01", -0.185378000, -0.112070500, -0.064632480, -0.027086950, 0.036643230,
  "2011-05-01", 0.008258164, 0.053702510, 0.094340370, 0.137678700, 0.270847900,
  "2011-06-01", -0.105608500, -0.072065040, -0.019818160, 0.018149950, 0.069389460,
  "2011-07-01", -0.080303930, -0.040885830, -0.006315288, 0.030778970, 0.084747610,
  "2011-08-01", 0.001524279, 0.052229100, 0.075928880, 0.126691500, 0.167735600,
  "2011-09-01", -0.097216090, -0.066777680, -0.040682890, -0.014226140, 0.034411750)

# Some quick data preparation

long_df <- df %>%
  mutate(date = ymd(date)) %>%
  pivot_longer(-date, names_to = "perc", values_to = "p_scores")

# Here is a subset of the data frame in long format

# A tibble: 35 x 3
   date       perc  p_scores
   <date>     <chr>    <dbl>
 1 2011-03-01 p10     0.0346
 2 2011-03-01 p25     0.0865
 3 2011-03-01 p50     0.134
 4 2011-03-01 p75     0.177
 5 2011-03-01 p90     0.233
 6 2011-04-01 p10    -0.185
 7 2011-04-01 p25    -0.112
 8 2011-04-01 p50    -0.0646
 9 2011-04-01 p75    -0.0271
10 2011-04-01 p90     0.0366
# … with 25 more rows

# Simplified code

ggplot(long_df, aes(x = date, y = p_scores)) +
  geom_line(size = 1) +
  scale_x_date("Month",
               date_breaks = "1 month",
               date_labels = '%B') +
  scale_y_continuous("% Fat.", labels = function(x) paste0(x*100, "%")) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  facet_wrap(~ perc, ncol = 1)

Below is my other recommendation if you want to stack the lines onto one plot. It appears each line moves in tandem over time without much volatility. I included the code as well for reproducibility.
ggplot(long_df, aes(x = date, y = p_scores, col = factor(perc))) +
  geom_line(size = 1) +
  scale_x_date("Month",
               date_breaks = "1 month",
               date_labels = '%B') +
  scale_y_continuous("% Fat.", labels = function(x) paste0(x*100, "%")) +
  labs(color = "Score \nType:") +  # This is a generic legend title
  theme_bw() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

Also, you can achieve the same result without converting perc to a factor variable inside of aes(). But I digress.
I hope this helps!


text:
Q: I am not able to select a grid item populated using a list I am populating a grid using a list of data from view model. But I'm not able to select an item from the grid. Can you guys please help.
<StackPanel Margin="0,69,0,0">
    <GridView ItemsSource="{Binding GamesList}" x:Name="gameGrid" >
        <GridView.ItemTemplate>
            <DataTemplate>
                <Button Tag="{Binding Source}" Command="{Binding Path=DataContext.GameSelectionMethod, ElementName=gameGrid}"
                        CommandParameter="{Binding SelectedValue}" >
                    <StackPanel Width="202" VerticalAlignment="Top">
                        <Image Source="{Binding imageurl}" Height="324"/>
                        <StackPanel Background="Black" Padding="19,9,0,0">
                            <TextBlock FontWeight="Semibold" TextTrimming="CharacterEllipsis" FontFamily="Segoe Pro"
                                        Foreground="White" TextAlignment="Left" FontSize="24" Text="{Binding title}"
                                        TextWrapping="Wrap" Height="65"/>
                            <TextBlock FontFamily="Segoe Pro" Foreground="White" TextAlignment="Left"
                                        FontSize="16" Text="{Binding price}" Margin="0,48,0,0"/>
                        </StackPanel>
                    </StackPanel>
                </Button>
            </DataTemplate>
        </GridView.ItemTemplate>
    </GridView>
</StackPanel>

I need a click event in this button and need to know which one is selected. I have tried many methods but everything is actually complex solution. I have added a command and its not triggering. its working on mouse click but not on gamepad of xbox
My view model
public List<GameModel> GamesList
{
    get
    {
        return gamesList;
    }
    set
    {
        gamesList = value;
        OnPropertyChanged("GamesList");
    }
}
public void GetSampleData()
{

    var data = new GameModel { gameId = 1, title = "Call Of Duty: Black Ops 4", price = "$59.99", imageurl = "/Assets/Product Image-7.png" };
    GamesList.Add(data);
    var data1 = new GameModel { gameId = 2, title = "Forza Horizon 4", price = "$59.99", imageurl = "/Assets/Product Image-8.png" };
    GamesList.Add(data1);
    var data2 = new GameModel { gameId = 3, title = "Halo 5: Guardians", price = "$59.99", imageurl = "/Assets/Product Image-9.png" };
    GamesList.Add(data2);
    var data3 = new GameModel { gameId = 4, title = "Sea of Thieves", price = "$59.99", imageurl = "/Assets/Product Image-10.png" };
    GamesList.Add(data3);
    var data4 = new GameModel { gameId = 5, title = "Assassin's Creed : Origins", price = "$59.99", imageurl = "/Assets/Product Image-11.png" };
    GamesList.Add(data4);
    var data5 = new GameModel { gameId = 6, title = "Shadow of War", price = "$59.99", imageurl = "/Assets/Product Image-12.png" };
    GamesList.Add(data5);

    GamesList.Add(data10);

}

public ICommand GameSelectionMethod
{
    get
    {
        return new DelegateCommand(GameSelection);
    }
}

private void GameSelection()
{
    string tag = "1";
    var parameters = new GameModel();
    parameters.gameId = Convert.ToInt16(tag);
    _navigationService.Navigate(typeof(HomeView), parameters);
}

A: It seems that this is what you're trying to do:
<Page
    x:Class="App1.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="using:App1"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
    d:DesignHeight="450" d:DesignWidth="800" >
    <Page.DataContext>
        <local:ViewModel1/>
    </Page.DataContext>
    <StackPanel Margin="0,69,0,0">
        <GridView ItemsSource="{Binding GamesList}" x:Name="gameGrid" SelectionChanged="GameGrid_OnSelectionChanged" >
            <GridView.ItemTemplate>
                <DataTemplate>
                    <StackPanel Width="202" VerticalAlignment="Top">
                        <Image Source="{Binding imageurl}" Height="324"/>
                        <StackPanel Background="Black" Padding="19,9,0,0">
                            <TextBlock FontWeight="Semibold" TextTrimming="CharacterEllipsis" FontFamily="Segoe Pro"
                                       Foreground="White" TextAlignment="Left" FontSize="24" Text="{Binding title}"
                                       TextWrapping="Wrap" Height="65"/>
                            <TextBlock FontFamily="Segoe Pro" Foreground="White" TextAlignment="Left"
                                       FontSize="16" Text="{Binding price}" Margin="0,48,0,0"/>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </GridView.ItemTemplate>
        </GridView>
    </StackPanel>
</Page>

You can just use the SelectionChanged event of the grid instead of wrapping your controls inside the button.
ViewModel and Code-behind
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml.Controls;

namespace App1
{
    public sealed partial class MainPage
    {
        public ViewModel1 VM => (ViewModel1) DataContext;

        public MainPage()
        {
            this.InitializeComponent();
        }

        private void GameGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            GridView grid = sender as GridView;

            if (grid != null)
            {
                var selectedGame = grid.SelectedItem;
                VM.SelectedGame = (GameModel)selectedGame;
                VM.GameSelection();
                grid.SelectedItem = null;
            }
        }
    }

    #region ViewModel

    public class ViewModel1 : INotifyPropertyChanged
    {
        public ViewModel1()
        {
            GetSampleData();
        }

        private GameModel _selectedGame;

        public GameModel SelectedGame
        {
            get
            {
                return _selectedGame;
            }
            set
            {
                _selectedGame = value;
                OnPropertyChanged();
            }
        }

        private List<GameModel> gamesList;
        public List<GameModel> GamesList
        {
            get
            {
                return gamesList;
            }
            set
            {
                gamesList = value;
                OnPropertyChanged("GamesList");
            }
        }

        #region Test data

        public void GetSampleData()
        {
            GamesList = new List<GameModel>();
            var data = new GameModel { gameId = 1, title = "Call Of Duty: Black Ops 4", price = "$59.99", imageurl = "/Assets/Product Image-7.png" };
            GamesList.Add(data);
            var data1 = new GameModel { gameId = 2, title = "Forza Horizon 4", price = "$59.99", imageurl = "/Assets/Product Image-8.png" };
            GamesList.Add(data1);
            var data2 = new GameModel { gameId = 3, title = "Halo 5: Guardians", price = "$59.99", imageurl = "/Assets/Product Image-9.png" };
            GamesList.Add(data2);
            var data3 = new GameModel { gameId = 4, title = "Sea of Thieves", price = "$59.99", imageurl = "/Assets/Product Image-10.png" };
            GamesList.Add(data3);
            var data4 = new GameModel { gameId = 5, title = "Assassin's Creed : Origins", price = "$59.99", imageurl = "/Assets/Product Image-11.png" };
            GamesList.Add(data4);
            var data5 = new GameModel { gameId = 6, title = "Shadow of War", price = "$59.99", imageurl = "/Assets/Product Image-12.png" };
            GamesList.Add(data5);

        }

    #endregion

        public void GameSelection()
        {
            Debug.WriteLine(SelectedGame?.title);
            // Do things here. See output window.
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    public class GameModel
    {
        public int gameId { get; set; }
        public string title { get; set; }
        public string price { get; set; }

        public string imageurl { get; set; }
    }

    #endregion
}

redpajama_set_name: RedPajamaStackExchange


text: Q: Check and send messages to mobile devices in the same lan I would like to develope an hybrid mobile app using Cordova and JavaScript. I would like to know if it is possible using these technologies to scan devices connected on the same lan and possibly send messages to them (of course they need the same application on device) so something like sockets etc. .


text:
Q: Cannot update database because entity cannot drop constraint I created some new tables and I noticed I didn't use the good naming convention for the ids.
So I did a new add-migration with the new ids but when I try to update-database I have the following error :

The constraint 'PK_dbo.DB_User_Type' is being referenced by table
  'AspNetUsers', foreign key constraint
  'FK_dbo.AspNetUsers_dbo.DB_User_Type_DB_User_Type_Id'. Could not drop
  constraint. See previous errors.

I don't understand because the script starts by dropping all constraints.
Could someone explain how to solve this error please?
I'm using the new approach code first from an existing database from entity 6.1. Here is the Up function
public override void Up()
        {
            DropForeignKey("dbo.DB_Company_Profile", "DB_Category_Id", "dbo.DB_Category");
            DropForeignKey("dbo.DB_Category_Translation", "DB_Category_Id", "dbo.DB_Category");
            DropForeignKey("dbo.DB_User_Type_Translation", "DB_User_Type_Id", "dbo.DB_User_Type");
            DropForeignKey("dbo.DB_Company_Profile", "category_id", "dbo.DB_Category");
            DropForeignKey("dbo.DB_Category_Translation", "category_id", "dbo.DB_Category");
            DropForeignKey("dbo.AspNetUsers", "DB_User_Type_user_type_id", "dbo.DB_User_Type");
            DropForeignKey("dbo.DB_User_Type_Translation", "user_type_id", "dbo.DB_User_Type");
            DropIndex("dbo.DB_Company_Profile", new[] { "DB_Category_Id" });
            DropIndex("dbo.DB_Category_Translation", new[] { "DB_Category_Id" });
            DropIndex("dbo.DB_User_Type_Translation", new[] { "DB_User_Type_Id" });
            DropColumn("dbo.DB_Company_Profile", "category_id");
            DropColumn("dbo.DB_Category_Translation", "category_id");
            DropColumn("dbo.DB_User_Type_Translation", "user_type_id");
            RenameColumn(table: "dbo.AspNetUsers", name: "DB_User_Type_Id", newName: "DB_User_Type_user_type_id");
            RenameColumn(table: "dbo.DB_Company_Profile", name: "DB_Category_Id", newName: "category_id");
            RenameColumn(table: "dbo.DB_Category_Translation", name: "DB_Category_Id", newName: "category_id");
            RenameColumn(table: "dbo.DB_User_Type_Translation", name: "DB_User_Type_Id", newName: "user_type_id");
            RenameIndex(table: "dbo.AspNetUsers", name: "IX_DB_User_Type_Id", newName: "IX_DB_User_Type_user_type_id");
            DropPrimaryKey("dbo.DB_Category");
            DropPrimaryKey("dbo.DB_User_Type");
            AddColumn("dbo.DB_Category", "category_id", c => c.Int(nullable: false, identity: true));
            AddColumn("dbo.DB_User_Type", "user_type_id", c => c.Int(nullable: false, identity: true));
            AlterColumn("dbo.DB_Company_Profile", "category_id", c => c.Int(nullable: false));
            AlterColumn("dbo.DB_Category_Translation", "category_id", c => c.Int(nullable: false));
            AlterColumn("dbo.DB_User_Type_Translation", "user_type_id", c => c.Int(nullable: false));
            AddPrimaryKey("dbo.DB_Category", "category_id");
            AddPrimaryKey("dbo.DB_User_Type", "user_type_id");
            CreateIndex("dbo.DB_Company_Profile", "category_id");
            CreateIndex("dbo.DB_Category_Translation", "category_id");
            CreateIndex("dbo.DB_User_Type_Translation", "user_type_id");
            AddForeignKey("dbo.DB_Company_Profile", "category_id", "dbo.DB_Category", "category_id", cascadeDelete: true);
            AddForeignKey("dbo.DB_Category_Translation", "category_id", "dbo.DB_Category", "category_id", cascadeDelete: true);
            AddForeignKey("dbo.DB_User_Type_Translation", "user_type_id", "dbo.DB_User_Type", "user_type_id", cascadeDelete: true);
            AddForeignKey("dbo.AspNetUsers", "DB_User_Type_user_type_id", "dbo.DB_User_Type", "user_type_id");
            DropColumn("dbo.DB_Category", "Id");
            DropColumn("dbo.DB_User_Type", "Id");
        }

A: I had the same problem. This post helped me.
The problem is that EF didn't automatically renamed my FK_CONSTRAINST. As a result the DropForeignKey() wasn't correct. You can solve this by manual SQL queries (check post above). But I solved it by first changing the FK_CONSTRAINST manually in the DB. Remember you can use -Verbose to check the queries. It's easier debugging.

A: I had to delete the foreign key manually before running the update-database command. Because the constraint name in my DB is something like: FK_dbo.AspNetUsers_dbo.DB_User_Type_DB_User_TypeId
While the constraint the script is trying to drop is:
FK_dbo.AspNetUsers_dbo.DB_User_Type_DB_User_Type_Id

A: Well, there are some rules about foreign keys - some of them are meant to handle situations, when you try to delete a record that has another records associated with it.
In your case, it seems like you want to apply the CASCADE rule to your relationships. This way entity will delete all its FKs

A: *

*DropForeignKey("dependantTable", "dependantColumn", "principalTable")

*DropPrimaryKey("principalTable")

*AddPrimaryKey("principalTable", "principalColumn",)

*AddForeignKey("dependantTable", "dependantColumn", "principalTable")


text:
Q: Create Special offer layout How can I create a layout that contains the red view on top left corner
See the picture below to have a better idea of what I am seeking for
Thank you
enter image description here

A: check out these libraries on Github
https://github.com/wavever/TagCornerImageView
https://github.com/czy1121/cornerlabelview
https://github.com/shts/TriangleLabelView


text:
Q: Controlling a Mac Mini from Linux Mint - Some special keys don't work I've installed TeamViewer on 2 machines: my ASUS X555-LD laptop running Linux Mint Cinnamon 17.3 and a late-2012 Mac Mini running OS X El Capitan. The task is to remote control the Mac with the ASUS laptop's Linux Mint. After connection is set and the "Action > Send key combinations" option is enabled, there are still some remaining issues with special keys:

*

*My laptop's "Windows" key doesn't trigger the "Command" key on Mac; instead, the Linux Mint dock menu opens, like I would not even using TeamViewer

*My laptop's "Caps Lock" key doesn't seem to work at all on Mac

*My laptop's "AltGr" key triggers the "a" character's key on Mac before triggering the character / function I wanted; for example, if I try to type a semicolon (;) it types "a;" instead

Every other main special keys ("Alt", "Tab", "Ctrl", "Shift") are working normally. Does / Did anybody have this kind of problem, too?


text:
Q: Difficulties in understanding a conditional probability question from a textbook In the book "Complete Probability & Statistics 1 for Cambridge International AS & A Level" I found the following question:

The homework diaries and completed homework of two Students A and B,
are examined.
There is a probability of 0.4 that Student A does not make a note in
her diary homework set. She always does the homework if it is written
in her diary, but never does the homework if it is not written in.
There is a probability of 0.8 that Student B writes the homework given
in her diary. When she does this, she will do the homework 90% of the
time. If she has nothing written in her diary then she checks with a
friend, who knows what the homework is 50% of the time; Student B
always does the homework if she is told what it is by her friend.
A) Find the probability that Stundent B does her homework on a particular
night.
B) Find the probability that both students do her homework on a
particular night.
C) If one piece of homework was given to a student
but wasn't done, find the probability that it was given to Student A.

For A) I got $0.8\cdot 0.9+0.2\cdot 0.5=0.82$.
For B) I got $0.82\cdot 0.6=0.492.$
For C) I got: The probability that the homework is not done by both or one student is $1-0.492=0.508$. Therefore we find that $\frac{0.4}{0.508}\approx 0.7874$
But consulting this forum I found that the solution is apparently $\frac{0.382}{0.382+0.108}=0.752$
I do not understand why this is correct. For me, 0.752 is the solution to the question:  If homework of both was checked and one was not done, find the probability that it was Student A's.
Can somebody tell me if I am missing something?

A:

The homework diaries and completed homework of two Students A and B,
are examined.
There is a probability of 0.4 that Student A does not make a note in
her diary homework set. She always does the homework if it is written
in her diary, but never does the homework if it is not written in.
There is a probability of 0.8 that Student B writes the homework given
in her diary. When she does this, she will do the homework 90% of the
time. If she has nothing written in her diary then she checks with a
friend, who knows what the homework is 50% of the time; Student B
always does the homework if she is told what it is by her friend.
C) If one piece of homework was given to a student but wasn't done,
find the probability that it was given to Student A.

I got: The probability that the homework is not done by both or one
student is $1-0.492=0.508$. Therefore we find that
$\frac{0.4}{0.508}\approx 0.7874.$

Firstly, you are interpreting "one student" as "at least one student", whereas the author probably means "exactly one student".
Secondly, you aren't taking into account the given condition that one piece of homework wasn't done.
Now, P(A did but not B) $= [0.6 \times (0.8\times0.1+0.2\times0.5)]=0.108,$
while P(B did but not A) $= [(1-0.6) \times (1-(0.8\times0.1+0.2\times0.5))]=0.328.$
The required probability is P(B did but not A) $\div$  [P(A did but not B) + P(B did but not A)], which equals $$\frac{0.328}{0.328+0.108}=0.752.$$

But consulting this forum I found that the solution is apparently
$\frac{0.382}{0.382+0.108}=0.752.$
I do not understand why this is correct. For me, 0.752 is the solution
to the question:  If homework of both was checked and one was not
done, find the probability that it was Student A's.

Exactly! But, to be exact, "exactly one was not done". -)
By the way, your transcribed answer from that forum contains two identical typos.


text:
Q: My Frontend wont connect to my node.js websocket My Frontend wont connnect to my node.js websocket server, when i want to run it on another port than port 80. I cant run it on port 80 because my apache is already on port 80. Im currently trying it on port 39100 it shouldnt be a problem with the firewall.
My node.js websocket file runs on port 39100:
it runs on port 39100
In my node.js websocket server:
    const wss = new WebSocketServer.Server({ port: 39100})

My Frontend file which trys to connect to this port
In my Frontend File:
    const ws = new WebSocket("ws://flagduel.com:39100");

I tried it with apache stopped and port 80 in my server.js and "ws://flagduel.com" in my Frontend file which worked perfectly fine

A: It seems that the port 39100 you are trying to use is not open on your machine in contrast to port 80.
I assume that your server is running Ubuntu. If this is the case, try to run the following command to see if the port is open:
sudo ufw status verbose

If you don't see port 39100 in the list of open ports similar to port 80, you need to open the port using the following command:
sudo ufw allow 39100/tcp

Once executed, verify that the port is now open using the previous command.
Please let me know if this helps.

A: Have you tried checking the Firewall on the vps providers site?


text:
Q: Java server on a machine with two NICs If I write a java socket server on a machine with two LAN Cards each of which is on a different network like one is on the 10.x.x.x network and the other is on the 192.168.10.x network, is the server going to bind to one of them randomly or it will listen to the incoming requests on both NICs and answer accordingly?

A: If you do not specify adapter it will listen on all available adapters.


text:
Q: Array of pictures leaking This is what I'm doing. I have an ever growing array of pictures pictures for a photo slideshow. I display picture i as follows:
pictures[i]
   .fadeIn(500)
   .delay(5000)
   .fadeOut(500, function () {
        $(this).remove();
        delete this;
   });

Despite my attempts to flush the memory by using .remove() and delete, I am still having a memory leak. Am I doing something wrong?

A: Update
As per the comments below, this was tested in Chrome and the browser seems to hold on to the memory from the images until the page is no longer actively rendered (reloaded, switched tab, etc.). Unfortunately, this holds true in Firefox and IE as well.
IE and Firefox had much better memory de-allocation (continually dropping memory as the page stayed open) but both still grew indefinitely. Upon switching tabs in both (by opening a new tab) the memory was almost immediately freed.
I haven't inspected your code thoroughly so I'm not sure if this problem can somehow be avoided (it doesn't appear so on first pass) though you should keep in mind that you are continually adding indicies to an ever-growing array that will continue to use more and more memory on its own. Perhaps it is the  reference in the array that is sticking around which could be avoided if you came up with another way to implement the slideshow.
The reason why I'm guessing it might be this is from this discussion: garbage collection with node.js. The browser garbage collector needs to ensure that they are not reachable (which they always are, since the array is ever-growing). Thus you have to wait for the garbage collector to clean up the <img> values inside the indices to free the memory, and that doesn't necessarily happen right when you set them to null.

You'll need to pass your iterator i to your callback function.  Then you'll be able to null the picture after it fades out and free the memory it was using. Just make sure you don't get caught in the common closure-iterator problem -- something like this should work:
pictures[i].fadeIn(500).delay(5000).fadeOut(500, (function(i) {
    pictures[i] = null;
})(i);


text:
Q: Format Date (25 Jul) using Javascript Object Model I am using sp2013 and building display templates. I would like to build a locig in javascript object model to get a date field back and display it on a page e.g.
var itemDate =  $getItemValue(ctx, "Created");
This displays on the page by default as: Thu Jul 25 09:30:07 PDT 2013
I want to display it as: 25 Jul
How do i format a date in javascript?

A: I would suggest that you consider using moment.js for working with dates. Nk SP's solution will, of course, work fine for your current question, but moment gives you a lot of flexibility for working with dates and formatting them.
Here is an example (note jQuery is not a requirement):
$(document).ready(function(){
 var d = new Date("Thu Jul 25 09:30:07 PDT 2013");
 $("#display1").html(moment(d).format("DD, MM"));
 $("#display2").html(moment(d).format("DD, MMM"));
 $("#display3").html(moment(d).format("DD, MMM, YYYY"));
 $("#display4").html(moment(d).format("LLLL"));
 $("#display5").html(moment(d).fromNow());
});

Output:

25, 07 25, Jul 25, Jul, 2013 Thursday, July 25 2013 12:30
  PM 9 months ago

Here is a JSFiddle: http://jsfiddle.net/uHER4/

A: You can do:
var d=new Date("Thu Jul 25 09:30:07 PDT 2013");
var monthNames = [ "January", "February", "March", "April", "May", "June",
    "July", "August", "September", "October", "November", "December" ];

var yourNiceDate= d.getDate()+" "+monthNames[d.getMonth()];

A: When you need to work with dates in javascript, I strongly recommend using the excellent moment.js library. It makes formatting dates a snap.
var d = moment("Thu Jul 25 09:30:07 PDT 2013");
d.format("DD MMM"); // "25 Jul"

A: If the format does not vary from what you presented, you could use split, and access the desired elements in array notation.
itemDate = itemDate.split(" ");
itemDate = itemDate[1] + " " + itemDate[2];

You lose any date properties by doing this, so if the other elements of the date object are important you're probably better off with moment.js.


text:
Q: C++ Builder XE3, IntraWeb, Display SQL Server database query results Our company is beginning development on an IntraWeb application which requires access to our SQL Server database(s). I am attempting to creating a very basic application to get one column of data from our database and display it... in any way possible. I have attempted many times to do this but have only seen failure. From what I see I can not even get query results. I am using C++ Builder XE3. This is what I am doing...

*

*Create IntraWeb Application Wizard (Standalone)

*Add #include "UserSessionUnit.h" to Unit1.cpp

*Set IWServerController->ComInitialization to ciMultiThreaded

*Drag TADOConnection to UserSessionUnit

*Set ADOConnection1->ConnectionString using builder (Microsoft OLE DB Provider for SQL Server)

*Drag TADOQuery to UserSessionUnit

*Set ADOQuery1->Connection to ADOConnection1

*Set ADOQuery1->SQL to "SELECT Column1 FROM Table1"

*Drag TDataSource to UserSessionUnit

*Set DataSource1->DataSet to ADOQuery1

*Drag TIWDBGrid to Unit1

*Set IWDBGrid1->DataSource to IWUserSession.DataSource1

*Run the query when IWForm1 is created...

void __fastcall TIWForm1::IWAppFormCreate(TObject *Sender)
{
UserSession()->ADOQuery1->Open();
}
I imagine this should work. The application builds and runs with no errors, but displays only an empty grid...
I replicated this scenario in a C++ Builder VCL Forms Application and it worked no problems (used TDBGrid instead of TIWDBGrid, of course).
I have tried this with several "TIWDB" components to no avail.


text:
Q: Whats are some real time data sources? I'm working on a demo on real-time visualization and I'm trying to think out of the box. Looks like any big data real-time demo is on twitter or traffic data. Are there any other options out there that publish real-time data (for free)?
Thanks

A: Have you considered environmental datasets?
For one, there are near real time (say, hourly or 15m) data on streamflow and water quality. There's also a wealth of weather data served up via NOAA NCDC and APIs. How about some bouy data?
Seeing this post reminded me that there's lots of flight tracking data out there which could be fun to visualize too.

A: You can find real-time data sources at www.hooksdata.io. Using a query language you can specify what data you need and then add a webhook URL where you want to receive the data or just pull the data anytime.
API DOCS: https://www.hooksdata.io/docs/api/introduction/
Available data sources with examples:
RSS:
Input:
SELECT * FROM RSS('http://feeds.feedburner.com/TechCrunch/')

TwitterUserTimeline:
Input:
SELECT * FROM TwitterUserTimeline('Techstars')

Output:
{ "_entity_type": "tweet", "_id": "tweet_976733289221210112", "contributors": null, "coordinates": null, "created_at": "Thu Mar 22 08:12:17 +0000 2018", "entities": { "hashtags": [ { "indices": [ 121, 132 ], "text": "3Dprinting" } ], "symbols": [], "urls": [], "user_mentions": [ { "id": 117789943, "id_str": "117789943", "indices": [ 3, 19 ], "name": "StanleyBlack&Decker", "screen_name": "StanleyBlkDeckr" }, { "id": 14277276, "id_str": "14277276", "indices": [ 61, 71 ], "name": "techstars", "screen_name": "techstars" } ] }, "favorite_count": 0, "favorited": false, "geo": null, "id": 976733289221210112, "id_str": "976733289221210112", "in_reply_to_screen_name": null, "in_reply_to_status_id": null, "in_reply_to_status_id_str": null, "in_reply_to_user_id": null, "in_reply_to_user_id_str": null, "is_quote_status": false, "lang": "en", "metadata": { "iso_language_code": "en", "result_type": "recent" }, "place": null, "retweet_count": 7, "retweeted": false, "retweeted_status": { "contributors": null, "coordinates": null, "created_at": "Wed Mar 21 20:37:05 +0000 2018", "entities": { "hashtags": [ { "indices": [ 100, 111 ], "text": "3Dprinting" } ], "symbols": [], "urls": [ { "display_url": "twitter.com\/i\/web\/status\/9\u2026", "expanded_url": "https:\/\/twitter.com\/i\/web\/status\/976558334030442498", "indices": [ 117, 140 ], "url": "https:\/\/t.co\/6GWviWvVd1" } ], "user_mentions": [ { "id": 14277276, "id_str": "14277276", "indices": [ 40, 50 ], "name": "techstars", "screen_name": "techstars" } ] }, "favorite_count": 11, "favorited": false, "geo": null, "id": 976558334030442498, "id_str": "976558334030442498", "in_reply_to_screen_name": null, "in_reply_to_status_id": null, "in_reply_to_status_id_str": null, "in_reply_to_user_id": null, "in_reply_to_user_id_str": null, "is_quote_status": false, "lang": "en", "metadata": { "iso_language_code": "en", "result_type": "recent" }, "place": null, "possibly_sensitive": false, "retweet_count": 7, "retweeted": false, "source": "Percolate<\/a>", "text": "Ahead of the Stanley+Techstars program, @Techstars leaders visited us to see how we've incorporated #3Dprinting and\u2026 https:\/\/t.co\/6GWviWvVd1", "truncated": true, "user": { "contributors_enabled": false, "created_at": "Fri Feb 26 16:34:00 +0000 2010", "default_profile": false, "default_profile_image": false, "description": "Official Twitter account for Stanley Black and Decker", "entities": { "description": { "urls": [] }, "url": { "urls": [ { "display_url": "stanleyblackanddecker.com", "expanded_url": "http:\/\/stanleyblackanddecker.com", "indices": [ 0, 22 ], "url": "http:\/\/t.co\/OwfwWAucUP" } ] } }, "favourites_count": 474, "follow_request_sent": false, "followers_count": 5293, "following": false, "friends_count": 170, "geo_enabled": false, "has_extended_profile": false, "id": 117789943, "id_str": "117789943", "is_translation_enabled": false, "is_translator": false, "lang": "en", "listed_count": 136, "location": "New Britain", "name": "StanleyBlack&Decker", "notifications": false, "profile_background_color": "C0DEED", "profile_background_image_url": "http:\/\/pbs.twimg.com\/profile_background_images\/84200087\/stanley_twitter_nologos.jpg", "profile_background_image_url_https": "https:\/\/pbs.twimg.com\/profile_background_images\/84200087\/stanley_twitter_nologos.jpg", "profile_background_tile": false, "profile_banner_url": "https:\/\/pbs.twimg.com\/profile_banners\/117789943\/1501159100", "profile_image_url": "http:\/\/pbs.twimg.com\/profile_images\/534427580120571905\/qEDM5_-D_normal.jpeg", "profile_image_url_https": "https:\/\/pbs.twimg.com\/profile_images\/534427580120571905\/qEDM5_-D_normal.jpeg", "profile_link_color": "0084B4", "profile_sidebar_border_color": "C0DEED", "profile_sidebar_fill_color": "FFD30D", "profile_text_color": "333333", "profile_use_background_image": true, "protected": false, "screen_name": "StanleyBlkDeckr", "statuses_count": 1239, "time_zone": null, "translator_type": "none", "url": "http:\/\/t.co\/OwfwWAucUP", "utc_offset": null, "verified": false } }, "source": "Twitter for iPhone<\/a>", "text": "RT @StanleyBlkDeckr: Ahead of the Stanley+Techstars program, @Techstars leaders visited us to see how we've incorporated #3Dprinting and ad\u2026", "truncated": false, "user": { "contributors_enabled": false, "created_at": "Mon Jul 27 04:06:55 +0000 2015", "default_profile": true, "default_profile_image": false, "description": "Humble Star", "entities": { "description": { "urls": [] } }, "favourites_count": 51, "follow_request_sent": false, "followers_count": 26, "following": false, "friends_count": 74, "geo_enabled": false, "has_extended_profile": false, "id": 3296795162, "id_str": "3296795162", "is_translation_enabled": false, "is_translator": false, "lang": "en", "listed_count": 0, "location": "", "name": "Munkhi Tse", "notifications": false, "profile_background_color": "C0DEED", "profile_background_image_url": "http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png", "profile_background_image_url_https": "https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png", "profile_background_tile": false, "profile_banner_url": "https:\/\/pbs.twimg.com\/profile_banners\/3296795162\/1520835673", "profile_image_url": "http:\/\/pbs.twimg.com\/profile_images\/973081082500235264\/46urpcv1_normal.jpg", "profile_image_url_https": "https:\/\/pbs.twimg.com\/profile_images\/973081082500235264\/46urpcv1_normal.jpg", "profile_link_color": "1DA1F2", "profile_sidebar_border_color": "C0DEED", "profile_sidebar_fill_color": "DDEEF6", "profile_text_color": "333333", "profile_use_background_image": true, "protected": false, "screen_name": "Munkhitse", "statuses_count": 53, "time_zone": "Pacific Time (US & Canada)", "translator_type": "none", "url": null, "utc_offset": -25200, "verified": false } }

TwitterSearch:
Input:
SELECT * FROM TwitterSearch('Techstars')

Output:
{ "_entity_type": "tweet", "_id": "tweet_976733289221210112", "contributors": null, "coordinates": null, "created_at": "Thu Mar 22 08:12:17 +0000 2018", "entities": { "hashtags": [ { "indices": [ 121, 132 ], "text": "3Dprinting" } ], "symbols": [], "urls": [], "user_mentions": [ { "id": 117789943, "id_str": "117789943", "indices": [ 3, 19 ], "name": "StanleyBlack&Decker", "screen_name": "StanleyBlkDeckr" }, { "id": 14277276, "id_str": "14277276", "indices": [ 61, 71 ], "name": "techstars", "screen_name": "techstars" } ] }, "favorite_count": 0, "favorited": false, "geo": null, "id": 976733289221210112, "id_str": "976733289221210112", "in_reply_to_screen_name": null, "in_reply_to_status_id": null, "in_reply_to_status_id_str": null, "in_reply_to_user_id": null, "in_reply_to_user_id_str": null, "is_quote_status": false, "lang": "en", "metadata": { "iso_language_code": "en", "result_type": "recent" }, "place": null, "retweet_count": 7, "retweeted": false, "retweeted_status": { "contributors": null, "coordinates": null, "created_at": "Wed Mar 21 20:37:05 +0000 2018", "entities": { "hashtags": [ { "indices": [ 100, 111 ], "text": "3Dprinting" } ], "symbols": [], "urls": [ { "display_url": "twitter.com\/i\/web\/status\/9\u2026", "expanded_url": "https:\/\/twitter.com\/i\/web\/status\/976558334030442498", "indices": [ 117, 140 ], "url": "https:\/\/t.co\/6GWviWvVd1" } ], "user_mentions": [ { "id": 14277276, "id_str": "14277276", "indices": [ 40, 50 ], "name": "techstars", "screen_name": "techstars" } ] }, "favorite_count": 11, "favorited": false, "geo": null, "id": 976558334030442498, "id_str": "976558334030442498", "in_reply_to_screen_name": null, "in_reply_to_status_id": null, "in_reply_to_status_id_str": null, "in_reply_to_user_id": null, "in_reply_to_user_id_str": null, "is_quote_status": false, "lang": "en", "metadata": { "iso_language_code": "en", "result_type": "recent" }, "place": null, "possibly_sensitive": false, "retweet_count": 7, "retweeted": false, "source": "Percolate<\/a>", "text": "Ahead of the Stanley+Techstars program, @Techstars leaders visited us to see how we've incorporated #3Dprinting and\u2026 https:\/\/t.co\/6GWviWvVd1", "truncated": true, "user": { "contributors_enabled": false, "created_at": "Fri Feb 26 16:34:00 +0000 2010", "default_profile": false, "default_profile_image": false, "description": "Official Twitter account for Stanley Black and Decker", "entities": { "description": { "urls": [] }, "url": { "urls": [ { "display_url": "stanleyblackanddecker.com", "expanded_url": "http:\/\/stanleyblackanddecker.com", "indices": [ 0, 22 ], "url": "http:\/\/t.co\/OwfwWAucUP" } ] } }, "favourites_count": 474, "follow_request_sent": false, "followers_count": 5293, "following": false, "friends_count": 170, "geo_enabled": false, "has_extended_profile": false, "id": 117789943, "id_str": "117789943", "is_translation_enabled": false, "is_translator": false, "lang": "en", "listed_count": 136, "location": "New Britain", "name": "StanleyBlack&Decker", "notifications": false, "profile_background_color": "C0DEED", "profile_background_image_url": "http:\/\/pbs.twimg.com\/profile_background_images\/84200087\/stanley_twitter_nologos.jpg", "profile_background_image_url_https": "https:\/\/pbs.twimg.com\/profile_background_images\/84200087\/stanley_twitter_nologos.jpg", "profile_background_tile": false, "profile_banner_url": "https:\/\/pbs.twimg.com\/profile_banners\/117789943\/1501159100", "profile_image_url": "http:\/\/pbs.twimg.com\/profile_images\/534427580120571905\/qEDM5_-D_normal.jpeg", "profile_image_url_https": "https:\/\/pbs.twimg.com\/profile_images\/534427580120571905\/qEDM5_-D_normal.jpeg", "profile_link_color": "0084B4", "profile_sidebar_border_color": "C0DEED", "profile_sidebar_fill_color": "FFD30D", "profile_text_color": "333333", "profile_use_background_image": true, "protected": false, "screen_name": "StanleyBlkDeckr", "statuses_count": 1239, "time_zone": null, "translator_type": "none", "url": "http:\/\/t.co\/OwfwWAucUP", "utc_offset": null, "verified": false } }, "source": "Twitter for iPhone<\/a>", "text": "RT @StanleyBlkDeckr: Ahead of the Stanley+Techstars program, @Techstars leaders visited us to see how we've incorporated #3Dprinting and ad\u2026", "truncated": false, "user": { "contributors_enabled": false, "created_at": "Mon Jul 27 04:06:55 +0000 2015", "default_profile": true, "default_profile_image": false, "description": "Humble Star", "entities": { "description": { "urls": [] } }, "favourites_count": 51, "follow_request_sent": false, "followers_count": 26, "following": false, "friends_count": 74, "geo_enabled": false, "has_extended_profile": false, "id": 3296795162, "id_str": "3296795162", "is_translation_enabled": false, "is_translator": false, "lang": "en", "listed_count": 0, "location": "", "name": "Munkhi Tse", "notifications": false, "profile_background_color": "C0DEED", "profile_background_image_url": "http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png", "profile_background_image_url_https": "https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png", "profile_background_tile": false, "profile_banner_url": "https:\/\/pbs.twimg.com\/profile_banners\/3296795162\/1520835673", "profile_image_url": "http:\/\/pbs.twimg.com\/profile_images\/973081082500235264\/46urpcv1_normal.jpg", "profile_image_url_https": "https:\/\/pbs.twimg.com\/profile_images\/973081082500235264\/46urpcv1_normal.jpg", "profile_link_color": "1DA1F2", "profile_sidebar_border_color": "C0DEED", "profile_sidebar_fill_color": "DDEEF6", "profile_text_color": "333333", "profile_use_background_image": true, "protected": false, "screen_name": "Munkhitse", "statuses_count": 53, "time_zone": "Pacific Time (US & Canada)", "translator_type": "none", "url": null, "utc_offset": -25200, "verified": false } }

NFLGames:
Input:
SELECT * FROM NFLGames
WHERE status = 'FUTURE' and
away_team.team_name = 'New England Patriots' OR
home_team.team_name = 'New England Patriots' AND
start_datetime.countdown = 3600

SoccerGames:
Input:
SELECT * FROM SoccerGames
WHERE away_team.team_name = 'Real Madrid'
OR home_team.team_name = 'Real Madrid'
AND start_datetime.countdown = 3600

Output:
{
"matches_count": 1,
"results": [
    {
        "_entity_type": "SoccerGame",
        "_id": "SoccerGame_490555",
        "away_score": null,
        "away_team": {
            "_entity_type": "SoccerTeam",
            "_id": "SoccerTeam_86",
            "espn_id": 86,
            "id": "SoccerTeam_86",
            "logo_url": "http://a.espncdn.com/combiner/i?img=/i/teamlogos/soccer/500/86.png&h=500",
            "team_name": "Real Madrid"
        },
        "competition": "Spanish Primera División",
        "game_id": "490555",
        "home_score": null,
        "home_team": {
            "_entity_type": "SoccerTeam",
            "_id": null,
            "team_name": "Leganes"
        },
        "link": "http://m.espn.go.com/soccer/gamecast?gameId=490555&lang=EN&wjb=",
        "start_datetime": {
            "countdown": 86970,
            "datetime": "2018-02-21T17:45:00+0000",
            "timestamp": 1519235100
        },
        "status": "FUTURE",
        "timestamp": 1519235100
    }
]

}
EpisodesByTVShow:
Input:
SELECT * FROM
EpisodesByTVShow(name = 'Game of Thrones')
WHERE start_datetime.countdown = 3600

Output:
{
        "_entity_type": "Episode",
        "_id": "Episode_4961",
        "image": {
            "medium": "http://static.tvmaze.com/uploads/images/medium_landscape/1/2681.jpg",
            "original": "http://static.tvmaze.com/uploads/images/original_untouched/1/2681.jpg"
        },
        "link": "http://www.tvmaze.com/episodes/4961/game-of-thrones-1x10-fire-and-blood",
        "number": 10,
        "runtime": 60,
        "season": 1,
        "start_datetime": {
            "countdown": -210591933,
            "datetime": "2011-06-20T01:00:00+0000",
            "timestamp": 1308531600
        },
        "summary": "Daenerys must realize her destiny. Jaime finds himself in an unfamiliar predicament.",
        "title": "Fire and Blood",
        "tvmaze_episode_id": 4961,
        "tvshow": {
            "_entity_type": "TVShow",
            "_id": "TVShow_82",
            "externals": {
                "imdb": "tt0944947",
                "thetvdb": 121361,
                "tvrage": 24493
            },
            "genres": [
                "Drama",
                "Adventure",
                "Fantasy"
            ],
            "id": "TVShow_82",
            "image": {
                "medium": "http://static.tvmaze.com/uploads/images/medium_portrait/143/359013.jpg",
                "original": "http://static.tvmaze.com/uploads/images/original_untouched/143/359013.jpg"
            },
            "language": "English",
            "name": "Game of Thrones",
            "network": {
                "country": {
                    "code": "US",
                    "name": "United States",
                    "timezone": "America/New_York"
                },
                "id": 8,
                "name": "HBO"
            },
            "officialSite": "http://www.hbo.com/game-of-thrones",
            "premiered": "2011-04-17",
            "rating": {
                "average": 9.3
            },
            "runtime": 60,
            "schedule": {
                "days": [
                    "Sunday"
                ],
                "time": "21:00"
            },
            "status": "Running",
            "summary": "
Based on the bestselling book series A Song of Ice and Fire by George R.R. Martin, this sprawling new HBO drama is set in a world where summers span decades and winters can last a lifetime. From the scheming south and the savage eastern lands, to the frozen north and ancient Wall that protects the realm from the mysterious darkness beyond, the powerful families of the Seven Kingdoms are locked in a battle for the Iron Throne. This is a story of duplicity and treachery, nobility and honor, conquest and triumph. In the Game of Thrones, you either win or you die.
",
            "tvmaze_id": 82,
            "type": "Scripted",
            "updated": 1517168016,
            "url": "http://www.tvmaze.com/shows/82/game-of-thrones",
            "webChannel": {
                "country": {
                    "code": "US",
                    "name": "United States",
                    "timezone": "America/New_York"
                },
                "id": 22,
                "name": "HBO Go"
            },
            "weight": 99
        }
    }

WeatherByCity:
Input:
SELECT * FROM WeatherByCity
(name = 'San Francisco'
AND country.name = 'United States'
AND subdivision.type = 'State'
AND subdivision.name = 'California')
WHERE weather_conditions.main = 'Rain'
AND start_datetime.countdown = 86400

Output:
{
        "_entity_type": "WeatherStatus",
        "_id": "WeatherStatus_Geoname_5391959-1519178400",
        "city": {
            "_entity_type": "City",
            "_id": "Geoname_5391959",
            "admin1_code": "CA",
            "admin2_code": "075",
            "admin3_code": null,
            "admin4_code": null,
            "alternative_names": [
                "Franciscopolis",
                "Frisco",
                "Gorad San-Francyska",
                "Kapalakiko",
                "Khiu-kim-san",
                "Khiu-kîm-sân",
                "Lungsod ng San Francisco",
                "New Albion",
                "SF",
                "SFO",
                "San Francisco",
                "San Franciscu",
                "San Francisko",
                "San Fransisco",
                "San Fransiskas",
                "San Fransisko",
                "San Frantzisko",
                "San Phransisko",
                "San-Francisko",
                "San-Fransisko",
                "Sanfrancisko",
                "Sao Francisco",
                "São Francisco",
                "Yerba Buena",
                "can pirancisko",
                "jiu jin shan",
                "saenpeulan",
                "saenpeulansiseuko",
                "saina pharansisako",
                "saina phransisko",
                "san f ran si s ko",
                "san fan shi",
                "san fransskw",
                "san fransyskw",
                "san fransyskۆ",
                "san phransisko",
                "sana phransisako ka'unti",
                "sana phransisko",
                "sanfuranshisuko",
                "sena phransisko",
                "sn prnsysqw",
                "syana phransisko",
                "Σαν Φρανσίσκο",
                "Горад Сан-Францыска",
                "Сан Франсиско",
                "Сан Франциско",
                "Сан-Франциско",
                "Сан-Франціско",
                "Սան Ֆրանցիսկո",
                "סאן פראנציסקא",
                "סן פרנסיסקו",
                "سان فرانسسکو",
                "سان فرانسيسكو",
                "سان فرانسیسکو",
                "سان فرانسیسکۆ",
                "सॅन फ्रान्सिस्को",
                "सैन फ्रांसिस्को",
                "स्यान फ्रान्सिस्को",
                "সান ফ্রান্সিসকো কাউন্টি",
                "সান ফ্রান্সিস্কো",
                "ਸੈਨ ਫਰਾਂਸਿਸਕੋ",
                "சான் பிரான்சிஸ்கோ",
                "శాన్ ఫ్రాన్సిస్కో",
                "സാൻ ഫ്രാൻസിസ്കോ",
                "සැන් ෆ්\u200dරැන්සිස්කෝ",
                "ซานฟรานซิสโก",
                "སན་ཧྥུ་རན་སིས་ཁོ",
                "ဆန်ဖရန်စစ္စကိုမြို့",
                "სან-ფრანცისკო",
                "サンフランシスコ",
                "三藩市",
                "旧金山",
                "舊金山",
                "샌프란",
                "샌프란시스코"
            ],
            "ascii_name": "San Francisco",
            "coordinates": "37.77493,-122.41942",
            "country": {
                "country_code_2": "US",
                "country_code_3": "USA",
                "country_numeric_code": "840",
                "name": "United States",
                "official_name": "United States of America"
            },
            "dem": "28",
            "elevation": 16,
            "feature_class": "P",
            "feature_code": "PPLA2",
            "geonameid": "5391959",
            "id": "Geoname_5391959",
            "modification_date": "2017-06-15",
            "name": "San Francisco",
            "population": 864816,
            "subdivision": {
                "country_code_2": "US",
                "name": "California",
                "subdivision_code": "US-CA",
                "type": "State"
            },
            "timezone": "America/Los_Angeles"
        },
        "features": {
            "clouds_percent": 44,
            "humidity_percent": 83,
            "pressure": {
                "hPa": 1027.12,
                "inHg": 30.33,
                "mmHg": 770.4
            },
            "rain": {
                "inch_hour": 0,
                "mm_hour": 0
            },
            "snow": {
                "inch_hour": 0,
                "mm_hour": 0
            },
            "temperature": {
                "celsius": 8.36,
                "fahrenheit": 32
            },
            "wind_direction_degrees": 297.002,
            "wind_speed": {
                "meters_per_second": 3.42,
                "miles_per_hour": 7.65
            }
        },
        "is_current": false,
        "measure_time": {
            "countdown": 42931,
            "datetime": "2018-02-21T03:00:00+0000",
            "timestamp": 1519182000
        },
        "start_datetime": {
            "countdown": 39331,
            "datetime": "2018-02-21T02:00:00+0000",
            "timestamp": 1519178400
        },
        "weather_conditions": [
            {
                "description": "scattered clouds",
                "icon": "03n",
                "icon_url": "http://openweathermap.org/img/w/03n",
                "id": 802,
                "main": "Clouds"
            }
        ]
    }

NBAGames:
Input:
SELECT * FROM NBAGames
WHERE status='FUTURE'
AND (away_team.team_name='Charlotte Hornets'
OR home_team.team_name='Charlotte Hornets')
AND start_datetime.countdown = 3600

Output:
{
"matches_count": 1,
"results": [
    {
        "_entity_type": "NBAGame",
        "_id": "NBAGame_400975613",
        "away_score": null,
        "away_team": {
            "_entity_type": "NBATeam",
            "_id": "NBATeam_CHA",
            "acronym": "CHA",
            "division": "Southeast",
            "id": "NBATeam_CHA",
            "team_name": "Charlotte Hornets"
        },
        "game_id": "400975613",
        "home_team": {
            "_entity_type": "NBATeam",
            "_id": null,
            "acronym": null
        },
        "link": "http://espn.go.com/nba/game?gameId=400975613",
        "start_datetime": {
            "countdown": 137435,
            "datetime": "2018-02-23T00:00:00+0000",
            "timestamp": 1519344000
        },
        "status": "FUTURE"
    }
]

}
MLBGames:
Input:
SELECT * FROM MLBGames
WHERE status = 'FUTURE'
AND (away_team.team_name = 'Toronto Blue Jays'
OR home_team.team_name = 'Toronto Blue Jays')
AND start_datetime.countdown = 3600

Output:
{
"matches_count": 1,
"results": [
    {
        "_entity_type": "MLBGame",
        "_id": "MLBGame_400962533",
        "away_score": null,
        "away_team": {
            "_entity_type": "MLBTeam",
            "_id": "MLBTeam_TOR",
            "acronym": "TOR",
            "division": "AL East",
            "id": "MLBTeam_TOR",
            "team_name": "Toronto Blue Jays"
        },
        "game_id": "400962533",
        "home_team": {
            "_entity_type": "MLBTeam",
            "_id": null,
            "acronym": null
        },
        "link": "http://espn.go.com/nhl/gamecast?gameId=400962533",
        "start_datetime": {
            "countdown": 135524,
            "datetime": "2018-02-23T00:00:00+0000",
            "timestamp": 1519344000
        },
        "status": "FUTURE"
    }
]

}
NHLGames:
Input:
SELECT * FROM NHLGames
WHERE status='FUTURE'
AND (away_team.team_name='New Jersey Devils'
OR home_team.team_name='New Jersey Devils')
AND start_datetime.countdown = 3600

Output:
{
"matches_count": 1,
"results": [
    {
        "_entity_type": "NHLGame",
        "_id": "NHLGame_400962534",
        "away_score": null,
        "away_team": {
            "_entity_type": "NHLTeam",
            "_id": "NHLTeam_NJ",
            "acronym": "NJ",
            "division": "Metropolitan Division",
            "id": "NHLTeam_NJ",
            "team_name": "New Jersey Devils"
        },
        "game_id": "400962534",
        "home_team": {
            "_entity_type": "NHLTeam",
            "_id": null,
            "acronym": null
        },
        "link": "http://espn.go.com/nhl/gamecast?gameId=400962534",
        "start_datetime": {
            "countdown": 134517,
            "datetime": "2018-02-23T00:00:00+0000",
            "timestamp": 1519344000
        },
        "status": "FUTURE"
    }
]

}
CryptoTickers:
Input:
SELECT * FROM CryptoTickers
WHERE market_cap_usd >= 18000000000

StockTickers:
SELECT * FROM StockTickers('AAPL')
WHERE close > 170

A: Just some thoughts:
Environmental Datasets
As stated by the other comment, have a look to weather, forecast (or similar services).
Space data
What about data from the Universe?
Flights
Here's some real time flight tracking data: the evaluation plan is limited but free.
Social Networks
Twitter Streaming API, Facebook RealTime Updates API (in case you hyave already an app on the social Network), Foursquare
Energy production
Various energy production (real-time and quasi real-time) data.
On these ones probably you have to fiddle around the pages to track the sources of the data, sorry.
Website traffic
Google Analytics RealTime API (for your registered websites)
Money
Bitcoin transactions, Stock Market API
More?
And here and here an "not-so-updated" list of other Real-Time API services (some free, some others not).

A: I'm been working with Ably Hub - it is a marketplace for open streaming data sources, which are either paid or free to use under different licenses.
Full disclosure: I'm a Developer Advocate for Ably but I think the resources from this marketplace might certainly help you with some cool data viz.
If you are interested in checking out an example - I built a live bitcoin price chart using one of the sources from the Ably Hub and KendoUI.


text:
Q: Biztalk SOAP Adapter Maximum Number Of Messages I wonder if anyone can help. We're going through a period of performance testing whereby we send messages from .Net code into a SOAP adapter exposed by Biztalk. We're having some issues when we try to send 100 messages over (sequentially) at the same time.
Our Biztalk 'expert' has came back and suggested that the Biztalk SOAP adapter may not be able to handle that many requests in quick succession. This sounds ludicrous to me, can anybody point me at any official figures regarding request thresholds / or share their experience.
(Understand WCF may be a better option, however this is not available to us at this time).

A: I think it might be related to a threading, see section: Threading Issues, or a connections, see section: ASP .NET Settings Related to HTTP, SOAP, or WSE Adapter Performance at Troubleshooting BizTalk Server SOAP Adapter


text:
Q: Load a picturebox from a WIA ImageFile? I've taken over a poorly designed project from a co-worker and am looking to load a picture box directly from the WIA command that just completed to take a picture from an attached USB camera.
The current implementation waits until the file has been written to disk, then displays it from there probably
re-reading the file from disk.
Item item = d.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture);

WIA.ImageFile imagefile = item.Transfer(FormatID.wiaFormatJPEG) as WIA.ImageFile;

I tried casting an Image to the given picture box without success
picBox.Image = (Image)imageFile;

A: WIA.ImageFile is a COM object wrapper, not a System.Drawing.Image.
You'll have to mess with WIA.ImageFile Save method with temporary files or try in-memory solution as shown here:
http://www.pcreview.co.uk/forums/wia-imagefile-system-drawing-image-t2321026.html
var imageBytes = (byte[])image.FileData.get_BinaryData();
var ms = new MemoryStream(imageBytes);
var img = Image.FromStream(ms);


text:
Q: Text size and high contrast accessibility jQuery mobile I am new to jQuery mobile and I am trying to achieve jQuery mobile accessibility. Text size and high contrast. But in this I want text size and high contrast to be select through select options. Something I find but this is not what I am looking.
"jsfiddle net/DC2Ry/2"

A: I have altered your fiddle. Did you mean for the top buttons to be dropdowns themselves?
link: http://jsfiddle net/qrf4bcj3/1/
EDIT
Check this bad boy out:
http://jsfiddle net/qrf4bcj3/2/


text:
Q: Does markdown work in comments in "needs ♦ moderator attention" Flag dialog? For example:

A: Markdown is supported in flags these days. It uses the same "mini Markdown" renderer used for comments.
https://meta.stackexchange.com/a/214270/133242


text:
Q: Apache virtual host loads wrong page when a path is used I have a number of virtual hosts setup on my Apache server (RedHat) that all work fine until a path is used. To explain.
I have:

*

*https: //myserver1.com (default site)

*https: //myserver2.com

*https: //myserver3.com

But when a user lands on any of them they get the correct page and the URL is appended to /PORTAL/STARTUP.php
But if the users then bookmark their page e.g. https: //myserver3.com/PORTAL/STARTUP.php they will land of the default site but with the correct URL.
What have I missed?
<VirtualHost *:443>
    DocumentRoot /var/www/html/myserver1
    ServerName myserver1. com
    ErrorLog logs/myserver1-error_log
    CustomLog logs/myserver1-access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/myserver2
    ServerName myserver2.com
    ErrorLog logs/myserver2-error_log
    CustomLog logs/myserver2-access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/myserver3
    ServerName myserver3.com
    ErrorLog logs/myserver3_error_log
    CustomLog logs/myserver3_access_log common
</VirtualHost>

UPDATE
<VirtualHost 111.111.111.111:80>
        ServerAlias *
        RewriteEngine On
        RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [redirect=301]
</VirtualHost>

<VirtualHost 111.111.111.111:80>
        ServerAlias *
        RewriteEngine On
        RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [redirect=301]
</VirtualHost>

<filesMatch "\.(html|htm|js|css|png)$">
  FileETag None
  <ifModule mod_headers.c>
     Header unset ETag
     Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
     Header set Pragma "no-cache"
     Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
  </ifModule>
</filesMatch>

Header set X-Permitted-Cross-Domain-Policies: "master-only"
Header always set X-Frame-Options SAMEORIGIN
Header set X-XSS-Protection: "1; mode=block"
Header set Access-Control-Allow-Origin "*"

<VirtualHost *:80>
    ServerName clientA.com
    DocumentRoot /var/www/html
    ErrorLog logs/clientA.com-error_log
    CustomLog logs/clientA.com-access_log common
</VirtualHost>

<VirtualHost *:443>
    ServerName clientB.com:443
    DocumentRoot /var/www/html
    Redirect / https://clientB.com/
    ErrorLog logs/clientB.error_log
    CustomLog logs/clientB.access_log common
</VirtualHost>

#<VirtualHost *:443>
   # DocumentRoot /var/www/html/clientC
    #ServerName www.clientC.com
    #ErrorLog logs/clientB.com-error_log
    #CustomLog logs/clientB.com-access_log common
#</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientD
    ServerName clientD.com
    ErrorLog logs/clientD.com-error_log
    CustomLog logs/clientD.com-access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientE
    ServerName clientE.com
    ErrorLog logs/clientD.com-error_log
    CustomLog logs/clientD.com-access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientF
    ServerName clientF.com
    ErrorLog logs/clientF.com_error_log
    CustomLog logs/clientF.com_access_log common
</VirtualHost>

<VirtualHost *:443>
  DocumentRoot /var/www/html/clientG
  ServerName clientG.com
  ErrorLog logs/clientG_error_log
  CustomLog logs/clientG_access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientH
    ServerName clientH.com
    ErrorLog logs/clientH_error_log
    CustomLog logs/clientH_access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientI
    ServerName clientI.com
    ErrorLog logs/clientI_error_log
    CustomLog logs/clientI_access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientJ
    ServerName clientJ.com
    ErrorLog logs/error_log
    CustomLog logs/access_log common
</VirtualHost>

<VirtualHost *:443>
    ProxyPreserveHost On
    ProxyPass / http://111.111.111.111/
    ProxyPassReverse / http://11.111.111.111/
    ServerName clientK.com
    ErrorLog logs/clientK_error_log
    CustomLog logs/clientK_access_log common
</VirtualHost>

Then the above vhost entries go on to clients through to J


text:
Q: NPM command to drop mongo database, using "echo" not working I'm trying to create an npm command that drops a database from my mongo instance.
When I paste this line of code directly into my shell, it works, and gives the output below:
> echo 'db.dropDatabase()' | mongo musicappdb

MongoDB shell version v3.4.10
connecting to: mongodb://127.0.0.1:27017/musicappdb
MongoDB server version: 3.4.10
{ "ok" : 1 }
bye

However when I run it from my npm script, which is defined like this
scripts: {
     ...
     "drop-db": "echo 'db.dropDatabase()' | mongo musicappdb",
     ...
  },

I get
> echo "db.dropDatabase()" | mongo musicappdb

MongoDB shell version v3.4.10
connecting to: mongodb://127.0.0.1:27017/musicappdb
MongoDB server version: 3.4.10
db.dropDatabase()
bye

And the database is NOT getting dropped.
Why is the command not behaving properly when I issue through npm?

A: This worked for me:
"drop-db": "echo db.dropDatabase() | mongo musicappdb"

Without the single quotes.
It didn't work with either double or single quote. This is on Windows 10.

A: hey see this article maybe helps :
http://antrikshy.com/blog/run-mongodb-automatically-nodejs-project
just test :
'start mongo admin --eval "db.dropDatebase()" '

A: "drop-db": "echo 'db.dropDatabase()' | mongo myDB"

This worked for me
Output was
MongoDB shell version v4.0.9
connecting to: mongodb://127.0.0.1:27017/myDB?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("44d9deb8-6de1-49ff-8532-24cf2ae5247b") }
MongoDB server version: 4.0.9
{ "ok" : 1 }
bye

A: If someone is using Docker container:
docker exec -it mongodb_container sh -c "mongo db_name --eval 'db.dropDatabase()'"


text:
Q: How does printf take endianness into account behind the scenes? prtinf uses the write system call behind the scenes which calls vfprintf_internal defined in glibc defined here:
https://code.woboq.org/userspace/glibc/stdio-common/vfprintf-internal.c.html
I'm suspecting down the line it puts the characters one by one in some VGA buffer like 0xB8000 as explained here:
https://wiki.osdev.org/Bare_Bones
My question is:

*

*Does it automatically take care of the machine endianness?

If data is stored in reverse in memory in LE machines, it should first reverse them back before printing them byte by byte correct?
Where does that happen? Maybe itoa is doing that while converting each int to a char?


text:
Q: How to fetch cross domain data and parse it by using pure javascript? I wrote a simple example in Python.
the goal is to fetch the HTML and use "beautifulsoup"(html parser library) to parse the data I want.
The tools I used as following
 1. curl : to fetch specific url resource
 2. beauifulsoup : make me parse the complex html more easier
Now, I want to achieve the goal by pure javascript,
Because I want the to put the functionality on the my web site,
however if put the computation tasks on Server side is heavy for server,
so I want to pass the tasks to the client-side.
Is there any good way (some libraries?) to achieve the goal quickly?
Many thanks in advance

A: You cannot fetch HTML from other domains using JavaScript. It's intentionally disallowed for security reasons.
You could write a simple proxy on the server-side and then fetch the HTML through the proxy. That would free the server from any heavy computation you need to do, even if the load isn't completely on the browser.
Or, if you have control of the code on the other site, you could use JSONP as stated in Hilmi's comment.


text:
Q: How to resolve FCM curl failed error? I have implemented push notification using Fire base Cloud Messaging in Android, before today its working fine. But now, its not working.
It shows Error like this:

Curl failed: Failed to connect to fcm.googleapis.com port 443:
  Connection timed out

<?php

function send_notification ($tokens, $message)
{
    $url = 'https://fcm.googleapis.com/fcm/send';
    $fields = array(
         'registration_ids' => $tokens,
         'data' => $message
        );

    $headers = array(
        'Authorization:key = API KEY ',
        'Content-Type: application/json'
        );

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_POST, true);
   curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
   curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
   $result = curl_exec($ch);
   if ($result === FALSE) {
       die('Curl failed: ' . curl_error($ch));
   }
   curl_close($ch);
   return $result;
}

$tokens = "Token here..";

$message = array("message" => " FCM PUSH NOTIFICATION TEST MESSAGE");
$message_status = send_notification($tokens, $message);
echo $message_status;

?>

Now How to resolve it?

A: I found the solution, that the port no. 443 was blocked on the server for some reason. now its working fine.
Thank you


text:
Q: Case sensitive logon on some users Looking for a way to let selected users have case-sensitive logon check on Oracle 12.1. Setting SEC_CASE_SENSITIVE_LOGON = TRUE enables all users to have case sensitive logon, but trying to limit that to some.
Defining a profile having a verify function which checks for at least one upper and lower letter seems to only check when changing the password, but not upon logon.


text:
Q: Recovery of MapInfo transaction files (*.TMA, *.TIN, *.TDA) MapInfo (v 12.5.1 - 64 Bit, Release Build 122) just crashed on me while I was in the middle of modifying several tables and adding a few new ones to an existing Workspace.
Unfortunately the changes had not yet been saved, so were still being stored in the transaction files (*.TMA, *.TIN, *.TDA).  When I reopened the workspace, I was not expecting the unsaved changes to be recovered automatically, but I found no method to try to import the existing transaction files (which were still on my hard drive) so I could recover my lost data.
Is there a method built into MapInfo (or not) that can be used to recover this lost data?  Or am I forced to recreate it?

A: Unfortunately not.
These transaction files seems in some way bound to the session that created them, so you can't use them from a new session.
Let me add two recommendations:

*

*Goto ideas.pb.com and add a request/idea for Pitney Bowes to add a capability for getting to the data in the transaction files

*Download and install the latest patch for MapInfo Pro 12.5. You can find the patch here: Download for MapInfo Pro


text:
Q: Nested template using/typdef Say I have this setup:
template<typename T1>
struct A {
  template<typename T2>
  struct B {
    using type = int;
  };
};

I'd like to be able to form a typdef/using:
template<typename T1,typename T2>
using type2 = A<T1>::B<T2>::type;
//... and use like
type2<int,char> foo;

GCC complains that I need typename A<T1>::B<T2>::type instead, and afterwards complains that it expects ";" before "<" after B (i.e. typename A<T1>::B)
is there no way to use "using" with nested templates?

A: Switch from
using type2 = A<T1>::B<T2>::type;

to
using type2 = typename A<T1>::template B<T2>::type;

A: Note that B is a templated class and type is enclosed in a templated class, hence use the following
#include <iostream>
template<typename T1>
struct A {
    template<typename T2>
    struct B {
        using type = int;
    };
};

template<typename T1,typename T2>
using type2 = typename A<T1>::template B<T2>::type;

int main()
{
    type2<int,char> foo =2;
    std::cout << foo;

}


text:
Q: Jmeter- Beanshell code to add title in CSV I want to extract Response Title (HTML -> Head->Title) and want to add in CSV using beanshell. Can anyone please help in this. what code need to write in beanshell ?

A: *

*If you need to store a JMeter Variable into a file the easiest option is using Sample Variables property.

*

*add the next line to user.properties file (located in JMeter's "bin" folder)
sample_variables=yourVar

where yourVar should be your real "Reference Name" from the Regular Expression extractor

*restart JMeter to pick up the change

*when you run your test next time you will see an extra column in .jtl results file holding the required variable value

The property can be also set via -J command-line argument like:
jmeter -Jsample_variables=yourVar -n -t test.jmx -l result.jtl

*If you still want to go for scripting be aware that recommended approach assumes JSR223 Test Elements and Groovy language. You can write a variable into a file in Groovy like:
new File('yourFile.csv') << vars.get('yourVar')

again replace yourVar with your real variable name.

*If you still looking for Beanshell, the easiest way would be using FileUtils.writeStringToFile() function like
import org.apache.commons.io.FileUtils;
import java.nio.charset.StandardCharsets;

FileUtils.writeStringToFile(new File("yourFile.csv"), vars.get("yourVar"), StandardCharsets.UTF_8);


text:
Q: Starting JBPM demo I am trying to start the demo version of JBPM  7.26.0 (windows).
After a successful "ant start.demo", the wildfly server log fills up with

WARN  [org.kie.server.common.KeyStoreHelperUtil] (Thread-149) Unable
to load key store. Using password from configuration

http://localhost:8080/jbpm-casemgmt/jbpm-cm.html never loads after logging in (spins indefinitely).
Any suggestions on how to troubleshoot?
thanks!

A: Beside the Single Zip Distribution you can also try the provided Docker builds.
Just install Docker and run docker run -p 8080:8080 -p 8001:8001 -d --name jbpm-server-full jboss/jbpm-server-full:7.26.0.Final and browse to http://localhost:8080/business-central
This works fine for me.


text:
Q: AES encryption for storing data on cookie I need to store the maximum chars as possible on a cookie having char string to store encrypted in AES.
cookie has about 4kb  memory.
So i need to count how much chars i can store in a cookie encrypting in AES all these chars.
chars to store is an alphanumerical string.
EDIT: i can allow all the UTF-8 alphanumeric chars both in plaintext and in chipertext
THIS IS MY PIECE OF CODE
 <?php

$Pass = "132ksjcngpt04938idjsk39urtokg";
$Clear = "123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123456789012345678901234567890123456789o";

$crypted = fnEncrypt($Clear, $Pass);
echo "Encrypred: ".$crypted."

";

$newClear = fnDecrypt($crypted, $Pass);
echo "Decrypred: ".$newClear."

";

function fnEncrypt($sValue, $sSecretKey)
{
    return trim(
        base64_encode(
            mcrypt_encrypt(
                MCRYPT_RIJNDAEL_128,
                $sSecretKey, $sValue,
                MCRYPT_MODE_ECB,
                mcrypt_create_iv(
                    mcrypt_get_iv_size(
                        MCRYPT_RIJNDAEL_128,
                        MCRYPT_MODE_ECB
                    ),
                    MCRYPT_RAND)
                )
            )
        );
}

function fnDecrypt($sValue, $sSecretKey)
{
    return trim(
        mcrypt_decrypt(
            MCRYPT_RIJNDAEL_128,
            $sSecretKey,
            base64_decode($sValue),
            MCRYPT_MODE_ECB,
            mcrypt_create_iv(
                mcrypt_get_iv_size(
                    MCRYPT_RIJNDAEL_128,
                    MCRYPT_MODE_ECB
                ),
                MCRYPT_RAND
            )
        )
    );
}
?>

I TESTED AND THIS IS THE RESULT:
Encrypred: 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

Decrypred: 123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123hryd{}ls.-''ksllasllallallallallal:{}::{}jdhhfn123456789012345678901234567890123456789o

chiperText  is compoused of 3040 utf-8 chars
encrypted is up to 4056 utf-8 chars

A: Correct me if I wrong but supposing you're using UTF-8 as alphanumerical character for your plain text, since AES works with 16 byte length blocks (that can be viewed as 16 alphanumerical character in this context), your plain text is at least padded with 15 byte (the worst scenario).
So, given n the length of your plain text, the resulting cipher text length can be inferred with:
(n + 16) - (n % 16)

Just my 2 cents.
Dario.

A: If you use an authenticated streaming mode, such as AES-GCM, the raw ciphertext size in bytes will be 32 bytes larger than the plaintext size. 16 of those are for a random IV, and 16 for the MAC.
Now you have the problem that arbitrary bytes aren't valid UTF-8, so you need some encoding to take care of that. Base64 is a popular variant, but it increases the size to 4/3 of the original size.
This means if your size limit is 4KiB, you'll be able to support plaintexts of up to 3040 bytes.
There are other more efficient encodings, but that gets more complicated, and you'll need to figure out which characters are valid (such as \0). I don't recommend that unless absolutely necessary.

Your code has plenty of mistakes:

*

*You're using ECB, pretty much the worst of all modes

*You need the same IV for encryption and decryption. So store it alongside the ciphertext. You don't notice it, since ECB doesn't use an IV.

*You don't have authentication.

*Your IV generation isn't good. Use MCRYPT_DEV_URANDOM instead of MCRYPT_RAND.


text:
Q: is there a limit for CopyDatabase in Mongo I'm copying 100Million records (about 97G) data to another server using copyDatabase in Mongo. Both servers have more than 500G diskspace. However, i notice although the process is still running, but the actual files are not added anymore. stop at xxxxx.11    any idea?

A: Copy database will move collection data over, then build indexes for each collection. Building indexes on a 100GB data set can take a lot of time (especially with small amounts of RAM). It's likely that you're in the middle of a large index build.
You can check the progress by watching the logs and running db.currentOp() in the shell on the destination DB.


text:
Q: How can I change Integer value when it is an argument like change array's value? public static void main(String[] args) {
    Integer i = new Integer(0);
    int[] arr = {1};
    p1(i);
    p2(arr);
    System.out.println(i);
    System.out.println(arr[0]);
}

public static void p1(Integer i) {
    i = 2;
}

public static void p2(int[] i) {
    i[0] = 2;
}

//output: 0, 2
How can I change the value of i like I change the value of arr?

A: You can use AtomicInteger, which allows changing, instead of Integer:
public static void main(String[] args) {
    AtomicInteger i = new AtomicInteger(0);
    p1(i);
    System.out.println(i);
}

public static void p1(AtomicInteger i) {
    i.set(2);
}

A: Simply put: You can't, because Integer is immutable and you only get the object address by value, so swapping the whole object is not possible because after the method finished, the old object gets reassigned.

A: You can't change the value of the variable i in main from within the p1 method, because the argument is passed by value: the parameter i in p1 is entirely separate from the i variable, it's just that they have the same value at the start of the method. Java always uses pass-by-value semantics - but when the parameter type is a class, it's a reference that is passed by value.
In fact, you're not changing the value of arr, either - it's a reference to the same array as before, but the value in the array has been changed. And that's what you can't do with Integer, because Integer is an immutable type.
If you want a mutable class like Integer, you could use AtomicInteger instead:
public static void main(String[] args) {
    AtomicInteger i = new AtomicInteger(0);
    modify(i);
    System.out.println(i);
}

private static void modify(AtomicInteger x) {
    x.set(2);
}

I would usually not do this, however - I usually try not to modify the objects that method parameters refer to. Instead, I write methods which compute a single result, and return that.

A: Only by using some "hacks". You can do this like this:
public static void p1(Integer curInt) {
          Field field = curInt.getClass().getDeclaredField("value"); // Integer stores the real value in private field "value"
          field.setAccessible(true);
          field.set(curInt, 2);

}


text:
Q: Eigen - get a matrix from a map? I'm using Eigen::Map to get access to create an object from a C-array. I would like to save that object as a member variable of type MatrixXf.
How do I do that? I couldn't find a way to convert the Map to a Matrix.
Thanks.

A: I have encountered the same issue but vector is constant, then you have to do it following way as @ggael proposed,
Eigen::MatrixXd mat = Eigen::Map<const Eigen::MatrixXd>(x.data(), rows, cols);

where x can be either const Eigen::VectorXd x or const std::vector<double> or C type array.

A: Just use operator=:
MatrixXd mat;
mat = Map<MatrixXd>(data, rows, cols);


text:
Q: Linking if true statement in R I have a set of data in R. 800 samples with 12 observations generated randomly between 10 and 20. From this, i have two options, if the random generated number is less than 15, then the selection is option one and above 15, its option B. Now i want to generated a set of data for option one from its mean and sd as the normal distribution where the option A is true.
Run1 <- replicate(800, rnorm(12, mean=16, sd=3.1))

Im not sure how to link my other piece of code that says whether the option A is TRUE and thus generate a value for Run1?
edit: i essentially currently have a matrix which comprises of TRUE and FALSE, for the arguments above (option A - mean=16, sd=3.1 and option B - mean=18, sd=3.3) where A is TRUE for values below 15 and FALSE for values above 15. so a matrix like this is derived (just a small sample of full matrix)
  [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]

[1,]  TRUE  TRUE FALSE  TRUE FALSE FALSE  TRUE
  [2,]  TRUE  TRUE FALSE FALSE  TRUE  TRUE  TRUE
So what i want now is two matrices (one for A and on for B) which provide a mean value where A is TRUE (matrix A) from a normal distribution of the option A values detailed above and a mean value for B where it is FALSE (matrix B) from a normal distribution of the option B values detailed above ideally posessing N/A or similar where the value should not be generated in the corresponding matrix.
and then finally i would also like to combine these two matrices to form a third final matrix. may seem labourious but its necessary.
Thanks

A: One way to do this is to construct a matrix of the right size, then use row indexing to fill values into the appropriate rows ...
set.seed(101)
runifvals <- runif(800,10,20)
result <- matrix(nrow=800,ncol=12)
lowvals <- runifvals<=15
## sum(lowvals) is the number of rows of data we have to generate for case A ...
result[lowvals,]  <- rnorm(sum(lowvals)*12, 16,3.1)
result[!lowvals,] <- rnorm(sum(!lowvals)*12,18,3.3)

This assumes it's OK to have the result as an 800x12 matrix (but that's probably the most convenient format in general).
edit if you really want two separate matrices with embedded NAs (this seems odd/wasteful, but whatever ...):
matA <- matB <- matrix(NA,nrow=800,ncol=12)
matA[lowvals,]  <- rnorm(sum(lowvals)*12, 16,3.1)
matB[!lowvals,] <- rnorm(sum(!lowvals)*12,18,3.3)


text:
Q: Sending a pdf attachment from site on button click without mailto spam So, I have a site where I'd like users to send a document (preferably) a pdf file or word doc on button click to a specific email address.
I read that mailto is not a good way to do it because of all the potential spam thats possible from spambots. Disassembling and reassembling the email address doesn't seem that hard to crack either. I don't understand how encoding works so I'd be grateful if someone explains that.
What I would like is: when the user clicks the send button, it opens up an email client with the address of the recipient and of course the mail client would have the ability to send attachments. Whats a good way spam protected way to do this?

A: You can't send files with mailto. What you should do instead, which would also protect you from spam bots, is upload the file to your server and send the mail with the attached file from there.

A: The mailto protocol does not include attachments. And it would be a huge security issue as well. Some Outlook-related examples can be found on the internet, but in the case it has been working in the past, it is not possible nowadays and at least not platform independent in every case.