text:
Q: Why I need to click twice to generate a value in input field I developed a page using codeigniter framework. Following is the part of a code in the controller.
This creates few sets of buttons and input fields. When I click on each button values should added to the relevant input field. Everything works fine. But the problem is I have to click twice on the button. Once I click twice then values start to appear. And if I continue to click on other buttons then values generated in relavent input fields by one click. It need double click for the first button click. (Not for the first button of the order. I need to click twice for even start with button in the middle).
Also if I click two different buttons(each button 1 time). Then values will be added to the both input fields with the second click.
Also according to direction in a previous answer of the stackoverflow question I tried changing it to
$test .= '<input type="button"

instead of
$test .= '<button

But there was no luck. I'm really thankful if someone can give me a clue for this issue.
foreach ($data as $c) {
  foreach ($c as $value) {

    //There are some codes here
    //But there are no <form> elements in this area.

    $test .= "  reply
";
    $test .= '<input type="text" id="new_reply' . $value['id'] . '"  class="form-control">';
    $test .= '<button data-comment-id="' . $value['id'] . '" onclick="test_function(this);">Reply</button>';

  }
}

echo json_encode($test);

And here is my js function. Please note that this is not the end purpose of this function. I changed it to something very simple to identify the issue. Also to convey my issue.
$(document).ready(function(){
    test_function();
})

function test_function(reply){
  $("button").click(function() {
        var comment_id = reply.getAttribute("data-comment-id");
        if(comment_id){
            var inputbox_id = "new_reply" + comment_id;
            document.getElementById(inputbox_id).value ='test value';
        }
  });

}
and here is a sample image of the page

Edit 1
In my view file I have code like this.

then using ajax method I add the content like this
$('#page_content').html(response);

So I noticed that actually the div element is only clicked when I click the button.
I used these function to test this
$(document).ready(function(){
    Insert_record();
    view_content();
    insert_reply(this);
})

function insert_reply(reply){
$("div").click(function() {
    console.log("USA");
    $("button").click(function() {
        //insert_reply(this);
        console.log("Argentina");
    });
});
}

When I click a button once then result was this.

When I click for the second time then console changed to this.

A: The jQuery function $.click() binds an event listener to the button, but it only does so after test_function() has already been called from the onclick attribute.
Your first button click attaches the listener. The second click actually triggers it.
You probably want to attach the event listener within $(document).ready instead, that way they will be attached to your buttons as soon as they are ready:
$( document ).ready(function() {
  // attach event listeners here
});

A: I couldn't understand this $("button").click(function() {, because you are calling  test_function() on click itself so why you need a check again? here you can understand the difference.
This need to be a simple function call on click right?

function test_function(reply){
        console.log("hello");
        var comment_id = reply.getAttribute("data-comment-id");
        if(comment_id){
            var inputbox_id = "new_reply" + comment_id;
            console.log(comment_id);
            document.getElementById(inputbox_id).value ='test value';
        }
}

reply

  <input type="text" id="new_reply1234"  class="form-control">
<button data-comment-id="1234" onclick="test_function(this);">Reply</button>

Sorry if this answer is irrelevant, but this is what I could understand from the information you have given.


text:
Q: PropertyChanged Event doesn't reflect new Image.Source on first run I'm working on mobile app that kinda simulates how to build a Desktop Computer by dragging and dropping an image in order. I work with DropGestureRecognizer with AllowDrop set to True for the Drop Zone Image controls and DragGestureRecognizer with CanDrag set to True for the Drag Image Objects.
The idea is the Drag Image Objects will get dragged and dropped to a Drop Zone Image Control and if they dropped the correct Drag Image, the Drop Zone will accept this as the Image.Source and another Drop Zone will be stacked in front of it to work with the next Desktop Computer component. Otherwise, it would get rejected and the Image.Source will be set to empty or null.
However, i'm encountering a weird issue that, on the first incorrect image dragged, the Image.Source gets reset to empty or null by property but on the actual UI, it doesn't. On the succeeding EventHandler execution, it does get reset. I have a TapGestureRecognizer on the Drop Zone to check if there is an Image.Source set or not.
I'm sorry if my explanation is a bit confusing because English is not my native language and i'm having a hard time explaining it. So please refer to below example in GIF and my code:
View (.xaml):
<ContentPage.Content>
    <Grid RowDefinitions="Auto,60,*"
          ColumnDefinitions="*">

        <RelativeLayout Grid.Row="0" Grid.Column="0" HorizontalOptions="Center">
            <Image x:Name="imgCaseDropZone"
                   RelativeLayout.XConstraint="0"
                   RelativeLayout.YConstraint="0"
                   HeightRequest="{Binding ScreenWidth}"
                   WidthRequest="{Binding ScreenWidth}"
                   PropertyChanged="CaseDropZone_PropertyChanged"
                   BackgroundColor="LightGray">
                <Image.GestureRecognizers>
                    <DropGestureRecognizer AllowDrop="True" />
                    <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" />
                </Image.GestureRecognizers>
            </Image>
        </RelativeLayout>

        <Label Grid.Row="1" Grid.Column="0"
               x:Name="lblDirections"
               Text="Directions: Drag the components below in its proper order to the drop zone above."
               TextColor="Black"
               Padding="10"
               VerticalOptions="CenterAndExpand"
               HorizontalOptions="CenterAndExpand" />

        <ScrollView Grid.Row="2"
                    Orientation="Horizontal"
                    Margin="5">
            <StackLayout Orientation="Horizontal">

                <!--#region Case -->
                <Grid RowDefinitions="*,Auto"
                      IsVisible="{Binding CaseIsVisible}">
                    <Image Grid.Row="0"
                           x:Name="imgCaseDragObject"
                           Source="{Binding CaseImgSource}">
                        <Image.GestureRecognizers>
                            <DragGestureRecognizer CanDrag="True" />
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.Row="1"
                           Text="{Binding CaseLabel}"
                           TextColor="White"
                           FontSize="Medium"
                           BackgroundColor="Gray"
                           HorizontalTextAlignment="Center" />
                </Grid>
                <!--#endregion-->

                <!--#region Case Cover -->
                <Grid RowDefinitions="*,Auto"
                      IsVisible="{Binding CaseCoverIsVisible}">
                    <Image Grid.Row="0"
                           Source="{Binding CaseCoverImgSource}">
                        <Image.GestureRecognizers>
                            <DragGestureRecognizer CanDrag="True" />
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.Row="1"
                           Text="{Binding CaseCoverLabel}"
                           TextColor="White"
                           FontSize="Medium"
                           BackgroundColor="Gray"
                           HorizontalTextAlignment="Center" />
                </Grid>
                <!--#endregion-->

                <!--#region Case Screw -->
                <Grid RowDefinitions="*,Auto"
                      IsVisible="{Binding CaseScrewIsVisible}">
                    <Image Grid.Row="0"
                           Source="{Binding CaseScrewImgSource}">
                        <Image.GestureRecognizers>
                            <DragGestureRecognizer CanDrag="True" />
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.Row="1"
                           Text="{Binding CaseScrewLabel}"
                           TextColor="White"
                           FontSize="Medium"
                           BackgroundColor="Gray"
                           HorizontalTextAlignment="Center" />
                </Grid>
                <!--#endregion-->

                <!--#region Hard Disk Drive -->
                <Grid RowDefinitions="*,Auto"
                      IsVisible="{Binding HardDiskDriveIsVisible}">
                    <Image Grid.Row="0"
                           Source="{Binding HardDiskDriveImgSource}">
                        <Image.GestureRecognizers>
                            <DragGestureRecognizer CanDrag="True" />
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.Row="1"
                           Text="{Binding HardDiskDriveLabel}"
                           TextColor="White"
                           FontSize="Medium"
                           BackgroundColor="Gray"
                           HorizontalTextAlignment="Center" />
                </Grid>
                <!--#endregion-->

                <!--#region Heatsink -->
                <Grid RowDefinitions="*,Auto"
                      IsVisible="{Binding HeatsinkIsVisible}">
                    <Image Grid.Row="0"
                           Source="{Binding HeatsinkImgSource}">
                        <Image.GestureRecognizers>
                            <DragGestureRecognizer CanDrag="True" />
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.Row="1"
                           Text="{Binding HeatsinkLabel}"
                           TextColor="White"
                           FontSize="Medium"
                           BackgroundColor="Gray"
                           HorizontalTextAlignment="Center" />
                </Grid>
                <!--#endregion-->

                <!--#region Memory Module -->
                <Grid RowDefinitions="*,Auto"
                      IsVisible="{Binding MemoryModuleIsVisible}">
                    <Image Grid.Row="0"
                           Source="{Binding MemoryModuleImgSource}">
                        <Image.GestureRecognizers>
                            <DragGestureRecognizer CanDrag="True" />
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.Row="1"
                           Text="{Binding MemoryModuleLabel}"
                           TextColor="White"
                           FontSize="Medium"
                           BackgroundColor="Gray"
                           HorizontalTextAlignment="Center" />
                </Grid>
                <!--#endregion-->

                <!--#region Motherboard -->
                <Grid RowDefinitions="*,Auto"
                      IsVisible="{Binding MotherboardIsVisible}">
                    <Image Grid.Row="0"
                           Source="{Binding MotherboardImgSource}">
                        <Image.GestureRecognizers>
                            <DragGestureRecognizer CanDrag="True" />
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.Row="1"
                           Text="{Binding MotherboardLabel}"
                           TextColor="White"
                           FontSize="Medium"
                           BackgroundColor="Gray"
                           HorizontalTextAlignment="Center" />
                </Grid>
                <!--#endregion-->

                <!--#region Motherboard Screw -->
                <Grid RowDefinitions="*,Auto"
                      IsVisible="{Binding MotherboardScrewIsVisible}">
                    <Image Grid.Row="0"
                           Source="{Binding MotherboardScrewImgSource}">
                        <Image.GestureRecognizers>
                            <DragGestureRecognizer CanDrag="True" />
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.Row="1"
                           Text="{Binding MotherboardScrewLabel}"
                           TextColor="White"
                           FontSize="Medium"
                           BackgroundColor="Gray"
                           HorizontalTextAlignment="Center" />
                </Grid>
                <!--#endregion-->

                <!--#region Power Supply -->
                <Grid RowDefinitions="*,Auto"
                      IsVisible="{Binding PowerSupplyIsVisible}">
                    <Image Grid.Row="0"
                           Source="{Binding PowerSupplyImgSource}">
                        <Image.GestureRecognizers>
                            <DragGestureRecognizer CanDrag="True" />
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.Row="1"
                           Text="{Binding PowerSupplyLabel}"
                           TextColor="White"
                           FontSize="Medium"
                           BackgroundColor="Gray"
                           HorizontalTextAlignment="Center" />
                </Grid>
                <!--#endregion-->

                <!--#region Processor -->
                <Grid RowDefinitions="*,Auto"
                      IsVisible="{Binding ProcessorIsVisible}">
                    <Image Grid.Row="0"
                           Source="{Binding ProcessorImgSource}">
                        <Image.GestureRecognizers>
                            <DragGestureRecognizer CanDrag="True" />
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.Row="1"
                           Text="{Binding ProcessorLabel}"
                           TextColor="White"
                           FontSize="Medium"
                           BackgroundColor="Gray"
                           HorizontalTextAlignment="Center" />
                </Grid>
                <!--#endregion-->

            </StackLayout>
        </ScrollView>
    </Grid>

</ContentPage.Content>

View Code (.xaml.cs):
 [XamlCompilation(XamlCompilationOptions.Compile)]
 public partial class AssemblyPage : ContentPage
 {
      string caseSource;

      public AssemblyPage()
      {
           InitializeComponent();
      }

      int dragCount = 0;
      private void CaseDropZone_PropertyChanged(object sender, PropertyChangedEventArgs e)
      {
           if (e.PropertyName == "Source")
           {
                caseSource = imgCaseDropZone.Source.ToString().Split(':').Last().Trim();

                if (string.IsNullOrEmpty(caseSource))
                {
                     return;
                }

                if (caseSource != "img_assembly_case.png")
                {
                     imgCaseDropZone.Source = string.Empty;

                     lblDirections.Text = $"Drag Count: {++dragCount}";
                }
           }
      }

      private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
      {
           Application.Current.MainPage.DisplayAlert("", $"{imgCaseDropZone.Source}", "OK");
      }
 }

ViewModel (.cs):
 public class AssemblyViewModel : BaseVM
 {
      public double ScreenWidth => Xamarin.Forms.Application.Current.MainPage.Width;

      #region Case
      bool caseIsVisible;
      public bool CaseIsVisible
      {
           get => caseIsVisible;
           set => SetProperty(ref caseIsVisible, value);
      }

      public string CaseImgSource { get; }
      public string CaseLabel { get; }
      #endregion

      #region CaseCover
      bool caseCoverIsVisible;
      public bool CaseCoverIsVisible
      {
           get => caseCoverIsVisible;
           set => SetProperty(ref caseCoverIsVisible, value);
      }

      public string CaseCoverImgSource { get; }
      public string CaseCoverLabel { get; }
      #endregion

      #region HardDiskDrive
      bool hardDiskDriveIsVisible;
      public bool HardDiskDriveIsVisible
      {
           get => hardDiskDriveIsVisible;
           set => SetProperty(ref hardDiskDriveIsVisible, value);
      }

      public string HardDiskDriveImgSource { get; }
      public string HardDiskDriveLabel { get; }
      #endregion

      #region CaseScrew
      bool caseScrewIsVisible;
      public bool CaseScrewIsVisible
      {
           get => caseScrewIsVisible;
           set => SetProperty(ref caseScrewIsVisible, value);
      }

      public string CaseScrewImgSource { get; }
      public string CaseScrewLabel { get; }
      #endregion

      #region Heatsink
      bool heatsinkIsVisible;
      public bool HeatsinkIsVisible
      {
           get => heatsinkIsVisible;
           set => SetProperty(ref heatsinkIsVisible, value);
      }

      public string HeatsinkImgSource { get; }
      public string HeatsinkLabel { get; }
      #endregion

      #region MemoryModule
      bool memoryModuleIsVisible;
      public bool MemoryModuleIsVisible
      {
           get => memoryModuleIsVisible;
           set => SetProperty(ref memoryModuleIsVisible, value);
      }

      public string MemoryModuleImgSource { get; }
      public string MemoryModuleLabel { get; }
      #endregion

      #region Motherboard
      bool motherboardIsVisible;
      public bool MotherboardIsVisible
      {
           get => motherboardIsVisible;
           set => SetProperty(ref motherboardIsVisible, value);
      }

      public string MotherboardImgSource { get; }
      public string MotherboardLabel { get; }
      #endregion

      #region MotherboardScrew
      bool motherboardScrewIsVisible;
      public bool MotherboardScrewIsVisible
      {
           get => motherboardScrewIsVisible;
           set => SetProperty(ref motherboardScrewIsVisible, value);
      }

      public string MotherboardScrewImgSource { get; }
      public string MotherboardScrewLabel { get; }
      #endregion

      #region PowerSupply
      bool powerSupplyIsVisible;
      public bool PowerSupplyIsVisible
      {
           get => powerSupplyIsVisible;
           set => SetProperty(ref powerSupplyIsVisible, value);
      }

      public string PowerSupplyImgSource { get; }
      public string PowerSupplyLabel { get; }
      #endregion

      #region Processor
      bool processorIsVisible;
      public bool ProcessorIsVisible
      {
           get => processorIsVisible;
           set => SetProperty(ref processorIsVisible, value);
      }

      public string ProcessorImgSource { get; }
      public string ProcessorLabel { get; }
      #endregion

      public AssemblyViewModel()
      {
           CaseIsVisible = true;
           CaseImgSource = "img_assembly_case.png";
           CaseLabel = "Case";

           CaseCoverIsVisible = true;
           CaseCoverImgSource = "img_assembly_case_cover.png";
           CaseCoverLabel = "Case Cover";

           CaseScrewIsVisible = true;
           CaseScrewImgSource = "img_assembly_case_screw.png";
           CaseScrewLabel = "Case Screw";

           HardDiskDriveIsVisible = true;
           HardDiskDriveImgSource = "img_assembly_hard_disk_drive.png";
           HardDiskDriveLabel = "Hard Disk Drive";

           HeatsinkIsVisible = true;
           HeatsinkImgSource = "img_assembly_heat_sink.png";
           HeatsinkLabel = "Heatsink";

           MemoryModuleIsVisible = true;
           MemoryModuleImgSource = "img_assembly_memory_module.png";
           MemoryModuleLabel = "Memory Module";

           MotherboardIsVisible = true;
           MotherboardImgSource = "img_assembly_motherboard.png";
           MotherboardLabel = "Motherboard";

           MotherboardScrewIsVisible = true;
           MotherboardScrewImgSource = "img_assembly_motherboard_screw.png";
           MotherboardScrewLabel = "Motherboard Screw";

           PowerSupplyIsVisible = true;
           PowerSupplyImgSource = "img_assembly_power_supply.png";
           PowerSupplyLabel = "Power Supply";

           ProcessorIsVisible = true;
           ProcessorImgSource = "img_assembly_processor.png";
           ProcessorLabel = "Processor";
      }
 }

Current Build demo in GIF: https://imgur.com/a/oLeM9DV (i can't directly link the GIF because its too big)

A: Because when you trigger the PropertyChanged event, the drag and drop action has already been completed and the image has been automatically set to the target.
We could make that judgment as soon as we drag it over the target with DragOver event.Then make an action when the drag and drop is complete with Drop event.
For example,change the codes of the Image (imgCaseDropZone):
 <Image x:Name="imgCaseDropZone"
        RelativeLayout.XConstraint="0"
        RelativeLayout.YConstraint="0"
        RelativeLayout.WidthConstraint="400"
        RelativeLayout.HeightConstraint="400"
        BackgroundColor="LightGray"
                       >
      <Image.GestureRecognizers>
            <DropGestureRecognizer AllowDrop="{Binding CaseIsVisible}"   DragOver="CaseDropZone_DragOver"  Drop="CaseDropZone_Drop"/>
            <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" />
       </Image.GestureRecognizers>
 </Image>

in the code behind:
 private void CaseDropZone_DragOver(object sender, DragEventArgs e)
    {
        FileImageSource file = (FileImageSource)e.Data.Image;
        string name = file.File;
        if (name != "img_assembly_case.png")
        {
            e.Data.Image = string.Empty; // set the value string.Empty when drag it over the target,then it will fill the empty source to the image.
        }

    }

 private async void CaseDropZone_Drop(object sender, DropEventArgs e)
    {
        var ctx = (BindingContext as AssemblyViewModel);
        FileImageSource source = (FileImageSource)await e.Data.GetImageAsync();
        string name = source.File;
        if (name == "img_assembly_case.png")
        {
            ctx.CaseIsVisible = false;

            imgMotherboardDropZone.IsVisible = true;
        }
        else
        {
            Global.Score.PCAssembly -= 5;

            DisplayAlert($"Score: {Global.Score.PCAssembly}", "The pre-requisite component for this part has not yet been placed.", "OK");
        }
    }

Other Images are modified like this.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Production build always put MUI CSS at the top Could someone give me some insights about this.
Overriding Material UI CSS works in development environment,
but then it swapped in production environment.

This one is wrong, Material UI css should be at the bottom

This one is right, I'm overriding Material UI css.


text:
Q: Saving Parse.com objects into Trigger.io prefs storage is stripping data from object? I'm using Parse.com as my backend for a Trigger.io based Android app. My problem is pretty basic, and I'm convinced it's just some fundamental understanding of javascript that I'm not grasping - I'm still learning a lot about the language.
When I query Parse for an array of objects, and log the response, I get everything I need: the attributes, the unique object id, createdAt, updatedAt, etc for each object. Here is an example of a single object from Parse:
Object from Parse:

    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   : [FORGE]
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   : [ { attributes:
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :      { first_name: 'John',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        last_name: 'Smith',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        email: 'john.smith@aol.com',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        phone: '5551112234',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        address: '',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        city: '',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        state: '',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        zip: '',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        race: '7',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        theDate: '10/02/2012',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        formName: 'DriverWaiver',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        imported: true },
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :     _operations: {},
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :     _dirty: {},
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :     _hashedJSON: {},
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :     _escapedAttributes: {},
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :     cid: 'c38',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :     id: 'beLlUqrUBl',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :     createdAt: '2012-10-02T17:51:38.267Z',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :     updatedAt: '2012-10-02T17:51:38.267Z',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :     _setting: false,
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :     _previousAttributes:
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :      { first_name: 'John',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        last_name: 'Smith',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        email: 'john.smith@aol.com',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        phone: '5551112234',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        address: '',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        city: '',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        state: '',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        zip: '',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        race: '7',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        theDate: '10/02/2012',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        formName: 'DriverWaiver',
    [INFO] 10-03 10:34:21.992 18060 18072 I Forge   :        imported: true } },

However after saving the result, with no variable manipulation, using Trigger.io's forge.prefs.set(), I'm only able to read the attributes. Here is the same object after reading using forge.prefs.get():
After saving with forge.prefs.set() and retrieving with forge.prefs.get():

    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   : [FORGE]
    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   : [ { first_name: 'John',
    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   :     last_name: 'Smith',
    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   :     email: 'john.smith@aol.com',
    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   :     phone: '5551112233',
    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   :     address: '',
    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   :     city: '',
    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   :     state: '',
    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   :     zip: '',
    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   :     race: '7',
    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   :     theDate: '10/02/2012',
    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   :     formName: 'DriverWaiver',
    [INFO] 10-03 11:05:44.594 19055 19068 I Forge   :     imported: true },

Simplified code to produce above results

    var FormData = Parse.Object.extend(formName);
    var query = new Parse.Query(FormData);
    var currentYear = new Date().getFullYear();

    query.endsWith("theDate", currentYear.toString());
    query.limit(1000);
    query.descending('imported');

    // get from parse
    query.find({
      success: function(results) {

        // got from Parse
        if (formName == "DriverWaiver") forgeLog(results);

        // save to local
        forge.prefs.set(formName, results, function(){

            // saved to local
            forgeLog("Saved to Local");

                // get from local
                forge.prefs.get(formName, function(results){

                    // got from local
                    forgeLog("Got from Local");
                    if (formName == "DriverWaiver") forgeLog(results);

                }, function(){

                    // error getting from local
                    forgeLog("Error getting from Local");

                });

        }, function (){
            // error saving to local
            forgeLog("Error saving to Local");
        });
      },
      error: function(error) {
          // error getting from parse
          forgeLog("Error getting data from Parse");

      }
    });

So I guess my question is: how am I able to save the entire object? I really need that unique id saved for my app to function correctly.
I sent full logging output to Trigger support, and they've concluded it's a Parse API issue and deferred me to them. I'm not convinced it's a Parse issue, but instead of bouncing around to support channels I'm hoping the community here could provide some insight. Thanks in advance!


text:
Q: Overlay NdOverlays while keeping color / changing marker I want a scatter plot of different types of "asset", each asset should have the same color and labeled in the legend. I can do this using an NdOverlay of Scatter. Then I want to overlay two such plots, eg one coming from a model and another from experiment, so that the first and second only change in marker but keeps the same color for each asset.
I would expect this to work
df1 = pd.DataFrame({"asset": ["A", "B", "B"], "x": [1,2,3], "y": [1,2,3]})
df2 = pd.DataFrame({"asset": ["A", "B", "B"], "x": [1.5,2.5,3.5], "y": [1,2,3]})
df1.hvplot.scatter(x="x", y="y", by="asset") * df2.hvplot.scatter(x="x", y="y", by="asset").opts({"Scatter": {"style": {"marker": "d"}}})

but the colors in df1.hvplot per asset are different to those of df2.hvplot. I would like the most concise way starting from df1 and df2.
Edit: Is there a simple solution where I do not have to think about the sorting of df1 and df2 or whether they have the exact same set of "assets". Eg, I need something that would also work with
df1 = pd.DataFrame({"asset": ["A", "B", "B"], "x": [1,2,3], "y": [1,2,3]})
df2 = pd.DataFrame({"asset": ["C", "B", "A"], "x": [1.5,2.5,3.5], "y": [1,2,3]})
l1=df1.hvplot.scatter(x="x", y="y", by="asset")
l2=df2.hvplot.scatter(x="x", y="y", by="asset").opts(hv.opts.Scatter(marker='d'))
ll=l1*l2

or
df1 = pd.DataFrame({"asset": ["A", "B", "B"], "x": [1,2,3], "y": [1,2,3]})
df2 = pd.DataFrame({"asset": ["A", "B", "B", "C"], "x": [1.5,2.5,3.5, 4], "y": [1,2,3, 1]})
l1=df1.hvplot.scatter(x="x", y="y", by="asset")
l2=df2.hvplot.scatter(x="x", y="y", by="asset").opts(hv.opts.Scatter(marker='d'))
ll=l1*l2

A: Edit: If you need more flexibility, there are two options:

*

*Styling a dimensioned container, and

*Styling by using additional value dimensions.

For more information, see here: jupyter notebook, github repo, but the code goes like this.
Option 1 (more verbose, but often easier if you are working in a HoloMap-like container anyway):
import holoviews as hv
from holoviews import opts, dim
hv.extension('bokeh')
import pandas as pd
import numpy as np

def cycle_kdim_opts(layout, kdim_opts):
    """
    For each given kdim of an Nd holoviews container, create an options dict
    that can be passed into a holoviews `opts` object.

    Parameters
    ----------
    layout : A holoviews Nd container (HoloMap, ...)
    kdim_opts : dict of the form {kdim: {style_option: [alternatives]}}
        For an example, see below.

    """
    # Output shown for:
    # kdim_opts = {
    #     'h': {'color': ['orange', 'cyan']},
    #     'g': {'size': [30, 10]},
    # }
    values = {kd.name: list(d) for kd, d in zip(layout.kdims, zip(*layout.data.keys()))}
    # print(values)
    # {'g': ['a', 'b', 'b'], 'h': ['d', 'c', 'd']}

    mapping = {}
    for kd, o in kdim_opts.items():
        unique_values = list(set(values[kd]))
        styles = list(o.values())[0]
        mapping[kd] = dict(zip(unique_values, styles))
    # print(mapping)
    # {'h': {'c': 'orange', 'd': 'cyan'}, 'g': {'b': 30, 'a': 10}}

    kdim2style = {k: list(v.keys())[0] for k, v in kdim_opts.items()}
    # print(kdim2style)
    # {'h': 'color', 'g': 'size'}

    mapped_styles = {kdim2style[kd]: hv.Cycle([mapping[kd][value] for value in values])
                     for kd, values in values.items()}
    # print(mapped_styles)
    # {'size': Cycle(['10', '30', '30']), 'color': Cycle(['cyan', 'orange', 'cyan'])}

    return mapped_styles

df1 = pd.DataFrame({'asset': ['A', 'B', 'B'], 'x': [1.,2.,3.], 'y': [1.,2.,3.]})
df2 = pd.DataFrame({'asset': ['A', 'B', 'B', 'C'], 'x': [1.5,2.5,3.5,4], 'y': [1.,2.,3.,1.]})
df = df1.assign(source='exp').merge(df2.assign(source='mod'), how='outer')

labels = hv.Labels(df.assign(l=df.asset+',\n'+df.source), ['x', 'y'], 'l')

l = hv.Dataset(df, ['x', 'y', 'asset', 'source',], []).to(hv.Points).overlay()

od = {
    'source': {'size': [30, 10]},
    'asset': {'color': ['orange', 'cyan', 'yellow']},
}

options = (
    opts.NdOverlay(legend_position='right', show_legend=True, width=500),
    opts.Points(padding=.5, show_title=False, title_format='',
                toolbar=None, **cycle_kdim_opts(l, od)),
)

l.opts(*options) * labels

Option 2: Way less verbose, but takes more effort to e.g. customize the legend later on.
df1 = pd.DataFrame({'asset': ['A', 'B', 'B'], 'x': [1.,2.,3.], 'y': [1.,2.,3.]})
df2 = pd.DataFrame({'asset': ['A', 'B', 'B', 'C'], 'x': [1.5,2.5,3.5,4], 'y': [1.,2.,3.,1.]})
df = df1.assign(source='exp').merge(df2.assign(source='mod'), how='outer')

labels = hv.Labels(df.assign(l=df.asset+',\n'+df.source), ['x', 'y'], 'l')

l = hv.Points(df, ['x', 'y'], ['asset', 'source',])

options = (
    opts.NdOverlay(legend_position='right', show_legend=True, width=500),
    opts.Points(padding=.5, show_title=False, show_legend=True,
                marker=dim('source').categorize({'exp':'circle', 'mod':'diamond'}),
                color=dim('asset').categorize({'A':'orange', 'B':'cyan', 'C':'yellow'}),
                size=10, toolbar=None)
)

l.opts(*options) * labels

Original suggestion (closest to your example):
You could e.g. explicitly set the colours using a hv.Cycle object:
df1 = pd.DataFrame({"asset": ["A", "B", "B"], "x": [1,2,3], "y": [1,2,3]})
df2 = pd.DataFrame({"asset": ["A", "B", "B"], "x": [1.5,2.5,3.5], "y": [1,2,3]})
l1=df1.hvplot.scatter(x="x", y="y", by="asset")
l2=df2.hvplot.scatter(x="x", y="y", by="asset").opts(hv.opts.Scatter(marker='d'))
ll=l1*l2
ll.opts(hv.opts.Scatter(padding=.1, color=hv.Cycle(['blue', 'orange'])))


text:
Q: Proton-Neutron Lattice as a form of matter? Would it be possible for a lattice of protons and neutrons (I'm picturing a plane of hexagons in my head) to exist bound by the strong nuclear force (not gravity)? I know that the strong force losses its power when an atomic nucleus gets to be too large, but in a lattice, it would only have to bond one proton to a few neutrons or one neutron to a few protons at a time. Would this work? If so, what would be the properties of such a material?

A: No, because the repulsive power of the protons accumulates toward infinity, blowing the structure apart. To accomplish what you have described you would need stable, negatively charged particles like antiprotons... which of course also fail in such an arrangement because they annihilate the protons!
The instability from accumulating positive charge is also why higher elements become unstable.
You can create crystalline structures that are composed mostly of neutrons with electron-neutralized protons sprinkled in, but only if you have very powerful compression to keep the neutrons stable and the whole arrangement bound together. That's the material in neutrons stars, sometimes called "neutronium" (yes, as in Star Trek), and it's very, very stiff. Breaks in the neutron crusts of such stars lead to abrupt changes in the otherwise incredibly precise timing of pulsar radio bursts.

A: A lone proton in between a crystal lattice could find itself with more negative charge then equilibrium from the neighbouring clouds of electrons.  Thus there is a compressive force driven by the lattice and heat, in addition to proton repulsion of the nuclear force.
I expect over time their will be a determination that the coulomb barrier may not be static under all conditions and because it is not yet understood it's difficult to replicate working Low Energy Nuclear reactions.  However the anomalous results show something is happening.  That can only mean that the understanding is incomplete based on observations to date.


text:
Q: Branch.io initSessionWithLaunchOptions round tripping In AppDelegate and [branch initSessionWithLaunchOptions ...] - will there be any round tripping to branch.io backend(https://xxx.app.link/xxxx) when just opening the app not from a link?
Thanks in advance(Alex)

A: (from the Branch.io team)
Great question. The initSessionWithLaunchOptions method will be called every time your app launches, whether or not the open happened as a result of the user clicking a Branch link.
Hope that helps!


text:
Q: Get responsive html blocks with css I need display 3 simple text html blocks in 3 columns such as the image, but I need a responsive behaviour

I need the behaviour will be responsive, running like this one...
Anybody could teach me the css code for this responsive behaviour?

Thank you in advanced!

CARTELERA

PELICULA1
Nombre1
Dirextor1
España

      PELICULA2
Nombre2
Dirextor2
España

A: Generally you should post code here and we give you help with it. This site isn't a teaching resource.
That said, I will give you a point in the right direction. You could use Bootstrap for this as it's a pre-built responsive framework.
If you want to have a go at doing it yourself, look at this code for a starting point.

Item 1

Item 2

Item 3

Item 4

Item 5

Item 6

and the Css:
#container {
width: 100%;
}

.section {
    float: left;
    width: 120px;
    margin: 0 10px 10px 0;
    list-style: none;
}

And here's a fiddle


text:
Q: split multiple active class every 5 second and loop How to split all code working together at the same time, with unlimited different classes and loop in animated class. Code is like this but i want to make it run at the same time, and put it with unlimited of animated class.

$(function() {
    var lis = $(".animated > .boxed"),
        currentHighlight = 0;

        N = 5;//interval in seconds
    setInterval(function() {
        currentHighlight = (currentHighlight + 1) % lis.length;
        lis.removeClass('highlighted').eq(currentHighlight).addClass('highlighted');
    },  1000);
});
.boxed {
  background-color: red;
  padding:5px;
}

.highlighted {
    background-color:blue;
}

    1
    2
    3

    1
    2

    3

A: There are number of ways for doing this but basically you need to handle each of the "animated"-containers separately. Now you are looping through all the "boxed"-elements on the page which is not what you want if I understood you correctly. Loop the "boxed"-elements inside each "animated"-container:

$(function() {
  const highlightClass = "highlighted";

  $(".animated").each(function() {
    var $container = $(this);
    var $lis = $container.find(".boxed");

    setInterval(function() {
      var $highlighted = $container.find("." + highlightClass);

      $highlighted.removeClass(highlightClass);

      if ($highlighted.length == 0 || $highlighted.next().length == 0) {
        $container.find(".boxed").first().addClass(highlightClass);
      } else {
        $highlighted.next().addClass(highlightClass);
      }
    }, 1000);
  });

});
.boxed {
  background-color: red;
  padding: 5px;
}

.highlighted {
  background-color: blue;
}

    1
  2
  3

    1
  2

  3

    1
  2

  3


text:
Q: External Links in Angular App I'm in the process of incorporating Angular into a single page of an existing rails app.
Everything is working perfectly with the routing within the page using the following
app.config(function($routeProvider, $locationProvider) {
    $routeProvider
      .when('/services/:id', {
        templateUrl: "/javascripts/angular/templates/service_ui/service.html",
        controller: "ServiceCtrl"
     })

     $locationProvider.html5Mode(true);
});

However, I'd like to maintain normal functionality for links that are not related to Angular. For example, we have a number of links in the header that link elsewhere that are now being caught by the angular router.
I've found some potential solutions at: https://groups.google.com/forum/?fromgroups#!topic/angular/basidvjscRk
But the base path method doesnt seem to work..and the target="_self" method is rather obtrusive. Is there a better way to let angular ignore routes that aren't specified in the config function?
I know there is an .otherwise() method but again this seems like a hack. Am I missing something?
Thanks so much!

A: We have a relatively "traditional" web application in that most of the links trigger full page reloads; very few links go through Angular's routing system. Right after our module definition, we have the following:
app.run(function($location, $rootElement) {
  $rootElement.off('click');
});

This stops the built-in interception of clicks that Angular uses to manipulate the URL and such when you click on a link; the catch is that you now have to use $location manually whenever you want Angular to do its URL magic (e.g. via an ngClick and a function that manipulates $location accordingly).
You may consider using $rootElement.off combined with a special directive or configuration function that re-installs this behavior on links that you detect contain a certain URL fragment.

A: Another option that may work for you is to change the $rootElement: the link interception only occurs within the element that is declared as the ng-app.
In my case, I switched from <body ng-app="myApp"> to <section id="my-rich-area" ng-app="myApp">.
This worked for me as I didn't have any same-domain, non-angular links within that section, ymmv.


text:
Q: How to know which version of cocoapods suits my xcode Sorry to bother with basic question.
would like to know which version of any cocoapods, suits particular xcode version. If  I know the exact podfile version for my xcode directly can be used without any interruption

A: I would suggest to save everybody and yourself a lot of trouble and use a fairly recent verion of both xcode and cocoapods.


text:
Q: Pdf of the minimum of two normal variables. Let $X$, $Y$ be two normal, independent variables with zero mean. What is the distribution of $\min(X,Y)$?

A: $P(\mathrm{min}(X,Y)\leq x) = 1-P(\mathrm{min}(X,Y) > x) = 1-P(X>x\cap Y>x)=1-P(X>x)P(Y>x)=1-(1-F_X(x))(1-F_Y(x))$
where the $F_X(x)$ is the cumulative of $X$, and the same for $Y$. If they have the same variance the last two factors will be the same, simplifying the expression.
You can fill in with the correct expressions for the cumulatives and maybe you can recognize it as a familiar distribution but i doubt it.


text:
Q: How to cast my Linq query to the expected Web API return type My .Net Core Web API call is not returning values to the browser, but hanging the browser.
I have these models:
public class Status
    {
    public long StatusId { get; set; }
    public long UserId { get; set; }
    public string Body { get; set; }
    public virtual User User { get; set; }
    }

public class User
    {
    public long UserId { get; set; }
    public string Name { get; set; }
    public string Email { get; set; }
    public virtual ICollection<Status> Statuses { get; set; }
    }

My Status controller's Get functions look like this:
[HttpGet]
public IEnumerable<Status> GetAll()
    {
    var rv =  _context.Statuses.ToList();
    return rv;
    }

When I GET the API endpoint, I get the first record, then the browser hangs (keeps loading) and the rest of the data never comes through.
Stepping into my code, I see that rv is getting populated with all of the records, but we have the problem of the User having Statuses and then the Statuses have a User and so on - circular reference.
Ok, so let's try this in the controller so we don't get the Statuses from User:
var rv = _context.Statuses.Select(s => new
    {
    StatusId = s.StatusId,
    UserId = s.UserId,
    Body = s.Body,
    User = from u in _context.Users
           select new
               {
               UserId = u.UserId,
               Name = u.Name,
               Email = u.Email,
               }
    }

    ).ToList();

return rv;

Problem is rv is an anonymous type and I can't figure out how to successfully type it to the IEnumerable<Status> return type, even though it is the same as the model (excepting the missing Statuses in the User). Or do I change the return type and what to?

A: You could use dynamic as return type or you can create a custom class to save the projection of the query you need:
[HttpGet]
public dynamic GetAll()
{
  var rv = _context.Statuses.Select(s => new
  {
   StatusId = s.StatusId,
   UserId = s.UserId,
   Body = s.Body,
   User = from u in _context.Users
          select new
           {
           UserId = u.UserId,
           Name = u.Name,
           Email = u.Email,
           }
   }).ToList();

   return rv;
}

Also you can return a HttpResponseMessage :
public HttpResponseMessage Get()
{
  var rv = _context.Statuses.Select(s => new
  {
   StatusId = s.StatusId,
   UserId = s.UserId,
   Body = s.Body,
   User = from u in _context.Users
          select new
           {
           UserId = u.UserId,
           Name = u.Name,
           Email = u.Email,
           }
   }).ToList();

    return Request.CreateResponse(HttpStatusCode.OK, rv);
}

A: I'd recommend you to use separate ViewModel/DTO class to send data from API controller. Example:
public class StatusModel
    {
    public long StatusId { get; set; }
    public long UserId { get; set; }
    public string Body { get; set; }
    public virtual User User { get; set; }
    }

public class UserModel
    {
    public long UserId { get; set; }
    public string Name { get; set; }
    public string Email { get; set; }
    }

public HttpResponseMessage Get()
{
  var result = _context.Statuses.Include(e => e.User).Select(e => new StatusModel
    {
    StatusId = e.StatusId,
    UserId = e.UserId,
    Body = e.Body,
    User = new UserModel
            {
                UserId = e.User.UserId,
                Name = e.User.Name,
                Email = e.User.Email,
            }
    }).ToArray();

    return Request.CreateResponse(HttpStatusCode.OK, result);
}


text:
Q: A question on open mappings Let $X$ be a metric space. $f: X \to Y=f(X)$ is open and continuous mapping.
Must $Y$ be a metric space? Thanks for your help.

A: No. Let $X = \mathbb{R}$ and let $Y = \{a, b\}$ have the topology $\{\emptyset, \{a\}, \{a, b\}\}$.  Define the map $f: \mathbb{R} \to Y$ by $f(0) = b$ and $f(x) = a$ for all $x \in \mathbb{R} \setminus \{0\}$.  Then, $f$ is open, continuous, and onto, but $Y$ is not metrizable.


text:
Q: How to deploy SQL schema changes to Always On Availability group via Azure pipeline? We have the following setup - 2 SQL servers(01 & 02) configured as AlwaysOn with a listener node/alias (LT) pointing to which server is currently primary(01/02).
What would be the best way to configure an Azure DevOps pipeline to deploy changes to the SQL servers. Along with deploying the changes the release pipeline also needs to include steps for restoring a new DB backup from another server.
My thought is to configure everything on listener(LT) this includes running the power shell script to create the AzDo client as well. But what will happen once the servers(Primary & Secondary) are switched?


text:
Q: Illegal instruction - haskell I am building using the regular cabal build on my local machine, and the binary works fine. But when I copy the binary to another server for tests (same architecture : x86_64 and same glic and so on, as afar as I can tell) I get illegal instruction when I try to run it.
Is there some flag I should pass to cabal to make it compile a more generic binary maybe ?
Thanks

A: Unlike with GCC, the GHC compiler has only a handful of options to tune instruction sets, and they're all off by default.  The complete list is:
-msse -msse2 -msse3 -msse4 -msse4.2 -mbmi -mbmi2 -mavx -mavx2
-mavx512cd -mavx512er -mavx512f -mavx512pf

but there's no corresponding -mno-sse or similar options to turn them off because, like I say, they're off by default.  (Well, actually, on the x86_64 architecture, the -msse and -msse2 flags are technically forced on and can't be disabled.)
So, the problem is probably something else, most likely an incompatible or corrupt library.  It might be helpful to run under gdb to get a backtrace and see if you can spot a suspicious library or other obvious cause.


text:
Q: sencha touch sort list by Distance i want to sort a list of Locations by its Distance(displayed in list).
i already have a code that sould work but since i am that new to the whole mvc thing, i am not really sure where to place it to make it work.
Maybe someone can help me:
 var geocoder = new google.maps.Geocoder();
 var geo = Ext.create('Ext.util.Geolocation',{
autoUpdate: false,
listeners: {
    locationupdate:{
        scope: this,
        fn: function(geo){
            var haversindeDistance = function(lat1,lon1,lat2,lon2){
                if(typeof(Number.prototype.toRad)=="undefined"){
                        Number.prototype.toRad = function(){
                            return this * Math.PI/180;
                        }
                }
                var R = 6371; //km
                var dLat = (lat2-lat1).toRad();
                var dLon = (lon2-lon1).toRad();
                var lat1 = lat1.toRad();
                var lat2 = lat2.toRad();

                var a = Math.sin(dLat/2)*Math.sin(dLat/2)+
                        Math.sin(dLong/2)*Math.sin(dLon/2)*Math.cos(lat1)*Math.cos(lat2);
                var c = 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));
                var d = R*c;
                // KM or MIles
                //return d*0.621371192; //MIles
                return d;
            };
        var store = Ext.getStore('locationsstore');
        store.suspendEvents(true);
        store.each(function(location){
            var lat2 = parseFloat(location.get(geocoder.geocode( { 'address': sAddress}, function(results, status) { })))||0;
            var lon2 = parseFloat(location.get(geocoder.geocode( { 'address': sAddress}, function(results, status) { })))||0;
            //var lat2 = parseFloat(location.get('lat'))||0;//try to put geocode on this ish
            //var lon2 = parseFloat(location.get('lon'))||0;
            if(lat2 && lon2){
                var distance = haversineDistance(geo.getLatitude(),geo.getLongitude(),lat2,lon2);
                location.set('distance',distance);
            }
        }, this);
        store.resumeEvents();
        store.filter('distance',/\d/);
        store.sort('distance');//check if it is not done or can not be done somewhere else
        list.setMasked(false);
    }
},
    locationerror:{
        scope: this,
        fn:function(geo,bTimeout,bPermissionDenied,bLocationUnavailable,message){
        console.log([geo,bTimeout,bPermissionDenied,bLocationUnavailable,message]);
        if(bTimeout){
            Ext.Msg.alert('Timed out getting your location.');
        }else{
            Ext.Msg.alert('Error getting location. Please make sure location services are enabled on your Device.');
        }
        list.setMask(false);
        }
    }
    }
 });
 geo.updateLocation();

A: i found the Solution.Just adding a Listener to the Navigation/List View should do it. I had too much in the Controller so i decided to put it directly into the View.


text:
Q: Herokuapp giving bad request on POST request, but works fine on the index page of a simple FLASK app I wrote a simple FLASK app to get started with some actual backend and frontend integration.
This is my FLASK app
import random
from re import L
import numpy as np
from flask_restful import Api, Resource, reqparse
from flask import request, jsonify, Flask, make_response, render_template

alpha_dic = {
    'a' : 0,
    'b' : 1,
    'c' : 2,
    'd' : 3,
    'e' : 4,
    'f' : 5,
    'g' : 6,
    'h' : 7,
    'i' : 8,
    'j' : 9,
    'k' : 10,
    'l' : 11,
    'm' : 12,
    'n' : 13,
    'o' : 14,
    'p' : 15,
    'q' : 16,
    'r' : 17,
    's' : 18,
    't' : 19,
    'u' : 20,
    'v' : 21,
    'w' : 22,
    'x' : 23,
    'y' : 24,
    'z' : 25,
}

def reverse_dic(mydict, val):
    return list(mydict.keys())[list(mydict.values()).index(val)]

def eq_len(fi_ph, sec_ph):
    i=0
    res = ''
    while len(res) < len(fi_ph):
        if i<len(sec_ph):
            res += sec_ph[i]
            i += 1
        else:
            i = 0
    return res

def gen_pas(fi_ph, sec_ph):
    pin = ""
    sec_ph = eq_len(fi_ph, sec_ph)
    for i in range(len(fi_ph)):
        res = (alpha_dic[fi_ph[i]] + alpha_dic[sec_ph[i]])%26
        choice = np.random.random_sample(2)
        if choice[0] > 0.3:
            if choice[1] > 0.5:
                pin += reverse_dic(alpha_dic, res).upper()
            else:
                pin += reverse_dic(alpha_dic, res).lower()
        else:
            pin += str(res)
    return pin

app = Flask(__name__)
api = Api(app)

class Hello(Resource):
    def get(self):
        headers = {'Content-Type': 'text/html'}
        return make_response(render_template('index.html'),200,headers)

api.add_resource(Hello, '/')

class GenPass(Resource):
    def get(self):
        parser = reqparse.RequestParser()
        parser.add_argument('phrase', required=True)
        parser.add_argument('key', required=True)
        args = parser.parse_args()
        args['phrase'] =  args['phrase'].lower()
        args['key'] =  args['key'].lower()
        pas = gen_pas(args['phrase'], args['key'])
        dic = {
            'pass' : pas,
            'return' : 200
        }
        return dic

api.add_resource(GenPass, '/genpass')

I hosted this, with the following Procfile
web: gunicorn wsgi:app

The problem that is happening is, when I request the main index page, the correct HTML page comes as the response, but when I request something with POST using the genpass url such as
https://passgenabhi.herokuapp.com/genpass?phrase=lookfortheworst&key=robot

It returns a bad request, I really can't figure out what's wrong even with the Heroku Logs, so any help will be appreciated.
Heroku Logs
2022-08-09T11:19:45.551609+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2022-08-09T11:19:45.600540+00:00 app[web.1]: [2022-08-09 11:19:45 +0000] [4] [INFO] Handling signal: term
2022-08-09T11:19:45.600546+00:00 app[web.1]: [2022-08-09 11:19:45 +0000] [9] [INFO] Worker exiting (pid: 9)
2022-08-09T11:19:45.601698+00:00 app[web.1]: [2022-08-09 11:19:45 +0000] [17] [INFO] Worker exiting (pid: 17)
2022-08-09T11:19:45.701140+00:00 app[web.1]: [2022-08-09 11:19:45 +0000] [4] [INFO] Shutting down: Master
2022-08-09T11:19:45.861295+00:00 heroku[web.1]: Process exited with status 0
2022-08-09T19:15:54.956445+00:00 heroku[web.1]: Unidling
2022-08-09T19:15:54.969954+00:00 heroku[web.1]: State changed from down to starting
2022-08-09T19:16:00.016800+00:00 heroku[web.1]: Starting process with command `gunicorn wsgi:app`
2022-08-09T19:16:01.289385+00:00 app[web.1]: [2022-08-09 19:16:01 +0000] [4] [INFO] Starting gunicorn 20.0.4
2022-08-09T19:16:01.289739+00:00 app[web.1]: [2022-08-09 19:16:01 +0000] [4] [INFO] Listening at: http://0.0.0.0:46900 (4)
2022-08-09T19:16:01.289784+00:00 app[web.1]: [2022-08-09 19:16:01 +0000] [4] [INFO] Using worker: sync
2022-08-09T19:16:01.292799+00:00 app[web.1]: [2022-08-09 19:16:01 +0000] [9] [INFO] Booting worker with pid: 9
2022-08-09T19:16:01.331116+00:00 app[web.1]: [2022-08-09 19:16:01 +0000] [17] [INFO] Booting worker with pid: 17
2022-08-09T19:16:01.774348+00:00 heroku[web.1]: State changed from starting to up
2022-08-09T19:16:03.030916+00:00 app[web.1]: 10.1.84.173 - - [09/Aug/2022:19:16:03 +0000] "GET / HTTP/1.1" 200 327 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
2022-08-09T19:16:03.032533+00:00 heroku[router]: at=info method=GET path="/" host=passgenabhi.herokuapp.com request_id=ffdb5b1a-8372-40f9-83ab-677c348bb7aa fwd="14.143.35.158" dyno=web.1 connect=0ms service=4ms status=200 bytes=473 protocol=https
2022-08-09T19:16:03.579729+00:00 app[web.1]: 10.1.84.173 - - [09/Aug/2022:19:16:03 +0000] "GET /favicon.ico HTTP/1.1" 404 207 "https://passgenabhi.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
2022-08-09T19:16:03.581464+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=passgenabhi.herokuapp.com request_id=13ab6a1c-8666-4a02-af74-6ced84c1975c fwd="14.143.35.158" dyno=web.1 connect=0ms service=1ms status=404 bytes=375 protocol=https
2022-08-09T19:17:02.128579+00:00 heroku[router]: at=info method=POST path="/genpass?phrase=lookfortheworst&key=robot" host=passgenabhi.herokuapp.com request_id=052a1dc6-3845-4d5b-b99b-154cc1af3daf fwd="1.6.180.189" dyno=web.1 connect=0ms service=2ms status=400 bytes=253 protocol=https
2022-08-09T19:17:02.129307+00:00 app[web.1]: 10.1.43.27 - - [09/Aug/2022:19:17:02 +0000] "POST /genpass?phrase=lookfortheworst&key=robot HTTP/1.1" 400 92 "-" "PostmanRuntime/7.29.2"
2022-08-09T19:27:02.520975+00:00 heroku[router]: at=info method=POST path="/genpass?phrase=lookfortheworst&key=robot" host=passgenabhi.herokuapp.com request_id=0a0369ec-23f2-4737-ba25-82a1cb3f36f4 fwd="14.143.35.158" dyno=web.1 connect=0ms service=3ms status=400 bytes=253 protocol=https
2022-08-09T19:27:02.522623+00:00 app[web.1]: 10.1.45.2 - - [09/Aug/2022:19:27:02 +0000] "POST /genpass?phrase=lookfortheworst&key=robot HTTP/1.1" 400 92 "-" "PostmanRuntime/7.29.2"
2022-08-09T19:27:06.193030+00:00 heroku[router]: at=info method=GET path="/genpass?phrase=lookfortheworst&key=robot" host=passgenabhi.herokuapp.com request_id=0dcd1eb9-082a-4744-a898-3164a5c76c2d fwd="14.143.35.158" dyno=web.1 connect=0ms service=1ms status=405 bytes=254 protocol=https
2022-08-09T19:27:06.194615+00:00 app[web.1]: 10.1.45.2 - - [09/Aug/2022:19:27:06 +0000] "GET /genpass?phrase=lookfortheworst&key=robot HTTP/1.1" 405 64 "-" "PostmanRuntime/7.29.2"
2022-08-09T19:27:15.971695+00:00 heroku[router]: at=info method=POST path="/genpass?phrase=lookfortheworst&key=robot" host=passgenabhi.herokuapp.com request_id=41e83e69-b54b-4d71-bf54-6cf4d2652db8 fwd="14.143.35.158" dyno=web.1 connect=0ms service=1ms status=400 bytes=253 protocol=https
2022-08-09T19:27:15.973315+00:00 app[web.1]: 10.1.45.2 - - [09/Aug/2022:19:27:15 +0000] "POST /genpass?phrase=lookfortheworst&key=robot HTTP/1.1" 400 92 "-" "PostmanRuntime/7.29.2"
2022-08-09T19:35:47.000000+00:00 app[api]: Build started by user abhiraj.official15@gmail.com
2022-08-09T19:36:14.771849+00:00 app[api]: Release v19 created by user abhiraj.official15@gmail.com
2022-08-09T19:36:14.771849+00:00 app[api]: Deploy 1f50ff0a by user abhiraj.official15@gmail.com
2022-08-09T19:36:15.043014+00:00 heroku[web.1]: Restarting
2022-08-09T19:36:15.066650+00:00 heroku[web.1]: State changed from up to starting
2022-08-09T19:36:15.833441+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2022-08-09T19:36:15.873840+00:00 app[web.1]: [2022-08-09 19:36:15 +0000] [4] [INFO] Handling signal: term
2022-08-09T19:36:15.874214+00:00 app[web.1]: [2022-08-09 19:36:15 +0000] [17] [INFO] Worker exiting (pid: 17)
2022-08-09T19:36:15.874215+00:00 app[web.1]: [2022-08-09 19:36:15 +0000] [9] [INFO] Worker exiting (pid: 9)
2022-08-09T19:36:15.974443+00:00 app[web.1]: [2022-08-09 19:36:15 +0000] [4] [INFO] Shutting down: Master
2022-08-09T19:36:16.140433+00:00 heroku[web.1]: Process exited with status 0
2022-08-09T19:36:20.291434+00:00 heroku[web.1]: Starting process with command `gunicorn wsgi:app`
2022-08-09T19:36:21.429334+00:00 app[web.1]: [2022-08-09 19:36:21 +0000] [4] [INFO] Starting gunicorn 20.0.4
2022-08-09T19:36:21.429798+00:00 app[web.1]: [2022-08-09 19:36:21 +0000] [4] [INFO] Listening at: http://0.0.0.0:28907 (4)
2022-08-09T19:36:21.429829+00:00 app[web.1]: [2022-08-09 19:36:21 +0000] [4] [INFO] Using worker: sync
2022-08-09T19:36:21.432871+00:00 app[web.1]: [2022-08-09 19:36:21 +0000] [9] [INFO] Booting worker with pid: 9
2022-08-09T19:36:21.473488+00:00 app[web.1]: [2022-08-09 19:36:21 +0000] [17] [INFO] Booting worker with pid: 17
2022-08-09T19:36:22.018018+00:00 heroku[web.1]: State changed from starting to up
2022-08-09T19:36:26.000000+00:00 app[api]: Build succeeded
2022-08-09T19:36:45.045826+00:00 heroku[router]: at=info method=POST path="/genpass?phrase=lookfortheworst&key=robot" host=passgenabhi.herokuapp.com request_id=e527987b-25ae-49ab-ae3f-64c301c566ef fwd="14.143.35.158" dyno=web.1 connect=0ms service=2ms status=400 bytes=253 protocol=https
2022-08-09T19:36:45.054616+00:00 app[web.1]: 10.1.91.190 - - [09/Aug/2022:19:36:45 +0000] "POST /genpass?phrase=lookfortheworst&key=robot HTTP/1.1" 400 92 "-" "PostmanRuntime/7.29.2"
2022-08-09T19:36:56.100015+00:00 heroku[router]: at=info method=POST path="/genpass" host=passgenabhi.herokuapp.com request_id=d66fc93e-27db-47e6-8f7b-3456117e7edc fwd="14.143.35.158" dyno=web.1 connect=0ms service=2ms status=400 bytes=253 protocol=https
2022-08-09T19:36:56.108807+00:00 app[web.1]: 10.1.91.190 - - [09/Aug/2022:19:36:56 +0000] "POST /genpass HTTP/1.1" 400 92 "-" "PostmanRuntime/7.29.2"

Thanks!!


text:
Q: What is the meaning of the output MonoJust for tests result in Spock I have written some tests that in spock that give me results I can't make sense of. When I try to assert in the then: block the test fails with the output of MonoJust. I have no idea what that means. Can someone please explain why this is happening? When I print result, I just get the output MonoJust as well.
Here is the code:

    def "should retrieve product by its  productId "() {
        given:

        def product = builder.createProduct()
        1 * producteService.findProduct(product.group, PRODUCT_ID) >> Mono.just(product)

        when:
        def result = controller.getBranch(product.group, PRODUCT_ID)

        then:
               StepVerifier.create(result)
                .expectNext(product-> {
                   assertThat(product.getProductId()).isEqualTo(PRODUCT_ID)
                }
                .expectComplete().verify()

    }

Unfortunately, I get this error which makes no sense to me:

    Condition failed with Exception:

StepVerifier.create(result) .expectNext(product -> { assertThat(product.getProductId()).isEqualTo(PRODUCT_ID) }) .expectComplete().verify()
|            |      |        |                                                                                |                |
|            |      MonoJust |                                                                                |                java.lang.AssertionError: expectation "expectNext

A: That is a red-herring and part of Spock's implicit assertions, which doesn't mesh well with fluent assertion utils.
You can get less confusing readouts by splitting it like this:
    def "should retrieve product by its  productId "() {
        given:
        def product = builder.createProduct()

        when:
        def result = controller.getBranch(product.group, PRODUCT_ID)

        then:
        1 * producteService.findProduct(product.group, PRODUCT_ID) >> Mono.just(product)

        and:
        def verifier = StepVerifier.create(result)
                .expectNext(product-> {
                   assertThat(product.getProductId()).isEqualTo(PRODUCT_ID)
                }
                .expectComplete()
        verifier.verify()

    }

Also note that mock assertions belong in the then block.
The actual error was:
java.lang.AssertionError: expectation "expectNext, i.e., you didn't get a result.


text:
Q: Is it possible for a charged particle to have no spin? Can a charged point particle ever have spin zero?  If not why?

A: Yes, there are charged spin zero particles namely the charged pions. However, they are not point particles but rather have a radius comparable to that of a proton. None of the mesons and hadrons are. Only the leptons, the photon, the hypothetical gravitons are point particles. I am not sure of the status of the Higgs boson.


text:
Q: SQLMAP missing one or more core extensions ('gzip', 'ssl', 'sqlite3', 'zlib') How to solve the following problem?
[16:49:39] [CRITICAL] missing one or more core extensions ('gzip', 'ssl', 'sqlite3', 'zlib') most likely because current version of Python has been built without appropriate dev packages

A: I had the same problem, basically you need to install the dev packages of those extensions and then reinstall Python.
In my case I was missing the bz2 and I installed it using this command:
sudo apt-get install libbz2-dev

Then I reinstalled python3 using:
pyenv install 3.8.0

And that solved the problem. In your case you'll need to install all those packages (and their dev counterparts) and reinstall Python.


text:
Q: CSS Scope and Multiple Classes I've ran into an issue where the parent scope is having an argument with its children.
What I was trying to accomplish is by setting the default color scheme for my page in the top level div (or body tag in my case). And have the ability to change the colors deeper down the DOM.
However when I use the following the inner DIV's are purple, and not red (see fiddle for demo).
Now if I swap the classes around in the file it works (the order in which they reside in the file), however this is not a solution in my case as its also possible for a 'red page' with purple panels and the same problem would arise.
Fiddle: http://jsfiddle.net/16t7g9cm/4/
HTML:

 .red.panel

 .red .panel

 .panel

CSS:
.red .panel,
.panel.red {
    background-color: #cc3300;
    color: #ffffff;
}

.purple .panel,
.panel.purple {
    background-color: #990099;
    color: #ffffff;
}

Can anyone explain/ point me to what causes this behavior and any possible solutions.
Regards.

A: They have the same specificity however purple comes after red in the CSS and therefore is overriding it.
You can simply switch them around to solve the issue.
http://jsfiddle.net/16t7g9cm/7/
.purple .panel,
.panel.purple {
    background-color: #990099;
    color: #ffffff;
}

.red .panel,
.panel.red {
    background-color: #cc3300;
    color: #ffffff;
}

However if you can't reorder the classes you could make the red selectors would specific:
.purple .red .panel,
.purple .panel.red {
    background-color: #cc3300;
    color: #ffffff;
}

A: This is a specificity issue the closer you are to the DOM the more specific you are so if you just replace the position of your css statements:
.purple .panel,
.panel.purple {
    background-color: #990099;
    color: #ffffff;
}

.red .panel,
.panel.red {
    background-color: #cc3300;
    color: #ffffff;
}

it would work :)
http://jsfiddle.net/16t7g9cm/6/

Another way if ordering is a bit hard is to make it more specific (its hacky but works):
.red.red .panel,
.panel.red.red {
    background-color: #cc3300;
    color: #ffffff;
}

.purple .panel,
.panel.purple {
    background-color: #990099;
    color: #ffffff;
}

as you see instead of .red I have .red.red which is the same thing but give you more specificity
http://jsfiddle.net/16t7g9cm/8/

A: Add the following code and you code will work fine

.red .panel,
.panel.red {
    background-color: #cc3300 !important;
    color: #ffffff !important;
}

your parent styles are applied to the child element, hence current specified code will override the existing parent theme when conditions are met.


text:
Q: MySQL utf8_bin collation equivalent for Azure SQL database I am trying to migrate a MySql application to Azure.
The pricing for Azure's MySql database seems to be quite higher than the "SQL Databases" option so i decided to go for that "SQL database" option.
The last step for the resource set-up is to choose a collation.
In MySQL i use utf8_bin but that collation seems not to be valid for "SQL Database".
Is there an equivalent collation?
I need to store UTF characters, case sensitive and accent sensitive comparison and i almost never sort strings.
I did some research on the internet, but couldn't find any information about Azure's collations
Edit:
After additional researches i've come across 'Latin1_General_BIN2' that should do the job. I'm not sure that 'Latin' can handle all utf8 characters (eg. ʖ, ޖ, etc) - and i did not yet fully grasped the difference between BIN and BIN2 collations

A: that collation is not UTF8 capable. Up to this moment, existing collations in SQL Server and Azure SQL DB are non-Unicode, with Unicode being enabled (UTF-16) with the NCHAR and NVARCHAR (and SQLVARIANT) data types.
That being said, we are now running a private preview of UTF8 support in SQL Server and Azure SQL DB, so I'd like to further discuss with you.
Will you be at Ignite? If so please look for me in the SQL Server booth. If not, can you please send me an email to utf8team@microsoft.com?
Thank you!


text:
Q: HTTP header Get response with no content-length gives 502 bad gateway To create a comet connection (hanging get) i am not specifying the content-length in HTTP Header. This works on my system but will requested from another machine of institute LAN, it gives 502 Bad Gateway for the request.
If i mention content-length, i get the response but the connection gets closed, which i dont want. What can be the alternatives to this?

A: Follow the HTTP/1.1 specification for connection persistence. Return HTTP/1.1 in the reply. If the query was HTTP/1.1, default to keeping the connection open. If the query wasn't, default to closing it. If you get a Connection: close header, close the connection after sending the response. If you get a Connection: keep-alive header, keep the connection open even if that wasn't the protocol default.
If you don't want to follow HTTP/1.1, you can probably get connection persistence anyway. Just always include a Connection: Keep-Alive header if you successfully establish persistence through the rules above. Send a Connection: Close header if you cannot support a persistent connection even though the client requested one.
Basically, follow the HTTP specification. If you know the content length, you should always send a Content-Length header. Use the persistence negotiation rules to establish a persistent connection if the client can support one.


text:
Q: Angular issue on custom compiler module I search a lot on google but haven't found  any solution. This below code works fine when  I "build" without prod, But this code throws an error when I "build" using prod
its throws error like
error NG1010: Value at position 0 in the NgModule.declarations of DynamicComponentModule is not a reference
Value could not be determined statically.
    @NgModule({
        imports: [
        CommonModule,
        ],
        declarations: [this.options.component],
        exports: [
        this.options.component
        ]
    }) class DynamicComponentModule { }
    const childComponent: any = this.compiler.compileModuleAndAllComponentsSync(DynamicComponentModule as any);
    const factory = childComponent.componentFactories.find((comp) =>
        comp.componentType === this.options.component
    );
    let ModuleComponent_object: any = this.componentModule.createComponent(factory);

can anyone suggest me what i m doing wrong in this?
package.json
{
  "name": "myApp",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^12.0.1",
    "@angular/common": "~11.2.0",
    "@angular/core": "~11.2.0",
    "@angular/forms": "~11.2.0",
    "@angular/material": "^12.0.1",
    "@angular/platform-browser": "~11.2.0",
    "@angular/platform-browser-dynamic": "~11.2.0",
    "@angular/router": "~11.2.0",
    "@ionic-native/core": "^5.31.1",
    "@ionic-native/http": "^5.31.1",
    "@ionic-native/splash-screen": "^5.31.1",
    "@ionic-native/status-bar": "^5.31.1",
    "@ionic/angular": "^5.5.2",
    "bootstrap": "^5.0.1",
    "chart.js": "^2.9.3",
    "crypto-js": "^3.3.0",
    "flag-icon-css": "^3.5.0",
    "ion2-calendar": "^3.5.0",
    "ionic-selectable": "^4.8.0",
    "ionic-tooltips": "^4.0.0-beta.0",
    "moment": "^2.29.1",
    "ng2-charts": "^2.3.0",
    "ngx-quill": "^5.2.0",
    "ngx-sortablejs": "^11.1.0",
    "quill": "^1.3.6",
    "rxjs": "~6.6.0",
    "socket.io-client": "^4.1.2",
    "sortablejs": "^1.13.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1101.4",
    "@angular/cli": "~11.1.4",
    "@angular/compiler": "~11.2.0",
    "@angular/compiler-cli": "~11.2.0",
    "@angular/language-service": "~11.2.0",
    "@ionic/angular-toolkit": "^3.1.0",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "fs-extra": "^10.0.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.2.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.0.2",
    "xlsx": "^0.17.4"
  },
  "description": "An Ionic project"
}


text:
Q: how to pass the callback function in node.js from android client I want to send data from socket in android client to node.js server ..
what ive done in server side :
     socket.on('new user',function(data,callback){
        console.log('ON new user');

      if(data in users ){
        callback(false);
       }else {
        callback(true);
        socket.nickname = data;
        users[socket.nickname]= socket;
            UpdateNickNames();
    }
});

and on my client  android :
         import io.socket.client.IO;
        import io.socket.client.Socket;
       import io.socket.emitter.Emitter;

 public class MainActivity extends AppCompatActivity {
  private static final String TAG = "MainActivity";
EditText edt;
Button btn;
boolean msg;
private Socket mSocket;
{
    try {
        mSocket = IO.socket("http://192.168.1.101/");
        Log.v(TAG,"fine");
    } catch (URISyntaxException e) {
        Log.v(TAG,"Error..... "+e.getMessage());
        e.printStackTrace();
    }
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mSocket.connect();
    edt=(EditText)findViewById(R.id.editText);
    btn=(Button)findViewById(R.id.button);
    btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            attemptSend();
        }
    });
}
private void attemptSend() {
    String message = edt.getText().toString().trim();
    if (TextUtils.isEmpty(message)) {
        return;
    }

    mSocket.emit("new user", message, true);
    Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}

but it's crash with error :
 throw er; // Unhandled 'error' event                                                                           ^                                                                                TypeError: callback is not a function

A: I believe your server-side code looks good. the problem is on the clientside... when you are emiting the "new user" event, make sure its a function you are passing as a parameter, instead you passed a boolean value(true). Try this,
mSocket.emit("new user", message, callback);
Also, based on the callback result you get from serverSide, you do something, else you do something else..
HOPE THIS HELPS!

A: I've found The Solution here :
            mSocket.emit("new user", message, new Ack() {
            @Override
            public void call(Object... args) {
              //Code goes here
            }
    });

}


text:
Q: ng-show/ng-if not working on google autocomplete pac-container custom result I have added a custom result to my google places autocomplete pac-container with the following code-
angular.element('.pac-container').addClass('location-autocomplete-container');
var el = angular.element('
' +
                        'Can\'t find your location?
');
angular.element(".pac-container").append(el);

I want to hide this result in a particular variable condition. Say the variable name is showCantFindResult. ng-show/ng-if is not working on the div of cantFind. Is there any way to show/hide the div on the basis of variable value?


text:
Q: If I create a user in a testmethod, I cannot select them with SOQL in the same testmethod. How can I work around this? I am creating a test method to test functionality allowing users to search for other users.
In order to do this, I have tried creating and saving test users with certain criteria, and then searching for those users with a SOQL select.  However, when I try to search for those test users, I cannot find them - I only find "real" users that exist outside the test.  I assume that this is because "real" users are available to testmethods.
If I cannot rely on "real" users to be consistent between environments, and I cannot create and insert a user within the test, I have no idea how to test this functionality.  Is there a way to access users you create & insert within a test method?

A: I don't see why that would not work, I've made a quick example based on what you explained and the test pass perfectly, try it out:
@isTest
private class UserCriteriaFilteringTest {

    @isTest static void user_search_test() {
        // Implement test code
       Profile senior_manager_profile = [select Id, Name from Profile where Name = 'Senior Manager' limit 1];

       Double hash = Double.valueOf(System.now().millisecond());
       User u = new User(alias =  'TestUser',
         email='mockuser@mockmail.com',
         emailencodingkey='UTF-8', lastname='Testing',
         languagelocalekey='en_US', localesidkey='en_US',
         profileid = senior_manager_profile.Id,
         timezonesidkey='America/Los_Angeles', username=  String.valueOf(hash) + 'mockuser@mockmail.com');
       insert u;

       hash = Double.valueOf(System.now().millisecond());
       User u1 = new User(alias =  'TestUser',
         email='mockuser@mockmail.com',
         emailencodingkey='UTF-8', lastname='Testing',
         languagelocalekey='en_US', localesidkey='en_US',
         profileid = senior_manager_profile.Id,
        timezonesidkey='America/Los_Angeles', username=  String.valueOf(hash) + 'mockuser@mockmail.com');
       insert u1;

       // filter by the email address to get only mock users.
       List<User> users = [select id, Name from User where email = 'mockuser@mockmail.com'];

       System.assert(users.size() == 2);

    }

}


text:
Q: .NET Core Custom User Properties with EF and Code First I have created a test project where I am playing around with .NET Core 2.2 and Identity Framework 2.0.
I have successfully created a project and adjusted some fields so that I understand how the data is parsed from the View to the Controller to the Stores.
I have been looking at customizing the database so that a user will also contain a ReferralID to test some stuff out, this ReferralID is an integer.
What I did is I extended the IdentityUser with this custom property and made a custom version for every Identity Option.
    public class ApplicationUsers : IdentityUser
    {
        public int? ReferralID { get; set; } = null;
    }

I also added it to the database in the tables that were generated but now the application is throwing an error:

CLR property 'ReferralID' cannot be added to entity type 'IdentityUser' because it is declared on the CLR type 'ApplicationUsers'

I have unfortunately not been able to find/understand what is wrong, it seems that something is wrong in the ModelBuilder, I have not touched the model builder and it was auto generated by using a scaffolder Scaffold-DbContext "Data Source=(localdb)\mssqllocaldb;Initial Catalog=CoreTest;Integrated Security=True" Microsoft.EntityFrameworkCore.SqlServer -Context GolfScoresContext -OutputDir Models -DataAnnotations -Project WebApi -Force
What step did I miss? Or can I not add custom properties to an IdentityUser? I have seen people struggling with this and adding [NotMapped] to ApplicationUsers but then I think my property will not get saved.

A: I eventually found out that the reason for throwing it should be something with HasKey and it not accepting an extended model. (using: Entity Framework Core Using multiple DbContexts)
I ended up regenerating the model which fixed it, I think some thing broke in the OnModelCreating as suggested here https://github.com/aspnet/EntityFrameworkCore/issues/9133


text:
Q: Check if site is up or not with Robot and RequestsLibrary How can I check if the site is up without actually opening the browser using Robot ?
This is what I've got so far:
*** Keywords ***
Load staging server if available
Create Session  localhost  ${STAGING_SERVER}
${response}=  get request  localhost  /
Run Keyword If  ${response.status_code} == 200
...  Open Browser  ${STAGING_SERVER}  ${BROWSER}
...  ELSE
...  Open Browser  ${DEVELOPMENT_SERVER}  ${BROWSER}

I'm using Robot's RequestsLibrary. The problem with my code is that it won't even manage to get status code of the response if the site is down because it will fail to establish http connection.

A: Probably you should use keyword Run Keyword And Ignore Error and based on the status check for status code or open browser using ${DEVELOPMENT_SERVER} url. Something like that:
Create Session  localhost  ${STAGING_SERVER}
${status}  ${response}  Run Keyword And Ignore Error  get request  localhost  /
Run Keyword And Return If  '${status}' == 'FAIL'  Open Browser  ${DEVELOPMENT_SERVER}  ${BROWSER}
Run Keyword If  ${response.status_code} == 200
...  Open Browser  ${STAGING_SERVER}  ${BROWSER}
...  ELSE
...  Open Browser  ${DEVELOPMENT_SERVER}  ${BROWSER}


text:
Q: Offline mode for UWP application(framework that implements this feature) My UWP application needs to perform following tasks

*

*let user access application when offline(without showing
disconnected    error)

*store user data entered locally

*update when there is network available
I want to achieve it using sync framework like an entity framework where I do not need to implement everything manually.
I have heard of Microsoft sync Framework but I am not sure of it's compatibility with windows 10 applications
Thanks

A: The recommended approach for this scenario is to use the Azure Mobile Apps and their Offline sync capabilities.


text:
Q: Visual Studio 2012 crashed while adding data source to report viewer I am trying to create rdlc report in vs 2012 ultimate. report was working fine on vs 2010. Now problem is: Visual studio crashed (closed) when I try to add data source in report viewer.
any suggestion to resolve this issue. Is this a known error in vs 2012 ultimate ?

A: I was with the same error, then I removed the PdfSharp and MigraDoc libraries from the project.
No errors anymore.
EDIT:
Actually, the error was in the source control.
PdfSharp.Charting was removed but the project still was refer it.

A: Unfortunately this is a known issue in both Visual Studio 2012 and Visual Studio 2013, it is mentioned in this Microsoft Connect bug.
A workaround has been posted on this MSDN blog.

A: I also had this problem.  I was able to add reports to a new project so I knew there was a problem with my project.  After much trial and error I determined that I had some unnecessary references that got carried over from an older project.  The references were not correct and were missing some dependencies.  After deleting these references my problem was resolved.

A: I encountered this fault after migrating a project from VS2010 to VS2012 recently.
The fix that work for me was to open the .rdlc in a text editor, and look for the tags that contain the path to the dataset used in the report. They looked like this:
<rd:SchemaPath>.......some path.....</rd:SchemaPath>

In my case the path was the old path to where the source was previously kept when I was working in VS2010. I had changed the location of the project on my PC and this path was now invalid.
So I updated the path to the correct location, saved the RDLC, and everything works fine.

A: I debug and found that if you download VS- Command the problem is resolved


text:
Q: Call a controller function from directive with parameters How can a directive call a function from a controller with some parameters ?
I would to give the variable myVar to the scope.$apply(attrs.whattodo);
HTML :

     {{i}}

Controller JS :
   function ctrl($scope) {
      $scope.myarray = [1];
      $scope.addVal = function (value) {
          $scope.myarray.push(value);
      }
   }

Directive JS :
angular.module('component', []).directive('customattr', function () {
  return {
      restrict: 'A',
      link: function (scope, element, attrs) {
          var myVar = 5;
          scope.$apply(attrs.whattodo);
      }
  };
});

A: Why don't you use the "&" sign in isolated scope?

  Value: {{value}}!
  <button customattr add-val="addValue(value)">Add</button>

In controller:
   function ctrl($scope) {
      $scope.myarray = [1];
      $scope.addValue = function (value) {
          $scope.myarray.push(value);
      }
   }

And in directive:
angular.module('component', []).directive('customattr', function () {
  return {
      restrict: 'A',
      scope: {
          addVal: "&"
      },
      controller: function ($scope) {
          var myVar = 5;
             // To execute addVal in controller with 'value' param
          $scope.addVal({value: value})
      }
  };
});

A: Here is one of the working methods:
You have to bind this attribute in scope as a scope model with function type. So you can execute this when you need in other (directive) sope
HTML

  Value: {{value}}!

  <button customattr whattodo="addValue">Add</button>

JS
angular.module('component', [])

.controller('MainCtrl', function($scope) {
  $scope.value = 1;

  $scope.addValue = function(val){
    alert(val);
    $scope.value = val;
  }
});

.directive('customattr', function () {
  return {
      restrict: 'A',
      scope: {
          whattodo: "=" // or ' someOtherScopeName: "=whattodo" '
      },
      link: function (scope, element, attrs) {
          var myVar = 5;
          scope.whattodo(myVar); // or ' scope.someOtherScopeName(myVar) '
      }
  };
});

Here is code on plunker

from AngularJS: Directives
= or =attr - set up bi-directional binding between a local scope property and the parent scope property of name defined via the value
  of the attr attribute. If no attr name is specified then the attribute
  name is assumed to be the same as the local name. Given  and widget definition of scope: {
  localModel:'=myAttr' }, then widget scope property localModel will
  reflect the value of parentModel on the parent scope. Any changes to
  parentModel will be reflected in localModel and any changes in
  localModel will reflect in parentModel

A: in html
whattodo="addVal(value)"

in directive
scope.$apply(function(s){
    s.whattodo({value : myVar});
});


text:
Q: Install PHP 5.5.30 via DockerFile instead of PHP 5.5.9 I have an issue where my PHP version is affecting a project I'm trying to run inside of a docker container.
When I run php -v in the container I get this.
PHP 5.5.9-1ubuntu4.20 (cli) (built: Oct  3 2016 13:00:37)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

My goal is to make the "php -v" command results look like below.  Which it does right now on a working machine.
PHP 5.5.30 (cli) (built: Dec 12 2015 21:28:27)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
    with Suhosin v0.9.36, Copyright (c) 2007-2014, by SektionEins GmbH

The reason I need to downgrade is something changed in regards to how the date() function works between these two versions that causes a crashing error in the PDO Extention, something to this tune (exception 'PDOException' with message 'SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2017-01-13 23:47:31 UTC')
Changing the PHP version seems to fix it.  To save time since its a huge project and I need to just deploy it to active users I need to switch the PHP version down.
My docker file looks like below.
FROM ubuntu:14.04
MAINTAINER Joe Astrahan <****>

VOLUME ["/var/www"]

RUN apt-get update && \
    apt-get install -y software-properties-common && \
    apt-get update && \
    apt-get install -y \
      apache2 \
      curl \
      libcurl3 \
      libcurl3-dev \
      php5 \
      php5-cli \
      libapache2-mod-php5 \
      php5-gd \
      php5-json \
      php5-ldap \
      php5-mysql \
      php5-pgsql \
      php5-curl

COPY config/apache_default.conf /etc/apache2/sites-available/000-default.conf
COPY config/run /usr/local/bin/run
RUN chmod +x /usr/local/bin/run
RUN a2enmod rewrite

EXPOSE 80
CMD ["/usr/local/bin/run"]

The run file is below:
#!/bin/bash
set -e

PHP_ERROR_REPORTING=${PHP_ERROR_REPORTING:-"E_ALL & ~E_DEPRECATED & ~E_NOTICE"}
sed -ri 's/^display_errors\s*=\s*Off/display_errors = On/g' /etc/php5/apache2/php.ini
sed -ri 's/^display_errors\s*=\s*Off/display_errors = On/g' /etc/php5/cli/php.ini
sed -ri "s/^error_reporting\s*=.*$//g" /etc/php5/apache2/php.ini
sed -ri "s/^error_reporting\s*=.*$//g" /etc/php5/cli/php.ini
echo "error_reporting = $PHP_ERROR_REPORTING" >> /etc/php5/apache2/php.ini
echo "error_reporting = $PHP_ERROR_REPORTING" >> /etc/php5/cli/php.ini

source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND

I am not sure how to install a particular version of php 5.5.30 since it always installs 5.9.  I looked around on Google and couldn't find anything.  Any help is appreciated!
If needed below is my docker-compose.yml file.
version: '2'
services:
    dblive:
        image: mysql:5.7.17
        volumes:
            - ./db_data_live:/var/lib/mysql
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: ****
            MYSQL_DATABASE: ****
            MYSQL_USER: ****
            MYSQL_PASSWORD: ****

    dbdev:
        image: mysql:5.7.17
        volumes:
            - ./db_data_dev:/var/lib/mysql
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: ****
            MYSQL_DATABASE: ****
            MYSQL_USER: ****
            MYSQL_PASSWORD: ****

    phpmyadmin:
        depends_on:
            - dblive
            - dbdev
        image: phpmyadmin/phpmyadmin
        environment:
            PMA_ARBITRARY : 1
        restart: always
        ports:
            - "8081:80"

    web:
        build: ./
        depends_on:
            - dblive
            - dbdev
        volumes:
            - ./web:/var/www
            - ./config/php.ini:/usr/local/etc/php/php.ini
            - ./config/apache_default.conf:/etc/apache2/sites-enabled/000-default.conf
        restart: always
        ports:
            - "80:80"
            - "443:443"
        environment:
           TEST: testenviromentvar

I blurred out the passwords but just put your own to make the database work.  Note, use docker exec 8d8a115f6d6b php -v to test php version in the container.  Where the jumble of #'s is the container id after you run docker-compose up etc...
For those curious the line in PHP it currently errors, its below.
$class->created = date('Y-m-d H:i:s', time());
$validated = $class->save();
I get this exact error message, exception 'PDOException' with message 'SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2017-01-13 23:47:31 UTC' for column 'created' at row 1' in /var/www/public_html/devsite/vendor/php-activerecord/php-activerecord/lib/Connection.php:322
The error is because of the UTC, but for some reason this doesn't cause an issue in 5.5.30?

A: Thanks to help from xn20c I was able to find the solution.
First make your dockerfile look like this.
FROM ubuntu:14.04
MAINTAINER Your Name <your@email.com>

VOLUME ["/var/www"]

RUN apt-get update && \
    apt-get install -y software-properties-common && \
    apt-get update && \
    apt-get install -y \
      apache2 \
      curl \
      libcurl3 \
      libcurl3-dev \
      php5 \
      php5-cli \
      libapache2-mod-php5 \
      php5-gd \
      php5-json \
      php5-ldap \
      php5-mysqlnd \
      php5-pgsql \
      php5-curl \
      mysql-client

COPY config/php.ini /etc/php5/apache2/php.ini

# install php-5.5.30
COPY config/install_php-5.5.30.sh /tmp/install_php-5.5.30.sh
RUN /bin/bash /tmp/install_php-5.5.30.sh

COPY config/apache_default.conf /etc/apache2/sites-available/000-default.conf
COPY config/run /usr/local/bin/run

RUN chmod +x /usr/local/bin/run
RUN a2enmod rewrite

EXPOSE 80
CMD ["/usr/local/bin/run"]

Next you will notice its looking for a run script at the end and it also has a special script which installs php 5.5.30 from source.
install_php-5.5.30.sh
#!/bin/bash

# install dependencies
apt-get -y update && \
apt-get install -y \
  build-essential \
  apache2-dev \
  libxml2-dev

# download PHP 5.5.30 source code
cd /tmp
curl -fsSL http://php.net/get/php-5.5.30.tar.bz2/from/this/mirror | tar xjf -
cd php-5.5.30

# configure build options
./configure --prefix=/usr \
            --with-config-file-path=/etc/php5/apache2 \
            --with-config-file-scan-dir=/etc/php5/apache2/conf.d \
            --disable-pdo \
            --disable-json \
            --enable-mbstring \
            --with-apxs2

# compile and install
NUM_CORES=`cat /proc/cpuinfo | grep processor | wc -l`
make -j $NUM_CORES
make install

# configure extension directory
echo 'extension_dir="/usr/lib/php5/20121212"' >> /etc/php5/apache2/php.ini

# cleanup
rm -rf /tmp/php-5.5.30 /tmp/install_php-5.5.30.sh

The above installs PHP and enables the mbstring module with --enable-mbstring.  Usually PHP installs this package by default but when you compile by source you have to enable it.  This goes for any other packages you might need just look up what the --enable flag would be and add it there.
Finally my run script does some last minute changes to the php.ini file that I think are nice.
run
#!/bin/bash
set -e

PHP_ERROR_REPORTING=${PHP_ERROR_REPORTING:-"E_ALL & ~E_DEPRECATED & ~E_NOTICE"}
sed -ri 's/^display_errors\s*=\s*Off/display_errors = On/g' /etc/php5/apache2/php.ini
sed -ri 's/^display_errors\s*=\s*Off/display_errors = On/g' /etc/php5/cli/php.ini
sed -ri "s/^error_reporting\s*=.*$//g" /etc/php5/apache2/php.ini
sed -ri "s/^error_reporting\s*=.*$//g" /etc/php5/cli/php.ini
echo "error_reporting = $PHP_ERROR_REPORTING" >> /etc/php5/apache2/php.ini
echo "error_reporting = $PHP_ERROR_REPORTING" >> /etc/php5/cli/php.ini

source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND

Finally put it all together with a docker-compose file like this...
version: '2'
services:
    dblive:
        image: mysql:5.5.52
        volumes:
            - ./db_data_live:/var/lib/mysql
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: ****
            MYSQL_DATABASE: ****
            MYSQL_USER: ****
            MYSQL_PASSWORD: ****

    dbdev:
        image: mysql:5.5.52
        volumes:
            - ./db_data_dev:/var/lib/mysql
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: ****
            MYSQL_DATABASE: ****
            MYSQL_USER: ****
            MYSQL_PASSWORD: ****

    phpmyadmin:
        depends_on:
            - dblive
            - dbdev
        image: phpmyadmin/phpmyadmin
        environment:
            PMA_ARBITRARY : 1
        restart: always
        ports:
            - "8081:80"

    web:
        build: ./
        depends_on:
            - dblive
            - dbdev
        volumes:
            - ./web:/var/www
            - ./config/apache_default.conf:/etc/apache2/sites-enabled/000-default.conf
        restart: always
        ports:
            - "80:80"
            - "443:443"

Then simply run... docker-compose up -d --remove-orphans
and put the Dockerfile in the same directory and you have a completely working php 5.5.30 server with MySQL support (live & dev databases) and even PHPMyAdmin which can be accessed on port 8081 (localhost:8081)
Hope this helps someone!
-- Important Side Notes --
Make sure your php.ini file does not change the extention_dir or you will have problems like CURL not finding the correct extension path working etc...