text:
Q: How do i load different views? In my MY_Controller.php, I want to detect user device and the requested domain name. Domain names I am using on same app are: www.seeme.tld and m.seeme.tld, also I am using $this->detect().
So this is what I did:
<?php

if($this->detect->isMobile() || $_SERVER['HTTP_HOST'] === MOBILE_URL){
$this->config->set_item('base_url', MOBILE_URL);
}elseif(!$this->detect->isMobile() || $_SERVER['HTTP_HOST'] != MOBILE_URL){
$this->config->set_item('base_url', WEBSITE_URL);
}

?>

I have 2 folders in application/views folder : PC(for pc users) and Mobile(for mobile users)
In order to load views, I used this code in my fetch() function:
public function fetch($view, $data = array, $other_vars = false)
{

if(base_url() === MOBILE_URL || $this->_ci->detect->isMobile()){
$f = 'Mobile/';
}elseif(!$this->_ci->detect->isMobile() || base_url() != MOBILE_URL){
$f = 'PC/';
}
return $this->_ci->load->view($f.'contents/'.$view, $data, true);
}

When I use a mobile device or the visit m.seeme.tld with a mobile device, I get mobile contents. But when I visit visit m.seeme.tld with a PC instead of getting mobile contents, I rather get PC contents. Please help me solve this issue!

A: Changing config array could be problematic sometimes: How to override config's array within a controller in CodeIgniter?. Also you are doing double check (in controller and in the function).
I archieve similar behaviour with doing this way:
YOURCONTROLLER.PHP __construct():
if ($this->detect->isMobile() || $_SERVER['HTTP_HOST'] === MOBILE_URL){
   define('IS_MOBILE', TRUE);
}else{
   define('IS_MOBILE', FALSE);
}

then you could use to load the view:
if (IS_MOBILE) {
   $view_folder = 'Mobile/';
}else{
   $view_folder = 'PC/';
}
$this->load->view($view_folder.$view, $data, TRUE);

Also you could add a single checkpoint to view if the if statment is working fine:
if ($this->detect->isMobile() || $_SERVER['HTTP_HOST'] === MOBILE_URL){
   define('IS_MOBILE', TRUE);
   log_message('debug', 'Im mobile browser: '.$this->detect->isMobile().' or the url is mobile:'.$_SERVER["HTTP_HOST"]);
}else{
   define('IS_MOBILE', FALSE);
   log_message('debug', 'Im pc');
}

Hope it helps to you.
// This works only replace the '===' with '='.

A: thanks for the help but i got it fixed. all i did was to first detect mobile users in MY_Controller.php and redirect them to MOBILE_URL then in my fetch() i did:
if($_SERVER['HTTP_HOST'] = MOBILE_URL){
$view_folder = 'Mobile/;
}else{ $view_folder = 'Frontend/;
}

and that's it,Paam it started working.


text:
Q: Missing \endcsname inserted with beamer document I have created a beamer presentation in Overleaf but I don't know what my error means
>Missing \endcsname inserted.
<to be read again>
                   \relax
l.99 \end{frame}

This is my tex
\documentclass{beamer}
\usetheme{Warsaw}
\title{Gettysburg Cemetery Dedication}
\author{Abraham Lincoln}
\institute{United States of America}
\date{19 Nov 1863}

\begin{document}
\begin{frame}
\titlepage % beamer's \maketitle
\end{frame}

\begin{frame}
\frametitle{Outline}
\begin{itemize}
\item Agenda
\item Review
\item Summary
\end{itemize}
\end{frame}
\tableofcontents

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Agenda}

\begin{frame}
\frametitle{Agenda}
\begin{itemize}
\item Met on battlefield (great)
\item Dedicate portion of field --- fitting!
\item Unfinished work (great tasks)
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{Not on Agenda!}
\begin{itemize}
\item Dedicate
\pause\item Consecrate
\pause\item Hallow (in narrow sense)
\pause\item Add or detract
\pause\item Note or remember what we say
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Review}
\begin{frame}
\frametitle{Key Objectives \& Success Factors}
\begin{itemize}
\item What makes nation unique:
\begin{itemize}
\item Conceived in Liberty
\item are equal
\end{itemize}

\begin{block}{Shared vision:}
\begin{itemize}
\item  New birth of freedom.
\item  Gov't of/for/by the people.
\end{itemize}
\end{block}

\end{itemize}
\end{frame}

\begin{frame}
\frametitle{Organizational Overview}
\begin{figure}
\includegraphics[width=0.5\textwidth]{gettysburg_graph}
\end{figure}
%\begin{equation}
%\lable{Four Score and Seven}
%-(4 * 20 + 7) = -87
%\end{equation}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Summary}
\begin{frame}
\frametitle{Summary}
\begin{columns}
\begin{column}
\begin{itemize}
\item New nation
\item Civil war
\item Dedicate field
\end{itemize}
\end{column}

\begin{column}
\begin{itemize}
\item Dedicated to unfinished work
\item New birth of freedom
\item Government not perish
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\end{document}

A: There are two mistakes in your code:

*

*You have \lable instead of \label in an equation (it's commented out in your code but once you uncomment it you'll get an error).

*The column environment requires a length specifying the width.

The corrected code (I marked the changes using %HERE):
\documentclass{beamer}
\usetheme{Warsaw}

\begin{document}

\begin{frame}
\frametitle{Organizational Overview}
\begin{figure}
\includegraphics[width=0.5\textwidth]{example-image-a}
\end{figure}
%\begin{equation}
%\label{Four Score and Seven}% HERE
%-(4 * 20 + 7) = -87
%\end{equation}
\end{frame}

\section{Summary}
\begin{frame}
\frametitle{Summary}
\begin{columns}
\begin{column}{.5\linewidth}% HERE
\begin{itemize}
\item New nation
\item Civil war
\item Dedicate field
\end{itemize}
\end{column}

\begin{column}{.5\linewidth}% HERE
\begin{itemize}
\item Dedicated to unfinished work
\item New birth of freedom
\item Government not perish
\end{itemize}
\end{column}
\end{columns}
\end{frame}

\end{document}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Do 'local' deformation relations between vector bundles imply a 'global' one? Let $\pi:Z\to B$ be an elliptic fibration over some base $B$. Suppose two vector bundles $V$ and $V'$ differ only in that on each fibre (i.e. elliptic curve) they are related by some deformation, i.e. they sit in the same extension group.
My question is whether it follows that $V$ and $V'$ are themselves related by a deformation. I feel that this should obviously be the case, but I don't have a solid enough understanding of extensions to convince myself.

A: If the base $B$ is local, or affine with trivial Picard group, then maybe you can extend the arguments I gave in my answer to your other question here. But as soon as $B$ is global, say a projective curve, then you are dealing with bundles on a surface. They have a first Chern class that is a divisor on the surface, which may not be uniquely determined by its restrictions to a pencil of curves. There is also a second Chern class, which cannot be seen on a curve. For a specific example, take a bundle on your elliptic curve $E$, and consider its pullback $V$ to $E \times \mathbb{P}^1$ (the projective line). Then take $V'$ to be $V$ tensor the pullback of $\mathcal{O}(1)$ on $\mathbb{P}^1$. In this case, $V$ and $V'$ have isomorphic restrictions to every elliptic fiber, but cannot be deformation equivalent since their first Chern classes are different.


text:
Q: Google Map renders quaterly inside div. browser resize renders the map properly I am using gmap, drupal 6 on pantheon. My gmap occurs quaterly in its own div, when the page refreshes.
I have checked with gmap resize() option. it did not work. Even I have tried to load the gmap, when the tab(the map is inside "view map" tab not jquery UI tab) is clicked, it did not work there too. The map is not inside iframe. When the browser is re-sized or inspect element tool is opened for debugging, the map appears but the matker is not visible. The marker goes outside of the given width-height.
Google Maps not rendering completely on page? did not help me.
Please suggest.

A: *

*Are you rendering the "#map-canvas" HTML div programmatically?
In that case, make sure that the DOM is ready before trying to render the Map.

*Apply: google.maps.event.trigger(map, 'resize');
I had to use this to prevent gray areas => But I guess this is what you've tried already?

*Check the map dimensions in the Google Chrome Element inspector.


text:
Q: Playing Audio/Video from UDP data in a Browser Now that FireFox has dropped their support for plugins, I have lost a huge feature on my website that integrated a VLC plugin for audio and for video from UDP data.
What are the best options (sticking to FireFox only is completely acceptable for my customer base) to get both audio and video data (as separate modules) into a browser from a UDP stream?
I was hoping Flash was a solution but it looks like their udp datagram api is not supported on the browser. VLC was the most convenient but now it is dead...


text:
Q: Dynamically created group is not reflecting in the check permissions in SharePoint 2013 on-prem I have created a few SharePoint groups through an itemadded event receiver in my on-premise solution. user will give a title for the group and click on save button and on itemadded, I am adding sitegroup.add() and calling the web.update();
When I added a user into the group and then I checked for this user in the check permissions in site settings, am not able to see the group name against this user.
Do I need to do any extra line of code in order to update / reflect the group name against the user in the check permissions ?
for the other groups and users which were created few weeks back working perfectly.
            var allgroups = CurrentWeb.SiteGroups;
             allgroups.Add(strDivGrpName, currUser, null,
           strDivGrpName);
            CurrentWeb.AssociatedGroups.Add(CurrentWeb.SiteGroups
            [strDivGrpName]);
                         allgroups.Add(strDivGrpName, currUser, null,
               strDivGrpName);
               CurrentWeb.AssociatedGroups.Add(CurrentWeb.SiteGroups
          [strDivGrpName]);
                         CurrentWeb.Update();


text:
Q: Displaying 3-D scatter plot w/ Color Dependent on Data I have a large set of data that I've collected that I'd like to display in a 3-D scatter plot. The data is contained in a text file.
The data is organized like so
1 1 1 10.8
2 1 1 3.4
4 1 1 6.1
8 1 1 4.5
1 2 1 7.8
...
8 8 8 11.9

The first three tokens in each line should represent (x,y,z) points. In the 3-D scatter plot, there should be a dot for each of these points.
The color of the dots depends on the fourth token. Basically, the closer the fourth parameter is to the max value, the closer it will be to the color red. The close the fourth parameter is to the min value, the bluer it will be.
I'm pretty sure that the scatter3(X,Y,Z,S,C) function does this, but I'm not an expert.
Here's what my data variable contains:

A: Try this (assume data is the array you presented in your question):
x = data(:,1);
y = data(:,2);
z = data(:,3);
s = ones(size(data,1), 1) * 20; %sizes of markers
c = data(:,4); %color data

scatter3(x,y,z,s,c);
colorbar;

Or you can simply do it inline:
scatter3(data(:,1),data(:,2),data(:,3),ones(size(data,1), 1)*20,data(:,4));
colorbar


text:
Q: Return 404 for the /web directory Symfony 3 All my links are accessibles by mysite.com but also with mysite.com/web/
I would not like to redirect /web to / but, i would like to return a 404 for ^/web. I think it's possible cuz i saw a lot of symfony projects which return 404 error for the /web path
Thanks you all !

A: You need to modify your apache configuration so the document root points to /web folder.
Your apache config file needs to look something similar to this:
<VirtualHost *:80>
ServerName www.mysite.com
ServerAlias mysite.com
ServerAdmin contact@mysite.com
RewriteEngine On

DocumentRoot your_site_path/web

<Directory your_site_path/web/>
        Options FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{ENV:REDIRECT_STATUS} ^$
        RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
        RewriteCond %{REQUEST_FILENAME} -f
        RewriteRule .? - [L]
        RewriteRule .? %{ENV:BASE}/app.php [L]
    </IfModule>
</Directory>
</VirtualHost>


text:
Q: how to get property of entity of entity by name in class Person i have relation to class Position, and the class Position has a relation to class PositionTitle, and the PositionTitle has a property named Title
public class Person
{
  public position Position{get;set;}
  public string Name{get;set;}
  public DateTime BirthDate{get;set;}
  public bool IsAdmin{get;set;}
  public int Age{get;set;}
}

public class position
{
  public positionTitle PositionTitle{get;set;}
  public bool IsSystem{get;set;}
}

public class PositionTitle
{
  public string Title{get;set;}
}

i have a string "Person.Position.PositionTitle.Title", how can i get this property of person with this string??
EDIT:
i should add sth, im gonna get all properties of person till getting to system types,, i mean i wanna have these propertis as string { Name,Age,IsAdmin,BirthDate,IsSystem,Title}
how could I?
EDiT2: one more problem,, Position itself can have a relation to Person, and if i get properties of person and recursively get properties of those classes that person have a relation to,, there would be a non stop loop, because Person has a Position and Position has a Person

A: Basically you split the string by the '.', then loop through each substring, using reflection to get the property of the current instance. Then set the instance to the property you've just got.
You'll end up with the property you're after.
    /// <summary>
    /// Gets an object property's value, recursively traversing it's properties if needed.
    /// </summary>
    /// <param name="FrameObject">The object.</param>
    /// <param name="PropertyString">The object property string.
    /// Can be the property of a property. e.g. Position.X</param>
    /// <returns>The value of this object's property.</returns>
    private object GetObjectPropertyValue(Object FrameObject, string PropertyString)
    {
        object Result = FrameObject;

        string[] Properties = PropertyString.Split('.');

        foreach (var Property in Properties)
        {
            Result = Result.GetType().GetProperty(Property).GetValue(Result, null);
        }

        return Result;
    }

Disclamer: This works for my use, watch out for null references etc!


text:
Q: Zip including hidden files In Linux I can zip all(except hidden files) in current directory by doing:
zip 1.zip *

But how do I include the hidden files?

A: If you want to zip all files (+hidden files)
Kindly using: zip -r namefiles.zip .
The "." is all files in folder.
zip -r namefiles.zip "folder will zip"

A: On macOS 10.15.7 I had to separatelly add all dot leading files (\.*) and rest of the files (*):
zip -r file.zip \.* *

A: Or you can add more simple
zip 1.zip ./

A: if you don't have rights to save zip file in current dir you can go to dir where you have rights and type
zip -r 1.zip /path/to/source/dir/.

However when if in .../some_dir you type
unzip 1.zip

then your files will be decompress into  .../some_dir/path/to/source/dir/

A: EDIT: The correct way is zip -r 1.zip .
The commands shown in my previous answer below are incorrect because they also include the parent directory.

Have you tried this:
zip yourfile.zip sourcedir/* .*

or you in your case
zip 1.zip * .[^.]*

It should include all hidden files also.

A: Just to be sure it is not forgotten since this is a forum for developers and a good number of us use git.
An easy way to get only what you want in the zip is to use git archive -o filename.zip branch

A: If you'd like to save some subdirectory of the current directory recursively with hidden and regular files just type
$ zip -r backup_subdirectory.zip backup_subdirectory/. backup-subdirectory/*

And for unzipping:
$ unzip backup_subdirectory.zip

Or even simpler by using tar for creating an archive:
$ tar czvf backup_subdirectory.tar.gz backup_subdirectory/

And for extracting all files from the archive:
$ tar xzvf backup_subdirectory.tar.gz

A: zip -r 1.zip .* -x "../*"

Just doing zip -r 1.zip .* will include the parent folder as well so the trick is to exclude the parent folder using -x "../*"


text:
Q: Navigation Drawer Intent Activity Android Studio I have created a navigation drawer for an App I'm creating, I'm learning the code and everything as I go along. I've come to a point where I'm unable to make any links to another activity in the navigation drawer work.
Main Activity
public class MainActivity2 extends AppCompatActivity {

private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mToggle;

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

    final Button bCreateTask = (Button) findViewById(R.id.btnCreateNewTask);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.DrawerLayout);
    mToggle = new ActionBarDrawerToggle(this,mDrawerLayout, R.string.Open,      R.string.Close);

    mDrawerLayout.addDrawerListener(mToggle);
    mToggle.syncState();

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    bCreateTask.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity2.this,                                                   NewTaskActivity.class);
            MainActivity2.this.startActivity(intent);

        }
    });
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if(mToggle.onOptionsItemSelected(item)){
        return true;

    }
    return super.onOptionsItemSelected(item);
}

}

Main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout     xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/DrawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.example.rikhi.chores.MainActivity2">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <Button
        android:text="New Task"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/btnCreateNewTask"
        android:layout_weight="1" />
</LinearLayout>

<android.support.design.widget.NavigationView
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    app:menu="@menu/navigation_menu"
    android:layout_gravity="start"
    app:headerLayout="@layout/navigation_header">
</android.support.design.widget.NavigationView>

</android.support.v4.widget.DrawerLayout>

Navigation_Menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/nav_accont"
    android:icon="@mipmap/ic_person_black_24dp"
    android:title="MyAccount"/>
<item android:id="@+id/nav_setting"
    android:icon="@mipmap/ic_settings_black_24dp"
    android:title="settings"/>
<item android:id="@+id/nav_logout"
    android:icon="@mipmap/ic_lock_outline_black_24dp"
    android:title="logout"/>

</menu>

I'm not sure if I have to use intent or how it works if someone could please guide me that would be great. If any other code is needed please ask and ill be happy to provide.

A: bCreateTask.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity2.this, NewTaskActivity.class);
            startActivity(intent);

        }
    });

A: If you want to add drawer, then you have to use this way.
     @SuppressWarnings("StatementWithEmptyBody")
     @Override
     public boolean onNavigationItemSelected(MenuItem item) {
      int id = item.getItemId();

      if (id == R.id.nav_home) {

      } else if (id == R.id.nav_profile) {

      } else if (id == R.id.nav_study_list) {

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

A: try this:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main2);
    initNavigationDrawer();

    final Button bCreateTask = (Button) findViewById(R.id.btnCreateNewTask);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.DrawerLayout);
    mToggle = new ActionBarDrawerToggle(this,mDrawerLayout, R.string.Open,R.string.Close);

    mDrawerLayout.addDrawerListener(mToggle);
    mToggle.syncState();

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    bCreateTask.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity2.this,NewTaskActivity.class);
            MainActivity2.this.startActivity(intent);

        }
    });
}

public void initNavigationDrawer() {

    NavigationView navigationView = (NavigationView) findViewById(R.id.navigation_view);
    navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(MenuItem menuItem) {

            int id = menuItem.getItemId();

            switch (id) {
                case R.id.nav_accont:
                    Intent intent = new Intent(MainActivity2.this, SecondActivity.class);
                    startActivity(intent);
                    break;
                case R.id.nav_setting:
                    //same logic
                    break;
                case R.id.nav_logout:
                   //same logic
                    break;
                default:
                    break;
            }
            return true;
        }
    });
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if(mToggle.onOptionsItemSelected(item)){
        return true;

    }
    return super.onOptionsItemSelected(item);
}

Also in your layout :
    <android.support.design.widget.NavigationView
    android:id="@+id/navigation_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    app:menu="@menu/navigation_menu"
    android:layout_gravity="start"
    app:headerLayout="@layout/navigation_header">
</android.support.design.widget.NavigationView>


text:
Q: How To Refresh/Clear the DistributedCache When Using Hue + Beeswax To Run Hive Queries That Define Custom UDFs? I've set up a Hadoop cluster (using the Cloudera distro through Cloudera Manager) and I'm running some Hive queries using the Hue interface, which uses Beeswax underneath.
All my queries run fine and I have even successfully deployed a custom UDF.
But, while deploying the UDF, I ran into a very frustrating versioning issue. In the initial version of my UDF class, I used a 3rd party class that was causing a StackOverflowError.
I fixed this error and then verified that the UDF can be deployed and used successfully from the hive command line.
Then, when I went back to using Hue and Beeswax again, I kept getting the same error. I could fix this only by changing my UDF java class name. (From Lower to Lower2).
Now, my question is, what is the proper way to deal with these kind of version issues?
From what I understand, when I add jars using the handy form fields to the left, they get added to the distributed cache. So, how do I refresh/clear the distributed cache? (I couldn't get LIST JARS; etc. to run from within Hive / Beeswax. It gives me a syntax error.)

A: Since the classes are loaded onto the Beeswax Server JVM (same goes with HiveServer1 and HiveServer2 JVMs), deploying a new version of a jar could often require restarting these service to avoid such class loading issues.


text:
Q: View Reloads When Frame is Changed I have a YouTubePlayer (from here) in my app. I have a UIViewController (we'll call this MainViewController) with a UITableView full of videos. Whenever a user taps on a cell, it opens another UIViewController (we'll call this DetailViewController) with my custom xib view called playerView. Like I said, playerView is a custom xib view and in that view is my YouTubePlayer. This is how I set up playerView in my DetailViewController
playerContainer.addSubview(playerView)
playerView.frame = CGRect(x: 0, y: 0, width: playerContainer.frame.size.width , height: playerContainer.frame.size.height)
playerView.player.loadVideoID(nowPlayingVideo.id)

Ok so this works great. BUT... whenever the user dismisses DetailViewController, I want playerView to be moved to the MainViewController. Like where the user can see what is playing in the background. So to do this, I added this code in DetailViewController...
override func viewWillDisappear(_ animated: Bool) {
    nowPlayingView.addSubview(playerView)
    playerView.frame = CGRect(x: 8, y: 8, width: width, height: height)
    playerView.layoutIfNeeded()
}

nowPlayingView is another custom xib view and is added to the app's window earlier on. So this is where I start running into problems. This code works great. The frame is changed correctly and it's added to nowPlayingView, but, the YouTubePlayer in playerView seems to reload. So it pauses playback, shows a loading icon, and then resumes. It's pretty annoying. This shouldn't be happening because the video is already loaded in the YouTubePlayer. I'm pretty sure it happens only whenver I am changing the frame of playerView. Does anyone have any ideas on how to fix this?

A: When the video resumes playing after loading, does the video start over or does it resume where it left off before changing the view?


text:
Q: Docker image not running on host 8050 I am trying to teach myself how to deploy a dash application on AWS.
I have created a folder 'DashboardImage' on my mac that contains a Dockerfile, README.md, requirements.txt and an app folder that contains my python dash app 'dashboard.py'.
My Dockerfile looks like this:

I go into the DashboardImage folder and run
docker built -t conjoint_dashboard .

It built successfully and if I run docker images I can see the details of the image.
When I try
docker run conjoint_dashboard

The terminal tells me Dash is running on http://0.0.0.0:8050/ but it is not connecting.
I can't understand why.

A: You need to expose the port, see: https://docs.docker.com/engine/reference/commandline/run/#publish-or-expose-port--p---expose

$ docker run -p 127.0.0.1:80:8080/tcp ubuntu bash
This binds port 8080 of the container to TCP port 80 on 127.0.0.1 of the host machine. You can also specify udp and sctp ports. The Docker User Guide explains in detail how to manipulate ports in Docker.

A: Update it according to your port, e.g. if your application exposes port 8050 then:
docker run -p 8050:8050 conjoint_dashboard where -p = publish first one is the HOST port, and the second is the CONTAINER port.
Also you can update your dockerfile:

FROM: continuumio/minicoda3
...

EXPOSE 8050/tcp

...

The EXPOSE instruction doesn't actually publish the port. It functions as a type of documentation between the person who builds the image and the person who runs the container, about which ports are intended to be published.
To actually publish the port when running the container, use the -p flag on docker run to publish and map one or more ports, or the -P flag to publish all exposed ports and map them to high-order ports.
By default, EXPOSE assumes TCP. You can also specify UDP:


text:
Q: How can I know why a triggered send has been queued? I'm sending triggered sends via REST API call but some emails get queued. How can I know what is making them be queued? How can I see the logs without opening a support ticket? Is there any way of getting this information from the API? any endpoint that could give me information?
Thanks!

A: Unfortunately, this is not available to the user right now. There are a lot of pain points in relation to this that are being brought up - including issues where a Triggered Send 'hangs' due to an error in an email, but no notification is set to recognize this error - so the queue keeps building up.
My best advice is to either work with support to see what offerings they can do with your situation (likely will require services, which will be $$$) or to try and set up your own monitoring system for checking queues and then troubleshoot the queues to see what caused the issue.
Here is a link to my simple Triggered Send queue limits monitoring script that may be useful.
From there, I would recommend looking at the queued records in the TSD queue link in Interactions in Email Studio and doing a 'send preview' of the Trigger on that record and see if there is an email error. You can also try the age old IT solution of 'turn it off and on again' via a pause/restart and see if that handles it too.  Other than that, you really are at the mercy of support/services for solutioning.


text:
Q: Should [super loadView] be called from loadView or not? In Programming iOS 4 by Matt Newburg he states:

"To provide a UIViewController with a view manually, implement its
loadView method… You must NOT call super".

In the iOS 5 Developer's Cookbook by Erica Sadun she states:

"The loadView method allows you to set up the screen and layout any
subviews… Make sure to call [super loadView] whenever you inherit
from a specialized subclass such as UITableViewController or
UITabBarController."

This, to me at least, is confusing.

A: Apple is the source of truth and they say NO super call.

If you override this method in order to create your views manually,
you should do so and assign the root view of your hierarchy to the
view property. (The views you create should be unique instances and
should not be shared with any other view controller object.) Your
custom implementation of this method should not call super.

https://developer.apple.com/documentation/uikit/uiviewcontroller/1621454-loadview
[edit]
Another important note scattered around in the UIViewController class reference:

The default loadView method attempts to load the view from the nib
file associated with the view controller (if any).

A: This is a very old question, but I find that it needs a better answer than the one it got.

Should [super loadView] be called from loadView or not?

It depends. The two sources you cite are talking about different situations, and they're both correct in the context they're describing.
The quote from Neuberg is talking about view controllers that inherit directly from UIViewController. That class has its own implementation of loadView that provides default behavior; specifically, it automatically loads the view hierarchy from a .xib (or storyboard) file that's associated with the view controller. If you call UIViewController's version of that method, the view hierarchy created in that method will either replace your own implementation's view hierarchy, or vice versa. Nine years after this question was posed, the documentation for UIViewController's -loadView method still warns against that:

You can override this method in order to create your views manually. If you choose to do so, assign the root view of your view hierarchy to the view property. The views you create should be unique instances and should not be shared with any other view controller object. Your custom implementation of this method should not call super. [emphasis added]

The quote from Sadun is talking about a different situation, i.e. one in which your view controller is not a direct subclass of UIViewController, but is instead derived from UITableViewController, UITabBarController, etc. Those classes override -loadView themselves and need their versions called. At least in the case of UITableViewController, this is called out in the Overview section:

You may override loadView or any other superclass method, but if you do, be sure to invoke the superclass implementation of the method, usually as the first method call.

So, if you're subclassing UIViewController and providing your own -loadView implementation to generate the controller's views rather than using a .xib or storyboard to provide the views, don't call the superclass's -loadView method. On the other hand, if you're subclassing a class such as UITableView and doing the same thing, check the docs to see whether you need to call that class's -loadView method from your own override.


text:
Q: How do I get the user info of a twitter user using javascript? Using jquery's $.ajax function, I'm not able to parse the results.  For example, I used it like this
$.ajax({

    url : "http://api.twitter.com/1/users/show.json?screen_name=techcrunch",
    dataType : "json",
    success : function(data)
    {
        // parse the JSON here
    },
    error : function()
    {
        alert("Failure!");
    },

});

This doesn't work.  Do I need a callback function?

A: As metnioned, this is due to the Same Origin Policy. To get around this, you should set your datatype to jsonp.
$.ajax({

    url : "http://api.twitter.com/1/users/show.json?screen_name=techcrunch",
    dataType : "jsonp",
    success : function(data)
    {
        console.log(data);
    },
    error : function()
    {
        alert("Failure!");
    },

});

Example: http://jsfiddle.net/jonathon/bpnbj/

A: You can't make an ajax call to an external url due to Same Origin Policy. You can see more info in Call external url through $.ajax in wordpres theme thread.


text:
Q: The goal "copy-dependencies" does not copy the parent pom My project structure is like this:
* Foo
  - API
  - Core
  - OSGi

All child projects define Foo as their parent (parent has dependencyManagement).
Another team is going to use my project. They only need my API layer and they cannot access my maven repository.
I need to give them all the dependencies of my API so I executed the following maven command:
mvn dependency:copy-dependencies -DincludeScope=compile -Dmdep.copyPom
-Dmdep.useRepositoryLayout

The dependency-plugin copies everything just fine except for the parent pom. How can I add the parent pom.xml to the output folder?

A: see the addParentPoms option here http://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html


text:
Q: Django: What is a clean way to populate a list of optional object attributes that need to be wrapped in try/except? Is this a good place for eval()? I repeatedly find myself in a position where I'm writing specific django model instance fields into a list for various reasons (exporting to CSV, logging) and I'd imagine the same is true for many other people.
Generating a report could require traversing through foreign keys IF they exist. The larger the report, the more unreadable the code gets as I wrap attribute getter attempts in try/except blocks.
Optional foreign keys are also problems: item.optional_fk.optional_date.method()
for item in django_model_instances:
    try:
          date_created = item.order.date_created.strftime('%Y/%m/%d')
    except AttributeError:
          date_created = ''

    try:
        date_complete = item.order.date_complete.strftime('%Y/%m/%d')
    except AttributeError:
        date_complete = ''

    # perhaps more try/except...

    writer.writerow([
        item.optional_fk.optional_field.strtime('%Y'),
        item.optional_fk.method(),
        item.bar,
        date_created,
        # other attributes...
        date_complete,
        # other attributes...
         ])

As you have more columns to write the code starts to look like a monster.
I like the readability of using eval() wrapped in try/except but I read I should avoid eval like the plague.
Is using eval in Python a bad practice?

*

*There is almost always a better way to do it - trying to find a better way without writing too much code :)

*Very dangerous and insecure - the strings are hard coded

*Makes debugging difficult - True

*Slow - code is for generating reports, it can be slow.
.
def no_exceptions_getter(item, statement):
    try:
        return eval(statement)
    except AttributeError, e:
        log.debug(e)
        return ''

for item in django_model_instances:
    writer.writerow([no_exceptions_getter(item, x) for x in (
        'item.foo',
        'item.bar',
        'item.date_created.strftime("%Y/%m/%d")',
        'item.date_complete.strftime("%Y/%m/%d")',
        'item.optional_foreign_key.foo',
        # more items in a readable list format
        )])

I don't see the security vulnerability, speed or debugging problems being an issue.
So my question for you experts out there is: is this an OK use of eval?

A: Why aren't you just using getattr?
for item in django_model_instances:
    date_created = getattr(item.order, 'date_created', '')
    if date_created:
          date_created = date_created.strftime('%Y/%m/%d')

or a simple wrapper, if this particular pattern is used a lot:
def get_strftime(object, attr):
    value = getattr(object, attr, None)
    if value is None:
        return ''
    return value.strftime('%Y/%m/%d')

writer.writerow([
    item.foo,
    item.bar,
    get_strftime(item.order, 'date_created'),
    get_strftime(item.order, 'date_complete'),
])

A: I assume in your example that date_created might not exist because you're not always passing the same model class to your loop. The solution may then appear to be to put the logic in the object via the model class definition, and write a 'getrow' method function for any classes you might want to do this to. For classes that have a 'date_created' method, they return that, otherwise return '' or None.

A: How about
def getattrchain(obj, attrStr, fnArgs=None, defaultResult=''):
    try:
        for attr in attrStr.split('.'):
            obj = getattr(obj,attr)
    except AttributeError:
        return defaultResult

    if callable(obj) and fnArgs is not None:
        return obj(*fnArgs)
    else:
        return obj

for item in django_model_instances:
    writer.writerow([getchainattr(item, x, args) for x,args in (
        ('foo', None),
        ('bar', None),
        ('date_created.strftime', [r'%Y/%m/%d']),
        ('date_complete.strftime', [r'%Y/%m/%d']),
        ('optional_foreign_key.foo', None),
    )
])


text:
Q: Java multithreaded program getting stuck waiting I'm starting to code multithreaded programs in Java and I'm having problems with this particular program, which seems to get stuck in a waiting state indefinitely, even though it doesn't look like it should be able to.
In this program, there are threads which distribute numbers(tokens) across different containers: every thread has an array of containers from which to take the numbers from(it takes one number from each one), and an array of containers to put it in.
As you can see from the code, I make sure that before taking numbers, the Thread makes sure that every Container has a number ready to get, to avoid infinite waiting.
I tried the program with this structure: 4 threads and 4 containers, Thread 1 and 2 both take numbers from containers 1 and 2, and they both put them in container 3.
Thread 3 takes numbers from container 3 and puts them in container 4 and 1, and thread 4 takes numbers from container 4 and puts them in container 2.
The first two containers are initialized with one number, and the other two with no numbers, as you can see here:
public class Main {
    public static void main(String[] args) throws InterruptedException{
        Container[] c = new Container[4];
        ThreadT[] threads = new ThreadT[4];

        c[0] = new Container(1,1);
        c[1] = new Container(1,2);
        c[2] = new Container(0,3);
        c[3] = new Container(0,4);

        threads[0]= new ThreadT(0, 200, new Container[]{c[0],c[1]}, new Container[]{c[2]}, c);
        threads[1]= new ThreadT(100, 200, new Container[]{c[0],c[1]}, new Container[]{c[2]}, c);
        threads[2]= new ThreadT(500, 600, new Container[]{c[2]}, new Container[]{c[0], c[3]}, c);
        threads[3]= new ThreadT(200, 300, new Container[]{c[3]}, new Container[]{c[1]}, c);

        for(ThreadT t : threads) t.start();

        Thread.sleep(30000);

        for(ThreadT t : threads) t.interrupt();
    }
}

The program works for a while: one of the first two Threads gets to take numbers and transfer them in container 3 without a problem, but once the numbers are in container 3, the program stops for no apparent reason: Thread 3 should pass the allTokensAvailable()check in the transferMessages() function and get a number from the container, but it doesn't.
I tried moving some of the wait() conditions and trying different conditions altogether but with no success.
I print the status of all the containers every time they change for debugging.
class Container{
    private int id;
    private Random r = new Random();
    private ArrayList<Integer> tokens = new ArrayList();

    public Container(int tokensToGenerate, int id){
        this.id = id;
        for(int i = 0; i < tokensToGenerate; i++){
            tokens.add(r.nextInt(10));
        }
    }

    public synchronized void putToken(int token){
        tokens.add(token);
        notifyAll();
    }

    public synchronized int getToken() throws InterruptedException {
        while(tokens.isEmpty()) wait();
        int result = tokens.get(0);
        tokens.remove(0);
        return result;
    }

    public void printStatus(){
        System.out.println("Container "+id+" has "+tokens.size()+" elements");
    }
    public synchronized boolean hasTokens(){
        return !tokens.isEmpty();
    }
}

class ThreadT extends Thread{
    private Container[] takeFrom;
    private Container[] sendTo;
    private Container[] allContainers;
    private ArrayList<Integer> tokensToSend = new ArrayList();
    private Random r = new Random();
    private int minWait;
    private int maxWait;

    public ThreadT(int min, int max, Container[] senders, Container[] receivers, Container[] all){
        takeFrom = senders;
        sendTo = receivers;
        allContainers = all;
        minWait = min;
        maxWait = max;
    }

    private boolean allTokensAvailable(){
        boolean result = true;
        for(Container c : takeFrom){
            if(!c.hasTokens()) result = false;
        }
        System.out.println("allTokensAvailable for "+Thread.currentThread().getName()+" "+result);
        return result;
    }

    private void printAllStatus(){
        for(Container c : allContainers) c.printStatus();
    }

    private void transferMessages() throws InterruptedException{
        while(!allTokensAvailable()) {
            System.out.println(Thread.currentThread().getName()+" waiting");
            wait();
        }

        for (Container c : takeFrom){
            tokensToSend.add(c.getToken());
            System.out.println(Thread.currentThread().getName()+" is receiving messages");
            printAllStatus();
        }
        sleep((r.nextInt(maxWait-minWait)+minWait));
        for(Container c : sendTo){
            for(int i : tokensToSend){
                System.out.println(Thread.currentThread().getName()+" is sending messages");
                c.putToken(i);
                printAllStatus();
            }
        }
        tokensToSend.clear();
    }

    @Override
    public synchronized void run(){
        try{
            while(true){
                transferMessages();
            }
        } catch (InterruptedException e) {}
    }
}

In theory, Thread 3 should get a number from Container 3 and put a copy of that number in containers 1 and 4.
EDIT: I put a lot of print statements to figure out what's going on with the Threads, and it seems like there's an issue where threads are not getting to do the check even though I put notifyAll() instead of notify.
Here's the output from the program:
allTokensAvailable for Thread-2 false
allTokensAvailable for Thread-0 true
allTokensAvailable for Thread-1 true
allTokensAvailable for Thread-3 false
Thread-0 is receiving messages
Thread-3 waiting
Thread-2 waiting
Container 1 has 0 elements
Container 2 has 1 elements
Container 3 has 0 elements
Container 4 has 0 elements
Thread-0 is receiving messages
Container 1 has 0 elements
Container 2 has 0 elements
Container 3 has 0 elements
Container 4 has 0 elements
Thread-0 is sending messages
Container 1 has 0 elements
Container 2 has 0 elements
Container 3 has 1 elements
Container 4 has 0 elements
Thread-0 is sending messages
Container 1 has 0 elements
Container 2 has 0 elements
Container 3 has 2 elements
Container 4 has 0 elements
allTokensAvailable for Thread-0 false
Thread-0 waiting

Why is it that when container 3 receives an element Thread 3 doesn't even try to check? (there is no allTokensAvailable for Thread-3 true/false? It should at least check right?


text:
Q: Importing jar into Android Studio project Currently i'm getting this error:
    UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
    at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
    at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
    at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
    at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
    at com.android.dx.command.dexer.Main.processClass(Main.java:704)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
    at com.android.dx.command.dexer.Main.access$300(Main.java:83)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:632)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)
...while parsing db/DbFacade.class

1 error; aborting

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    E:\Program Files (x86)\Android\sdk\build-tools\build-tools-21.1.2\dx.bat --dex --output E:\Documents\Workspaces\AndroidStudio\Peanuts\app\build\intermediates\pre-dexed\debug\Peanuts-d65a672244db794ef4112fb86dd03a66b2b8790f.jar E:\Documents\Workspaces\AndroidStudio\Peanuts\app\libs\Peanuts.jar
Error Code:
    1
Output:

    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
        at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
        at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
        at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
        at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
        at com.android.dx.command.dexer.Main.processClass(Main.java:704)
        at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
        at com.android.dx.command.dexer.Main.access$300(Main.java:83)
        at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
        at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
        at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
        at com.android.dx.command.dexer.Main.processOne(Main.java:632)
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
        at com.android.dx.command.dexer.Main.run(Main.java:246)
        at com.android.dx.command.dexer.Main.main(Main.java:215)
        at com.android.dx.command.Main.main(Main.java:106)
    ...while parsing db/DbFacade.class

    1 error; aborting

I made a directory "libs" at app/libs. The same level as my "build" and "src" directory.
Then i Copied my jar ("Peanuts.jar") into that folder.
Next, i right clicked it and selected 'Add as library'.
This .jar uses 2 other jars, one for json and another for mysql. I've created the JAR in eclipse, EXPORT > JAVA > RUNNALE JAR  and checked "Extract required libraries into generated jar.
my app.iml contains:
    <orderEntry type="library" exported="" name="Peanuts" level="project" />

my build.gradle contains:
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:21.0.+'
    compile files('libs/Peanuts.jar')
}

A: This is because Peanuts and appcompat have some file in common. Try removing appcompat and clean and rebuild the application. It might work fine.


text:
Q: Is it safe to use my admob account on New google developer account This is my case
I have a google developer account and ive been uploading my app on it for 2yr,
yesterday my developer account has been terminated, the admod account still safe tho.
Now im going to create a new developer account using different email under my wife name.
My questions:
Is it safe to use my old admob account (which is used on my terminated google dev acc before) to a new GDA?
Do i need a new laptop/pc to create a new GDA?
Thanks in advance.

A: I think you can't use the older admob account for a long time. If it's against google policy then they will catch.


text:
Q: Horizontal scroll on HTML select? I need my select in IE 10/11 to show horizontal scroll in case it has long titled item and vertical if it has more items then usual.
I tried div with overflow-x:auto; but vertical scroll on select hides under this div and requires horizontal scrolling.
Find running reference code here.
HTML is:
<div style="width:140px; overflow-x:auto;">
    <select name="selectbox" size="5"  id="selectbox" >
        <option>one two three four five six seven eight</option>
        <option>seven eight</option>
        <option>nine ten</option>
        <option>one two three four five six</option>
        <option>seven eight</option>
        <option>nine ten</option>
        <option>one two three four five six seven eight nine ten</option>
        <option>seven eight</option>
        <option>nine ten</option>
        <option>one two three four five six</option>
        <option>seven eight</option>
        <option>nine ten</option>
    </select>
</div>

A: A similar post which is about stylizing a select element is here:
Hide vertical scrollbar in <select> element
It seems to be really difficult to stylize a select element, because he is interpreted by each browser. As you can see on this fiddle, even if it's close to your asking it's not really clean.
.bloc {
    width: 140px;
    border: 1px solid grey;
    display: inline-block;
    overflow: auto;
}

#selectbox {
    height: 100%;
    padding: 10px;
    margin:-5px -20px -5px -5px;
}

So, you can't customize your select in that way :(


text:
Q: How to include 3 interactions with a SINGLE predictor in lmer I know that I could use lm(a ~ (b + c + d)^2) in order to get all possible two-way interactions in a model, but I need only the interactions with a single predictor. Let's say I want the possible interaction of B + C + D with predictor E.
I've tried:
lmer(MyVar ~ (1|ID) + (B + C + D)^E, data = data, REML = F)

Error in terms.formula(formula, data = data) :
  invalid power in formula

I know that I could hard code each interaction with either * or :, but I suppose there's a simple way to do that all at once, isn't there? Thanks in advance.

A: Peter already provided an answer in the comments, but just so there is a worked example here, I have used the carrots dataset from the lmerTest package to fit this kind of model.
#### Load Library ####
library(lmerTest)

#### Fit 3 Interactions with Predictor ####
fit <- lmer(Preference
            ~ (Work + Homesize + Age) * sens2
            + (1 + sens2 | Consumer),
            data=carrots)
summary(fit)

This specific model has more than 12 parameters, so it gives a warning at the that it can't show the entire correlation matrix at the end:
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula:
Preference ~ (Work + Homesize + Age) * sens2 + (1 + sens2 | Consumer)
   Data: carrots

REML criterion at convergence: 3793

Scaled residuals:
    Min      1Q  Median      3Q     Max
-3.5393 -0.5531  0.0221  0.6129  3.0304

Random effects:
 Groups   Name        Variance Std.Dev. Corr
 Consumer (Intercept) 0.194588 0.44112
          sens2       0.002667 0.05164  0.30
 Residual             1.070431 1.03462
Number of obs: 1233, groups:  Consumer, 103

Fixed effects:
                 Estimate Std. Error        df t value Pr(>|t|)
(Intercept)      4.599943   0.269675 92.130730  17.057   <2e-16 ***
Work2            0.252784   0.215224 92.355377   1.175   0.2432
Work3            0.049107   0.202453 92.620270   0.243   0.8089
Work4            0.350115   0.241920 92.357943   1.447   0.1512
Work5           -0.172296   0.251901 92.336511  -0.684   0.4957
Work6            0.142940   0.306935 92.245988   0.466   0.6425
Work7            0.284870   0.222300 92.466369   1.281   0.2032
Homesize3       -0.210541   0.117745 92.054098  -1.788   0.0770 .
Age2             0.147557   0.258083 91.931134   0.572   0.5689
Age3             0.175345   0.244237 91.940161   0.718   0.4746
Age4             0.143185   0.286984 91.891878   0.499   0.6190
sens2           -0.005156   0.048716 92.036870  -0.106   0.9159
Work2:sens2     -0.026848   0.038861 92.096571  -0.691   0.4914
Work3:sens2      0.025743   0.036536 92.167106   0.705   0.4828
Work4:sens2      0.020395   0.043681 92.097263   0.467   0.6417
Work5:sens2      0.041402   0.045486 92.091579   0.910   0.3651
Work6:sens2      0.041545   0.055435 92.076468   0.749   0.4555
Work7:sens2     -0.026257   0.040130 92.126134  -0.654   0.5145
Homesize3:sens2  0.034216   0.021273 92.017206   1.608   0.1112
Age2:sens2       0.050271   0.046641 91.984618   1.078   0.2839
Age3:sens2       0.049982   0.044137 91.986480   1.132   0.2604
Age4:sens2       0.098257   0.051868 91.973468   1.894   0.0613 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation matrix not shown by default, as p = 22 > 12.
Use print(x, correlation=TRUE)  or
    vcov(x)        if you need it

Since this may be common for models that have a lot of interaction terms, you can simply follow the advice given with the warning and just run vcov(fit) to see the rest:
22 x 22 Matrix of class "dpoMatrix"
                  (Intercept)         Work2         Work3         Work4
(Intercept)      0.0727247177 -2.460271e-02 -2.159223e-02 -2.485573e-02
Work2           -0.0246027147  4.632157e-02  2.731653e-02  2.605219e-02
Work3           -0.0215922283  2.731653e-02  4.098720e-02  2.751607e-02
Work4           -0.0248557275  2.605219e-02  2.751607e-02  5.852536e-02
Work5           -0.0188462642  2.535069e-02  2.746376e-02  2.638325e-02
Work6           -0.0590599021  2.577976e-02  2.074795e-02  2.352827e-02
Work7           -0.0196165301  2.525230e-02  2.745152e-02  2.594625e-02
Homesize3       -0.0109607544 -3.400679e-04  3.870252e-03  2.706524e-03
Age2            -0.0407749626 -6.515489e-03 -1.335698e-02 -4.201862e-03
Age3            -0.0494575617 -7.385083e-04 -7.919796e-03 -3.694373e-03
Age4            -0.0511840024 -5.047503e-04 -6.213891e-03 -8.488546e-04
sens2            0.0017103436 -5.694673e-04 -4.960309e-04 -5.737888e-04
Work2:sens2     -0.0005694673  1.082713e-03  6.301142e-04  6.007327e-04
Work3:sens2     -0.0004960308  6.301141e-04  9.510769e-04  6.326784e-04
Work4:sens2     -0.0005737887  6.007327e-04  6.326785e-04  1.367865e-03
Work5:sens2     -0.0004311883  5.838187e-04  6.310805e-04  6.061557e-04
Work6:sens2     -0.0013903112  5.995643e-04  4.776545e-04  5.446369e-04
Work7:sens2     -0.0004495020  5.815462e-04  6.308496e-04  5.958678e-04
Homesize3:sens2 -0.0002555305 -1.271474e-05  8.614862e-05  5.884019e-05
Age2:sens2      -0.0009699655 -1.494199e-04 -3.104255e-04 -9.394093e-05
Age3:sens2      -0.0011767009 -1.158708e-05 -1.805710e-04 -8.082443e-05
Age4:sens2      -0.0012155754 -8.270833e-06 -1.427594e-04 -1.592515e-05
                        Work5         Work6         Work7     Homesize3
(Intercept)     -1.884626e-02 -5.905990e-02 -1.961653e-02 -1.096075e-02
Work2            2.535069e-02  2.577976e-02  2.525230e-02 -3.400679e-04
Work3            2.746376e-02  2.074795e-02  2.745152e-02  3.870252e-03
Work4            2.638325e-02  2.352827e-02  2.594625e-02  2.706524e-03
Work5            6.345422e-02  1.792640e-02  3.446007e-02  2.839939e-03
Work6            1.792640e-02  9.420917e-02  1.785281e-02  1.291156e-03
Work7            3.446007e-02  1.785281e-02  4.941720e-02  4.034687e-03
Homesize3        2.839939e-03  1.291156e-03  4.034687e-03  1.386395e-02
Age2            -7.707013e-03  3.230279e-02 -7.764027e-03 -1.515922e-03
Age3            -1.021223e-02  4.033104e-02 -9.334598e-03  2.906882e-03
Age4            -1.878498e-02  4.116822e-02 -2.475574e-02  4.240265e-03
sens2           -4.311884e-04 -1.390312e-03 -4.495020e-04 -2.555306e-04
Work2:sens2      5.838188e-04  5.995648e-04  5.815462e-04 -1.271468e-05
Work3:sens2      6.310805e-04  4.776551e-04  6.308496e-04  8.614867e-05
Work4:sens2      6.061557e-04  5.446375e-04  5.958678e-04  5.884025e-05
Work5:sens2      1.483935e-03  4.114916e-04  7.971930e-04  6.188087e-05
Work6:sens2      4.114910e-04  2.207829e-03  4.096409e-04  2.535023e-05
Work7:sens2      7.971929e-04  4.096415e-04  1.151554e-03  9.018370e-05
Homesize3:sens2  6.188081e-05  2.535036e-05  9.018363e-05  3.267278e-04
Age2:sens2      -1.768088e-04  7.730782e-04 -1.781380e-04 -3.387819e-05
Age3:sens2      -2.350601e-04  9.623697e-04 -2.142697e-04  7.102571e-05
Age4:sens2      -4.406804e-04  9.803703e-04 -5.821051e-04  1.018839e-04
                         Age2          Age3          Age4         sens2
(Intercept)     -4.077496e-02 -4.945756e-02 -5.118400e-02  0.0017103436
Work2           -6.515489e-03 -7.385083e-04 -5.047503e-04 -0.0005694673
Work3           -1.335698e-02 -7.919796e-03 -6.213891e-03 -0.0004960309
Work4           -4.201862e-03 -3.694373e-03 -8.488546e-04 -0.0005737888
Work5           -7.707013e-03 -1.021223e-02 -1.878498e-02 -0.0004311884
Work6            3.230279e-02  4.033104e-02  4.116822e-02 -0.0013903117
Work7           -7.764027e-03 -9.334598e-03 -2.475574e-02 -0.0004495020
Homesize3       -1.515922e-03  2.906882e-03  4.240265e-03 -0.0002555306
Age2             6.660707e-02  4.917829e-02  4.874852e-02 -0.0009699654
Age3             4.917829e-02  5.965166e-02  5.751230e-02 -0.0011767008
Age4             4.874852e-02  5.751230e-02  8.235963e-02 -0.0012155754
sens2           -9.699654e-04 -1.176701e-03 -1.215575e-03  0.0023732002
Work2:sens2     -1.494201e-04 -1.158717e-05 -8.270915e-06 -0.0008009534
Work3:sens2     -3.104256e-04 -1.805711e-04 -1.427594e-04 -0.0007021649
Work4:sens2     -9.394109e-05 -8.082452e-05 -1.592525e-05 -0.0008088714
Work5:sens2     -1.768090e-04 -2.350602e-04 -4.406805e-04 -0.0006125030
Work6:sens2      7.730783e-04  9.623699e-04  9.803704e-04 -0.0019275339
Work7:sens2     -1.781381e-04 -2.142698e-04 -5.821052e-04 -0.0006376798
Homesize3:sens2 -3.387822e-05  7.102570e-05  1.018839e-04 -0.0003572095
Age2:sens2       1.574981e-03  1.162241e-03  1.152849e-03 -0.0013328873
Age3:sens2       1.162241e-03  1.410198e-03  1.360446e-03 -0.0016167476
Age4:sens2       1.152849e-03  1.360446e-03  1.949606e-03 -0.0016727270
                  Work2:sens2   Work3:sens2   Work4:sens2   Work5:sens2
(Intercept)     -5.694673e-04 -4.960308e-04 -5.737887e-04 -4.311883e-04
Work2            1.082713e-03  6.301141e-04  6.007327e-04  5.838187e-04
Work3            6.301142e-04  9.510769e-04  6.326785e-04  6.310805e-04
Work4            6.007327e-04  6.326784e-04  1.367865e-03  6.061557e-04
Work5            5.838188e-04  6.310805e-04  6.061557e-04  1.483935e-03
Work6            5.995648e-04  4.776551e-04  5.446375e-04  4.114916e-04
Work7            5.815462e-04  6.308496e-04  5.958678e-04  7.971930e-04
Homesize3       -1.271468e-05  8.614867e-05  5.884025e-05  6.188087e-05
Age2            -1.494201e-04 -3.104256e-04 -9.394109e-05 -1.768090e-04
Age3            -1.158717e-05 -1.805711e-04 -8.082452e-05 -2.350602e-04
Age4            -8.270915e-06 -1.427594e-04 -1.592525e-05 -4.406805e-04
sens2           -8.009534e-04 -7.021649e-04 -8.088714e-04 -6.125030e-04
Work2:sens2      1.510208e-03  8.888542e-04  8.476685e-04  8.246902e-04
Work3:sens2      8.888542e-04  1.334852e-03  8.949241e-04  8.931412e-04
Work4:sens2      8.476685e-04  8.949241e-04  1.908065e-03  8.579816e-04
Work5:sens2      8.246902e-04  8.931412e-04  8.579816e-04  2.068938e-03
Work6:sens2      8.398725e-04  6.749491e-04  7.659950e-04  5.829051e-04
Work7:sens2      8.214882e-04  8.927538e-04  8.437191e-04  1.121775e-03
Homesize3:sens2 -1.207554e-05  1.252882e-04  8.732358e-05  9.165766e-05
Age2:sens2      -2.118283e-04 -4.351115e-04 -1.361084e-04 -2.505820e-04
Age3:sens2      -2.290075e-05 -2.572678e-04 -1.193013e-04 -3.321938e-04
Age4:sens2      -1.572527e-05 -2.020783e-04 -2.686406e-05 -6.127763e-04
                  Work6:sens2   Work7:sens2 Homesize3:sens2
(Intercept)     -1.390311e-03 -0.0004495020   -2.555305e-04
Work2            5.995643e-04  0.0005815462   -1.271474e-05
Work3            4.776545e-04  0.0006308496    8.614862e-05
Work4            5.446369e-04  0.0005958678    5.884019e-05
Work5            4.114910e-04  0.0007971929    6.188081e-05
Work6            2.207829e-03  0.0004096415    2.535036e-05
Work7            4.096409e-04  0.0011515535    9.018363e-05
Homesize3        2.535023e-05  0.0000901837    3.267278e-04
Age2             7.730783e-04 -0.0001781381   -3.387822e-05
Age3             9.623699e-04 -0.0002142698    7.102570e-05
Age4             9.803704e-04 -0.0005821052    1.018839e-04
sens2           -1.927534e-03 -0.0006376798   -3.572095e-04
Work2:sens2      8.398725e-04  0.0008214882   -1.207554e-05
Work3:sens2      6.749491e-04  0.0008927538    1.252882e-04
Work4:sens2      7.659950e-04  0.0008437191    8.732358e-05
Work5:sens2      5.829051e-04  0.0011217754    9.165766e-05
Work6:sens2      3.072991e-03  0.0005804819    4.112908e-05
Work7:sens2      5.804819e-04  0.0016104051    1.306882e-04
Homesize3:sens2  4.112908e-05  0.0001306882    4.525614e-04
Age2:sens2       1.056816e-03 -0.0002524409   -4.911036e-05
Age3:sens2       1.318931e-03 -0.0003035236    9.540544e-05
Age4:sens2       1.345904e-03 -0.0008078267    1.388138e-04
                   Age2:sens2    Age3:sens2    Age4:sens2
(Intercept)     -9.699655e-04 -1.176701e-03 -1.215575e-03
Work2           -1.494199e-04 -1.158708e-05 -8.270833e-06
Work3           -3.104255e-04 -1.805710e-04 -1.427594e-04
Work4           -9.394093e-05 -8.082443e-05 -1.592515e-05
Work5           -1.768088e-04 -2.350601e-04 -4.406804e-04
Work6            7.730782e-04  9.623697e-04  9.803703e-04
Work7           -1.781380e-04 -2.142697e-04 -5.821051e-04
Homesize3       -3.387819e-05  7.102571e-05  1.018839e-04
Age2             1.574981e-03  1.162241e-03  1.152849e-03
Age3             1.162241e-03  1.410198e-03  1.360446e-03
Age4             1.152849e-03  1.360446e-03  1.949606e-03
sens2           -1.332887e-03 -1.616748e-03 -1.672727e-03
Work2:sens2     -2.118283e-04 -2.290075e-05 -1.572527e-05
Work3:sens2     -4.351115e-04 -2.572678e-04 -2.020783e-04
Work4:sens2     -1.361084e-04 -1.193013e-04 -2.686406e-05
Work5:sens2     -2.505820e-04 -3.321938e-04 -6.127763e-04
Work6:sens2      1.056816e-03  1.318931e-03  1.345904e-03
Work7:sens2     -2.524409e-04 -3.035236e-04 -8.078267e-04
Homesize3:sens2 -4.911036e-05  9.540544e-05  1.388138e-04
Age2:sens2       2.175354e-03  1.606007e-03  1.592130e-03
Age3:sens2       1.606007e-03  1.948116e-03  1.878419e-03
Age4:sens2       1.592130e-03  1.878419e-03  2.690248e-03


text:
Q: How to get the first letter of an XML attribute with XSLT? I have this XML:
<entry>
  <title handle="foo">Foo</title>
</entry>

How can I get the first letter of the handle attribute using XSLT 1.0?
Thanks for any help.

A: You can use the substring XPath function.
For example, the following XPath expression will evaluate to 'f' for your example XML.
substring(/entry/title/@handle, 1, 1)


text:
Q: Unable to use Windows Fonts with PIL My question is related to Python, specifically the Python PIL library. I know there are several questions similar to mine, unfortunately I am unable to reply/comment on those questions because my reputation is not high enough. My issue is specific to choosing a windows font for PIL:
Below is my code for what font I want to select:
Based on reading other solutions on stack overflow to get Arial Bold font, I found a solution which stated to add the following code to get arial bold to work:
font = ImageFont.truetype("C:\Windows\Fonts\\ariblk.ttf", font_size)

And this works (Whats weird is I don't even see ariblk.tff as an option within C:\Windows\Fonts directory path, but this works.). However, I am not sure why, the path below which exists, shows me the following error when I run it:
font = ImageFont.truetype("C:/Windows/Fonts/Arial/Arial Bold.ttf", font_size)

ERROR:
Traceback (most recent call last):
  File "C:\Users\Sagar\Desktop\Python Image Edit Test\imageEdit.py", line 48, in <module>
    font = ImageFont.truetype("C:/Windows/Fonts/Arial/Arial Black.ttf", font_size)
  File "C:\Users\Sagar\AppData\Local\Programs\Python\Python36-32\lib\site-packages\PIL\ImageFont.py", line 238, in truetype
    return FreeTypeFont(font, size, index, encoding)
  File "C:\Users\Sagar\AppData\Local\Programs\Python\Python36-32\lib\site-packages\PIL\ImageFont.py", line 127, in __init__
    self.font = core.getfont(font, size, index, encoding)
OSError: cannot open resource

Although I have got a solution for the Arial Bold font above, I was asking this question, because there are several fonts within windows, which if I ever wanted to use in the future, I can never, because I keep getting this error. I am specifying the exact directory path to the font.tff Windows file such as in my second example above which gave me the error.
Currently I feel that I face these errors because the names of this font files have spaces, but I am not 100% sure about that. If anyone can explain or show me why I cant get any Windows font.tff file to work, I would greatly appreciate it.
Basically within the windows font directory path (C:\Windows\Fonts) I have noticed, that some fonts can be further opened to view additional fonts, like I show on my 2nd example above which does not work:
Please note: My overall code for using the PIL Library works and outputs the fonts to images just as I like, I just mainly want support with finding out how I can make the PIL library work with any font.tff file I want.

A: I had this same issue and just found out how to fix it since it was bothering me.
I used to be able to just install a font and use this path in Python:
"C:/Windows/Fonts/ARCHRISTY.ttf"
But i guess Windows doesn't actually install the ttf there anymore. I went into the "C:/Windows/Fonts/" folder and right clicked the "AR CHRISTY Medium" font and checked its properties.
Its real location is now at:
".../AppData/Local/Microsoft/Windows/Fonts/ARCHRISTY.ttf"
In Python you can do this to create the path:
os.path.expandvars("%LocalAppData%/Microsoft/Windows/Fonts/ARCHRISTY.ttf")


text:
Q: Render a vectorfield with Point Sprites in OpenGL I'd like to render a vectorfield visualization with OpenGL. Right now, I have a 3D cube filled with points which I need to replace with arrows. I've read a lot about Point Sprites in OpenGL and they seem to fit my needs pretty good.
I haven't really worked with textures yet, so there are some questions regarding the use of them together with Point Sprites:
First of all, is it possible to easily replace my points with arrows by just using a texture? If so, is it possible to rotate or scale those point sprites by an arbitrary degree using shaders?
If there are other possibilites than point sprites for achieving this, it would also be great to hear about them. I'm using OpenGL 4.2.

A: Point sprites are always screen-aligned squares. And they have an implementation-dependent maximum size.
If you need to do something like this, you should use a Geometry Shader that takes points as inputs, and outputs a quad (as 4 vertices of a triangle strip). Then you can do whatever you want.
Note that you should try to pass as little information as you can get away with out of the GS. Ideally, for maximum performance, you should only output to gl_Position and to a vec2 indicating where in the quad a particular location is.

A:
is it possible to ... scale those point sprites by an arbitrary degree using shaders?

No, point sprites have an implementation-defined upper limit on size.


text:
Q: friendly_id override SecureRandom uuid / appending sequence of numbers on slug urls Rails I'm trying to bypass the default friendly_id method which validates uniq value on a particular slug.  In short, I would like to bypass friendly_id checking for slugs with same value and for it to not append the --1 , --2, etc.  I need the ability to create records with friendly_id which can all have the same slug text.
        class Product < ActiveRecord::Base
         extend FriendlyId
         friendly_id :title, use: :slugged # use the title column to create slug column

A: I think the only way to do that would be to use scopes to allow each duplicate friendly_id to exist in its own "scope space".
https://github.com/norman/friendly_id/blob/master/lib/friendly_id/scoped.rb#L7
I'm guessing something like this (assuming that the duplicate friendly_ids belong to different userss):
class Product < ActiveRecord::Base
  extend FriendlyId
  friendly_id :tite, :use => [:scoped,:slugged], :scope => :user
end

A: Thanks for the great answer, the scope solution is definitely the correct path.  Although, just to help others, it really wasn't needed to do a full scope on the user object.   I simply just did this:
     friendly_id :title, :use => :scoped, :scope => :id

and put the scope on the id in the table for the record.  Since each id is unique, the slug will be the same and not append the --1, etc.


text:
Q: How to declare external typescript types in kotlin I need to access a Typescript library (react-admin) from kotlin-js
In particular this types definitions
https://github.com/marmelab/react-admin/blob/master/packages/ra-core/src/types.ts
How do I declare in kotlinjs for example the following types ?
export type AuthProvider = {
    login: (params: any) => Promise<any>;
    logout: (params: any) => Promise<void | false | string>;
    checkAuth: (params: any) => Promise<void>;
    checkError: (error: any) => Promise<void>;
    getIdentity?: () => Promise<UserIdentity>;
    getPermissions: (params: any) => Promise<any>;
    [key: string]: any;
};

export type DataProvider<ResourceType extends string = string> = {
    getList: <RecordType extends RaRecord = any>(
        resource: ResourceType,
        params: GetListParams
    ) => Promise<GetListResult<RecordType>>;

    getOne: <RecordType extends RaRecord = any>(
        resource: ResourceType,
        params: GetOneParams
    ) => Promise<GetOneResult<RecordType>>;

// etc etc ...

}

thanks


text:
Q: How to Delete Newline at End of GtkTextBuffer So I am working on making a more or less fixed size GtkTextBuffer (and if there is a better way to do this please let me know) and I am using marks to divide the buffer into "entries". Then using those marks I delete a section of the buffer from the start iter to the iter at the appropriate mark.
The issue with all of this is that it leaves a newline at the end of the buffer which I am unable to figure out how to delete. Anybody have experience with this or have any ideas on how to delete the newline?
Here is my current code:
// markName is a c string and textBuffEntries is an int
// keeping track of how many entries there are in the buffer
snprintf(markName, 9, "%d", textBuffEntries);
if(allMarksPopulated) {
   neo_debug(func_mask, "Deleting: %s", markName);
   gtk_text_buffer_get_start_iter(buffer, &startIter);
  gtk_text_buffer_get_iter_at_mark(buffer, &markIter,
        gtk_text_buffer_get_mark(buffer, markName));
  gtk_text_buffer_delete(buffer, &startIter, &markIter);
  gtk_text_buffer_get_iter_at_line(buffer, &markIter, 1);
  gtk_text_buffer_get_start_iter(buffer, &startIter);
  gtk_text_buffer_delete(buffer, &startIter, &markIter);
}
neo_debug(func_mask, "textBuffEntries: %d", textBuffEntries);

// Now write the data to the buffer
gtk_text_buffer_get_end_iter(buffer, &endIter);
gtk_text_buffer_insert (buffer, &endIter,
      msg_str.c_str(),
      msg_str.length());

snprintf(markName, 9, "%d", textBuffEntries);
gtk_text_buffer_get_end_iter(buffer, &endIter),
gtk_text_buffer_create_mark(buffer, markName,
             &endIter,
             true);
msg_str = "\n";
gtk_text_buffer_get_end_iter(buffer, &endIter);
gtk_text_buffer_insert (buffer, &endIter,
      msg_str.c_str(),
      msg_str.length());

if(!allMarksPopulated && MAX_LINES == textBuffEntries)
{
   allMarksPopulated = true;
}

if(MAX_LINES == textBuffEntries)
{
   textBuffEntries = 0;
} else {
   textBuffEntries++;
}

A: As noted in the comment above:
I fixed it, I was being dumb about where the newline was getting inserted so I changed it to prepend the insertion string instead of appending it. So that when each "bookmark" section is deleted there is a clean line ending.


text:
Q: dynamically assign text to  from
* Using jquery 1.8.3
I am creating a function which creates an "li" element and sets some properties, including establishing an event listener.
$(this).closest('a').text(text); //$(this) is the li tag, and it does show that in the browser if you step through

The dom structure looks like this:

...

If you follow it in the debugger, both the .text() method and "text" variable are being populated with the correct info. There is something going on with the assignment part that I can't track. I am sure it is something stupid and obvious I am missing, but I could use some help getting over this hump.
If you need more info, please let me know.

A: The anchor tag is not the ancestor of the li .. Rather it is a sibling of the div in which it is encased..
You are looking for this I belive
$(this).closest('div').prev('a').text(text);

A: You have to use html() function from jQuery:
$(document).ready(function(){

$("#element li ").click(function(){
  $("#linki").html($(this).html());

  });
});

Hello

live example http://jsbin.com/opoqid/46/edit


text:
Q: Searching with xslt relations and distances

        <memberuser  name="John">

            <connection>Tim</connection>

            <connection>Mary</connection>
            <connection>Alen</connection>

        </memberuser>

        <memberuser  name="Alen">

            <connection>Jill</connection>

            <connection>Elen</connection>
            <connection>John</connection>

        </memberuser>

Suppose i have an xml like the one above. how can i compute and associate by using the xslt the connection of my connection. So for the member user John for ex. Jill which is a connection for Alen is a connection of a connection for John. I want to compute and to show  for every user it connections of connections. i want to compute something like this:

<connection>Tim</connection>

<connection>Mary</connection>

<connection>Alen</connection>

<connectionofconnection>
    <from>Allen</from>
    <name>Jill</name>
</connectionofconnection>

A: If you want to limit the number of generations to two (child and grandchild), you could do it this way:
XSLT 1.0
Edited to eliminate self and direct connections from the list of second-generation connections.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:key name="member" match="memberuser" use="@name" />

<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="connection">
    <xsl:copy-of select="."/>
    <xsl:apply-templates select="key('member', .)/connection[not(.=current()/../@name or .=current()/../connection)]" mode="gen2"/>
</xsl:template>

<xsl:template match="connection" mode="gen2">
    <connection thru="{../@name}">
        <xsl:value-of select="." />
    </connection>
</xsl:template>

</xsl:stylesheet>

Applied to the following test input:
<root>
    <memberuser name="Adam">
        <connection>Betty</connection>
        <connection>Cecil</connection>
        <connection>David</connection>
    </memberuser>
    <memberuser name="Betty">
        <connection>Adam</connection>
        <connection>Cecil</connection>
        <connection>Eve</connection>
    </memberuser>
</root>

you will receive the following output:
<?xml version="1.0" encoding="UTF-8"?>
<root>
   <memberuser name="Adam">
      <connection>Betty</connection>
      <connection thru="Betty">Eve</connection>
      <connection>Cecil</connection>
      <connection>David</connection>
   </memberuser>
   <memberuser name="Betty">
      <connection>Adam</connection>
      <connection thru="Adam">David</connection>
      <connection>Cecil</connection>
      <connection>Eve</connection>
   </memberuser>
</root>


text:
Q: Pointers in structure I'm trying to use a file pointer that I have declared in a structure of linked list, but I keep getting it as a NULL value.
I have the following structure:
struct _hash_table
{
    char found;
    struct _hash_chain *hash_chain;
}

struct _hash_chain
{
    uint64_t value;
    FILE *fout;
    struct _hash_chain *next;
}

and
struct _hash_table hash_table[TABLE_SIZE];

I keep getting hash_table[i]->hash_chain->fout = NULL and it's pointer address is nil.
Do I need to dynamically allocate memory for the pointer?

A: struct _hash_table hash_table[TABLE_SIZE]; - This will not allocate memory for struct _hash_chain because hash_chain is pointer variable in _hash_table.
...
struct _hash_table hash_table[TABLE_SIZE];
for (i = 0; i < TABLE_SIZE; i++);
{
    hash_table[i].hash_chain = (struct _hash_chain *)malloc(sizeof(struct _hash_chain));
    memset(hash_table[i].hash_chain, 0, sizeof(struct _hash_chain));
}

//Then do file open for TABLE_SIZE times
//hash_table[0].hash_chain->fout = fopen("file.txt", "w");
...

Accssing h_table[i].hash_chain without dynamic memory allocation will leads to crash(an undefined behaviour). I hope you will take care of next pointer.


text:
Q: Parsing to create a date field in Tableau returning NULL for September dates I was able to successfully parse some text into a date but then found that all of the Sept dates were returning NULL. Here is an example of the string I started with:
Apr 02, 2011 at 8:15 am
I used the following to create a date from it.
date(str([Date])) and the Sept dates return NULL
When I remove the str() the Sept dates return #Error
Any ideas on how to get the September dates to return properly? Here is an example of the exact record for one. Sept 03, 2010 at 6:27 am The only difference that I see is that September records use a four letter month abbreviation.

A: In an ideal world your ETL process cleans data.
But, if your Tableau source data is not enough cleaned, you can massage it with some Tableau functions. For your issue:

REPLACE(string, substring, replacement)
Searches string for substring and replaces it with replacement. If substring is not found, the string is not changed.

Some ideas:
date(replace(str([Date])), "Sept", "Sep" )


text:
Q: Flutter integration for Google Assistant & Siri - voice interactions I want to build an app with Google Assistant & Siri support.
How would one go about implementing this in Flutter?
I'm aware of existing voice support,
but there's no support for back-and-forth voice actions...
Thanks!


text:
Q: What is the difference between CSS margin and outline? Both margins and outline are used to add space around the border.

A: outline is just drawing an line around the border, without actually claiming space.
Here is a JSFiddle demonstrating both: http://jsfiddle.net/g8FXT/

A: outline only makes a line around any element to make it look different from the other elements.it will not give any space.whereas margin will give space around any element.

as in the above example u can see how left margin works.

A: outline is purely decorative, it doesn't add any space around anything.

A: If you give margin, it will give a space in the direction provided outside the container. Padding provides space inside the container. Outline is purely decorative.

A: Mmm... I think margin and outline properties are pretty close. You can set the space around the element with both. There is a property, outline offset, within witch you can set the size (thickness) of outline property by units, same as margin. In my opinion, the difference between choosing one of them would be in the necessity of using an outline border or not. If you don't need it, it's ok to use margin to set the space around the element. If you need to set an outline border around the margin, it would be more logical to use outline property straightly, instead of setting the current element inside another father element with a set border already.


text:
Q: Recibir respuesta XML usando CURL Tengo un código que retorna una respuesta de Amazon MarketPlace, es por get y obtengo las respuesta mediante cURL, si coloco la URL en el navegador me trae el xml, sin embargo si lo hago por php me trae el texto plano, aun no se mucho sobre cURL y quisiera ya sea traer el xml con las etiquetas o traer los datos más ordenados, (actualmente me trae todos los campos seguidos - inentendible) .
Así tengo mi código:
  $ch = curl_init($link);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"))
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    $response = curl_exec($ch);
    $info = curl_getinfo($ch);
    curl_close($ch);

   $info = curl_getinfo($ch);
   curl_close($ch);

   echo('<p>' . $response. '</p>');
   print_r($info);
    ?>

A: Tienes dos errores
1.Debes Enviar en el header el content-type:
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml")

2. Debes habilitar la transferencia de la respuesta:
curl_setopt($ch , CURLOPT_RETURNTRANSFER , true);

Esta libreria es muy usada puedes tener la documentacion en el manual de PHP
tambien te invito a leer mas acerca de la libreria cURL este sitio esta en ingles pero a final de cuenta todos los lenguajes de programacion ejecutan esta instruccion por debajo


text:
Q: Extracting a large number of fields for each document in a MongoDB aggregation query I have a MongoDB collection. In it, each document has an item ID, a time field, and a large number of other fields. The item IDs are repeated. I want to extract all the data from the last document in this collection for each distinct item ID. One approach that works is the following:
db.items.aggregate({
    $sort: {time: -1}}, {
    $group: {
        _id: {item: '$item.id'},
        time: {$first: '$time'},
        anotherField: {$first: '$anotherField'},
        yetAnotherField: {$first: '$yetAnotherField'},
        ...
    }
})

...however, I would need to add an expression for each field in the document that I want to pull, which is quite clunky. Is there a query that accomplishes this as computationally efficiently (or better) as the above but more gracefully?

A: You can use $$ROOT to reference the entire doc in your $group.
So to get the most recent (i.e. last) doc for each group you can do:
db.items.aggregate({
    $sort: {time: -1}}, {
    $group: {
        _id: {item: '$item.id'},
        lastDoc: {$first: '$$ROOT'}
    }
})


text:
Q: How to write json in neovim lua? I'm trying to write a json file as part of a neovim plugin I'm working on. I started with the code below.
Code:
    write = function()
        local json = vim.fn.json_encode("{\"test\": \"thing\"}")
        print(json)
        local ok, result = pcall(vim.fn.writefile, {json}, "./test.json")

        if ok then
            print("Okay")
        else
            print(result)
        end
    end

Output inside test.json:
"{\"test\": \"thing\"}"
This almost works, but as you can see it outputs a string. How can I properly get it to write as a JSON object?

A: A JSON Object is a string.
https://www.w3schools.com/Js/js_json_objects.asp
The vim.fn.json_encode() is more meant to do things like this...
lua_table = {one = 1, two = 2, three = 3}
json_object = vim.fn.json_encode(lua_table)
-- ^-> '{"one": 1, "two": 2, "three": 3}'

Reference: :help json_encode (nvim command mode)
json_encode({expr})                                     json_encode()
                Convert {expr} into a JSON string.  Accepts
                msgpack-special-dict as the input.  Will not convert
                Funcrefs, mappings with non-string keys (can be created as
                msgpack-special-dict), values with self-referencing
                containers, strings which contain non-UTF-8 characters,
                pseudo-UTF-8 strings which contain codepoints reserved for
                surrogate pairs (such strings are not valid UTF-8 strings).
                Non-printable characters are converted into "\u1234" escapes
                or special escapes like "\t", other are dumped as-is.
                Blobs are converted to arrays of the individual bytes.

                Can also be used as a method:
                        GetObject()->json_encode()


text:
Q: 101 town problem with connected road
There are $101$ towns
  There are $50$ roads entering each town and $50$ roads leaving each town. Each town is connected with every other town by a one way road. Prove that you can reach one from other by driving along at most two roads.

Please help without graph theoretic solution. I am thinking of applying contradiction. I am not being able to think of a solution.

A: Suppose we want to go from $A$ to $B$. If there's a road connected $A$ to $B$ directly, we are done.
Suppose not. Then, there must exist a road from $B$ to $A$.
Now, let $C_1,C_2,...,C_{50}$ be $50$ cities such that there's a road from $A$ to $C_i$.
If there exists $i\in \{ 1,2,...,50\}$ such that there's a road from $C_i$ to $B$, we are done.
Suppose for a contradiction there isn't such road. Then for all $1 \le i \le 50$, each road is from $B$ to $C_i$. But there is also a road from $B$ to $A$ so there are $51$ roads out of $B$, which is a contradiction as required.


text:
Q: ASK, Istio on gke error installation, galley + pilot run but getting error on logs I got some problem when trying istio installation through GKE istio. I had installed istio, and got some problems: on pods galley + pilot seems to run, but when checking on logs I got some error and not enable to proper function on istio-proxy. gke version istio was:
image: gke.gcr.io/istio/pilot:1.1.16-gke.0
image: gke.gcr.io/istio/pilot:1.1.16-gke.0

and this my error from galley:
error on galley-istio
and this from pilot:
error on pilot-istio

A: For the first error:
Galley:
Error reading mesh config as json. unknow field"sidecarToTelemtrySessionAffinity" in
It seems you need to check this:
Stackdriver server expects a time series only comes from one source, which means session affinity needs to be enabled between sidecar and telemetry server.
To achieve that, you need to set "sidecarToTelemetrySessionAffinity: true" in mesh config and add "sessionAffinity: ClientIP" to istio-telemetry service (Istio from x.x.x.x).
For the second error:
Failed to create a new MCP sink stream: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp:i/o timeout"
I am looking for this error in some documents that I have. I hope found it soon.
My 2cents.
Also, you always have more details.
Policies and Telemetry


text:
Q: How to stop delay showing Interstitial ads in Tabs? I created an android app with 3 tabs(Fragments).

I added Interstitial ads in Search Tab. It means when I click Search tab Interstitial ad will pop up. But the problem is Interstitial ad load after 3 sec. It's wrong with AdMob policy. How to correct it? I want to load ad without delay when clicking the Search tab.
Here is my code:
MainActivity.java
public class MainActivity extends AppCompatActivity {

    public InterstitialAd mInterstitialAd;

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

                                                                                BottomNavigationView bottomNav = findViewById(R.id.bottom_navigation);
        getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
                new HomeFragment()).commit();
        bottomNav.setOnNavigationItemSelectedListener(navListener);
    }

            private BottomNavigationView.OnNavigationItemSelectedListener navListener =
            new BottomNavigationView.OnNavigationItemSelectedListener() {
                @Override
                public boolean onNavigationItemSelected(@NonNull MenuItem item) {
                    Fragment selectedFragment = null;

                    switch (item.getItemId()) {
                        case R.id.nav_home:
                            selectedFragment = new HomeFragment();
                            break;
                        case R.id.nav_favorites:
                            selectedFragment = new FavoritesFragment();
                            break;
                        case R.id.nav_search:
                            selectedFragment = new SearchFragment();
                            break;
                    }                                                                                getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
                            selectedFragment).commit();
                    return true;
                }
            };

//display code
private void displayInterstitial() {

    mInterstitialAd.setAdListener(new AdListener() {
        public void onAdLoaded() {
            if (mInterstitialAd.isLoaded()) {
                mInterstitialAd.show();
            }
        }
    });
}
// display code end

}

SearchFragment.java
public class SearchFragment extends Fragment {
    public InterstitialAd mInterstitialAd;
    public static ViewPager viewPager;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        View v = inflater.inflate(R.layout.fragment_search, container, false);

      //fragment Interstitial ad code start
        final AdRequest adRequest = new AdRequest.Builder().build();
        mInterstitialAd = new InterstitialAd(getActivity());
        mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
        mInterstitialAd.loadAd(adRequest);
        mInterstitialAd.setAdListener(new AdListener() {
            @Override
            public void onAdLoaded() {
                super.onAdLoaded();
                if(mInterstitialAd.isLoaded()){
                    mInterstitialAd.show();
                }
            }
            @Override
            public void onAdClosed() {
            }
        });
        //fragment Interstitial ad code end

        return v;
    }
}

A: It's nearly impossible for an InterstitialAd to be loaded without any delay, due to reasons such as network speed, network connectivity, Admob's servers, and etc.
That's why, InterstitialAds are meant to be loaded first, then shown when you want it to be shown.
Currently, you're loading an InterstitialAd in the onCreateView() method of your SearchFragment, then showing it immediately once it's loaded. This is actually the wrong approach.
Instead, you should load the ad much earlier, such as in the onCreate() method of your MainActivity. Then, in the switch case for SearchFragment check if the InterstitialAd is loaded. If it is, show it.
Here's what I mean:
public class MainActivity extends AppCompatActivity {

public InterstitialAd mInterstitialAd;

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

    loadInterstitial();

    BottomNavigationView bottomNav = findViewById(R.id.bottom_navigation);
    getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
            new HomeFragment()).commit();
    bottomNav.setOnNavigationItemSelectedListener(navListener);
}

private BottomNavigationView.OnNavigationItemSelectedListener navListener = new BottomNavigationView.OnNavigationItemSelectedListener() {
    @Override
    public boolean onNavigationItemSelected(@NonNull MenuItem item) {
        Fragment selectedFragment = null;
        switch (item.getItemId()) {
            case R.id.nav_home:
                selectedFragment = new HomeFragment();
                break;
            case R.id.nav_favorites:
                selectedFragment = new FavoritesFragment();
                break;
            case R.id.nav_search:
                selectedFragment = new SearchFragment();
                displayInterstitial();
                break;
        }
        getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
                        selectedFragment).commit();
        return true;
    }
};

private void loadInterstitial(){
    mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId("ADMOB_INTERSTITIAL_ID");
    mInterstitialAd.loadAd(new AdRequest.Builder().build());
    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            mInterstitialAd.loadAd(new AdRequest.Builder().build());
        }
    });
}

private void displayInterstitial() {
    if (mInterstitialAd.isLoaded()) {
        mInterstitialAd.show();
    }
}

You should also load the next InterstitialAd when the Ad is closed, so it'll be ready for the next time SearchFragment is pressed.
Also, don't paste your Admob Unit ID in the code you show here. That's not info you should share.


text:
Q: Why does the text move when click in mat-tab-group Please look at my situation.
enter image description here
Here is my html
<mat-tab-group>
<mat-tab label="mat-tab-label">
  contents
</mat-tab>
<mat-tab label="mat-tab-label_0">
  contents
</mat-tab>

my scss
.mat-tab-label{
    display: block;
    background-color: #fff;
    display: flex;
    position: relative;
    width: 413px;
    height: 55px;}
.mat-tab-label:first-child{
    background-image: url(./img/icon01.svg);
    background-repeat: no-repeat;
    background-position: 30% 50%;
}
.mat-tab-label:last-child{
    background-image: url(./img/icon02.svg);
    background-repeat: no-repeat;
    background-position: 27% 50%;
}

The label moves every time you click.
I want to fix this.

A: This is managed by the pre-built themes css under .mat-ripple-element.  In the case of not utilizing one of those themes, the following rule is required in the css/scss:
:host ::ng-deep .mat-ripple-element {
  position: absolute;
}

Note that the use of :host ::ng-deep as a means of styling elements in the shadow DOM is deprecated.  To date, I'm not aware of an alternative and it seems there remains reluctant acceptance of its use at the time of writing this.


text:
Q: scala splitting json into multipe objects if array valued filed is found I need to split a json object in scala into multiple objects if an array valued fields is found.
input JSON
{
  "name" : "test"
  "age"  : 22,
  "courses" : [math, english]
}
should be split into
[{
  "name" : "test"
  "age"  : 22,
  "courses" : "math"
},
{
  "name" : "test"
  "age"  : 22,
  "courses" : "english"
}]
Are there any frameworks that support this kind of splitting. Thanks!

A: Its best if you model your json to a scala object and then work with it. In this example I am using jackson library and its addon module for scala. You could use any appropriate json library. Here I am modelling your json to a case class using the convenient json to case class deserialization ability provided by the Jackson Scala Module
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper

val mapper = new ObjectMapper() with ScalaObjectMapper
mapper.registerModule(DefaultScalaModule)

case class A(name: String, age: Int, courses: Array[String]){def toJson = mapper.writeValueAsString(courses.map(e => A(name,age,Array(e))))}

val json = """{ "name" : "test", "age" : 22, "courses" : ["math", "english"] }"""

val anA = mapper.readValue(json, classOf[A])

anA.toJson