text:
Q: Python Tkinter not opening when using .grid() I am working through online tutorials to learn how to make a GUI with Tkinter. But i am having an issue when using the .grid() function.
Here is what i have so far:
from Tkinter import *

root = Tk()
title = Label(root, text = "Hello World")
title.pack()

name           = Label(root, text = "Name")
password       = Label(root, text = "Password")
entry_name     = Entry(root)
entry_password = Entry(root)

name.grid           (row = 0, sticky = E)
password.grid       (row = 0, sticky = E)
entry_name.grid     (row = 0, column = 1)
entry_password.grid (row = 1, column = 1)

check = Checkbutton(root, text = "Keep me logged in")
check.grid(columnspan = 2)

root.mainloop()

So the problem im having is as soon as i include that first line:
name.grid(row = 0, sticky = E)

And then run the script, there are no errors, but nothing opens. The program just hangs and i have to close the command prompt in order to regain control.
If i comment out all the lines using .grid() they program works fine and will open a window with my title inside it.
So, does anyone know what im doing wrong?
Im using Python 2.7

A: You cannot use both pack and grid with two or more widgets that share the same parent. In your case you're using pack for title and grid for everything else. Use one or the other.

A: Keep grid geometry manager consistent so use title.grid().
from tkinter import *

root = Tk()
title = Label(root, text = "Hello World")
title.grid()

name           = Label(root, text = "Name")
password       = Label(root, text = "Password")
entry_name     = Entry(root)
entry_password = Entry(root)

name.grid(row = 0, sticky = E)
password.grid       (row = 0, sticky = E)
entry_name.grid     (row = 0, column = 1)
entry_password.grid (row = 1, column = 1)

check = Checkbutton(root, text = "Keep me logged in")
check.grid(columnspan = 2)

root.mainloop()


text:
Q: How to pass MenuItem as command parameter for its child control I have something like below. For MenuItem, here I am passing an object of that MenuItem as a CommandParameter. This works fine for me. My MenuItem holds a RadioButton and I want to use the MenuItem CommandParameter value for this RadioButton. Could anyone please help me how to do this. Thanks in Advance.
<MenuItem Header="Name"
          VerticalAlignment="Center"
          VerticalContentAlignment="Center"
          Command="{Binding SortCommand}"
          CommandParameter="{Binding RelativeSource={RelativeSource Self}}">
      <MenuItem.Icon>
           <RadioButton VerticalAlignment="Center"
                        Margin="3"
                        IsChecked="True"
                        GroupName="sort"
                        Command="{Binding SortCommand}"
                        CommandParameter="..." />
      </MenuItem.Icon>
</MenuItem>

Now Command is executing only when I select the MenuItem. I want to do the same when user selects the RadioButton also. Below is the code which I am using for this.
public void OnSortCommandExecuted(object menuItem)
{
   MenuItem menu = menuItem as MenuItem;
   if (menu != null)
   {
      ((RadioButton)menu.Icon).IsChecked = !((RadioButton)menu.Icon).IsChecked;
      this.eAggregator.GetEvent<ImagesSortedEvent>().Publish(menu.Header.ToString());
   }
}

A: Like I said in the comments as well, it's not a good practise to pass on UI component as CommandParameter to ViewModel since ViewModel shouldn't know about View.
I would suggest you to have proper binding in ViewModel. Create a bool property in ViewModel and bind with IsChecked DP of radioButton. That ways you don't have to pass any CommandParameter from View, simply check the status of bool property from command execute method.

Now, that why MenuItem can't be accessed from RadioButton?

RadioButton doesn't lie in same Visual tree as that of MenuItem.
So, you can't use RelativeSource to travel upto MenuItem. Also ElementName binding won't work here since this to work both elements should lie in same Visual Tree.
You might find over net to use x:Reference in such cases where two elements doesn't lie in same Visual tree but that won't work here since it will create cyclic dependency.
Last thing, you have to resort with it to use Freezable class object to hold an instance of MenuItem and use that resource in your bindings.
First of all you need to define class deriving from Freezable:
public class BindingProxy : Freezable
{
    #region Overrides of Freezable

    protected override Freezable CreateInstanceCore()
    {
        return new BindingProxy();
    }

    #endregion

    public object Data
    {
        get { return (object)GetValue(DataProperty); }
        set { SetValue(DataProperty, value); }
    }

    public static readonly DependencyProperty DataProperty =
        DependencyProperty.Register("Data", typeof(object),
                                     typeof(BindingProxy));
}

and you can use it from XAML like this to pass MenuItem:
    <MenuItem Header="Name"
              x:Name="menuItem"
              VerticalAlignment="Center"
              VerticalContentAlignment="Center"
              Command="{Binding SortCommand}"
              CommandParameter="{Binding RelativeSource={RelativeSource Self}}">
        <MenuItem.Resources>
            <local:BindingProxy x:Key="proxy"
                                Data="{Binding Source={x:Reference menuItem}}"/>
        </MenuItem.Resources>
        <MenuItem.Icon>
            <RadioButton VerticalAlignment="Center"
                         Margin="3"
                         IsChecked="True"
                         GroupName="sort"
                         Command="{Binding SortCommand}"
                         CommandParameter="{Binding Data.CommandParameter,
                                              Source={StaticResource proxy}}"/>
        </MenuItem.Icon>
    </MenuItem>

Ofcourse you need to declare local namespace in XAML.
PS - I would still insist to use first approach to define proper bindings in ViewModel.

UPDATE
If MenuItem is placed under ContextMenu, then RelativeSource binding won't be possible. Approach described above will work in that case.
But in case you are placing MenuItem directly as child of some control (like Menu), RelativeSource binding will work:
CommandParameter="{Binding CommandParameter,
       RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=MenuItem}}"

redpajama_set_name: RedPajamaStackExchange


text:
Q: Highly available Azure VM I've deployed an Azure VM (woohoo!) and now I'm advised that it's really important that it keeps working.
I've had a read up on Availability Zones and It looks like this might be the thing to do but I'm not sure if I understand it correctly.
If I have one VM in an availability zone, will that VM be replicated across the zones ?
thanks in advance,
Paul.

A: No

Availability Zones are unique physical locations with independent power, network, and cooling. Each Availability Zone is comprised of one or more datacenters and houses infrastructure to support highly available, mission critical applications. Availability Zones are tolerant to datacenter failures through redundancy and logical isolation of services.

Azure availability zones

Virtual machines (VMs) are physically separated across zones, and a virtual network is created using load balancers at each site. These locations are close enough for high availability replication, so your applications stay running, despite any issues at the physical locations.

Availability Zones help to spread VMs across different separated parts (with regards to availability) of a region to achieve high availability. But it is still necessary to use a load balancer and at least two VMs to achieve high availability. A single VM can not be high available as a single VM is not protected against hardware failure, misconfiguration, etc.

A: If you need high availability then you need to run at least 2 VM's. Running a single VM in an availability zone won't help you. Availability zones allow  you to specify which zone in  a region (usually there are 3 zones in a region) your VM goes into. To have HA you need to have at least 2 VM's so that they can sit in separate regions. You would then need to use something like a load balancer to direct traffic however you want.
You can take this a step further and have 2 VM's, each in a separate region. Availability Zones split your VM's over different buildings, power, network etc. in the same region, but this won't protect your from large scale disasters that affect all zones.


text:
Q: SSO to Office 365 without federation I'm developing a product, lets call it CP (standing for cool product). Users sign into CP with their credentials and it happens to be the case that their credentials for CP and AAD (Office 365) are the same. Once they are signed into CP I want to sign them into AAD automatically.
There are two obvious paths to take:

*

*Federate the authentication of the AAD domain to CP. I don't want to do this because many users will never use CP and are expecting their standard AAD interface during login.

*Federate CP authentication to AAD and let them login to CP by having them sign in to AAD. I don't want to do this neither because CP actually offers a special login screen.

So I'm looking to either post credentials directly to office 365 through some deeplink which I haven't been able to find. Or configure AAD in such a way that it does not federate its authentication but does allow CP to login a user.
I have been looking to use the Primary Refresh Token, which is the way SSO to Office 365 works on Windows machines. However, this requires a device registration. I could register a "fake" device and request PRTs using this fake device. However, this seems like an overkill and would still require cookie injection into the clients browser. Therefore, this avenue also seems undesirable.
To be clear, I'm talking about an actual user login in the browser, I'm not looking to get a token (so ROPC is not a solution).


text:
Q: WiFi not working after upgrading to 22.04 I upgraded to version 22.04 some days ago, and from that day I have been fighting with the WiFi, but could not make it work. The fact is the card is present, but it is not recognized by the system. The output of lspci shows all the card details:
(base) luis@Carmen-HP:~$ lspci -nnk | grep 0280 -A3
04:00.0 Network controller [0280]: Intel Corporation Wireless 7265 [8086:095a] (rev 61)
    DeviceName: Intel Dual BandWireless-AC 7265 802.11 ac 1x1 WiFi + BT 4.0 Combo Adapter
    Subsystem: Intel Corporation Dual Band Wireless-AC 7265 [8086:5010]
    Kernel driver in use: iwlwifi

But in the configuration menus the WiFi appears as "Not Available". I have tried several ways to update the package "backport-iwlwifi-dkms" and the /lib/firmware folder contents, the last one as described in the answer here:
Wireless Network not showing with iwlwifi card
But nothing seems to change anything. I have also tried adding some options to the /etc/modprobe.d/iwlwifi.conf file, as described here (sorry the link is in Spanish):
https://slimbook.es/en/tutoriales/linux/79-configurando-driver-wifi-intel-iwlwifi-conf
as, even though my laptop is not a Slimbook, the chip is the same and it was an easy test. But nothing changed.
The output of dmesg is the following:
(base) luis@Carmen-HP:~$ sudo dmesg | grep iw
[    5.230910] Loading modules backported from iwlwifi
[    5.230913] iwlwifi-stack-public:master:9858:4c7cba27
[    5.285225] iwlwifi 0000:04:00.0: Found debug destination: EXTERNAL_DRAM
[    5.285240] iwlwifi 0000:04:00.0: Found debug configuration: 0
[    5.285501] iwlwifi 0000:04:00.0: loaded firmware version 29.f2390aa8.0 7265D-29.ucode op_mode iwlmvm
[    5.419606] iwlwifi 0000:04:00.0: Detected Intel(R) Dual Band Wireless AC 7265, REV=0x210
[    5.434004] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    5.434396] iwlwifi 0000:04:00.0: Allocated 0x00400000 bytes for firmware monitor.
[    5.442498] iwlwifi 0000:04:00.0: base HW address: c8:21:58:59:b0:5f, OTP minor version: 0x0
[    5.505126] ieee80211 phy0: Selected rate control algorithm 'iwl-mvm-rs'
[    8.458692] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    8.537179] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    8.538492] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[    8.559211] iwlwifi 0000:04:00.0: mac start retry 0
[    8.573295] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    8.651234] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    8.652397] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[    8.675001] iwlwifi 0000:04:00.0: mac start retry 1
[    8.689462] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    8.775924] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    8.777199] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[    8.799885] iwlwifi 0000:04:00.0: mac start retry 2
[    8.824928] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    8.902466] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    8.903805] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[    8.929417] iwlwifi 0000:04:00.0: mac start retry 0
[    8.943419] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    9.029111] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    9.030368] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[    9.052862] iwlwifi 0000:04:00.0: mac start retry 1
[    9.066967] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    9.153272] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    9.154832] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[    9.181093] iwlwifi 0000:04:00.0: mac start retry 2
[    9.211600] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    9.296095] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    9.297506] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[    9.321403] iwlwifi 0000:04:00.0: mac start retry 0
[    9.335573] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    9.421158] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    9.422423] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[    9.445741] iwlwifi 0000:04:00.0: mac start retry 1
[    9.459838] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    9.547492] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[    9.548780] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[    9.573399] iwlwifi 0000:04:00.0: mac start retry 2
[   20.022804] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   20.101774] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   20.102986] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   20.126480] iwlwifi 0000:04:00.0: mac start retry 0
[   20.140345] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   20.220178] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   20.221749] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   20.243784] iwlwifi 0000:04:00.0: mac start retry 1
[   20.257398] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   20.336429] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   20.337671] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   20.359611] iwlwifi 0000:04:00.0: mac start retry 2
[   20.376628] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   20.464329] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   20.465835] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   20.489444] iwlwifi 0000:04:00.0: mac start retry 0
[   20.503511] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   20.582267] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   20.584052] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   20.611604] iwlwifi 0000:04:00.0: mac start retry 1
[   20.625064] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   20.704483] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   20.706069] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   20.735718] iwlwifi 0000:04:00.0: mac start retry 2
[   31.021083] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   31.107791] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   31.109129] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   31.131563] iwlwifi 0000:04:00.0: mac start retry 0
[   31.145200] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   31.231600] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   31.233177] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   31.257412] iwlwifi 0000:04:00.0: mac start retry 1
[   31.271697] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   31.357149] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   31.358712] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   31.383568] iwlwifi 0000:04:00.0: mac start retry 2
[   31.397327] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   31.484263] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   31.485594] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   31.509367] iwlwifi 0000:04:00.0: mac start retry 0
[   31.524566] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   31.611024] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   31.612252] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   31.635024] iwlwifi 0000:04:00.0: mac start retry 1
[   31.649196] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   31.735292] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   31.736533] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   31.759668] iwlwifi 0000:04:00.0: mac start retry 2
[   41.884078] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   41.965962] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   41.967469] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   42.001831] iwlwifi 0000:04:00.0: mac start retry 0
[   42.016263] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   42.097977] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   42.099382] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   42.131282] iwlwifi 0000:04:00.0: mac start retry 1
[   42.145201] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   42.226990] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   42.228827] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   42.263716] iwlwifi 0000:04:00.0: mac start retry 2
[   42.278697] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   42.359041] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   42.360471] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   42.386558] iwlwifi 0000:04:00.0: mac start retry 0
[   42.403035] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   42.484093] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   42.485660] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   42.521341] iwlwifi 0000:04:00.0: mac start retry 1
[   42.536160] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   42.616209] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   42.617685] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   42.650936] iwlwifi 0000:04:00.0: mac start retry 2
[   52.728662] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   52.810365] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   52.811919] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   52.840683] iwlwifi 0000:04:00.0: mac start retry 0
[   52.855481] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   52.944260] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   52.945697] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   52.974703] iwlwifi 0000:04:00.0: mac start retry 1
[   52.990432] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   53.070736] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   53.072130] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   53.105183] iwlwifi 0000:04:00.0: mac start retry 2
[   53.121337] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   53.202808] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   53.204214] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   53.233562] iwlwifi 0000:04:00.0: mac start retry 0
[   53.247610] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   53.327163] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   53.328602] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   53.357672] iwlwifi 0000:04:00.0: mac start retry 1
[   53.372481] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   53.453976] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   53.455322] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   53.485314] iwlwifi 0000:04:00.0: mac start retry 2
[   63.691942] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   63.773512] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   63.774947] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   63.811529] iwlwifi 0000:04:00.0: mac start retry 0
[   63.827229] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   63.909318] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   63.910867] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   63.945272] iwlwifi 0000:04:00.0: mac start retry 1
[   63.959628] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   64.040623] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   64.042171] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   64.077989] iwlwifi 0000:04:00.0: mac start retry 2
[   64.093029] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   64.173908] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   64.175460] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   64.208745] iwlwifi 0000:04:00.0: mac start retry 0
[   64.224300] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   64.314272] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   64.316293] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   64.350263] iwlwifi 0000:04:00.0: mac start retry 1
[   64.364806] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   64.446103] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   64.447607] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   64.482126] iwlwifi 0000:04:00.0: mac start retry 2

And nothing seems to be blocked, either by hw or sw:
(base) luis@Carmen-HP:~$ rfkill list all
0: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
1: hci0: Bluetooth
    Soft blocked: no
    Hard blocked: no

I am a bit out of ideas at this point. Any suggestions on how to grab more information or what to try to get back my wifi??


text:
Q: Classify all the fields with abelian absolute Galois group I'm wondering if anyone has classified all the fields $K$ such that $Gal(\bar{K}/K)$ is abelian?
The only examples I'm aware of are: finite fields, the real numbers $\mathbb{R}$ and $k((T))$ where $k$ is any algebraically closed field of characteristic 0. (One might also add any algebraically closed field as an example not listed above...)
Is there any other example of such fields?
An possibly easier question would be: can one apriori prove that $Gal(\bar{K}/K)$ is procyclic as suggested by the examples above?

A: Geyer in Unendliche algebraische Zahlkörper, über denen jede Gleichung auflösbar von beschränkter Stufe ist, Satz 1.13 and the paragraph after that, gives a full characterization of which abelian profinite groups occur as absolute Galois groups: They are either $\mathbb{Z}/2\mathbb{Z}$ or $\prod_p\mathbb{Z}_p^{c(p)}$ for some cardinal numbers $c(p)$.
Side remark: For algebraic extensions of $\mathbb{Q}$, abelian absolute Galois groups are in fact cyclic, see Satz 2.3 in the same paper.


text:
Q: How to show a module is not projective Let $R$ be the ring $K[X]/(X^r)$ for some field $K$ and $r>1$, and consider the module $XR$. I can show that this module is not projective by observing that the ring is local, so all projective modules are direct sums of copies of $R$, and $XR$ is not one of these because it doesn't have the right dimension.
In particular, this means that $XR$ cannot satisfy the lifting property, but I haven't been able to find an example of a map that doesn't lift - can anybody think of a good example in this case?
Looking around previous questions suggests that if the module I want to show isn't projective is a quotient of the ring then the identity generally won't lift, but there doesn't seem to be a neat strategy for dealing with ideals.

A: It's a good idea to map from a projective module onto the module you want to show is not projective. What about the homomorphism $$R\to RX,\;r\mapsto rX?$$

A: Since your ring is local, its projective modules are free. Since your ring has dimension $r$ over $K$, all its finitely generated projective modules have $K$-dimension divisible by $r$, yet your module $XR$ has dimension $r-1$. It follows that $XR$ is not projective.


text:
Q: What is an upper bound for number of prime powers less than $n$? What is an upper bound for number of prime powers less than $n$?
I mean the numbers in the form $a^b$ in which $b \ge 2$ and $a$ is a prime number.
I have found that $\frac {\log n} {\log 2} + \frac {\log n} {\log 3} + \frac {\log n} {\log 5} + \dots + \frac {\log n} {\log i}$ is an upper bound ($i$ is the greatest prime less than or equal to $n$).
And I guess it is less than $\pi \left( \frac {\log n} {\log 2} \right)$, so $\pi \left( \frac {\log n} {\log 2} \right)$ is an upper bound.

A: We can count the powers of $2,3,5,7,11,13,17$ independently and then take care of the other powers using:
$\pi(x)<\lfloor1.3\frac{x}{\log(x)}\rfloor$, for $n\geq 17$.
Suppose $P$ is the number of prime powers less than or equal to $n$, in other words $\sum\limits_{i=2}^{2^i\leq n}\pi(x^{1/i})$ , Then we have the following inequality for $n>7$:
$P\leq\sum\limits_{i=1}^{i\leq7}\lfloor\log_{p_i}(n)-1\rfloor+\sum\limits_{i=2}^{19^i\leq n}\lfloor\frac{1.3n^{1/i}}{i\log(n)}-7\rfloor$

A: The expression you give is a correct computation if you enclose every term on the right in floor brackets.  You can distribute out the $\log n$ numerator, so you are really asking for $\log n\sum_{p \text{ prime}}^{p \le n}\frac 1{\log p}$  We can compute the first few terms in the sum explicitly.  I arbitrarily did primes up through $19$.
$$\log n\sum_{p \text{ prime}}^{p \le n}\frac 1{\log p}\approx \log n(1.5666 +\sum_{k=10}^{p_k  \le n}\frac 1{\log p_k})$$
Then using the prime number theorem, the last term becomes
$$\sum_{k=10}^{p_k  \le n}\frac 1{\log p_k}\approx \sum_{k=10}^{p_k  \le n}\frac 1{\log (k \log k)}=\sum_{k=10}^{p_k  \le n}\frac 1{\log k + \log \log k}$$  Now to get an upper bound we can ignore the $\log \log k$ term in the denominator and change the sum to an integral
$$\sum_{k=10}^{p_k  \le n}\frac 1{\log k + \log \log k}\gt \sum_{k=10}^{p_k  \le n}\frac 1{\log k}\approx \operatorname{li}(\pi(n))-\operatorname{li}(10)$$
Putting it all together, your bound is
$$\log n\left(1.5666+\operatorname{li}(\pi(n))-\operatorname{li}(10)\right)$$


text:
Q: R generate bins from a data frame respecting blanks I need to generate bins from a data.frame based on the values of one column. I have tried the function "cut".
For example: I want to create bins of air temperature values in the column "AirTDay" in a data frame:
AirTDay (oC)
8.16
10.88
5.28

19.82
23.62
13.14

28.84
32.21
17.44
31.21

I need the bin intervals to include all values in a range of 2 degrees centigrade from that initial value (i.e. 8-9.99, 10-11.99, 12-13.99...), to be labelled with the average value of the range (i.e. 9.5, 10.5, 12.5...), and to respect blank cells, returning "NA" in the bins column.
The output should look as:
Air_T (oC)    TBins
8.16          8.5
10.88         10.5
5.28          NA
              NA
19.82         20.5
23.62         24.5
13.14         14.5
              NA
              NA
28.84         28.5
32.21         32.5
17.44         18.5
31.21         32.5

I've gotten as far as:
setwd('C:/Users/xxx')

temp_data <- read.csv("temperature.csv", sep = ",", header = TRUE)
TAir <- temp_data$AirTDay

Tmin <- round(min(TAir, na.rm = FALSE), digits = 0) # is start at minimum value
Tmax <- round(max(TAir, na.rm = FALSE), digits = 0)
int <- 2 # bin ranges 2 degrees
mean_int <- int/2

int_range <- seq(Tmin, Tmax + int, int) # generate bin sequence
bin_label <- seq(Tmin + mean_int, Tmax + mean_int, int) # generate labels

temp_data$TBins <- cut(TAir, breaks = int_range, ordered_result = FALSE, labels = bin_label)

The output table looks correct, but for some reason it shows a sequential additional column, shifts column names, and collapse all values eliminating blank cells. Something like this:
Air_T (oC)    TBins
    1         8.16          8.5
    2         10.88         10.5
    3         5.28          NA
    4         19.82         20.5
    5         23.62         24.5
    6         13.14         14.5
    7         28.84         28.5
    8         32.21         32.5
    9         17.44         18.5
   10         31.21         32.5

Any ideas on where am I failing and how to solve it?

A: v<-ceiling(max(dat$V1,na.rm=T))
breaks<-seq(8,v,2)
labels=seq(8.5,length.out=length(s)-1,by=2)
transform(dat,Tbins=cut(V1,breaks,labels))
      V1 Tbins
1   8.16   8.5
2  10.88  10.5
3   5.28  <NA>
4     NA  <NA>
5  19.82  18.5
6  23.62  22.5
7  13.14  12.5
8     NA  <NA>
9     NA  <NA>
10 28.84  28.5
11 32.21  <NA>
12 17.44  16.5
13 31.21  30.5

This result follows the logic given: we have
paste(seq(8,v,2),seq(9.99,v,by=2),sep="-")
 [1] "8-9.99"   "10-11.99" "12-13.99" "14-15.99" "16-17.99" "18-19.99" "20-21.99"
 [8] "22-23.99" "24-25.99" "26-27.99" "28-29.99" "30-31.99"

From this we can tell that 19.82 will lie between 18 and 20 thus given the value 18.5, similar to 10.88 being between 10-11.99 thus assigned the value 10.5


text:
Q: In spring security saml, Unable to GET /saml/login I'm working with spring security SAML, following the example of SAML authentication found here.
I'm implementing the contents of the file WebSecurityConfig.java, in my project. I've copied that file in the same package as other called SecurityConfiguration.java generated by jHipster.
My problem is that when I try to perform a 3rd party login with my registered IDP, I get a 404 error saying "Cannot GET /saml/login" in the response body.
I'm trying to login using this URL:
http://localhost:9000/saml/login?idp=the id of the identity provider

What could be happening?

A: Problem solved. When you are going to test SAML authentication, ensure you have your browser connected to the same port indicated by your server log.
If your server has opened port 8080 for example, your browser must be connected to port 8080. If you are working in development environment, use localhost:8080. Jhipster projects use port 9000 by default, which is the port where typescript compiler listens, to apply source changes on the fly. With SAML, avoid typescript mediation.
Also helps performing tests using @EnableWebSecurity(debug = true) in your security configuration bean, which writes in log the activated filters when making requests.


text:
Q: SEO - Redirect Hop Counting Site Spider Tool Anyone know of any available code to spider a site, track hops, redirects, type of redirects etc?
Or a hopefully free tool?
The Reason I'm trying to do this is to clean up a site thats pages have accumulated several redirects over the years.
I've googled and googled to no avail.. I found tools that would check a page only if you provided the links.. but not a "spider" tool..
thank you

A: For something similar, I have used JSpider - http://j-spider.sourceforge.net/


text:
Q: Why are print and return giving me different results? I'm using a Python script to calculate Pascal's Triangles for various modulos, and then spit out formatted strings that Lilypond can read. This is for a piece of music.
I can get my triangles to print perfectly, using this:
rows_and_mod = 2
rows = rows_and_mod ** 2

def lily_string(rows):
    for rownum in range (rows):
        newValue=1
        PrintingList = [newValue]
        for iteration in range (rownum):
            newValue = newValue * (rownum-iteration) * 1 / ( iteration + 1 )
            PrintingList.append(int(newValue % rows_and_mod))
    for n,i in enumerate(PrintingList):
        if i==0:
            PrintingList[n]='r8'
        elif i==1:
            PrintingList[n]='g8'
        elif i==2:
            PrintingList[n]="b16 b"
        elif i==3:
            PrintingList[n]="\\tuplet 3/2 { d'16 d' d' }"
        elif i==4:
            PrintingList[n]="f'32 f' f' f'"
    formatted_tri = " ".join(PrintingList)
    print formatted_tri

final_tri = lily_string(rows)

Which prints:
g8
g8 g8
g8 r8 g8
g8 g8 g8 g8
But when I replace the print at the end with a return, it only gives me back the first item of the list. For instance:
    formatted_tri = " ".join(PrintingList)
    return formatted_tri

final_tri = lily_string(rows)

print final_tri

Prints only a single g8.
I figure I must be missing something on how to use or place Return.

A: return ends the function immediately. This is significantly more obvious when it's just return, with no argument. A function call can only execute a single return, because once it does, it's gone.
>>> def f():
...     print 1
...     return
...
...     # Doesn't happen.
...     print 2
...
>>> f()
1

If you want to send output out of your program (for example, so Lilypond can use it), you want print. If you want to send data to the part of your program that called the function, you want return. Here, you want print. If you want to perform further processing on the string inside your Python program, you'll want to instead return a single string or a list of strings.
Finally, you've mixed tabs and spaces for indentation. If you keep doing that, you'll run into weird bugs where certain parts of your program are executed at the wrong times, too many times, or not at all, and after many hours of frustration, you'll find that Python was reading your indentation differently from how you were reading it. Avoid those problems; don't mix tabs and spaces.


text:
Q: show interstitial ads after x actions (in fragment and content based app) I know how to show interstitial ads but I need help on showing interstitial ads after x actions i.e after 3 fragments clicked. This is a non gaming app (only content) and I worked with fragment, not activity. Currently I am showing ads after every 60 seconds but it violets admob policy and creates bad impression to users. my code is below:
    package com.xxx.xxxx;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentTransaction;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;

import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.InterstitialAd;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class MainActivity extends AppCompatActivity
        implements NavigationView.OnNavigationItemSelectedListener {

    NavigationView navigationView = null;
    Toolbar toolbar = null;
    InterstitialAd mInterstitialAd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Prepare the Interstitial Ad
        mInterstitialAd = new InterstitialAd(MainActivity.this);

        // Insert the Ad Unit ID
        mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ads));
        // mInterstitialAd.loadAd(adRequest);

        mInterstitialAd.setAdListener(new AdListener() {
            public void onAdLoaded() {
                // don't show Ad here
            }

            @Override
            public void onAdClosed() {
                createRequest(); //load request whenever ad closed by user
            }
        });

        ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
        scheduler.scheduleAtFixedRate(new Runnable() {
            public void run() {

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        if (mInterstitialAd.isLoaded())
                            mInterstitialAd.show();
                        else
                            createRequest();
                    }
                });
            }
        }, 60, 60, TimeUnit.SECONDS);

        //Set fragment initially
        MainFragment fragment = new MainFragment();
        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.fragment_container, fragment);
        fragmentTransaction.addToBackStack(null);
        fragmentTransaction.commit();

        toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        DrawerLayout drawer = findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.addDrawerListener(toggle);
        toggle.syncState();

        navigationView = findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);
    }

    public void createRequest() {

        AdRequest adRequest = new AdRequest.Builder().build();
        mInterstitialAd.loadAd(adRequest);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        //noinspection SimplifiableIfStatement

        return super.onOptionsItemSelected(item);
    }

    @SuppressWarnings("StatementWithEmptyBody")
    @Override
    public boolean onNavigationItemSelected(@NonNull MenuItem item) {
        // Handle navigation view item clicks here.
        int id = item.getItemId();

        DrawerLayout drawer = findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);

        return true;
    }
}


text:
Q: ColdFusion.navigate alternative? In another question, "Using Google Map with ColdFusion", I ran into a problem of not able to display a google map using CF. After much experimenting, I found out that if you use ColdFusion.navigate to point to a page from one cflayoutarea to another cflayoutarea, the map in the destination cflayoutarea would not show. (However, if you just run the page, both by itself or when it is inside the destination cflayoutarea, the map will show)
So my question now is: is there an alternative approach where I don't need to use coldfusion.navigate to navigate from one cflayoutarea to another?

A: Your English isn't great, so I'm going to paraphrase to a question that makes sense (to me) and answer that question...
It sounds like you have 2 CFLayoutArea's, and you want to have a link (or button, etc) in one of them that will change the contents of the other.
If you're eliminating ColdFusion.navigate as an option, then it seems to me you're going to have to try one of a few other options that are all basically the same thing. I like jQuery. If you don't like jQuery, you can use another library, or roll your own solution, but they will all do the same job.
Since this code:
<cflayout name="foo" type="hbox">
    <cflayoutarea name="nav">nav</cflayoutarea>
    <cflayoutarea name="content">content</cflayoutarea>
</cflayout>

Produces this HTML:

        nav

        content

You can use the ID attribute of the content DIV, with jQuery, to change its contents:

<cflayout name="foo" type="hbox">
    <cflayoutarea name="nav">go</cflayoutarea>
    <cflayoutarea name="content">content</cflayoutarea>
</cflayout>


text:
Q: Setting up a RESTful api with Django, pre-existing models So I'm currently tasked with creating a web api for a systems database that I manage, and already have an existing django site with models and such created. What would be the best tool to create an api to work with my existing models and framework? Everything I'm looking at (tastypie, django rest framework) seems to want me to recreate my models using their serializer objects. Is that my only choice if I want to implement a RESTful api? Sorry if this is a dumb question, I've never created an API before and am just attempting to figure things out.
To reiterate, attempting to create an API for django with pre-existing models, what tool should I use?
Thanks!

A: I recommend you to use Django REST framework since I'm using it and satisfied with the result. One more bonus point is its author is active on StackOverflow, you can ask question anytime.
One can choose Tastypie over DRF. Well it's just the matter of taste. I can say both are equally good.
And no you don't have to recreate your models, creating serializer class is even easier than creating form from models in Django.
If you don't want to use DRF or Tastypie, fine, you can always build an API yourself with just normal views. But soon you will face the wall of serializing object, complex URL design, and other sorts of problems.
It's up to you to decide which path you want to go.

A: I would also recommend using Django Rest Framework but if you're interested in a simple solution to work with existing models, take a look at https://github.com/tomchristie/django-auto-api (same author as Rest Framework). It allows you to easily expose existing models in multiple formats and is really simple to integrate into your app.


text:
Q: How can VBA alerts generated from Word macros be disabled? I'm working on an application that processes Word documents using interop.
Here's how I set up the Application:
Application app = new Application()
{
    DisplayAlerts = wdAlertLevel.wdAlertsNone
};

app.Application.AutomationSecurity = MsoAutomationSecurity.msoAutomationSecurityForceDisable;

I'm trying to disable all alerts and prevent macros from executing. However, after adding the last line that disables macros, I get the following alert from VBA:

Do I need to disable VBA alerts as well? If so, how can I do that? This alert stops execution of the application until I deal with it.


text:
Q: How to stream all videos in a folder? Hi i want to stream videos over web using ffserver. i got this link as reference.
Now what i am not able to figure out is how to pass a folder(which content all videos i want to stream) as input to stream all videos. I also want add more videos dynamically to this folder in time to time and streaming should happen(like how it works in Darwin). now i can't use Darwin because it doesn't support for iOS.
please give me a suggestion.
is there any other open source tool by which i can do this?

A: I wrote a bash script for this, it's working in ubuntu 16
Hopefully someone else can write it up in a less terrible language
Here's the script:
echo -e "HTTPPort 8090\nHTTPBindAddress 0.0.0.0\nMaxHTTPConnections 2000\nMaxClients 1000\nMaxBandwidth 1000\nCustomLog -\n<Stream stat.html>\nFormat status\n</Stream>"
num=1
for i in *.mp3; do
echo -e "<Stream \"$(urlencode $i)\">\nFile \"$(pwd)/$i\"\nFormat mp2\nAudioCodec libmp3lame\nAudioBitRate 64\nAudioChannels 1\nAudioSampleRate 44100\nNoVideo\n</Stream>"
done

save this as a bash script in the folder you want to serve, I'll refer to it as:
./gen_ffserver_conf.sh

it's hard coded for mp3, you'd have to sort through my echos to get it to do another format.
run the server with:
ffserver -f <(bash -e ./gen_ffserver_conf.sh)

I had to install a package for the url encoding:
sudo apt install gridsite-clients

(and of course you need ffserver as well, in the ffmpeg package)
I stream the files by going to:
http://<ip address of streaming server>:8090/stat.html

and clicking on the urlencoded values, (using chromium). This will open the stream and start playing.
Explanation:
ffserver doesn't like wildcards, or at least I never figured that out, so I'm just creating an entry for each file in the server. The urlencoding is annoying but necessary for the stat page links to work properly.


text:
Q: Crash opening 2.8 project in 2.18 When I open an old project (QGIS version 2.8.9) with QGIS 2.18.10, I catch an error that says:
Project file is older : this project file was saved by an older version of QGIS. when saving this project file, QGIS will update latest version, possibly rendering it useless ...
After that QGIS crashes. How can I fix it?


text:
Q: Known Good SQL Logins Failing (Error 18456) Accompanied by "Unable to Reuse a Session" (Error 18056) I am losing my patience with this problem. I'm running SQL Server 2008 R2 with all updates.
It is very intermittent. Every now and again this SQL server instance will report the error: Login failed for user 'XX'. Reason: Failed to open the database configured in the login object while revalidating the login on the connection.

Error: 18456, Severity: 14, State: 46.

I know this is a good login, it works all of the other times, and no one changes the credentials.
The above error is immediately followed by this error:

The client was unable to reuse a session with SPID 150, which had been
  reset for connection pooling. The failure ID is 46. This error may
  have been caused by an earlier operation failing. Check the error logs
  for failed operations immediately before this error message.
Error: 18456, Severity: 14, State: 46.

When this occurs a few minutes later this is reported also:
Message
All schedulers on Node 0 appear deadlocked due to a large number of worker threads waiting on ASYNC_NETWORK_IO. Process Utilization 0%.
The above message just keeps repeating until I restart the server.
From researching this issue I've increased the maximum worker threads (currently at 1100). The server has 72G memory and 4 vCPUs, running Windows Server 2008 R2.
i don't encounter this issue at all on my other database servers that run the same environment. Just this one. Any help would be greatly appreciated, I'm running out of options.


text:
Q: How to implement logging of all changes mysql database? I need to track all changes in database: update, insert, delete. I want know WHO and WHAT change.
Need log table with columns:

*

*Date.

*Table name.

*Column.

*Old value.

*New value.

*IP.

What is the best way to implement this?
Are there ready-made solutions?
I tried use triggers on update / insert / delete. This is a good solution? Or maybe I do not know something about the correct logging in mysql?
My trigger:
CREATE TRIGGER `user_update_trigger`
AFTER UPDATE ON `users`
FOR EACH ROW
BEGIN

DECLARE done int default false;
DECLARE col_name CHAR(255);

DECLARE counter INTEGER(11);

DECLARE column_cursor cursor for SELECT `column_name`
                    FROM `INFORMATION_SCHEMA`.`COLUMNS`
                    WHERE `TABLE_SCHEMA`='test'
                    AND `TABLE_NAME`='users';

DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;

open column_cursor;

myloop: loop

fetch column_cursor into col_name;

if done then
    leave myloop;
end if;

/*SET @old_val = OLD.{{col_name}}; <------ HOW GET VALUE? */
/*SET @new_val = NEW.{{col_name}};<------ HOW GET VALUE? */

if @old_val <> @new_val then
    /*INSERT INTO `log` ....*/
end if;

end loop;

close column_cursor;

END;

A: enable mysql audit log filtering.
You can do something like
    {
  "filter": {
    "class": [
      {
        "name": "connection",
        "event": [
          { "name": "connect" },
          { "name": "disconnect" }
        ]
      },
      { "name": "general" },
      {
        "name": "table_access",
        "event": [
          { "name": "insert" },
          { "name": "delete" },
          { "name": "update" }
        ]
      }
    ]
  }
}

or
    "event": [
  { "name": "select", "log": false },
  { "name": "insert", "log": true },
  { "name": "delete", "log": true },
  { "name": "update", "log": true }
]


text:
Q: Which is the best Data Mining model to extrapolate known values to missing values in a table? (General question) I am working on a little data mining project (I am still a Data Science student, not a professional). Maybe you can help me to choose a proper model for my task.
So, let's say we have a table with three columns and around 4000 rows:

YEAR
COLOR
NAME

1900
Green
David

1901
Yellow
Sarah

1902
Green
???

1902
Red
Sarah

…
…
…

2020
Purple
John

Any value for any field can be repeated in the dataset (also Year values).
In the first two columns we don't have missing values, but we only have around 20% of Name values in the third column. Name value deppends somewhat on the first two columns (not a causal relation).
My goal is to extrapolate the available Name values to the whole table and get a range of occurrences for each name value (for example in a boxplot)
I have imagined a process like that, although I am not very sure if statitically it makes sense (any objections and suggestions are appreciated):

*

*For every unknown NAME value, the algorythm choose randomly one of the already known NAME values. The odds of a particular NAME value to be chosen depend on the variables YEAR and COLOR. For instance, if 'David' values tend to be correlated with low Year values AND with 'Green' or 'Purple' values for Color, the algorythm give 'David' a higher probability to be chosen if input values for Year and Color are "1900, Purple".

*When the above process ends, the number of occurrences for each name is counted.

*The above process is applied 30 times and the results for each name are displayed in a plotbox.
However, I don't know which is the best model to implement an idea similar to this. I have drawn the process in a simple paint drawing:
Possible output for the task
Which do you think it could be a good approach to this task? I appreciate any help.

A: I think you have the process down, it's converting the data which may be the first hurdle.
I would look at using from sklearn.preprocessing import OrdinalEncoder to encode the data to convert from categorical to numeric.
You could then use a random number generator to produce a number within the range defined by the encoding which would randomly select a name.
Loop through this 30 times with an f loop to achieve the result.
It also looks like you will need to provide the ranking values for year and colour prior to building out your code. From here you would just provide bands, for example, if year > 1985, etc within your for loop to specify the names.


text:
Q: how to build dll files in netbeans using ms vc++ compiler? i tried using cygwin gcc compiler  along with netbeans to create dll files it seems there is an issue in the generated dll file. if i use the ms vc++ compiler and do all compiling on command line its runs file, but i dont know how to integrate ms vc++ tools in netbeans ... can anyone help me on that ?
thanks
jay

A: NetBeans doesn't provide a way to integrate microsoft compiler in its IDE. This is probably because it doens't have rights to do so. With NetBeans you can integrate only GNU compilers for C/C++. To use Microsoft C/C++ compiler, you have to use MS Visual Studio IDE, or MS Visual Studio provided command line tools.


text: Q: R: ESS shell.exec speed I am using ESS in Windows XP. I have noticed that shell.exec is much slower with ESS than with RGui (the problem occurs when I try help(ls) for example, the help is displayed much faster in RGui, I tracked it down and it is due to shell.exec). Is there any reason for this? How can I fix it? My default browser is Firefox.


text:
Q: C1 CMS - Restore the CSS file I've made changes in the css file that defines the whole style for the website and saved these changes. Unfortunately, as I am not a web designer, I don't have the previous version of style.css. Is there any opportunity to cancel the implemented changes or restore the previous version of the file?

A: No unfortunately you can't if you have already saved and deployed your code or your code is not maintained via any version controlling systems like git.
What i can suggest by looking at your situation is if you are looking for fresh file from the c1 CMS you should install again in a different folder and then go to "~/Frontend/Styles/" folder of your new project and look for styles.min.css file. Other than that sorry you can't.
Thanks, Hope this helps.


text:
Q: check if secure connection can be established before redirect Might be a similar question than others but so far I couldn't find anything that answered my question.
Situation: a user is on my website http://www.example.com. I am about to redirect him to another of my sites: https://secure.example.org
Before the redirect happens, I want to check if the client is actually able to successfully establish a secure connection. (either server-side during the redirect or maybe with an AJAX request prior to redirection or anything that serves the purpose).
Is that possible at all, and how would it be done? Any preference on how to do it?

A: If the browser can't securely connect to https://secure.example.org it will not.
You can always make an AJAX request but it success or failure will not indicate much about the success of the real request. (And because it's cross domain you will have to add CORS headers).
But your current configuration is by design insecure: because your first page use http, an attacker can replace your link to your secure page by anything he wants.
If you add https to your first page, then you have nothing else to do, the browser will do all secure check for you.
You should look into HSTS too, to improve the security.
To redirect to https if possible, on the beginning of the http webpage, include a javascript file with an https url, containing the redirection to the https website: users will be redirected only if they support https. (And you can use HSTS with that method too)

A: Try something like this:
   if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off"){
  $redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $redirect);
}


text:
Q: How to productionize a k-fold target-encoded feature? I am attempting to build a model that has many predictors which are both categorical and large in cardinality.  Target encoding looks to be a good solution for including these features, but I'm unsure of how to productionize the mapping if k-fold target encoding is used to avoid overfitting as described below:

Say 5 folds are divided at random; each category in each feature will then have 5 means in the training set.  How do I decide which value to map to in production?  My only thought is that the folds should be divided deterministically; then in production, we have a mapping for each fold definition - then each event that runs through our production model will have its fold calculated in realtime and mapped according to that value?
Image taken from:
https://towardsdatascience.com/getting-deeper-into-categorical-encodings-for-machine-learning-2312acd347c8

A: The answer is in the source code for the blog post: https://github.com/groverpr/Machine-Learning/blob/9963e59823fe0ff18cc8e1b2657b71c01f133193/catboost/utils.py#L25-L27
They re-fit the target encoding using the entire training set, before making out-of-sample predictions.
Note that they also fill missing values with the global mean of the target.
Edit: I wonder if it could be useful to average together the results of the K encodings, rather than re-training a single encoding on the entire dataset.


text:
Q: (Unity2D) Как сделать вылезающего врага Я новичок в unity. Сейчас делаю 2D игру и хотел бы добавить туда врага, который вылезает из земли через равные промежутки времени и залезает обратно. Что-то типа цветочка из марио. Хотелось бы чтобы он имел возможность вылезать со всех сторон, и снизу, и сверху, и слева, и справа. Буду рад любой помощи

A: Всё решается с помощью оси Z. Спрайт врага находится за спрайтом ограждения. Например, ограда по Z на 0, а враг на -5. Вылезание это изменение координат врага. Тут уж как вы захотите - хоть вверх, хоть вниз, хоть по диагонали. Вас в этом ничто не ограничивает.
gameObject_enemy.transform.position = new Vector3(20f, 10f, -5);


text:
Q: What are the different ways an accent mark can go over the letter A & how are they pronounced? I've found specifically these ones: á, à, â, å, ä.  I believe they COULD be used in the English language, or root ones such as Celtic & Germanic, but I don't know how they are pronounced.
Oh, and I've glanced at the articles What does the grave accent mark on words mean? and Diacritic if that helps jumpstart you on your assistance.  Thank you, and please give examples of how they are used!

A: The uses of diacritic marks in modern English are quite limited, and diacritic marks can always be omitted without being incorrect. This applies equally to A and any other letter.
Recent foreign borrowings: e.g. rôle, coup d'état, façade, etc. but role, coup d'etat, and facade are also all correct.
Stage and poetry prosody:  e.g. learnèd indicating a normally silent vowel is to be pronounced
Diaeresis: e.g. Brontë, Chloë, Zoë (also indicating a silent vowel is to be pronounced) or naïve, Boötes, and noël (indicating a vowel is to be pronounced separately).
Artistic or humorous effect: e.g. Blue Öyster Cult
As for pronunciation: in English, including or not including the diacritic does not change the pronunciation, though it may clarify it. In other languages diacritics have many different pronunciations and you would have to look at each language for details.

A: Apart from rare accented E, there's no diacritics in English. In any case, all modified letters are pronounced as per particular foreign word in question, as specific words are often pronounced specifically, apart from the generic sound implied by a diacritic.


text:
Q: Install Firefox extension using windows registry I have followed the instructions here [MDC - Adding Extensions using the Windows Registry],
but haven't been able to get Firefox to automatically install my extension when I restart it.
I have written an application that is half windows service and half FF extension. I have built an installer and want it to be able to install the Firefox extension along with the service.
So far I have tried the following things:

*

*Removing my dev version of the
extension from FF first

*Removing the
pointer file to my dev version of the
extension from my profile dir

*Removing my "dev" profile completelly
so that FF only has a "default"
profile

*Running FF without the
-no-remote and -P switches I setup for the dev environment

*Trying the
key in both HKEY_CURRENT_USER and
HKEY_LOCAL_MACHINE

*Carefully checking
the ID and Paths I have used

*Trying
Paths that don't include spaces

*Trying the Paths in Quotes

*Trying a
trailing \ at the end of the path

*Trying the .xpi filename at the end of the path instead of just the dir name

*Building the XPI using the Extension
Builder plugin instead of manually
(although my manual build would
install just fine if I dragged it to
FF)

I'm using FF3.5.2 on Windows 2003 Server
(could it be a W2K3 install security issue?)
UPDATE: Now tested also on WinXP FF3.0.11. Same problem.

A: OK. I figured it out myself! I miss-read one line of the instructions!!!

"the location of the unpacked XPI"

I must be losing my mind. For some reason I reread this as the "packed XPI" over and over!!!
(I feel very silly now)
The answer was to use the unpacked files in the install dir not the .xpi file.

A: I noticed that it's really important to have back-slash in the file path, ex: [TARGETDIR]Extension\Firefox\


text:
Q: Generate signed APK error com.android.dex.DexException: Multiple dex files define when generate signed apk, has this error, but build project is ok
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;
gradle:
apply plugin: 'com.android.application'

repositories {
    maven {
        url 'https://raw.github.com/71241NW123CK/maven-repo/master'
    }
}

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "com.baclock"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 18
        versionName "2018.02.09"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        incremental false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'party.treesquaredcode.android:flip-animation:0.0.2'
    compile 'com.mcxiaoke.volley:library:1.0.6'
    compile 'com.google.android.gms:play-services-gcm:8.1.0'
    compile 'com.google.android.gms:play-services:8.1.0'
    compile 'com.evernote:android-job:1.2.4'
}

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

A: Add multiDexEnabled true in default config and then try.
defaultConfig {
        applicationId "com.baclock"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 18
        versionName "2018.02.09"
        multiDexEnabled true
    }

A: Add multiDexEnabled = true inside defaultConfig block.
defaultConfig {
        applicationId "com.baclock"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 18
        versionName "2018.02.09"
        multiDexEnabled true
    }


text:
Q: Exception when using play framework 1.2.3 on Ubuntu My instance of play v1.2.3 on Ubuntu was working fine till yesterday.  I am not entirely certain if I installed any new packages on Ubuntu in the meanwhile.  When I now try running play (run/start), I get the exception copied below.  I have tried cleaning the tmp directory but it did not help.  Any other thoughts (besides setting up play again) will be greatly appreciated.  Thanks
Exception in thread "main" play.exceptions.UnexpectedException: Unexpected Error
    at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
    at play.classloading.hash.ClassStateHashCreator.getClassDefsForFile(ClassStateHashCreator.java:83)
    at play.classloading.hash.ClassStateHashCreator.scan(ClassStateHashCreator.java:58)
    at play.classloading.hash.ClassStateHashCreator.scan(ClassStateHashCreator.java:63)
    at play.classloading.hash.ClassStateHashCreator.scan(ClassStateHashCreator.java:63)
    at play.classloading.hash.ClassStateHashCreator.scan(ClassStateHashCreator.java:63)
    at play.classloading.hash.ClassStateHashCreator.computePathHash(ClassStateHashCreator.java:48)
    at play.classloading.ApplicationClassloader.computePathHash(ApplicationClassloader.java:371)
    at play.classloading.ApplicationClassloader.<init>(ApplicationClassloader.java:62)
    at play.Play.init(Play.java:272)
    at play.server.Server.main(Server.java:158)
Caused by: java.lang.RuntimeException: java.io.IOException: Input/output error
    at play.libs.IO.readContentAsString(IO.java:62)
    at play.libs.IO.readContentAsString(IO.java:49)
    at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
    ... 10 more
Caused by: java.io.IOException: Input/output error
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:220)
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
    at java.io.InputStreamReader.read(InputStreamReader.java:167)
    at java.io.Reader.read(Reader.java:123)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1364)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1340)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1315)
    at org.apache.commons.io.IOUtils.toString(IOUtils.java:525)
    at play.libs.IO.readContentAsString(IO.java:60)

A: One of the Java classes in my project somehow got corrupted.  I noticed it when I tried copying the whole directory to another location - the copy operation generated an error message specifying the corrupted file (which I'm sure one could have detected through other means as well).
Removing the corrupted file (& replacing with the same code) resulted in normal behavior.  Hope this helps others.


text:
Q: can't display array inside of html using vuejs v-for I am returning back an array of object to render all on the screen. I am making a Ajax request to get a bunch of titles. Right now I can only manage to make it bring back one by writing vm.CourseTitle=data.d.results[0].Title; Instead, I want it to return all, I have tried vm.CourseTitle=data.d.results.Title; but that breaks it. How do I need to format the vuecode to make this display all the titles? In theory, this would be enclosed within a return{}. No idea why I can't get this to work!

new Vue({
  el: "#app",

  data: {
 CourseTitle: [{ "Title":"Ford", "models":[ "Fiesta", "Focus", "Mustang" ] },
    { "Title":"BMW", "models":[ "320", "X3", "X5" ] },
    { "Title":"Fiat", "models":[ "500", "Panda" ] }

  ],
  }

})

Todos:

 {{CourseTitle}}

A: You're not correctly manipulating html. It should be:

{{course.Title}}

Further, li tag should be wrapped with ul tag.


text: Q: How did Hamilton come up with his idea of summing up the kinetic energy and potential energy? When we browse through any classical physics textbook, the Lagrangian comes first where the potential energy is subtracted from Kinetic energy. Was Hamilton playing around with energy functions and he got the idea of summing up both the energies?


text:
Q: Any successful website built on top of Google App Engine? I would like to know whether there are any websites (not toy projects) that have been successfully built on top of GAE (excluding google) using whatever programming languages or frameworks that are available.

A: Yes, of course there are. We've featured a few of them on the blog in the past, including webfilings, Wolfire games, and Neptune's Pride, to name a few.

A: Overgrowth looks fairly big.
The App Engine gallery, but it has been closed.
And there is also StackPrinter...
See: 5 cool web applications hosted on Google App Engine

A: Snapchat uses Google App Engine. They just turned down a $3 Billion offer I believe, so they are very successful in that sense. Source: Gigaom Article

A: WordsKeeper - web application for foreign language learners.


text:
Q: How to run npm install and run gulp with ANT I'm trying to run npm install and run gulp after the npm install with ANT build.xml file... when i run ant the the ant command is executing without any error, but nor npm install or gulp is not executed...
Here is what i have done in build.xml
<?xml version="1.0" encoding="utf-8"?>
<project name="gulp">
    <npminstall>npm install</npminstall>
    <target name="gulp">
        <gulp file="dist/op/generator/gulpfile.js"/>
    </target>
</project>

A: Just like you do it in the terminal you can do this using exec task https://ant.apache.org/manual/Tasks/exec.html


text:
Q: Python3 error "ImportError: No module named" have __init__.py I created a simple flask application and my directory structure looks like this:
myproject
- src
-- models
--- __init__.py
-- views
--- errors.py
--- default.py
-- application.py
-- config.py
-- __init__.py
- test
-- test_myproject.py
Readme.md
setup.py
..

The application.py from the src look like this:
from src.models import db
from src.views.errors import error_pages
from src.views.scoreboard import scoreboard
from src.config import config

The test_myproject looks like this:
from src.models import db, Result
from src.application import create_app

I use Pycharm to develop this and when I click run it works but when I try to run it via the command line python application.py I get the following error:
Traceback (most recent call last):
  File "src/application.py", line 18, in <module>
    from src.models import db
ImportError: No module named 'src'

Runnint the unittests with python -m unittest works.
If I change the imports from application.py to:
from models import db
from views.errors import error_pages
from views.scoreboard import scoreboard
from config import config

It will work when I run it via the command line, however the tests won't work anymore.
File ".../src/application.py", line 18, in <module>
    from models import db
ImportError: No module named 'models'

What am I doing wrong?

A: You said that you're running python application.py, which suggests that your working directory is src. To be able to import modules under src.* (without playing with PYTHONPATH) you should run Python from the myproject directory instead.
Consider either moving application.py to myproject or running it with python src/application.py.


text:
Q: Entire page as a dropzone for drag and drop While writing web apps that took file input, I wanted to use drag 'n' drop, but I didn't want just a small dropzone on the page. I thought it would be more convenient if you could drop anywhere on the page. Luckily, the window.ondrop event fires anywhere on the page, but I wanted some fancy effect to show the user visually that drag/drop was possible.
To do that, all that was needed was detect when a file was dragged into the window, and when it was dragged out, to trigger an effect that showed the user that the app was drag-enabled. Turns out that drag events are not that convenient. I assumed that window.ondragenter would trigger only once, when the user entered the page. Then when you left the window, it'd trigger window.ondragleave. Wrong. It's constantly firing as the mouse moves over child elements in the page.
I looked at what properties were available in the event object, trying to find anything that could isolate what I needed, but nothing worked. The furtherest I got was being able to change the background color of body. And only if there was nothing else on the page.
Tons of file upload sites got it right. Imgur and WeTransfer for example. Their sites were all spahetti-coded and compressed to the point of unreadability, and I couldn't find anything on the subject by googling.
So how can this be done?

A: The trick is to use a dropzone covering the entire page, and caching the target of window.ondragenter to compare with the target of  window.ondragleave.
First, the dropzone:

Even though the dropzone will be covering the entire page, using visibility:hidden or display:none will hide it from view. I used visibility:hidden so that CSS animations can be used to animate the transition.
Assigning the events

So here's the process: You drag a file over the window, and window.ondragenter immediately fires. The target is set to the root element, . Then you immediately unhide your dropzone, which covers the entire page. window.ondragenter will fire again, this time the target being your dropzone. Each time the dragenter event fires, it will cache the target, because this will be the target that will match the last window.ondragleave event that fires when you drag out of the window.
Why does this work? I have no idea, but that is how to do it. This is pretty much the only working method that triggers when the user drags off the page.
I believe it works because once the dropzone is unhidden, it will always be the last target. It covers every pixel of the page, even the  tag. This method relies on dragleave firing when leaving the window. Unfortunately there is a bug in Firefox that prevents it from working properly. Please vote for it so it'll get fixed sooner. As of Firefox 57.0.2, dragleave appears to fire properly. However, a workaround is required, checking document instead of the cached element:
if(e.target === lastTarget || e.target === document)

Here's a JSBin of it in action. Tested working in latest Chrome, Firefox, Edge and IE11.

A: I changed the accepted answer a little because didn't want to hide Dropzone. So maybe this tiny modification be helpful for others:
1- Made a full width hidden wrapper:

DROP HERE

2- Show it on [dragenter] event:
window.addEventListener("dragenter", function(e){ // drag start
    // unhide our green overlay
    showWrapper();
    lastTarget = e.target; // cache the last target here
});

3- if user drop the file, pass it to Dropzone:
window.addEventListener("drop", function(e){

    e.preventDefault();
    hideWrapper();

    // if drop, we pass object file to dropzone
    var myDropzone = Dropzone.forElement(".dropzone");
    myDropzone.handleFiles(e.dataTransfer.files);

});

I made a live demo with more details on codepen.
Thank you


text:
Q: How do I use Linq in MonoDevelop 2.0 on OS X? I installed MonoDevelop 2.0 on my Mac.
I created a new Console Application.
"Hello World" program runs fine.
But I can't use Linq.
using System. doesn't show Linq option.
What should I do?

A: I'm running Monodevelop 2.0 and Mono 2.0 on Ubuntu 9.04 and lambda's and Linq work fine.
Contrary to what Thomas Levesque says, System.Core does exist in Mono. Extension methods, lambda's et al are all supported.
You need to use using System.Linq.
public static void Example1()
{

    List<string> people = new List<string>()
    {
        "Granville", "John", "Rachel", "Betty",
        "Chandler", "Ross", "Monica"
    };

    IEnumerable<string> query = from p in people where p.Length > 5
    orderby p select p;

    foreach (string person in query)
    {
        Console.WriteLine(person);
    }
}

A: You may need to right-click on your project in the solution view, do Options, Build, General, and set your Target Runtime to Mono / .Net 3.5 or bigger.
Then you can right-click references, do Edit References, and add a reference to System.Core to your project.

A: Is your Console Application referencing the System.Core.dll? You need to reference it in order to use System.Linq.

A: The Latest version of Mono Develop does support linq.  On the project you must select 3.5 under Build/General/RuntimeVersion.  After that you can add the System.Core reference.

A: Check if your project references on System.Xml.Linq library too

A: Not sure LINQ is fully implemented within the current release http://www.mono-project.com/Roadmap


text:
Q: Ansible-Playbook run custom group_vars Im newbie using ansible.
I am trying to execute a custom playbook, which executes the roles that have been mounted from an iso, for this I have the following structure.
- /iso/
 - /AnsibleFiles/
     - /roles/
       - ....
       - ....

- myPlaybook.yml
- /myInventory/
  - group_vars/
    - myInventoryFile

*

*myPlaybook.yml: It has where my roles are, and which have to execute.

*myInventoryFile: It has the variables that I need to execute the roles.

Im trying to execute like this:
ansible-playbook myPlaybook.yml -i myInventory/group_vars/myInventoryFile

But itdoes not work.. ansible dont read my vars, return this message:
The conditional check '{{ my_Var }}' failed. The error was: error while evaluating conditional ({{ my_Var }}): 'my_Var ' is undefined\n\nThe error appears to have been in '/home/user/myPlaybook.yml

myInventoryFile
Have the variable defined like this: my_Var: true
myPlaybook.yml
It ave to evaluate this variable to know which roles to execute.
when: "{{my_Var}}"

A: I got the following to work.
I created the following directory structure:
.
+ AnsibleFiles
| + roles
|   + testmyvar
|     + tasks
|       + main.yml
+ myInventory
| + localhost
+ myPlaybook.yml

The content of AnsibleFiles/roles/testmyvar/tasks/main.yml:
---
- name: Checking value of my_Var
  debug: var=my_Var
...

The content of myInventory/localhost:
localhost my_Var=yuck

The content of myPlaybook.yml
---
- hosts: localhost
  roles:
    - AnsibleFiles/roles/testmyvar
...

I get the following when I run the following command:
me$ ansible-playbook -i ./myInventory/localhost ./myPlaybook.yml

PLAY [localhost] ***************************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]

TASK [AnsibleFiles/roles/testmyvar : Checking value of my_Var] *****************
ok: [localhost] => {
    "my_Var": "yuck"
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0

I do not think you can have a group_vars directory and specify that with the -i on the command line.  From what I read, you must have an inventory file.  That means everything must be in that inventory file, including the vars definitions.
Hopefully this provides some guidance on how to update your Ansible code.

A: inventory file:    ansible-playbook myPlaybook.yml -i /etc/ansible/inventory/myInventory.yml
group vars folder/file: /etc/ansible/inventory/group_vars/myInventory.yml / /etc/ansible/inventory/group_vars/myInventory/something.yml


text:
Q: How to add a ssh key to remote server? In my VPS, run ssh-add -l and it returns: The agent has no identities.
but I have run cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys' previously
I then run ssh-add ~/.ssh/authorized_keys
it returns @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/home/deployer/.ssh/authorized_keys' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
and ssh git@github.com still get report Permission denied (publickey).

A: To add your ssh-key to your ssh-agent you have to add it with:
ssh-add

After that ensure your key is added:
ssh-add -l

To fix your permission problem try:
chmod 0600 ~/.ssh/authorized_keys

A: The currently most up voted answer is plainly wrong as it fails to understand the question. OP is asking how to authorize a key on a remote server, not how to add a key to your local ssh-agent.
To add a key to a remote server use the ssh-copy-id command from your local PC:
ssh-copy-id -i path/to/key.pub username@remoteHost

This adds the public key located at path/to/key.pub with the correct permission to the server at remoteHost using username as login name. Note that this also seems to require the private key next to the public key (the path/to/key file in this example).

A: Dude, use pssh. Create a file with all the hostnames you want to add the file to, then run something like:
pssh -h [hostsfile] -P 'echo "sshkeystringBLARG etc..." >> /home/[user]/.ssh/authorized_hosts'
You can modify the cmd accordingly and off you go.
Enjoy


text:
Q: MediaRecorder, get partial videos on interval during recording? I am using MediaRecorder to record the screen on a browser.
At the end of the session the video is uploaded to the server.
To make the process more error-proof I would like to upload partial videos on intervals instead of only one big file at the end.
I have tried something like this:
const handleRecord = function ({stream}) {
  const mediaRecorder = new MediaRecorder(stream);

  mediaRecorder.ondataavailable = function (e) {
    uploadVideoPart(e.data); // Upload to server
  };

  mediaRecorder.start(10000); // 10 seconds
};

But the upload videos are corrupted.
The first one is possible to be reproduced but there is warning:

[matroska,webm @ 0x7fa5e580ec00] File ended prematurely at pos. 1060573 (0x102edd)

The rest of the videos are totally corrupted.
Looks like there is a special blob at the beginning and at the end that prevents me to do upload partial videos.
How can I handle partial videos using MediaRecorder ?


text:
Q: PSR and constructor visibility According to PSR-2

Visibility MUST be declared on all properties and methods

but what about __construct, it's specific function and I was wondering if it should also be marked by default as public when we're using PSR?

A: Yes you should also declare visibility for the __construct() method. In some cases the __construct is not public like
abstract class Singleton {

    private static $instances;

    final public static function getInstance() {
        $className = get_called_class();

        if(isset(self::$instances[$className]) == false) {
            self::$instances[$className] = new static();
        }
        return self::$instances[$className];
    }

    protected function  __construct() { }

}


text:
Q: Free webhosting not letting WebRequest get the page I am creating a chat application and I am using a free webhosting to store the online users in a database. I have the following structure:
1) index.php where i get the online users in this format:

<user>
   <name></name>
   <ip></ip>
</user>

2) add.php?user= to add a new user to the database when he connects.
3) remove.php?user= to remove a user when he disconnects.
Now in the application I have a function GetUsers() like this:
string url = @"http://.../index.php";
System.Net.WebRequest req = System.Net.WebRequest.Create(url);

System.Net.WebResponse res = (System.Net.WebResponse)req.GetResponse();

If I am using the local IIS server for the url it works but when I try with the free webhosted url it gives me an 406 Not Acceptable error. So I think I need to put some headers or something to fake a real browser.
UPDATE: 1) The free hosting service is using Apache as the webserver.
            2) You can suggest another approach to fetch the web page.

A: I suggest using a tool like Fiddler to capture your browser's requests, and then trying to simulate them in code.
You can also route your programmatic requests through Fiddler using the technique from this answer.
Shortly:
req.Proxy = new WebProxy("http://localhost:8888", false);

localhost:8888 is the default address of Fiddler.


text:
Q: Calendar View without horizontal scroll I´m trying to use a Calendar View (Android Studio Widget) with horizontal scrolling. In design view the calendar appears fixed with arrows to scroll, that is what i want, but when i run the app, the calendar appears with vertical scrolling showing some months. I want to show only the present month and scroll with arrows horizontally.
Xml code:
<CalendarView
    android:id="@+id/calendarView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@color/colorPrimaryDark"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.491"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.328" />

App view:

Design view (what I want):

1:


text:
Q: onBlur / onClick conflict with CodeMirror2 in React I have created multiple CodeMirror cells. OnBlur works fine, however if I click run button on the other cell, instead of firing run, it actually triggers onBlur and then I need to click mouse again to trigger run. Ideally both of these events should be fired when run button is clicked.
I have seen that the issue is with the order of precedence for these two events and one of the proposed solutions was to add ref attribute to code mirror like this ref = {cell => this.cell = cell} and then in the other handler which is related to run button do this.cell.focus() or in some similar way.
Unfortunately I am not even able to access ref attribute for CodeMirror2 so I can't test it. I will paste both of these components and any suggestion is appreciated.
To summarize: The issue is that onBlur shadows onClick, so run button needs to be clicked twice. I want to be able to click run button and that both onBlur and handleRunClick fire.
import React, { Component } from "react";
import { Controlled as CodeMirror } from "react-codemirror2";
import CellResults from "./CellResults";
import CellToolbar from "../Shared/CellToolbar";
import AddCellButton from "../Shared/AddCellButton";
import "codemirror/lib/codemirror.css";
import "codemirror/theme/darcula.css";
import "codemirror/mode/javascript/javascript.js";
import "codemirror/mode/ruby/ruby.js";
import "codemirror/mode/python/python.js";

class CodeCell extends Component {
  state = {
    code: this.props.cell.code
  };

  handleChange = value => {
    this.setState({ code: value });
  };

  handleBlur = () => {
    this.props.onUpdateCodeState(this.state.code, this.props.cellIndex);

    if (this.props.language === "Markdown") {
      this.props.toggleRender(this.props.cellIndex);
    }
  };

  render() {
    const cell = this.props.cell;
    const cellOptions = {
      mode: cell.type.toLowerCase(),
      theme: "darcula",
      lineNumbers: true,
      showCursorWhenSelecting: true
    };

    return (

          <AddCellButton
            className="add-cell-btn"
            onClick={this.props.onAddClick}
            cellIndex={this.props.cellIndex}
          />

        <CellToolbar
          cellIndex={this.props.cellIndex}
          onDeleteClick={this.props.onDeleteClick}
          language={cell.type}
          onLanguageChange={this.props.onLanguageChange}
          rendered={cell.rendered}
          onRunClick={this.props.onRunClick}
        />
        <CodeMirror
          value={this.state.code}
          options={cellOptions}
          onBeforeChange={(editor, data, value) => {
            this.handleChange(value);
          }}
          onBlur={this.handleBlur}
        />
        {cell.type !== "Markdown" ? (
          <CellResults language={cell.type} results={cell.results} />
        ) : null}

    );
  }
}

export default CodeCell;

import React from "react";
import Button from "react-bootstrap/Button";

class RunCellButton extends React.Component {
  handleRunClick = () => {
    this.props.onClick(this.props.cellIndex);
  };
  render () {
    return (
      <Button
        className="run-button"
        onClick={this.handleRunClick}
        variant="secondary"
        size="sm"
      >
        ►
      </Button>
    );
  }

};

export default RunCellButton;

Below is the similar problem with Adding Cell. When I trigger click event it fires, the state of show is changed to true but if I log it on line 36 it is still false. I am triggering click event from a different component, again due to this obBlue shadowing everything else so every button needs to be clicked twice.
import React, { Component } from "react";
import SplitButton from "react-bootstrap/SplitButton";
import * as constants from "../../Constants/constants";
import DropdownButton from "react-bootstrap/DropdownButton";
import Dropdown from "react-bootstrap/Dropdown";

class AddCellButton extends Component {
  state = {
    show: false
  }
  handleSelectCellType = language => {
    this.props.onClick(this.props.cellIndex, language);
  };

  handleToggle = () => {
    this.setState((prevState) => {
      return {
        show: !prevState["show"]
      }
    })
  }

  render() {
    const dropDownItems = constants.LANGUAGES.map(language => {
      return (
        <Dropdown.Item
          as="button"
          value={language}
          key={language}
          eventKey={language}
        >
          {language}
        </Dropdown.Item>
      );
    });
    console.log("state of show " + this.state.show)
    return (
      <DropdownButton
        show={this.state.show}
        onToggle={this.handleToggle}
        className="add-cell-btn"
        variant="secondary"
        id="dropdown-basic-button"
        title={+}
        size="sm"
        onSelect={this.handleSelectCellType}
      >
        {dropDownItems}
      </DropdownButton>
    );
  }
}

export default AddCellButton;


text:
Q: Exception thrown when trying to deploy CAS maven overlay I'm trying to setup a CAS server locally in Jboss. i'm trying to deploy the maven overlay described in this link.
https://github.com/UniconLabs/simple-cas4-overlay-template
and when i'm trying to deploy the cas.war file i got few errors and i managed to fix them by adding following dependencies.
     <dependency>
        <groupId>org.restlet.jee</groupId>
        <artifactId>org.restlet.ext.spring</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.restlet.jee</groupId>
        <artifactId>org.restlet</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.restlet.jee</groupId>
        <artifactId>org.restlet.ext.servlet</artifactId>
        <version>2.2.2</version>
    </dependency>

Now i'm getting this error:

Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class  [org.restlet.ext.spring.SpringRouter]: Constructor threw exception; nested exception is  java.lang.NoClassDefFoundError: com/sun/net/httpserver/HttpHandler

I tried to find a dependency having this class but I didn't find. What am i doing wrong ?
My ultimate goal is to integrate CAS with Sprint security.
Thanks in advance.

A: I found the issue. It was due to not specifying "com/sun/net/httpserver/HttpHandler" under modules in jboss wildfly.
To fix the issue add the following under paths in /modules/system/layers/base/sun/jdk/main/module.xml:
<path name="com/sun/net/httpserver"/>


text:
Q: Json on .net server for android i have json for login interface and i got no ideas how to handle this type of json
please help me for how to handle this json
{
    "ActionVerb": "xyz",
    "Source": "android",
    "DTOCollect": [
        {
            "DTOoJson": {
                "LoginIdStr": "xyz",
                "UserPassStr": "xyz"
            },
            "DTOType": "loginRequestObj"
        }
    ]
}

A: By "handle this type of json", I am guessing that you are asking how to deserialize this in java?
If so, the easiest way to go is to use a JSON library, there are quite alot of these. Personally I like GSON, but google around for it and make your own selection


text:
Q: Forward requests on Public IP to Private IP Azure I have a Ubuntu VM running on Azure with Private IP 10.0.0.4 and I have assigned a Public IP x.x.x.x. An application is listening on several ports on the private IP address and I cannot connect to them from external network.
How do I forward any request on any port on Public IP to 10.0.0.4 on the same port.

A: You remove the public IP from the server and put it on a public load balancer. Then you point the traffic from the load balancer back to the private IP of your vm.

A public Load Balancer maps the public IP address and port of incoming traffic to the private IP address and port of the VM

https://docs.microsoft.com/en-us/azure/load-balancer/concepts-limitations#public-load-balancer


text:
Q: 2x3 repeated measures for skewed data I am using 2x3 repeated measures ANOVA. I am analyzing three years of test data and comparing two different groups. However, my data is negatively skewed.
What is the best way to transform negatively skewed data? What shall I use for repeated measure analysis of non normal data?
Thanks for your help.

A: Apply a transformation function to the data. The same transformation must be applied to all the samples. For example taking the logarithm of both sample values can lower the skew to the right.
Use the ladder of powers if log does not work.
3 cube
2 square
1 no transformation
1/2 square root
1/3 cube root
0 log
-.5 reciprocal root
-1 reciprocal
-2 reciprocal squared
If the data is right skewed try functions from the bottom.
If the data is left skewed try function from the top.
Good luck


text:
Q: Routing for executing different GET methods with same type of parameter Could anybody little help me with routing?
In WebApiConfig I have this mapping
config.Routes.MapHttpRoute(DefaultApi",
    routeTemplate: "{controller}/{uid}",
    defaults: new {uid = RouteParameter.Optional}
);

and two methods in controller
[RoutePrefix("AppartmentCategory")]
public class AppartmentCategoryController : ApiController
{
    [HttpGet]
    public IHttpActionResult Get(Guid uid){...}

    [HttpGet]
    [Route("{propertyUid?}")]
    public IHttpActionResult GetList(Guid propertyUid){...}
}

When I try to send requests
1. http://.../AppartmentCategory/043F61D1-7194-E611-A98B-9C5C8E0005FA

and
2. http://.../AppartmentCategory/?propertyUid=2fdc968d-0192-e611-a98b-9c5c8e0005fa

In both cases executing method public IHttpActionResult GetList(Guid propertyUid)
What shold I fix for executing public IHttpActionResult Get(Guid uid) method for first request?

A: You are mixing convention-based routing and attribute routing. config.MapHttpAttributeRoutes() is mapped before convention-based routes (as it should)
config.MapHttpAttributeRoutes();

config.Routes.MapHttpRoute(DefaultApi",
    routeTemplate: "{controller}/{uid}",
    defaults: new {uid = RouteParameter.Optional}
);

so it will hit the GetLists first as first match always win when matching templates. Technically both actions will have similar routes.
[RoutePrefix("AppartmentCategory")]
public class AppartmentCategoryController : ApiController
{
    //GET AppartmentCategory/043F61D1-7194-E611-A98B-9C5C8E0005FA VIA CONVENTION-BASED ROUTING
    [HttpGet]
    public IHttpActionResult Get(Guid uid){...}

    //GET AppartmentCategory/2fdc968d-0192-e611-a98b-9c5c8e0005fa VIA ATTRIBUTE ROUTING
    [HttpGet]
    [Route("{propertyUid?}")]
    public IHttpActionResult GetList(Guid propertyUid){...}
}

You should try to differentiate the two actions a little more and also try not to mix convention-based and attribute routing in the same controller.
[RoutePrefix("AppartmentCategory")]
public class AppartmentCategoryController : ApiController {
    //GET AppartmentCategory/043F61D1-7194-E611-A98B-9C5C8E0005FA
    [HttpGet]
    [Route("{uid:guid}")]
    public IHttpActionResult Get(Guid uid){...}

    //GET AppartmentCategory?propertyUid=2fdc968d-0192-e611-a98b-9c5c8e0005fa
    [HttpGet]
    [Route("")]
    public IHttpActionResult GetList(Guid propertyUid){...}
}


text:
Q: Find the probability that the generations number $1,2,...,r$ will not include the progenitor, and the median distribution. In a population of $n+1$ people a man, the "progenitor," sends out letters to two distinct persons, the "first generation." These repeat the performance and, generally, for each letter received the recipient sends out two letters to two persons chosen at random without regard to the past development. Find the probability that the generations number $1,2,...,r$ will not include the progenitor. Find the median of the distribution, supposing $n$ to be large.
There are two people who receive the letter in the first generation. There are four people who receive the letter in the second generation, and so on. So, the number of people who receive the letter increases exponentially. A person who received the letter has ${n-1 \choose 2}$ ways to send out letters to the next generation, assuming that this person cannot send out letters to the originator. Therefore, the probability of not sending out to originator for each person is ${n-1 \choose 2}/ {n \choose 2} = 1-\frac2n$. We are asked to find the probability that 1st 2nd ... rth generations do not send out letters to the originator, and it is $\prod_{k=1}^{r}(1-\frac2n)^{2^k}$. But, the answer is $(1-2/n)^{2^r-2}$. Doesn't this answer only  consider $r-1$ th generation?
Regarding the second part of the question, I need to find $r$ such that $(1-2/n)^{2^r -2} < 1/2 < (1-2/n)^{2^r}$. I was thinking of taking logs and rearrange in some manner, but I am not sure about this. The answer is  "$2^{r+1} = 0.7n$, approximately." How can I reach this answer?
I appreciate if you give some help.

A: I think you mean the simplified answer is $(1-2/n)^{2^r-2}$.
The original answer is
$$
\prod_{k=1}^{r-1} (1-2/n)^{2^k},
$$
since for generations $1,2,\ldots,r$ not to include the progenitor, the people sending out letters in generations $1,2,\ldots,r-1$ must not pick the progenitor. You do not consider where people in the $r$-th generation send their letters, since that will form generation $r+1$.
To get the simplified answer,
$$
\prod_{k=1}^{r-1} (1-2/n)^{2^k} = (1-2/n)^{\sum_{k=1}^{r-1} 2^k},
$$
and note that $\sum_{k=1}^{r-1} 2^k = 2^r-2$.
For the last part, you want to approximately solve
$$
(1-2/n)^{2^r-2} = 1/2. \quad (\ast)
$$
Write $(1-2/n)^{2^r-2} = e^{(2^r-2)\log(1-2/n)}$, and use that $\log(1-2/n) \approx -2/n$ for $n$ large (Taylor series approximation). The 0.7 will come from $\log(1/2)$ when you solve $(\ast)$.