text:
Q: Change values of dictionary C# I create a dictionary (Dictionary<string, bool> values).
I create the function:
    private Dictionary<string, bool> ChangeValues(int line, Dictionary<string, bool> values)
    {
        for (int i = 0; i < line; i++)
        {

        }

        return values;
    }

I want to change bool values according the number of line.
The table below is the result of a dictionary (only show the bool):
line 0 =  values["A"][false]
          values["B"][false]
          values["C"][false]

line 1 =  values["A"][false]
          values["B"][false]
          values["C"][true]

line 2 =  values["A"][false]
          values["B"][true]
          values["C"][false]

line n...

How I can change the bool value according the number of line?
Thanks.
[update]
After some help, the function is done:
    private Dictionary<string, bool> ChangeValues(int line, Dictionary<string, bool> values)
    {
        string[] keys = values.Keys.ToArray();

        keys = (from k in keys orderby k descending select k).ToArray();

        for (int i = 0; i < line; i++)
        {
            for (int j = 0, bit = 1; j < values.Count; j++, bit <<= 1)
            {
                values[keys[j]] = (i & bit) != 0;
            }
        }

        return values;
    }

Thanks to PeterDuniho

A: Do you mean like this:
static Dictionary<string, bool> ChangeValues(int line, Dictionary<string, bool> values)
{
  switch (line)
  {
    case 0:
      values["A"] = false;
      values["B"] = false;
      values["C"] = false;
      break;

    case 1:
      values["A"] = false;
      values["B"] = false;
      values["C"] = true;
      break;

    case 2:
      values["A"] = false;
      values["B"] = true;
      values["C"] = false;
      break;
  }

  return values;
}

Note: You can also have void return type (as in static void ChangeValues) and omit the return values; statement since you always return the same instance anyway, but that depends on whether you want a "fluent syntax" or not.

After comments, try this:
static Dictionary<string, bool> ChangeValues(int line, Dictionary<string, bool> values)
{
  var binary = Convert.ToString(line, 2);

  var key = 'A';
  foreach (var c in binary)
  {
    values[key.ToString()] = c == '1';
    key++;
  }

  return values;
}

The comment about void is the same as before.

A: If I understand the question correctly, all you want is to be able to iterate all possible combinations of the flags stored in your dictionary. In addition, these flags correspond exactly to the bits in your loop variable i.
If so, then you can just use the bits from the loop variable directly to set the flag values in the dictionary. For a general solution, you do need to pass the key names as well, in the correct order according to the bits you want to set.
For example:
private Dictionary<string, bool> ChangeValues(int line, Dictionary<string, bool> values, string[] keys)
{
    for (int i = 0; i < line; i++)
    {
        for (int j = 0, bit = 1; j < keys.Length; j++, bit <<= 1)
        {
            values[keys[j]] = (i & bit) != 0;
        }

        // do something with values here
    }

    return values;
}

Call like this:
var result = ChangeValues(8, values, new [] { "C", "B", "A" });

Note that the above simply modifies the dictionary that was passed in. I infer from the way the question was asked — "I want to change bool values" — that this was your intent. However, if you actually want to return a whole new dictionary object, you can do so:
private Dictionary<string, bool> ChangeValues(int line, string[] keys)
{
    Dictionary<string, bool> values = new Dictionary<string, bool>();

    for (int i = 0; i < line; i++)
    {
        for (int j = 0, bit = 1; j < keys.Length; j++, bit <<= 1)
        {
            values[keys[j]] = (i & bit) != 0;
        }

        // do something with values here
    }

    return values;
}

Of course, in that case the values of the original dictionary are of no use, so there's no need to pass it in, so I've left it out of the parameter list for this version of the method.
If in fact you want to return a new dictionary but still need the old one for some reason (e.g. you want to do something with it, like copying values or something, which you failed to mention in your question), then you can combine the two examples above to suit your needs.


text:
Q: Image rotation script breaks on AJAX load, starts rotating too quickly I adapted an image rotation script from here.
I have a main page (main.php), and a button that will load a page (ajax.php) into a div container on main.php. The code for image rotation is placed inside $(document).ready(function() section of the ajax.php page. This code is below.
When the page first loads, it is okay and the images are rotating once every 1000ms. If I click the button to the load ajax.php to put in a new rotating set of images, it loads two images in succession, waits 1000ms, loads two images, etc. If I click a third time, it will load three images in succession, wait 1000ms, etc. Do you have an idea where the problem is occurring? Thanks.
Just an edit - if I put a comment inside the mouseleave function I see it will get called multiple times when the problem occurs, so it could be the .mouseleave(); code at the very end causing problems?
Edit2: I have added new code snippets. One from the main.php and two from the ajax.php page:
MAIN

<link rel="stylesheet" href="css/classic.css" type="text/css" />

    <button id="main-button">Get Random Content</button>

</script></script>

AJAX

<?php
echo '
';
for ($i = 0; $i < 15; $i++) {
    echo '';
}
echo '
';
?>

A: Edit since more code has been disclosed
The issue looks like it is a problem with stopping the prior setInterval().  The event handlers that would normally stop it are wiped and so it keeps going forever.  And, because it's inside a $(document).ready() callback function scope, you can't get to it to manually clear it.
I think the best way to fix it is to move the slide

Original answer
You are apparently rerunning code that sets up new setInterval() timers each time you load new content.  That gets you duplicate timers that cause the multiple unwanted actions.
There are a bunch of possible causes for how you could end up with a duplicate timer:

*

*An event handler on replaced content may be getting removed when the new content is loaded and that keeps a prior timer from getting removed.

*Code for initializing the new content may be starting a new timer without stopping an old one.

*A variable may be getting re-initialized, thus overwriting the previous timer variable.

*When you initialize the newly loaded content, you add duplicate event handlers.  You need to either remove prior event handlers before readding new event handler or you need to not doubly reinitialize the content.
We would have to see more about how the HTML is laid out, what content has event handlers on it and what content is being reloaded to know exactly which problem is occurring.

redpajama_set_name: RedPajamaStackExchange


text: Q: How do I prevent iTunes from deleting movies, music? I have certain movies downloaded on my Mac for my kids so I always have stuff to watch.  I noticed after a long time (1/2 year or longer) the downloads disappear and I have to re-download them.  Is there any way to prevent this?


text:
Q: Sampling of positive weights with sum unity and an equality constraint Suppose I have a vector of positive weights a=(a1, a2, a3, a4) such that a2=a3 and a1+a2+a3+a4=1. Is there any way to sample this kind of weights using R? I tried to think about using the Dirichlet distribution, but it gives no mechanism to force two of the variates to be equal.

A: To sample evenly across the set {(a1, a2, a3, a4 | a2=a3, a1+a2+a3+a4=1, a1>0, a2>0, a3>0, a4>0}, I would first sample the value for a2 (which is equal to a3). To do this we need to know the distribution of this value. If a2 = a3 = r, then we have a1+a4 = 1-2r; for positive a1 and a4 there is a line segment of length (1-2k)*sqrt(2) containing all feasible values of a1 and a4. Integrating, the probability that a2 is k or less is 4(k - k^2). In more detail:
Prob (a2 <= k) = Integral(0 to k) (1-2r)*sqrt(2) dr / Integral(0 to 0.5) (1-2r)*sqrt(2) dr
               = ((k-k^2)*sqrt(2)) / (sqrt(2)/4)
               = 4k - 4k^2

Thus, we can sample values for a2 by selecting a uniformly distributed value u~U(0, 1) and setting a2 to equal the value k for which 4k - 4k^2 = u. Solving via the quadratic formula, this yields:
a2 = 0.5 * (1 - sqrt(1-u))

In R, we can sample 1000 values for a2 with:
set.seed(144)
a2 <- 0.5 * (1 - sqrt(1 - runif(1000)))
a3 <- a2

Given a fixed value a2 = a3 = k, the value of a1 is uniformly distributed in [0, 1-2k]:
a1 <- runif(1000) * (1 - 2*a2)

Having specified a1, a2, and a3, there is only one possible value for a4:
a4 <- 1 - a1 - a2 - a3

We can take a look at some of our sampled values:
head(cbind(a1, a2, a2, a4))
#              a1         a2         a2         a4
# [1,] 0.83455239 0.01251016 0.01251016 0.14042729
# [2,] 0.02744599 0.22932773 0.22932773 0.51389856
# [3,] 0.45835472 0.23860119 0.23860119 0.06444291
# [4,] 0.36843649 0.14679703 0.14679703 0.33796946
# [5,] 0.35109881 0.08702039 0.08702039 0.47486041
# [6,] 0.02916818 0.19942616 0.19942616 0.57197949

Here is the distribution of a1 values (note that by symmetry this is identical to the distribution of the a4 values). Because we select a1 uniformly in the range [0, 1-2*a2], lower values are more common than higher values:

Here is the distribution of a2 values (by definition this is the same as the distribution of the a3 values). The shape of the distribution is similar to the one of a1, but the maximum value is 0.5:

A:
I tried to think about using the Dirichlet distribution,

Well, to me it looks like Dirichlet distribution.

but it gives no mechanism to force two of the variates to be equal.

but you don't have to. You actually have three variates from Dirichlet distribution - A, B, C, all >= 0, uniformly distributed U(0,1) so that A+B+C=1
After sampling (A, B, C) you just assign
a1 = A;
a2 = B/2.0;
a3 = B/2.0;
a4 = C;

Please take a look at how to sample thing (well, in Python)
Generating N uniform random numbers that sum to M


text:
Q: External screen doesn't work when update kernel Good morning community.
As I indicated in the title my problem is that when I updated the computer with an apt-get full-upgrade the kernel has been updated and my external display has stopped working.
I have tried to reuse the NVIDIA private drivers but when I run the xrandr command it does not recognize the external display or the HDMI connector.
I have read of users who have had similar problems with other physical components of the computer but not the display.
Currently the kernel I am using is 5.15.0-56-generic and the operating system is Ubuntu 22.04.1 LTS.
Attached is the output of the xrandr command as well as lspci in case it might be helpful in figuring out what is causing this problem.
Best regards.
manuel@mjflomon:~$ xrandr
Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
XWAYLAND0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 380mm x 220mm
   1920x1080     59.96*+
   1440x1080     59.99
   1400x1050     59.98
   1280x1024     59.89
   1280x960      59.94
   1152x864      59.96
   1024x768      59.92
   800x600       59.86
   640x480       59.38
   320x240       59.52
   1680x1050     59.95
   1440x900      59.89
   1280x800      59.81
   720x480       59.71
   640x400       59.95
   320x200       58.96
   1600x900      59.95
   1368x768      59.88
   1280x720      59.86
   1024x576      59.90
   864x486       59.92
   720x400       59.55
   640x350       59.77

manuel@mjflomon:~$ lspci
00:00.0 Host bridge: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation 6th-10th Gen Core Processor PCIe Controller (x16) (rev 07)
00:02.0 VGA compatible controller: Intel Corporation CoffeeLake-H GT2 [UHD Graphics 630]
00:12.0 Signal processing controller: Intel Corporation Cannon Lake PCH Thermal Controller (rev 10)
00:14.0 USB controller: Intel Corporation Cannon Lake PCH USB 3.1 xHCI Host Controller (rev 10)
00:14.2 RAM memory: Intel Corporation Cannon Lake PCH Shared SRAM (rev 10)
00:14.3 Network controller: Intel Corporation Cannon Lake PCH CNVi WiFi (rev 10)
00:16.0 Communication controller: Intel Corporation Cannon Lake PCH HECI Controller (rev 10)
00:17.0 SATA controller: Intel Corporation Cannon Lake Mobile PCH SATA AHCI Controller (rev 10)
00:1d.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #9 (rev f0)
00:1d.6 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #15 (rev f0)
00:1f.0 ISA bridge: Intel Corporation HM470 Chipset LPC/eSPI Controller (rev 10)
00:1f.3 Audio device: Intel Corporation Cannon Lake PCH cAVS (rev 10)
00:1f.4 SMBus: Intel Corporation Cannon Lake PCH SMBus Controller (rev 10)
00:1f.5 Serial bus controller: Intel Corporation Cannon Lake PCH SPI Controller (rev 10)
01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GP106 High Definition Audio Controller (rev ff)
03:00.0 Ethernet controller: Qualcomm Atheros Killer E2400 Gigabit Ethernet Controller (rev 10)


text:
Q: Why the prediction of profit is negative for the population less than 31125 using linear regression i am beginner to machine learning and i have some doubt related to linear regression.here is the link of my repository https://github.com/utkarshmani1997/Machine_Learning/blob/master/exercise_1/exp1.ipynb
i was trying to predict the profit but it is giving negative values.What does it mean?

A: I got it. Actually, I was trying to predict only for range between 5k to 30k but when I tried for 35k, it gave me a positive result. This means that for that population range, there will be no profit. In other words, it is a loss.


text:
Q: Increasing the efficiency of equipment using Amazon Machine Learning The problem statement is kind of vague but i am looking for directions because of privacy policy i can't share exact details. so please help out.
We have a problem at hand where we need to increase the efficiency of equipment or in other words decide on which values across multiple parameters should the machines operate to produce optimal outputs.
My query is whether it is possible to come up with such numbers using Linear Regression or Multinomial Logistic Regression algorithms, if no then can you please specify which algorithms will be more suitable. Also can you please point me to some active research done on this kind of problem that is available in public domain.
Does the type of problem i am asking suggestions for comes in the area of Machine Learning ?

A: Lots of unknowns here but I'll make some assumptions.
What you are attempting to do could probably be achieved with multiple linear regression. I have zero familiarity with the Amazon service (I didn't even know it existed until you brought this up, it's not available in Europe). However, a read of the documentation suggests that the Amazon service would be capable of doing this for you. The problem you will perhaps have is that it's geared to people unfamiliar with this field and a lot of its functionality might be removed or clumped together to prevent confusion. I am under the impression that you have turned to this service because you too are somewhat unfamiliar with this field.
Something that may suit your needs better is Response Surface Methodology (RSM), which I have applied to industrial optimisation problems that I think are similar to what you suggest. RSM works best if you can obtain your data through an experimental design such as a Central Composite Design or Box-Behnken design. I suggest you spend some time Googling these terms to get your head around them, I don't think it's an unmanageable burden to learn how to apply these with no prior experience in this area. Because your question is vague, only you can determine if this really is suitable. If you already have the data in an unstructured format, you can still generate an RSM but it is less robust. There are plenty of open-access articles using these techniques but Science Direct is conveniently down at the moment!
Minitab is a software package that will do all the regression and RSM for you. Its strength is that it has a robust GUI and partially reflects Excel so it is far less daunting to get into than something like R. It also has plenty of guides online. They offer a 30 day free trial so it might be worth doing some background reading, collecting the tutorials you need and develop a plan of action before downloading the trial.
Hope that is some help.


text:
Q: Wireless dropping out on a BCM4313 My connection keep dropping out: I have to click on my home wifi-network to disconnect and reconnect to the internet.
I tried to set MTU to 1500 as this post[1] suggest but my wireless keep dropping!
[1] http://mylinuxramblings.wordpress.com/2011/10/16/how-to-stop-ubuntu-11-10-wireless-dropping-out/
The following question did not help me either: How do I stop my ethernet network connection from dropping?
My config is the following, ubuntu11.10 on HP Pavilion dv6, wifi using a WEP key:
$ lspci | grep -i eth
07:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

$ sudo lsmod | grep iwl
nothing

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 2c:27:d7:ad:ed:fd
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          Packets reçus:0 erreurs:0 :0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000
          Octets reçus:0 (0.0 B) Octets transmis:0 (0.0 B)
          Interruption:42 Adresse de base:0x4000

lo        Link encap:Boucle locale
          inet adr:127.0.0.1  Masque:255.0.0.0
          adr inet6: ::1/128 Scope:Hôte
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          Packets reçus:2004 erreurs:0 :0 overruns:0 frame:0
          TX packets:2004 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0
          Octets reçus:149984 (149.9 KB) Octets transmis:149984 (149.9 KB)

wlan0     Link encap:Ethernet  HWaddr 40:2c:f4:02:e6:a8
          inet adr:192.168.0.100  Bcast:192.168.0.255  Masque:255.255.255.0
          adr inet6: fe80::422c:f4ff:fe02:e6a8/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Packets reçus:335223 erreurs:0 :0 overruns:0 frame:0
          TX packets:198348 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000
          Octets reçus:424664317 (424.6 MB) Octets transmis:22730432 (22.7 MB)

    $ sudo lshw -C network

  *-network
       description: Ethernet interface
       product: RTL8111/8168B PCI Express Gigabit Ethernet controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:07:00.0
       logical name: eth0
       version: 06
       serial: 2c:27:d7:ad:ed:fd
       size: 10Mbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half firmware=N/A latency=0 link=no multicast=yes port=MII speed=10Mbit/s
       resources: irq:42 ioport:4000(size=256) memory:c0404000-c0404fff memory:c0400000-c0403fff
  *-network
       description: Wireless interface
       product: BCM4313 802.11b/g/n Wireless LAN Controller
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:0d:00.0
       logical name: wlan0
       version: 01
       serial: 40:2c:f4:02:e6:a8
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=brcmsmac driverversion=3.0.0-12-generic firmware=N/A ip=192.168.0.100 latency=0 link=yes multicast=yes wireless=IEEE 802.11bgn
       resources: irq:17 memory:c4500000-c4503fff

    $ dmesg
[ 9532.203125] wlan0: no IPv6 routers present
[ 9953.253505] ieee80211 phy0: wl_ops_bss_info_changed: qos enabled: false (implement)
[ 9953.253529] ieee80211 phy0: brcmsmac: wl_ops_bss_info_changed: disassociated
[ 9953.253544] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled false, count 1 (implement)
[ 9953.253556] wlan0: deauthenticating from 00:24:d4:6c:a7:60 by local choice (reason=3)
[ 9953.381894] cfg80211: All devices are disconnected, going to restore regulatory settings
[ 9953.381908] cfg80211: Restoring regulatory settings
[ 9953.381989] cfg80211: Calling CRDA to update world regulatory domain
[ 9953.394242] cfg80211: Updating information on frequency 2412 MHz for a 20 MHz width channel with regulatory rule:
[ 9953.394257] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[ 9953.394265] cfg80211: Updating information on frequency 2417 MHz for a 20 MHz width channel with regulatory rule:
[ 9953.394275] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[ 9953.394283] cfg80211: Updating information on frequency 2422 MHz for a 20 MHz width channel with regulatory rule:
[ 9953.394292] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[ 9953.394299] cfg80211: Updating information on frequency 2427 MHz for a 20 MHz width channel with regulatory rule:
[ 9953.394309] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[ 9953.394316] cfg80211: Updating information on frequency 2432 MHz for a 20 MHz width channel with regulatory rule:
[ 9953.394326] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[ 9953.394333] cfg80211: Updating information on frequency 2437 MHz for a 20 MHz width channel with regulatory rule:
[ 9953.394342] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[ 9953.394350] cfg80211: Updating information on frequency 2442 MHz for a 20 MHz width channel with regulatory rule:
[ 9953.394359] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[ 9953.394366] cfg80211: Updating information on frequency 2447 MHz for a 20 MHz width channel with regulatory rule:
[ 9953.394375] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[ 9953.394384] cfg80211: Updating information on frequency 2452 MHz for a 20 MHz width channel with regulatory rule:
[ 9953.394393] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[ 9953.394401] cfg80211: Updating information on frequency 2457 MHz for a 20 MHz width channel with regulatory rule:
[ 9953.394410] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[ 9953.394418] cfg80211: Updating information on frequency 2462 MHz for a 20 MHz width channel with regulatory rule:
[ 9953.394428] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[ 9953.394435] cfg80211: Disabling freq 2467 MHz
[ 9953.394441] cfg80211: Disabling freq 2472 MHz
[ 9953.394447] cfg80211: Disabling freq 2484 MHz
[ 9953.394457] cfg80211: World regulatory domain updated:
[ 9953.394462] cfg80211:     (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[ 9953.394472] cfg80211:     (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 9953.394481] cfg80211:     (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[ 9953.394491] cfg80211:     (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[ 9953.394500] cfg80211:     (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 9953.394509] cfg80211:     (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 9954.078437] wlan0: authenticate with 00:24:d4:6c:a7:60 (try 1)
[ 9954.080078] wlan0: authenticated
[ 9954.080674] wlan0: associate with 00:24:d4:6c:a7:60 (try 1)
[ 9954.084134] wlan0: RX ReassocResp from 00:24:d4:6c:a7:60 (capab=0x411 status=0 aid=1)
[ 9954.084146] wlan0: associated
[ 9954.084733] ieee80211 phy0: wl_ops_bss_info_changed: qos enabled: true (implement)
[ 9954.084753] ieee80211 phy0: brcmsmac: wl_ops_bss_info_changed: associated
[ 9954.084775] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled true, count 0 (implement)
[ 9954.178608] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled true, count 1 (implement)
[ 9964.500026] wlan0: no IPv6 routers present
[10129.310209] psmouse.c: TouchPad at isa0060/serio1/input0 lost sync at byte 4
[10129.315119] psmouse.c: TouchPad at isa0060/serio1/input0 lost sync at byte 1
[10129.316770] psmouse.c: TouchPad at isa0060/serio1/input0 lost sync at byte 1
[10129.318072] psmouse.c: TouchPad at isa0060/serio1/input0 lost sync at byte 1
[10129.324147] psmouse.c: TouchPad at isa0060/serio1/input0 lost sync at byte 4
[10129.324150] psmouse.c: issuing reconnect request
[10295.864340] ieee80211 phy0: wl_ops_bss_info_changed: qos enabled: false (implement)
[10295.864364] ieee80211 phy0: brcmsmac: wl_ops_bss_info_changed: disassociated
[10295.864378] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled false, count 1 (implement)
[10295.864389] wlan0: deauthenticating from 00:24:d4:6c:a7:60 by local choice (reason=3)
[10295.996982] cfg80211: All devices are disconnected, going to restore regulatory settings
[10295.996997] cfg80211: Restoring regulatory settings
[10295.997039] cfg80211: Calling CRDA to update world regulatory domain
[10296.007372] cfg80211: Updating information on frequency 2412 MHz for a 20 MHz width channel with regulatory rule:
[10296.007387] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10296.007395] cfg80211: Updating information on frequency 2417 MHz for a 20 MHz width channel with regulatory rule:
[10296.007405] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10296.007413] cfg80211: Updating information on frequency 2422 MHz for a 20 MHz width channel with regulatory rule:
[10296.007423] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10296.007431] cfg80211: Updating information on frequency 2427 MHz for a 20 MHz width channel with regulatory rule:
[10296.007440] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10296.007448] cfg80211: Updating information on frequency 2432 MHz for a 20 MHz width channel with regulatory rule:
[10296.007458] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10296.007465] cfg80211: Updating information on frequency 2437 MHz for a 20 MHz width channel with regulatory rule:
[10296.007475] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10296.007483] cfg80211: Updating information on frequency 2442 MHz for a 20 MHz width channel with regulatory rule:
[10296.007491] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10296.007497] cfg80211: Updating information on frequency 2447 MHz for a 20 MHz width channel with regulatory rule:
[10296.007506] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10296.007512] cfg80211: Updating information on frequency 2452 MHz for a 20 MHz width channel with regulatory rule:
[10296.007522] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10296.007529] cfg80211: Updating information on frequency 2457 MHz for a 20 MHz width channel with regulatory rule:
[10296.007539] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10296.007547] cfg80211: Updating information on frequency 2462 MHz for a 20 MHz width channel with regulatory rule:
[10296.007556] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10296.007563] cfg80211: Disabling freq 2467 MHz
[10296.007568] cfg80211: Disabling freq 2472 MHz
[10296.007574] cfg80211: Disabling freq 2484 MHz
[10296.007584] cfg80211: World regulatory domain updated:
[10296.007589] cfg80211:     (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[10296.007598] cfg80211:     (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[10296.007608] cfg80211:     (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[10296.007616] cfg80211:     (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[10296.007626] cfg80211:     (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[10296.007635] cfg80211:     (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[10296.673333] wlan0: authenticate with 00:24:d4:6c:a7:60 (try 1)
[10296.675742] wlan0: authenticated
[10296.676405] wlan0: associate with 00:24:d4:6c:a7:60 (try 1)
[10296.679387] wlan0: RX ReassocResp from 00:24:d4:6c:a7:60 (capab=0x411 status=0 aid=1)
[10296.679405] wlan0: associated
[10296.680038] ieee80211 phy0: wl_ops_bss_info_changed: qos enabled: true (implement)
[10296.680059] ieee80211 phy0: brcmsmac: wl_ops_bss_info_changed: associated
[10296.680081] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled true, count 0 (implement)
[10296.772424] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled true, count 1 (implement)
[10306.995486] wlan0: no IPv6 routers present
[10959.473673] ieee80211 phy0: wl_ops_bss_info_changed: qos enabled: false (implement)
[10959.473697] ieee80211 phy0: brcmsmac: wl_ops_bss_info_changed: disassociated
[10959.473711] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled false, count 1 (implement)
[10959.473721] wlan0: deauthenticating from 00:24:d4:6c:a7:60 by local choice (reason=3)
[10959.606133] cfg80211: All devices are disconnected, going to restore regulatory settings
[10959.606148] cfg80211: Restoring regulatory settings
[10959.606171] cfg80211: Calling CRDA to update world regulatory domain
[10959.619338] cfg80211: Updating information on frequency 2412 MHz for a 20 MHz width channel with regulatory rule:
[10959.619353] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10959.619362] cfg80211: Updating information on frequency 2417 MHz for a 20 MHz width channel with regulatory rule:
[10959.619372] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10959.619380] cfg80211: Updating information on frequency 2422 MHz for a 20 MHz width channel with regulatory rule:
[10959.619389] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10959.619397] cfg80211: Updating information on frequency 2427 MHz for a 20 MHz width channel with regulatory rule:
[10959.619407] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10959.619415] cfg80211: Updating information on frequency 2432 MHz for a 20 MHz width channel with regulatory rule:
[10959.619424] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10959.619432] cfg80211: Updating information on frequency 2437 MHz for a 20 MHz width channel with regulatory rule:
[10959.619441] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10959.619450] cfg80211: Updating information on frequency 2442 MHz for a 20 MHz width channel with regulatory rule:
[10959.619459] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10959.619467] cfg80211: Updating information on frequency 2447 MHz for a 20 MHz width channel with regulatory rule:
[10959.619477] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10959.619484] cfg80211: Updating information on frequency 2452 MHz for a 20 MHz width channel with regulatory rule:
[10959.619494] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10959.619502] cfg80211: Updating information on frequency 2457 MHz for a 20 MHz width channel with regulatory rule:
[10959.619510] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10959.619518] cfg80211: Updating information on frequency 2462 MHz for a 20 MHz width channel with regulatory rule:
[10959.619528] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[10959.619536] cfg80211: Disabling freq 2467 MHz
[10959.619541] cfg80211: Disabling freq 2472 MHz
[10959.619547] cfg80211: Disabling freq 2484 MHz
[10959.619557] cfg80211: World regulatory domain updated:
[10959.619563] cfg80211:     (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[10959.619572] cfg80211:     (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[10959.619582] cfg80211:     (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[10959.619591] cfg80211:     (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[10959.619600] cfg80211:     (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[10959.619609] cfg80211:     (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[10960.289297] wlan0: authenticate with 00:24:d4:6c:a7:60 (try 1)
[10960.290935] wlan0: authenticated
[10960.291233] wlan0: associate with 00:24:d4:6c:a7:60 (try 1)
[10960.294306] wlan0: RX ReassocResp from 00:24:d4:6c:a7:60 (capab=0x411 status=0 aid=1)
[10960.294317] wlan0: associated
[10960.294932] ieee80211 phy0: wl_ops_bss_info_changed: qos enabled: true (implement)
[10960.294953] ieee80211 phy0: brcmsmac: wl_ops_bss_info_changed: associated
[10960.294974] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled true, count 0 (implement)
[10960.352994] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled true, count 1 (implement)
[10970.495396] wlan0: no IPv6 routers present
[11087.098762] thunderbird-bin[21454]: segfault at 47a2f968 ip 00007f8d4e101c08 sp 00007fff100b9600 error 4 in libX11.so.6.3.0[7f8d4e0cc000+133000]
[11121.347726] ieee80211 phy0: wl_ops_bss_info_changed: qos enabled: false (implement)
[11121.347751] ieee80211 phy0: brcmsmac: wl_ops_bss_info_changed: disassociated
[11121.347764] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled false, count 1 (implement)
[11121.347772] wlan0: deauthenticating from 00:24:d4:6c:a7:60 by local choice (reason=3)
[11121.458090] cfg80211: All devices are disconnected, going to restore regulatory settings
[11121.458106] cfg80211: Restoring regulatory settings
[11121.458159] cfg80211: Calling CRDA to update world regulatory domain
[11121.466926] cfg80211: Updating information on frequency 2412 MHz for a 20 MHz width channel with regulatory rule:
[11121.466931] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[11121.466934] cfg80211: Updating information on frequency 2417 MHz for a 20 MHz width channel with regulatory rule:
[11121.466937] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[11121.466939] cfg80211: Updating information on frequency 2422 MHz for a 20 MHz width channel with regulatory rule:
[11121.466942] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[11121.466945] cfg80211: Updating information on frequency 2427 MHz for a 20 MHz width channel with regulatory rule:
[11121.466947] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[11121.466950] cfg80211: Updating information on frequency 2432 MHz for a 20 MHz width channel with regulatory rule:
[11121.466953] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[11121.466955] cfg80211: Updating information on frequency 2437 MHz for a 20 MHz width channel with regulatory rule:
[11121.466958] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[11121.466960] cfg80211: Updating information on frequency 2442 MHz for a 20 MHz width channel with regulatory rule:
[11121.466963] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[11121.466966] cfg80211: Updating information on frequency 2447 MHz for a 20 MHz width channel with regulatory rule:
[11121.466969] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[11121.466971] cfg80211: Updating information on frequency 2452 MHz for a 20 MHz width channel with regulatory rule:
[11121.466974] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[11121.466976] cfg80211: Updating information on frequency 2457 MHz for a 20 MHz width channel with regulatory rule:
[11121.466979] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[11121.466982] cfg80211: Updating information on frequency 2462 MHz for a 20 MHz width channel with regulatory rule:
[11121.466985] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[11121.466987] cfg80211: Disabling freq 2467 MHz
[11121.466989] cfg80211: Disabling freq 2472 MHz
[11121.466990] cfg80211: Disabling freq 2484 MHz
[11121.466993] cfg80211: World regulatory domain updated:
[11121.466994] cfg80211:     (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[11121.466997] cfg80211:     (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[11121.467000] cfg80211:     (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[11121.467003] cfg80211:     (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[11121.467005] cfg80211:     (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[11121.467008] cfg80211:     (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[11122.126757] wlan0: authenticate with 00:24:d4:6c:a7:60 (try 1)
[11122.128357] wlan0: authenticated
[11122.128949] wlan0: associate with 00:24:d4:6c:a7:60 (try 1)
[11122.132048] wlan0: RX ReassocResp from 00:24:d4:6c:a7:60 (capab=0x411 status=0 aid=1)
[11122.132061] wlan0: associated
[11122.132665] ieee80211 phy0: wl_ops_bss_info_changed: qos enabled: true (implement)
[11122.132692] ieee80211 phy0: brcmsmac: wl_ops_bss_info_changed: associated
[11122.132717] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled true, count 0 (implement)
[11122.209770] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled true, count 1 (implement)
[11133.139251] wlan0: no IPv6 routers present
[12443.067973] thunderbird-bin[21693]: segfault at 4432f968 ip 00007fed4a977c08 sp 00007fffd1700aa0 error 4 in libX11.so.6.3.0[7fed4a942000+133000]
[12860.796445] ieee80211 phy0: wl_ops_bss_info_changed: qos enabled: false (implement)
[12860.796495] ieee80211 phy0: brcmsmac: wl_ops_bss_info_changed: disassociated
[12860.796510] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled false, count 1 (implement)
[12860.796522] wlan0: deauthenticating from 00:24:d4:6c:a7:60 by local choice (reason=3)
[12860.928592] cfg80211: All devices are disconnected, going to restore regulatory settings
[12860.928608] cfg80211: Restoring regulatory settings
[12860.928619] cfg80211: Calling CRDA to update world regulatory domain
[12860.938395] cfg80211: Updating information on frequency 2412 MHz for a 20 MHz width channel with regulatory rule:
[12860.938410] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[12860.938419] cfg80211: Updating information on frequency 2417 MHz for a 20 MHz width channel with regulatory rule:
[12860.938428] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[12860.938436] cfg80211: Updating information on frequency 2422 MHz for a 20 MHz width channel with regulatory rule:
[12860.938445] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[12860.938454] cfg80211: Updating information on frequency 2427 MHz for a 20 MHz width channel with regulatory rule:
[12860.938464] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[12860.938472] cfg80211: Updating information on frequency 2432 MHz for a 20 MHz width channel with regulatory rule:
[12860.938482] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[12860.938490] cfg80211: Updating information on frequency 2437 MHz for a 20 MHz width channel with regulatory rule:
[12860.938500] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[12860.938507] cfg80211: Updating information on frequency 2442 MHz for a 20 MHz width channel with regulatory rule:
[12860.938516] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[12860.938522] cfg80211: Updating information on frequency 2447 MHz for a 20 MHz width channel with regulatory rule:
[12860.938532] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[12860.938538] cfg80211: Updating information on frequency 2452 MHz for a 20 MHz width channel with regulatory rule:
[12860.938548] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[12860.938557] cfg80211: Updating information on frequency 2457 MHz for a 20 MHz width channel with regulatory rule:
[12860.938565] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[12860.938572] cfg80211: Updating information on frequency 2462 MHz for a 20 MHz width channel with regulatory rule:
[12860.938580] cfg80211: 2402000 KHz - 2472000 KHz @  KHz), (300 mBi, 2700 mBm)
[12860.938586] cfg80211: Disabling freq 2467 MHz
[12860.938591] cfg80211: Disabling freq 2472 MHz
[12860.938596] cfg80211: Disabling freq 2484 MHz
[12860.938605] cfg80211: World regulatory domain updated:
[12860.938610] cfg80211:     (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[12860.938618] cfg80211:     (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[12860.938627] cfg80211:     (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[12860.938636] cfg80211:     (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[12860.938645] cfg80211:     (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[12860.938653] cfg80211:     (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[12861.604995] wlan0: authenticate with 00:24:d4:6c:a7:60 (try 1)
[12861.606814] wlan0: authenticated
[12861.607309] wlan0: associate with 00:24:d4:6c:a7:60 (try 1)
[12861.610404] wlan0: RX ReassocResp from 00:24:d4:6c:a7:60 (capab=0x411 status=0 aid=1)
[12861.610415] wlan0: associated
[12861.611046] ieee80211 phy0: wl_ops_bss_info_changed: qos enabled: true (implement)
[12861.611067] ieee80211 phy0: brcmsmac: wl_ops_bss_info_changed: associated
[12861.611089] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled true, count 0 (implement)
[12861.687610] ieee80211 phy0: wl_ops_bss_info_changed: arp filtering: enabled true, count 1 (implement)
[12872.562747] wlan0: no IPv6 routers present
[12955.317191] psmouse.c: TouchPad at isa0060/serio1/input0 lost sync at byte 1
[12955.318831] psmouse.c: TouchPad at isa0060/serio1/input0 lost sync at byte 1
[12955.330146] psmouse.c: TouchPad at isa0060/serio1/input0 - driver resynched.

Edit: Trying How do I get my Broadcom BCM4313 working correctly?
$ lsmod | grep brc
brcmsmac              631693  0
brcmutil               17837  1 brcmsmac
mac80211              310872  1 brcmsmac
cfg80211              199587  2 brcmsmac,mac80211
crc_ccitt              12667  1 brcmsmac

A: I am somewhat confused; from the output of lshw -C network it seems you were already using brcmsmac driver before the edit:
   product: BCM4313 802.11b/g/n Wireless LAN Controller
   vendor: Broadcom Corporation
   [snip]
   configuration: broadcast=yes driver=brcmsmac [snip]

If it is so, you should try the binary Broadcom STA driver, which sometimes work quite better than this post suggests. You can install it using jockey-gtk (or Additional Drivers in menu) or with
sudo apt-get install bcmwl-kernel-source

You can check what driver is being used from NetworkManager menu (under Connection information) or again with lshw - STA driver is called wl so lshw should return driver=wl (or wl0) instead of driver=brcmsmac. lsmod isn't much of use here because both drivers can be loaded.

A: This works for me http://drndivoje.wordpress.com/2011/07/31/how-to-enable-broadcom-wireless-bcm4311-card-on-linux-mint-11/


text:
Q: 2 ordered pairs are equal if and only if the 1st sets in each are equal, and the 2nd sets in each are equal? Say $\langle a,b \rangle = \langle c,d \rangle$ if and only if $(a=c) \land (b=d)$
Does this mean that if there are 2 distinct pairs of equal sets joined by and, they must be ordered?
If so, does this mean the 1st pair of sets in the and statement has to come 1st in the ordered pair?
If so, why does the 1st equal set come first and not the second?
It's my understanding that $a \land b = b \land a$, which the above statement is making me reconsider.

A: Yes, an ordered pair is designed to be ordered: the first (left) and second (right) element play different roles. If $a \neq b$ then $\langle a,b\rangle \neq \langle b,a \rangle$. The clause just defines a criterion to check for equality of two pairs: how to check that pairs are equal.
So $(a=c) \land (b=d)$ also implies $\langle b,a\rangle = \langle d,c\rangle$, as we have the same criterion to check in both cases.


text:
Q: Why javascript typeof returns always "object" Where am I doing wrong?
I would wait "Class" as a result of this code but it doesn't:

This is from object function:

A: Tyepof doesnt work like that, it only returns built in types. You could try:
this.constructor.name==="Class";

It will check all the way up the prototype chain to see if this or any prototype of this is Class. So if OtherType.prototype=Object.create(Class); then it'll be true for any OtherType instances. Does NOT work in < IE9
or
this instanceof Class

But that will not check the entire prototype chain.
Here is a list of return values typeof can return
Here is an answer about getting the type of a variable that has much more detail and shows many ways it can break.

A: Because JavaScript knows only the following types :
Undefined - "undefined"
Null - "object"
Boolean - "boolean"
Number - "number"
String - "string"
Host object (provided by the JS environment) - Implementation-dependent
Function object (implements [[Call]] in ECMA-262 terms) - "function"
E4X XML object - "xml"
E4X XMLList object - "xml"
Any other object - "object"
You can find more here
Read this thread to find how you can get the object name

A: object.constructor.name will return constructor's name. Here is an example:
function SomeClass() {
    /* code */
}
var obj = new SomeClass();
// obj.constructor.name == "SomeClass"

Be aware that you need to use named functions, if you assign anonymous functions to variables, it will be an empty string...
var SomeClass = function () {
    /* code */
};
var obj = new SomeClass();
// obj.constructor.name == ""

But you can use both, then the named function's name will be returned
var SomeClassCtor = function SomeClass() {
    /* code */
};
var obj = new SomeClassCtor();
// obj.constructor.name == "SomeClass"

A: You may try this as well
function getType(obj){
    if (obj === undefined) { return 'undefined'; }
    if (obj === null) { return 'null'; }
    return obj.constructor.name || Object.prototype.toString.call(obj).split(' ').pop().split(']').shift().toLowerCase();
}

An Example Here.
function MyClass(){}
console.log(getType(new MyClass)); // MyClass
console.log(getType([])); // Array
console.log(getType({})); // Object
console.log(getType(new Array)); // Array
console.log(getType(new Object)); // Object
console.log(getType(new Date)); // Date
console.log(getType(new Error));  // Error


text: Q: How to place Items when converting from Figma to code? I'm new to figma , and sometimes when I look at a figma design there are elements which should be placed in grid or flexbox , but by doing so sometimes the design is not 100% accurate , do you set all the elements as "absolute" position so you can have that perfect positioning ? , and if so how that plays out when you try to make the webpage responsive ?


text:
Q: Undesired drag and drop behaviour with JTable I am attempting to add drag-and-drop functionality to my application, whereby the originator of the drag event is a JTable.  I am currently using the built-in drag support JTable offers by calling setDragEnabled(true).
The problem I'm facing is that in order to commence a drag operation, one has to first click on a row of the table, and then release the mouse; it is only the second mouse press (and all subsequent mouse presses) that generate drag events.  This occurs even if the JTable loses focus - i.e. Once the first left-click operation has been performed, drag-and-drop works perfectly until I swap in a new TableModel.  When new model has been installed one needs to perform a left-click on the table before drags start working again.
Reading the API documentation for setDragEnabled(boolean) the implication is that this is the L&F's responsibility and hence there may not be anything I can do to solve this.  Does anyone have any suggestions?  I am using the Alloy L&F but would be reluctant to change it.

A: I discovered a hacky solution, which was to add a MouseListener to the JTable and hook into the TransferHandler's exportAsDrag method when the mouse is pressed:
    final JTable actionTbl = new JTable();
    actionTbl.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent evt) {
            // Need to explicitly start a drag operation when the mouse is pressed.
            // Otherwise drags are only started *after* the user has clicked once
            // on the JTable (this could be down to the L&F not doing the right thing).
            actionTbl.getTransferHandler().exportAsDrag(actionTbl, evt, TransferHandler.COPY);
        }
    });

A: Quote from the javadoc of the setDragEnabled method

When automatic drag handling is enabled, most look and feels (including those that subclass BasicLookAndFeel) begin a drag and drop operation whenever the user presses the mouse button over an item (in single selection mode) or a selection (in other selection modes) and then moves the mouse a few pixels.

If I read this correctly, you should get the desired behavior when you use single selection mode.
If you need that behavior combined with multiple selection, you could opt to manually handle the incoming mouse events on the table, and on mouse_down adjust the selection and then delegating the mouse event to the JTable. So in pseudo-code:
protected void processEvent(AWTEvent e) {
  if ( isMouseDownEvent( e ) ){
     adjustSelection( e );
  }
  super.processEvent( e );
}

Note: I haven't tested this. It is solely based on what I read in the javadoc, and might have some unwanted side-effects as the JTable itself will still handle the event and react on it

A: Adamski's solution works really well, but I had to change TransferHandler.COPY in the last line to TransferHandler.MOVE in order for it to work:
final JTable actionTbl = new JTable();
actionTbl.addMouseListener(new MouseAdapter() {
    @Override
    public void mousePressed(MouseEvent evt) {
        actionTbl.getTransferHandler().exportAsDrag(actionTbl, evt, TransferHandler.MOVE);
    }
});


text:
Q: Is there any way to install RMongo package as its officially removed from CRAN? I need to install RMongo to connect to my local MongoDB database. On installing RMongo I am getting this error:
Warning in install.packages :
  package 'RMongo' is not available (for R version 3.5.3)

I also downloaded RMongo tar file and stored in R directory where all packages get installed and tried to install the package by writing this command in R environment
install.packages("C:/Users/Akash/Documents/R/win-library/3.5/RMongo_0.0.25.tar", repos = NULL, type="source")

On trying to download the package through tar file I am getting this error,
Warning: invalid package 'C:/Users/Akash/Documents/R/win-library/3.5/RMongo_0.0.25.tar'
Error: ERROR: no packages specified
In R CMD INSTALL
Warning in install.packages :
  installation of package 'C:/Users/Akash/Documents/R/win-library/3.5/RMongo_0.0.25.tar' had non-zero exit status
Any help is appreciated
Thanks in Advance


text:
Q: HikariCP with grails 5 not works I'm trying to integrate HikariCP DB connection pool to new Grails 5.2.4 application (based on spring boot 2.7) without any success.
For grails 3 & 4 it works from the box: just add dependancy to build.gradle and double check dataSource.pooled property (have to be true)
  implementation 'mysql:mysql-connector-java:8.0.22'
  implementation 'com.zaxxer:HikariCP:5.0.1'

But with version 5 of grails happance nothing. I don't see any log messages, debugger not stopping on HikariDataSource constructor breackpoints.
Any ideas?


text:
Q: Scrollview animation not smooth (objective-C) I am trying to scroll my scroll view up when the textFieldDidBeginEditing delegate method is called.  It works, but there is one buggy issue.  On the FIRST call of the method (when the user taps the textview for the FIRST time, the animation is not smooth, and instantaneous jumps to the topPoint.  Every animation afterwards is smooth.  Why is the first animation not smooth like the other ones?  Am I missing something?
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
    CGPoint topPoint;
    topPoint = CGPointMake(0, 200);
    [self.scrollView setContentOffset:topPoint animated:YES];
}

A: This only happens when the debugger is plugged in.  It even causes audio glitches too, I lost hours toiling over it and even filed a radar for no reason :|


text:
Q: jNavigate refresh current page I am using Jquery jNavigate plugin and everything works well. Except at some point from  my other part of the JS code I want to be able to refresh content that is currently displayed in the container. How can I achieve this?
Here is what I've done.
I have one container for content that should be displayed via AJAX:

Then I initialize jNavigate plugin on it
$('#container').jNavigate({
        spinner: 'img/loading_icon.gif',
        extTrigger: '.jnav-ext',
        intTrigger: '.jnav-int'});

And I have several links that work with jNavigate:
Home
About

So everything works well except I can't refresh current content. Plugin itself has navigate() method inside. So how can I call that method from outside to refresh the contents in the container (refresh same page)?

A: I figured out it myself. Here is correct answer:
$('#container').jNavigate("navigate", {url: window.location.href});

Invoke this from whenever you want to reload current page in #container which is initially loaded via jNavigate.


text:
Q: What does registry setting EnableLinkedConnections do on a technical level? Note: the base problem for me is to be able to access a network share that I (Win 7 admin user) have set up when I run an elevated program. Normally the elevated program will not have access to my non-elevated network shares.
According to Microsoft the registry setting EnableLinkedConnections will allow elevated processes to access the network share of the currently logged in (non-elevated) explorer process.
This explanation makes some sense:

[...] When you're a member of the
  Administrators group and you log in,
  your account is busted down to a
  non-privileged user by UAC. This
  running context is completely separate
  from the context you get when you
  right-click Command Prompt and launch
  as an administrator. As you'll
  probably have noticed, network drives
  connected in one context are not
  visible in the other. [...]

This forum thread asks about the vulnerabilities opened by this setting. The answer given links to an article about disabling UAC prompts (or so I understand).
The question now is, what does the registry setting EnableLinkedConnections do or allow on a Windows 7 system, given that we are not running in a domain environment.

Edit: One thing that I'm specifically interested in is whether this setting only affects the (visibility of) network drives or whether it has any other implications.

A: Not having source access to Windows it's difficult to say anything that isn't speculation. That disclaimer aside, here's what I've been able to glean by reading up on this:
UAC creates two security tokens on logon: the elevated token containing the user's full group memberships, and the restricted token which has membership of the "Administrators" group stripped out. Each token contains a distinct locally unique ID (LUID) that identifies the logon session. They are two separate and distinct logon sessions.
Starting in Windows 2000 Server SP2, mapped drives (which are represented as symlinks in the object manager namespace) are tagged with the LUID of the token that created them (you can find some Microsoft references to this behavior in this KBase article, and you can learn more about the mechanics of the feature in this blog posting). The gist of the feature is that mapped drives created by one logon session are not accessible to another logon session.
Setting the EnableLinkedConnections value triggers a behaviour in the LanmanWorkstation service and the LSA security subsystem (LSASS.EXE) to cause LSA to copy drives mapped from by either one of the users' tokens into the context of the other token. This allows drives mapped with the elevated token to be visible to the restricted token and the converse. There isn't any peculiarity of the behavior of this feature w/ respect to a domain versus non-domain environment. If your users are running with "Administrator" accounts in a non-domain environment their restricted tokens and elevated tokens, by default, will have independent drive mappings.
In terms of vulnerabilty, official documentation from Microsoft seems to be lacking. I did find a comment and a response from a Microsoft employee asking about the potential vulnerabilities in a conversation about UAC from 2007. Given that the answer comes from Jon Schwartz, who, at the time, was titled "UAC Architect", I'd tend to consider his answer having credibility. Here's the gist of his answer to the following inquiry: "...I have not found any information to describe what is actually happening technically or if this opens any kind of UAC loopholes.  Can you comment?"

 Technically, it opens a small loophole since non-elevated malware can now "pre-seed" a drive letter + mapping into the elevated context -- that should be low-risk unless you end up with something that's specifically tailored to your environment.

Personally, I can't think of a way to "exploit" this loophole, insofar as "seeding" the elevated token with a drive mapping would still require the user to actually elevate and execute something malicious from that "seeded" drive mapping. I'm not a security researcher, though, and I may not be approaching this with a good mind-set to come up with potential exploits.
I've dodged using the EnableLinkedConnections value in my Customer sites by continuing the trend that we began when Customers started deploying Windows NT 4.0-- having users logon with limited user accounts. That's worked well for us for years and continues to work well in Windows 7.

A: Simply put, it links your super-user credentials with your normal credentials. It is of course more complex, but basically, even your "administrator" account on windows 7 is not an admin, but needs to do the equivalent of SUDO on linux to perform a multitude of operations. When you map a network drive, you need to do this, but the network drive only becomes mapped for the super-user, not the normal user. This registry setting links the super-user credentials with your standard ones for the purpose of mapped drives. This way, both can access the mapped drive instead of just the super-user.

A: Declare: I know this is a question from 2010 but I still try to add more details. I'm still new to Stack Exchange community. This answer adds details to Evan Anderson's answer.

Personally, I can't think of a way to "exploit" this loophole, insofar as "seeding" the elevated token with a drive mapping would still require the user to actually elevate and execute something malicious from that "seeded" drive mapping.

For example, a program on network drive was to run as admin, in order to achieve this, you must schedule two things: mount the network directory as drive in admin session, assuming it was Z:; run the program from network drive, assuming it was Z:\daemon.exe.
By enabling EnableLinkedConnections a very specifically made malware could unmount Z:\ and replace it with another network drive with a dangerous daemon.exe file, and Windows will continue executing it since it's stored within local area and aren't enforced by internet security zone settings (MOTW). Were it remaining disabled, the replaced Z: drive won't have been affecting the admin session therefore ensuring security.
It's a very targeted security risk uncommonly seen nowadays because:

*

*You use a network drive for priority tasks which is extremely uncommon, priority tasks usually use UNC path to avoid problem across sessions, it means that the program isn't well designed to utilize UNC path (usually seen on very ancient software and Microsoft's very ancient CMD).

*Attacker has to know which program you're running on network drive with UAC priority, which means attacker already mastered how your computer system works, but who has the chance of knowledge that? A stranger won't be that bored to spy on your computer 24 * 7, perhaps someone with physical access to your computer.

*Attacker has to create a fake one that doesn't trigger security software. Despite bypassing MOTW flag, modern Windows usually run security software, most people don't care it so it's default to Windows Defender.

*And finally, in case the device is in managed environment, unless attacker exploited a vulnerability to run that mount program, it also means the security policy is likely to be poorly made because untrusted code shouldn't have run on managed devices by users.

The same attack surface applies to symbolic link too, which is why creation of symbolic link requires UAC priority by default until Windows 10 Creators Update. The removal of UAC priority requirement gives the signal that it's no longer a dangerous security breach everyone should avoid, although system administrators may still configure this in group policy if needed.
Edit: word changes


text:
Q: Set half of the filters of a layer as not trainable keras/tensorflow I'm trying to train a model suggested by this research paper where I set half of the filters of a convolution layer to Gabor filters and the rest are random weights which are initialized by default. Normally, if I have to set a layer as not trainable, I set the trainable attribute as False. But here I have to freeze only half of the filters of a layer and I have no idea how to do so. Any help would be really appreciated. I'm using Keras with Tensorflow backend.

A: How about making two convolutional layers which are getting the same input and (nearly) the same parameters? So one of them is trainable wir random weights at initialization and the other layer is non trainable with the gabor filters.
You could then merge the outputs of the two layers together in a way that it looks like it's the output from one convolutional network.
Here is an example for demonstration (you need to use Keras functional API):
n_filters = 32

my_input = Input(shape=...)
conv_freezed = Conv2D(n_filters/2, (3,3), ...)
conv_trainable = Conv2D(n_filters/2, (3,3), ...)

conv_freezed_out = conv_freezed(my_input)
conv_trainable_out = conv_trainable(my_input)
conv_out = concatenate([conv_freezed_out, conv_trainable_out])

# set weights and freeze the layer
conv_freezed.set_weights(...)
conv_freezed.trainable = False


text:
Q: Setting c++11 std for gcc in solaris 11 I am trying to install cmake on solaris machine by building its source code. In  one of the steps we need to do "make" to build the source code. When I do a make I am getting below error
/json_reader.cpp:35:18: error: 'snprintf' is not a member of 'std'
#define snprintf std::snprintf

This indicates that code is using c++11 std but gcc compiler uses c++98 std. I have gcc version 4.8.2 (GCC) in the solaris machine. As per my knowledge make is wrapper over gcc.
Question is: How to set CFLAGS for gcc globally so that when I do a "make" it directly uses c++ 11 std.


text:
Q: Remote being automatically added in main project folder this is my problem.

*

*I create a new directory and set the remote to my new repo on GitHub

*I add and stage my files

*I push my files up but it adds all my other folders from another directory
When I push my files up from a new directory it is  adding that remote to my main and pushing my files up from my main directory. I subsequently REMOVE the remote added in my main directory. However, it keeps on re-adding the remote to my main everytime I create a new directory, create the new remote and push files up.
I honestly have tried almost every command to solve this.

A: I was forgetting to run 'git init' :facepalm


text:
Q: setCustomValidity message styles on multiple lines I am new to HTML. I am able to show custom message for html input field as mentioned at here
However, I want to show message on multiple lines e.g.
Message title:
    1. option 1 text
    2. option 2 text

I tried to insert br tag to message, but it is not working.
My code looks like as below:
<div class="col-6">
    <input class="form-control" type="url" name="test_url" id="test_url" required="required" pattern="my_custom_url_pattern_goes_here" oninvalid="this.setCustomValidity('URL must be in one of the following format:\nFirst url example\nAnother url example')" oninput="setCustomValidity('')">
</div>

How can I achieve this?


text:
Q: JSF or MVC with Servlets/JSPs or other frontend frameworks? I'm working on development of a social web application using Java. I need to develop the frontend/GUI of my application for web browsers.
I'm wondering  what is the better strategy to do frontend development, whether using frameworks like JSF 2.0 & like  OR  simply following MVC approach with servlets and JSPs ?
As I have heard JSF really makes the development simpler but also the learning curve is not too low, so is it worth learning JSF or I should prefer to directly proceed with servlets/JSPs ?
I'm new to web applications development using Java & I've almost completed writing the business logic for the application.
Please justify your answer on the basis of following parameters:

*

*Performance & costs

*Ease of Development & Time (considering the learning time as well)

*Future Maintenance of code

*Any other parameters you consider important

Update (07-09-2012):
I finally  went with JSF-2.0 & have no regrets till date. Learning curve is not steep. It's easier & development is fast with component libraries like Primefaces. There are some costs as to state saving but those things can be handled intelligently. Community is big & things are well documented now. Hopefully, in near future Stateless JSF is also coming which will boost JSF with extra high performance.

A: For a hobby webapp, homebrewing some MVC framework is not bad. It's a nice learning exercise tour. However, it will bite you on the long term, for sure if you publish on the web and it becomes popular. Most of existing MVC frameworks are very well thought out. Most of the unforeseen caveats are taken into account. The sole framework API is well maintained and documented by a third party.
Also, whenever your webapp becomes popular and you need more developers to work on it to fulfill the enduser requirements/wishes, it's easier to find someone who's already familiar with an existing framework. With a homebrewed and possibly buggy MVC framework, you'll likely find less developers who are eager enough to dive into another learning curve before taking over the maintenance which they'll probably never reapply on their future jobs/projects.
This does not specifically apply on JSF, but on every other existing and popular MVC framework as well, such as Spring MVC. As to JSF in general, well, I've written a lot about it before here. Here are some good starting points to read the one and other about it:

*

*JSF versus plain HTML/CSS/JS

*JSF adoption and popularity

*What are the disadvantages of JSF 2.0?

A: For modern web apps like yours, and if your responsibility is the UI, you really don't want any "abstraction layer" stand between you and your html/css/javascript. Don't use any "component" framework.

I have heard JSF really makes the development simpler

Did you hear that from real webapp developers who actually used JSF in real products? Or just JSF committee patting their own backs? Or some old timers' wishful thinking that they don't need to learn the darn javascript?
If you choose JSF, please report your experience back to us after you shoot yourself out of frustration.

A: It's better use some MVC framework.
You can use either component based framework:
*

*JSF = mostly standard, but its hard to learn and a lot of people don't like it
*Tapestry = quite big and probably good framework

*Wicket, GWT - smaller component based frameworks, handy, powerful, smart, but I haven't  used them yet
Or you can use request oriented framework.
*

*Spring MVC, Struts 2 = They are very similar. Spring MVC have probably better documentation

*Struts - I do NOT recommend this, when you can use Struts 2, or Spring MVC - you can trust me in this point

Each framework have its pro-and-con it depend on situation and your knowledge. I cannot give you single-valued answer.

A: You might want to consider Tapestry 5 if you're exploring options. We've been happily using it for many years on a large project in the social media space. It's an easy to use MVC framework that's component based. We're able to develop rapidly with it, especially now that we've built up a lot of our building blocks.
Learning time is probably on par with ramping up on any new framework. I'd perhaps say it's less than JSF and more than Spring MVC, though it really depends on what you're already familiar with and how deeply you use things. I put together a very small project on github a while back to get started with Tapestry 5 quickly, if you're interested it's tapstack.
As for long term use of a Tapestry based application, it has served us well. Maintenance of the code has been much better than when were using JSP. It's very stable as well. We've served billions of page views through Tapestry without any major problems.
On the downside it is less common than some other web frameworks. It is definitely a little different too. We feel it's worth it though, and refreshing to work with. Ultimately it's going to depend on what you need and what you feel works best for you. Best of luck with your decision.

A: Spring MVC is very easy to learn and if you have a simple web app and you want to save your time, its better than JSF.
However if your web app is not so simple, JSF beats Spring MVC by far. Its model is more complicated, but it is much better structured and it is widely supported, so that you don't have to reinvent the wheel again in most of the cases. Complex gui can done with JSF with less effort.


text:
Q: html_entity_decode not decoding ASCII Heres my code:
$string = '&#73&#116';
$string = html_entity_decode($string);
echo $string;

It should be echoing "It", but its just echoing the ASCII codes. Am I using the wrong function? I also tried htmlspecialchars_decode and it changes nothing.

A: Those are not valid entities Actually, they are valid in HTML 4 (and I suppose HTML5 too), but in this case the entities need to be semicolon-terminated for PHP to recognize them:
$string = 'It';

htmlspecialchars_decode() only decodes <, >, &, ' and " (and the last two depend on the quotes flag).


text:
Q: How to interactively parse a struct an enum in rust, ideally using clap Okay here is an example of what I want to accomplish. I have a rigid, and complicated enum that must be parsed. The structure of the enum cant be changed.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema, Subcommand)]
#[serde(rename_all = "snake_case")]
pub enum Msg {
    SetConfig {
        set_config_msg: AnotherEnum,
    },
    AddAsset {
        asset_info_type: MyStruct,
    },
    AddNums {
        num_1: u8,
        num_2: u8
    }
}

pub struct MyStruct {
    string0: String,
    string1: String
}

pub struct AnotherEnum {
    Variant0,
    Variant1(MyStruct),
}

for now you can imagine AnotherEnum and SomeStruct are any arbitrary enum and struct. What I would like is to interactively go through every single field here and get user input. It would look like this:
>>> my-cli set_config
Enter set_config_msg (Variant0 or Variant1)
>>> Variant1
Enter string0:
>>> Hello
Enter string1:
>>> World
Done

Any info is super helpful. Looking for some guidance. For context I am building a very general CLI that other people will have to use with totally different structs and enums. I'm hoping the macros in Clap will be enough to get me what I need. I can't change the structure of the Msg enum, but I can add derive macros etc.


text:
Q: Docker compose command error when running python I am running docker container with
version: "3"

services:
  mysql:
    container_name: ammd_db_mysql
    image: hellojaeho/mysql:test2
    ports:
      - ${MYSQL_PORT}:3306
    volumes:
      - ./mysql/mysql:/var/lib/mysql
      - ./mysql/system_config:/system_config
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
    restart: on-failure
    command: python3 /system_config/initialfunc.py

which runs image that is built from mysql:5.7 image
RUN /bin/sh -c apt-get update -y
RUN /bin/sh -c apt-get install python3 -y
RUN /bin/sh -c apt-get install python3-pip -y
RUN /bin/sh -c pip3 install mysql-connector

when I run the container without command: python3 /system_config/initialfunc.py, and run in CLI,
>> docker exec -it ammd_db_mysql bin/bash
root@df30c7777f8b:/# python3 /system_config/initialfunc.py

the code works well. However, when I run the container with the command running this code, I receive this message.
ammd_db_mysql  | 1
ammd_db_mysql  | Traceback (most recent call last):
ammd_db_mysql  |   File "/usr/local/lib/python3.7/dist-packages/mysql/connector/network.py", line 509, in open_connection
ammd_db_mysql  |     self.sock.connect(sockaddr)
ammd_db_mysql  | ConnectionRefusedError: [Errno 111] Connection refused
ammd_db_mysql  |
ammd_db_mysql  | During handling of the above exception, another exception occurred:
ammd_db_mysql  |
ammd_db_mysql  | Traceback (most recent call last):
ammd_db_mysql  |   File "/system_config/initialfunc.py", line 12, in <module>
ammd_db_mysql  |     con_Mysql = sql.connect(host="localhost", user="root", password="asdf")
ammd_db_mysql  |   File "/usr/local/lib/python3.7/dist-packages/mysql/connector/__init__.py", line 179, in connect
ammd_db_mysql  |     return MySQLConnection(*args, **kwargs)
ammd_db_mysql  |   File "/usr/local/lib/python3.7/dist-packages/mysql/connector/connection.py", line 95, in __init__
ammd_db_mysql  |     self.connect(**kwargs)
ammd_db_mysql  |   File "/usr/local/lib/python3.7/dist-packages/mysql/connector/abstracts.py", line 716, in connect
ammd_db_mysql  |     self._open_connection()
ammd_db_mysql  |   File "/usr/local/lib/python3.7/dist-packages/mysql/connector/connection.py", line 206, in _open_connection
ammd_db_mysql  |     self._socket.open_connection()
ammd_db_mysql  |   File "/usr/local/lib/python3.7/dist-packages/mysql/connector/network.py", line 512, in open_connection
ammd_db_mysql  |     errno=2003, values=(self.get_address(), _strioerror(err)))
ammd_db_mysql  | mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (111 Connection refused)
ammd_db_mysql exited with code 1

I searched for the error mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (111 Connection refused) and I checked my.cnf file. However, the bind-address is already closed.
root@28a9ae96446f:/# cat /etc/mysql/my.cnf
# Copyright (c) 2016, 2021, Oracle and/or its affiliates.
# :
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

root@28a9ae96446f:/etc/mysql/mysql.conf.d# cat mysqld.cnf
# Copyright (c) 2014, 2021, Oracle and/or its affiliates.
# :
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
#log-error      = /var/log/mysql/error.log
# By default we only accept connections from localhost
#bind-address   = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

My python code is:
import mysql.connector as sql
from mysql.connector.locales.eng import client_error
import os
import subprocess
import crypt
import json

if __name__ == "__main__":
    i = 1

    print(i);i += 1
    con_Mysql = sql.connect(host="localhost", user="root", password="asdf")
    print(i);
    i += 1
    cursor = con_Mysql.cursor()
    print(i);
    i += 1
    databases = ("show databases")
    cursor.execute(databases)
    database_list = [databases[0] for (databases) in cursor]

Can you help me to find the way to run the python code during the compose up?
#I added the command mentioned as the comment, This is what I got
version: "3"

services:
  mysql:
    container_name: ammd_db_mysql
    image: hellojaeho/mysql:test2
    ports:
      - ${MYSQL_PORT}:3306
    volumes:
      - ./mysql/mysql:/var/lib/mysql
      - ./mysql/system_config:/system_config
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
    restart: on-failure
    command: "apt update && apt install net-tools && netstat -tulnp"


text:
Q: Remove welcome screen from Live USB? I created a Live Ubuntu 10.10 with persistent storage on a USB drive. On every boot the Welcome screen appears where you can select the language and choose to try Ubuntu Live or to install Ubuntu.
I'd like to remove this screen and have Ubuntu directly start into Live mode with a specific language. How could I achieve that?

A: You should be able to prepare a LiveUSB image for yourself with the Ubuntu Customization Kit
(reference screenshots).
But, I think you should consider installing from a LiveCD to your USB rather than burning the image to your USB.

A: I would like to comment, since this is one of the first results on google, that you should NEVER install Ubuntu on a flash medium as a regular installation. Live usb's make a lot of changes to the way Ubuntu loads in order to prevent damage to your pendrive. There are things you can do to an installation of ubuntu in order to prevent this damage, but do not ever just simply install Ubuntu onto a pendrive unless you do not care if it becomes damaged.
You can install Ubuntu directly to a flash medium if you disable the use of swap and switch it to load the /tmp directory directly to the RAM instead of using a /tmp folder on your device. This is extremely important because flash has a limited number of rewrites, and using it for any sort of temporary memory will cause it to become unusable exponentially quicker. LiveUSB starts up with a static image of Ubuntu, with all modifications (the Persistence portion of the usb) loaded from the casper-rw file (or partition if you deleted the file and created a partition on your flash drive labeled casper-rw). this prevents the use of the flash drive for any sort of temporary storage and prolongs the life of the device.
Those of you who have read this page and simply installed ubuntu to the flash drive without disabling swap/moving the /tmp folder to store data in ram, should do that now in order to prevent damage to your flash drives.
If you want anything more than a live-usb version of Ubuntu on your flash drive, you really should just install it to a hard disk (portable or internal, just a device that is not simply a flash medium) in order to proficiently use it/prevent hardware damage.

A: I would also recommend performing an actual INSTALLATION of the OS on a USB device, instead of a LiveUSB with storage. After performing tests with the different solutions, I found with a friend of mine that for the SAME storage device, the LiveUSB version will boot slightly faster (like 5 seconds faster under 10.04) than the real installation.
However, when we tried to then upgrade some of the packages, we ran into a space problem. The LiveUSB installation keeps everything in a SQUASFS file system, which is essentially read-only, and is unpacked as needed. This means that an existing package is in this SQUASH can only be read, not deleted.
In short, upgrading packages add up to the used file space, instead of replacing files. The new package files will be used instead, but those new files are just like regular ones. Over time, the load time will increase slightly, as more and more packages will be in regular file system.
On a lnger term, LiveUSB is not the solution. Definitely, I would recommend a full installation, which can then be maintained like any other hard-disk installation.
Just one thing:
At the end of the questions, before confirming the installation to start, there is an "Advanced" button. Click it to check that the GRUB or GRUB2 will indeed be installed on the proper device that is your USB disk, not the local hard disk. If you see "/dev/sda" this is NOT GOOD. /dev/sda is the first internal hard disk. using sda will render your computer unbootable. Change /dev/sda to the one that designates your actual USB disk.
This is a mistake I will not forget.

A: Spent ages looking for this, found the below on a different forum, thought might be useful:
I figured it out. In order to remove the Welcome screen and the Install Ubuntu shortcut on the desktop you must remove the ubiquity installer from you custom LiveCD:
sudo apt-get purge ubiquity


text:
Q: Reading a path from another project in the same server and directory I have two projects running on the server:

*

*Project1

*Project2

Urls to my catalogues
C:\inetpub\wwwroot\Project1\Folder1\

C:\inetpub\wwwroot\Project2\wwwroot\Folder1\

Project1 - Web Aplication in Net Framework
Project2 -  API REST in .Net Core 2.2
Is there a way for me to read the path C:\inetpub\wwwroot\Project1\ from Project2 ?
The reason is the common catalog for both projects located in Project1
I don't want to do it manually. I am looking for a different way. Maybe it can be read from the IIS level?


text:
Q: Install and run Tomcat 8 on Ubuntu 16.04 Error I need install tomcat 8 on Ubuntu 16.04.
I use this guide
Download tomcat from this place
When I try to start tomcat, an error appears:
Job for tomcat.service failed because the control process exited with error code. See "systemctl status tomcat.service" and "journalctl -xe" for details.

What wrong?
Command systemctl status tomcat.service show this:
tomcat.service - Apache Tomcat 8 Servlet Container
    Loaded: loaded (/etc/systemd/system/tomcat.service; disabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Fri 2019-03-22 15:26:39 CET; 4min 40s ago
    Process: 1578 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=203/EXEC)

    Mar 22 15:26:39 vps635350 systemd[1]: Starting Apache Tomcat 8 Servlet Container...
    Mar 22 15:26:39 vps635350 systemd[1]: tomcat.service: Control process exited, code=exited status=203
    Mar 22 15:26:39 vps635350 systemd[1]: Failed to start Apache Tomcat 8 Servlet Container.
    Mar 22 15:26:39 vps635350 systemd[1]: tomcat.service: Unit entered failed state.
    Mar 22 15:26:39 vps635350 systemd[1]: tomcat.service: Failed with result 'exit-code'.

I do not understand what is wrong. Already tried to change permissions on folders, but it does not work
logs folder is empty.


text:
Q: Refresh Token Jsonwebtoken I am using jsonwebtoken in NodeJs API application for authenticating user in my API application. The flow that I have setup is as follows:
1) The user registers through signup API and the access token is generated using the following:
var jwt = require('jsonwebtoken');
var token = jwt.sign(user, _conf.authentication.superSecret, {
    expiresIn: 1440 // I intend to keep it short.
});

2) The token expires in 24 hours for example. This token is returned to the client mobile application to use as header in all the subsequent API requests.
I want to know how do I work around with refresh token for jwt. Currently I don't have a mechanism for refreshing token. Hence if the token expires in 24 hours I want the client (mobile app) to be able to request a new access token.
Thanks in advance.

A: I had same problem in a project.
1) I created the refresh token and returned it when user signed in (with the jsonwebtoken). I saved the refresh token with the user.
2) When client send a request with the expired token, server returns 401.
3) I implemented a new path to refresh the token. It receives the refresh token and the user as param and returns a new token (jsonwebtoken).
4) (optional) You can implement a mechanism for invalidating a refresh token, in case someone stole it
I based my implementation in this post, really good snippets:
Refresh token in JWT (Node.js implementation)
Hope it helps


text:
Q: python3.8.2 telnet library - cannot get telnet read output on screen I am using the following code with python3.8.2 connecting to Cisco network devices (switch, router), running in an eveNG lab environment. I am connecting from a mac laptop, to a router using telnet on IP 10.9.249.3 and port 32769.
Problem is that when I run this code I do not get any output. I can however see the commands being run and the running config output on the device itself using a separate connection. The code execution just stays put waiting for an event.
from telnetlib import Telnet

HOST = "10.9.249.3"
tn = Telnet(HOST,32769)

tn.write(b"terminal length 0\n")
tn.write(b"show runn\n")
tn.write(b"exit\n")

print(tn.read_all().decode('ascii'))
tn.exit()

When I do a control-break I get the following output:
^CTraceback (most recent call last):
  File "p1.py", line 12, in <module>
    print(tn.read_all().decode('ascii'))
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/telnetlib.py", line 335, in read_all
    self.fill_rawq()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/telnetlib.py", line 526, in fill_rawq
    buf = self.sock.recv(50)
KeyboardInterrupt

I found similar issues posted and tried their suggestions like changing to a different Telnet read_*() method but no change in the output.
One thing I have noticed is that when I connect to the network device, I have to do the following to disconnect the (manual) telnet connection:
ctrl-]
telnet> quit
Connection closed.

Thanks and regards,
Abid Ghufran


text:
Q: Odd behavior turning on LEDs using assmebly with MSP430FR4133 I am seeing some very odd behavior when I program my MSP430FR4133 board to turn on an LED using assembly language.
The LED will not come on when I run my assembly program.
The issue is that when I run a simple C program, the LED comes on and it works just as I programmed it to.
Now if I go back and run the assembly program, the LED will turn on! But if I stop the program and re-start the program the LED will no longer turn on again.
Is there any idea why this odd behavior could be happening?
Here is the assembly code I am using:
    ;MSP430 Assembler Code Template for use with TI Code Composer Studio

    .cdecls C,LIST,"msp430fr4133.h"       ; Include device header file

    .def    RESET

    .text                           ; Assemble into program memory.
    .retain                         ; Override ELF conditional linking
                                        ; and retain current section.
    .retainrefs                     ; And retain any sections that have
                                        ; references to current section.

     RESET       mov.w   #__STACK_END,SP   ; Initialize stackpointer
     StopWDT     mov.w   #WDTPW|WDTHOLD,&WDTCTL  ; Stop watchdog timer

     mov.w  #0x0001,&P1OUT
     mov.b  #0x0001,&P1DIR

     ; Main loop here

     InfLoop:
        jmp InfLoop
        NOP

     .global __STACK_END
     .sect   .stack

     ; Interrupt Vectors

      .sect   ".reset"                ; MSP430 RESET Vector
      .short  RESET

Here is the C code that I run on the board:
      #include <msp430fr4133.h>

      int main(void)
      {
           PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default  high-impedance mode

           WDTCTL = WDTPW | WDTHOLD; // Stop the watchdog timer

           P1DIR = 0x01;
           P4DIR = 0x01;

           P1OUT = 0x01;
           P4OUT = 0x01;

           for(;;)
           {
           }

           return (0);
       }

A: The C code has this:
  PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default  high-impedance mode

This initialization is missing from the assembler code; without it, none of the other pin configuration settings will take effect.

A: See MSP430 user guide for LPM5 (Low Power Mode). Typical asm example:
...

StopWDT     mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
SetupGPIO   bis.b   #BIT0,&P1DIR
            bis.b   #BIT0,&P1OUT
UnlockGPIO  bic.w   #LOCKLPM5,&PM5CTL0      ; Disable the GPIO power-on default
                                            ; high-impedance mode to activate
                                            ; previously configured port settings

...


text:
Q: Shorter case statement Let's take in consideration this ruby code:
@name = case @name
  when 1 then "Noah"
  when 2 then "Liam"
  when 3 then "Mason"
  when 4 then "Jacob"
  when 5 then "William"
  when 6 then "Ethan"
  when 7 then "James"
  when 8 then "Alexander"
  when 9 then "Michael"
  when 10 then "Benjamin"
  when 11 then "Elijah"
  when 12 then "Daniel"
  when 13 then "Aiden"
  when 14 then "Logan"
  when 15 then "Matthew"
  when 16 then "Lucas"
  when 17 then "Jackson"
  when 18 then "David"
  when 19 then "Oliver"
  when 20 then "Jayden"
  when 21 then "Joseph"
  when 22 then "Gabriel"
  when 23 then "Samuel"
  when 24 then "Carter"
  when 25 then "Anthony"
  when 26 then "John"
  when 27 then "Dylan"
  when 28 then "Luke"
  when 29 then "Henry"
  when 30 then "Andrew"
end

I have the strong suspect that there is a much shorter way to write the same thing. Something in the shape of @name.case["Noah", "Liam"...]. Even LaTeX has a better way to handle this. Consider that my program will have a very long list of case statements like that so if I leave it like that it might work, but it'll be extremely long and difficult to read. I can't find anything like that though.
Do you know if there is such an option?

A: Let's say you have your list of names. You could create an hash that map integers to them
mapping = Hash[(1..names.size).zip(names)]

then implement a function that given a number and the mapping rules returns a name or something else
def id_to_name(id, mapping)
  mapping.fetch(id, 'no name')
end

You could even make a class for this, so this method does not need the mapping as parameter
class IdToName
  def initialize(names, fallback_name)
    @mapping = Hash[(1..names.size).zip(names)]
    @fallback_name = fallback_name
  end

  def get(id)
    @mapping.fetch(id, @fallback_name)
  end
end

id_to_name = IdToName.new(your_names, 'no name')
puts id_to_name.get(1) # Noah
puts id_to_name.get(1000) # no name

A: If the numeric values of @name are consecutive values starting with 0 (or 1), a simple array that contains all the values should be enough:
@name = ['', 'Noah', 'Liam', 'Mason', 'Jacob', 'William'][@name]

Fill free to put as many names as you want after 'William'.
If the keys are not consecutive or they are not integer numbers then a Hash can be used instead:
 @name = { '1': 'Noah', 'three': 'Mason', '5': 'William' }[@name.to_s.to_sym]

A: The shortest possible way is to create an array using the %w shortcut to eliminate extraneous punctuation:
names = %w(Noah   Liam    Mason  Jacob  William Ethan James   Alexander Michael Benjamin
           Elijah Daniel  Aiden  Logan  Matthew Lucas Jackson David     Oliver  Jayden
           Joseph Gabriel Samuel Carter Anthony John  Dylan   Luke      Henry   Andrew)

You can add line breaks, extra spaces, etc. Then simply index them using @name:
names[@name - 1]

Since the first element of names is 0, you have to subtract one from @name or put a dummy element in the beginning so you can start at 1.


text:
Q: Logged in user's email address I'm unable to fetch the user's email address even though I've added the email in the extended permissions for the app.
This is the preview box that I get when i'm editing the app's details

Yet i'm unable to get the email address of the logged in user.
This is the url i'm using for fetching the user info
https://graph.facebook.com/me?fields=first_name,last_name,email,gender&access_token=+accessToken

This is the data i'm getting from facebook
{
   "first_name": "Varun",
   "last_name": "Achar",
   "gender": "male",
   "id": "1XXXXXX66660851"
}

Any ideas?

A: I don't know why the Authenticated Referrals approach is not working for you, but here's how you can ask for the email address and get it in 2 other ways (you'll need to deactivate the authenticated referrals though):
(1) Serveri-Side Authentication - When facebook load your canvas page it's doing that by POSTing to your canvas url, providing the *signed_request* parameter. With that you can check if the user is authenticated or not (if he is, you get the access token and other things about the user such as his fb user id).
If the user is not authenticated you send him to the following url:
https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_url=YOUR_REDIRECT_URI&scope=email,publish_stream,etc

When the user gets back you should have an authenticated signed request.
(2) Client-Side Authentication - You use the javascript sdk to authenticate the user in your canvas page.
Once you have an access token you can get the email address by issuing a request to:
https://graph.facebook.com/me?fields=email

Or from the client side you can use:
FB.api("me?fields=email", function(response) {
    console.log(response);
});

Edit
You should read the javascript sdk documentation? especially the FB.login part.
It shows an example of how to use it and asking for more permissions (using the the scope parameter)

A: This is how I finally got it working. Couldn't get it working through the Authentication Referrals so had to do this
FB.login(function(resp)
{
  // Handle the response.
}
, {scope: "email, user_relationships"});


text:
Q: How to run python script on background/as a process? I want to run a python script as a process/in the background. I searched and found pythonw.exe but when I do pythonw.exe name_of_my_script.py nothing happened. Am I doing something wrong and/or how else would I run it in the background?
This is part of my code that do problem  :
from selenium import webdriver

I will thank you for any help whatsoever.
note:
With the help of the comments here, I understood that also python.exe running don't work and bring error - NameError: name 'PROTOCOL_TLS' is not defined ( even tough in normal running it doesn't have errors.
edit:
i used http://pytoexe.com/ and i got exe file that work but the cmd console still exist ( mabye it because i use phantomjs ? ) click here

A: You can create your own exe by going to http://pytoexe.com .
After that convert your script. Choose windows-based and convert it.
You'll not have any problems after that. Hope that helps.

A: I'd approach this by using threading module, and use os.fork() - but I'm not running Windows. I suggest having a look through Difference in behavior between os.fork and multiprocessing.Process for other OSes.

A: By "I want to run a python script as a process/in the background," do you mean make the window not visible? if so, just save the script as .pyw instead of .py


text:
Q: Minimize $c^Tx$ subject to $Ax=b$ I am studying linear optimization and want to understand the basic general forms. Consider this problem for $A \in \mathbb{R}^{n \times m}$:
\begin{array}{ll}\min\limits_{{x:\,Ax=b}} c^Tx.\end{array}
From linear algebra I know there are three cases to solve $Ax=b$:

*

*if $\mathrm{rank}(A)<\mathrm{rank}([A\quad b])$, which is like putting to many equations that cannot be solved simultaneously, thus in this case no solution.

\begin{array}{ll}\min\limits_{{x:\,Ax=b}} c^Tx=+\infty.\end{array}

*if $\mathrm{rank}(A)=\mathrm{rank}([A\quad b])=m$, which means the number of variables is equal to number of equations and this equations are independent, thus there exists only one unique $x=(A^*A)^{-1}A^*b$.

\begin{array}{ll}\min\limits_{{x:\,Ax=b}} c^Tx=c^T(A^*A)^{-1}A^*b.\end{array}

*if $\mathrm{rank}(A)=\mathrm{rank}([A\quad b])<m$, which means the number of variables is greater then number of equations, thus we have a freedom to choose many variations of $x$ to solve $Ax=b$. Many solutions $x$ exists.

Now, among these $x$, I need to find the one that minimizes $c^Tx$. I remember from linear algebra class, that among these $x$, there is one that minimizes $||x||_2^2$ is $x=A^*(AA^*)^{-1}b$. Is it the one that I need to minimize $c^Tx$? How I can show it?

A: If $Ax = b$ has multiple solutions then let $x_0$ be any solution.
A general solution is given by $x = x_0 + n$ where is $n$ is an arbitrary vector in the null space of $A$.
If there is a vector $n$ in the null space of $A$ such that $c^T n \neq 0$, assuming without loss of generality $ c^T n  > 0$, then $x_0 - t n_0$ is a solution of $Ax = b$ for every real $t > 0$ and letting $t \to \infty$ we see that the value of the objective  function tends to $-\infty$ , and so the minimum is clearly not attained.
In case $c^T n = 0$ for every $n$ in the null space of $A$ (in this case $c$ is in the row space of $A$) then clearly objective function takes only one value over the permissible set of values which will be the minimum.