text:
Q: Using the wildcard CSS selector I have an element with CSS styles, and a randomly added number at the end of the class:

I want to use wildcard css selector for the second element like this:
[class^="control-"] {
  color:red;
}

I looked at this post for inspiration.
It doesn't work I believe, because the element is in the middle. Is there any way I could achieve this result? I cannot use the wildcard selector on the first class name. It has to be the second one.

A: You can use this instead:
[class*=" control-"] {
  color: red;
}

The space at the start ensures that it doesn't match something like xyzcontrol-34689, only something like xyz control-34689.

[class*=" control-"] {
  color: red;
}

Red text

*= searches the whole attribute value, instead of just the start like ^= would.
As @DBS has noted in the comments, everything would break if control- is the first thing, so this is probably better:
[class*=" control-"], [class^="control-"] {
  color: red;
}

This matches either something that contains  contains- anywhere in the attribute value, or contains- only at the start of the attribute value.

[class*=" control-"], [class^="control-"] {
  color: red;
}

Red text

Also red text

A: Instead of ^=, you can use *= selector.
*= css selector selects elements whose css attribute value contains the substring.

[class*=" control-"] {
  color: red;
}

Hello


text:
Q: Проблема с foreignKey помогите пожалуйста извлечь и вывести данные при помощи foreignKey
models.py:
class Gender(models.Model):
    gender = models.CharField(
        max_length=10,
        blank=False,
    )

class UserProfile(User):
    name1 = models.CharField(
        'Имя',
        max_length=30,
        blank=True,
        null=True,
    )
    gender = models.ForeignKey(
        Gender,
        default=0,
    )

fixtures:
[
    {
        "model": "drummersaransk.Gender",
        "pk": 1,
        "fields": {
            "gender": "none"
        }
    },
    {
        "model": "drummersaransk.Gender",
        "pk": 2,
        "fields": {
            "gender": "male"
        }
    },
    {
        "model": "drummersaransk.Gender",
        "pk": 3,
        "fields": {
        "gender": "female"
        }
    }
]

views.py:
def user_personal(request, id):
    entries_user_profile = UserProfile.objects.get(user_ptr_id=id)

    t = loader.get_template('user_personal.html')
    c = RequestContext(request, {
        'entries_user_profile': entries_user_profile,
    })
    return HttpResponse(t.render(c))

user_personal.html:
{% if entries_user_profile.gender_id %}

        Пол

        {{ entries_user_profile.gender_id }}

{% endif %}

проблема в том, что не выводится значение gender из таблицы Gender(none, male or female)
ps
пробовал выводить так: {{ entries_user_profile.gender.gender }}
выводится пустое значение
pps
пожалуйста не предлагайте использовать CHOICES
A: {{ entries_user_profile.gender.gender }}

Это правильно. Видимо ничего там просто нет. Юзеру точно задан пол? Потому как по дефолту присваивается 0, а в БД записи с id=0 нет…

redpajama_set_name: RedPajamaStackExchange


text:
Q: Unable to deploy MySQL on Redhat Openshift I am unable to deploy MySQL on Redhat openshift. My pod keep going into CrashLoopBackOff. From the error, I don't understand what is the issue because it states that initializing of server in progress as process and after that, it directly goes into shutdown state. Need to understand what is actually happening.
Deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql-wordpress-deployment
  namespace: wordpress-website
  labels:
    app: mysql-wordpress
spec:
  selector:
    matchLabels:
      app: mysql-wordpress
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: mysql-wordpress
    spec:
      volumes:
        - name: mysql-local-pv
          persistentVolumeClaim:
            claimName: local-mysql-pvc
      containers:
        - name: mysql-container
          image: mysql
          imagePullPolicy: IfNotPresent
          port:
            - containerPorts: 3306
          env:
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mysql-pass
                  key: pass
          volumeMounts:
            - name: mysql-local-pv
              mountPath: /var/lib/mysql

PersistentVolume.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: local-mysql-pv
spec:
  storageClassName: ibmc-block-bronze
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: "20Gi"
  hostPath:
    path: /tmp/data/
  persistentVolumeReclaimPolicy: Recycle

PersistentVolumeClaim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: local-mysql-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi

Error Logs
Initializing database
mysqld: Can't create directory '/var/lib/mysql/' (OS errno 17 - File exists)
2019-08-18T10:16:22.005955Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2019-08-18T10:16:22.006063Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.17) initializing of server in progress as process 17
2019-08-18T10:16:22.008464Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2019-08-18T10:16:22.008504Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-08-18T10:16:22.008970Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17)  MySQL Community Server - GPL.

A: hostPath is required privileged scc to write something to host by pod.
So you configure privileged permission as following steps.
# oc adm policy add-scc-to-user privileged -z default
# oc edit deployment mysql-wordpress-deployment
spec:
...
  template:
  ...
    spec:
    ...
      containers:
      - name: mysql-container
        securityContext:
          privileged: true

Basically, privileged mode is not recommended as aspect of security, because privileged allow to access directly to host resources without any constraints.
I hope it help you.


text:
Q: Modifying browser plugin list from cocoa app I am trying list and modify the browser's navigator.plugins from a Cocoa application on OS X. I did not find a way to list the plugin list installed on OS X. On Windows I am able to check the registry and modify it.
Any leads are greatly appreciated, thanks.

A: Web browsers on OS X enumerate the Internet plug-ins in several locations on disk. Plug-ins shared between browsers are found at /Library/Internet Plug-Ins and ~/Library/Internet Plug-Ins, while application-specific Internet plug-ins typically reside inside [[NSBundle mainBundle] builtInPlugInsPath]. The only way to modify the list of Internet plug-ins that a browser sees is to move the plug-in bundles out of the directories that comprise the search path.


text:
Q: Metro or Modern UI? In the previews of Windows 8 everyone was talking about Metro and since a few weeks ago it's called Modern UI.
Why the change and should I stop using the term Metro?

A: Modern UI Style is the correct term for Windows 8 and Windows Phone since August 2012.
The german Metro AG  had threatened legal action against Microsoft for infringing on the "Metro" trademark. So Microsoft renamed Metro to Modern UI Style.
So maybe we should stop talking about Metro; but still it would have been better.


text:
Q: OData services with Elastic search I am new to OData services.I have written a query to retrieve the specific field with null values.I build the query in OData and pass it on to elastic search to retrieve data.But the query seems to be not working.
The query is as follows:
$filter=assignedToEM eq  null.
I have also tried giving as: $filter=assignedToEM eq  'null'

The query has been built as :
{
 "from" : 0,
 "size" : 15,
 "query":{
       "bool" : {
           "must_not" : {
                    "term" : {
                        "assignedToEM" : "null"
                               }
                         }
                 }
          }
 }
In elastic search schema,The not_null value for assignedToEM is given as "_null_".

It would be really helpful if i get a solution for this as soon as possible.
Thanks.

A: Use Olastic - open source implementation of the OData services for Elasticsearch.
You can use sources as an example or get dependency from maven

A: One way to achieve this would be to create a query_string query with the special _missing_ field name instead, like this:
{
    "from": 0,
    "size": 15,
    "query": {
        "query_string": {
            "query": "_missing_:assignedToEM"
        }
    }
}

Or what should also work is to use the NOT operator like this:
{
    "from": 0,
    "size": 15,
    "query": {
        "query_string": {
            "query": "NOT(assignedToEM:*)"
        }
    }
}


text:
Q: Integration Ovirt and openstack, But got MTU interface error message I want  to manage Ovirt VM's network by openstack neutron(OVN).
My setup:

*

*oVirt v4.4.10 (created one VM names: vm1)

*Openstack victoria (5.4.0)

My steps:

*

*created network 'vlan-1' at openstack dashboard network page.

*created provider 'neutron' and select openstack networking type

*import network 'vlan-1' from 'neutron' provider.

*create nic1 in vm1 and selected  network 'vlan-1'

*run vm1.

But vm1 start failed, The engine.log shows:
2022-11-02 12:05:17,674+08 WARN  [org.ovirt.engine.core.bll.provider.network.openstack.BaseNetworkProviderProxy] (EE-ManagedThreadFactory-engine-Thread-11256) [a0d16d0c-f5df-4992-808f-0095daff628a]
Host binding id for external network vlan-1 on host ovn-comp-nodes is null, using host id 192.168.3.215 to allocate vNIC  nic1 instead. Please provide an after_get_caps hook for the plugin type OPEN_VSWITCH on host ovn-comp-nodes

2022-11-02 12:05:23,180+08 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (ForkJoinPool-1-worker-21) [6f97b9be] EVENT_ID: VM_DOWN_ERROR(119), VM ovn-comp-node1 is down with error. Exit message:
Cannot get interface MTU on 'vlan-1': No such device.

I am reading Ovirt's source code but still can't found the reason...


text:
Q: 4th order Runge-Kutta Scheme for Stochastic Differential Equations In the book "Introduction to Stochastic Differential Equations" by Thomas C. Gard, they talk about higher-order runge-kutta type schemes. The SDE in question is a general Ito SDE of the form:
$$dX = f(t,X)dt + g(t,X)dW$$
In discrete time, they claim the analagous version is ($h = \Delta t_n$):
$$X_n = X_{n-1}+ \frac{1}{6}\left\lbrace \left[F_0 + 2F_1+2F_2+F_3 \right]h+\left[G_0 + 2G_1 + 2G_2 +G_3 \right]\Delta W_n \right\rbrace$$
where:
$F_0 = f(t_{n-1},X_{n-1})$
$F_1 = f(t_{n-1}+\frac{1}{2}h, X_{n-1}+\frac{1}{2}F_0h + \frac{1}{2}G_0\Delta W_n)$
$F_2 = f(t_{n-1}+\frac{1}{2}h, X_{n-1}+\frac{1}{2}F_1h + \frac{1}{2}G_1\Delta W_n)$
$F_3 = f(t_{n}, X_{n-1}+F_2h + \frac{1}{2}G_2\Delta W_n)$
"and the $G_i$'s are defined as $g$ evaluated at the same points".
So two questions about this:
1) Does that statement mean that:
$G_0 = g(t_{n-1},X_{n-1})$
$G_1 = g(t_{n-1}+\frac{1}{2}h, X_{n-1}+\frac{1}{2}F_0h + \frac{1}{2}G_0\Delta W_n)$
and so forth?
2) If I was interested (to save computational time) in using a 3rd order Runge-Kutta method, could I assume the analagous form for SDE is:
$$X_n = X_{n-1}+ \frac{1}{6}\left\lbrace \left[F_0 + 4F_1+F_2 \right]h+\left[G_0 + 4G_1 + G_2 \right]\Delta W_n \right\rbrace$$ with modified $F_0, F_1, F_2, G_0, G_1, G_2$ so that it matches the ODE input of the 3rd order Runge-Kutta?

A: 1) This is correctly understood, but
2) both the "4th order Runge-Kutta scheme" and the "3rd order Runge-Kutta" method would actually not converge to the solution of the Ito SDE, but to the one of the Stratonovich SDE. Note also that except from special cases (like one of $f$ and $g$ being a multiple of the other), methods involving only $\Delta W$ and not also higher order stochastic integrals cannot be of (strong or root mean square) order higher than 1.


text:
Q: Android Activity has been destroyed when called getChildFragmentManager...commit() My application structure is like this:

*

*ActivityMedia is main activity that has 2 tabs: Photo & Video, each tab is FragmentCategory.

In each tab, the 1st screen is list of Category, and when click on a category, will show FragmentMediaList, which is list of Media for the category, with this code:
((ActivityMedia) getActivity()).addFragment(FragmentMediaList.newInstance(mediaType, aSite, null));

*

*When clicking back from FragmentMediaList of Photo, it will show FragmentCategory of Photo, same for Video tab

*In FragmentMediaList, when click on an item, will show ActivityMediaPlayer with this code:
Intent it = new Intent(getActivity(),ActivityMediaPlayer.class);
getActivity().startActivity(it);

*When clicking back from ActivityMediaPlayer, app will show FragmentMediaList , back again, will show FragmentCategory
Everything was fine when I tested on my device, but on some of user's devices, when starting ActivityMediaPlayer, the ActivityMedia seems to be destroyed. When click back from ActivityMediaPlayer, the FragmentMediaList  is showed, click back again, FragmentCategory is showed, but when click on a category in FragmentCategory, crash happens in this line of code of HostFragment class:
getChildFragmentManager().beginTransaction().replace(R.id.hosted_fragment, fragment).addToBackStack(null).commit();

It said "Activity has been destroyed"
Here are my classes details:
ActivityMedia:
public class ActivityMedia extends BaseActivity
    ...
    protected void onCreate(Bundle savedInstanceState) {
    viewPager = (ViewPager) findViewById(R.id.viewpager);
    tabLayout = (TabLayout) findViewById(R.id.tablayout);

    customPagerAdapter = new CustomPagerAdapter(getSupportFragmentManager());

    // increase this limit if you have more tabs!
    viewPager.setOffscreenPageLimit(1);
    viewPager.setAdapter(customPagerAdapter);
    tabLayout.setupWithViewPager(viewPager);

    ...
    @Override public void onBackPressed() {
    if(!BackStackFragment.handleBackPressed(getSupportFragmentManager())){
        super.onBackPressed();
    }
}

CustomPagerAdapter:
public class CustomPagerAdapter extends FragmentStatePagerAdapter {
private final List<String> tabTitles = new ArrayList<String>() {{
    add("VIDEO");
    add("PHOTO");
}};

private List<Fragment> tabs = new ArrayList<>();

public CustomPagerAdapter(FragmentManager fragmentManager) {
    super(fragmentManager);
    initializeTabs();
}

public CustomPagerAdapter(FragmentManager fragmentManager, Fragment fragment1, Fragment fragment2) {
    super(fragmentManager);
    tabs.add(fragment1);
    tabs.add(fragment2);
}

private void initializeTabs() {
    tabs.add(HostFragment.newInstance(FragmentSite.newInstance(MediaType.Movie)));
    tabs.add(HostFragment.newInstance(FragmentSite.newInstance(MediaType.Photo)));
}

@Override
public Fragment getItem(int position) {
    return tabs.get(position);
}

@Override
public int getCount() {
    return tabs.size();
}

@Override
public CharSequence getPageTitle(int position) {
    return tabTitles.get(position);

 }
}

HostFragment:
public class HostFragment extends BackStackFragment {
private Fragment fragment;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.host_fragment, container, false);
    if (fragment != null) {
        replaceFragment(fragment, false);
    }
    return view;
}

public void replaceFragment(Fragment fragment, boolean addToBackstack) {
    try{
        if (addToBackstack) {
            getChildFragmentManager().beginTransaction().replace(R.id.hosted_fragment, fragment).addToBackStack(null).commit();
        } else {
            getChildFragmentManager().beginTransaction().replace(R.id.hosted_fragment, fragment).commit();
        }
    }catch (Exception e){
        getChildFragmentManager().beginTransaction().remove(this);
        K.log("Error when commit fragment: " + e.getLocalizedMessage());
    }

}

public static HostFragment newInstance(Fragment fragment) {
    HostFragment hostFragment = new HostFragment();
    hostFragment.fragment = fragment;
    return hostFragment;
 }
}

BackStackFragment:
public abstract class BackStackFragment extends BaseFragment {
public static boolean handleBackPressed(FragmentManager fm)
{
    if(fm.getFragments() != null){
        for(Fragment frag : fm.getFragments()){
            if(frag != null && frag.isVisible() && frag instanceof BackStackFragment){
                if(((BackStackFragment)frag).onBackPressed()){
                    return true;
                }
            }
        }
    }
    return false;
}

protected boolean onBackPressed()
{
    FragmentManager fm = getChildFragmentManager();
    if(handleBackPressed(fm)){
        return true;
    } else if(getUserVisibleHint() && fm.getBackStackEntryCount() > 0){
        fm.popBackStack();
        return true;
    }
    return false;
 }
}


text:
Q: Add NSDefaults string into InAppSettingsKit I want to be able to change the DefaultValue of one of a UITableView cell in the Settings.bundle. I mainly want to put this...
userEmail = [defaults objectForKey:@"username"];
...into the plist.
I am doing this because I want my app to display the user's email in the settings so that they know what account they are using.
Here is part of the plist data that I want changed.
<dict>
            <key>IASKTextAlignment</key>
            <string>IASKUITextAlignmentRight</string>
            <key>DefaultValue</key>
            <string>EMAIL</string>
            <key>Key</key>
            <string>email</string>
            <key>Title</key>
            <string>Email</string>
            <key>Type</key>
            <string>PSTitleValueSpecifier</string>
        </dict>

How would I do this? Thanks in advance.

A: You can't dynamically change the plist in the Settings.bundle because it belongs to the read-only (as far as sandboxing goes) app bundle.
What you probably want to do is to modify the current value using [[NSUserDefaults standardUserDefaults] setObject:@"the username" forKey:@"username"] in your -application:didFinishLaunchingWithOptions: or somewhere else in your startup process.
Then the change will be reflected in IASK and the system settings.


text:
Q: Microsoft AD Server Migration - Two Servers Shutting Down One(Avoiding Server Demotion) I have two servers, one old AD server (server A) and a brand new server (server B). I am trying to migrate from old to new so I setup my second server following these instructions and add the second server as a domain controller within the same domain.
So, everything is wonderful in serverland, both servers are on the old domain and are configured as domain controllers. Now I would like to shut off Server A (eventually will be decommissioned, but I would like to keep it as a backup for now). So I disable AD replication on server B and adjust the DNS settings so that server B no longer points at server A:

Then I shut off server A. Suddenly(on server B) I cannot access the AD's configuration either through "Active Directory Users and Computers" or "Active Directory Administrative Center". I get various derivations of:

Naming information cannot be located because:
  The RPC server is unavailable

Cannot connect to any domain. Refresh or try again when connection is
  available.

The following Domain Controller could not be contacted: 127.0.0.1.
  The specified domain either does not exist or could not be contacted.

So it seems like its working(I can login with domain credentials, third party applications utilizing AD seem to work), but I can't access anything. Am I missing something here, I don't see why server B doesn't just detect itself as the new AD server. I thought there is no longer a magical "Primary" AD server. Most people on the internet recommend demoting the old AD server, but I'd rather not in this case. Is it possible to complete the AD migration without demoting the old server?
Update 1
After update FSMO roles as @KatherineVillyard suggested I get most of the same errors, but in the "Active Directory Administrative Center" I get one new one that is interesting, when you select "Change domain controller" I get:

Cannot find an available server in the DEV domain that is running the
  Active Directory Web Service (ADWS).

This is interesting as I checked and I'm sure the service is running on my new box. I wonder if the issue is DNS related. I already tried re-adjusting the network settings and rebooting the server. Often times with these types of issues it seems that I'm just throwing things against the wall and seeing what sticks :(
Update 2
I have tried a great many things, however it seems that I can reproduce the issue by shutting down server A by merely just disabling the NetLogin service on Server A. Once this service on server A stops responding you no longer have access to that domain(similar type errors thrown) through any of the snap-in controls on either server.
I also noticed something funny, when you run the following command on server B:
nltest /DSGetDC:MYDOMAINHERE

You get the following(assuming netlogin is running on both servers):

DC: \\(SERVER A)
  Address: \\(SERVER A IP ADDRESS)
  Dom Guid: XXXX
  Dom Name: (MYDOMAINHERE)
  Forest Name: (MYDOMAINHERE)
  Dc Site Name: Default-First-Site-Name
  Our Site Name: Default-First-Site-Name...

Another thing I notice on the new server(B) is that if you run("dcdiag /test:advertising") you get the following message(no issues on the old server(A)):

Testing server: Default-First-Site-Name\(Server B)
  Starting test: Advertising
  Warning: DsGetDcName returned information for \\(Server A).(MYDOMAINHERE), when we were trying to reach (Server B).
  SERVER IS NOT RESPONDING or IS NOT CONSIDERED SUITABLE.
  ......................... (Server B) failed test Advertising

This really strikes me as an issue with some sort of DNS configuration on the new server(B), but I've removed every single reference to server A in server B's DNS Manager and rebooted the server. This whole thing is a bit of a black box, where does "DSGetDC" pull this information? The "(DNS) server", which should be server B, which shouldn't have any reference to server A, clearly I'm missing something here :(

A: There's not a "magical Primary AD server" but there are FSMO roles.  I'm fairly certain, based on the information that you've provided, that Server A holds one or all of the FSMO roles.
You probably want to bring Server A back up, gracefully transfer all of the FSMO roles to Server B, and take it back down.  This article tells you how to do that with PowerShell.  In case of link rot, here's the main gist:
Find the current masters:
Get-ADForest example.com| ft DomainNamingMaster, SchemaMaster
Get-ADDomain example.com | ft InfrastructureMaster, PDCEmulator, RIDMaster

Load the Active Directory powershell module:
Import-Module ActiveDirectory

You can move the roles based on name or role number.
Move-ADDirectoryServerOperationMasterRole "Server B" –OperationMasterRole 0,1,2,3,4

or
Move-ADDirectoryServerOperationMasterRole "Server B" –OperationMasterRole PDCEmulator,RIDMaster,InfrastructureMaster,SchemaMaster,DomainNamingMaster

If this fails, add -force to the end, as in
Move-ADDirectoryServerOperationMasterRole "dc2" –OperationMasterRole 0,1,2,3,4 -force

You can also use the GUI if you prefer.

A: I gave up :(
I gave it to a coworker to figure out, what we eventually discovered is that the issue was related to the "DFSR SYSVOL replication". We demoted and re-promoted the new server(B) to attempt to clear out any invalid configuration. Then we followed the resolution to the issue is detailed in the following post. Turns out, after running the steps in Scenario 1 and 2 that the registry key "SysvolReady" was set to zero on the new server(B).
(In case of link rot)

To resolve the issue, perform all steps below in the order described,
  using an elevated CMD prompt while running as a Domain Admin:
Scenario 1:

*

*Determine which security group policy is applying this setting to the DCs by running on the PDCE:
GPRESULT.EXE /H secpol.htm

*Open secpol.htm in a web browser then click "Show All". Search for the entry "Manage Auditing and Security Log." It will list the group
  policy that is applying this setting.

*Using GPMC.MSC, edit that group policy to include the group "Administrators".

*Allow AD and SYSVOL replication to converge on all DCs. On the PDCE, run:
GPUPDATE /FORCE

*Log off the PDCE and log back on, in order to update your security token with the user right assignment.

*Run:
DFSRMIG.EXE /CREATEGLOBALOBJECTS

*Allow AD and SYSVOL replication to converge on all DCs. On the PDCE, run:
DFSRDIAG.EXE POLLAD
DFSRMIG.EXE /GETMIGRATIONSTATE

*Validate that some or all of the DCs have reached the 'Prepared' state and are ready to redirect. At this point you can proceed with
  your migration normally. See the More Information section below
  migration best practices.
Scenario 2:

*

*Determine which security group policy is applying this setting to the DCs by running on the PDCE:
GPRESULT.EXE /H secpol.htm

*Open secpol.htm in a web browser then click "Show All". Search for the entry "Manage Auditing and Security Log." It will list the group
  policy that is applying this setting.

*Using GPMC.MSC, edit that group policy to include the group "Administrators".

*Allow AD and SYSVOL replication to converge on all DCs. On the affected DC, run:
GPUPDATE /FORCE

*Restart the DFSR service on that DC.

*Validate that the DC now shares SYSVOL and NETLOGON, and replicates SYSVOL inbound.

"warrenw note 5/3/2013"

*

*Manually share the sysvol - Edit this registry value -
  Key
  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\parameters
  Value SysvolReady = 1
run net share to make sure the sysvol is shared out.

*Open the policy and add the user or group to the ""manage auditing and security log" user right.

*Run gpupdate force.

We think the failure to replicate and netlogin state registry key was the crux of the issue, but there was a great number of other more minor things that we attempted, these could also be a factor in the resolution. Hopefully, however, this post will be of assistance to someone in the future.


text:
Q: ubuntu14.04 build android4.4 modem error when I build modem file it said:
make:
[build/ELINK82_TB_KK_HSPA/DEFAULT/bin/dep/codegen_dep/nvram_auto_gen.det] Error 2

I user gcc 4.4 and g++ 4.4 build android 4.4 modem, If anybody can help me, thanks!

A: I had solved this problem by myself:
At first reinstall Ubuntu 10.04,and install all software below
sudo apt-get install openssh-server //安装ssh
sudo apt-get install git-core gawk
sudo apt-get install libxau-dev libxdmcp-dev x11proto-core-dev x11proto-input-dev x11proto-kb-dev xtrans-dev libxcb1-dev
sudo apt-get install git-core gnupg zip curl libc6-dev libx11-dev libxml2-utils xsltproc
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-jdk
sudo aptitude install -y bison g++-4.4 g++-4.4-multilib gcc-4.1-multilib gcc-4.4-multilib gcc-multilib m4 vim vim-runtime system-config-kickstart nmon ethtool tofrodos
sudo apt-get -y install libxml-simple-perl perl-doc libwww-perl libfile-spec-perl


text:
Q: Can inotify allow me to monitor all files with a specific name extension no matter where they are on disk? Can inotify allow me to monitor all files with a specific name extension no matter where they are on disk?
For example, if I want to monitor all *.mp3 files on my device in various directories. Is it possible?
Many thanks!
Amanda

A: Not without setting up notification for every single directory. Consider using the auditing subsystem instead.

A: With pyinotify at least you could. You'd have to watch recursively at / or the directory your disk is mounted on and use the exclude_filter argument to the WatchManager.add_watch method.
Maybe react https://github.com/copton/react already does all you need.


text:
Q: Change input language doesn't work I need to change the keyboard input language and set it to English from C# (I need an .exe for do it), the problem is that the program works in Visual Studio, but when I launch the .exe it doesn't change the keyboard.
I have this in the main method on a winforms app
static void Main(){
    InputLanguage englishLayout = GetInputLanguageByName("english");
    if (englishLayout!=null) {
        InputLanguage.CurrentInputLanguage = englishLayout;
    }
    else
    {
        Console.WriteLine("nulo.");
    }

This method searches the installed languages
public static InputLanguage GetInputLanguageByName(string inputName){
    foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages){
        Console.WriteLine(lang.LayoutName);
        if (lang.Culture.EnglishName.ToLower().StartsWith(inputName))
            return lang;
         }
    return null;
}

Just need that from the application (do not need forms, just change the keyboard language), but when I launch the .exe outside Visual Studio it doesn't work.


text:
Q: Charset conversion Java Hi
I have a scenario where I need to convert the default Charset should be overridden bu UTF-8. I am using below class. But I am not getting the expected output. Because I use a unix system that has default UTF-8 as charset and I compare the results there. Am I wrong somewhere in this program?
public class CharsetDisplay {

 public static void main(String[] args) {
  System.out.println(Charset.defaultCharset().name());
  System.out.println(Charset.isSupported("UTF-8"));
  final Charset UTF8_CHARSET = Charset.forName("UTF-8");
  try {
   byte[] byteArray = new byte[] {34,34,0};
   String str = new String(byteArray,UTF8_CHARSET);
   System.out.println("String*** "+str);
   System.out.println("String to Hex *** "+stringToHex(str));
  } catch (Exception e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
 }

}

Prints output as
windows-1252
true
String*** ""

Note after "" in the string output I have a spl char, which I don't get in a unix env

A: What do you expect the zero byte to render as in this environment?  Your output looks exactly correct to me.
Don't forget that any differences that you encounter between environments might not be down to Java.  If you're invoking your Java program from a console (which I expect you are), it's up to the console to actually convert the program's output to what you see on the screen.  So depending on the charset the console is using, it's entirely possible for Java to output the characters that you expect, but for the console to fail to render them properly.

A: If Java doesn't pick up your locale's encoding properly you may have to tell it explicitly, at the command-line:
java -Dfile.encoding=utf-8 CharsetDisplay


text:
Q: How to summarize multiple rows in a single new row in r I have a dataframe of states and certain population
# A tibble: 9 x 2
  region        selected_pop
  <chr>             <dbl>
1 Connecticut       59306
2 Maine             85416
3 Massachusetts     83870
4 New Hampshire     62250
5 New Jersey       533328
6 New York         197454
7 Pennsylvania      35732
8 Rhode Island      85614
9 Vermont            3414

and I want to create an output that looks like this, where totalpop is sum of population of each state. How would I do this in r?
region Totalpop
Northeast 1146384

A: Assuming the dataset have only 'Northeast' states, an option is to change the 'region' to 'Northeast' in group_by and summarise the 'selected_pop'
library(dplyr)
df1 %>%
     group_by(region = 'Northeast') %>%
     summarise(Total_pop = sum(selected_pop))


text:
Q: Why do image reading functions assign channels dimension to axis 2? Image reading functions like imread of OpenCV and io.imread of skimage assign the channels dimension to axis2.
For example, if I read a color image of height=50 & width=100 as:
import cv2
img=cv2.imread('lena.png')

printing its shape as img.shape would return (50,100,3).
Trying to understand the ordering of axes of this 3D array physically, the height axis (size=50) is away from the observer. The width axis (size=100) is oriented downwards & the channel axis (size=3) is oriented towards the right. But, thinking about the axes ordering of the image, the height axis is downwards, the width axis is rightwards & the channel axis is away from the observer. There's a mismatch!
Instead, if imread returns a 3D array in the shape (3,50,100), then the ordering of axes of the 3D array would match that of the image. So, why isn't it chosen like this?


text:
Q: FS module to read CSV file I'm new with node js and I tried to use the module "fs" but I have always the same error that I can't understand: " Cannot find module 'fs' ".
The code is:
     const fs = require('fs');
      fs.createReadStream("data/dataset.csv", "utf8", function(error, data)
        {
          data = d3.tsv.parse(data);
          console.log(JSON.stringify(data));
        }
      );

Can someone help me?
Thank you

A: You're using fs wrong!
First of all you're not using stream properly.
Also you don't need stream for this task. (if you just need to read file)
Try this instead:
fs.readFile("data/dataset.csv", "utf8", (err, data) => {
  if (err) throw err;
  data = d3.tsv.parse(data);
  console.log(JSON.stringify(data));
});

A: By the assumption that you are using webpack I don't think that it is possible to require fs in the browser.  Webpack take your code and bundle it, then it is "usually" sent to a browser.  Although webpack is reading and using node.js code it will ultimately run in the browser which does not have the required 'fs' module and is not a node.js environment.
I am not sure what you are trying to achieve.
With webpack it is possible to change the configuration and have custom file loaded
as a step.  You should take a look at Adding a csv file to a webpack build
Or Webpack Express Cannot Resolve Module 'fs', Request Dependency is Expression


text:
Q: "Man in the middle" can change the value data sent in a Man-in-the-middle attack If I send from A to B an information, the "Man in the middle" can change the value data sent or he/she can only sniff it?

A: the answer depends upon the technologies involved.
1 if you do nothing to prevent the mitm attack, the man in the middle can both sniff and change your data.  if you look up arp spoofing, you'll see a very simple way to play mitm - and you'll find tool sthat automate the work.
2 you can use crypto protocols like TLS, designed to prevent both sniffing and changingof data.  if, however, you use a broken implementation, broken protocol, or weak algorithms, you're back to #1
3 you can use crypto that will provide only sniffing or changing data. for example, digital signatures effectively garuantee that the data hasn't changed, but the signature does nothing to protect the data from being read.  similarly, a one time pad will make it impossible to read your data, but won't prevent blind tampering (there was an old problem with automatic teller machines, where it was possible to flip random bits to change the value of a deposit, hoping to make it larger tthan what you really deposited)


text:
Q: Invariant measures for a renewal process driven by Interarrival times bounded away from zero Good morning, I apologize in advance if my question sounds too basic but after some research I was unable to come up with satisfactory answers to my doubts.
I am currently studying a model which needs a slight modification of the notion of Piecewise Deterministic Markov Processes (PDMP). In short I am given a compact smooth manifold $M$ and a finite set $E$, a collection of smooth vector fields $(F^i)_{i\in E}$ on $M$ and $Q(x,i,j)$ is an aperiodic irreducible Markov transition matrix, that continuously depends on $x$. In particular for every $x\in M$ there exists $n_x\in\mathbb N$ such that $Q^{n_x}(x,i,j)$ is positive for every $i,j\in E$. We also define $\Phi^i$ the flow associated with the vector field $F^i$.
Next I am given $\tau>0$ and a sequence of random variables $0=T_0<T_1<\dots<T_n<...$, such that the differences $U_i:=T_i-T_{i-1}$, $i\geq 1$ are i.i.d. random variables distributed as exponentials random variables of intensity $\lambda$ and shifted by $\tau$, that is $f_{U_i}(t)=\lambda e^{-\lambda(t-\tau)}\mathbb{1}_{\{t\geq \tau\}}$. In particular, this models the fact that $U_i\geq \tau$ almost surely.
The Markov chain is then defined as follows: $Z_0=(X_0,Y_0)$ is a random variable on $M\times E$, independent of $(U_i)_{i\geq 1}$. Inductively, $X_{n+1}=\Phi^{Y_n}(U_{n+1},X_n)$ and $\mathbb P(Y_{n+1}=j\mid X_{n+1}, Y_n=i)=Q(X_{n+1},i,j)$. In this way we have defined $(Z_n)_{n\geq 0}$. The continuous version $(Z_t)$ is obtained by interpolation: namely $Z_t=X_n$ if $t\in [T_n,T_n+\tau)$, while $Z_t=(\Phi^{Y_n}(t-T_n,X_n),Y_n)$ if $t\in [T_n+\tau,T_{n+1})$. Basically, I want to force my flow to remain stopped at its initial point up to time $\tau$, and only then I follow its trajectory.
My questions:
1) Has this process been already studied in the literature? It seems to be a very specific and natural renewal (càdlàg) process, and I was guessing something should already exist; probably I don't have the right keywords to look for. In this case does it has a name?
2) What can be said about invariant (stationary) measures for this process? I've tried to compute explicitly the semigroup $P_t$, which can actually be done with precise computations, but then I started to ask myself if this actually makes sense for such a process. Since $\tau$ is positive, the Feller property for $P_t$ seems trivial, and I fear that I'm probably missing something. In particular, for the infinitesimal generator we find that $\lim_{t\to 0}\frac{P_tf-f}{t}=0$ for every $f\in C^0(M)$, and this actually makes me doubt about the construction.
I thank in advance whoever feels like providing me with some references, or giving me any hint on where to focus my research.
My bests,
Guido


text:
Q: how to escape metacharacter like "/" and "." in regex? Original:
src="this/text/is/not/needed/me/at/all/<filename>.jpg"
src="this/is/another/text/that/is//also/not/required/<filename>.jpg"

My desired output should be:
src="IMAGES/<filename>.jpg"

I want to remove the path of *.jpg file in src="" and want src="images/*.jpg" using regex in notepad++.
How can I do that?

A: Find what: src=".*/(.*\.jpg)"
Replace with: src="images/$1"

A: You can try to replace src=".*?\/([^\/]*?\.jpg)" with src="images/$1".

A: You can use this regex to find -
(src=").*(\/.*\..*")

And replace with -
$1IMAGES$2

A single REPLACE ALL should work.

A: Replace src=".*/([^/]+.jpg)" with src="images/$1"


text:
Q: RCC_AHB2PeriphClockCmd I'm beginner in Embedded programming. I'm programming in STM 32F407ZG. While programming the demo codes, i just came across the code
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);
what is this?, explain it.
#include "stm32f4xx.h"
#include "stm32f4xx_rcc.h"

 void delay()
  {
   for(int i=0;i<0x3FF;i++)
     for(int j=0;j<0x3FF;j++);
  }

 void mx_pinout_config(void)
  {
    GPIOG->ODR     = 0x00000000;
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);
    GPIOF->MODER   = 0X55555555;                         // OUTPUT MODE SELECT
    GPIOF->OTYPER  = 0x00000000;
    GPIOF->PUPDR   = 0x00000000;
    GPIOF->OSPEEDR = 0xFFFFFFFF;
    GPIOF->ODR     = 0x00000000;
  }

 int main(void)
  {
    mx_pinout_config();
    while (1)
      {
        GPIOF->ODR = 0x0000000F;
        delay();
        GPIOF->ODR = 0x00000000;
        delay();
      }
  }

A: STM32F407ZG is a low power device.
In order to save power, the microcontroller is designed in such a way so that whenever any peripheral is required, then its respective bus clock needs to be enabled and then only the peripheral can be used, and after the work of the peripheral is over then the clock must be disabled to save power.
In your case, you want to use GPIOF which resides on ARM high-performance bus1 so RCC_AHB1PeriphClockCmd() enables/disables the clock of AHB1 for GPIOF. RCC stands for reset and control circuitry and controls the clock of the CPU, microcontroller peripherals and various buses on it.


text:
Q: How to write MDB content to INI files in Delphi 7? There is a table entry for mdb. And the table has 18 columns and 10 rows.
I want to write the contents of the table in the ini file.
Is there a way?
procedure TForm1.Button4Click(Sender: TObject);
var
  ini : TIniFile;
  i : Integer;
  sTableInfo : String;

begin

  Adotable1.First;
  ini := TIniFile.Create('C:\Users\win10_pro\Desktop\test.ini');
  sTableInfo := Adotable1['name'] + '  '  +Adotable1['capital']+ '  ' +   Adotable1['continent'];

  try
  for i := 0 to adotable1.RecordCount - 1 do
     begin
        ini.WriteString('Name', 'test1', sTableInfo );
      end;
        ShowMessage('INI file create');
      end;
  finally
    ini.Free;
  end;

This way, only one item goes in, and I want all items to go in. This way, only one item goes in, and I want all items to go in.

A: I have no idea why you want to do this, since you have a perfectly good database that is already storing the data. However, this should do what you want (untested). Note I also had to change the code that writes to the INI file so that the key changes with every pass, or only one value is written.
procedure TForm1.Button4Click(Sender: TObject);
var
  ini : TIniFile;
  keyNo: Integer;
  sTableInfo : String;
begin
  Adotable1.First;
  ini := TIniFile.Create('C:\Users\win10_pro\Desktop\test.ini');
  keyNo := 1;
  try
     while not adotable1.Eof do
     begin
       sTableInfo := Adotable1['name'] + '  '  +Adotable1['capital']+ '  ' +   Adotable1['continent'];

       ini.WriteString('Name', 'test' + IntToStr(keyNo), sTableInfo );
       Inc(keyNo);
       adoTable1.Next;
     end;
     ShowMessage('INI file created');
  finally
    ini.Free;
  end;
end;


text:
Q: Watir Set value of input type="text" I am trying to set an email into this span but I'm having trouble selecting it and updating it. The span id is created dynamically but the class is not

    Email*

    <input type="text" aria-labelledby="foundation-text-input-3535" placeholder="" value="" autocomplete="off" data-qa="email_input">

A: it should be getting set via the input element, not the span, right?
browser.text_field(data_qa: 'email_input').set email_address

You can also use regular expressions as well if you need to locate things that way:
browser.span(id: /foundation-text-input/)

Results from irb:
irb(main):001:0> require 'watir'
=> true
irb(main):002:0> browser = Watir::Browser.new
=> #<Watir::Browser:0x6e1ac1ec79323ad4 url="data:," title="">
irb(main):003:0> browser.goto "https://portal.sysco.com/login"
=> "https://portal.sysco.com/login"
irb(main):004:0> browser.text_field(data_qa: 'email_input').set "test"
=> nil
irb(main):005:0> browser.text_field(data_qa: 'email_input').value
=> "test"


text:
Q: SSH Tunnel - channel 2: open failed: administratively prohibited - Ubuntu 18.4 VM I need to run an android project from a remote location to the Appetize.io simulators. The simulator provides an ssh command to do it. Every time I tried to connect, it outputs the following error:
Appetize command to connect through SSH
sudo ssh -vv -fN -o StrictHostKeyChecking=no -p 2205 PUBLIC_KEY@useast-android-10.appetize.io -L6000:localhost:5609 && adb connect localhost:6000

Error
channel 2: open failed: administratively prohibited:
channel 2: free: direct-tcpip: listening port 6000 for localhost port 5609, connect from 127.0.0.1 port 49057 to 127.0.0.1 port 6000, nchannels 3
Result
The command successfully establish the connection, authenticates, "add '[useast-android-9.appetize.io]:2208,[209.222.0.20]:2208' (RSA) to the list of known hosts", but when I try to run adb connect localhost:6000 fails.
The command works somethimes so I know that given certain conditions that I still do not know, it manages to establish the connection and connects to the simulator but most cases it does not work.

I tried the following:

*

*Killing any service at port 6000

*using 127.0.0.1 instead of localhost when running the command

*stopping and restarting ADB before running the command
adb kill-server && adb start-server

*Adding the following to the  /etc/ssh/sshd_config file
MaxSessions 100
AllowTcpForwarding yes
PermitOpen any
PermitTTY yes
PermitTunnel yes

*Making sure localhost is in the /etc/hosts file

127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

*Running the same command from Google Compute Engine VM and from EC2 AWS VM with the same result.

Here is the block of code that runs the command:
Sorry for the excessive logs, at this point I wanted to output anything to find the reason it is failing.
try{
    var util  = require('util'),
    exec = require('child_process').exec;
    let simulatorSSHURL = `ssh -vv -fN -o StrictHostKeyChecking=no -p ${simPort} ${simUser}@${simHost} -L6000:127.0.0.1:5609 && adb connect 127.0.0.1:6000`

    console.log(`RUN SIMULATOR: ${simulatorSSHURL}` );
    const buildAppOutput = exec(`adb kill-server && adb start-server && sudo ${simulatorSSHURL}`)

    buildAppOutput.stdout.on('data', (data) => {
      console.log('stdout: ' + data.toString())
      if(!res.finished){
        res.write(`data: ${JSON.stringify({data: data, end: false})}`);
        res.write("\n\n");
      }else{
        console.log("CONNECTION ALREADY FINISHED - STDOUT");
      }
    });

    buildAppOutput.stderr.on('data', (data) => {
      console.log('stderr: ' + data.toString())
      if(!res.finished){
        if( data.toString().includes("open failed") ){
          console.log("CONNECTION OPEN FAILED");
          res.write(`data: ${JSON.stringify({data: data, end: true})}`);
          res.write("\n\n");
          res.end();
        }else{
          res.write(`data: ${JSON.stringify({data: data, end: false})}`);
          res.write("\n\n");
        }
      }else{
        console.log("CONNECTION ALREADY FINISHED - STDERR");
      }
    });

    buildAppOutput.on('exit', (code) => {
      console.log("Finished Compiling");
      if(!res.finished){
        res.write(`data: ${JSON.stringify({data: null, end: true})}`);
        res.write("\n\n");
        res.end();
      }else{
        console.log("CONNECTION ALREADY FINISHED - CATCH");
      }
    });

  }catch(e){
    console.log(`ERROR: ${e}`);
    if( !res.finished){
      res.write(`data: ${JSON.stringify({data: e, end: true})}`);
      res.write("\n\n");
      res.end();
    }
  }

Here is the output log:
I marked in black the in-between lines of the log that mention the successful connection, authentication, and error.
[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `babel-node index.js`
server running on port 5000
/api/v1/connect
{ port: '2208',
  user: 'g1yjx7wq2pex4fvejxrt7d63rw',
  hostname: 'useast-android-9.appetize.io' }
RUN SIMULATOR: ssh -vv -fN -o StrictHostKeyChecking=no -p 2208 g1yjx7wq2pex4fvejxrt7d63rw@useast-android-9.appetize.io -L6000:127.0.0.1:5609 && adb connect 127.0.0.1:6000
stderr: * daemon not running; starting now at tcp:5037

stderr: * daemon started successfully

stderr: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *

stderr: debug2: resolving "useast-android-9.appetize.io" port 2208

stderr: debug2: ssh_connect_direct: needpriv 0

debug1: Connecting to useast-android-9.appetize.io [209.222.0.20] port 2208.
stderr: debug1: Connection established.
debug1: permanently_set_uid: 0/0
stderr: debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3

stderr: debug1: Remote protocol version 2.0, remote software version appetize.io
debug1: no match: appetize.io
debug2: fd 3 setting O_NONBLOCK

debug1: Authenticating to useast-android-9.appetize.io:2208 as 'g1yjx7wq2pex4fvejxrt7d63rw'
stderr: debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: host key algorithms: ssh-rsa
debug2: ciphers ctos: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc,des-cbc-ssh1
debug2: ciphers stoc: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc,des-cbc-ssh1
debug2: MACs ctos: hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib,zlib@openssh.com
debug2: compression stoc: none,zlib,zlib@openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none

stderr: debug1: expecting SSH2_MSG_KEX_ECDH_REPLY

stderr: debug1: Server host key: ssh-rsa SHA256:bxqxb1Xs4R5c8DmAYmYtOHc1hcPgRMfak44LM3ORi5w

stderr: debug1: checking without port identifier
Warning: Permanently added '[useast-android-9.appetize.io]:2208,[209.222.0.20]:2208' (RSA) to the list of known hosts.
stderr: debug2: set_newkeys: mode 1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS

stderr: debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 4294967296 blocks
debug2: key: /root/.ssh/id_rsa ((nil))

stderr: debug2: key: /root/.ssh/id_dsa ((nil))
debug2: key: /root/.ssh/id_ecdsa ((nil))
debug2: key: /root/.ssh/id_ed25519 ((nil))

stderr: debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
stderr: debug1: Authentication succeeded (none).
Authenticated to useast-android-9.appetize.io ([209.222.0.20]:2208).
debug1: Local connections to LOCALHOST:6000 forwarded to remote address 127.0.0.1:5609
stderr: debug1: Local forwarding listening on ::1 port 6000.
debug2: fd 4 setting O_NONBLOCK
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 6000.
debug2: fd 5 setting O_NONBLOCK
debug1: channel 1: new [port listener]
debug2: fd 3 setting TCP_NODELAY
debug1: forking to background

stderr: debug1: Entering interactive session.

stderr: debug1: pledge: network

stderr: debug1: Connection to port 6000 forwarding to 127.0.0.1 port 5609 requested.
stderr: debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]

stderr: channel 2: open failed: administratively prohibited:
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 6000 for 127.0.0.1 port 5609, connect from 127.0.0.1 port 46696 to 127.0.0.1 port 6000, nchannels 3
CONNECTION OPEN FAILED
stderr: debug1: Connection to port 6000 forwarding to 127.0.0.1 port 5609 requested.

CONNECTION ALREADY FINISHED - STDERR
stderr: debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]

CONNECTION ALREADY FINISHED - STDERR
stderr: channel 2: open failed: administratively prohibited:
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 6000 for 127.0.0.1 port 5609, connect from 127.0.0.1 port 46698 to 127.0.0.1 port 6000, nchannels 3

CONNECTION ALREADY FINISHED - STDERR
stderr: debug1: Connection to port 6000 forwarding to 127.0.0.1 port 5609 requested.

CONNECTION ALREADY FINISHED - STDERR
stderr: debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]

CONNECTION ALREADY FINISHED - STDERR
stderr: channel 2: open failed: administratively prohibited:
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 6000 for 127.0.0.1 port 5609, connect from 127.0.0.1 port 46700 to 127.0.0.1 port 6000, nchannels 3

CONNECTION ALREADY FINISHED - STDERR
stderr: debug1: Connection to port 6000 forwarding to 127.0.0.1 port 5609 requested.
debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]

CONNECTION ALREADY FINISHED - STDERR
stderr: channel 2: open failed: administratively prohibited:
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 6000 for 127.0.0.1 port 5609, connect from 127.0.0.1 port 46702 to 127.0.0.1 port 6000, nchannels 3


text:
Q: Update a field in an array on a Firestore document Is it possible to update a single value in a Firestore document that's in an array? For example, if I have a document like this is there a way to update just the size property of the second item?
{
    "name": "Name",
    "items": [
        {
            "size": 10
        },
        {
            "size": 20
        }
    ]
}

I can update a first-level property using the updateData method like this but I'm not sure how I would construct the data to update a value that's in an array.
NSDictionary *data = @{@"name": @"New Name"};
[documentReference updateData:data completion:^(NSError * _Nullable error) {

}];


text:
Q: ODE particular solution in different methods $y''' + 2y'' + y' = 7 x e^{x}$
I am trying to get the particular solution of this ODE, surprisingly I got different answer for both variation of parameter(VOP) and  undetermined coefficients (UC) method!
I believe this is due to the fact that UC does not accept any mutual term that already exists in the homogeneous solution , so we end up having that term in the particular solution of VOP.
These are the answers I got by different methods:
VOP:
$$
Y_p =   7 e^{-x}\left(-\frac 16x^3 - \frac 12x^2 - x- 1\right)
$$
UC:
$$Y_p = 7 e^{-x} \cdot ( - x^{3}/6 - x^{2}/2 )$$
Why is this? Should I take a step further in the solution?
Edit :
My solution via UC:

Via VOP:


text:
Q: Is there a way to get the executing app name from within an app flow? I am using the following to read property files:
<spring:bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  <spring:property name="locations">
    <spring:list>
     <spring:value>file:${MULE_HOME}/conf/general.properties</spring:value>
    </spring:list>
  </spring:property>
  <spring:property name="searchSystemEnvironment" value="true" />
  <spring:property name="ignoreResourceNotFound" value="true" />
</spring:bean>

I would like to be able to read a property file that is distinct to a particular app with something like the following:
<spring:value>file:${MULE_HOME}/conf/**${currentappname}**.properties</spring:value>

Is there any way to get the name of the currently executing application from Mule so I can grab the property file for a specific application without having to code the full filename into the Mule flow?

A: In mule there is Mule Expression language to get the current Application name.
Why don't you use mule expression like #[app.name]   to get the app name, example :-
<spring:value>file:${MULE_HOME}/conf/#[app.name].properties</spring:value>

Please find the reference here :-
http://www.mulesoft.org/documentation/display/34X/Mule+Expression+Language+MEL


text:
Q: How to crop image programmatically (without views) I have a bitmap, and I have a RectF with percentages for crop.
Something like x = 0.3, y = 0.1, height = 0.6, width = 0.7 for image with 100x100 px
means:
crop by X from 30 to 70 px, crop by Y from 10 to 60 px.
How can I do that crop without intents, cropping view and etc, I need just image cutted from original.
I found some kind of solution:
croppedBitmap = Bitmap.createBitmap(croppedBitmap, rect.left, rect.top, rect.right, rect.bottom);

but I am afraid of VERY big bitmaps, I need to crop original image, I cannot load it in sample size with downscaling


text:
Q: Changing and adding to lists within dictionaries in python2.7 I am trying to create an ATM simulator
I have this part of my code which will be saved to a file.
bank = {'bob':[1122,0],'fred':[2211,0]}

The key is the users name, then the values are - Pin and balance.
I want to print and be able to change just the balances of the dictionary.
I have tried things like
values =bank.values()
print values[0]

But that prints both pin and balance.

A: Your dictionary value is nested ... You need to go one level deeper
>>> bank = {'bob':[1122,0],'fred':[2211,0]}
>>> values =bank.values()
>>> print values[0]
[1122, 0]
>>> print values[0][1]
0

As you can see values[0][1] can be used to access the balance inside the list in the dictionary

A: If you want to print all the balances, try this:
for value in bank:
    print value[1]

But it would be better to change your data structure to:
{'bob' : {'pin': 1122, 'balance': 0},
 'fred' : {'pin': 2211, 'balance': 0}}

and access to values as:
for account in bank:
    print account['balance']

or
bank['bob']['balance']


text:
Q: Mathematical description in GR I have heard a phrase somewhere, which can be reduced to the following two points:
1) There exists a handy and underused mathematical apparatus applicable to GR, comparing to which tensor calculus is obsolete.
2) The apparatus is related to graphs.
Does anybody have an idea, what could this apparatus be?

A: Maybe people talked about Penrose graphical notation or related inventions.
(The question is a little vague and I'm not use if "obsolete" is really the word. Watch out, the last time someone complained about tensors here, Ron Maimon gave a raging answer, which resembed an anvanced lecture in theoretical linguistics.)


text:
Q: using .load() with a variable and mutliple identifiers Ok so this is quick start to my jQuery
var uid = $('#mem_week a').attr('href');
$('#usersImg').load(uid #profile-advanced-right img);

Not quite sure if I can write the var uid inside the .load() like that, plus I need to be specific on the id #profile-advanced-right img is this possible?? if not can someone show how I would write this?>
Generated Mark up::

  Mr.EasyBB

That is just a basic mark up. Really I am trying to grab the users Image from the url /u1 from the div #profile-advanced-right .main-content img as though and out come should be

  Mr.EasyBB

A: Close. This is what you want:
$('#usersImg').load(uid + " #profile-advanced-right img");

You could have found this out by reading the jQuery load() documentation. It's generally a good idea to check the docs before asking a question here on SO. :)

A: So load basically does the same thing as this:
$.get(url).done(function(htmlFragment){ //get the html fragment at this url (it will be a string)
  $('#myElement').html(htmlFragment); //set the contents of your element to that html fragment
});

In other words, it's a helper method for a much more complex concept. By my reading what you want is to select an img within the returned fragment and stick it in your element
var url = $('#mem_week a').attr('href');
$.get(url).done(function(htmlFragment){ //get the html fragment at this url (it will be a string)
   //parse the string with jquery and navigate to that node
  var justTheImg = $(htmlFragment).find('#profile-advanced-right img');
  //set the contents of your element to that img (using the html method might also work)
  $('#myElement').append(justTheImg);
});


text:
Q: Node link not working I want to link my results from searchfn to the page, not only to the component.
At the moment I have:
[#if queryStr?has_content]
    [#assign searchResults = mySearchfn.searchContent('website', queryStr, '/home', 'mgnl:component') /]
[#assign recordsFound = searchResults?size /]

  ${recordsFound} Results -> "${queryStr}"

    [#if searchResults?has_content]
        [#list searchResults as item]

${item.excerpt!}

${item.page!}

${item.pageLink!}

        [/#list]
    [/#if]

[/#if]

the url I get from  tag is something like "path/to/page/area/component", the problem is I can't see the full page, only the component.
link

given the example above, only builds the url as /page not building with full string (path/to/page)

A: Either

*

*use searchPages(String query, String startPath) instead or

*change last param in your code to be mgnl:page instead of mgnl:component (as the last param is the return type not the search type).

A: can you try:
${cmsfn.link(cmsfn.page(item))}
or:
${cmsfn.link(cmsfn.contentByPath(item.pageLink))}


text:
Q: Does JBOSS EAP 6.3 support spring + websocket? I am trying to implement websocket using JBOSS and I understand for enterprise edition  websockets are supported from JBOSS EAP 6.3. I am also trying to integrate websockets with spring. I was wondering, does JBOSS EAP 6.3 supports integration of websockets with spring?
I have followed and configured all the steps mentioned at
http://spring.io/guides/gs/messaging-stomp-websocket/
except that, the application is deployed in JBOSS EAP 6.3. When I execute and try to connect, I am hitting with the following error.
GET http://localhost:8080/hello/info 404 (Not Found)
  sockjs-0.3.4.min.js:27 u._startsockjs-0.3.4.min.js:27 (anonymous function)
  stomp.js:134 Whoops! Lost connection to undefined

A: the Atmosphere Framework supports JBoss 6.3. Just take a look at this:
https://github.com/Atmosphere/atmosphere/wiki/Installing-JBoss-WebSocket-Support
Just jump on our mailing list for more information.
-- Jeanfrancois


text:
Q: Special case of the Monodromy Theorem Let $D$ be the unit disc in the complex plane. Suppose the following theorem is true: If $f \in H(D)$ and
\begin{equation*}
f(z)=\sum_{n=0}^\infty a_nz^n
\end{equation*} has radius of convergence $1$, then $f$ has at least one singular point on the unit circle. How can we apply this result to prove this version of the Monodromy Theorem: If $\Omega$ and $D$ are concentric discs, $(f,D)$ is a function element which can be analytically continued along every curve in $\Omega$ that starts at the origin $0$, then there exists a $g \in H(\Omega)$ such that $g(z)=f(z)$ on $D$?


text:
Q: Can the shell created from PHP shell_exec is reusable? I am working on a project, where I need to execute multiple unix script from PHP environment. Could this be possible to open a single unix shell and execute all the unix scripts.
Currently im using shell_exec for each of the scripts execution. This makes the application slow, as each time shell_exec,a new shell is being opened and the script is executed.
Thanks in Advance,

A: No, the underlying shell is not accessible.
You could try few things:

*

*Optimise the scripts so you have to do fewer execs. Pipe them or something like that

*I am not sure if it will work but you should be able to start a bash process and send commands to it (see proc_open). This way you could be able to manually and reuse the shell. But I imagine it will be a nightmare, especially in parsing the responses from the scripts (if you need that).


text:
Q: FIX repeating groups to reuse same tags Does FIX protocol allow to reuse same tag in a message and in repeating groups? I.e. could I have something like that
        <message name='Quote' msgtype='S' msgcat='app'>
            <field name='Price' required='Y'/><!-- i.e. total price for the whole quote-->
    ...
            <group name='NumLegs' required='Y'>
                <field name='Price' required='Y'/><!-- i.e. leg price -->
    ...
                <group name='NumLegDetails' required='Y'>
                    <field name='Price' required='Y'/><!-- i.e. leg component price -->
    ...
                </group>
    ...
            </group>
        </message>

A: TL;DR
It is not allowed in the tag-value encoding.
(but in FIXML it is)
Some explanations
My initial misunderstanding came from this statement in the FIX tag-value specification: see here, search for "Field presence"

A tag (field) must appear at most once in a message, except when the
tag appears within a repeating group.

But as I learned this refers to the wire format of the message, not the definition of the message.
Whereas the FIX5.0SP2 spec Volume 1 refers to the definition of the message and states:

A tag number (field) should only appear in a message once. If it
appears more than once in the message it should be considered an error
with the specification document.

In the meantime I even found it mentioned in FIXimate when looking at the NestedParties component (emphasis mine): (link to NestedParties component in FIXimate)

The NestedParties component block is identical to the Parties Block.
It is used in other component blocks and repeating groups when nesting
will take place resulting in multiple occurrences of the Parties block
within a single FIX message.. Use of NestedParties under these
conditions avoids multiple references to the Parties block within the
same message which is not allowed in FIX tag/value syntax.

BTW, there are also components NestedParties2, NestedParties3, NestedParties4 to work around this.
Information from FIX Trading Community Forum
The thread can be accessed here, but as far as I know you can only access it if you are a FIX TC member: FIX TC forum
The FIX expert Hanno Klein gave the following information:

The quote from the refactored online spec refers to the wire format of
any instance of a message encoded in tagvalue syntax. It means that
inside the wire format of a single repeating group a tag (field) may
appear more than once.

FIXML does not have this restriction:

The restriction is actually limited to the tagvalue encoding. For
example, the parties component is "Pty" for all instances in FIXML,
the XML syntax/encoding of FIX. This is due to the fact that the XML
syntax has an unambiguous structure with a distinct path to every
occurrence of a component or field. The XML names only need to be
unique within the same element.

Tag-value does:

For tagvalue, a parser needs to know when a repeating group starts and
ends. The NoXXX field marks the starting point and a field that is not
part of the group marks the ending point. There are no explicit
delimiters for repeating groups in tagvalue and components
(non-repeating) are not visible in the wire format at all.
Technically, you are probably right that a Price tag could exist in
two distinct repeating groups without causing a parser issue but I do
not see the benefit to allow this exception to the rule. You cannot
allow it for two adjacent levels, e.g. root + nesting level 1 or
nesting level x + nesting level y.

This part from original answer still applies
On another note, when defining your own repeating groups please use the notation NoXXX for repeating groups since that is the official recommendation. see here, search for "NumInGroup field"

It is recommended that NumInGroup fields be named NoXXX, e.g.
NoContraBrokers(382).

However, following your example with 44/Price you would normally see 566/LegPrice used as the price for an individual leg since the two are used differently. The former is the price used for the execution of an order, the latter is used when defining a leg of a strategy.
So in short, when defining your message structure and repeating groups you should really think about if the meaning of the tag is the same for all occurrences of the tag in the message and if it really makes sense to use the very same tag in the body and in repeating groups. Clarity should be first priority.

incorrect (strike through) part of original answer
At first I thought that this could not be allowed but mainly because I have never seen it appear somewhere in a real message. But actually I could not find a reason why it should not be allowed. The specification only says: see here, search for "Field presence"

A tag (field) must appear at most once in a message, except when the
tag appears within a repeating group.
A tag (field) must appear at most once per repeating group instance.

A: No, this is not allowed. I suggest you get a large data dictionary from http://www.quickfixengine.org, save it to your computer in XML format, and then execute a command like the following:
grep Price FIX.xml | grep number

Doing that will show you the definitions of all the Price-related fields. If you search for each of those field names within messages/components, you will see that each one is used in a different place. The overall result is that each field is listed only once in a message.

A: You can't re-use a repeating group tag outside a repeating group.
The declaration of a tag as a repeating group tag puts constraints on it, such as its order within a group and how one occurrence is treated differently to a subsequent occurrence.  Non-repeating group tags have no such constraint.


text:
Q: Как, при помощи ctrl + left/right arrow, сделать переход не только в начало слова, но и в конец Я раньше работала с Atom, в котором с этими переходами проблем не было. Сейчас выполняю посредственные задачи, с которыми справится и встроенный IDLE Python. Но проблема в том, что он, при нажатии ctrl left/right arrow, переходит только в начало слова. Как мне это настроить, чтобы было также, как и на Atom'е?

A: У меня все работает: ctrl left arrow переходит в начало слова, ctrl right arrow в конец.
Я использую Python 3.8, возможно в ранних версиях это не исправили.


text:
Q: Calculating Answer Proportion by Participant I have a dataset which contains a participant number, a response variable, and various other unimportant variables.
I want to calculate the proportion of answer choices on the response variabble for each participant individually and save this proportion to a new dataframe. The new dataframe should contain the pp_num and the proportion number of each answer choice.
Made Up Test Data:
Response <- c("Disgust", "Sadness", "Disgust", "Anger", "Anger", "Neutral", "Anger", "Disgust", "Happiness") #create example data
ResponseNum <- c(1,2,1,3,3,4,3,1,5) #Response, but expressed in Numbers
ppnum <- c(1,1,1,2,2,2,3,3,3)
df2a_anger <- as.data.frame(cbind(Response, ResponseNum, ppnum)) #create dataframe
df2a_anger$ResponseNum <- as.numeric(as.character(df2a_anger$ResponseNum)) # make numeric

Now, I know how to calculate the total proportion across participants:
df3 <- as.data.frame(prop.table(table(df2a_anger$ResponseNum)))

But I can´t get the same data divided per participant with pp_num saved. Does anyone have any ideas? My latest attempt was:
df3 <- group_by(df2a_anger, df2a_anger$ppnum) %>% prop.table(table(df2a_anger$ResponseNum))

A: You can count and then calculate proportions for each ppnum :
library(dplyr)

df2a_anger %>%
    count(ppnum, ResponseNum) %>%
    group_by(ppnum) %>%
    mutate(n = n/sum(n))

#  ppnum ResponseNum     n
#  <chr>       <dbl> <dbl>
#1 1               1 0.667
#2 1               2 0.333
#3 2               3 0.667
#4 2               4 0.333
#5 3               1 0.333
#6 3               3 0.333
#7 3               5 0.333


text:
Q: Please explain Meteor's Iron Router DATA and Subscribe/publish rendering I am frustrated with the lack of documentation around Iron Router and Collections/publish/subscribe. I have some Publish statements (on the isServer part of the code in the site) that return data from Collections to the client. I call them in the route like this:
Router.route('/project/:_id', {
  path: '/project/:_id',
  template: 'project',
  waitOn: function(){
    return Meteor.subscribe( "getProject", this.params._id );
  }

At this point, I have a server capable of sending a published data set to the client. I have a client asking to subscribe to that data set.  That should be all I need for a functional page, right? BUT, Iron Router barks at me when I don't include a data: field like this in the Route:
data: function() {
  return Projects.find();
}

Why do I need a data: if I should already have the data I want on the Meteor.subscribe? Can someone explain why this is necessary? I don't want Projects.find() results in the Template, I want the result of Meteor.subscribe("getProject"). Tried to call getProject in the data: part but it wants a collection not a publish/subscription.
This is frustrating because it seems like the most basic task: render a page and use the result set provided by the server. Am I missing something more than that? Basic LAMP can render data pretty easily.

A: On this piece of code.
waitOn: function(){
    return Meteor.subscribe( "getProject", this.params._id );
  }

Like the name say you are waiting to the client, get the "data ready" Aka the subscription.
And about the data:function() field on others word "template data", lets put in on an example.
Lets say you have this template.
<template name="projects">

A List Of Projects

</template>

So you need to pass data into the the template right?
So you can pass data as a function or as an object
you can pass
data:function(){
  return Projects.find() //for example
}

or
data:{
   projects:[{
     title:"example"
      },
      {
     title:"example2"
      }
    ]
 }

You need also know if you use the data as a function you don't need the {{#each}} helper on the template, but if you use it like an object you will need to do the follow
{{#each projects}}
   {{title}}
{{/each}}

Or you can just omit the data on the iron router and create your own helpers
Template.example.helpers({
  projects:function(){
    return Projects.find(); //this will do the same as data:function(){} iron router method
  }
})

Hope you get it

A: Yes, you still have to call find on any collection you need data from. A subscription just makes that data, that would normally only exist on the server side, available on the client side. A subscription pulls down the stuff you need for that given user. For example, you don't want all projects, you only want the projects that belong to the current user.
If you have the autopublish package installed, you wont need subscriptions as all clients will have all the data; without it you need to specify only what you need.


text:
Q: Is there a way to specify which variable to use in ember relationship After specifying the relationship between
App.Post = DS.Model.extend({
  comments: DS.hasMany('comment')
});

App.Comment = DS.Model.extend({
  post: DS.belongsTo('post')
});

But what it does is it accepts integer id in 'post' and an array of integers in 'comments' can anyone please tell me how to use any other variable for the reference like name or title instead of array.

A: With the associations, they are referencing the ember models not their specific types. So in this case the comments in the post model are just references to the individual comment ember objects


text:
Q: What does mean these errors in Gradle? I'm trying to assemble a Kotlin project using Gradle and I'm getting this kind of errors:
Execution failed for task ':app:processProDebugResources'.
> Could not resolve all files for configuration ':app:ProDebugRuntimeClasspath'.
   > Failed to transform misnapworkflow_UX2-release.aar to match attributes {artifactType=android-compiled-dependencies-resources}.
      > Execution failed for AarResourcesCompilerTransform: /gradle/conf/caches/transforms-3/dad12f3b940e882b6d90ca007996f37e/transformed/jetified-misnapworkflow_UX2-release.
         > AAPT2 aapt2-7.0.4-7396180-linux Daemon #0: Daemon startup failed
           This should not happen under normal circumstances, please file an issue if it does.

But I don't understand why it is failing.

A: In the end, the base Docker image I was taking was an Alpine and after changing it the execution was successful. Probably it was missing something.


text:
Q: Jquery Cookie return undefined [only in ie] Iam using jquery cookie .cookie return undefined in IE (only one machine).help me to resolve this issue.
JS Code
var cookie = {};
cookie["version"] = 1;
cookie["columnstate"] = { "width": 100, "hidden": true };
cookie["columnstate1"] = { "width": 200, "hidden": false };
$.cookie("state", JSON.stringify(cookie), { expires: 365 });

$("#getCookie").click(function () {
    alert($.cookie("state"));
});

HTML
<button id="getCookie">Get Cookie</button>

A: This is working with me on IE8
var cookie = {};
cookie["version"] = 1;
cookie["columnstate"] = { "width": 100, "hidden": true };
cookie["columnstate1"] = { "width": 200, "hidden": false };
jQuery.cookie("state", JSON.stringify(cookie), { expires: 365 });

alert(jQuery.cookie("state"));

I am using jquery.cookie.js v1.4.1. Which IE version you are trying.


text:
Q: Python Socket error I am new to Python and I am trying to write a Server program.  However, when it comes time for the server to accept the socket connection, it won't and I have to terminate the program with
File "test.py", line 12, in <module>
  client_socket, address = server_socket.accept()
File "/usr/lib/python2.6/socket.py", line 195, in accept
  sock, addr = self._sock.accept() `

I'm pretty sure it is saying that something is not matching up but I cannot find out where it is not doing so.  My server program is below:
 import socket
 import os

 server_address = '10.1.1.2'

 #while 1:
 #       os.system('netcat -l 3333')
 serversocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM)

 serversocket.bind ((socket.gethostname(), 3333))

 serversocket.listen(1)

 serversocket, client_addr = serversocket.accept()
 print client_addr

 serversocket.close()

Thank you for you help!

A: I think you should call socket.gethostbyname(socket.gethostname()) instead of just socket.gethostname().

A: I figured it out. Instead of socket.gethostname() I needed to be server_address in that spot. Thats why I couldn't connect to the server in the first place and always had to kill it with ^C


text:
Q: Reading data via GPIO I have just learned GPIO and I've read a lot of in internet. As I understood GPIO port can be at one of two states: out and in. In any states it can work with 0 and 1. For example, if we need to turn on a LED we change state to out and send 1. But I can't understand what happens when we connect to GPIO temperature sensor. It is clear that we change state to in. But what do we read from GPIO? 0s and 1? How can we get the temperature? Please, explain.
P.S. I use Olinuxino A13 board and currently I don't have any sensors. I just want to understand how it generally works and buy after that.

A: As you are dealing with temperature sensor here, so you need to use Analog to digital converter (ADC). You will have to put values into the ADC registers and then read the incoming values from ADC channel.
You have not mentioned which Micro controller you are focusing, so I am assuming Atmega32. You will have to read its datasheet to understand the ADC registers and you will have to make a function to read the values coming from the ADC channel and those values will be your temperature values.
For example:
 //function to read adc value
 uint16_t adc_read(uint8_t ch)
{
    ch &= 0b00000111;
    ADMUX = (ADMUX & 0xF8)|ch;
    ADCSRA |= (1<<ADSC);
    while(ADCSRA & (1<<ADSC));
    return (ADC);
}

so in your main, all you need to do is read values using above function and store it in a variable.
int main()
{
  uint16_t adc_result0;
  while(1)
  {
    adc_result0 = adc_read(0); //reading values and storing it in variable for further processing.
  }
}

Note: Above functions are just for the demo purpose and may not give the actual output.

A: The Allwinner A13 does not have any Analogue-to-Digital-Converter (ADC) inputs.
According the the User Manual:

2.8 I2C and SPI under Debian
  I2C and SPI are both supported in the latest Debian releases. There is respective kernel support for both.
  There is a python module called pyA13 might be found here:
  https://pypi.python.org/pypi/pyA13 It does have I2C (aka TWI) and SPI.

The I2C pins are described in section 6.3 UEXT module of the User Manual
So a straightforward way to interface the Olinuxino A13 to a temperature sensor is to get a temperature sensor with a built-in I2C interface, run Debian, and get at the temperature sensor form Python. I would expect to also be able to get at I2C from C, but I didn't see that mentioned)
There are quite a lot of I2C temperature sensors. They vary by operating voltage, resolution, and device package. I recommend trying to get things working quickly and cheaply first.
For example Microchip Temperature Sensors include devices with an I2C/SMBus. Some of these come in a Dual-In-Line package, which you can plug into a breadboard, and hence make it relatively easy to test things. Microchip parts are carried by a lot of distributers, so it shouldn't be too hard to get some (You should be able to pick one up for about 1GBP ($1.50))
There are I2C temperature sensors from other manufacturers which may have benefits. I've used Microchip I2C sensors, they are cheap and they worked.
If you really want to, you could buy an external ADC, and interface to that. Their are ADC devices which provide parallel data transfer, so you could experiment with GPIO. Some support SPI. This would require more electronics than an I2C temperature sensor. Hence I'd recommend getting a couple of I2C temperature sensors anyway. They should make it easy to set things up, and might still be useful, to to give you a way to do temperature comparison, (which may help debug the system) if you decide to go analogue.


text:
Q: react page is not showing after login this is my dashboard page , i should be directed to it after the login , and i am sure that the login process is successful , but after the login I face a plank page .
import React from "react";
import axios from "axios";
import { Link } from "react-router-dom";
import "./Chat.css"

const DashboardPage = (props) => {
  const nameRef = React.createRef();

  const [chatrooms, setChatrooms] = React.useState([]);
  const chatname = nameRef.current.value;

  const createChat = (e) => {
    e.preventDefault()

  axios
    .post("http://localhost:5000/chatroom", {
      name:chatname  })
    .then((response) => {
    console.log(response.data.message)
    })
    .catch((err) => {
      console.log(err);

    });

};

  const getChatrooms = () => {
    axios
      .get("http://localhost:5000/chatroom", {
        headers: {
          Authorization: "Bearer " + localStorage.getItem("CC_Token"),
        },
      })
      .then((response) => {
        setChatrooms(response.data);
        console.log(response.data)
      })
      .catch((err) => {
        setTimeout(getChatrooms, 3000);

      });
  };

  React.useEffect(() => {
    getChatrooms();
    // eslint-disable-next-line
  }, []);

  return (

Chatrooms

          Chatroom Name
          <input
            type="text"
            name="chatroomName"
            id="chatroomName"
            placeholder="ChatterBox Nepal"
            ref={nameRef}
          />

      <button onClick={createChat} type="button">Create Chatroom</button>

        {chatrooms.map((chatroom) => (

{chatroom.name}

            <Link to={"/chat/" + chatroom._id}>

Join

            </Link>

        ))}

  );
};

export default DashboardPage;

and this is the App.js :
import './App.css';
import Navigation from './components/Navigation';
import {BrowserRouter,Routes,Route} from "react-router-dom"
import Home from "./pages/Home"
import Login from "./pages/Login"
import Signup from "./pages/Signup"
import Chat from "./pages/Chat"
import 'font-awesome/css/font-awesome.min.css';
import io from "socket.io-client";
import makeToast from "./Toaster";
import React from "react";
import DashboardPage from './pages/DashboardPage';

function App() {

  const [socket, setSocket] = React.useState(null);

  const setupSocket = () => {
    const token = localStorage.getItem("CC_Token");
    if (token && !socket) {
      const newSocket = io("http://localhost:5000", {
        query: {
          token: localStorage.getItem("CC_Token"),
        },
      });

      newSocket.on("disconnect", () => {
        setSocket(null);
        setTimeout(setupSocket, 3000);
        makeToast("error", "Socket Disconnected!");
      });

      newSocket.on("connect", () => {
        makeToast("success", "Socket Connected!");
      });

      setSocket(newSocket);
    }
  };

  React.useEffect(() => {
    setupSocket();
    //eslint-disable-next-line
  }, []);

  return (
    <BrowserRouter>
       <Navigation />
       <Routes>

          <Route path="/" element={<Home />} />
          <Route path="/login" element={<Login setupSocket={setupSocket} />}  />
          <Route path="/signup" element={<Signup />} />
          <Route path="/dashboard" element={<DashboardPage socket={socket} />} />

          <Route path="/chat/:id" element={<Chat socket={socket} />} />

       </Routes>
    </BrowserRouter>

  );
}

export default App;

and this is the chat page :
import React from "react";
import "./Chat.css"
const Chat = ({ match, socket }) => {
  const chatroomId = match.params.id;
  const [messages, setMessages] = React.useState([]);
  const messageRef = React.useRef();
  const [userId, setUserId] = React.useState("");

  const sendMessage = () => {
    if (socket) {
      socket.emit("chatroomMessage", {
        chatroomId,
        message: messageRef.current.value,
      });

      messageRef.current.value = "";
    }
  };

  React.useEffect(() => {
    const token = localStorage.getItem("CC_Token");
    if (token) {
      const payload = JSON.parse(atob(token.split(".")[1]));
      setUserId(payload.id);
    }
    if (socket) {
      socket.on("newMessage", (message) => {
        const newMessages = [...messages, message];
        setMessages(newMessages);
      });
    }
    //eslint-disable-next-line
  }, [messages]);

  React.useEffect(() => {
    if (socket) {
      socket.emit("joinRoom", {
        chatroomId,
      });
    }

    return () => {
      //Component Unmount
      if (socket) {
        socket.emit("leaveRoom", {
          chatroomId,
        });
      }
    };
    //eslint-disable-next-line
  }, []);

  return (

Chatroom Name

          {messages.map((message, i) => (

                {message.name}:
              {" "}
              {message.message}

          ))}

            <input
              type="text"
              name="message"
              placeholder="Say something!"
              ref={messageRef}
            />

            <button className="join" onClick={sendMessage}>
              Send
            </button>

  );
};

export default Chat;

so as i said above , what should i do ??
before i edit it a liitle bit , it showed only the create room part of the dashboard page , but not the ( join room ) part .
now it does not show anything , and I am lost !!!!!!!!!!!!!!


text:
Q: need advice with logic for coding out this php exercise I've got a list in a text file with the top 1000 words used in the english language. Each line has a list of up to 50 words, like this:

the,stuff,is,thing,hi,bye,hello,a,stuffs
  cool,free,awesome,the,pray,is,crime
  etc.

I need to write code using that file as input, to make an output file with the a list of pairs of words which appear together in at least fifty different lists. For example, in the above example, THE & IS appear together twice, but every other pair appears only once.
I can't store all possible pairs of words, so no brute force.
I'm trying to learn the language and I'm stuck on this exercise of the book. Please help. Any logic, guidance or code for this would help me.
This is what I have so far. It doesn't do what's intended but I'm stuck:
Code:
//open the file
$handle = fopen("list.txt", 'r');

$count = 0;
$is = 0;
while(!feof($handle)) {

    $line = fgets($handle);

    $words = explode(',', $line);

    echo $count . "

";
    print_r($words);
    foreach ($words as $word) {
        if ($word == "is") {
            $is++;
        }
    }
    echo "

";

$count++;
}

echo "Is count: $is";

//close the file
fclose($handle);

$fp = fopen('output.txt', 'w');
fwrite($fp, "is count: " . $is);
fclose($fp);

This is what I came up with but I think it's too bloated:
plan:
check the first value of the $words array
store the value into $cur_word
store $cur_word as a key in an array ($compare) and
store the counter (line number) as the value of that key
it'll be 1 at this point
see if $cur_word is on each line and if it is then
put the value into $compare with the key as $cur_word
if array has at least 50 values then continue
else go to the next value of the $words array
if it has 50 values then
go to the next value and do the same thing
compare both lists to see how many values match
if it's at least 50 then append
the words to the output file
repeat this process with every word

A: There are probably 100's of solutions to this problem.  Here is one
$contents = file_get_contents("list.txt");

//assuming all words are separated by a , and converting new lines to word separators as well
$all_words = explode(",", str_replace("\n", ",", $contents));
$unique_words = array();
foreach ($all_words as $word) {
    $unique_words[$word] = $word;
}

this will give you all the unique words in the file in an array.
You can also use the same technique to count the words
$word_counts = array();
foreach ($all_words as $word) {
    if (array_key_exists($word, $word_counts)) {
        $word_counts[$word]++;
    } else {
        $word_counts[$word] = 1;
    }
}

then you can loop through and save the results
$fp = fopen("output.txt", "w");
foreach ($word_counts as $word => $count) {
    fwrite($fp, $word . " occured " . $count . " times" . PHP_EOL);
}
fclose($fp);


text:
Q: Drawing to a bitmap from a WPF canvas I have a canvas that contains an Image in which I dislay an existing BMP.  I draw rectangles on the canvas and add these to the Children colllection.  When I click save, I want to update the underlying BMP file.
The following code works, but the rectangle that gets drawn to the BMP is way smaller than what I drew.  I guess there's some difference in the co-ordinates?  Maybe I shouldn't be using System.Drawing?
        using (Graphics g = Graphics.FromImage(image))
        {
          g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;

          foreach (var child in canvas.Children)
          {
            if (child is System.Windows.Shapes.Rectangle)
            {
              var oldRect = child as System.Windows.Shapes.Rectangle;

              // need to do something here to make the new rect bigger as the scale is clearly different
              var rect = new Rectangle((int)Canvas.GetLeft(oldRect), (int)Canvas.GetTop(oldRect), (int)oldRect.Width, (int)oldRect.Height);
              g.FillRectangle(Brushes.Black, rect);
            }
          }
          ... code to save bmp

All suggestions welcome!
Thanks

A: Try using the System.Windows.Media.Imaging.RenderTargetBitmap Class (an example here).
Wpf uses Device Independent Graphics so you have to compensate for the DPI :
RenderTargetBitmap bmp = new RenderTargetBitmap((int)Canvas1.Width, (int)Canvas1.Height, 96, 96, PixelFormats.Default);
bmp.Render(Canvas1);

From Third Link:

There are two system factors that determine the size of text and graphics on your screen: resolution and DPI. Resolution describes the number of pixels that appear on the screen. As the resolution gets higher, pixels get smaller, causing graphics and text to appear smaller. A graphic displayed on a monitor set to 1024 x 768 will appear much smaller when the resolution is changed to 1600 x 1200.


text:
Q: How to route SMTP traffic for my exchange virtual machine which hosted on my ubuntu server which is acting as a router\firewall behind my ADSL router I'M new to the whole operation what I have is Ubuntu server 18.04 which act as a Router\firewall and DHCP server for my network same server host a virtual machine holding Microsoft Exchange 2013 how I can shift SMTP traffic from my ADSL router which have a static public IP (A record and MX record already published) through Ubuntu server(another Router\Firewall) to land on my exchange server.. this is needed to activate mail receiving function.
Else this is what I did in ADSL Router under NAT option I activated port forwarding to Ubuntu server (router\firewall) external IP address and in Ubuntu server I used below commands to shift traffic to my VM
iptables -A PREROUTING -t nat -i eno1 -p tcp --dport 25 -j DNAT --to 10.10.10.30:25
iptables -A FORWARD -p tcp -d 10.10.10.30 --dport 25 -j ACCEPT

but still not working what I missed here ?


text:
Q: Mi programa crashea al concluir Estoy aprendiendo a programar C++ y he escrito el siguiente codigo. Todo corre bien pero al final (cuando se admite el decimo valor) deja de funcionar.
Estoy usando MSVC2015.
Me pueden ayudar con esto, por favor?
#include "stdafx.h"
#include <iostream>

using namespace std;

int main() {

    int pank[10];

    for (int i = 0; i <= 10; i++) {
        cout << "Cuantos pancakes se comio la persona No." << i << " " << endl;
        cin >> pank[i];
    }

    system("pause");
    return 0;
}

A: Eso se debe a que los arrays empiezan por la posición 0. Es decir, si tu array tiene que tener 10 posiciones tendrá las posiciones:
0, 1, 2, 3, 4, 5, 6, 7, 8 y 9

Por tanto, en tu bucle tienes que ir desde la posición 0 a la posición n-1 (10-1 = 9). Tendrías que cambiar la condición tal que así:
for (int i = 0; i < 10; i++) {
                 ^^
   cout << "Cuantos pancakes se comio la persona No." << i << " " << endl;
   cin >> pank[i];
}

El error que te da se debe a que si pones la condición i<=10 también va a intentar almacenar un valor para la posición 10 del array, la cual no existe.
Va a intentar hacer esto:
cin >> pank[10];

lo cual es erróneo ya que esa posición no existe y por eso tienes que indicar en la condición que recorra hasta el número n-1.


text:
Q: Input 3 number in one line We can get 3 number from user like this
a = int(input())
b = int(input())
c = int(input())

Now how can we get 3 number from user in one line?
a , b , c = int(input())

I tried this but it's not ok

A: try this:
a , b , c = map(int,(input().split()))

A: You can do like this:
a, b, c = input("Insert the 3 values: ").split()
print(f"a: {a}\nb: {b}\nc: {c}")

See this similar question for more details

A: If you're reading data from a .txt file and you're wanting to map variables a, b, and c in one line.
Example:
inputFile = open("example.txt",r)

a, b = map(int, inputFile.readline().split())

A: try:
    a,b,c  = map(int,input('input').split())

    print(a,b,c)

except:
    print('input is no good')


text:
Q: An easy way to replace binary reference in the VS project with a project reference Note: system is poorly modularized, there is much coupling between components, and I am in no position to change that.
Context MS Visual Studio 2010 (Pro)
Backstory:
I have a solution that uses a web service. There is tight coupling between client [component] and said web service. When I work on the client I often need to tweak the web service. Both client and service have unreasonable number of [poorly modularized] projects. To make matter worse those web service projects have dependencies in the same manner on other web services and libraries. So that creating one solution will contain 200 projects, and will bring VS/R# to a halt, therefore creating a humangous solution is not an option.
Client projects have binary references to web-service binaries (it shouldn't, but it does). Sometimes I want not just debug, but to change code in those projects.
Question
Is there an easy way in Visual Studio (e.g. using an unknown to me R# feature, or a VS Power Toys extension or yet some other Visual Studio Extension/Plugin) to replace a binary reference with a project reference?