text:
Q: Facebook data import leads to "Value below was evaluated just now" I am trying to display user's profile image on the sidebar after he logs in using his FB account. Apparently, the data is loaded from Facebook but after the initialization of the page. Therefore, the image is not displayed as I would like. All I get is the empty thumbnail.
In console I get: Value below was evaluated just now
Beneath I can see all data needed that are properly loaded but not displayed. In .html section "script" I use:
function getFBData () {
    FB.api('/me', function (response) {
        fbinfo = new Array();

        var im = document.getElementById("profileImage").setAttribute("src", "http://graph.facebook.com/" + response.id + "/picture?type=normal?callback=?");
    });
   public var id = response.id;
    public var first_name = response.first_name;
    public var last_name = response.last_name;
    var email = response.email;

}

In component.ts file I implemented console.log(this.userDetails);

A: FB.api is asynchronous, you can only access the response in the callback function:
function getFBData () {
    FB.api('/me', (response) => {
        document.getElementById("profileImage").setAttribute("src", "http://graph.facebook.com/" + response.id + "/picture?type=normal");
        const id = response.id,
            first_name = response.first_name,
            last_name = response.last_name,
            email = response.email;
    });
}

Also, updated the code with arrow functions and const (because it is 2017). :)


text:
Q: Details about Generalized Convolution (Number Theory - Apostol) In "Introduction to analytic Number Theory" by Apostol there is chapter about generalized convolution.
Let F denote a real or complex-valued function defined on the positive real axis such that $F(x) = 0$ for $0<x<1$.
$\alpha$ is any arithmetical function.
Generalized convolution is then defined by $(\alpha \circ F)(x)= \sum_{n \leq x} \alpha(n)F(\frac{x}{n})$
Then the text says:
" If F(x) = 0 for all nonintegral values of x, the restriction of F to integers is an arithmetical function and we find that $(\alpha \circ F)(m) =(\alpha \ast F)(m)$"
Here $(\alpha \ast \beta)(n) = \sum_{d | n} \alpha(n)\beta(\frac{n}{d})$.
My question is why does F(x) have to be 0 for all nonintegral values of x for this to work?
Edit: Is the point that we want $F(\frac{x}{n})$ to be 0 when $\frac{x}{n}$ is not an integer?

A: Yes. For example, to isolate $F$, take $\alpha$ to be the unit function $u$. Then the generalized convolution for integer $m \geq 1$ is
$(u \circ F)(m) = \sum_{n \leq m} F(\frac{m}{n})$
If $F(\frac{m}{n}) = 0$ whenever $\frac{m}{n}$ is not an integer, the above sum reduces to
$\sum_{n | m} F(\frac{m}{n}) = (u \ast F)(m)$
I think Apostol could have simply said "If $F(x) = 0$ for all nonintegral values of x, we find that $(\alpha \circ F)(m) = (\alpha \ast F)(m)$ for all integers $m \geq 1$..."

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is the specification of the Postman's pm.test() function? In Postman you can write tests to be executed after requests.
This is the documentation and these are the examples. But I don't see/find the specification of the pm.test() function.

*

*What does it return?

*Does it get any arguments?

A: The information regarding the pm.test function and the arguments that it takes can be found here:
https://learning.getpostman.com/docs/postman/scripts/postman-sandbox-api-reference/#pmtest


text:
Q: Why do fonts sometimes look "fat" on Mac OS X? Sometimes when resuming from suspend, the fonts in Mac OS X look "fatter" than normal. Unfortunately right now I can't get my Macbook Pro to exhibit the "normal" behavior for comparison, it has been abnormal yesterday and today. If I can get screenshots of what I think is 'normal', I'll add them.
"Fixing" this has been random. I use an external monitor, and sometimes unplugging it and plugging back in, or even turning it off and back on has worked. Sometimes with the display attached (or not) detecting displays works. Sometimes logging out or rebooting entirely is what it takes.
Displays used:

*

*Macbook Pro 15" built-in display

*Dell 27" LCD (2009 model)

Software where I see this happen, at least most noticably:

*

*Firefox (screenshots below)

*iTerm

*Things

*MacIrssi (screenshots below)

I am using Mac OS X 10.5.8.
"Abnormal" view from MacIrssi with Inconsolata 16 pt.

"Abnormal" view from Firefox.

Finally got it to switch back, though after resuming from suspend its back to "fat" :-(.

And 'normal' in Firefox:

A: The issue becomes apparent when you zoom in on the images:

As you can see, the skinny version is entirely greyscale, while the fat version has some pixels that are slightly reddish, and some that are slightly bluish.
This occurs because of sub-pixel anti-aliasing. An LCD screen doesn't actually contain square pixels that can be any color; instead, it has three skinny rectangular elements that are red, green, and blue. (Images below from Wikipedia).

When anti-aliasing fonts, instead of simply using shades of grey, you can vary the intensity of each of the three colors, to allow you to render at three times the horizontal resolution you can achieve simply by anti-aliasing with shades of grey. The scaled-up pictures I provided don't actually represent what you are seeing; instead, the fonts should look considerably smoother due to the shape and placement of the pixels. It would be more accurate to render it something like this:

So, what you are seeing is that sometimes the font is being rendered with sub-pixel anti-aliasing, and sometimes it is being rendered with normal anti-aliasing. I would guess that the sub-pixel anti-aliasing algorithms being used are optimized for black text on a white background, which may explain why the text looks a little "fat" when viewed as white text on a black background.
On the other hand, it may simply be a more accurate rendering of the actual font. If you look at a properly scaled up version of the same font, it looks a bit bolder and less wispy than the "skinny" version shown above:

The reason it's switching back and forth between the two versions is probably because of your second monitor. I don't know exactly when the OS decides this, or how it does, but it likely detects an LCD with an unknown subpixel layout. Because it doesn't know the layout of the pixels, it goes with the safer standard anti-aliasing (as sub-pixel anti-aliasing can look really strange when displayed on an LCD with the wrong layout). It seems that somehow, you are sometimes getting it to make one decision, and sometimes getting it to make the other. I believe that once an application is started in a certain rendering mode, it won't change until you quit and re-launch the application, which would explain why you're seeing erratic behavior; what behavior you get may depend on exactly when you connect your external monitor along with when you launch your applications.
If you simply want to make this consistent across all applications, no matter whether you use the second LCD or not, and always use the skinny fonts, you can simply turn off font smoothing in the Appearance system preference panel:

Of course, then you lose sub-pixel anti-aliasing everywhere. As John Rudy points out, you can get somewhat more fine grained control by following the instructions for setting the level manually using the defaults program; or if you're not yet on Snow Leopard, then you should still have the more fine-grained controls available to you in System Preferences.

A: It looks like differences in the anti-aliasing, which could make sense if you're seeing this behavior at suspend/resume and external monitor connection/disconnection. It could be that your Dell monitor is triggering a change in the anti-aliasing mode used by the system.
Depending on your version of Mac OS X, you may have options to control the font smoothing used by the system in the Appearance System Preferences window. (As of Snow Leopard, I'm only seeing a checkbox to "use LCD font smoothing when available." This seems to correspond to the old "Automatic - Best for Main Display" setting.)
You can still configure this via system properties in Terminal.app. This article explains the details, which I'll summarize below:
There are five settings for font smoothing:

*

*Automatic - Best for Main Display

*Standard - Best for CRT (option 1)

*Light (option 2)

*Medium - Best for Flat Panel (option 3)

*Strong (option 4)

To tightly control this so that you are no longer in the automatic world, use Terminal.app to change the property system-wide. I suspect if you do this, the display switching (between monitors and I suspect perhaps your screen saver for suspend/resume) should no longer mess with your settings.
In Terminal.app, enter:
    defaults -currentHost write -globalDomain AppleFontSmoothing -int 2

Change the 2 to whichever option (from the list above, use the option numbers after the text) you like most.

A: If you are using a CRT, you can expect some distortion of colours, brightness and aspect ratio in the time until the CRT is fully warmed up.  What monitor are you using?


text:
Q: Flask/Ajax request seems to have no data - Cannot parse it I am trying to get the name value of the form on the flask back-end and add it to the database.
When I try and get the keys, or values out of the request, but it seems that nothing is going through. Trying a couple different things, I get just gotten a Response object @ ..., a b'...' response, an immutable list that did not have anything. I am pretty stumped.
I have tried quite a few suggestions here on SO. Unfortunately, quite a few seem to be using jQuery. The rest did not seem to yield anything of substance that I would crack the code on.
My Flask Code:
@app.route('/add-name', methods=['POST'])
def add_stage():
    print(request)
    # name = New_Item(name=request.form.get('name'))
    # db.session.add(stage)
    # db.session.commit()
    data = {'response': 'OK'}
    return jsonify(data);

My JS code:
<form id="name_form" action="" method="POST">
  <label for="name">Name:</label>
  <input type="text" id="name"/>
</form>'

var my_form = document.getElementById("name_form");

my_form.addEventListener("submit", function(e) {
    e.preventDefault();

    var request = new XMLHttpRequest();
    request.open('POST', '/add-name', true);
    request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    // Also tried request.send(data) where data was the value.
    // Also tried request.send({'data': data } where data was the value.
    request.send(my_form);
  });

Can anyone get me some pointers on this? I am pretty new to Ajax and can see its benefits.
Added JSfiddle: https://jsfiddle.net/396rpLzm/

A: Try putting your form into a FormData object:
var my_form = document.getElementById("name_form");
var XHR = new XMLHttpRequest();
var FD = new FormData(my_form);
XHR.open("POST", '/add-name');
XHR.send(FD);

A: Actually, so the above caused some other issues down the road. I wanted to point out that @Vorsprung durch Technik posted an answer where he said that the send line:
should be request.send("name=" + name); I am not entirely sure why this worked but it did.
With the answer about using FormData, when I printed out the request.form, I got:
ImmutableMultiDict([('-----------------------------
231208931201322113290\r\nContent-Disposition:
form-data; name',
'"name"\r\n\r\nTest\r\n-----------------------------
231208931201322113290--\r\n')])

which does not want to be assessed. (Changed the numbers in case they are sensitive. Does that have something to do with the security token? I saw some posts about jinja csrf tokens and JS security tokens causing some issues...maybe that is part of it.).


text:
Q: Trouble compiling a clickable QLabel I want to have a QLabel in Qt which reacts to the mouse click event. I have found various similar solutions that don't seem to work in my current version 5.8.x
This seems to be the consensus on how to accomplish what I want: https://wiki.qt.io/Clickable_QLabel
If I take that, the program fails to compile with the error:
QtProjects/HelloWorldTest/qclickablelabel.cpp:5: error: undefined reference to `vtable for QClickableLabel'

(I renamed ClickableLabel to QClickableLabel because it makes more sense to me, the rest is 1:1)
I hunted down this error message and found the solution to just remove the Q_OBJECT macro, which in turn leads to this error which makes the least sense to me:
#ifndef QCLICKABLELABEL_H
#define QCLICKABLELABEL_H

#include <Qt>
#include <QWidget>
#include <QLabel>

class QClickableLabel : public QLabel {
    //Q_OBJECT

public:
    explicit QClickableLabel(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
    ~QClickableLabel();

signals:
    void clicked();

protected:
    void mousePressEvent(QMouseEvent* event);

};

#endif // QCLICKABLELABEL_H

.
#include "qclickablelabel.h"
#include <QDebug>

QClickableLabel::QClickableLabel(QWidget* parent, Qt::WindowFlags f)
    : QLabel(parent) {

}

QClickableLabel::~QClickableLabel() {}

void QClickableLabel::mousePressEvent(QMouseEvent* event) {
    emit clicked(); // <----- Error happens here
}

Error message:
QtProjects/HelloWorldTest/qclickablelabel.cpp:12: error: undefined reference to `QClickableLabel::clicked()'

The QClickableLabel::clicked is defined as a signal and emit is for raising signals. So why doesn't the compiler find the method?
The existing solutions seem to be outdated, so a way to accomplish this for the current version would be appreciated!

A: Uncoment the Q_OBJECT macro, the moc compiler needs that for the class.
if you are compilling using QMake, run qmake again so it will generate the moc files necessary to compilling the Qt code.

A: Signal and slots are implemented in Qt using the moc compiler:

The moc reads C++ source files. If it finds one or more class
  declarations that contain the Q_OBJECT macro, it produces another C++
  source file which contains the meta object code for those classes.

You should be sure that moc processes your header file in order to generate the implementation of your signals:

*

*Add Q_OBJECT to your class definition

*Add the header file to your .pro file (assuming you are using Qt Creator): HEADERS += qclickablelabel.h


text:
Q: MVEL script execution error "no context" after library update I have a problem with MVEL running very simple 2-lines script like this:
for (int i=0; i < 1; i++) {}
for (int j=0; j < 1; j++) {}

With MVEL library of version 2.2.3 and higher there is always such error:
Exception in thread "main" java.lang.RuntimeException: no context
This "no context" error message doesn't specify a problem in script and I'm not sure if it's a regression issue in library or some new special thing in MVEL syntax requirements. According to the spec the standard C-style for-loop should be supported and it worked fine with MVEL before 2.2.3.
There is only github project now for MVEL and seems no way to submit a bug or ask for help from its users/developers community. Any hints would be appreciated, thanks!


text:
Q: Create a calendar database table like this I would like to create a calendar SQL table like this one but for some years.
(I'm using mysql 5.7.28)
Date is DD-MM-YYYY

Is it possible?

A: If you are running MySQL 8.0, you can use a recursive query:
with recursive cte as (
    select '2019-01-01 00:00:00' dt
    union all
    select dt + interval 1 hour from cte where dt < '2020-01-01' - interval 1 hour
)
select
    row_number() over(order by dt) id,
    date(dt) day,
    time(dt) start_hour,
    time(dt + interval 1 hour) end_hour
from cte

The recursive cte generates a list of datetimes between the given boundaries (here, that's year 2019), with a 1 hour increment. Then, the outer query produces the expected result, by extracting the day and hour parts.
You can adjust the boudaries and the increment as per your exact requirements.
Side note: I would suggest to retain the full datetime in the calendar table as well; there are many situation where having a proper datetime value is more convenient than separated dates and times.
Demo on DB Fiddle for the first day only:

id | day        | start_hour      | end_hour
-: | :--------- | :-------------- | :--------------
 1 | 2019-01-01 | 00:00:00.000000 | 01:00:00.000000
 2 | 2019-01-01 | 01:00:00.000000 | 02:00:00.000000
 3 | 2019-01-01 | 02:00:00.000000 | 03:00:00.000000
 4 | 2019-01-01 | 03:00:00.000000 | 04:00:00.000000
 5 | 2019-01-01 | 04:00:00.000000 | 05:00:00.000000
 6 | 2019-01-01 | 05:00:00.000000 | 06:00:00.000000
 7 | 2019-01-01 | 06:00:00.000000 | 07:00:00.000000
 8 | 2019-01-01 | 07:00:00.000000 | 08:00:00.000000
 9 | 2019-01-01 | 08:00:00.000000 | 09:00:00.000000
10 | 2019-01-01 | 09:00:00.000000 | 10:00:00.000000
11 | 2019-01-01 | 10:00:00.000000 | 11:00:00.000000
12 | 2019-01-01 | 11:00:00.000000 | 12:00:00.000000
13 | 2019-01-01 | 12:00:00.000000 | 13:00:00.000000
14 | 2019-01-01 | 13:00:00.000000 | 14:00:00.000000
15 | 2019-01-01 | 14:00:00.000000 | 15:00:00.000000
16 | 2019-01-01 | 15:00:00.000000 | 16:00:00.000000
17 | 2019-01-01 | 16:00:00.000000 | 17:00:00.000000
18 | 2019-01-01 | 17:00:00.000000 | 18:00:00.000000
19 | 2019-01-01 | 18:00:00.000000 | 19:00:00.000000
20 | 2019-01-01 | 19:00:00.000000 | 20:00:00.000000
21 | 2019-01-01 | 20:00:00.000000 | 21:00:00.000000
22 | 2019-01-01 | 21:00:00.000000 | 22:00:00.000000
23 | 2019-01-01 | 22:00:00.000000 | 23:00:00.000000
24 | 2019-01-01 | 23:00:00.000000 | 00:00:00.000000

In earlier versions, you would typically create a large table of numbers by cross-joining subqueries, and use the number range to increment the initial date. row_number() can be emulated with a MySQL variable:
select
    @id:=@id + 1 id,
    date(dt) day,
    time(dt) start_hour,
    time(dt + interval 1 hour) end_hour,
    0 prenoted
from (
    select '2019-01-01' + interval d0.n + 10 * d1.n + 100 * d2.n + 1000 * d3.n hour dt
    from
        (
            select 0 n union all select 1 union all select 2 union all select 3 union all select  4
            union all select 5 union all select 6 union all select 7 union all select 8 union all select 9
        ) d0
        cross join (
            select 0 n union all select 1 union all select 2 union all select 3 union all select  4
            union all select 5 union all select 6 union all select 7 union all select 8 union all select 9
        ) d1
        cross join (
            select 0 n union all select 1 union all select 2 union all select 3 union all select  4
            union all select 5 union all select 6 union all select 7 union all select 8 union all select 9
        ) d2
        cross join (
            select 0 n union all select 1 union all select 2 union all select 3 union all select  4
            union all select 5 union all select 6 union all select 7 union all select 8 union all select 9
        ) d3
    where '2019-01-01' + interval d0.n + 10 * d1.n + 100 * d2.n + 1000 * d3.n hour < '2020-01-01'
) t
cross join (select @id := 0 id) i
order by dt

The above query gives you a maximum span of 10 000 hours (wich represent a little more than 416 days); you can add another cross join and update the arithmetic to handle up to 100 000 hours (and so on).
Demo on DB Fiddle for the first 24 hours.


text:
Q: Dual Boot with Windows 8 UEFI - Ubuntu/GRUB Being Bypassed I recently got a Dell Inspiron 13z with Windows 8. I decided to dual boot Ubuntu.
After install, it was booting straight into Ubuntu, with no GRUB menu showing up. No problem. I just ran boot repair and everything seemed to work fine. (Here's the output, btw: http://paste.ubuntu.com/5891478/)
Then I booted into Windows. Now I can't seem to get back into Ubuntu. I tried disabling Fast Boot by running REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /V HiberbootEnabled /T REG_dWORD /D 0 /F in PowerShell as Administrator. Even now, GRUB is still being bypassed somehow.
What should I do?
EDIT: I tried reinstalling GRUB by booting a LiveUSB and following this: https://superuser.com/questions/376470/how-to-reinstall-grub2-efi. Unfortunately, that didn't work.

A: The Boot Repair tool isn't 100% reliable. The problem you seem to have run into is that Boot Repair is rather over-enthusiastic about juggling boot loader files. Specifically, Boot Repair renames the Windows boot loader and installs a copy of GRUB in its place; however, this "repair," in addition to being terribly confusing, is sometimes undone by Windows -- Windows sees the change and (quite reasonably) re-installs its own boot loader. What's more, this "repair" is seldom necessary; the tool just applies it in a scattershot approach with a bunch of other "repairs" in the hopes that it will be useful. Unfortunately, sometimes it's not, and it can cause follow-on problems.
I recommend you try this:

*

*Back up the contents of your EFI System Partition (ESP; your /dev/sda1). This will serve as a fallback in case you make matters worse.

*Re-run Boot Repair, but click the Advanced Options item and check the Restore EFI Backups option before proceeding. This will undo some of Boot Repair's changes.

*Reboot and test both Windows and Ubuntu. There's a good chance that everything will work; however....

*

*If the system starts booting Windows directly, launch an Administrator Command Prompt window (not a PowerShell; it won't work) and type bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi.

*If the system starts booting Ubuntu directly with no option to boot Windows, install my rEFInd boot manager. Installing the Debian package is the easiest way to do this. rEFInd tends to be more reliable about launching Windows than is GRUB, so this may well fix the problem.

A: There is a boot order list in your BIOS settings. You can try to change the order in BIOS settings.
As reported with your boot-repair link,
"The boot files of [The OS now in use - Ubuntu 13.04] are far from the start of the disk. Your BIOS may not detect them. You may want to retry after creating a /boot partition (EXT4, >200MB, start of the disk). This can be performed via tools such as gParted. Then select this partition via the [Separate /boot partition:] option of [Boot Repair]. (https://help.ubuntu.com/community/BootPartition)"
Does your EFI system detect it?


text:
Q: how to insert a data in json text file I need to insert a new piece of data in a text file.
This is the method I use to read the text file:
try
{
    var path = @"text file\\GetAllEmp.txt";

    string rawJson = File.ReadAllText(path, Encoding.UTF8);

    ObservableCollection<EmployeeItem> Employee = new ObservableCollection<EmployeeItem>();
    var jsonData = JsonConvert.SerializeObject(rawJson);

    List<EmployeeItem> emp = JsonConvert.DeserializeObject<List<EmployeeItem>>(rawJson);

    listitem.ItemsSource = emp;

I just need to add new data in the text file.
How to add data?
What I have tried is:
public static void Writeemployee()
{
    var path = @"text file\\GetAllEmp.txt";

    string rawJson = File.ReadAllText(path);

    List<EmployeeItem> emp = JsonConvert.DeserializeObject<List<EmployeeItem>>(rawJson);
    var abs = emp;
    for (int i = 0; i < abs.Count; i++)
    {
        EmployeeItem s_Item = new EmployeeItem();
        int SID = ((int)s_Item.SiteID);
        DataAccess.AddEmployee(s_Item);
    }
}

My data access:
public static async void AddEmployeee(EmployeeItem Employee)
{
}

I just don't know how to insert. If there is any other method to insert, please let me know.

A: Using the file APIs in UWP cannot add items to the Json file without deleting the original items.
Because of the format of the Json file, items need to be placed in [{items1},{items2 }], so you need to read all the items, then add new elements, convert the list to Json format and write it to the file.
Here is a code sample.
EmployeeItem employeeItem = new EmployeeItem
{
    Id = 8,
    GroupID = 18,
    SiteID = 5565
};

StorageFolder appFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
string path = @"GetAllEmp.txt";

//get data
string rawJson = File.ReadAllText(path, Encoding.UTF8);
ObservableCollection<EmployeeItem> Employee = new ObservableCollection<EmployeeItem>();
var jsonData = JsonConvert.SerializeObject(rawJson);
List<EmployeeItem> emp = JsonConvert.DeserializeObject<List<EmployeeItem>>(rawJson);

emp.Add(employeeItem);

StorageFile sampleFile = await appFolder.GetFileAsync(path);
await Windows.Storage.FileIO.WriteTextAsync(sampleFile, JsonConvert.SerializeObject(emp));


text:
Q: react-native-firebase/storage - upload image to firebase storage error "_storage.default.storage is not a function" I have installed @react-native-firebase/app and @react-native-firebase/storage
Below is my package.json:
 "dependencies": {
    "@react-native-firebase/app": "^6.0.4",
    "@react-native-firebase/storage": "^6.0.4",
    "firebase": "^5.11.1",

...this is where I require @react-native-firebase/storage
import rnFb from '@react-native-firebase/storage';

..and this is the function I am calling to upload the image:
  uploadImage = localUri =>
    new Promise((resolve, reject) => {
      const localUri2 = Platform.OS === 'ios' ? localUri.replace('file://', '') : localUri;
      const fbUri = Firebase.storage().ref();

      rnFb.storage().ref(localUri2).putFile(fbUri)
        .then(() => { resolve(); })
        .catch((e) => { reject(e); });
    });

Error Im getting is:
TypeError: _storage.default.storage is not a function

Can anyone help?
Thank you!!

A: try below
import storage from '@react-native-firebase/storage';

...
storage().ref(localUri2)
...

or
import { firebase } from '@react-native-firebase/storage';

...
firebase.storage().ref(localUri2)
...


text:
Q: How to count nulls in a group rowwise in pandas DataFrame According to this topic https://stackoverflow.com/questions/19384532/how-to-count-number-of-rows-per-group-and-other-statistics-in-pandas-group-by I'd like to add one more stat - count null values (a.k.a. NaN) in DataFrame:
tdf = pd.DataFrame(columns = ['indicator', 'v1', 'v2', 'v3', 'v4'],
                   data = [['A', '3', pd.np.nan, '4', pd.np.nan ],
                           ['A', '3', '4', '4', pd.np.nan ],
                           ['B', pd.np.nan, pd.np.nan, pd.np.nan, pd.np.nan],
                           ['B', '1', None, pd.np.nan, None ],
                           ['C', '9', '7', '4', '0']])

I'd like to use something like this:
tdf.groupby('indicator').agg({'indicator': ['count']})
but with the addition of nulls counter to have it in separate column, like:
tdf.groupby('indicator').agg({'indicator': ['count', 'isnull']})
Now, I get error: AttributeError: Cannot access callable attribute 'isnull' of 'SeriesGroupBy' objects, try using the 'apply' method
How can I access this pd.isnull() function here or use some with its functionality?
Expected output would be:
          indicator      nulls
              count      count
indicator
A                 2          3
B                 2          7
C                 1          0

Note that pd.np.nan works as None in the same way.

A: First set_index and check all missing values with count by sum and then aggregate count with sum:
df = tdf.set_index('indicator').isnull().sum(axis=1).groupby(level=0).agg(['count','sum'])
print (df)
           count  sum
indicator
A              2    3
B              2    7
C              1    0

Detail:
print (tdf.set_index('indicator').isnull().sum(axis=1))
indicator
A    2
A    1
B    4
B    3
C    0
dtype: int64

Another solution is use function with GroupBy.apply:
def func(x):
    a = len(x)
    b = x.isnull().values.sum()
    return pd.Series([a,b],index=['indicator count','nulls count'])

df = tdf.set_index('indicator').groupby('indicator').apply(func)
print (df)
           indicator count  nulls count
indicator
A                        2            3
B                        2            7
C                        1            0

A: I've found almost satisfying answer myself: (cons: bit too complicated). In R for example I'd use RowSums on is.na(df) matrix. It's quite this way but more coding unfortunately.
def count_nulls_rowwise_by_group(tdf, group):
    cdf = pd.concat([tdf[group], pd.isnull(tdf).sum(axis=1).rename('nulls')], axis=1)
    return cdf.groupby(group).agg({group: 'count', 'nulls': 'sum'}).rename(index=str, columns={group: 'count'})

count_nulls_rowwise_by_group(tdf)
gives:
Out[387]:
           count  nulls
indicator
A              2      3
B              2      7
C              1      0


text:
Q: How to print only one div content from html page using print button I have 2 div tags in my html code.and I have 1 print button on the top of the page.when I click on the print button , it is giving me everything in the print what I have on html page(means content from both the divs). I want to restrict this print button's functionality till 1st div only and I will add another print button before next div to print that div content independently. Is there any way I can do this?

      <input type="button" value="Print" class="noprint" onclick="window.print();return false;">

          ...
          //my content.Want to print only this div when I will click print button.
          ...

       //I will add another print button here which will allow me to print the next div.

         ...
          //my content
         ...

A: @media print {
   *
    {
     display: none !important;
    }

   .printable
    {
     display: block !important;
    }
}

Then add the printable class to your div you want to print.

A: try this
$(document).on('click','#pring1',function(e){
    $('#printCSS').remove();
    $('head').append('<link href="stylesheetForBox01.css" media="print" id="printCSS">');
});

$(document).on('click','#pring2',function(e){
    $('#printCSS').remove();
    $('head').append('<link href="stylesheetForBox02.css" media="print" id="printCSS">');
});

in stylesheetForBox01.css page
#box1{
    display: none;
}

in stylesheetForBox02.css page
#box2{
    display: none;
}

A: I would recommend using media queries for this one, like such:
@media print {

    .div1 {display:block;}
    .div2 {display:none;}

 }

This will effectively hide div2 (you need to name your elements), while retaining div1.
See http://jsfiddle.net/576ttew8/ for an example.
Furthermore, you can use @media print to further style your div so that it renders better in the printable form.
For more information on @media print (and other media queries), see http://www.w3schools.com/css/css_mediatypes.asp


text:
Q: Get more data from a relationship table using Yii I'm building a web application using Yii framework, and i'm quite new to it.
I have 3 db tables. One stores users, the second products, and the third is a relationship table that stores user_id, product_id and more info like the time the product was bought.
I configured a MANY_MANY relationship, and have no problem to get all the products the user has bought. However I can't figure out how can I get the extra info from the relationship table?
Thank you

A: If your association holds additional data, you can declare itself as a class Purchase and add these relationships:
class User extends CActiveRecord
{
  public function relations()
  {
    return array(
      'purchases' => array(self::HAS_MANY, 'Purchase', 'user_id'),
      // Products purchased by this user
      'products' => array(
        self::HAS_MANY, 'Product', 'product_id',
        'through' => 'purchases',
      ),
    );
  }
}

class Purchase extends CActiveRecord
{
  // You need to add this, since every purchase is uniquely identified
  // by user and product. Surrogate 'id' key is also fine
  public function primaryKey()
  {
    return array('user_id', 'product_id');
  }

  public function relations()
  {
    return array(
      'user' => array(self::BELONGS_TO, 'User', 'user_id'),
      'product' => array(self::BELONGS_TO, 'Product', 'product_id'),
    );
  }
}

Remove remaining MANY_MANY relationships from User and Product models. Note the usage of through relationship. Fetching data might look like this:
$users = User::model()->with('purchases.product')->findAll();
foreach ($users as $user) {
  echo $user->username . "
";
  echo 'Purchases
';
  foreach ($user->purchases as $purchase) {
    echo "Date: {$purchase->purchased_at}
";
    echo "Product: {$purchase->product->name}
";
  }
  echo '
';
}

This will perform only one query from User table joining on another two tables. Also User::model()->with('products') will efficiently find user(s) with products they bought. Your DB scheme can remain the same, except you'll need to add composite primary key in the association table.
See this article in the Yii wiki for a detailed explanation.


text:
Q: Send and Receive operations between communicators in MPI Following my previous question : Unable to implement MPI_Intercomm_create
The problem of MPI_INTERCOMM_CREATE has been solved. But when I try to implement a basic send receive operations between process 0 of color 0 (globally rank = 0) and process 0 of color 1 (ie globally rank = 2), the code just hangs up after printing received buffer.
 the code:
program hello
include 'mpif.h'
implicit none
integer tag,ierr,rank,numtasks,color,new_comm,inter1,inter2
integer sendbuf,recvbuf,tag,stat(MPI_STATUS_SIZE)

tag = 22
sendbuf = 222

call MPI_Init(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr)
call MPI_COMM_SIZE(MPI_COMM_WORLD,numtasks,ierr)

if (rank < 2) then
color = 0
else
color = 1
end if

call MPI_COMM_SPLIT(MPI_COMM_WORLD,color,rank,new_comm,ierr)

if (color .eq. 0) then
if (rank == 0) print*,' 0 here'
call MPI_INTERCOMM_CREATE(new_comm,0,MPI_Comm_world,2,tag,inter1,ierr)
call mpi_send(sendbuf,1,MPI_INT,2,tag,inter1,ierr)

!local_comm,local leader,peer_comm,remote leader,tag,new,ierr

else if(color .eq. 1) then
 if(rank ==2) print*,' 2 here'
call MPI_INTERCOMM_CREATE(new_comm,2,MPI_COMM_WORLD,0,tag,inter2,ierr)
call mpi_recv(recvbuf,1,MPI_INT,0,tag,inter2,stat,ierr)
print*,recvbuf
end if
end

A: The communication with intercommunication is not well understood by most users, and examples are not as many as examples for other MPI operations. You can find a good explanation by following this link.
Now, there are two things to remember:
1) Communication in an inter communicator always go from one group to the other group. When sending, the rank of the destination is its the local rank in the remote group communicator. When receiving, the rank of the sender is its local rank in the remote group communicator.
2) Point to point communication (MPI_send and MPI_recv family) is between one sender and one receiver. In your case, everyone in color 0 is sending and everyone in color 1 is receiving, however, if I understood your problem, you want the process 0 of color 0 to send something to the process 0 of color 1.
The sending code should be something like this:
call MPI_COMM_RANK(inter1,irank,ierr)
if(irank==0)then
    call mpi_send(sendbuf,1,MPI_INT,0,tag,inter1,ierr)
end if

The receiving code should look like:
call MPI_COMM_RANK(inter2,irank,ierr)
if(irank==0)then
    call mpi_recv(recvbuf,1,MPI_INT,0,tag,inter2,stat,ierr)
    print*,'rec buff = ', recvbuf
end if

In the sample code, there is a new variable irank that I use to query the rank of each process in the inter-communicator; that is the rank of the process in his local communicator. So you will have two process of rank 0, one for each group, and so on.
It is important to emphasize what other commentators of your post are saying: when building a program in those modern days, use moderns constructs like use mpi instead of include 'mpif.h' see comment from Vladimir F. Another advise from your previous question was yo use rank 0 as remote leader in both case. If I combine those 2 ideas, your program can look like:
program hello
use mpi !instead of include 'mpif.h'
implicit none

    integer :: tag,ierr,rank,numtasks,color,new_comm,inter1,inter2
    integer :: sendbuf,recvbuf,stat(MPI_STATUS_SIZE)
    integer :: irank
    !
    tag = 22
    sendbuf = 222
    !
    call MPI_Init(ierr)
    call MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr)
    call MPI_COMM_SIZE(MPI_COMM_WORLD,numtasks,ierr)
    !
    if (rank < 2) then
        color = 0
    else
        color = 1
    end if
    !
    call MPI_COMM_SPLIT(MPI_COMM_WORLD,color,rank,new_comm,ierr)
    !
    if (color .eq. 0) then
        call MPI_INTERCOMM_CREATE(new_comm,0,MPI_Comm_world,2,tag,inter1,ierr)
    !
    call MPI_COMM_RANK(inter1,irank,ierr)
    if(irank==0)then
        call mpi_send(sendbuf,1,MPI_INT,0,tag,inter1,ierr)
    end if
    !
    else if(color .eq. 1) then
        call MPI_INTERCOMM_CREATE(new_comm,0,MPI_COMM_WORLD,0,tag,inter2,ierr)
        call MPI_COMM_RANK(inter2,irank,ierr)
        if(irank==0)then
            call mpi_recv(recvbuf,1,MPI_INT,0,tag,inter2,stat,ierr)
            if(ierr/=MPI_SUCCESS)print*,'Error in rec '
            print*,'rec buff = ', recvbuf
        end if
    end if
    !
    call MPI_finalize(ierr)
end program h


text:
Q: How to get data from GPS Tracking Device to server Firstly I'm planning to set up an vehicle tracking system. I have my own server. There is a device which can send the data via GPRS. I can define an IP and a port number to this device. I want to connect this device to my server without and auxiliary device. What I want to ask is which format the device send the data(XML, TXT, or something like that), how I can write the data to the database. And if I have to use a computer to get the coordinates from the device, which language should I use?
*I have already read the user manual bu I couldn't find any.


text:
Q: Validation using JMeter Iam new to JMeter,Iam posting data in Queue using JMeter and after posting  manually opening my UI and validating the data present UI same or not!
"Is it possible posting data(Using JMS Publiher) and validate fields in UI uisng only J-Meter"
Note:we are not using Recording Controller concept for my script, i need validation using J-Meter
Thanks& Regards,
ManiKanta

A: It is.

*

*For posting data into queue check out JMS Publisher and/or JMS Point-to-Point samplers. You might also be interested in Building a JMS Testing Plan - Apache JMeter article.

*For opening UI - use normal HTTP Request sampler

*For comparing expected values with the actual go for Response Assertion


text:
Q: We already working on the project - We are already working on the project? Which sentence is correct?

We already working on the project
We are already working on the project

?

A: "We working on the project" is not a grammatical sentence in most varieties of English, as it does not have a finite verb.
Therefore "We already working on the project" is equally ungrammatical in most varieties of English.


text:
Q: LaTeX \chapter introduction My supervisor wants me to write an introduction for each chapter, between the chapter number and the chapter title. I don't know how am I supposed to do it.This is what I want:
Chapter 2:
blabla
Title of Chapter 2

And I also want to have in my table of contents the following:
2 Title of Chapter 2......... page 15
This is what she wrote:

A: The memoir class provides a macro \afterchapternum which inserts itself between the chapter number and the chapter title. The following, less any typos, is just to give you an idea.
\documentclass{memoir}
\begin{document}
\tableofcontents
\renewcommand{\afterchapternum}{{\\ \normalsize\textit{In this chapter \ldots}\\}}
\chapter{first}
Some text.
\renewcommand{\afterchapternum}{\\ \normalsize\textit{But here \ldots}\\}}
\chapter{Second}
More text.
\end{document}

This produces text between the chapter number and the title, but does not add the text to the ToC. As given the layout of the inserted text is not pretty but I don't know what your supervisor wants, except that it is passing strange.
Define a macro that encompasses the desired layout of the inserted text and use that before each \chapter. For instance:
\newcommand{\chapintro}[1]{\renewcommand{\afterchapternum}{{\\ \normalsize\textit{#1}\\}}}

Good luck with your supervisor.


text:
Q: Apache/httpd didn't load PHP file after a while So I just installed apache/httpd on my CentOS 7, the problem is, when apache starts, it executes the php code but after a while it doesn't anymore
For example i tried to restart httpd
systemctl restart httpd
And then i open http://xx.xxx.xxx.xx/info.php
It executes normally, but after a while, i tried to opened it again... info.php seems to no longer executed and just loading page appear and nothing displayed..
Im using PHP 5.4.16 and CentOS Linux release 7.9.2009


text:
Q: Hints for moving to using SVN or GIT to manage our code on the server? Our current situation:

*

*1 Apache server (hosted)

*30 gb of data, hundreds of folders/projects

*files are 99% html/php/js/css, with a bunch of pdf/ppt/docs etc.

*Several developers, working from different locations, using own computers

*Some devs have only access to certain directories (using different ftp accounts)

*All updates are made with FTP directly, saving over old files

*The hosting company makes basic daily/weekly backups, but access to those files requires their help

Now we know this isn't near an optimal solution. Every now and then somebody accidentally deletes working files with wrong ones etc etc.
What should we do to this:

*

*All files are automatically backed up, so mistakes can be recovered easily and securely

*Devs shouldn't have to change their workflow much, we really, really like the auto-save-to-FTP functionality of Dreamweaver & WinSCP

*We get the new, better way of working to affect also the current files

?

A: Argh!! I had to say it. :)
Your workflow assumes that mostly developers work on only certain well-defined parts of the project, right? Else, I think your current setup just won't work.
Then the first course of action could be to create separate source repositories for these separate 'projects'. I use the term project loosely to mean functionality (e.g. search), part of the website (e.g. About Us) or however else you divide up the work.
I wouldn't go with SVN. No new project should if you're starting from a clean slate. With git, I'd start with the following:

*

*Create a list of sub projects based upon folder structure (no overlapping files/folders)

*Commit them to separate git repositories

*Create a master git project and import all these git repositories as submodules into the right path

*Give repository-specific write permissions to the developers as before

*However, all them them should be able to read all repositories

*A single git clone of the master repository followed by the submodule init command will initialise the repository for each developer

A: I haven't used GIT. I use SVN heavily. From what you describe, you definitely need a version control system. You can achieve almost all (except may be auto save) from a version control system, plus you will thank it for saving a lot of mess you might be going under with your current system.
So, lets jump to your queries:
All files are automatically backed up, so mistakes can be recovered easily
and securely

Files in a revision system are indexed per commit (commit==save), so you can see complete history of a file. In build features like diff, help you to find exact changes made from one revision to other. You can recover accidentally deleted files. You would like (and appreciate) to learn repository structure and how it helps to ease release, spot fixes by branching the code. So, SVN covers ground here.
Creating user and setting authorization and authentication is matter of editing a text file with user-name, password, and it's realm(s).
Devs shouldn't have to change their workflow much, we really, really like the
auto-save-to-FTP functionality of Dreamweaver & WinSCP

There are a lot of plugins available for SVN for various IDE. I haven't worked in Dreamviewer but it seems working with SVN in Dreamweaver is seamless. I guess it might change your work-flow a bit, but it's a good change. In any case, you can always have things like Tortoise SVN to provide you with a great UI to work with.
We get the new, better way of working to affect also the current files

It's very easy to import files to SVN. Once you get basic SVN server running, all you need to just run svn import my/project/folder svn://svn.server.location/reponame/projectname/trunk for each project or something similar. And you get going.
What I suggest is to look into

*

*Advantage of using a VCS

*Confused between git and SVN?

*SVN Book (free resource)

*A very nice article on adobe.com on 'using Subversion with Dreamweaver'
PS: By the way, my answer is true to any modern VCS. Whatever you choose to go with will be better than what you currently have.


text:
Q: Why am I getting a "conflict" HTTP 409 response from CopyLeaks on export API calls? I'm getting an HTTP 409 "Conflict" response while handling CopyLeaks' "Completion" webhook when sending my export request. I'm getting it every time I submit a test scan today, but I wasn't getting it a couple days ago when I last tested the code. I'm getting it for each new scan. The response has no body and no more information. Any idea what would cause this and how to resolve?
Here's some debugging info:
Scan API request body:
{
    "base64": "IjEuIElzIGl0IG9rIHRvIGhhdmUgYSBkYXJrIHJvb20gZHVyaW5nIHRoZSBleGFtPw0KDQoobWluaW11bSBvbmUgcGFyYWdyYXBoIHJlc3BvbnNlIC0gIDUgc2VudGVuY2VzKSI6Ck9rIEknbSBnb2luZyB0byBzdGFydCB3cml0aW5nIG91dCBteSBhbnN3ZXJzLi4uIGxhbGFsYWxhbGFsYWxhLiBNWSBBTlNXRVJTIEFSRSBTVElMTCBIRVJFISBJIExPVkUgUEFDUklNCgoiMS4gYikgV2hlcmUgaXMgdGhlIG1vc3QgaW1wb3J0YW50IHBsYWNlIHRvIHNob3cgaW4gdGhlIHJvb20gc2Nhbj8NCihtaW5pbXVtIG9uZSBwYXJhZ3JhcGggcmVzcG9uc2UgLSAgNSBzZW50ZW5jZXMpIjoKU28gZmFzdC4gTm90aGluZyBpcyBzYXZlZCB5ZXQsIGl0IG9ubHkgZ2V0cyBzYXZlZCBldmVyeSBtaW51dGUuIEl0IGNvdWxkIGJlIGxvbmdlciwgaWYgeW91IHdhbnQuIE9yIHNob3J0ZXIuIEFsbGxsbGxsbCBnb29kLiBKdXN0IHdhdGNoIHRoZSByaWdodC1oYW5kIGNvcm5lciBvZiB0aGUgc2NyZWVuLiBNYWdpYyB3aWxsIGhhcHBlbi4KCiIyLiBJcyBpdCBvayB0byByZWFkIGZyb20geW91ciBwaG9uZSBkdXJpbmcgdGhlIGV4YW0/IA0KKG1pbmltdW0gMSBzZW50ZW5jZSBhbnN3ZXIuKSI6ClNvIG1hZ2ljLiB3YWl0IGZvciBpdC4gT2sgSSdsbCBmaW5pc2ggdXAuIFdhaXQgZm9yIHRoZSBhdXRvc2F2ZSBhZ2FpbiwganVzdCB0byBzaG93IGl0cyBzdGlsbCB3b3JraW5nLi4uLiBldmVudHVhbGx5Li4uIEkgdGhpbmsgaW4gYSBmZXcgc2Vjb25kcy4uLiBtYXliZS4uLi4NCkkgc3VwcG9zZSB5b3UgY2FuIGZhc3QgZm9yd2FyZCB0aGlzIGlmIHlvdSB3YW50LiBOb3QgbWUuIEknbSBzdHVjayBpbiBodW1hbiB0aW1lLiBPSCENCk9rIG5vdyBJJ2xsIHN1Ym1pdC4KCg==",
    "filename": "087.txt",
    "properties": {
        "developerPayload": "Submitted by Mike",
        "exclude": {
            "quotes": true,
            "titles": true
        },
        "sandbox": true,
        "webhooks": {
            "status": "https://dev.earlychildhoodeducator.com/copyleaks/webhook/completed/087"
        }
    }
}

Completed webhook received body:
{"scannedDocument":{"scanId":"087","totalWords":158,"totalExcluded":56,"credits":0,"expectedCredits":1,"creationTime":"2021-07-21T03:48:41.013271Z","metadata":{"filename":"uploaded.txt"}},"results":{"score":{"identicalWords":1,"minorChangedWords":0,"relatedMeaningWords":0,"aggregatedScore":1.0},"internet":[{"url":"http://example.com/","id":"2a1b402420","title":"Example Domain","introduction":"Example Domain This domain is for use in illustrative examples in documents. You may use this domain in literature without ...","matchedWords":1,"metadata":{"finalUrl":"http://example.com/","filename":"source"}}],"database":[],"batch":[],"repositories":[]},"notifications":{"alerts":[]},"status":0,"developerPayload":"Submitted by Mike"}

Export API body:
{
    "completionWebhook": "https://dev.earlychildhoodeducator.com/copyleaks/webhook/exported/87",
    "crawledVersion": {
        "endpoint": "https://dev.earlychildhoodeducator.com/copyleaks/webhook/crawled/87",
        "headers": [
            [
                "HTTP_PRECI",
                "PRECI uOaDeRrRVhRPhQhJgHNK"
            ]
        ],
        "verb": "POST"
    },
    "results": [
        {
            "endpoint": "https://dev.earlychildhoodeducator.com/copyleaks/webhook/result/87/2a1b402420",
            "headers": [
                [
                    "HTTP_PRECI",
                    "PRECI uOaDeRrRVhRPhQhJgHNK"
                ]
            ],
            "id": "2a1b402420",
            "verb": "POST"
        }
    ]
}

Export API response:
status: "Conflict"
Headers:
{'Date': 'Wed, 21 Jul 2021 03:49:26 GMT', 'Content-Length': '0', 'Connection': 'keep-alive', 'Strict-Transport-Security': 'max-age=2592000; includeSubDomains', 'CF-Cache-Status': 'DYNAMIC', 'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Report-To': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=WFnYOPnNkcR4D%2F1%2BCbmHopFZw9ZtYMtUAVjA8Vx3c8OLYZakWpL76ysOKJ03Yd%2Fo6eNUaO35T%2B0k2lZxaUB9g6VYnmur9JrAnhL0G6%2FeceKE%2BTXCJBeMdEQDgGnEOrHRvTON"}],"group":"cf-nel","max_age":604800}', 'NEL': '{"report_to":"cf-nel","max_age":604800}

and no response body.

A: Each Export task has their unique task id. Once you create a job with the requested id, you cannot create another export job with the same id.
Having said that, if you are getting error 409, I assuming that you are trying to Export multiple tasks with the same job id.
In order to submit a unique export Id, you have to change the URI to this form:
https://api.copyleaks.com/v3/downloads/scanId/export/UNIQUE_JOB_ID

and having a UNIQUE_JOB_ID each new export job you create.


text:
Q: Asymmetry between high order and low order interaction terms Suppose we have a distribution for  $\mathbf{x}\in \{-1,1\}^n$ and are interested in representing $p(\mathbf{x})$ as a linear exponential family with sufficient statistics of the form $1,x_1,x_2,\ldots,x_1 x_2,\ldots,x_1 x_2 \cdots x_n$
Suppose we know that entropy some measure of complexity of target distribution is bounded. We can view the parameter vector as a probability distribution $D$. Can we say anything about how the mass in $D$ is distributed among terms of various orders for some interesting complexity measure? Are there complexity measures that force mass onto low-order terms?
Restricting attention to graphical models means discarding 3rd and higher order terms. I'm interested in some explanation why this works so well
This was motivated by a similar question on CSTheory
Edit 11/29
Below is the probability simplex of of distributions over $\{-1,1\}$ valued $x_1,x_2$, in "probability" coordinates and in "log-linear" coordinates. In second picture, x,y axes correspond to coefficients in front of $x_1$ and $x_2$, z axis is the coefficient of $x_1 x_2$ term. You can see first and second order dimensions are symmetric, so bounding entropy (or any other symmetric function of distribution) is not enough to force mass onto low-order coefficients....

Mathematica source

A: Under these assumptions any permutation of the monomials leads to exactly the same results, implying there is no inherent distinction between the low order terms and other terms.

If this doesn't seem convincing, let's look at a simple example.  Pick any one of the monomials and set $f(\mathbf{x}, \theta)$ proportional to $\exp(\theta t(\mathbf{x}))$ where $t$ evaluates to $1$ for the selected monomial and otherwise equals $0$.  In other words, letting $C(\theta) = \left(\exp(\theta) + 2^n - 1\right)^{-1}$ be the normalizing coefficient,
$$\eqalign{
f &= C(\theta) e^{\theta} &\text{ for this monomial}\cr
  &= C(\theta) &\text{ for all other monomials.}
}$$
The entropy of this distribution equals
$$\eqalign{
H(\theta) &= -\mathbb{E}\left[\log(f)\right] \cr
          &= \frac{\log(2^n-1) + (1+e^x)\log(1+e^x) - x e^x}{1 + e^x}
}$$
(writing $x = \theta - \log(2^n-1)$ to better isolate the dependence on $n$).
As $\theta$ ranges from $0$ to $\infty$, the entropy descends from $n/\log(2)$, which is the maximum attainable for any distribution, to $0$ (asymptotically), making the transition near $\theta = n \log(2)$.  At this value of $\theta$ half the mass is concentrated on the chosen monomial and the entropy is approximately one-third of its maximum possible value.
We can play a more complicated game by focusing various amounts of the probability on any subset of the monomials we choose and putting vanishing amounts of probability on the remaining monomials.  With such an approach we can meet any feasible lower bound on the entropy with a distribution that is as heavily concentrated on the chosen subset as possible.  There is nothing to distinguish one subset from another.  Thus, nothing informative can be said in general concerning the concentration of the distribution on the low order terms.


text:
Q: ember hash urls in google I am concerned about page ranking on google with the following situation:
I am looking to convert my existing site with 150k+ unique page results to a ember app, off the route. so currently its something like  domain.com/model/id - With ember and hash change - it will be /#/model/id. I really want history state but lack of IE support doesn't leave that as a option. So my Sitemap for google has lots and lots of great results using the old model/id. On the rails side I will test browser for compatibility, before either rendering the JS rich app or the plain HTML / CSS. Does anyone have good SEO suggestions with my current schema for success.
Linked below is my schema and looking at the options -
http://static.allplaces.net/images/EmberTF.pdf
History state is awesome but it looks like support is only around 60% of browsers.
http://caniuse.com/history
Thanks guys for the suggestions, the google guide is similar to what I'm going to try. I will roll it out to 1 client this month, and see what webmasters and analytics show.

A: here is everything you need to have your hash links be seo friendly: https://developers.google.com/webmasters/ajax-crawling/
basically You write Your whole app with hashlinks, but You have to add "!" to them, so You have #!/model/id. Next You must have all pages somewhere generated and if google asks for them, return "plain html" as described here:  https://developers.google.com/webmasters/ajax-crawling/docs/getting-started
use google webmaster tools to check if Your site is crawlable.

A: I'm not sure if you're aware that you can configure Ember to use the browser history for the location API and keep using your pages the way they are reference now. All you need to do is configure the Route's location property
App.Router.reopen({
  location: 'history'
});

See more details about specifying the location api here


text:
Q: Best HTML5 markup for sidebar I'm setting up my WordPress sidebars for an HTML5 theme and really wanting to use before_widget and after_widget right.
So my question is this: which of the two markup patterns is more appropriate? The following code is all completely outside the
 element.
Option 1: Aside with sections

Option 2: Div with Asides

I suppose the auxiliary question is then what heading to use for each widget title. If I wrap each widget in a
 then
 seems most appropriate. If I use , I'm not sure.
All opinions welcome. Devil's advocates encouraged.

A: Based on this HTML5 Doctor diagram, I'm thinking this may be the best markup:

...

...

...

I think it's clear that  is the appropriate element as long as it's outside the main
 element.
Now, I'm thinking that
 is also appropriate for each widget in the aside. In the words of the W3C:

The article element represents a self-contained composition in a
  document, page, application, or site and that is, in principle,
  independently distributable or reusable, e.g. in syndication. This
  could be a forum post, a magazine or newspaper article, a blog entry,
  a user-submitted comment, an interactive widget or gadget, or any
  other independent item of content.

A: First of all ASIDE is to be used only to denote related content to main content, not for a generic sidebar. Second, one aside for each sidebar only
You will have only one aside for each sidebar. Elements of a sidebar are divs or sections inside a aside.
I would go with Option 1: Aside with sections

Here is the spec https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside
Again use section only if they have a header or footer in them, otherwise use a plain div.

A: The book HTML5 Guidelines for Web Developers: Structure and Semantics for Documents suggested this way (option 1):

It also points out that you can use sections in the footer.  So section can be used outside of the actual page content.

A: Update 17/07/27: As this is the most-voted answer, I should update this to include current information locally (with links to the references).
From the spec [1]:

The aside element represents a section of a page that consists of
  content that is tangentially related to the content of the parenting
  sectioning content, and which could be considered separate from that
  content. Such sections are often represented as sidebars in printed
  typography.

Great! Exactly what we're looking for. In addition, it is best to check on
 as well.

The section element represents a generic section of a document or
  application. A section, in this context, is a thematic grouping of
  content. Each section should be identified, typically by including a
  heading (h1-h6 element) as a child of the section element.
...
A general rule is that the section element is appropriate only if the element's contents would be listed explicitly in the document's outline.

Excellent. Just what we're looking for. As opposed to
 [2] which is for "self-contained" content,
 allows for related content that isn't stand-alone, or generic enough for a
 element.
As such, the spec seems to suggest that using Option 1,  with
 children is best practice.
References

*

*https://www.w3.org/TR/html51/sections.html#the-aside-element

*https://www.w3.org/TR/html51/sections.html#elementdef-article

*http://html5doctor.com/aside-revisited/

A: Look at the following example, from the HTML5 specification about aside.
It makes clear that what currently is recommended (October 2012) it is to group widgets inside aside elements. Then, each widget is whatever best represents it, a nav, a serie of blockquotes, etc

The following extract shows how aside can be used for blogrolls and
  other side content on a blog:

My wonderful blog

My tagline

My blogroll

Example Blog

Archives

My last post

My first post

Twitter Feed

   I'm on vacation, writing my blog.

   I'm going to go on vacation soon.

My last post

This is my last post.

Permalink

My first post

This is my first post.

Posting

While I'm thinking about it, I wanted to say something about
   posting. Posting is fun!

Permalink

   Archives —
   About me —
   Copyright

A: I'm surprised that none of the responses above consider responsive design.
I may have valid aside elements such as a tag cloud, links for further reading and so on together, one after the other, in my sidebar when my page is viewed on a desktop device.
However, when my page is reduced on a mobile device to a single column then I will be separating those elements. My navigation element will go between my header and main content elements, and links for further reading will go below the main content element, above the footer.
As the semantic content of these elements is not changing with the width of the display window, then they need to be individually marked up as aside elements.
It follows then, that the sidebar itself should not be marked up as an aside element, even when it only contains content of one type.
In turn, this means that Option 1 in the original question must be undesirable (wrong?) and that the better answer should be Option 2.

A: The ASIDE has since been modified to include secondary content as well.
HTML5 Doctor has a great writeup on it here:
http://html5doctor.com/aside-revisited/
Excerpt:

With the new definition of aside, it's crucial to remain aware of its context. >When used within an article element, the contents should be specifically related >to that article (e.g., a glossary). When used outside of an article element, the >contents should be related to the site (e.g., a blogroll, groups of additional >navigation, and even advertising if that content is related to the page).


text:
Q: How I can run my App on my iOS device in Xcode 9 ? I have a problems when I want to run my application on my iPhone in Xcode 9 and using Swift lang.
When  I run this application in simulator everything is all right, but when I connect my iPhone (by cable or wireless) to my MBP I have an error:

Swift stdlib tool Error: Task failed with exit 1 signal 0

and application stopped.
Why I have this error message and how can I test my app on my devices?
Thanks for all answers.
P.S.: Xcode 9.2 (9C40b) iOS 11.2 (Deployment target)

A: If removing DerivedData don't help try to just reboot phone or mac.
It mainly works for me with that error


text:
Q: How to change playback rate in jwplayer I want to change the playback speed of video in HTML5 mode of jwplayer. I am not interested in flash browser, we will be restricting this feature only for HTML5 browsers
Issue:
I tried changing the playbackrate for HTML5 in jwplayer but playbackrate is coming undefined
i am attaching my code below
    jwplayer('my-video').setup({
                 sources: [
                      {file:'./test.mp4' , type: "mp4" },
                     ],
                 width:'640px',
                 height:'360px',
                 image : './test.jpg'
              });
$("#speed_10").click(function() {
        myVid=$( "#my-video" ).find('.jwvideo').find('video');
        alert(myVid.length);

        alert($( "#my-video" ).find('.jwvideo').find('video').attr('src'))
        alert(myVid.playbackRate)
        alert($( "#my-video" ).find('.jwvideo').find('video').length)
        $( "#my-video" ).find('.jwvideo').find('video').PlaybackRate=0.5;

 });

1st alert coming as 1
2nd alert coming undefined
3rd alert is showing "source"
4th alert is 1
I am able to catch the div but not able to change the playback rate in jquery !!!
http://www.longtailvideo.com/support/forums/jw-player/feature-suggestions/32556/playbackrate-support/
following above link i also tried with java script and it worked using code below
(document.getElementsByTagName('video')[0].playbackRate=0.2.

but if i use above code how do i use this for multiple video since there is no ID involved in above code [no unique id is passed for above javascript]
Below is the div structure for the jwplayer

A: Found this script manually manipulating the DOM for custom speeds:
<script type="text/javascript">
  jwplayer("video").setup({
      image: 'https://<your_CDN_ID>.cloudfront.net/static/splash/<splash.png>',
      width: 960,
      height: 600,
      flashplayer: "https://<your_CDN_ID>.cloudfront.net/assets/jwplayer.flash.swf",
      html5player: "https://<your_CDN_ID>.cloudfront.net/assets/jwplayer.html5.js",
      primary: 'html5',
      sources: [
          { file: 'https://<your_CDN_ID>.cloudfront.net/static/videos/<video>.mp4' },
          { file: 'https://<your_CDN_ID>.cloudfront.net/static/videos/<video>.webm' }
      ]
  });

  var tag;

  jwplayer().onReady(function(){
    if (jwplayer().getRenderingMode() == "flash") {
      return;
    }

    tag = document.querySelector('video');
    tag.defaultPlaybackRate = 1.0;
    tag.playbackRate = 1.0;

    jwplayer().addButton("https://<your_CDN_ID>.cloudfront.net/assets/25.png", "", function(){
      jwplayer().seek(jwplayer().getPosition());
      tag.playbackRate = 0.25;
    },"025");

    jwplayer().addButton("https://<your_CDN_ID>.cloudfront.net/assets/05.png", "", function(){
      jwplayer().seek(jwplayer().getPosition());
      tag.playbackRate = 0.5;
    },"05");

    jwplayer().addButton("https://<your_CDN_ID>.cloudfront.net/assets/1.png", "", function() {
      jwplayer().seek(jwplayer().getPosition());
      tag.playbackRate = 1.0;
    },"1");

    jwplayer().addButton("https://<your_CDN_ID>.cloudfront.net/assets/125.png", "", function() {
      jwplayer().seek(jwplayer().getPosition());
      tag.playbackRate = 1.25;
    },"125");

    jwplayer().addButton("https://<your_CDN_ID>.cloudfront.net/assets/15.png", "", function() {
      jwplayer().seek(jwplayer().getPosition());
      tag.playbackRate = 1.5;
    },"15");

    jwplayer().addButton("https://<your_CDN_ID>.cloudfront.net/assets/2.png", "", function() {
      jwplayer().seek(jwplayer().getPosition());
      tag.playbackRate = 2.0;
    },"2");

  });

</script>

Instead of toggle like the excellent blogpost from Ethan there are speed buttons.
Just setting a custom speed:
document.querySelector('video').playbackRate=0.80;

A: https://developer.jwplayer.com/jw-player/demos/advanced/set-playback-rate/
only add line playbackRateControls in .setup()
jwplayer('user-player').setup({
playlist: 'https://cdn.jwplayer.com/v2/media/gaCRFWjn',
  // Set the available playback rates of your choice
  playbackRateControls: [0.75, 1, 1.25, 1.5]
});

A: Just add ids to your videos and use document.getElementsById (id) instead of document.getElementsByTagName.
document.getElementsById('yourid').playbackRate=0.2

A: I found the answer for this, main issue which i faced for multiple video was how to make each video unique.i just had to get div by ID first and after get 'Video' tag than change playbackrate
 adding the code below
var video = document.getElementById('exampleId')
var video_speed = video.getElementsByTagName('video')[0]
alert(video_speed.playbackRate)

video_speed.playbackRate=0.2;
alert(video_speed.playbackRate)

I even tried with multiple video, it worked fine

A: I wrote a blog post about a how to do this in the JW Player, by the way. It might be helpful! - http://www.longtailvideo.com/blog/33860/slow-motion-with-jw-player


text:
Q: How to display a long text file whiptail This is the code than open a whiptail message box based on the content of the file in the file variable. The file has many lines.
$(whiptail --title "Opening file" --yesno "$(cat $file)" 78 78 3>&1 1>&2 2>&3)

Now the box is fixed in width and height.
How to show a scrolling text box so I can see all of the text in the file?

A: The option --scrolltext is supposed to do this, and reading source code, it applies to textbox and messagebox (yesno is a special case of the latter), but in a quick check, I see no scrollbar.  Perhaps it will work with the version of newt which you are using.


text:
Q: Trouble creating multiple modals I've been working on a professional website that will include a portfolio section. I want the portfolio to contain several thumbnails--when each thumbnail is clicked on, a modal should open with more information about that subject. The problem I'm running into is that only the first modal opens. The second one doesn't work (and I'd like to add several of these ideally). I've been reading online help for months now and trying different solutions. Nothing has worked so far. I'll post the code here. Apologies for the length, the blocky colors, and the lack of images in this version. But I think you get the idea. Click on the buttons marked "Users conducting a card sort" to see the issue I'm having. Any help is appreciated!

// Get the modal
var modal = document.getElementsByClassName("modal")[0];

// Get the button that opens the modal
var btn = document.getElementsByClassName("button")[0];

// Get the  element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks on the button, open the modal
btn.onclick = function() {
  modal.style.display = "block";
}

// When the user clicks on  (x), close the modal
span.onclick = function() {
  modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}

// Cache selectors
var lastId,
    topMenu = $("#nav-links"),
    topMenuHeight = topMenu.outerHeight()+15,
    // All list items
    menuItems = topMenu.find("a"),
    // Anchors corresponding to menu items
    scrollItems = menuItems.map(function(){
      var item = $($(this).attr("href"));
      if (item.length) { return item; }
    });

// Bind click handler to menu items
// so we can get a fancy scroll animation
menuItems.click(function(e){
  var href = $(this).attr("href"),
      offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+1;
  $('html, body').stop().animate({
      scrollTop: offsetTop
  }, 300);
  e.preventDefault();
});

// Bind to scroll
$(window).scroll(highlightNav);

$(window).ready(highlightNav);

function highlightNav(){
   // Get container scroll position
   var fromTop = $(this).scrollTop()+topMenuHeight;

   // Get id of current scroll item
   var cur = scrollItems.map(function(){
     if ($(this).offset().top < fromTop)
       return this;
   });
   // Get the id of the current element
   cur = cur[cur.length-1];
   var id = cur && cur.length ? cur[0].id : "";

   if (lastId !== id) {
       lastId = id;
       // Set/remove active class
       menuItems
         .parent().removeClass("active")
         .end().filter("[href='#"+id+"']").parent().addClass("active");
   }
}
*{
 margin: 0px;
 padding: 0px;
 box-sizing: border-box;
}

@media screen and (prefers-reduced-motion: reduce) {
 html {
  scroll-behavior: auto;
 }
}

#logo {
 max-width: 10%;
 height: auto;
 padding: 1vh;
}

nav {
 display: flex;
 position: fixed;
 z-index: 1; /* Stay on top */
   top: 0; /* Stay at the top */
 justify-content: space-around;
 align-items: center;
 min-height: 15%;
 background-color: grey;
 font-family: 'Red Hat Display', sans-serif;
}

.navname {
 color: #ECEAEA;
 text-transform: uppercase;
 letter-spacing: 0.4vw;
 font-size: 2.2vw;
 font-family: 'Volkhov', serif;
}

#nav-links {
 display: flex;
 justify-content: space-around;
 width: 38%;

}

#nav-links li {
 list-style: none;
}

#nav-links a {
 color: #ECEAEA;
 text-decoration: none;s
 font-weight: bold;
 letter-spacing: 0.2vh;
 font-size: 1.2vw;
 -webkit-transition: 50ms all ease-out;
    -moz-transition: 50ms all ease-out;
    transition: 50ms all ease-out;
}

#nav-links li.active a {
    color: #EADA15;
}
#mainpage {
 padding-left: 1vh;
 background-color: #EADA15;
 padding-top: 1%
}

#about {
 padding-top: 14%;
}

#portfolio, #experience, #education {
 padding-top: 12%
}
.column1 {
 width: 31%;
 float: left;
 margin: 1%;
}

.column2 {
 width: 64%;
 float: right;
 margin: 1%;
}

#portrait {
 max-width: 100%;
 height: auto;
 padding: 0vh;
}

.bodytext {
 font-family: 'Red Hat Text', sans-serif;
 font-size: 1.5vw;
 line-height: 2vw;
 text-align: justify;
 vertical-align: middle;
}
.divider {
 width: 100%;
 overflow: auto;
}

.column3, .column4, .column5 {
 width: 29%;
 float: left;
 margin: 1%;
}

#portfolio {
 background-color: blue;
 overflow: auto;
}

button {
 background-color: blue;
 border: none;
}

/* The Modal (background) */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
  -webkit-transition: all 3s;
  -moz-transition: all 3s;
  transition: all 3s;
}

/* Modal Content/Box */
.modal-content {
  background-color: #fefefe;
  margin: 10% auto; /* 15% from the top and centered */
  padding: 20px;
  border: 1px solid #888;
  width: 60%; /* Could be more or less, depending on screen size */\
}

/* The Close Button */
.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

.portfolioimage {
 cursor: pointer;
 -webkit-filter: brightness(100%);
}

.portfolioimage:hover {
    -webkit-filter: brightness(70%);
    -webkit-transition: all 500ms ease;
    -moz-transition: all 500ms ease;
    -o-transition: all 500ms ease;
    -ms-transition: all 500ms ease;
    transition: all 500ms ease;
}

@media screen and (max-width:1024px){
 .nav-links a {
  font-size: 1.5vw;
 }
}

@media screen and (max-width:768px){
 nav {
 min-height: 20vh;
 }

 #logo {
 max-width: 15%;
 height: auto;
 padding: 1vh;
 }

 .navname {
  font-size: 3vh;
 }

 .nav-links{
  display: block;
  text-align: left;
  width: 15%
 }

 .nav-links li {
  line-height: 4vh;
 }

 .nav-links a {
  font-size: 2vh;
  padding: 0.5vh;
 }

 #about {
  padding-top: 11vh;
 }

 .bodytext {
 font-size: 2.5vw;
 line-height: 3vw;
 text-align: left;

}
}

/* Modal Content */
.modal-content {
 position: relative;
 animation-name: animatetop;
 animation-duration: 1.4s
}

/* Add Animation */
@keyframes animatetop {
 from {top: -500px; opacity: 0}
 to {top: 0; opacity: 1}
}

<!doctype html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <link href="styles.css" rel="stylesheet">

    <title>Adam McBride-Smith</title>

Adam McBride-Smith

    About

    Portfolio

    Experience

    Education

I'm a technical communicator with a background in education and a passion for creative problem solving. Whether conducting user research, designing accessible interfaces, drafting flow diagrams, or writing documentation, I believe that collective efforts often produce the best results, and that technology can help show the way to a more open, compassionate, and democratic future.

Portfolio

    <button id="myBtn1" class="button"></button>

     ×

Web Page Usability Testing

Competencies: Usability Testing, Data Analysis, Content Management

        Personal Characteristics: Collaboration, Critical Thinking

      Tools: MS Excel

As a project for a class on research methods at Portland State University, I participated in exploratory usability testing of a web page. The page was designed to help students and faculty in the Professional and Technical Writing Program get answers to their questions about the program. The purpose of the study was to determine whether the information categories used by the page aligned with user preferences.

We started our research by conducting both open and closed card sorts. During our closed card sort, printed category cards that matched the actual site menu were distributed among the groups of users. Subcategory cards were also distributed. Our test participants then grouped the subcategory cards under their preferred headings. Data from each card sort was collected and collated to show the user preferences of the group as a whole.

Following the card sorts, I participated in creating a similarity matrix to describe the groupings preferred by our card sort participants, and to compare those preferences with the actual information design of the MPTW web page. We were able to highlight areas where the site aligned with user expectations, but also important areas where it was not aligned. Analyzing our data against the actual site brought to light some of the idiosycrasies that can result when legacy content is updated with more recent content, such as information "islands," and inconsistent formatting. At the conclusion of our study, we compiled our findings and presented them to the head of the MPTW program.

    <button id="myBtn2" class="button"></button>

     ×

Web Page Usability Testing

Competencies: Usability Testing, Data Analysis, Content Management

        Personal Characteristics: Collaboration, Critical Thinking

      Tools: MS Excel

As a project for a class on research methods at Portland State University, I participated in exploratory usability testing of a web page. The page was designed to help students and faculty in the Professional and Technical Writing Program get answers to their questions about the program. The purpose of the study was to determine whether the information categories used by the page aligned with user preferences.

We started our research by conducting both open and closed card sorts. During our closed card sort, printed category cards that matched the actual site menu were distributed among the groups of users. Subcategory cards were also distributed. Our test participants then grouped the subcategory cards under their preferred headings. Data from each card sort was collected and collated to show the user preferences of the group as a whole.

Following the card sorts, I participated in creating a similarity matrix to describe the groupings preferred by our card sort participants, and to compare those preferences with the actual information design of the MPTW web page. We were able to highlight areas where the site aligned with user expectations, but also important areas where it was not aligned. Analyzing our data against the actual site brought to light some of the idiosycrasies that can result when legacy content is updated with more recent content, such as information "islands," and inconsistent formatting. At the conclusion of our study, we compiled our findings and presented them to the head of the MPTW program.

#

#

#

#

#

#

#

#

Experience

#

#

#

#

#

#

#

#

#

#

#

#

#

#

#

#

Education

#

#

#

#

#

#

#

#

#

#

#

#

#

#

#

#

#

#

#

#

A: var btn = document.getElementsByClassName("button")[0]; this line mentions only to select the first element([0]) from the list, that is why it only works for first element.
var btn = document.getElementsByClassName("button")[0];

btn.onclick = function() {
  modal.style.display = "block";
}

This part of your code explicitly selects the first button and adds an event listener to it. Instead write it like this.
var btn = document.getElementsByClassName("button");
btn.forEach((b,i)=>{
  b.onclick = function() {
    modal[i].style.display = "block";
  }
})

also do the same if you have multiple modals.

A: @greyface, that makes sense. I tried to implement this and now neither modal is working, although it's quite possible that I've done it incorrectly. I'm also getting a warning in Dreamweaver that there's an "unexpected token" in line 12.
// Get the modal
var modal = document.getElementsByClassName("modal");

// Get the button
var btn = document.getElementsByClassName("button");

// Get the  element that closes the modal

var span = document.getElementsByClassName("close");

// When the user clicks on the button, open the modal
btn.forEach(b=>{b.onclick = function() {
  modal.style.display = "block";
}})

// When the user clicks on  (x), close the modal
span.onclick = function() {
  modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}


text:
Q: Application of Frequency Response Theorem in Linear Circuits One of the most important results of control theory for linear systems is the so called "Frequency Response Theorem" (here the references):

Briefly, it says that under the hypotesis of stability and linearity, if the input signal is sinusoidal, the output signal will be the original sine with phase and amplitude variations respectively equal to phase and amplitude of the transfer function of that system.
Now, let's consider for instance a RC low pass filter:

The output signal will be like this:

So, it is not sinusoidal, although both R and C are linear components. Where is the mistake?

A: The problem is that you statement: "The output signal will be like this:" is rather wrong.
What you have shown there is the output of a rectifier circuit. I don't know where that came from but it is NOT the output of the given circuit.
You get that output waveform if you replace the R with a diode, but in that case you no longer have a Linear Circuit.

A: The transfer function of the shown circuit is equal to:
$$\mathcal{H}\left(\text{s}\right):=\frac{\text{V}_\text{out}\left(\text{s}\right)}{\text{V}_\text{in}\left(\text{s}\right)}=\frac{\frac{1}{\text{sC}}}{\frac{1}{\text{sC}}+\text{R}}=\frac{1}{1+\text{sCR}}\tag1$$
Now, when:
$$\text{v}_\text{in}\left(t\right)=\hat{\text{u}}\sin\left(\omega t+\varphi\right)\tag2$$
We get:
$$\text{V}_\text{in}\left(\text{s}\right)=\mathcal{L}_t\left[\hat{\text{u}}\sin\left(\omega t+\varphi\right)\right]_{\left(\text{s}\right)}=\hat{\text{u}}\cdot\frac{\text{s}\sin\left(\varphi\right)+\omega\cos\left(\varphi\right)}{\text{s}^2+\omega^2}\tag3$$
So, the output voltage is:
$$\text{V}_\text{out}\left(\text{s}\right)=\frac{1}{1+\text{sCR}}\cdot\text{V}_\text{in}\left(\text{s}\right)=\frac{1}{1+\text{sCR}}\cdot\hat{\text{u}}\cdot\frac{\text{s}\sin\left(\varphi\right)+\omega\cos\left(\varphi\right)}{\text{s}^2+\omega^2}\tag4$$
Assume that \$\text{C}=\text{R}=\omega=\hat{\text{u}}=1\$ and \$\varphi=0\$. In the time-domain we get:
$$\text{v}_\text{out}\left(t\right)=\frac{\exp\left(-t\right)}{2}+\frac{\sin\left(t\right)-\cos\left(t\right)}{2}\tag5$$


text:
Q: Why does fn_my_permissions(NULL, 'SERVER') return different results depending on which database is in use? fn_my_permissions "returns a list of the permissions effectively granted to the principal on a securable."
use master
select * from fn_my_permissions(NULL, 'SERVER') // 25 rows

use some_other_database
select * from fn_my_permissions(NULL, 'SERVER') // 25 rows

use a_third_database
select * from fn_my_permissions(NULL, 'SERVER') // 0 rows

Why would my SERVER level permissions depend on what database I was using?


text:
Q: Allow comma separated values in a prompt: Youtube API Example I'm looking to modify YouTube API Apps Script to allow comma separated values in a prompted; or alternative method.
I have been learning how to pull data from the YouTube API through Apps Script using the following example: https://developers.google.com/youtube/v3/quickstart/apps-script
I am able to execute the code but now I'm looking to learn how to be able to add multiple string values to the prompt.  In the example, you add a channel name (string) and it will output an ID and view count.  I would like to see how you can allow the script to take multiple values.
Add: RedBull, JimmyKimmelLive, ESPN as an example.  I believe the call needs to be modified in the below code with the getResponseText.  Although, I'm not sure if you would have to call it a different way to allow more than one value.
  var ui = SpreadsheetApp.getUi();
  var channelName = ui.prompt("Enter the channel name: ").getResponseText();
  channelsListByUsername('snippet,contentDetails,statistics',
                         {'forUsername': channelName});

A: *

*You want to input the multiple values to the prompt.

*

*Sample value is RedBull, JimmyKimmelLive, ESPN.

*You want to retrieve each value from RedBull, JimmyKimmelLive, ESPN, and give them to channelsListByUsername().

If my understanding is correct, how about this modification? Please think of this as just one of several answers. The flow of this modified script is as follows.

*

*Input the value of RedBull, JimmyKimmelLive, ESPN to the prompt.

*Parse the inputted value using split().

*Give each value of the parsed value to channelsListByUsername().

*

*At that time, I used trim() for this situation.

Modified script:
var ui = SpreadsheetApp.getUi();
var channelName = ui.prompt("Enter the channel name: ").getResponseText();
var values = channelName.split(",");
for (var i = 0; i < values.length; i++) {
  channelsListByUsername('snippet,contentDetails,statistics', {'forUsername': values[i].trim()});
}

Note:

*

*In this sample script, the delimiter of inputted value is ,. If you want to other patterns, please tell me.

References:

*

*split()

*trim()
If I misunderstood your question and this was not the result you want, I apologize.


text:
Q: Equidistant "Recursive" form to explicit form Let $$x_i = \frac{x_{i+1}+x_{i-1}}{2} \quad \text{for $i \in \{2,...,k\}$}$$
and $x_0 = 1$, $x_{k+1}=0$
I want to prove that $x_i = 1-\frac{i}{k+1}$

I noticed that $$x_i = \frac{x_{i+1}+x_{i-1}}{2}=\frac{\frac{x_{i+2}+x_{i}}{2}+\frac{x_{i}+x_{i-2}}{2}}{2}$$
$$\Rightarrow x_i = \frac{x_{i+2}+x_{i-2}}{2}$$
which makes the points equidistant from each other. Visibly, I see this as a linear function if you'd map $(0,x_0),(1,x_2),...$
But I'd still like some tips how to show this in a nice mathematical way.

A: Certainly noticing that it is a linear function is helpful. You can then make the Ansatz $x_j = Aj + B$ and solve for the coefficients. Alternatively, if you didn't notice that, this is a linear difference equation and the Ansatz $x_j = z^j$ would allow you to find this as well.


text:
Q: SQLAlchemy polymorphic association I try to implement polymorphic association by mean of SQLAlchemy library and use for it the example:
discriminator_on_association.
 But there is one incompatibility with my case. In the example: Address objects created and then they added to Supplier or Customer (so Address table has polymorphic foreign key to the Supplier and Customer tables and Supplier and Customer object backref to the Address). While Address object add to the one these tables SQLAlchemy automatically solve how to assign Id's on the tables. Then Supplier or Customer object can be obtained using 'parent' field of the Address.
 Though in my case I need first create Address object and then assign to the address parent an object (e.g. Company, in example it was Supplier and Customer).
 Example of the using polymorphic association as for my case:
engine = create_engine('sqlite://', echo=True)
Base.metadata.create_all(engine)

session = Session(engine)

address = Address(street='2569 west elm', city="Detroit", zip="56785")

cust = Customer(name="Tester")
supl = Supplier(company_name="Ace Hammers")

address.parent = supl

session.add_all([address])

session.commit()

But if I try to apply this pattern to my case without modification I receive the next error message:

Traceback (most recent call last):
  File "discriminator_on_related.py", line 131, in
    address.parent = supl
  File "C:\Python27\lib\site-packages\sqlalchemy-0.9.3-py2.7-win32.egg\sqlalchemy\ext\associationproxy.py", line 271, in __set__
    setattr(obj, self.target_collection, creator(values))
TypeError: __init__() takes exactly 1 argument (2 given)

How I should modify this pattern to make it works?
P.S. Sorry if it's trivial question (SQLAlchemy association_proxy looks like some kind of magic for me).

A: Sorry everyone who was bothered in this question. May be the answer will be useful for someone. The answer was really too easy. The main my mistake was that I've use a complicated pattern example as base on my case. To solve this task was only required to split it on subtasks. So this task consist of polymorphic inheritance with joined tables (that implement quite easy using SQLAlchemy) and setting foreign key on common (parent) table. That's show the next code snippet:
@as_declarative()
class Base(object):
    @declared_attr
    def __tablename__(cls):
        return cls.__name__.lower()
    id = Column(Integer, primary_key=True)

class CompanyInterface(Base):
    discriminator = Column(String)

    __mapper_args__ = {"polymorphic_on": discriminator}

class Address(Base):
    street = Column(String)
    city = Column(String)
    zip = Column(String)
    company_id = Column(Integer, ForeignKey(CompanyInterface.id))
    company = relationship(CompanyInterface)

    def __repr__(self):
        return ("%s(street=%r, city=%r, zip=%r, company=%r)" %
                (self.__class__.__name__, self.street, self.city, self.zip, self.company))

class Customer(CompanyInterface):
    id = Column(Integer, ForeignKey(CompanyInterface.id), primary_key=True)
    name = Column(String)
    __mapper_args__ = {"polymorphic_identity": "Customer"}

class Supplier(CompanyInterface):
    id = Column(Integer, ForeignKey(CompanyInterface.id), primary_key=True)
    company_name = Column(String)
    __mapper_args__ = {"polymorphic_identity": "Supplier"}

engine = create_engine('sqlite:///test/test_me.db', echo=False)
Base.metadata.create_all(engine)

session = Session(engine)

address1 = Address(street='test-1', city="Detroit", zip="56785")
address2 = Address(street='test-2', city="Phoenix", zip="110322")
address3 = Address(street='test-3', city="Washington", zip="432414")

supl1 = Supplier(company_name="Supplier-1 TEST")
supl2 = Supplier(company_name="Supplier-2 TEST")
cust1 = Customer(name="Customer-1 TEST")
cust2 = Customer(name="Customer-2 TEST")

address1.company = supl1
address2.company = cust1
address3.company = cust1

session.add_all([address1, address2, address3])

session.commit()

address3.company = supl2

session.commit()

print "PRINTING, TOTAL = %s" % session.query(Address).count()
for address in session.query(Address):
    print "ADDRESS = %s" % address


text:
Q: How can I disable config processing in Git? I'm writing a script to run git on a system with a given version of git installed, but I need it to be hermetic, so that the script behaves exactly the same way regardless of any gitconfig files.
How can I tell git to avoid processing all config files?


text:
Q: Flowchart convert into java program input methodology Can somebody help me about this flow chart in my java program, because I am  new to java. So far I know how to code, but when it comes to flowchart I feel dumb.
Here is what I understand so far: First I'll get input from user then match it with cnt=1 but afterwards again cnt<=line then again cnt2=1.
cnt1 means count 1
cnt2 means count 2
input line is input number only.

A: Please explain your question more clearly:
What do you mean here cnt<=line?
What is 'line' here?
May be below program will help, is this what you are expecting:
    import java.util.Scanner;

public class SchoolHomework {
    public static void main(String args[]) {
        try (Scanner sc = new Scanner(System.in)) {
            System.out.println("Enter number only:");
            int line = sc.nextInt();
            int cnt = 1;
            int cnt2 = 0;
            while (cnt <= line) {
                cnt2 = 1;
                while (cnt2 <= line) {
                    if (cnt2 <= line) {
                        System.out.println("*");
                    } else {
                        System.out.println("#");
                    }
                    cnt2++;
                }
                System.out.println(" ");
                cnt++;
            }
        }
    }
}


text:
Q: The repository jessie-backports Release does no longer have a Release file I get the following output (and error at the end) when I run apt update on my system:
$ sudo apt update
Ign:1 http://deb.debian.org/debian stretch InRelease
Hit:2 http://packages.microsoft.com/repos/vscode stable InRelease
Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:4 http://security.debian.org/debian-security stable/updates InRelease
Hit:6 http://ftp.us.debian.org/debian stable-updates InRelease
Hit:7 http://fai-project.org/download stretch InRelease
Hit:8 http://repository.spotify.com stable InRelease
Hit:9 http://deb.debian.org/debian-security stretch/updates InRelease
Hit:10 http://dl.google.com/linux/chrome/deb stable Release
Hit:12 http://deb.debian.org/debian stretch-backports InRelease
Hit:13 https://download.docker.com/linux/debian stretch InRelease
Hit:14 https://deb.nodesource.com/node_10.x stretch InRelease
Ign:15 http://deb.debian.org/debian stable InRelease
Ign:17 http://deb.debian.org/debian jessie-backports InRelease
Ign:18 http://deb.debian.org/debian jessie InRelease
Hit:19 http://deb.debian.org/debian testing InRelease
Hit:5 https://release.memsql.com/production/debian memsql InRelease
Hit:20 http://deb.debian.org/debian unstable InRelease
Hit:21 http://deb.debian.org/debian stretch Release
Hit:11 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Hit:23 http://deb.debian.org/debian stable Release
Err:25 http://deb.debian.org/debian jessie-backports Release
  404  Not Found [IP: 151.101.248.204 80]
Hit:26 http://deb.debian.org/debian jessie Release
Reading package lists... Done
E: The repository 'http://deb.debian.org/debian jessie-backports Release' does no longer have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

I don't understand why I'm getting this error.
$ cat /etc/apt/sources.list
# These lines should work for many sites

deb http://deb.debian.org/debian stretch main contrib non-free
deb http://deb.debian.org/debian-security stretch/updates main contrib non-free
deb http://deb.debian.org/debian stretch-backports main contrib non-free

# repository that may contain newer fai packages for stretch
deb [trusted=yes] http://fai-project.org/download stretch koeln

$ grep jessie-backports /etc/apt/sources.list.d/*
/etc/apt/sources.list.d/jessie-backports.list:deb http://deb.debian.org/debian/ jessie-backports main contrib non-free
/etc/apt/sources.list.d/jessie-backports.list:# deb-src http://deb.debian.org/debian/ jessie-backports main contrib non-free
/etc/apt/sources.list.d/jessie-backports.list.save:deb http://deb.debian.org/debian/ jessie-backports main contrib non-free
/etc/apt/sources.list.d/jessie-backports.list.save:# deb-src http://deb.debian.org/debian/ jessie-backports main contrib non-free

Some system information:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.8 (stretch)
Release:        9.8
Codename:       stretch

A: A Debian version has five phases in its life cycle:

*

*testing: the version is in development, and has no backports or security archive

*stable: the version is now released, and a backports and security archive are created

*oldstable: the next version after this one is released. The security support is still maintained by the security team for all architectures, and the backports archive is still supported, until a year after it became oldstable.

*long-term support (LTS): a year after the release of the next version of Debian, the security team stops supporting this version, and the LTS team takes over. The LTS team does not support backports, and it does not support all architectures; only a limited list of architectures is supported. Additionally, not all packages are supported during the LTS phase; notably, things like webbrowsers etc are explicitly not supported (but there are many other things).

*No longer supported: the LTS phase ends 5 years after the original release of that version; at that point, the version is moved to archive.debian.org

Jessie has become oldstable on June 17th 2017, and therefore became LTS on June 17th 2018. As such, the jessie-backports repository is now dormant. It was retained for a while to allow for certain valid use cases, but the backports administrators have recently done some maintenance work, and disabled the jessie-backports repository; that is the reason you are now getting those errors.
The backports repository is meant to contain software versions that are available in the next version of Debian; i.e., jessie-backports will contain packages with versions as shipped in stretch. As such, if you have already moved to stretch as you claim to, enabling jessie-backports on your system should provide no benefit at all, and you should just stick with the stretch repository and move on from jessie.

A: Since Jessie is no longer the most recent stable release for Debian (Stretch is) I believe they no longer support jessie-backports.  It is now stretch-backports.  It is not very safe to run stretch-backports on a jessie based machine since stretch-backports are recompiled based on what's available in Stretch.  Unfortunately your options are:

*

*upgrade to stretch

*remove jessie-backports (which appears to be in /etc/apt/sources.list.d/)


text:
Q: i can upload at about 10Mbps, but when i open port 80 and running a web server, i can serve data only at about 200 to 300kbps - why? I have Comcast internet for residential service, and I can upload a file at 10Mbps, but when I open the port 80 and run Apache, and use my other PC on DSL to download the file, it was only at 20 to 30 kbyte/second.
The DSL can download at about 3Mbps, so it should be at least 300kbype/second.  Does anybody know why it is 20-30 kbyte/second running an apache server?

A: You say that your cable connection can upload at 10Mbps, and if that's true then the asymmetry of the connection can't be to blame for getting what sounds like a 256Kbps upload speed. However, I assume you've actually tested this, as opposed to just assuming it - many ISPs won't give those sorts of upload speeds, even on the high-end cable packages. If you've actually seen real upload speeds to read sites of 10Mbps, then that rules out one option.
The same goes for your DSL link - I'm assuming you've seen real download speeds of 300KB/s. Never assume your ISP's advertised speeds are correct without real-world testing, they can't guarantee the quality of DSL lines (and some of them just plain lie through their teeth).
That said, Comcast is infamous of being one of the worst ISPs for traffic shaping and blocking - they use Sandvine network monitoring equipment to prevent BitTorrent seeding, for example. They always used to deny this, but it's fairly conclusively been demonstrated that they do.
So, it's possible that Comcast are also doing something nasty to incoming connections on port 80, in an attempt to stop people running high traffic websites on their home connections. Some ISPs just plain block it, but it sounds like perhaps they're just throttling. I would suggest reconfiguring Apache to listen on an alternate high-numbered port - something unassociated with any existing service, like 4477. If you want to test this, you need to put the port number after the domain name, separated with a colon.
If that still runs slowly, you could try making it a HTTPS connection on a random port, but SSL is a bit of a pain to set up in Apache if you haven't done it before.

A: Try a different port (say port 81) and see if you have the same performance problems. If you don't your ISP is throttling that port.

A: Since you're on a residential connection, you probably have an asymmetric line... ie the upload speed will be significantly slower than the download speed.
The reason is that this reflects what most typical home users do... download a lot more than they upload.  Watching videos / downloading email etc takes a lot less bandwidth than the few http/whatever calls necessary to retrieve it.

A: The 'A' in ADSL stands for 'Asymmetric'.  More bandwidth on an Asymmetric DSL connection is allocated for download than upload so you cannot upload as quickly.  Symmetric DSL connections are available, but (typically) not through residential programmes so they are much more expensive.


text:
Q: Relationship between expectation of a function and function of the expectation? Given a convex function $f(x) \in R; dom f=R$ and $x \sim \mathcal{N}(x|m,\sigma)$. Can we find an upper bound of
$$ |E_{x }f(x)-f(m)
 |$$.
I think the upper bound should depends on the second derivative of $f(x)$, but I do not have a good way to bound this term.