text:
Q: Tooltip Not Working On TextBox At A Time Of Enabled="false" TextBox is Enabled="false", which is why the tooltip is not showing on TextBox.
What should I do to show the ToolTip without changing state of TextBox?
<asp:TextBox ID="txtDescription" data-original-title="Description" Enabled="false"  runat="server" Class="txtDescription form-control tooltips"></asp:TextBox>

A: I use ReadOnly="true" and it's work.
<asp:TextBox ID="txtDescription" data-original-title="Description" ReadOnly="true" runat="server" Class="txtDescription form-control tooltips"></asp:TextBox>


text:
Q: Root view disappearing I have the below code to test some modal presentation. I'm attempting to present a UBSLoginViewController via a UINavigationController, then modally present a UBSLoadingViewController with transparent background over the UBSLoginViewController, wait some time, then dismiss it.
What happens:

*

*Login view displays,

*Loading view displays transparent over login view,

*Login view disappears or transparency disappears on loading view. Either way, login view is no longer visible behind loading view.

*No dismissal of loading view.
I do get two warnings below. One comes at the first presentation of the login view, the second on attempt to dismiss (warning 1 on bottom):
2014-08-22 11:37:52.525 Uberscore[72349:60b] Warning: Attempt to dismiss from view controller <UINavigationController: 0x8c4cfc0> while a presentation or dismiss is in progress!
2014-08-22 11:37:53.088 Uberscore[72349:60b] Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0x8c4cfc0>.

Code below:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //Prep window
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    //Set up and display login controller
    UBSLoginViewController* loginView = [[UBSLoginViewController alloc] initWithNibName:LOGINVIEW bundle:nil];
    UINavigationController* navigation = [[UINavigationController alloc] initWithRootViewController:loginView];
    navigation.navigationBarHidden = YES;
    self.window.rootViewController = navigation;
    [self.window makeKeyAndVisible];
    [loginView presentViewController:[[UBSLoadingViewController alloc] initWithNibName:LOADINGVIEW bundle:nil] animated:YES completion:nil];
    int timeout = 3000;
    wait(&timeout);
    [loginView dismissViewControllerAnimated:YES completion:nil];
    return YES;
}

A: You're dismissing the loginView with this line:
[loginView dismissViewControllerAnimated:YES completion:nil];

You want to call dismissViewControllerAnimated:completion: on the loading view instead.
UBSLoadingViewController *loadingView = [[UBSLoadingViewController alloc] initWithNibName:LOADINGVIEW bundle:nil];
[loginView presentViewController:loadingView animated:YES completion:nil];
...
// Later on to dismiss the loading view
[loadingView dismissViewControllerAnimated:YES completion:nil];

redpajama_set_name: RedPajamaStackExchange


text:
Q: What are the best practices for using cronjob along with docker and laravel? I ran into a problem that I have to manually write a cronjob in a production environment inside Ubuntu, I would like to have a completely standalone docker project. There is a solution with creating an ubuntu container, but it looks weird, ubuntu inside ubuntu. So far, I've had to set up a cronjob outside of a container on Ubuntu itself.
Dockerfile
FROM php:8.1-fpm

RUN apt-get update && apt-get install -y \
      apt-utils \
      libpq-dev \
      libpng-dev \
      libzip-dev \
      zip unzip \
      git && \
      docker-php-ext-install pdo_mysql && \
      docker-php-ext-install bcmath && \
      docker-php-ext-install gd && \
      docker-php-ext-install zip && \
      apt-get clean && \
      rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY ./_docker/app/php.ini /usr/local/etc/php/conf.d/php.ini

# Install composer
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN curl -sS https://getcomposer.org/installer | php -- \
    --filename=composer \
    --install-dir=/usr/local/bin

WORKDIR /var/www

docker-compose.yml
 version: '3'

services:
  nginx:
    image: nginx:latest
    volumes:
      - ./:/var/www/
      - ./_docker/nginx/conf.d/:/etc/nginx/conf.d/
    ports:
      - 8876:80
    container_name: flowers_nginx
    depends_on:
        -   flowers

  flowers:
    build:
        context: .
        dockerfile: _docker/app/Dockerfile
    volumes:
      - ./:/var/www/
    depends_on:
        -   database
    container_name: flowers_php

  database:
    image: mysql:8.0
    restart: always
    volumes:
      - ./temp/db:/var/lib/mysql
    environment:
        MYSQL_DATABASE: ****
        MYSQL_ROOT_PASSWORD: *****
        MYSQL_USER: ****
        MYSQL_PASSWORD: *****
    ports:
      - 8101:3306
    command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
    container_name: flowers_mysql

Due to lack of experience, I need a hint with the best solution, maybe use kubernetes-cronjob or redis, but I have not yet learned these technologies, I will be grateful if you help me choose the right solution and development path.
I tried to do the following inside Ubuntu itself which has docker installed and it works, but because of this I can't make a completely standalone docker project without connecting to the ubuntu job which has docker installed
crontab -e
* * * * * cd /var/www/public/flowers_shop && php artisan schedule:run >> /dev/null 2>&1


text:
Q: HoloLens 1 stopped connecting to PC over Wi-Fi I would really appreciate some help :)
Worked from home, connected normally for months.
Went back to work, same HoloLens, same laptop, different Wi-Fi.
Won't connect now - cannot access the device portal (https://192.168.1.110/).
Can normally acces over USB (http://127.0.0.1:10080/).
Tried:

*

*2 networks - office and tethering over mobile

*3 browsers

*reseting both the HL and the laptop multiple times

I'm using Windows 10.
Any ideas? Thanks :)

A: As discussed in the comments, the problem was that the IP address had changed: the IP address will be assigned by the network's DHCP server, and is generally persistent once assigned in helpful networks, but when you switch to a different network or different DHCP server the IP address is likely to change.
In home networks or small office networks the DHCP server is probably built into your router. It would be possible to set up an address reservation for the HoloLens in your router's configuration, if you wanted to preserve or change the address, provided both routers use the same IP address range for attached devices.


text:
Q: html2canvas generating everytime different results Following is the JS code to download the html as an image.
html2canvas(document.querySelector('#js-market-analysis'),{
     width: 600,
     height: 600,
     letterRendering: 1,
     allowTaint: true,
     useCORS: true,
 }).then(function(canvas) {
     saveAs(canvas.toDataURL('image/png'), 'Market Analysis.png');
 });

HTML code to be download as image.

                    TAM

                    SAM

                    SOM

I am facing an issue on every click the result is not consistent as per the desired output. Can anybody suggest what is wrong in the code.


text:
Q: Im having trouble with inserting dynamically created material input string to web page in angular Below is the code, where im generating a Textarea material input along with a value and inserting it into a div called child_2. the problem is its loading default HTML Textarea and also without value loaded inside it.
      const box = document.getElementById(cmt_id);

        const child_1 = box.children[0];
        const child_2 = box.children[1];
        let comment_text = child_1.innerHTML;

        let inputText = `
          <mat-form-field appearance="outline" class="w-100">
          <textarea
          matInput
          matTextareaAutosize
          [matAutosizeMinRows]="2"
          [matAutosizeMaxRows]="6"
          class="comment"
          (keyup.enter)="updateComment($event.target.value, ct.id)"
          [(value)]="${comment_text}"
          ></textarea>
          </mat-form-field>
          `;
          child_2.innerHTML = inputText;

this code works as in the picture.
generated Textarea input.
please help!

A: @ViewChildren("textField") textFields: QueryList;
try to understand this concept in angular...


text:
Q: Fantasy book series; Brother is jealous of sister's magical (sword) glove I read a series of books a few years ago but I never finished the series.
The main characters were a brother and sister. The brother was jealous of the sister having put on a glove that does not come off and that summons a sword. Over time the brother learns magic.
The setting is like the Dark Ages(?).
(edit) If anyone may have read the books, i remember the brother started using (fire?) magic in a mountain made of ice, and when the sister used the glove it would heat up, and would also burn if she tried to pull it off, and she though it was a curse. hopefully that helps.

A: The story is probably The Coming of Dragons by A.J. Lake(who is not me...).

Edmund, a king's son in disguise, and Elspeth, a sea captain's tomboy daughter, are the only two survivors of a terrible shipwreck. They just want to go home, but fate has other plans as they are drawn into the fight against an evil warlord terrorizing their homeland. Accompanied by a mysterious minstrel and haunted by magical powers they did not seek, Edmund and Elspeth journey across a savage land of wild boars, fierce rogue knights, and black magic. Fantasy fans will devour this dramatic tale of mystery, wonder, and the power of friendship.

The main characters were a brother and sister.

The two are not siblings but do become very close friends.

The brother was jealous of the sister having put on a glove that does not come off and that summons a sword. Over time the brother learns magic.

Edmund has abilities of the Ripente, and can see through other peoples' eyes.  Elspeth has a magical crystal sword that is worn all the time as a glove(and she cannot take it off).

The setting is like the Dark Ages

The series that the book is from is called The Darkest Age.


text:
Q: How to use Pandas group-by and sum this is my dataframe:
    RefactoringType      Detail
0   Move Method         com.onegravity.colorpicker.ColorPickerDialog
1   Move Source Folder  NaN
2   Move Attribute      com.onegravity.colorpicker.ColorPickerDialog
3   Move Attribute      com.onegravity.colorpicker.ColorPickerDialog
4   Move Attribute      com.onegravity.colorpicker.ColorPickerDialog
5   Move Attribute      com.onegravity.colorpicker.ColorPickerDialog
6   Move Attribute      com.onegravity.colorpicker.ColorPickerDialog
7   Move Attribute      com.onegravity.colorpicker.ColorPickerDialog
8   Move Attribute      com.onegravity.colorpicker.ColorPickerDialog
9   Rename Method       com.onegravity.colorpicker.ColorPickerDialog

the column Detail contain the name of classes.I need to calculate the number of RefactoringType in each class.
I tried this:
g1 = df1.groupby(["Detail", "RefactoringType"]).sum()

It return for me:
Detail                                         RefactoringType
com.onegravity.colorpicker.ColorPickerDialog    Move Attribute
                                                Move Method
                                                Rename Method

I need the result like this:
 Class                                       Move Method   Move Attribute Rename Method

com.onegravity.colorpicker.ColorPickerDialog  1             1                    1

PS: after I will define all the type of refactoring.
Thanks for help

A: Try:
df.groupby(['Detail', 'RefactoringType']).size()\
    .unstack().fillna(0, downcast='infer')

For the following test DataFrame:
df = pd.DataFrame(data=[
    [ 'Move Attribute', 'ColorPickerDialog' ],
    [ 'Move Method',    'ColorPickerDialog' ],
    [ 'Rename Method',  'ColorPickerDialog' ],
    [ 'Rename Method',  'ColorPickerDialog' ],
    [ 'Rename Method',  'XxxxxxxxxxxDialog' ],
    [ 'Rename Method',  'XxxxxxxxxxxDialog' ]],
    columns=['RefactoringType', 'Detail'])

I got:
RefactoringType    Move Attribute  Move Method  Rename Method
Detail
ColorPickerDialog               1            1              2
XxxxxxxxxxxDialog               0            0              2


text:
Q: Show that any pair of vectors jointly lies in the same number of subspaces Assume a finite field $F_q=GF(q)$ of order $q$. Let $V$ be the $(n+1)$-dimensional vector space over $F_q$. Let $P$ be the set of 1-dimensional subspaces of $V$ i.e. $P=V\setminus\{\mathbf{0}_{(n+1)\times1}\}$. Let $B$
 be the set of all $(i+1)$-dimensional subspaces of $V$ for some $i\in\{2,3,\dots,n-1\}$.
I want to show that any pair of vectors in $P$ jointly lies in the same number of elements of $B$. In other words, if we pick any two vectors $\{\mathbf{p}_1,\mathbf{p}_2\}\in P$ then the following quantity should be constant
$$|\{S\in B:\mathbf{p}_1\in S \text{ and } \mathbf{p}_2\in S\}|$$
I want to show this for all possible values of $i$.
Any ideas or a sketch of the proof?

A: Let $\mathbf{e_j},j=1,2,\ldots,n+1,$ be the vectors in the natural
basis. Pick arbitrary linearly independent vectors $\mathbf{p_1}$ and $\mathbf{p_2}$, and show that
$$|\{S\in B:\mathbf{p}_1\in S \text{ and } \mathbf{p}_2\in S\}|=
|\{S\in B:\mathbf{e}_1\in S \text{ and } \mathbf{e}_2\in S\}|.$$
This can be done as follows:

*

*The group $GL_{n+1}(\Bbb{F}_q)$ acts doubly transitively on $P$. In
other words, given $\mathbf{p}_1$ and $\mathbf{p}_2$ there exists a
bijective linear transformation $T:V\to V$ such that
$T(\mathbf{e_1})=\mathbf{p}_1$ and $T(\mathbf{e_2})=\mathbf{p}_2$,
This is because we can extend $\mathbf{p_1},\mathbf{p_2}$ to a basis
$\mathbf{p_1},\mathbf{p_2},\ldots,\mathbf{p_{n+1}}$ of $V$, when the matrix with $\mathbf{p_j}, j=1,2,\ldots,n+1,$ as columns is invertible. Fix one such linear transformation $T$.

*$S$ contains $\mathbf{e_1},\mathbf{e_2}$ if and only if $T(S)$ contains $\mathbf{p_1},\mathbf{p_2}$.

*And because $T$ is bijective, $S$ contains $\mathbf{p_1},\mathbf{p_2}$ if and only if $T^{-1}(S)$ contains $\mathbf{e_1},\mathbf{e_2}$.

*Leaving it to you to produce a bijection between the prescribed two subsets of $B$.


text:
Q: vips thumbnail transparent issue for svg image I have one transparent SVG image, I am trying to generate the thumbnail of that image. It generates a thumbnail of the image properly, but it removes the transparency of the image and adds a black background to the image. I want to generate thumbnail without losing the transparency of the image.
Note - The same problem with jpg and jpeg images also, but I added white background to the image in svg case it's not make the transparent background
I am using PHP vips library.
Here is my code for that
$im = Vips\Image::thumbnail($filename, 180, ['height' => 225, 'size' => 'both']);
$alpha = $im->hasAlpha();
if($alpha) {
    $im = $im->flatten(['background' => [255, 255, 255]]);
}

A: Just write to a format that supports transparency, like PNG.
For example:
$im = Vips\Image::thumbnail("x.svg", 180, ['height' => 225, 'size' => 'both']);
$im->WriteToFile("x.png");

WEBP, GIF, HEIC, AVIF, TIFF etc. also support transparency. JPEG does not.


text:
Q: Flutter: `onPressed` acts on all `IconButton`s in a list view I want to change color of every icon after pressing. But all of icons in a ExpandableContainerchange after pressing one of them.
class _ExpandableListViewState extends State<ExpandableListView> {
  bool expandFlag = false;
  Color _iconColor = Colors.white;

  @override
  Widget build(BuildContext context) {
    return new Container(
      margin: new EdgeInsets.symmetric(vertical: 1.0),
      child: new Column(
        children: <Widget>[
          new Container(
               .
               .
               .
               ),
          new ExpandableContainer(
              expanded: expandFlag,
              expandedHeight: ...
              child: new ListView.builder(
                itemBuilder: (BuildContext context, int index) {
                  return new Container(
                    decoration:
                        new BoxDecoration(border: new Border.all(width: 1.0, color: Colors.grey), color: Colors.black),
                     child: new ListTile(
                       title: ...

                       leading: new IconButton(
                        icon: Icon(Icons.star, color: _iconColor),
                        onPressed: () {
                          setState(() {
                           _iconColor = _iconColor == Colors.white ? Colors.yellow : Colors.white;
                          });
                        },
                      ),
                      subtitle: ...
                  ),
                  );
                },
                itemCount: ...,
              ))
        ],
      ),
    );
  }
}

class ExpandableContainer extends StatelessWidget {
  final bool expanded;
  final double expandedHeight;
  final Widget child;

  ExpandableContainer({
    @required this.child,
    this.expandedHeight,
    this.expanded = true,
  });

  @override
  Widget build(BuildContext context) {
.
.
.
}

Whole code:
import 'package:flutter/material.dart';
import 'data.dart';

void main() {
  runApp(new MaterialApp(home: new Home()));
}

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      backgroundColor: Colors.grey,
      appBar: new AppBar(
        title: new Text("Expandable List", style: TextStyle(color: Colors.black)),
        backgroundColor: Colors.lightGreen,
      ),
      body: new ListView.builder(
        itemBuilder: (BuildContext context, int index) {
          return new ExpandableListView(title: broadcast[index].title, ind: index);
        },
        itemCount: broadcast.length,
      ),
    );
  }
}

class ExpandableListView extends StatefulWidget {
  final String title;
  final int ind;

  const ExpandableListView({this.title, this.ind});

  @override
  _ExpandableListViewState createState() => new _ExpandableListViewState();
}

class _ExpandableListViewState extends State<ExpandableListView> {
  bool expandFlag = false;
  Color _iconColor = Colors.white;

  @override
  Widget build(BuildContext context) {
    return new Container(
      margin: new EdgeInsets.symmetric(vertical: 1.0),
      child: new Column(
        children: <Widget>[
          new Container(
            color: Colors.blue[300],
            padding: new EdgeInsets.symmetric(horizontal: 5.0),
            child: new Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                new IconButton(
                    icon: new Container(
                      height: 50.0,
                      width: 50.0,
                      decoration: new BoxDecoration(
                        color: Colors.deepOrange,
                        shape: BoxShape.circle,
                      ),
                      child: new Center(
                        child: new Icon(
                          expandFlag ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
                          color: Colors.white,
                          size: 30.0,
                        ),
                      ),
                    ),
                    onPressed: () {
                      setState(() {
                        expandFlag = !expandFlag;
                      });
                    }),
                new Text(
                  widget.title,
                  style: new TextStyle(fontWeight: FontWeight.bold,fontSize: 20.0, color: Colors.black87),
                )
              ],
            ),
          ),
          new ExpandableContainer(
              expanded: expandFlag,
              expandedHeight: 90.0 * (broadcast[widget.ind].contents.length < 4 ? broadcast[widget.ind].contents.length : 4), // + (0.0 ?: 29.0),
              child: new ListView.builder(
                itemBuilder: (BuildContext context, int index) {
                  return new Container(
                    decoration:
                        new BoxDecoration(border: new Border.all(width: 1.0, color: Colors.grey), color: Colors.black),
                     child: new ListTile(
                      title: new Text(
                        broadcast[widget.ind].contents[index],
                        style: new TextStyle(fontWeight: FontWeight.bold, color: Colors.lightGreen),
                        textAlign: TextAlign.right,
                      ),
                       leading: new IconButton(
                        icon: Icon(Icons.star, color: _iconColor),
                        onPressed: () {
                          setState(() {
                           _iconColor = _iconColor == Colors.white ? Colors.yellow : Colors.white;
                          });
                        },
                      ),
                      subtitle: new Text ('${broadcast[widget.ind].team[index]}\n${broadcast[widget.ind].time[index]}          ${broadcast[widget.ind].channel[index]}',
                      textAlign: TextAlign.right, style:TextStyle(color: Colors.white)),
                      isThreeLine: true,
                  ),
                  );
                },
                itemCount: broadcast[widget.ind].contents.length,
              ))
        ],
      ),
    );
  }
}

class ExpandableContainer extends StatelessWidget {
  final bool expanded;
  final double expandedHeight;
  final Widget child;
  //final Color iconColor;

  ExpandableContainer({
    @required this.child,
    this.expandedHeight,
    this.expanded = true,
    //this.iconColor,
  });

  @override
  Widget build(BuildContext context) {
    double screenWidth = MediaQuery.of(context).size.width;
    return new AnimatedContainer(
      duration: new Duration(milliseconds: 100),
      curve: Curves.easeInOut,
      width: screenWidth,
      height: expanded ? expandedHeight : 0.0,
      child: new Container(
        child: child,
        decoration: new BoxDecoration(border: new Border.all(width: 1.0, color: Colors.blue)),
      ),
    );
  }
}

A: You need to make the list item a StatefulWidget in which you have the state _iconColor
Stateful List Tile
class StatefulListTile extends StatefulWidget {
  const StatefulListTile({this.subtitle, this.title});
  final String subtitle, title;
  @override
  _StatefulListTileState createState() => _StatefulListTileState();
}

class _StatefulListTileState extends State<StatefulListTile> {
  Color _iconColor = Colors.white;
  @override
  Widget build(BuildContext context) {
    return new Container(
      decoration: new BoxDecoration(
          border: new Border.all(width: 1.0, color: Colors.grey),
          color: Colors.black),
      child: new ListTile(
        title: new Text(
          widget?.title ?? "",
          style: new TextStyle(
              fontWeight: FontWeight.bold, color: Colors.lightGreen),
          textAlign: TextAlign.right,
        ),
        leading: new IconButton(
          icon: Icon(Icons.star, color: _iconColor),
          onPressed: () {
            setState(() {
              _iconColor =
                  _iconColor == Colors.white ? Colors.yellow : Colors.white;
            });
          },
        ),
        subtitle: new Text(widget?.subtitle ?? "",
            textAlign: TextAlign.right, style: TextStyle(color: Colors.white)),
        isThreeLine: true,
      ),
    );
  }
}

Usage

class ExpandableListView extends StatefulWidget {
  final String title;
  final int ind;

  const ExpandableListView({this.title, this.ind});

  @override
  _ExpandableListViewState createState() => new _ExpandableListViewState();
}

class _ExpandableListViewState extends State<ExpandableListView> {
  bool expandFlag = false;
  Color _iconColor = Colors.white;

  @override
  Widget build(BuildContext context) {
    return new Container(
      margin: new EdgeInsets.symmetric(vertical: 1.0),
      child: new Column(
        children: <Widget>[
          new Container(
            color: Colors.blue[300],
            padding: new EdgeInsets.symmetric(horizontal: 5.0),
            child: new Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                new IconButton(
                    icon: new Container(
                      height: 50.0,
                      width: 50.0,
                      decoration: new BoxDecoration(
                        color: Colors.deepOrange,
                        shape: BoxShape.circle,
                      ),
                      child: new Center(
                        child: new Icon(
                          expandFlag
                              ? Icons.keyboard_arrow_up
                              : Icons.keyboard_arrow_down,
                          color: Colors.white,
                          size: 30.0,
                        ),
                      ),
                    ),
                    onPressed: () {
                      setState(() {
                        expandFlag = !expandFlag;
                      });
                    }),
                new Text(
                  widget.title,
                  style: new TextStyle(
                      fontWeight: FontWeight.bold,
                      fontSize: 20.0,
                      color: Colors.black87),
                )
              ],
            ),
          ),
          new ExpandableContainer(
              expanded: expandFlag,
              expandedHeight: 90.0 *
                  (broadcast[widget.ind].contents.length < 4
                      ? broadcast[widget.ind].contents.length
                      : 4), // + (0.0 ?: 29.0),
              child: new ListView.builder(
                itemBuilder: (BuildContext context, int index) {
                  return StatefulListTile(
                    title: broadcast[widget.ind].contents[index],
                    subtitle:
                        '${broadcast[widget.ind].team[index]}\n${broadcast[widget.ind].time[index]}          ${broadcast[widget.ind].channel[index]}',
                  );
                },
                itemCount: broadcast[widget.ind].contents.length,
              ))
        ],
      ),
    );
  }
}

A: You should make the color property distinct for each element in the ListView, what you are doing is that the color is global and shared among all the icons in the ListView, for this reason all icons are changing their color when one icon is pressed.
class Broadcast {
  final String title;
  List<String> contents;
  List<String> team = [];
  List<String> time = [];
  List<String> channel = [];
  Color iconColor = Colors.white; //initialize at the beginning

  Broadcast(this.title, this.contents, this.team, this.time, this.channel); //, this.icon);
}

edit your ExpandableListView
class ExpandableListView extends StatefulWidget {

  final int ind;
  final Broadcast broadcast;

  const ExpandableListView({this.broadcast,this.ind});

  @override
  _ExpandableListViewState createState() => new _ExpandableListViewState();
}

edit your Home class
class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      backgroundColor: Colors.grey,
      appBar: new AppBar(
        title: new Text("Expandable List", style: TextStyle(color: Colors.black)),
        backgroundColor: Colors.lightGreen,
      ),
      body: new ListView.builder(
        itemBuilder: (BuildContext context, int index) {
          return new ExpandableListView(title: broadcast[index], ind: index);
        },
        itemCount: broadcast.length,
      ),
    );

  }
}

edit your _ExpandableListViewState
class _ExpandableListViewState extends State<ExpandableListView> {
  bool expandFlag = false;

  @override
  Widget build(BuildContext context) {
    return new Container(
      margin: new EdgeInsets.symmetric(vertical: 1.0),
      child: new Column(
        children: <Widget>[
          new Container(
            color: Colors.blue[300],
            padding: new EdgeInsets.symmetric(horizontal: 5.0),
            child: new Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                new IconButton(
                    icon: new Container(
                      height: 50.0,
                      width: 50.0,
                      decoration: new BoxDecoration(
                        color: Colors.deepOrange,
                        shape: BoxShape.circle,
                      ),
                      child: new Center(
                        child: new Icon(
                          expandFlag ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
                          color: Colors.white,
                          size: 30.0,
                        ),
                      ),
                    ),
                    onPressed: () {
                      setState(() {
                        expandFlag = !expandFlag;
                      });
                    }),
                new Text(
                  widget.broadcast.title,
                  style: new TextStyle(fontWeight: FontWeight.bold,fontSize: 20.0, color: Colors.black87),
                )
              ],
            ),
          ),
          new ExpandableContainer(
              expanded: expandFlag,
              expandedHeight: 90.0 * (broadcast[widget.ind].contents.length < 4 ? broadcast[widget.ind].contents.length : 4), // + (0.0 ?: 29.0),
              child: new ListView.builder(
                itemBuilder: (BuildContext context, int index) {
                  return new Container(
                    decoration:
                        new BoxDecoration(border: new Border.all(width: 1.0, color: Colors.grey), color: Colors.black),
                     child: new ListTile(
                      title: new Text(
                        broadcast[widget.ind].contents[index],
                        style: new TextStyle(fontWeight: FontWeight.bold, color: Colors.lightGreen),
                        textAlign: TextAlign.right,
                      ),
                       leading: new IconButton(
                        icon: Icon(Icons.star, color:  widget.broadcast.iconColor),
                        onPressed: () {
                          setState(() {
                           widget.broadcast.iconColor = widget.broadcast.iconColor == Colors.white ? Colors.yellow : Colors.white;

                          });
                        },
                      ),
                      subtitle: new Text ('${broadcast[widget.ind].team[index]}\n${broadcast[widget.ind].time[index]}          ${broadcast[widget.ind].channel[index]}',
                      textAlign: TextAlign.right, style:TextStyle(color: Colors.white)),
                      isThreeLine: true,
                  ),
                  );
                },
                itemCount: broadcast[widget.ind].contents.length,
              ))
        ],
      ),
    );
  }
}


text:
Q: Multiple parametric equations for planes and lines $\mathbb R^3$? I want to know if you can get different sets of parametric equations for a particular line or plane in $\mathbb R^3$? The reason being I know you can have multiple directional vectors or normal vectors which convey the direction, and these can be scaled, so by this, are there infinitely many possible parametric equations?

A: Parametric equations are never unique. Let's use curves in $\mathbb{R}^2$ as an illustration, for simplicity. Suppose you have parametric equations for some curve:
$$
x = x(t) \quad y = y(t)
$$
Let $f: \mathbb{R} \to \mathbb{R}$ be any bijective function. This just means that for each real number $z$, there is a one and only one number $w$ such that $f(w) = z$.
Then the curve
$$
x = x(f(t)) \quad y = y(f(t))
$$
is the same curve as the original. However, if you think of $t$ as time, the point $\big(x(t),y(t)\big)$ is now moving along the curve at a different speed.
Examples of interesting bijections are functions like $f(w) = 3w+7$ or $f(w) = \tanh(w)$.
So, for example, the curve
$$
(x,y) = \big(\tanh(t), 5\tanh(t)\big)
$$
is exactly the same curve as
$$
(x,y) = \big(t, 5t)
$$
They are both the line $y=5x$.


text:
Q: Can't ssh from external network My friend and I are trying to get ssh access on his server working from external networks. He is running Debian 7.1. He can access the server from the internal network but every time I try to access his server (of course from an external network), I get the following error.
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/MyUser/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/MyUser/.ssh/id_dsa
debug3: no such identity: /Users/MyUser/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
MyUser@HisServer.com's password:
debug3: packet_send2: adding 64 (len 56 padlen 8 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.

Permission of ~/.ssh/ is 700 and ~/.ssh/* is 600. He has
RSAAuthentication yes
PubkeyAuthentication yes
ChallengeResponseAuthentication yes
PasswordAuthentication no
UsePAM yes

included in his sshd_config.
Port checker says that Port 22/tcp is open. Strangest thing is that we can't find any history of access in the log. sudo grep ssh /var/log/* only shows his activity.
Thus, I suspect it's the router's config that's causing the problem, but shouldn't we be able to ssh if the port is open?

A: You need to configure your router or DSL modem to port forward port 22 to the IP address of your server on port 22.
A simple test to do to check if it is a connectivity issue is to telnet on port 22:
telnet xxx.xxx.xxx.xxx 22

where the x's represent the external IP address of your router.

A: Maybe this will help.
Try to use your external ip adres  find your ex.ip adress on http://www.whatismyip.com/.
I've sit for almost  4 weeks to find out not to use my 192.168.x.xxx adress
 but to use the external one 88.67.xx.xxx.
Excuse me for my television english.

A: The reason why we couldn't ssh from external networks was because my friend had a "nested LAN".
It turns out that his apartment had its own LAN, so even after he port-forwarded tcp/22 to his server's private IP address (within his home's LAN), external access got stuck at the apartment's LAN.
He could have paid around $30 per port to open ports with numbers larger than 1000, if I remember correctly, but he figured it wasn't worth it, so we basically gave up.

A: You can use Corkscrew to tunnel ssh traffic through HTTP. No need to pay that ridiculous $30.


text:
Q: Invoke one stored procedure from another stored procedure by passing array values in postgresql I'm unable to pass the array values as input to another stored procedure. However when I try to insert(table kvstore populated without issues) the array values, the table get loaded. Please advice me on how to pass array values dynamically from one stored procedure to another.
The raise notice prints values like below
NOTICE:  Value 1:
NOTICE:  Value 2:

CREATE OR REPLACE FUNCTION test_schema.test_insert_choice(
    p_member_crn  character varying,
    p_preferencearray text[][],
    p_created timestamp without time zone,
    p_modified timestamp without time zone,
    p_created_system smallint,
    p_created_by character varying,
    p_modified_by character varying,
    p_modified_system smallint
    )
  RETURNS text AS
$BODY$
DECLARE

    lv_n_rtn                INTEGER ;
    lv_t_err_msg            TEXT ;
    lv_t_err_dtl            TEXT ;

BEGIN

    /*FOR i IN 1 .. array_upper(p_preferencearray, 1) LOOP
        INSERT INTO lcdm_main.kvstore (key, value)
        VALUES (p_preferencearray[i][1], p_preferencearray[i][2]);
    END LOOP;*/

    FOR i IN 1 .. array_upper(p_preferencearray, 1) LOOP
    raise notice 'Value 1: %', p_preferencearray[i][1];
    raise notice 'Value 2: %', p_preferencearray[i][2];
        perform  test_schema.test_insert_master(p_member_crn,
                                                         p_preferencearray[i][1],
                                                         p_preferencearray[i][2],
                                                         p_created,
                                                         p_modified,
                                                         p_created_system,
                                                         p_created_by,
                                                         p_modified_by,
                                                         p_modified_system);
    END LOOP;

    RETURN 0;

END;

$BODY$
  LANGUAGE plpgsql VOLATILE SECURITY DEFINER
  COST 100;```

A: Found the solution and replacing FOR with FOREACH helped to resolve the issue
CREATE OR REPLACE FUNCTION test_schema.test_insert_choice(
    p_member_crn  character varying,
    p_preferencearray text[][],
    p_created timestamp without time zone,
    p_modified timestamp without time zone,
    p_created_system smallint,
    p_created_by character varying,
    p_modified_by character varying,
    p_modified_system smallint
    )
  RETURNS text AS
$BODY$
DECLARE

    lv_n_rtn                INTEGER ;
    lv_t_err_msg            TEXT ;
    lv_t_err_dtl            TEXT ;

       m   text[];
       arr text[] := p_preferencearray;

BEGIN

   FOREACH m SLICE 1 IN ARRAY arr
   LOOP
       perform  test_schema.test_insert_master(p_member_crn,
                                                         m[1],  --Preference Id
                                                         m[2],  --Preference Value
                                                         p_created,
                                                         p_modified,
                                                         p_created_system,
                                                         p_created_by,
                                                         p_modified_by,
                                                         p_modified_system);
   END LOOP;

    RETURN 0;

END;

$BODY$
  LANGUAGE plpgsql VOLATILE SECURITY DEFINER
  COST 100;

Thanks for everyone


text:
Q: Team member deleted "Release" configuration. How would I recreate it? I had a team member delete the release configuration from one of our projects. While I do have the removal in source control, there were many changes to the solution in the offending commit. I figured it would be easier to recreate the profile rather than reverting (as this was done months ago).
I recreated a profile called "Release" through the Configuration Manager. Upon building the solution however, I've discovered the project binaries are still in debug mode (using this tool).
At this point I have gone through the solution file in a text editor and tried to compare it to the last known working version. Here is the entry for my new release config:
{9191D2A0-00A9-4A1C-9EAC-8837577D473F}.Release|Any CPU.ActiveCfg = Release|Any CPU
   {9191D2A0-00A9-4A1C-9EAC-8837577D473F}.Release|Any CPU.Build.0 = Release|Any CPU
   {9191D2A0-00A9-4A1C-9EAC-8837577D473F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
  {9191D2A0-00A9-4A1C-9EAC-8837577D473F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
  {9191D2A0-00A9-4A1C-9EAC-8837577D473F}.Release|x86.ActiveCfg = Release|Any CPU
  {9191D2A0-00A9-4A1C-9EAC-8837577D473F}.Release|x86.Build.0 = Release|Any CPU
Does anyone know what settings I need to tweak to get this new build configuration to actually build in release mode, or I am stuck in merge hell trying to revert the commit?
EDIT:
Here is my configuration after I created a new release profile:

However after compiling with these settings, the dlls are debug.

A: You'll need to go through each project in the solution and individually check the build settings for that project.  You can do this by right-clicking the project in the solution explorer and selecting properties.  Navigate to the Build tab:

Verify that the correct configuration is selected from the combo boxes at the top and then check the appropriate boxes.

A: In Visual Studio go to top menu->Build->Configuration Manager
In there set the project configurations to release when you have the Active solution configuration set to release. Save the solution.
The solution configuration (in the sln file) is really just a name for a collection of flags for the solutions projects, the configurations defined in the configuration manager for the PROJECTS in reference to the named solution configuration are what msbuild is actually using during the build process.


text:
Q: What are C# chaining functional approach caveats? What to do with "ifs"? Recently I watched Pluralsight course "Functional programming in C#". And rewrote some methods in my hobby project. Now they look like this:
public override CommandLineResult GetResult()
{
    return Disposable.Using(new IndicatorRepository(), repo =>
    {
        return repo.AddOrUpdateIndicator(Indicator, Value, DateTimeExtensions.LocalNow().Date);
    })
    .Map((p) => new NumericIndicatorRecorderedModel()
    {
        Id = Guid.NewGuid().ToString(),
        DbActionPreformed = true,
        IsRewritten = Convert.ToBoolean(p),
        IndicatorName = Indicator,
        Value = Value,
        ValueDate = ValueDate
    })
    .Map((model) => new CommandLineResult()
    {
        ActionName = "~/Views/CommandLine/_clresult_NumericIndicatorRecorderedModel.cshtml",
        Model = model
    });
}

There's something pretty about this chaining approach (I removed Using with Disposable class, at every step I have expressions, not statements, etc.).
But the questions are:

*

*Does not this approach covers some dangers? and what are they? (isn't it more difficult to debug for example)

*What usually people do in terms of chaining approach, if it is required to branch the flow of code execution? Break chain with ifs somewhere? Write "map-if" functional extensions (would not that approach create spaghetti code?)?

UPDATE: more specific question regarding this issue
What approach to implement code branching is better - to break chaining like this:
        public string GetResult(bool param) {
        if (param) {
            return MyClass.DoOneWay(p =>...).AlsoDo(q =>...).ToString();
        }
        else
        {
            return MyClass.DoOtherWay(p =>...).AlsoDo(q =>...).ToString();
        }
    }

Or to implement functional if-helpers, like this:
        public string GetResult(bool param)
    {
        return MyClass.DoIf(param, p => ...., q => ....).AlsoDo(q =>...).ToString();
    }

And what to do, if there're much more options then just true/false?
How to "functionaly" implement "switch" branching?


text:
Q: How can i list all inbound rules for all VMs on my subscription with powershell? I want to list all the ports in inbound rules which are open for a VM using powershell.
I have found that Network Security groups are either attached to NIC or Vnets.
Can anyone share a script where i can see the inbound rules for a VM using powershell?

A: Try the command as below, the $rule is what you want, you could check by $rule.Name.
$rgs = (Get-AzResourceGroup).ResourceGroupName
foreach($rg in $rgs){

  $vms = (Get-AzVM -ResourceGroupName $rg).Name

  foreach($vm in $vms){

    $nicname = ((Get-AzVM -ResourceGroupName $rg -Name $vm).NetworkProfile.NetworkInterfaces.Id -split"/")[8]

    $nic = Get-AzResource -ResourceGroupName $rg -ResourceType Microsoft.Network/networkInterfaces -ResourceName "$nicname" -ApiVersion 2018-07-01
    $nsgnic = ($nic.properties.networkSecurityGroup.id -split"/")[8]

    $rulenic = (Get-AzNetworkSecurityGroup -ResourceGroupName $rg -Name $nsgnic).SecurityRules
    $ruledefault = (Get-AzNetworkSecurityGroup -ResourceGroupName $rg -Name $nsgnic).DefaultSecurityRules | Where-Object {$_.Direction -eq 'Inbound'}
    $rulenic1 = $rulenic + $ruledefault

    $vnetname = (Get-AzNetworkInterface -ResourceGroupName $rg -Name $nicname).IpConfigurations.Subnet.Id.Split("/")[8]
    $subname = (Get-AzNetworkInterface -ResourceGroupName $rg -Name $nicname).IpConfigurations.Subnet.Id.Split("/")[10]

    $subnet = Get-AzResource -ResourceGroupName $rg -ResourceType Microsoft.Network/virtualNetworks/subnets -ResourceName "$vnetname/$subname" -ApiVersion 2018-07-01
    $nsgsub = ($subnet.properties.networkSecurityGroup.id -split"/")[8]
    $rulesub = (Get-AzNetworkSecurityGroup -ResourceGroupName $rg -Name $nsgsub).SecurityRules
    $ruledefault1 = (Get-AzNetworkSecurityGroup -ResourceGroupName $rg -Name $nsgsub).DefaultSecurityRules | Where-Object {$_.Direction -eq 'Inbound'}
    $rulsub1 = $rulesub + $ruledefault1

    $rule = $rulenic1 + $rulsub1
    Write-Output $rule.Name

  }

}

I test it in one resource group, for the whole subscription, just add a loop like above.


text:
Q: Background image won't display in header? I am new to css and the image for my header is not displaying. Whenever I try to add it to my header the nav gets a slightly darker tint of red? You and your genius minds figure it out!
css:
    header {
    background: url("http://www.charlottecentercity.org/wp-content/uploads/2013/09/Imaginon-pic.jpg");
    background-size: cover;
    image-repeat: no-repeat;
    }
    ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    vertical-align: middle;
    line-height: 70px;
    display: inline;
    }
    li {
    display: inline;
    }
    nav {
    background: rgba(255,0,0,0.5);
    }
    nav img {
    height: 60px;
    margin: 5px;
    float: left;
    }

html:

About Imaginon

General Info

Programs and Events

Plan Your Visit

Just for Fun

A: Try and give the header (min/max) width / height

A: Add css overflow:hidden to your header.. and do the same
in future to all your wrapper elements.

A: The background image is showing on the header, but:

*

*it is set to background-size: cover, which means that you only see the very top, blue part. Presumably, when you have more content, you'll see more of the header, but in the mean time you could add a min-height: 600px; for example.

*the nav has a reddish, semi-transparent background color that sits on top of the header background color. Just remove that red color if you don't want it.

A: Do give the header a defined size, as it will not be able to fill something that does not have a defined size to it.
header {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100px;
  background: url(../wp-content/uploads/2013/09/Imaginon-pic.jpg) no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

If your style sheet is in a subfolder like I usually have, make sure to add ".." to your image location to tell css to step back one directory. Using a direct path will require another http request, not a huge deal but slows your site down in the long run.
I included the webkit background code because I believe it to be easier to use. As well as creating browser compatibility.


text:
Q: Why do i need to specify constructor argument as nullable generic type? I'm trying to make OK() to call ApiResponse constructor. When I give null to ApiResponse constructor argument, it shows error that type mismatches.
If I change data type to T? it works. Why is it happening? Default upper bound of T is Any? so i thought it won't be any problem to assign null.
class ApiResponse<T> private constructor(
        val data: T, // If I change data type to T?, no error
        val message: String?
) {
    companion object {
        fun <T> OK(): ApiResponse<T> {
            return ApiResponse(null, null)
        }

        fun <T> OK(data: T): ApiResponse<T> {
            return ApiResponse(data, null)
        }
    }
}

I've searched with keywords kotlin, generic, constructor, nullable, T but i could not find answer.

A: In
fun <T> OK(): ApiResponse<T> {
   return ApiResponse(null, null)
}

if someone calls ApiResponse.OK<String>(), then it tries to construct an ApiResponse where data is null and also of type String, which is incompatible.  None of your types prevent that call -- when you have a generic type argument to the function like that, the caller can specify any T they please, including a nonnull type.
You must either return an ApiResponse<T?>,  or not have an argumentless OK factory method.


text:
Q: Backing up files on ubuntu for reinstall. Will there be problems with permissions? I have some very important files I want to backup before I reinstall my Ubuntu back to 9.04 from the 9.10 (its causing me all sorts of problems).
The files total size is small so im just going to copy them over to Dropbox. Im wondering, when i reinstall Ubuntu and copy them back will there be any issues re the permissions of those files because my old user account which created them and the new user Ill setup on the new install will be different?

A: You are better off if you use tar (with some compression if you wish) and save this to DropBox, then restore from the tar file, and the permissions will be restored.

A: There shouldn't be any problem, since it's the same user accessing Dropbox. Though, if there are mproblems, just sudo chmod and sudo chown the files, any you're ready to go.

A: You will lose file's permissions by copying them over Dropbox. Then use chown/chmod/chgrp to restore permissions if something fails.

A: If you re-install, and re-create your user, you're not guaranteed that you'll have the same user ID.  (I think ubuntu starts creating user ids at 500).
But it's really no big deal:  as @Kami and @Bobby mentioned, a couple of simple commands can restore the ownership.


text:
Q: OpenCL Installation on Ubuntu 10.04 i have a problem to which i want a solution and fast....any help is appreciated.
I have a laptop with ubuntu10.04 and Nvidia 8400M GS graphics card. I recently started some work on OpenCL and wanted to run it on my laptop's GPU...but i ran into many problems the day I started.
I downloaded the latest drivers and sdk's needed for running OpenCL on an Nvidia GPU. I have installed
1. NVIDIA-Linux-x86-260.19.36 driver
2. devdriver-3.2-linux-32-260.19.26 driver
3. cudatoolkit_3.2.16_linux_32_ubuntu10.04 CUDA Toolkit
4. gpucomputingsdk-3.2.16-linux GPU SDK
I set the PATH and the LD_LIBRARY_PATH variables as was indicated after the installation process of the cuda toolkit. After that i went to the *NVIDIA_GPU_Computing_SDK/OpenCL* directory and typed sudo make (as was given here). But i get the error
   'glXGetCurrentContext' was not declared in this scope

I can't understand what the problem is. Have I missed something to install or is there some problem with the MakeFile and I have to change some options in there?
Also after this step, how am I supposed to link run an OpenCL program code using this?
Thanks in advance.

A: Have you installed libgl1-mesa-dev?
These packages provide this file:
http://packages.ubuntu.com/search?searchon=contents&keywords=libgl.so&mode=exactfilename&suite=lucid&arch=any

A: Perhaps kludgy, but I just static link in my build files to the libraries and includes. There are now at least 3 (Intel, AMD, NVIDIA) OpenCL implementations to juggle.


text:
Q: How to test onChangeLague ngx-translate with Angular and Jest? I'm trying to do some unit test and I'm still learning about unit test and about ngx-trasnlate:
Is there a way to test a subscription with onLangChange by ngx-translate?
this is what I have until now:
ngOnInit(){
   ...
     this.subscription = this.translateService.onLangChange.subscribe(() => {
          this.dataGrid?.api.refreshHeader();
     });
}

SPEC
 describe('SearchCounterpartyComponent', () => {
      let component: SearchCounterpartyComponent;
      let fixture: ComponentFixture<SearchCounterpartyComponent>;
      let translateService: TranslateService;

      class TranslateServiceStub{
        public get(key: any): any {
          return of(key);
        }
      };

      beforeEach(async () => {
        await TestBed.configureTestingModule({
          declarations: [ SearchCounterpartyComponent, TranslatePipeMock ],
          schemas: [CUSTOM_ELEMENTS_SCHEMA],
          providers: [
            {provide: TranslateService, useClass: TranslateServiceStub}
          ],
          imports: [
            ReactiveFormsModule,
            RouterTestingModule,
            HttpClientTestingModule,
            MatDialogModule,
            MatTooltipModule
          ]
        }).compileComponents();
      });

      beforeEach(() => {
        fixture = TestBed.createComponent(SearchCounterpartyComponent);
        component = fixture.componentInstance;
        translateService = TestBed.inject(TranslateService);
      });

    it('should create search counterparty component', () => {
       expect(component).toBeTruthy();
     });
});


text:
Q: Are nulls not permitted in RPG programming? I've been told by our RPG programmer that none of our AS400-based DB2 database tables can permit nulls because nulls "are really difficult to program for" in RPG.    I'd like to know if this is actually true and if so, what is it that makes this basic database feature so difficult to use in RPG?
I realize this may be slightly out of scope for Stack Overflow, but this is the best source I know for this kind of information.

A: The answer turns out to be "NULLS are allowed but require extra work."   User Carl Groner commented above with a link to an excellent article which explains this from the RPG programmer's point of view.   Here is the pertinent part which applied to my problem:

RPG/400 doesn't support processing NULLs in a database file. If a file
  contains NULLs,     specifying the ALWNULL(*YES) compiler option on
  the Create RPG Program (CRTRPGPGM) command allows the program to
  access the file as input only, with the caveat that all NULL-capable
  fields contain the "default" value when a NULL is encountered. This
  means the RPG/400 program will have no way of distinguishing a NULL
  from a blank, for example.

A: IBM RPG does not currently support handling nulls directly, but they can be handled in a SQL call by using the ISNULL built in function:
exec sql declare X cursor for
select ISNULL(numfield, 0),
       ISNULL(alphafield, '')
from table
where field = value
for read only;


text:
Q: To display the data from postgraphile api into the react app `
import React, { useEffect, useState } from 'react';
import { useQuery, gql } from '@apollo/client';
import { LOAD_USERS } from "../GraphQL/Queries"

function GetUsers() {

  const { error, loading, data } = useQuery(LOAD_USERS);
  const [users, setUsers] = useState([]);

  useEffect(() => {
    if (data) {
      console.log(data.allUsers)
      setUsers(data.allUsers)
    }
  }, [data]);
  return (
    <div>
      {users.map((val) => {
        return <h1> {val.firstname} </h1>
      })}
    </div>
  )

}

export default GetUsers;

`
the error is occuring in console log as
Uncaught TypeError: users.map is not a function. So please help me with this how do i display it on app. it is being print in the console log


text:
Q: Notation for the set of continuous functions with constant boundary values I am writing a paper about continuous functions with constant boundary, e.g. $f:X\to\mathbb{R}$ with $f(x)=C$ for all $x\in\partial X$.
Is there a standard notation for such a thing? I considered calling this set $C(X)$ but I'm worried that will be confusing since this notation is usually reserved for the set of all continuous functions on $X$.


text:
Q: Laravel test. assert exact JSON structure I have a laravel API project. There is a lot security data, that shouldn't be shown for users in API responses. I need some way to write tests where I can get true if only the response structure is exact same as a pre-set structure in test.
So, if my test structure is $structure = [ 'data' => ['_id', 'user' => ['name', 'email], 'title']; but in response I'm recieveing more or less fields, I need this test to be failed.
In a docs I've found only:
assertJson - expecting for exact key => values, but I need a keys only;
assertJsonStructure - returns true even if some fields missing or response contains some other fields.

A: Use Opis JSON Schema
$validator = new \Opis\JsonSchema\Validator();
$result = $validator->dataValidation($json, $schema);
PHPUnit::assertTrue($result->isValid(), "Mismatch json schema");

For your case read more about required and additionalProperties: https://docs.opis.io/json-schema/1.x/object.html#required
Your json scheme may be looks like:
{
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "type": "integer"
        }
      }
}


text:
Q: Two non-differentiable functions whose product is differentiable. So I was wondering while studying analysis if there is any case where two functions aren't differential at $0$ (kind of like $1/x$) but is differentiable at 0 when combined (i.e.  $fg$).
I mean this for functions that are defined on $\mathbb{R}$.

A: Take $f(x)=|x|$ and $g(x)=|x|$.

A: Let $h :R\to R$ be positive and differentiable at every point. Example 1.Let $f:R\to R$ be positive and nowhere continuous. For example let $f(x)=1$ when $x$ is rational and $f(x)=2$ when $x$ is rational.  Example 2. Let $f:R\to R$ be continuous ,positive, and nowhere differentiable.(Such functions do exist.)...In both examples let $g(x)=h(x)/f(x)$. In both examples , neither $f$ nor $g$ are differentiable anywhere but their product is differentiable everywhere. In example 2., both $f$ and $g$ are continuous. For a third example suppose $f(x)=0$ for $x\leq 0$ and that $f$ is discontinuous on $[0,\infty)$. Let $g(x)=f(-x)$.

A: On $\mathbb R$ let $f$ be the indicator of $[0,\infty)$ and $g$ the indicator of $(-\infty,0)$. Their product is $0$, whereas each of the functions is not differentiable at $0$.
Furthermore, you dont need your functions to be defined on $\mathbb R$ to say something about differentiability in $0$, since differentiability is a local property.


text:
Q: Can I insert Posts in WordPress via a standalone Tool I want to create a Blog witch daily Posts from different People who dont be very familiar with the WordPress Backend and how to set up a Blog Post. So I will build my own little standalone Tool where they can easy choise the Content of the Post and then the Tool will build the Strukture of the Post and send it to WordPress and publish it.
Is that possible with WordPress or do I need another CMS like Drupal or each other?
Thank you for helping me out.
Best wishes

A: Yes, it is possible. For example using the REST API.

A: Or you can do it via email. Just google 'wp post via email.'


text:
Q: Kafka Consumer - How to set fetch.max.bytes higher than the default 50mb? I want my consumers to process large batches, so I aim to have the consumer listener "awake", say, on 1800mb of data or every 5min, whichever comes first.
Mine is a kafka-springboot application, the topic has 28 partitions, and this is the configuration I explicitly change:

Parameter
Value I set
Default Value
Why I set it this way

fetch.max.bytes
1801mb
50mb
fetch.min.bytes+1mb

fetch.min.bytes
1800mb
1b
desired batch size

fetch.max.wait.ms
5min
500ms
desired cadence

max.partition.fetch.bytes
1801mb
1mb
unbalanced partitions

request.timeout.ms
5min+1sec
30sec
fetch.max.wait.ms + 1sec

max.poll.records
10000
500
1500 found too low

max.poll.interval.ms
5min+1sec
5min
fetch.max.wait.ms + 1sec

Nevertheless, I produce ~2gb of data to the topic, and I see the consumer-listener (a Batch Listener) is called many times per second -- way more than desired rate.
I logged the serialized-size of the ConsumerRecords<?,?> argument, and found that it is never more than 55mb.
This hints that I was not able to set fetch.max.bytes above the default 50mb.
Any idea how I can troubleshoot this?

Edit:
I found this question: Kafka MSK - a configuration of high fetch.max.wait.ms and fetch.min.bytes is behaving unexpectedly
Is it really impossible as stated?

A: Finally found the cause.
There is a broker fetch.max.bytes setting, and it defaults to 55mb. I only changed the consumer preferences, unaware of the broker-side limit.
see also
The kafka KIP and the actual commit.


text:
Q: Get value of previous array key So I tried doing this :
$array = array('first'=>'111', 'second'=>'222', 'third'=>'333');

var_dump(prev($array["second"]));

Hoping to get 111 but I get NULL. Why?
$array["second"] returns 222. Shouldn't we get 111 when we use PHP's prev() function?
How to get the previous value of an array if it exists using the key?

A: prev function expects an array as an argument but you're passing a string.
$array["second"] evaluates to '222'

A: Your current value from $array["second"] is not an array and prev takes an array as a parameter.
You have to move the internal pointer of the $array and then get the previous value.
$array = array('first'=>'111', 'second'=>'222', 'third'=>'333');
while (key($array) !== "second") next($array);
var_dump(prev($array));

A: In this case, you point directly the previous value, without iterating the array.
$array = array('first'=>'111', 'second'=>'222', 'third'=>'333');
$keys = array_flip(array_keys($array));
$values = array_values($array);
var_dump($values[$keys['second']-1]);


text:
Q: Laravel 5.2 web middleware group in routes.php is gone I recently starte a new laravel project and realised the web middleware group in the routes.php is gone.
It still seems to use it though - therfore I'd like to ask where it is configured since it is not listed in the Kernel.php as default middleware
protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
        \GeneaLabs\LaravelCaffeine\Http\Middleware\LaravelCaffeineDripMiddleware::class,
];

I'm actually asking because I want to create an additinal api to my app and therefore I'd like to not use the web middleware.

A: I actually found the answer my self. The root of this behaviour is in the RouteServiceProvider where the map function applies the middleware.
/**
 * Define the routes for the application.
 *
 * @param  \Illuminate\Routing\Router  $router
 * @return void
 */
public function map(Router $router)
{
    $this->mapWebRoutes($router);

    //
}

/**
 * Define the "web" routes for the application.
 *
 * These routes all receive session state, CSRF protection, etc.
 *
 * @param  \Illuminate\Routing\Router  $router
 * @return void
 */
protected function mapWebRoutes(Router $router)
{
    $router->group([
        'namespace' => $this->namespace, 'middleware' => 'web',
    ], function ($router) {
        require app_path('Http/routes.php');
    });
}

A: Where are you looking? On the default Kernel.php these are still there:
    /**
 * The application's global HTTP middleware stack.
 *
 * These middleware are run during every request to your application.
 *
 * @var array
 */
protected $middleware = [
    \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
];

/**
 * The application's route middleware groups.
 *
 * @var array
 */
protected $middlewareGroups = [
    'web' => [
        \App\Http\Middleware\EncryptCookies::class,
        \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
        \Illuminate\Session\Middleware\StartSession::class,
        \Illuminate\View\Middleware\ShareErrorsFromSession::class,
        \App\Http\Middleware\VerifyCsrfToken::class,
    ],

    'api' => [
        'throttle:60,1',
    ],
];

Then in your routes even the default web is not there, then put it.
Route::group(['middleware' => ['web']],function(){
      //your routes ...
});

Or if you do not want the session in your api endpoint:
Route::group(['middleware' => ['api']],function(){
      //your routes ...
});


text:
Q: SQL Script USE statement - C# In my C#.NET application, I use Microsoft.SqlServer.Management.Server.ConnectionContext.ExecuteNonQuery() to run a script against a SQL Server database.
I would like to know if there is a way to make sure the script does not contain "USE" statement.
I have to make sure the script is ran against a specific database and that it does not change DB while executing.
Thanks!

A:
have to make sure the script is ran against a specific database and that it does not change DB while executing.

The way you control that in sql server is through security. You create a user account in sql server that only had read access, and only for that one database, and then make sure to use that account when connecting to the server. If that means using a different connection here than at other points in your app, so be it.


text:
Q: Get Arguments To Program Remotely I have this code:
arguments = urllib.urlopen("http://website.com.info/file.php")
command = location + "\file.exe " + arguments.read()
I would like to be able to control the arguments remotely and this code works, But my problem my AV block this behavior because it tries to access a website or something. Any alternative way to be able to pass arguments to my program remotely?
I use python2.6 and this program run on windows (py2exe)
P.S this is used on my own computers I'm trying to control the arguments remotely when I'm not around.


text:
Q: Symfony2 authentication by directly calling check_path My firewall configurations works well when I log in via the login form defined in login_path. What I want is to log in without seeing or going login_path, but sending username and password parameters to check_path directly.
When I make a post request to the check_path with username and password, it seems symfony2 needs a cookie which is created in login_path by smyfony2 itself.
Is there a way to log in by sending username and password to check_path directly?

A: There is an option named require_previous_session to allow calling check_path without going login_path. http://symfony.com/doc/current/reference/configuration/security.html
After setting this directive as false, I am available to log-in by calling directly check_path.


text:
Q: Connect to iBeacon I can scan for iBeacons with:
func locationManager(manager: CLLocationManager!, didRangeBeacons beacons: [AnyObject]!, inRegion region: CLBeaconRegion!) {

  }
}

let suppose I get the following beacons after scanning
Beacon 1: major:1 minor:5 uuid:xxx
Beacon 2: major:1 minor:6 uuid:xxx
Beacon 3: major:1 minor:7 uuid:xxx

After the scan I want to connect to beacon 2 and change its characteristics.
I know I can use CoreBluetooth to scan and connect to a Bluetooth device and change its characteristics, but the problem is how can I identify which device is beacon 2 via Core Bluetooth?

A: You cannot obtain any information that directly relates a CLBeacon to a  CBPeripheral.
Typically the beacon's GATT service will expose a "device name" characteristic that you can display to the user to allow them to select the device to be configured from a list.
As David pointed in the comments, any such GATT service will be vendor specific, or it may not even exist, with the beacon being configured through some other method, such as USB. Even where a GATT service is provided it may be disabled through configuration or only active for a limited period after initial power-on.
There is no generic "configure an iBeacon" service defined.


text:
Q: Wordpress site slowed down due to css file from localhost I got my wordpress site load up and running LIVE but it's very slow. Now after hours of search I found out in the source code that I got a stylesheet linked as
<link rel='stylesheet' id='wpfb-css'  href='http://localhost:8888/wpsite/wp-content/plugins/wp-filebase/wp-filebase.css?ver=0.3.0.05' type='text/css' media='all' />

which means a css file has come from my local development server that I have offline...
Where is this file usually located at and what should I do to officialy remove it so my wordpress site can run smoothly again.
Thanks!

A: You need to update he "wpfb_css" field on the database:
UPDATE wp_options SET option_value = "http://newdomain.com/wp-content/plugins/wp-filebase/wp-filebase.css" WHERE option_name = 'wpfb_css';

A: Change in your template to link to it like this;
<link rel='stylesheet' id='wpfb-css'  href='/wp-content/plugins/wp-filebase/wp-filebase.css?ver=0.3.0.05' type='text/css' media='all' />

This uses an absolute path, without the domain, assuming your website loads at the base url, not in a sub directory, else prepend the subdirectory.
This should then work regardless of being on your dev environment or your production server.
Absolute vs relative URLs
The reason it's slowed down is because ordinarily it'd be a 404 error, but as every client has a localhost, the request isn't instantly dismissed by a server with a 404, so it's timing out when eventually port 8888 doesn't get a connection.


text:
Q: Understanding how UIDynamics calculate positions Im trying to understand how the UIDynamicAnimator calculates the values each iteration.
For example i have a simpel exampel where i have a UIAttachmentBehavior and a UIDynamicItemBehavior attached to the same DynamicItem
UIAttachmentBehavior *attachmentBehavior = [[UIAttachmentBehavior alloc] initWithItem:test attachedToAnchor:CGPointMake(50, 50)];
attachmentBehavior.frequency = 3.5;
attachmentBehavior.damping = .4;

UIDynamicItemBehavior *dynamicItemBehavior = [[UIDynamicItemBehavior alloc] initWithItems:@[test]];
dynamicItemBehavior.resistance = 10;
dynamicItemBehavior.action = ^{
    NSLog(@"%f", [dynamicItemBehavior linearVelocityForItem:test]);
};

Whenever i change the anchorPoint of the UIAttachmentBehavior it will animate to that location with a spring animation.
I dont understand how the DynamicItemBehavior knows about this movement, and thereby can apply its physics properties (resistance, density etc) to the movement triggered by a different Behavior?
Does the UIDynamicAnimator somehow prioritise and accumulate the values from all the behaviors (velocity, damping etc).
in my head it does something like
var velocity;

for behavior in item.behaviors
    velocity += behavior.velocity * behavior.damping

item.position = delta_time * velocity

A: I'm not sure I entirely understand what you're asking, but I happened upon this while studying UIDynamics a couple days ago. Maybe it can help you out: http://www.raywenderlich.com/76147/uikit-dynamics-tutorial-swift
About halfway down the page he talks about how exactly the behaviors are being calculated behind the scenes:

The method signatures for the dynamic behaviors use the term items
  rather than views. The only requirement to apply dynamic behavior to
  an object is that it adopts the UIDynamicItem protocol, as so:
  protocol

UIDynamicItem : NSObjectProtocol {
var center: CGPoint { get set }
var bounds: CGRect { get }
var transform: CGAffineTransform { get set } }

The UIDynamicItem protocol gives dynamics read and write access to the center and transform properties, allowing it to move the items based on its internal computations. It also has read access to bounds, which it uses to determine the size of the item. This allows it to create collision boundaries around the perimeter of the item as well as compute the item's mass when forces
  are applied. This protocol means that dynamics is not tightly coupled
  to UIView; indeed there is another UIKit class that isn't a view but
  still adopts this protocol: UICollectionViewLayoutAttributes. This
  allows dynamics to animate items within collection views.

There's more to it than what I've quoted here. It's a good read on the topic as a whole, I thought. Hope this helps!


text:
Q: Getting an error [UIImage mutableCopyWithZone:]: unrecognized selector sent to instance Working on JSON data and am extracting an image from the dictionary adding the image to an array
  NSURL *imageurl=[NSURL URLWithString:(NSString *) Dictionry[@"product"][@"image_medium_url"]];
    NSData *data = [NSData dataWithContentsOfURL:imageurl];
    UIImage *image = [UIImage imageWithData:data];
    [self.productImageArray addObject:image];

And am copying this array to another array
for(int i=0;i<prodReq.productNameArray.count;i++)
{

    [productimageA addObject:[[prodReq.productImageArray objectAtIndex:i] mutableCopy]];
}

And setting the image to an imageview
UIImageView *productimage=[[UIImageView alloc]initWithFrame:CGRectMake(15, prodimgY, 60, 75 )];
    productimage.image=[productimageA objectAtIndex:indexPath.row];

And when I run the project am getting this error
 -[UIImage mutableCopyWithZone:]: unrecognized selector sent to instance 0x14581240

What could be wrong?

A: UIImage objects are immutable, so you can't call mutableCopy on them.

A: You are adding UIImage to the productImageArray. You dont need to add mutableCopy for a UIImage object. So just use
[productimageA addObject:[prodReq.productImageArray objectAtIndex:i] ];


text:
Q: Login Page: Span text error does not appear in table upon PHP prompt & Unable to progress when correct username and password given This post was quite hard to title as I believe the issue I am having is spurred by multiple things.
I am trying to create a login system using HTML and PHP with the requirement of not using a database for username and password validation / storage. I found a good piece of code online that I liked the look of - it fulfills the requirements and works perfectly, so I tried to apply the elements it used in my own coding. However, my version does not offer any indication of working at all.
The original piece of code I found can be seen at this link here: https://www.w3schools.in/php/examples/php-login-without-using-database

The image above is of the program I am trying to take elements from - predominantly the "invalid login details" prompt that appears at the top of the page when login is pressed and an incorrect username and password is given. The code for this can be seen here:
<?php session_start(); /* Starts the session */

    /* Check Login form submitted */
    if(isset($_POST['Submit'])){
        /* Define username and associated password array */
        $logins = array('admin' => '123456','username1' => 'password1','username2' => 'password2');

        /* Check and assign submitted Username and Password to new variable */
        $Username = isset($_POST['Username']) ? $_POST['Username'] : '';
        $Password = isset($_POST['Password']) ? $_POST['Password'] : '';

        /* Check Username and Password existence in defined array */
        if (isset($logins[$Username]) && $logins[$Username] == $Password){
            /* Success: Set session variables and redirect to Protected page  */
            $_SESSION['UserData']['Username']=$logins[$Username];
            header("location:index.php");
            exit;
        } else {
            /*Unsuccessful attempt: Set error message */
            $msg="Invalid Login Details";
        }
    }
?>

The code is rather self-explanatory but I am very new to using PHP.
The remainder of the file is HTML based, creating the input boxes and button inside of a table, the code of which can be seen here:
<!doctype html>

<meta charset="utf-8">
<title>PHP Login Script Without Using Database</title>
<link href="./css/style.css" rel="stylesheet">

PHP Login Script Without Using Database Demo.

More tutorials www.w3schools.in

<form action="" method="post" name="Login_Form">

    <?php if(isset($msg)){?>

      <?php echo $msg;?>

    <?php } ?>

Login

      Username
      <input name="Username" type="text" class="Input">

      Password
      <input name="Password" type="password" class="Input">

      <input name="Submit" type="submit" value="Login" class="Button3">

</form>

Once the user enters one of the 3 pre-defined usernames and passwords, they should be taken to a website called "index.php" which simply gives an affirmation that you have passed verification as you can only access it with the correct credentials - the code of which is here:
<?php session_start(); /* Starts the session */

if(!isset($_SESSION['UserData']['Username'])){
    header("location:login.php");
    exit;
}
?>

Congratulation! You have logged into password protected page. Click here to Logout.

My code is slightly different; I am using a stylised form to display my interface, and I am very much set on keeping it. However, I think this may be the issue as to why I cannot verify usernames and passwords.
My version of the code can be seen below.
<?php
    session_start();

    /* Check Login form submitted */
    if (isset($_POST['Submit'])) {
        /* Define username and associated password array */
        $logins = array('admin' => '123456', 'username1' => 'password1', 'username2' => 'password2');

        /* Check and assign submitted Username and Password to new variable */
        $Username = isset($_POST['Username']) ? $_POST['Username'] : '';
        $Password = isset($_POST['Password']) ? $_POST['Password'] : '';

        /* Check Username and Password existence in defined array */
        if (isset($logins[$Username]) && $logins[$Username] == $Password) {
            /* Success: Set session variables and redirect to Protected page  */
            $_SESSION['UserData']['Username'] = $logins[$Username];
            header("location:index.php");
            exit;
        } else {
             /*Unsuccessful attempt: Set error message */
            $msg = "Invalid Login Details";
         }
     }
?>

<!DOCTYPE html>

    <meta charset="utf-8">
    <title>U33 DATABASING</title>
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css">
    <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
    <link rel="stylesheet" href="https://www.w3schools.com/lib/w3-theme-black.css">
    <link rel="stylesheet" href="style.css">

            U33

                <button class="w3-button w3-hover-red" title="Notifications">Important Links </button>

                    CV
                    Literary Database
                    Submit an Article

            CV
            Literary
                Database
            Submit an Article

Literary Database Login

            <?php if(isset($msg)){?>

                <?php echo $msg;?>

            <?php } ?>

        <form action="" method="post" name="Login_Form">

            <input type="text" name="Username" placeholder="Username" id="Username" required>

            <input type="password" name="Password" placeholder="Password" id="Password" required>
            <input class="w3-hover-red" type="submit" value="Login">

        </form>

I'm not certain what's wrong here at all; I have assigned the same variable names to my input boxes as would be if they were inside of the table in the other program, but that hasn't seemed to do anything. Additionally, regardless of what is inputted into the two text boxes, the "invalid login details" text does not appear in the  that I created - which is a table within the form.
An image of my product can be seen here:

As you can see, there is a grey outlined box above the username field - this is empty and should remain so until the user enters an incorrect username/password. Once this occurs, the red text should appear inside of the box - which I thought I had done when calling upon the $msg function in the else statement of the PHP at the top of the file, but that doesn't seem to work.
Also, when entering the correct information into the username and password field, I am not taken to the index.php file. Just for assurance, here is an image of the index.php page when the username and password are correct:

Maybe this is an issue of variable scope? I'm not really sure and would love any help I can get to figure this out.
Thank you for your time and I look forward to seeing the responses I get.

A: You are missing the name attribute on the submit button.
<input class="w3-hover-red" type="submit" value="Login">

should be
<input class="w3-hover-red" type="submit" value="Login" name="Submit">

Without it the very first isset fails and it just spits out the html as if you hadn't done anything.


text:
Q: Visualizing graph/network with 3 layeres (tripartite) igraph There are already a topic about tripartite graphs in igraph, but the way they use layout.sugiyama is not good for me. I would like to impose a order for the nodes. Actually, I would like to visualize edge crossing for the tripartite graph. Suppose I have a tripartite graph with 3 nodes in each column. I will have only one edge coming out from each node. The 6 edges could be, for example, (A->E, B->F, C->D, D-> H, E->G, F-> I). Something like that:
      A         D         G
      B         E         H
      C         F         I

How can I do this using igraph? As I said, I want to see the crossing edges. Thank you.

A: For example, you could do:
library(igraph)
coords <- matrix(c(rep(1:3, each = 3), rep(3:1, 3)),
                 ncol = 2,
                 dimnames = list(LETTERS[1:9], c("x", "y")))
g <- graph.formula(A--E, B--F, C--D, D-- H, E--G, F--I)
plot(g, layout = coords[V(g)$name, ])


text:
Q: Output updates only when I clear the filter in R shiny I am very new to Shiny and had a problem when trying to create a plot. The filter and the graph result work fine, but only after the partner is selected in the filter and then deselected again. The output does not update after selecting a partner in the filter immediately, but rather after deselecting it which is very weird. What am I doing wrong :( ? I am providing a piece of code below in case someone can help I would really appreciate it. Thanks in advance.

#### 1) Loading the libraries -------------------------------------------------------

library(shinydashboard)
library(shiny)
library(tidyverse)
library(readxl)

#### 2) Load the data ------------------------------------------------------------------

data<-structure(list(partner = c("park 1", "park 1", "park 1", "park 2",
"park 2", "park 2", "park 3", "park 3", "park 3", "park 4", "park 4",
"park 4", "park 5", "park 5", "park 5"), product = c("Children",
"Adults", "Senior", "Children", "Adults", "Senior", "Children",
"Adults", "Senior", "Children", "Adults", "Senior", "Children",
"Adults", "Senior"), quantity = c(10, 15, 25, 35, 46, 21, 34,
45, 64, 75, 34, 32, 67, 43, 23)), row.names = c(NA, -15L), class = c("tbl_df",
"tbl", "data.frame"))

#### a) header ----------------------------------------------------

header <-
  dashboardHeader(title = "Analysis")

#### b) Sidebar -------------------------------------------------------

sidebar <- dashboardSidebar(
  sidebarMenu(
    menuItem("Update",tabName = "update",icon=icon("info"))))

body <- dashboardBody(
  tabItems(
    tabItem(tabName = "update",
            fluidPage(
              selectInput("partner","Partner",
                          choices=unique(data$partner)),
              plotOutput("plot1")))))

ui <-
  dashboardPage(header, sidebar, body)

server <- function(input, output) {

  output$plot1 <- renderPlot({
    data%>%
      filter(partner %in% input$partner) %>%
      group_by(product) %>%
      summarise(total=sum(quantity)) %>%
      ggplot(aes(x=product,y=log(total))) +
      geom_bar(stat="identity",aes(fill=product),color="black",show.legend = F)+
      coord_flip()+
      theme_test()
  })
}

shinyApp(ui, server)


text:
Q: creating simple html page with typo3 i have just installed typo3 but i'm not able to create a simple html page. I create a new page with the "page" tool but i cannot see it with the "view" tool. I only can see "not found" in the navigator. ¿where are saved the html pages that you create with typo3?
regards.

A: at first a warm welcome to the TYPO3 community!
TYPO3 does not create HTML files, but save the rendered pages in a cache system.
To get a well installed TYPO3 producing frontend output you need a few steps:

*

*A root page in the page tree (your entry point to the page tree)

*A site created with the sites module for the root page (handles domains, languages etc.)

*A TypoScript template record at the root page (rendering definition for your page tree below the root page)

You will find documentation for this here:
TYPO3 page tree:

*

*https://docs.typo3.org/m/typo3/tutorial-editors/master/en-us/Pages/Index.html
TYPO3 site handling:

*

*https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/SiteHandling/Index.html
TYPO3 template record:

*

*https://docs.typo3.org/m/typo3/tutorial-templating/7.6/en-us/Tasks/WorkingTypoScript/TypoScriptTemplate/Index.html
TypoScript quick overview:

*

*https://docs.typo3.org/m/typo3/tutorial-typoscript-in-45-minutes/master/en-us/TypoScriptOverview/Index.html
TypoScript FLUIDTEMPLATE (Fluid is the TYPO3 template engine):

*

*https://docs.typo3.org/m/typo3/tutorial-templating/master/en-us/Index.html

*https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/ContentObjects/Fluidtemplate/Index.html
May be it could be interesting for you to install a distribution first, where everything is working already, so you will get a quick result:

*

*https://docs.typo3.org/m/typo3/guide-installation/master/en-us/In-depth/Distributions/Index.html
If you have problems with your installation have a look there:

*

*https://docs.typo3.org/m/typo3/guide-installation/master/en-us/Index.html
I hope this will help you.


text:
Q: How to obtain an Edmunds API key? This is my first attempt to use an API. I followed the instructions for registering for an Edmunds API (http://developer.edmunds.com/).
I registered for an account, got an email from them to confirm, clicked on that link, and got a request to register my application, which I filled out.
But when I log into my account and click on "keys", all I get is the message "You don't have any keys yet".
What am I missing? Thanks in advance.

A: UPDATE
The Edmunds API has been shutdown.
I would like to also recommend this website, it contains a list of the latest car information/database APIs.

I can't remember exactly how I created mine, I believe I created my dev account and then received an api key link via email. I clicked the link and it took me to a page where I could setup my app and receive an api key. You should have received said email by now.
If that doesn't work then try emailing: api@edmunds.com

A: Here is the email response I got from Edmunds:

Joe,
Thank you for your interest in the Edmunds Open API Program.
Unfortunately, we are in the process of retiring our Open API Program. Therefore, we are unable to issue you an API key at this time.
Regards,
Edmunds

A: An alternative to Edmunds API would be Marketcheck Cars API
The developer portal is given here  with Comprehensive API documentation
The APIs supported are

*

*Inventory Search API

*VIN History API

*Dealers API

*VIN Decoder API

*CRM Cleanse API

and lots more APIs coming up like - Market APIs with active and historical market averages, trends, dealer sales stats, dealer ranking, deal ranking, total cost to own, car market values (like Edmunds TMV) coming up


text:
Q: Strange ruby to_yaml behavior I got this weird problem with difference in behavior of to_yaml. For:
"0111".to_yaml

it returns:
"--- \"0111\"\n"

At the same time this:
"0128".to_yaml

returns:
"--- 0128\n"

As you can see the first output have "" but the second doesn't.
Any idea?
Environment: MRI Ruby 1.9.2 and JRuby 1.6.5 (1.9 mode).

A: I believe Eugene is right about the reason for these issue - seems like parser treats strings containing valid octal numbers differently.
If you don't like it you can switch to a different YAML parser. According to docs there are two parsers available: Syck and Psych. The former is old and unmaintained and the latter is its replacement.
Psych is used in latest versions of Rails and is default YAML engine in 1.9.3. But you can easily use it in 1.9.2 and see the difference:
require 'yaml'

p YAML::ENGINE.yamler      # => "syck"
# or explicitly set YAML::ENGINE.yamler = "syck" in 1.9.3
p '01'.to_yaml             # => "--- \"01\"\n"
p '08'.to_yaml             # => "--- 08\n"
p YAML.load('01'.to_yaml)  # => "01"
p YAML.load('08'.to_yaml)  # => "08"

p YAML::ENGINE.yamler = "psych"
p '01'.to_yaml             # => "--- '01'\n"
p '08'.to_yaml             # => "--- '08'\n"
p YAML.load('01'.to_yaml)  # => "01"
p YAML.load('08'.to_yaml)  # => "08"

As you can see there is no need to worry about different representation of strings in Syck as long as you're using the same engine to decode data (in both cases it returns original strings).
If for some reason you need unified representation for strings in YAML you can switch to Psych (it's more consistent at least in this case), but be careful as you might get in troubles trying to load with Psych data that was previously dumped with Syck.

A: I can duplicate this as well.  I'm not sure what is doing it, but my first guess is that it has do with the "numbers" in the string actually being octal numbers.  Or more accurately, the first being octal, and the second not.  If you remove the 0, you get the behavior from the first on both of them.  Perhaps somebody else could elaborate on this theory.
1.9.2p290 :002 > "0111".to_yaml
  => "--- \"0111\"\n"
1.9.2p290 :003 > "0128".to_yaml
  => "--- 0128\n"
1.9.2p290 :004 > "\0111".to_yaml
  => "--- \"\\t1\"\n"
1.9.2p290 :005 > "\0128".to_yaml
  => "--- \"\\n\\\n8\"\n"
1.9.2p290 :006 > string = "0111"
  => "0111"
1.9.2p290 :007 > string.class
 => String
1.9.2p290 :008 > string.to_yaml
 => "--- \"0111\"\n"
1.9.2p290 :009 > string = "111"
 => "111"
1.9.2p290 :010 > string.to_yaml
 => "--- \"111\"\n"
1.9.2p290 :011 > string = "128"
 => "128"
1.9.2p290 :012 > string.to_yaml
 => "--- \"128\"\n"