Flutter 2.0.2 Null check operator used on a null value

Question: While I know this may look like a duplicate with how many different posts there are about this error but I am getting this error for (which I assume) are different reasons on four different screens.
My app launches but I end up getting the Red screen error whenever I try to navigate my app because it says a widget within the screen used a Null Check operator on a null value.
Here are the errors I've gotten:

The following _CastError was thrown building NotificationBanner(dirty):
Null check operator used on a null value.
The relevant error-causing widget was:
NotificationBanner file:///Users/alexm/carebloom-flutter/lib/Views/homeview.dart:9:7

The following _CastError was thrown building AlertBanner(dirty):
Null check operator used on a null value.
The relevant error-causing widget was:
AlertBanner file:///Users/alexm/carebloom-flutter/lib/Views/alerts_view.dart:57:15

The following _CastError was thrown building MessageOverView(dirty):
Null check operator used on a null value.
The relevant error-causing widget was:
MessageOverView file:///Users/alexm/carebloom-flutter/lib/widgets/navbar.dart:41:16

This one is a little different

The following _CastError was thrown building SettingsView(dirty, dependencies:
[_EffectiveTickerMode], state: _SettingsViewState#ddb1e(tickers: tracking 1 ticker)):
Null check operator used on a null value.
The relevant error-causing widget was:
SettingsView file:///Users/alexm/carebloom-flutter/lib/widgets/navbar.dart:49:16

Now I assume that the errors lie within the whatever widget came back as WidgetName(dirty). SO the code for each of those is below. However I'd like to also ask some questions on top of all this just to better my understanding and help me diagnose issues in the future. When it has WidgetName(dirty) what exactly does that mean what is (dity)? Besides the error message showing a specific widget it also gives 'The relevant error-causing widget path, is that the one I should be looking at?
NotificationBanner:
  @override
  Widget build(BuildContext context) {
    return StreamBuilder<QuerySnapshot>(
        stream: FirebaseFirestore.instance
            .collection('alerts')
            .where('access',
                arrayContains: FirebaseAuth.instance.currentUser!.uid)
            .where('read', isEqualTo: false)
            //.orderBy('createdAt', descending: true)
            .snapshots(),
        builder: (context, snapshot) {
          if (!snapshot.hasData || snapshot.data!.docs.length <= 0) {
            return Container(
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(10),
                    topRight: Radius.circular(10),
                    bottomLeft: Radius.circular(10),
                    bottomRight: Radius.circular(10)),
                boxShadow: [
                  BoxShadow(
                    color: Colors.grey.withOpacity(0.5),
                    spreadRadius: 5,
                    blurRadius: 7,
                    offset: Offset(0, 3), // changes position of shadow
                  ),
                ],
              ),
              height: 60.0,
              child: Row(
                mainAxisSize: MainAxisSize.max,
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  SizedBox(width: 10.0),
                  Icon(
                    Icons.check_box,
                    color: Colors.green,
                    size: MediaQuery.of(context).size.width * .1,
                  ),
                  SizedBox(width: 5.0),
                  Expanded(
                    child: AutoSizeText(
                      "No Current Messages or Alerts",
                      maxLines: 1,
                      maxFontSize: 20,
                      style:
                          TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
                    ),
                  ),
                  //if (snapshot.hasData) SizedBox(width: 45),
                ],
              ),
            );
          }
          Alert alert = Alert.fromFirestore(snapshot.data!.docs.first);
          return Card(
            //height: 60.0,
            child: InkWell(
                child: Row(
                  mainAxisSize: MainAxisSize.max,
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    SizedBox(width: 10.0),
                    Icon(
                      Icons.warning,
                      color: Colors.red,
                      size: MediaQuery.of(context).size.width * .1,
                    ),
                    SizedBox(width: 15.0),
                    Expanded(
                      child: AutoSizeText(
                        "New Alert for Your Patient",
                        maxLines: 1,
                        maxFontSize: 20,
                        style: TextStyle(
                            fontSize: 20, fontWeight: FontWeight.bold),
                      ),
                    ),
                    //if (snapshot.hasData) SizedBox(width: 45),
                    if (snapshot.hasData) Icon(Icons.arrow_right, size: 50)
                  ],
                ),
                onTap: () {}),
            elevation: 12,
          );
        });
  }

  Widget getIcon(snapshot) {
    if (snapshot.hasData) {
      return Icon(
        Icons.warning,
        color: Colors.red,
        size: 60,
      );
    } else {
      return Icon(
        Icons.check_box,
        color: Colors.green,
        size: 60,
      );
    }
  }
}

AlertBanner:
import 'package:carebloom/models/alert_model.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';

class AlertBanner extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return StreamBuilder<QuerySnapshot>(
        stream: FirebaseFirestore.instance
            .collection('alerts')
            .where('access',
                arrayContains: FirebaseAuth.instance.currentUser!.uid)
            .where('read', isEqualTo: false)
            .orderBy('createdAt', descending: true)
            .snapshots(),
        builder: (context, snapshot) {
          print(snapshot.hasData);
          print('alert has error');
          print(snapshot.hasError);
          if (snapshot.hasError) {
            print(snapshot.error);
          }
          if (!snapshot.hasData || snapshot.data!.docs.length <= 0) {
            return Card(
              child: SizedBox(
                height: MediaQuery.of(context).size.height * .08,
                child: Row(
                  mainAxisSize: MainAxisSize.max,
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    SizedBox(width: 10.0),
                    Icon(
                      Icons.check_box,
                      color: Colors.green,
                      size: MediaQuery.of(context).size.width * .1,
                    ),
                    SizedBox(width: 5.0),
                    Expanded(
                      child: AutoSizeText(
                        "No Current Messages or Alerts",
                        maxLines: 1,
                        maxFontSize: 20,
                        style: TextStyle(
                            fontSize: 20, fontWeight: FontWeight.bold),
                      ),
                    ),
                    //if (snapshot.hasData) SizedBox(width: 45),
                  ],
                ),
              ),
            );
          }
          Alert curAlert = Alert.fromFirestore(snapshot.data!.docs.elementAt(0));
          return Card(
            child: SizedBox(
              height: MediaQuery.of(context).size.height * .08,
              child: Row(
                mainAxisSize: MainAxisSize.max,
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  SizedBox(width: 10.0),
                  Icon(
                    Icons.warning_rounded,
                    color: Colors.red,
                    size: MediaQuery.of(context).size.width * .1,
                  ),
                  SizedBox(width: MediaQuery.of(context).size.width * .08),
                  Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      AutoSizeText(
                          curAlert.desc!.toLowerCase().capitalizeFirstofEach,
                          maxLines: 1,
                          maxFontSize: 20,
                          style: TextStyle(
                              fontSize: 20, fontWeight: FontWeight.bold)),
                      AutoSizeText(
                        curAlert.fname + ' ' + '${curAlert.lname[0]}' + '.',
                        maxLines: 1,
                        maxFontSize: 20,
                        style: TextStyle(
                          fontSize: 18,
                        ),
                      ),
                    ],
                  ),
                  Spacer(), //SizedBox(width: MediaQuery.of(context).size.width * .1),
                  Icon(Icons.arrow_right, size: 50)
                  //if (snapshot.hasData) SizedBox(width: 45),
                ],
              ),
            ),
          );
        });
  }
}

extension StringFormatExtension on String {
  String get capitalizeFirstofEach => this
      .split(" ")
      .map((str) => str[0].toUpperCase() + str.substring(1))
      .join(" ");
}

MessageOverView:
import 'package:auto_size_text/auto_size_text.dart';
import 'package:carebloom/Services/auth.dart';
import 'package:carebloom/models/last_message_model.dart';
import 'package:carebloom/models/converstaions.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';

class MessageOverView extends StatelessWidget {
  // This widget is the root of your application.

  final AuthService _auth = AuthService();
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        centerTitle: true,
        automaticallyImplyLeading: false,
        backgroundColor: Color(0xFF6cc5de),
        title: AutoSizeText(
          'Messages',
          maxLines: 1,
          style: GoogleFonts.raleway(
              fontWeight: FontWeight.bold,
              fontSize: 35,
              textStyle: TextStyle(
                color: Colors.black,
              )),
          textAlign: TextAlign.center,
        ),
      ),
      body: Container(
        padding: EdgeInsets.all(2.5),
        decoration: BoxDecoration(
            gradient: LinearGradient(
                begin: Alignment.topRight,
                end: Alignment.bottomCenter,
                colors: [Color(0xFFb5e2ee), Colors.white])),
        child: Container(
          child: StreamBuilder<QuerySnapshot>(
              stream: FirebaseFirestore.instance
                  .collection('messages')
                  .where('access',
                      arrayContains: FirebaseAuth.instance.currentUser!.uid)
                  //FirebaseAuth.instance.currentUser.uid, isEqualTo: true)
                  .snapshots(),
              builder: (context, snapshot) {
                if (!snapshot.hasData) {
                  return Container();
                }
                print("after message list query*****************************");
                print(snapshot.data!.docs.toString());
                print(snapshot.data!.docs.length);
                return ListView.builder(
                    itemCount: 1,
                    itemBuilder: (context, pos) {
                      LastMessage msg = LastMessage.fromFirestore(
                          snapshot.data!.docs.elementAt(pos));
                      print('error before or after??????/');
                      print(snapshot.data!.docs.contains(msg.id));
                      return ConversationList(
                        patient: msg.fname! + ' ' + msg.lname!,
                        name: msg.author,
                        messageText: msg.text,
                        imageUrl: msg.photoURL,
                        time: DateFormat('MMM d, h:mma')
                            .format(msg.msgRecieved!.toDate()),
                        isMessageRead: false,
                        pos: pos,
                        id: msg.id,
                      );
                    });
              }),
        ),
      ),
    );
  }
}

SettingsView:
import 'dart:io';

import 'package:carebloom/Screens/login.dart';
import 'package:carebloom/Services/auth.dart';
import 'package:carebloom/Services/image_picker_handler.dart';
import 'package:carebloom/models/user.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';

class SettingsView extends StatefulWidget {
  SettingsView({Key? key}) : super(key: key);

  @override
  _SettingsViewState createState() => _SettingsViewState();
}

class _SettingsViewState extends State<SettingsView>
    with TickerProviderStateMixin, ImagePickerListener {
  // This widget is the root of your application.
  final AuthService _auth = AuthService();

  File? _image;
  AnimationController? _controller;
  late ImagePickerHandler imagePicker;

  @override
  void initState() {
    super.initState();
    _controller = new AnimationController(
      vsync: this,
      duration: const Duration(milliseconds: 500),
    );

    imagePicker = new ImagePickerHandler(this, _controller);
    imagePicker.init();
  }

  @override
  void dispose() {
    _controller!.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    print('Before query settings');

    return Stack(children: [
      StreamBuilder<DocumentSnapshot>(
          stream: FirebaseFirestore.instance
              .collection('users')
              .doc(FirebaseAuth.instance.currentUser!.uid)
              .get()
              .asStream(),
          builder: (context, snapshot) {
            if (!snapshot.hasData) {
              return Container();
            }
            LUser user = LUser.fromFirestore(snapshot.data!);

            return Column(
              children: [
                Container(
                  width: double.infinity,
                  child: Center(
                    child: CircleAvatar(
                      backgroundColor: Colors.white,
                      //backgroundImage: NetworkImage(user.photo),
                      foregroundColor: Colors.grey[600],
                      child: null == user.photo
                          ? CircleAvatar(
                              child: Icon(
                                Icons.person,
                                size: 210,
                                color: Colors.grey[600],
                              ),
                              backgroundColor: Colors.white,
                              radius: 110,
                            )
                          : CircleAvatar(
                              backgroundImage: NetworkImage(user.photo!),
                              backgroundColor: Colors.white,
                              radius: 110,
                            ),
                      radius: 110,
                    ),
                  ),
                ),
                ElevatedButton(
                  onPressed: () => imagePicker.showDialog(context),
                  child: Icon(Icons.camera_alt_outlined),
                  style: ElevatedButton.styleFrom(
                    primary: Color(0xFF3E8094),
                    onPrimary: Colors.white,
                    shadowColor: Color(0xFF6cc5de),
                    elevation: 5,
                    padding: EdgeInsets.fromLTRB(5, 5, 5, 5),
                    shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(20.0),
                        side: BorderSide(color: Color(0xFF6CC5DE))),
                  ),
                ),
                Container(
                  width: double.infinity,
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      SizedBox(
                        height: 20,
                      ),
                      Text(
                        'Name: ' + user.fname! + ' ' + user.lname!,
                        style: TextStyle(
                          fontSize: 24,
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                      SizedBox(
                        height: 20,
                      ),
                      Text(
                        'Email: ' + user.email!,
                        style: TextStyle(
                          fontSize: 24,
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                      SizedBox(
                        height: 20,
                      ),
                    ],
                  ),
                ),
                Container(
                  width: double.infinity,
                  height: 50,
                  child: ElevatedButton(
                      child: Text('Sign Out'),
                      style: ElevatedButton.styleFrom(
                        primary: Color(0xFF3E8094),
                        onPrimary: Colors.white,
                        shadowColor: Color(0xFF6cc5de),
                        elevation: 5,
                        padding: EdgeInsets.fromLTRB(5, 5, 5, 5),
                        shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(20.0),
                            side: BorderSide(color: Color(0xFF6CC5DE))),
                      ),
                      onPressed: () async {
                        await _auth.signOut();
                        Navigator.of(context).push(MaterialPageRoute(
                            builder: (_) => LoginScreen(),
                            fullscreenDialog: true));
                      }
                      // }
                      ),
                ),
              ],
            );
          }),
    ]);
  }

  @override
  userImage(File? _image) {
    setState(() {
      this._image = _image;
    });
  }
}

I've checked everything that I have a null check on so far and haven't been able to fix it.
I've upgraded flutter to 2.0.2, ran a flutter pub cache repair, and ensured that those things were done properly by doing them twice. I'm not exactly sure what I'm missing but I'm thinking its actually in the code.
Comment: Yes, the referenced line numbers for the referenced files should give you a clue to where each error came from.
Answer: Problem:
This error generally occurs when using a Bang ! operator (also known as null-assertion operator) to cast away nullability.
For example:
int? i;

void main() {
  print(i!.isEven); // Runtime error: Null check operator used on a null value
}

Solutions:

It's recommended to use a local variable and do a null check on it instead of using a bang operator when you're not sure about the nullability of the type.
int? i;

void main() {
  var local = i;
  if (local != null) {
    print(local.isEven);
  }
}

You can also use ?. and provide a default value if the type was null.
int? i;

void main() {
  print(i?.isEven ?? true);
}

Comment: Local variable was the way to go for me
Answer: The comment on my post helped me confirm where to look for my issues!
Which was useful for a different error I ran into later down the line.
With this issue it ended up being something in Firebase that had an old data layout than what we were actually working with. Pretty much one of the docs from firebase was missing a field and that caused the null check operator to do its job and let me know that it received a null value.
Comment: Can you explain further? What field is missing where?
Comment: Sure! My code in flutter was looking for specific fields to display and there were a few objects inside firebase that were missing one or two fields, because of this it was giving me an error. I went into firebase and added the fields to the objects and fired my app back up and it worked perfectly. This is a bit more specific to what I was doing rather than a catchall for anyone having this issue. I think I had a user object that was missing a gender field that was causing this but it could be other fields for other people.


MS Access - Adding unbound fields at design time

Question: I would like to create an Access report in which the record source is created via ADO code and then set as the record source for the report when the report is run. The problem I am running into is how to add fields to the report since the recordset is bound to the report at run-time and not design time. Is there  way I can manually add the field and make sure the field name matches what will be provided in the recordset field collection? Thank you.
Answer: The standard solution to this problem is to add all your fields in design view, up to the max available, and hide all of them, and show only the ones you need. Michael Kaplan explained that when he designed the Access Replication Conflict Resolver, this is the approach he used, precisely because adding controls at runtime quickly uses the lifetime limit on the number of controls on a form (700+, but I can't recall the exact number).
It's also just a bad idea, as @Jeff O says, to do design changes at runtime. For one, it means you can never distribute an MDE.
Answer: Several ways to do it, but all of them have their issues.  create-dynamic report using vba
Other questions have found the folley in working in design mode programatically.


To find radius of convergence of the power series.

Question: What is radius of convergence of series $\sum_{n=0}^{\infty} ({\log n})^2 (z^{n})$
I know that for a holomorphic function $f$ whose power series has coefficient $a_n$ is given as
$\frac{1}{R}= \lim_{x \to \infty} |\frac{a_{n+1}}{a_n}|$
Using this I am stuck in the step
$\frac{1}{R}= \lim_{x \to \infty} |\frac{\log({n+1})}{\log n}|$
, Please help.
Comment: the square is on the whole or just on  $n$??
Comment: Yes, The square is on the whole.
Answer: Your expression for $\frac{1}{R}$ in the last line is wrong — why is $a_n$ still there? There's the general formula, but when you use it for a specific series, both $a_n$ and $a_{n+1}$ must be replaced by the corresponding expressions from the given series.
In this example: $a_n=(\log n)^2$ and $a_{n+1}=(\log(n+1))^2$. (And I'm presuming $\log$ stands for the natural logarithm, although that doesn't really matter.) So
$$\frac{1}{R}=\lim_{n\to\infty}\left|\frac{a_{n+1}}{a_n}\right|=\lim_{n\to\infty}\left|\frac{(\log(n+1))^2}{(\log n)^2}\right|=1,$$
where the limit can be found e.g. using L'Hospital's Rule.
Comment: I agree with your answer. Thanks a lot.
Answer: The Radius of Convergence should be 1. The problem with your last line is that you are putting  ${a_n}$ again with ${log}$ term .The log term is itself your${ a_n}$


Riemann integrability of absolute value

Question: Prove using the definition of Riemann integrability that the function $f : [−2, 2] → \mathbb{R}$, $x → |x|$,
is integrable.
Im pretty stuck with this. I know the definition that "A bounded function $f : [a, b] → \mathbb{R}$ is Riemann integrable, if and only if for every $\epsilon > 0$ there is a partition $P$ of $[a, b]$ such, that $U_P − L_p < \epsilon.$"
However i cannot come up with a way to get the partition in terms of $\epsilon$ or $n$ so that i could proceed with the rest. How should i go about this?
Comment: What happens if you make sure that $0$ is one of your partition points?
Comment: Well i could go with $\frac{2-(-2)}{4} = 1$ so i would get $P = (-2, -1, 0, 1, 2)$, but that doens't seem to help me since i need the partition to be in terms of $\epsilon$ or $n$ right?
Answer: Divide your interval into $n$ equal parts of length $\frac {4}{n}$
Note that on each subinteval of length $\frac {4}{n}$ the difference between the maxium and the minimum of your function is $\frac {4}{n}$
Thus  $$U(f,P)-L(f,P)\le \frac {4}{n} \times 4 = \frac {16}{n}$$
Given an $\epsilon >0$, you let $n>\frac {16}{\epsilon}$ and go from there.
Comment: I think you'd better make sure $n$ is even.
Comment: Could you explain how did you come up with $\frac{4}{n}$?
Comment: The slope of your function is either $1$ or $-1$ so on a subinterval of length $4/n$ the maximum variation is $4/n$

Riemann integrability of absolute value


Converting gps to gis in dart

Question: I am a little lost on how to do this, I've looked up a bunch of different packages but none of them seemed right. Any help would be appreciated
Answer: Never mind, in case anyone wants to know, you can just use the confidantes of gps in hasura postgis, it's the same thing.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).

Converting gps to gis in dart


Hypergeometric 1F1 identity

Question: I have the following hypergeometric 1F1 function
\begin{equation}
x{_1}F_1(a-3/2;2a-1;c x^2)
\end{equation}
Is ther any way such that i can express this into something like $
{_1}F_1(a-1;2a-1;c x^2)$?
Answer: You can't have the direct form you want since the constant term for all hypergeometric functions is is non-zero.
The standard derivative works:
The derivative calculation is also elementary.
$\frac{d}{dx}\left(_{1}F_{1}\left(d;b;c\cdot x^{2}\right)\right)=\frac{d\cdot2\cdot c\cdot x}{b}{}_{1}F_{1}\left(d+1;b+1;c\cdot x^{2}\right)
$
$\therefore$
$x\cdot_{1}F_{1}\left(a-3/2;2\cdot a-1;c\cdot x^{2}\right)=\frac{2\cdot a-2}{\left(a-5/2\right)\cdot2\cdot c}\cdot\frac{d}{dx}\left(_{1}F_{1}\left(a-5/2;2\cdot a-2;c\cdot x^{2}\right)\right)$

Hypergeometric 1F1 identity


Beginner's statement translation to first order logic

Question: I'm beginning to learn predicate logic and I'm having a rough time figuring this one out.
I need to translate: Every planet except Earth is lifeless. Therefore, given any distinct two planets, at least one of them is lifeless.
UD: planets, Lx= x is lifeless, e= earth
This is how I translated it so far: $$ ∀x (x ≠ e → Lx) \land ¬Le ∴ ∀x∀y ((Lx∨Ly) → (∃z(Lz \land (z = y ∨z = x) )\land (x≠y)))) $$
I understand that if the statement was just "at least one planet is lifeless" then it would be $ ∃zLz$. But then I also have to translate "given any distinct two planets".
What would the translation of the conclusion be? Thank you.
Answer: I would interpret your translated conclusion as: "Given any two lifeless planets, at least one of them must be lifeless and they must not be the same planet." This is false for the case where $x = y = \textsf{Venus}$, since $\textsf{Venus}$ and $\textsf{Venus}$ are two lifeless planets but are the same planets.
I would translate the conclusion as:
$$
\forall x \forall y ~ \Big( x \neq y ~~\to~~ Lx \lor Ly\Big)
$$
Answer:

Every planet except Earth is lifeless.
Therefore, given any distinct two planets, at least one of them is lifeless.

$$ ∀x (x ≠ e → Lx) \land ¬Le\\
∴ ∀x∀y ((Lx∨Ly) → (∃z(Lz \land (z = y ∨z = x) )\land (x≠y)))) $$

The first line is correct.
For the second line, will this do?
$$\therefore∀x∀y\;\Big(x≠y→(Lx∨Ly)\Big).$$
Your suggestion, on the other hand, reads as "For every pair of planets such that at least one is lifeless, exactly one is lifeless."


Correct implementation of opening storyboard view controller from UIApplicationShortcutItem in objective-c

Question: This is the code I have got for trying to open a view controller from a storyboard. I am getting error "expected identifier" on
UINavigationController controller = [(UINavigationController)[[mainStoryboard instantiateViewControllerWithIdentifier: @"ARViewController"];
Can someone please help.
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler {

NSLog(@"%@", shortcutItem.type);
if ([shortcutItem.type isEqualToString:@"ADD OWN STRING HERE"]) {

    UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
    UINavigationController *controller = [(UINavigationController*)[[mainStoryboard instantiateViewControllerWithIdentifier: @"ARViewController"]];
    [navigationController pushViewController:controller animated:YES];

}
}

@end

Answer: The amount and locations of your [ and ] didn't match (two [ too many, one ] too many). It should be:
UINavigationController *controller = (UINavigationController*)[mainStoryboard instantiateViewControllerWithIdentifier: @"ARViewController"];


What is the difference between T and TItem in C#?

Question: When trying to create a generic class in C# I am doubtful about how to proceed.
Say I want to create a generic class with certain values on Blazor. (most of the time I've seen TItem used in Blazor projects, be as part of a component or in pure C# classes)
public class Disc<TItem> where TItem : class
{
    public IEnumerable<IValues<TItem>> Dataset { get; set; }
  [JsonIgnore]
    public string Title{ get; set; }
}

public interface IValues<TItem>
{
    IEnumerable<TItem> Items { get; set; }
    object Song { get; set; }
    string Lyrics { get; set; }
}

Isn't that the same as this? Just curious....
public class Disc<T> where T : class
{
    public IEnumerable<IData<T>> Dataset { get; set; }
  [JsonIgnore]
    public string Title { get; set; }
}

public interface IValues<T>
{
    IEnumerable<T> Items { get; set; }
    object Song { get; set; }
    string Lyrics { get; set; }
}

Comment: Same as the difference between `int t;` and `int titem;` - Just naming.
Answer: Yes it is the same - the name is just how you identify the generic type in the source code. They should get compiled to the exact same byte code.
It's more helpful to use longer type names when you have multiple generic types and you want to indicate their purpose, like Dictionary<TKey, TValue>
Answer: Yes, they are the same. When writing generics, you get to name the type placeholders anything you want, just like a variable or class name.
Different projects or organizations may follow different conventions. T is the most common for generics with a single type, and single-letter mnemonics are common for generics with multiple types, but you also sometimes see a T followed by the name, such as TItem.


Cannot start sql server under domain user

Question: I am doing a double hop kerberos authentication from my iis to my sql server and for that I need the SQLEXPRESS service to run under a domain user.
Domain name: domain.test
service user: sqlSrv
sql server computer name : SQL
When I try to start the service this is the error I get:
Windows Could not start the SQL Server (SQLEXPRESS) on Local Computer.
For more information, review the System Event Log.
If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 17058.

The error I see in the Event Log is:
initerrlog: Could not open error log file 'c:\Program Files\Microsoft SQL Server\MSSQ.1\MSSQL\LOG\ERRORLOG'.
Operating System error = 5 (Access is denied).
Source: MSSQL$SQLEXPRESS
Event ID: 17058

I've set up the following SPNs:
setspn -L domain.test\sqlSrv
setspn -A SQLEXPRESS/SQL:1433 domain.test\sqlSrv
setspn -A SQLEXPRESS/SQL.domain.test:1433 domain.test\sqlSrv

Answer: initerrlog: Could not open error log file 'c:\Program Files\Microsoft SQL Server\MSSQ.1\MSSQL\LOG\ERRORLOG'.
Operating System error = 5 (Access is denied).

Obviously you just replaced the service account on an existing installation. This is not supported. You need to install the service from scratch, using the desired service account.
While theoretically you could go through Configure Windows Service Accounts and Permissions and figure out what permissions are needed (in fact, figure out what local groups the service account needs to be member of), that would assume that you know what the heck you're doing.
Do it by the book. Install the service to use the desired service account. Read and follow Install SQL Server 2014 from the Command Prompt. The service account install command line parameters are described here:

SQL Server Database Engine:

Service account: /SQLSVCACCOUNT
Accountpassword: /SQLSVCPASSWORD
Answer: I had this problem when I wanted to start sqlserver service.The event viewer showed this message as you mentioned.I did my best to set permission unfortunately it did not work for me.The problem was related to "ERROLOG",its size was about 1G and it there was not the file name such as "ERRORLOG.1,ERROLLOG.2,..", so I deleted after making backup of it.at the problem disappeared.
I hope it is functional for you.


How to get Bootstrap Jumbotron not to lose its height without showing the white space when testing in a browser

Question: I'm having an issue with my jumbotron not scaling properly when i'm trying to test my website. My height changes every time I adjust the size of the browser, which cause it to show the white space. Is there a way to set the height for the jumbotron without showing the white space?
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>The Portfolio of Jason Murray</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <link id="orginal" href="css/default-theme.css" rel="stylesheet">

    <link href="css/style.css" rel="stylesheet">

    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Varela' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>

            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
              Toggle navigation

            </button>

            JasonMurray

Home

About

Portfolio

Contact

Front-End

Web Developer

Hi, I'm Jason Murray and I have a passion for building simplistic websites.

                Recent Work

© 2015 Jason Murray Web Design. All Rights Reserved

CSS:
body,html{
  overflow-x:hidden;
}
html{
  height: 100%;
}
body {
 font-family: 'Open Sans', sans-serif;
  overflow-x: hidden !important;
}

ul{
  padding: 0;
  margin: 0;
  list-style: none;
}

a{
  text-decoration: none;
  color: #2f2f2f;

}
a:focus{
  outline: none;
  text-decoration: none;
}
h1,h2{
    font-family: 'Montserrat', sans-serif;
}
h3,h4,h5,h6{
    font-family: 'Varela', sans-serif;
}

h2 {
  color: #313338;
  font-size: 72px;
  font-weight: 700;
  line-height: 57px;
  margin: 0;
  padding-bottom: 10px;
  text-transform: uppercase;
}
img{
 border:none;
}

/*--------------------*/
/* HEADER */
/*--------------------*/

#header{
  float: left;
  display: inline;
  width: 100%;
  position: relative;
}

/*--------.menu_area-------- */
.menu_area{
  position: absolute;
  left:0;
  right: 0;
  top: 0;
}
.navbar-default {
  background-color: #000000;
  border-color: transparent;
  padding: 12px 0px;
}
.past-main {
  background-color: rgba(0,0,0,0.8);
  margin-top: 0px;
  padding:6px 0px;
  -webkit-transition: all 0.5s ease 0s;
  -o-transition: all 0.5s ease 0s;
  transition: all 0.5s ease 0s;

}
#navbar{overflow-x: hidden;}

.navbar-brand {
  color: #fff !important;
  font-size: 20px;
  font-weight: bolder;
  font-family: 'Varela', sans-serif;
}
.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus {
  background-color: transparent;
}
.navbar-default .navbar-nav > li > a {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}
.navbar-default .navbar-nav > li > a:hover{
  text-transform: uppercase;
  color: #2da2c8;
}
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
  background-color: transparent;
  color: #2da2c8;
}
.navbar-brand > span {
  color: #2da2c8;
}
.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus {
  color: #2da2c8;
}

/*---------------------*/
/* MAIN CONTENT - HOME */
/*---------------------*/
.jumbotron {
  background: url("../img/lucho-49.jpg") no-repeat center center;
  -webkit-background-size: 100% 100%
  -moz-background-size: 100% 100%;
  -o-background-size: 100% 100%;
  background-size: 100% 100%;
  margin-top: 75px;
  height: 305px;
}
.image_opacity{
  background: none repeat scroll 0 0 #242434;
  margin-top: 75px;
  opacity: 0.8;
  position: absolute;
  right: 0;
  top: 0;
  width: 100%;
  height: 305px;
  z-index: 9;
}
.caption {
  margin-top: 17%;
  padding: 5px 0;
  position: relative;
  text-align: center;
  z-index: 999;
}
.caption > h2 {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  line-height: 12px;
  margin: 0 auto 10px;
  padding-bottom: 8px;
  text-align: center;
  text-transform: uppercase;
  width: 90%;
}
.caption>p{
    color: #ffffff;
    font-size: 12px;
}
.caption_btn{
    padding: 10px 15px;
    border: 2px solid #fff;
    color: #fff;
    font-size: 12px;
    display: inline-block;
    text-transform: uppercase;
}
.caption_btn:hover,.caption_btn:focus{
    border-color:#2da2c8;
    color: #2da2c8;
    text-decoration: none;
}

/*----------------------*/
/* MAIN CONTENT - ABOUT */
/*----------------------*/

#about {
  display: inline;
  float: left;
  width: 100%;
  padding: 80px 0px;
}
.about_area{
  float: left;
  display: inline;
  margin-bottom: 140px;
  width: 100%;
  min-height: 200px;
}
.heading{
  float: left;
  display: inline;
  width: 100%;
}
.heading h2 {
  display: inline-block;
  margin-bottom: 35px;
  margin-top: 65px;
  padding-bottom: 15px;
  padding-right: 50px;
  font-size: 40px;
  line-height: 40px;
}
.heading p{
  font-size: 16px;
  line-height: 28px;
  font-weight: 300;
}
.about_content{
  float: left;
  display: inline;
  width: 100%;
  padding: 50px 0px;
}
.about_featured{
  float: left;
  display: inline;
  width: 100%;
}
.panel-group .panel {
  border-radius: 0;
  margin-bottom: 0px;
  box-shadow: none;
}
.panel-group .panel + .panel {
  margin-top: 0;
}
.panel-default {
  border-color: transparent;
}
.panel-default > .panel-heading {
  background-color: transparent;
  color: #333;
  border: 0 none !important;
  padding: 5px 15px;
}
.panel-title {
  border-bottom: 1px solid #ccc;
  color: #222;
  font-family: 'Varela', sans-serif;
  font-size: 20px;
  font-weight: 400;
  text-transform: uppercase;
  -webkit-transition: all 0.5s;
  -o-transition: all 0.5s;
  transition: all 0.5s;
}
.panel-title a {
  display: block;
  text-decoration: none;
  padding-bottom: 10px;
}
.panel-default .in{
  padding-left:10px;
  margin-left: 20px;
  -webkit-transition: all 0.5s;
  -o-transition: all 0.5s;
  transition: all 0.5s;
}
.panel-title a span{
  margin-right: 5px;
}
.panel-body {
  border-top-color: transparent !important;
  padding: 0px 15px;
  margin: 10px 0px;
}
.about_slider{
  float: left;
  display: inline;
  width: 100%;
  height: 350px;
}
.single_iteam{
  float: left;
  display: inline;
  width: 100%;
  height:100%;
}
.single_iteam img {
  max-width: 100%;
}
.about_slider .slick-dots li button:before {
  content: "•";
  font-size: 28px;
}
.about_slider .slick-dots li.slick-active button:before {
  opacity: 0.75;
}
.skills_area{
  background-color: #fff
  float: left;
  display: inline;
  width: 100%;
  min-height: 350px;
  padding: 85px 0px;
  position: relative;
}
.skills{
  position: relative;
  z-index: 999;
}
.heading h3 {
  color: #000;
  display: inline-block;
  float: left;
  font-size: 40px;
  margin: 0 0 40px;
  padding-bottom: 10px;
  text-transform: uppercase;
  font-weight: bold;
  line-height: 40px;
}
div[data-dimension] {
  float: none;
  margin: 0 auto;
}
.circle-text{
  color: #000;
}
.single_skill{
  float: left;
  display: block;
  width: 100%;
  text-align: center;
}
.single_skill > h4 {
  color: #000000;
  font-size: 20px;
  font-weight: bold;
}

/*--------------------------*/
/* MAIN CONTENT - PORTFOLIO */
/*--------------------------*/

/*------------------------*/
/* MAIN CONTENT - CONTACT */
/*------------------------*/

/*--------------------*/
/* FOOTER */
/*--------------------*/

#footer{
  position: absolute;
  left: 0;
  bottom: 0;
  height: 100px;
  width: 100%;
  background-color: #000;
}
.footer_left{
  float: left;
  display: inline;
  width: 100%;
}
.footer_left > p {
  font-size: 12px;
  text-align: center;
  color: #ffffff;
  margin-bottom: 5px;
  margin-top: 5px;
}
.footer_left > p a {
  font-weight: bold;
}
.footer_right{
  float: left;
  display: inline;
  width: 100%;
}
.social_nav{
  text-align: center;
}
.social_nav li{
  display: inline-block;
}
.social_nav li a {
  border: 1px solid #fff;
  color: #ffffff;
  display: inline-block;
  font-size: 18px;
  height: 30px;
  margin-left: 5px;
  text-align: center;
  width: 35px;
  line-height: 28px;
  -webkit-transition: all 0.5s;
  -o-transition: all 0.5s;
  transition: all 0.5s;
}
.social_nav li a:hover{
  color: #2da2c8;
  border-color: #2da2c8;
}

/*----------------------------------*/
/* RESPONSIVE STYLE - MEDIA QUERIES */
/*----------------------------------*/

/* Landscape phones and portrait tablets */
@media(min-width: 481px) and (max-width: 767px) {
.navbar-brand {color: #fff !important;font-size: 26px;font-weight: bolder;font-family: 'Varela', sans-serif;}
.navbar-default .navbar-nav > li > a {font-size: 12px;}
.jumbotron {background: url("../img/lucho-49.jpg") no-repeat center center;-webkit-background-size: 100% 100%;-moz-background-size: 100% 100%;-o-background-size: 100% 100%;background-size: 100% 100%;height: 592px;}
.image_opacity{background: none repeat scroll 0 0 #242434;margin-top: 75px;height: 592px;opacity: 0.8;width: 100%;}
.caption {margin-top: 40%;position: relative;text-align: center;z-index: 999;}
.caption > h2 {color: #ffffff;font-size: 25px;font-weight: 700;line-height: 20px;margin: 0 auto 10px;padding-bottom: 8px;text-align: center;text-transform: uppercase;width: 90%;}
.caption> p {color: #ffffff;font-size: 14px;}
.caption_btn{padding: 10px 15px;border: 2px solid #fff;color: #fff;font-size: 14px;display: inline-block;text-transform: uppercase;}
.caption_btn:hover,.caption_btn:focus {border-color:#2da2c8;color: #2da2c8;text-decoration: none;}
#footer{padding: 24px;}
#footer > .container > .row {margin-right: auto;}
.footer_left > p {font-size: 12px;text-align: center;}
.social_nav{text-align: center;}
}
/* Portrait tablets and small desktops */
@media(min-width: 768px) and (max-width: 991px) {
.navbar-brand {color: #fff !important;font-size: 30px;font-weight: bolder;font-family: 'Varela', sans-serif;}
.navbar-default .navbar-nav > li > a {font-size: 13px;}
.jumbotron {background: url("../img/lucho-49.jpg") no-repeat center center;-webkit-background-size: 100% 100%;-moz-background-size: 100% 100%;-o-background-size: 100% 100%;background-size: 100% 100%;height: 816px;}
.image_opacity{background: none repeat scroll 0 0 #242434;margin-top: 75px;height: 816px;opacity: 0.8;width: 100%;}
.caption {margin-top: 28%;position: relative;text-align: center;z-index: 999;}
.caption > h2 {color: #ffffff;font-size: 45px;font-weight: 700;line-height: 56px;margin: 0 auto 10px;padding-bottom: 8px;text-align: center;text-transform: uppercase;width: 90%;}
.caption> p {color: #ffffff;font-size: 18px;}
.caption_btn{padding: 10px 15px;border: 2px solid #fff;color: #fff;font-size: 18px;display: inline-block;text-transform: uppercase;}
.caption_btn:hover,.caption_btn:focus {border-color:#2da2c8;color: #2da2c8;text-decoration: none;}
#footer{padding: 35px;}
#footer > .container {margin-left:-15px;margin-right:-15px;}
.footer_left > p {font-size: 13px;text-align: left;}
#footer .row {margin-left: -26px;}
.social_nav{text-align: right;margin-right: 12px;}
}

/* Landscape tablets and medium desktops */
@media (min-width: 992px) and (max-width: 1199px) {
.navbar-brand {color: #fff !important;font-size: 33px;font-weight: bolder;font-family: 'Varela', sans-serif;}
.container > .navbar-header {margin-left:8px;}
.navbar-default .navbar-nav > li > a {font-size: 14px;}
.navbar-right {margin-right:0px;}
.jumbotron {background: url("../img/lucho-49.jpg") no-repeat center center;-webkit-background-size: 100% 100%;-moz-background-size: 100% 100%;-o-background-size: 100% 100%;background-size: 100% 100%;height: 1024px;}
.image_opacity{background: none repeat scroll 0 0 #242434;margin-top: 75px;height: 1024px;opacity: 0.8;width: 100%;}
.caption {margin-top: 32%;position: relative;text-align: center;z-index: 999;}
.caption > h2 {color: #ffffff;font-size: 55px;font-weight: 700;line-height: 66px;margin: 0 auto 10px;padding-bottom: 8px;text-align: center;text-transform: uppercase;width: 90%;}
.caption> p {color: #ffffff;font-size: 19px;}
.caption_btn{padding: 10px 15px;border: 2px solid #fff;color: #fff;font-size: 18px;display: inline-block;text-transform: uppercase;}
.caption_btn:hover,.caption_btn:focus {border-color:#2da2c8;color: #2da2c8;text-decoration: none;}
#footer{padding: 35px;}
#footer > .container {margin-left:-15px;margin-right:-15px;}
.footer_left > p {font-size: 14px;text-align: left;}
.social_nav{text-align: right;margin-right: 18px;}
}

/* Large desktops and laptops */
@media(min-width: 1200px) {
.navbar-brand {color: #fff !important;font-size: 35px;font-weight: bolder;font-family: 'Varela', sans-serif;}
.navbar-default .navbar-nav > li > a {font-size: 15px;}
.jumbotron {background: url("../img/lucho-49.jpg") no-repeat center center;-webkit-background-size: 100% 100%;-moz-background-size: 100% 100%;-o-background-size: 100% 100%;background-size: 100% 100%;height: 740px;}
.image_opacity {background: none repeat scroll 0 0 #242434;margin-top: 75px;height: 740px;opacity: 0.8;width: 100%;}
.caption {margin-top: 10%;position: relative;text-align: center;z-index: 999;}
.caption > h2 {color: #ffffff;font-size: 65px;font-weight: 700;line-height: 76px;margin: 0 auto 10px;padding-bottom: 8px;text-align: center;text-transform: uppercase;width: 90%;}
.caption > p {color: #ffffff;font-size: 20px;}
.caption_btn {padding: 10px 15px;border: 2px solid #fff;color: #fff;font-size: 20px;display: inline-block;text-transform: uppercase;}
.caption_btn:hover,.caption_btn:focus {border-color:#2da2c8;color: #2da2c8;text-decoration: none;}
#footer{padding: 35px;}
.footer_left > p {font-size: 15px;text-align: left;}
.social_nav{text-align: right;}
}

Answer: I'd go for a different approach. The problem is, you've got fixed heights on your jumbotron and your image_opacity. A far more easy approach is putting a faux-gradient on the jumbotron, like this:
.jumbotron {
  background-image:
      linear-gradient(rgba(249, 249, 249, 0.9), rgba(249, 249, 249, 0.9)),
      url("../img/lucho-49.jpg") no-repeat center center;
  background-size: 100% auto;
  margin-top: 75px;
  height: 400px;
  position: relative;
}

And then you don't need the image_opacity. Oh and I didn't check this thoroughly, but -webkit-, -moz-, and -o-background-size are imho non-existent.
Edit 2: set the parent div and the jumbotron to a height of 100% (in this case, that's body):
html, body {
    height: 100%;
}
.jumbotron {
     background-image:
          linear-gradient(rgba(249, 249, 249, 0.9), rgba(249, 249, 249, 0.9)),
          url("../img/lucho-49.jpg") no-repeat center center;
     background-size: 100% 100%;
     margin-bottom: 0px;
     height: 100%;
}

Bootply (in this example the page is wrapped in a #wrap element, so this has to be height:100%;, too.)
This should do the trick. Try to put !important after the properties if it's not working immediately.
Comment: Have you used rgba? It works fine here. I'll edit my answer focussing on the height issue.
Comment: Yep! When I preview the site in the browser, the background image shows but not the rgba. Also, I tried it and it didn't work. I think its something to do with how I set my media queries breakpoints because when I scale the browser from min-width 1200px (desktop) to 320px (mobile), it i lose the height. Here is my media queries setting. https://jsfiddle.net/xhcr3sjm/
Comment: I edited my answer. You should make the parent (body) 100%.


Why does Providesupport Chat Console not produce event sounds?

Question: I am using Providesupport Chat Console from providesupport.com on ubuntu 12.10.
First of all, it crashes sometime :( but thats okay.
The real problem is: It is not producing event sounds. It says supported playback system is not available.
Comment: Thank your Mordoc, Just after a smoke, I tried to use their windows version with wine. guess what! It rocks :p
Comment: Can I suggest that you start with this previous question/response: http://askubuntu.com/questions/75732/sound-does-not-work?rq=1
Comment: Hello Mordoc, Sound is working fine for websites, youtube, totem, vlc, ubuntu own sounds, etc.
Comment: I notice that their Linux support page references some pretty old versions of Linux. Could it be possible that it is looking for the OSS sound drivers? It appears that they have been deprecated: https://help.ubuntu.com/community/OpenSound. You could use ProvideSupport's web console which might be as functional...
Comment: Their web console does not allow me to put away :(
Comment: Is it possible if I get the functionality in 12.10 which they are looking for? Like decoupling puleaudio and install their required sound framework such as ALSA or Gstreamer
Comment: Apparently you can at the expense of a possibly hobbled sound system on Linux. Can't really blame Ubuntu for this, OSS has passed out of use some time ago.
Answer: To those looking for solution:
Simply install playonlinux from software center.
download the windows executable and run it. it works like a charm and sound works great as well as pop ups.
The only issue I face now is your backspace key and arrow keys. Enter also does not send message and you have to press send button manually.
Work around:

Right client on providesupport desktop icon (shortcut) and click on properties.
add this in command: XMODIFIERS=''

Make sure it is single colon two times after =


duplicate columns when using join

Question: I am trying to join two tables: trainSearchStream and SearchInfo based on a common column: SearchID.
SELECT *
FROM   trainSearchStream
       INNER JOIN SearchInfo
               ON trainSearchStream.SearchID = SearchInfo.SearchID
LIMIT  3;

The problem is that the result has two columns for SearchID. How can I display only one column for SearchID?
These are the columns of trainSearchStream:
SearchID,AdID,Position,ObjectType,HistCTR,IsClick

and these are columns for SearchInfo:
 SearchDate,IPID,UserID,IsUserLoggedOn,SearchQuery,LocationID,CategoryID,SearchParams

My other question is that how can I save the result of my select statement in a new table?
Comment: @MAS In the future, please only tag the database software you are using.
Comment: can you post a sample output?
Comment: Which database are you using? MySQL or SQLite?
Comment: Sqlite3 @ColonelThirtyTwo
Answer: Ditch the * in the SELECT list and give a specific list of columns to return.
  SELECT t.SearchID
       , t.AdID
       , t.Position
       , t.ObjectType
       , t.HistCTR
       , t.IsClick
       , i.SearchDate
       , i.IPID
       , i.UserID
       , i.IsUserLoggedOn
       , i.SearchQuery
       , i.LocationID
       , i.CategoryID
       , i.SearchParams
    FROM trainSearchStream t
    JOIN SearchInfo i
      ON t.SearchID = i..SearchID
   LIMIT 3;

To "save" the result from that in another table, you can use an INSERT ... SELECT statemeent.  If you want to create a new table, you can use a CREATE TABLE ... SELECT statement.
References:
INSERT ... SELECT https://dev.mysql.com/doc/refman/5.5/en/insert-select.html
CREATE TABLE ... SELECT https://dev.mysql.com/doc/refman/5.5/en/create-table-select.html
Comment: Also note: best practice is to qualify *all* column references with the table name  (or an a table alias), as shown in the example query. This avoids your statement from throwing an "ambiguous column reference" error in the future, if someone were to add a column to a table, e.g. adding `UserID` column to the `trainSearchStream` table. With column references qualified, the statement will continue to work. If a reference to `UserID` is not qualified, then the statement that was working will start throwing an error.
Answer: Specify exactly the columns you want to see. This always the preferred way
SELECT
t.SearchID,AdID,Position,ObjectType,HistCTR,IsClick,
SearchDate, IPID,UserID,IsUserLoggedOn,SearchQuery,LocationID,CategoryID,SearchParams
FROM trainSearchStream  t
INNER JOIN SearchInfo ON trainSearchStream.SearchID = SearchInfo.SearchID LIMIT 3;

Edit
I forgot to include the alias name and apply that to column SearchId.
Comment: I get Error: ambiguous column name: SearchID

duplicate columns when using join


Play intro from large collection of songs

Question: I'm hoping to find a way to go through a large music collection to find a particular song.
However I do not know the title of the song, artist or album. I was hoping to find an audio player that has a 'play intro' feature, but I've looked at Clementine, Gnome, GMMP, VLC and Audacious but can't find such a feature.
Is it possible to write a script if no music player does this? I'm using Lubuntu 14.04 - the default music player is Audacious
Answer: This is pretty easy with a simple shell script. By "intro" I've decided 15 seconds is a good time - you can change this of course.
It also assumes all the songs are MP3 files, if they're not remove the .mp3 sections.
Finally, change ~/Music to wherever the songs are saved - e.g. on an external hard drive would be /media/username/hddname/foldername
intro=15 # Change this to change the played time.

for filename in ~/Music/*.mp3 ~/Music/**/*.mp3; do  # Remove .mp3 to change type.
    audacious -H "$filename" &
    echo "$filename"
    sleep $intro
    audacious -s
done

Simply paste this into Leafpad (or your chosen editor) and save it in your home area with a .sh extension.
Then run these commands, changing filename.sh for what you named it.
chmod +x filename.sh
./filename.sh

The first sets it to be allowed to run, the second will run it. Note that it won't open the window because of the -H option. This is because you are on Lubuntu, and are unlikely to have much memory.
This script will print our the name of the file when it starts to play it, so you know what you are listening to.
Comment: wow thnkas for the quick reply and the great for the script. 15 secs should be fine and can always change as you say. copied in to leafpad but not certain what you mean by saving it in home area. assumed in my home folder parent and it's listed below downloads, documents, videos etc... ran the two commands you gave and yes got the 'unknown -H option'. however audacious did open but with out playing any music. as far as i can see the first songs to be played in the music folder are mp3's so don't know what is up.
Comment: @flyaway hmm okay run without the -H ? so edit the script and then run it again. Yes, home area is along side your documents. Are your songs all in Music, not in a folder inside music?
Comment: that could be it. the songs are in different folders depending on the aritst/album etc
Comment: all the files i want to use are actually on an external hard drive. sorry forgot to mention this. i was first trying your script on the music on the internal HD. assuming its the folder within a folder issue, is the way round that? the music folder on the external also has folders within folders... and i just change the path name in your the first line ' filename in ~/Music/*.mp3; do'  to the appropriate one to get to the music folder on my hard drive right? thanks again for you time with this. i'm fairly new to linux so this help is much appreciated
Comment: @flyaway yeah, so you need to change it to be the correct path (I guess something in `/media`, you can find it out by opening the file in your file manager and pressing Ctrl + L (it will highlight the location). That's the thing to change `~/Music` for. Then see my edit for the folders inside folders thing.
Comment: i just keep getting 'no decoder found' messages. change the path to a specific folder of mp3 only music files and got the same thing. will have to leave it for this evening. and try again tomorrow. cheers
Comment: @flyaway try installing `audacious-plugins-freeworld-mp3`
Comment: ran sudo apt-get install for abouve package, got unable to locate message. thought to move this to a chat as you're being brilliant but its a bit long winded. then it even suggested automatically moving this discussion to a chat. only when i tried it informed i didn't have high enough reputation...
Comment: @flyaway what other sound programs do you have? You could change it for `vlc` - remove the `-H` and  the `audacious -s` line completely.


compare each item in list with another item in another list

Question: I have 2 list of double
List<double> numbers1 = [1,3,5,6,4.5,2.1,.......];
List<double> numbers2 = [.5,3.2,5.4,6,4.5,2.1,.......];

I want to compare [1] in list1 whith [.5] in list 2
if([1] close to[.5]) for example
which means if the first item value in fisrst list close to the first item value in second list
and etc, the second with second, third with third
How can I do this c#?
Comment: Rephrase/Edit your question and explain how you want to compare ... and what if list 1 has more numbers then list 2 ?
Comment: What's the expected return?
Answer: Simply check for the difference between two related items using Math.Abs:
bool allElementsClose = true;
for(int i = 0; i < lis1.Count && allElementsClose; i++)
{
    if(Math.Abs(list1[i] - list2[i]) > threshold)
    {
        Console.WiteLine("items not close");
        allElementsClose = false;
        break;
    }
}

You should however make some checks on the number of items before iterating.
Alternative approach using LINQ:
var allElementsClose = list1
    .Select((x, i) => Math.Abs(x - list2[i]))
    .All(x => x < threashhold);

This approach uses the overload of select that uses a Func<T, int> for getting the element and its index within the collection. This index can then be used to get the appropriate item in the second list and calculate the difference to it.
Comment: list1 does have to have `i` as indexer to
Comment: `int i = i` > i is not instantiated, so i guess you mean `int i = 0`
Answer: Simplest solution would be using Zip, which is meant for comparison of each mapping element of two collections and will also take care of difference in number of elements, as it checks the Enumerator.MoveNext() internally
var result = numbers1.Zip(numbers2,(n1,n2) => n1 - n2 < 0.5 ? "Close" : "Not Close");

result would IEnumerable<string> consisting of values "Close" and "Not Close"
Caveat:

Your question has good number of details missing, as I am not sure what is "Close" and what is "Not Close", I have assumed less than 0.5 difference between two numbers is close, modify as per requirement
Comment: Cool solution, didn´t know this method existed.
Comment: @HimBromBeere :), many such gems exist in Linq, infact many known APIs have interesting overloads to achieve the result
Answer: Actually it depends on what "close" means for you.
I will assume that if the difference between the numbers is less than 1, it is close.
So the code will be really simple
I will create 3 lists.
list1, list2, listResult (which will only contain Boolean values, that indicates whether the item in list1 is close to the item in list2.
var list1 = new List<float>();
var list2 = new List<float>();
var listResult = new List<bool>();

The 3 lines above, should go outside the method or event, like button1_click.
//to add values to the list you can use list1.addNew(5) and it will add the "5" to the list

void CompareLists(){
    //first of all we check if list1 and list2 have the same number of items
    if(list1.Count == list2.Count){
        for (int i=0; i<list1.Count; i++){
            if (list1[i] - list2[i] < 1)
               listResult.addNew(true);
            else
               listResult.addNew(false);
        }
    }
}

Now you have a list of boolens like
[true],[true],[false]
Hope, it works for you.
Answer: In .Net 4.0 you also have Zip() available:
var numbers1 = new List<double>() { 1, 3, 5, 6, 4.5, 2.1 };
var numbers2 = new List<double>() { 0.5, 3.2, 5.4, 6, 4.5, 2.1 };

var allElementsClose = numbers1
    .Zip(numbers2, (i1, i2) => Math.Abs(i1 - i2))
    .All(x => x < threshold);


How do I remove something from an array list when looping through it in java?

Question: I have an arraylist like this:
ArrayList<Integer> numbers = new ArrayList<Integer>();

And let's say the values inside are like:
[0,1,2,3,4,5]

So I'm looping through and I want to remove values from the arraylist while I'm looping through:
for(int i=0; i<numbers.size();i++){
    if(numbers.get(i)>2){
    numbers.remove(i);
    }
}

How would I do this?
Comment: I'd say the exact opposite: removing elements becomes much less efficient on huge lists;  it depends on n^2 while creating a list is n.
Comment: I would consider creating a new list (copy) containing only the wanted values. It is so much safer. Of course, unless the list is very, very huge.
Answer: You can call numbers.remove(i) and then decrement i to follow the change in the position within the list: numbers.remove(i); i--;.
If you use iterators, foreach or the : operator you can't remove values, because they use unmodifiable lists.
If you have a simple way of determining whether a number should be removed, you can use numbers.removeIf((number)->number>2) (like the problem in your example).
Comment: thank you so much! that i--; call was genius! I'm glad I posted a new question. thanks for posting an answer (a different and much better one) instead of referring me to the other one


PHP script for calculating Krippendorff's Alpha

Question: I can't find any PHP script to compute Krippendorff's Alpha. I need this for a project I'm working on, but the only things that I was able to find online are either written in Python (that I know nothing of) or are for SAS/SPSS software suites.
Any help is appreciated.
Thanks!
Answer: PHP and Perl syntax are quite similar. Here's the Perl script from the ALPHA resource page. I am sure you know how to convert the for loops/etc in Perl to PHP. If you are unsure about the syntax, search the Perl docs or internet and find the equivalent in PHP. You should be able to develop an equivalent PHP script by looking at the sample Perl one.
Comment: Thanks! That's where I got the other scripts but I simply overlooked the perl script. I'll look into it.
Answer: You can use this class. I used it worked
https://github.com/wikimedia/wikimedia-discovery-discernatron/blob/master/src/RelevanceScoring/KrippendorffAlpha.php
Answer: This is my javascript library for Krippendorff's Alpha. The detail instruction could be found in README.md. Hope it could help.


collect2: error: ld returned 1 exit status in c++

Question: I have just switched to elementary os and installed sublime text editor. i wrote a basic hello world program in c++ to check the working. And I get this error.
/tmp/cc3Pmvft.o: In function `main':
source.cpp:(.text+0xa): undefined reference to `std::cout'
source.cpp:(.text+0xf): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<<  <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
source.cpp:(.text+0x14): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
source.cpp:(.text+0x1c): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/tmp/cc3Pmvft.o: In function `__static_initialization_and_destruction_0(int, int)':
source.cpp:(.text+0x4a): undefined reference to `std::ios_base::Init::Init()'
source.cpp:(.text+0x59): undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status

The hello world program was,
#include <iostream>
using namespace std;

int main(){
     cout << "Hello World!" << endl;
     return 0;
}

I have  searched for answer in google and stackoverflow but couldn't find a solution.
Comment: _"I have searched for answer in google and stackoverflow but couldn't find a solution."_ Really? I recall this having been asked many many times.
Answer: You should compile it with C++ compiler, not C, g++ for example.
Instead of this
gcc source.cpp

do this
g++ source.cpp


How to dynamically set a checkbox's ID attribute in a jQuery DataTable

Question: I have a DataTables table populated with JSON data returned from a Java servlet. Each row in the table has a checkbox. I have code that can add a check to every checkbox but I need to figure out how to evaluate the value of a specific field in the JSON and, if the criteria is met, check the box. I'm open to any way that will work. So far I have been trying to set each checkbox's ID attribute when the table is instantiated. The idea is that my code would look at the ID value of every checkbox and check only those that equal a specific value. I would like to know if it's possible to set the ID attribute equal to the value of a specific field in the JSON. An abbreviated version of the JSON looks like this. Note that it contains a "status" field. I'd like to set the ID equal to the status value.

{"data":[{"date":"20180101","status":"Incomplete","total_files":22,"total_size":16896},{"date":"20180102","status":"Complete","total_files":24,"total_size":19968,"itws":"itws","itws_count":24,"itws_status":"Complete"}]}

Here is a snippet of my DataTables instantiation code.

$(document).ready(function () {
                var table = $('#search_results').DataTable({
                        searching: false,
                        paging: false,
                    "ajax": {
                        url: "http://localhost:8080/FileSearch-1/FileSearch"+servletUrl+"&startDate="+startDateVal+"&endDate="+endDateVal+"&startTime="+startTimeVal+"&endTime="+endTimeVal,
                        method: "GET",
                        xhrFields: {
                            withCredentials: true
                        }
                    },
                    "columns": [
                        {
                        "className": "details-control",
                        "orderable": "false",
                        "data": "null",
                        "defaultContent": '',
                        "render": function () {
                            return '';
                        },
                        "width":"15px"
                        },
                        { "render": function () {
                                return '<input type="checkbox" id="status" name="oneDay">';
                            }
                        },
                        { "data": "date" },
                        { "data": "status" },
                        { "data": "total_files" },
                        { "data": "total_size" }
                    ],
                    "order": [[1, 'asc']]
                });

Is it possible to set the checkbox's ID attribute to the value of the status field in the JSON? For example, if the status field is "Complete" then the checkbox's ID would be set to "Complete."
I've tried doing things like

return '<input type="checkbox" id="'+status+'" name="oneDay">';

...in which case the table will render correctly but the value of ID will remain blank.

return '<input type="checkbox" id="'+data:status+'" name="oneDay">';

...in which case it won't render at all and produces a JavaScript error that states the : is an unexpected token.
Comment: Voting to close as *"too broad"*. Basic reading of the plugin documentation should be done.
Comment: An `id` is an identification... That **has to be unique** like your driver's licence id number. It **not** the place to dynamically set a value. Use a [data](https://api.jquery.com/data/) attribute instead. -- Furthermore, [datatables](https://datatables.net/) creates dynamical elements on each [`draw()`](https://datatables.net/reference/api/draw()). You just can't modify DOM elements like this when an intance is active on them.
Comment: @Louys Good point about using .data() instead of the Id, I will include that going forward. However, it doesn't address the question which is actually not too broad but pretty specific. After more elbow grease I figured it out. I'll post the answer.
Answer: The value of an element's attribute, whether it's the name, Id, or a custom data attribute can indeed be set to the value of an element in the JSON. Here is how I did it.
Here is my old code.

"render": function () {
                            return '';
                        },

The new code includes two changes. There is a new line above the line that creates the checkbox. And the syntax to set the value of the attribute has been changed.

data: 'status',
                        "render": function (data, type, row) {
                                return '<input type="checkbox" data-status="'+data+'" id="'+data+'" name="oneDay">';
                            }

I added the "data-status" attribute per Louy's suggestion and will try to use that in lieu of the Id attribute going forward. The result of the new code is that the value of the Id and data-status attributes get set to the value of the "status" field in the JSON.


animating GIF on draggable(): jquery

Question: I'm looking to utilize jQuery's UI plugin to create draggable() and droppable() behavior similar to this jsfiddle. The only difference; I would like the shopping cart to play through an animation when draggable() is activated to make it more obvious to the user where they can drop their items.
However, the animation I require can not be accomplished via CSS, it is an animation of the image itself. I have both a GIF of the animation and also the equivalent sequence of JPEGs, whichever works best. What's the most elegant way to accomplish this?
FYI: The code is sourced from an IBM developerWorks article by Michael Abernethy
Answer: You could add a callback for the draggable's start event to change the src attribute of your cart image and then a stop callback to change it back.
Live example: http://jsfiddle.net/ambiguous/yM9s5/6/
Another approach is this:

Replace your  drop target with a
.
Size the
 through CSS to match the .
Add a background image to the
 to match the visual effect of the .
Add a background-image to your border class and set that image to your animated GIF.

For example: http://jsfiddle.net/ambiguous/yM9s5/5/
That should work with an animated GIF but I don't have one handy to check.
Comment: For your first method - as I mentioned, I need to play through a _sequence_ of images, this is the kicker...Flipping from one to another is easily accomplished. Your second method is similar in that when using an image not in the GIF format, it is the transition from only one image to another. It does not meet the needs of N number of images. Secondly, when a GIF is used as the background image of the div, it will play through the GIF in perpetuity. I require it to play **only once** and end on the last frame. Any ideas?
Comment: @Jordan: Use an animated GIF that has its "play once" flag turned on. You should be able to convert your sequence of images to a single animated GIF without too much difficulty so you only need one image.
Comment: I did not know that GIFs could have a "play once" flag enabled. I was able to create a non-looping GIF in Photoshop by following [a youtube video](http://www.youtube.com/watch?v=HXW2vlNu5Rs). Having a mouseover() fire the animation was as simple as an attr("src") swap. Thank you.
Comment: @Jordan: I had to check the flag to make sure I was remembering the right thing, found the same video :)

animating GIF on draggable(): jquery


UI Grid Custom Checkbox styling

Question: I am attempting to do some styling with the checkboxes in UI-Grid and it doesn't seem to be working properly. Notice the checkbox is still appearing underneath my styling overlay, and clicking on the 3rd checkbox seems to activate the overlay checkbox style.
Is there any way to replace the checkbox appearing in the column with my overlay and use that instead? Or does anyone have an idea to get this working properly?
http://plnkr.co/edit/fMMq71849pxE0NLcfuVJ
cellTemplate: '
' +
                                         '  <input type="checkbox" class= "Check" id="Check" name="select_item" value = "true" ng-model="row.entity.ValidateProvider"/>' +
                                         '  ' +
                                         '
'

I want to get them looking like the 4th from the top on this site:
http://cssdeck.com/labs/css-checkbox-styles
Answer: There is no easy way to do that.
In UI Grid, we usually uses blur event of HTML input control to end cell edit, which should be the best user experience. However currently there is no suitable CSS support to style custom checkbox, and to properly dispatch blur event at the same time. In the example mentioned, you can see the css rule to make `blur' impossible:
input[type=checkbox] { visibility: hidden; }

There is a non-standard css property appearance to use, which can work at this time, instead of visibility and others, but needs careful test on browsers. No support on any IE.
Also, editableCellTemplate should be used rather than cellTemplate for edit.

UI Grid Custom Checkbox styling


Polymorphic behavior in django's Admin

Question: The problem
Suppose I have three classes A, B and C, where B is a subclass of A and C is a subclass of B:
A <- B <- C

When I open up the admin and list all "A"s, I see all "A"s, "B"s and "C"s. But when I follow one of those links, to see the details and edit that particular B, I will see only the fields of B, even if that instance is actually an instance of C.
What I would like to see is the object to be shown to me according to its most specific type.
What I'm trying
I'm using InheritanceManager to get instances casted to the right type when working at a more abstract level. This works almost well (it can't handle more than one inheritance level). However, even for a single inheritance level, I can't get the polymorphic behavior to be reflected in the admin, as obviously the admin doesn't know about the manager's select_subclasses() method.
Any idea on how could I use to get such a polymorphic-like behavior on the admin?
Concrete Example
models.py:
from django.db import models
from model_utils.managers import InheritanceManager

class A(models.Model):
    a_field = models.CharField(max_length=200)
    objects = InheritanceManager()

class B(A):
    b_field = models.CharField(max_length=200)

class C(B):
    c_field = models.CharField(max_length=200)

admin.py
from myapp.models import A, B, C
from django.contrib import admin

admin.site.register(A)
admin.site.register(B)
admin.site.register(C)

Update
Adding a link to two threads from 2010 with some thoughts on how to achieve this with django-polymorphic:

http://groups.google.com/group/django-polymorphic/browse_frm/thread/84290fe76c40c12d
http://groups.google.com/group/django-polymorphic/browse_frm/thread/8332d9a71daa7fc5
Answer: This answer is partial, since I can't reproduce your first issue. When I list parent model objects, I see all of them. (Or maybe there's some misunderstanding.)

The issue with incomplete fields can be partially solved with admin inline. Since the subclass is simply a model with implicit OneToOneField to parent model, you can define an inline for "C" and then include it into inlines attribute on B's admin.
The problems are:

User won't be able to create object of class "C" via an inline in B's admin; it could be done only via C's admin. It's viewing only.
It won't work with multiple inheritance levels: you can include B into A's admin as an inline, but I know no easy way to include C as an inline to B's inline.

Another way is to modify A's admin template, placing there a link to the real instance (be it B or C). But I suppose you've already thought of it.

Regarding last issue: if you want to modify some model admin's queryset, it can be done via ModelAdmin's queryset() method (see an example in this question). You can override this method on your model's admin and place select_subclasses() logic there. But I haven't tried it so I can't say what would be ModelAdmin's behaviour if you do this. Maybe you'll need to override a few more methods.

PS. I currently use django-polymorphic, working on similar project with concrete inheritance. It doesn't provide any means to manage polymorphic models via admin either, so I decided not to rely much on Django's admin for this and just create a simple custom interface for site staff, I guess it won't take much time.
Comment: It should be noted that [`django-polymorphic` now supports django's admin](https://django-polymorphic.readthedocs.io/en/stable/admin.html).
Comment: I've added a concrete example to the question. You're right, listing all "A"s will also list "B"s and "C"s. I've also fixed the question accordingly and added a bit more detail to the remaining issue.
Comment: Thanks for the inlines suggestion. I can definitely work around some issues using them but, as you say, their applicability is quite limited, and the problems you raise are not negligible. The `queryset()` method works pretty well, but it also works only for a single level (that's more of a limitation of `InheritanceManager` though).
Comment: Of course, forgetting about the django-admin and just doing everything from scratch is also an option. I was seeing the "free" admin as one of the great benefits of django, but it's starting to look restrictive for this this project, as it will make extensive use of inheritance relations.
Comment: I think Django's admin is great, but the number of its use cases is limited, and documentation fails to note that. It appears at first that it's awesome and is really like an "admin" for your site, but actually it's more like a data browser (with its own limitations like generic relations and complex inheritance). And it's ok, since real "admin" use cases differ greatly from site to site.
Comment: For example, I use inlines and a link to real instance on parent instance's admin to handle inheritance at one project, and it's more than enough for *me*, while staff don't care (not dealing with that data directly). Also, it's the only project at the moment where I needed that kind of functionality, so I can't blame django developers for not implementing it (saving time to do bugfixes and more useful features).

Polymorphic behavior in django's Admin


Phone restart [Android - App Installation]

Question: I've met an issue related with almost every phone but not Nexus.
During installation of app to phone by usb - Android Studio - phone restarts itself and app is not installing finally - I have to run app one more time by Android Studio to install it.
This doesn't happen all the time, but randomly, it's annoying and time wasting.
Honestly I don't know with what it's truly related problem, phones or Android Studio.
Have you met this problem?
Do you know any solutions?
Thanks.
Comment: Do you have a stack trace? And is your phone rooted?
Comment: Sorry but no. It happened on many phones in the past so I guess that it was something with Android Studio because I can't repeat it now.
Answer: There are three cases:

There is a problem in the app source code: You should Build APK and install it in the phone. Maybe its required to install the app for several times. if phone restarted again, check the source code carefully.
There is a problem in usb cable: Maybe there is a short circuit in the cable or a glitch in it. Change cable and try again.
There is a problem in android studio: uninstall android studio and try to install it again.


Deserializing JSON into C# Class with dynamic object

Question: I have json being returned from an API.  The JSON is formatted as below:
{
   "success":true,
   "code":200,
   "total":2,
   "data":{
      "1019588":{
         "name":"(t) Bob Jones",
         "calls":213,
         "user_id":"1019588"
      },
      "1019741":{
         "name":"(t) Chris Smith",
         "calls":387,
         "user_id":"1019741"
      }
    }
}

I am trying to deserialize into a C# class but I am having issues with the dynamic id for each employee row.
My code:
AgentPeformanceResponse viewModel = JsonSerializer.Deserialize<AgentPeformanceResponse>(result.Result);

public class AgentPeformanceResponse
    {
        public bool success { get; set; }
        public int code { get; set; }
        public int total { get; set; }
        public Data data { get; set; }

        public AgentPeformanceResponse()
        {
            data = new Data();
        }

    }
    public class Data
    {
        public Data()
        {
            PerformanceReponse = new List<PerformanceReponse>();
        }
        public List<PerformanceReponse> PerformanceReponse { get; set; }

    }
    public class PerformanceReponse
    {
        public string name { get; set; }
        public int calls { get; set; }
        public string user_id { get; set; }

    }

How do I handle the dynamic employee ID so that I can deserialize it all into one object?
Comment: You would deserialize the `data` elements as a `Dictionary`. See: https://stackoverflow.com/questions/13517792/deserializing-json-with-dynamic-keys and https://stackoverflow.com/questions/24771804/how-can-i-deserialize-a-child-object-with-dynamic-numeric-key-names You can additionally create a custom deserializer if you want those `key`s to be properties in an object, and not a string key of a dictionary
Answer: all code you really need
Dictionary<string, PerformanceReponse> dict = JsonDocument.Parse(json).RootElement
.GetProperty("data").Deserialize<Dictionary<string,PerformanceReponse>>();

//or if you want a list
List<PerformanceReponse> list = data.Select(d=>d.Value).ToList();

or using Newtonsoft.Json

Dictionary<string,PerformanceReponse> dict =  JObject.Parse(json)
["data"].ToObject<Dictionary<string,PerformanceReponse>>();

how to use
PerformanceReponse data1019588= dict["1019588"];

Answer: You should use a Dictionary:
public class AgentPeformanceResponse
{
    public bool success { get; set; }
    public int code { get; set; }
    public int total { get; set; }
    public Dictionary<string,PerformanceReponse> data { get; set; }
}

public class PerformanceReponse
{
    public string name { get; set; }
    public int calls { get; set; }
    public string user_id { get; set; }
}

Example:
string json = @"{
   ""success"":true,
   ""code"":200,
   ""total"":2,
   ""data"":{
      ""1019588"":{
         ""name"":""(t) Bob Jones"",
         ""calls"":213,
         ""user_id"":""1019588""
      },
      ""1019741"":{
         ""name"":""(t) Chris Smith"",
         ""calls"":387,
         ""user_id"":""1019741""
      }
    }
}";

var obj = System.Text.Json.JsonSerializer
    .Deserialize<AgentPeformanceResponse>(json);

Answer: using System;
using System.Collections.Generic;

public class AgentPeformanceResponse
{
    public bool success { get; set; }
    public int code { get; set; }
    public int total { get; set; }
    public Dictionary<string, PerformanceReponse> data { get; set; }
}

public class PerformanceReponse
{
    public string name { get; set; }
    public int calls { get; set; }
    public string user_id { get; set; }
}

public class Program
{
    public static void Main()
    {
        var json = "{\"success\":true,\"code\":200,\"total\":2,\"data\":{\"1019588\":{\"name\":\"(t) Bob Jones\",\"calls\":213,\"user_id\":\"1019588\"},\"1019741\":{\"name\":\"(t) Chris Smith\",\"calls\":387,\"user_id\":\"1019741\"}}}";
        var result = System.Text.Json.JsonSerializer.Deserialize<AgentPeformanceResponse>(json);
        Console.WriteLine(result.code);
        Console.WriteLine(result.data["1019741"].name);
    }
}

The output will be
200
(t) Chris Smith
Fiddle for you
https://dotnetfiddle.net/lQu2Ln


Add two dictionaries into a json

Question: I am trying to write two dictionaries into a JSON one after another in Python.
I have made two dictionaries which look like ---
dictionary_quant =
{'dmin': [0.003163, 14.325], 'magNst': [0.0, 414.0], 'horizontalError': [0.12, 12.9], 'nst': [3.0, 96.0], 'depth': [-3.09, 581.37], 'latitude': [-43.3468, 67.1524], 'rms': [0.0, 1.49], 'depthError': [0.0, 32.0], 'magError': [0.0, 1.34], 'mag': [-0.57, 6.9], 'gap': [18.0, 342.0], 'longitude': [-179.8024, 179.3064]}

dictionary_categorical =
{'magType': ['ml', 'md', 'mb', 'mb_lg', 'mwr', 'Md', 'mwb', nan, 'mww'], 'net': ['ci', 'nc', 'us', 'ak', 'mb', 'uw', 'nn', 'pr', 'se', 'nm', 'ismpkansas', 'hv', 'uu'], 'type': ['earthquake', 'explosion'], 'status': ['reviewed', 'automatic'], 'locationSource': ['ci', 'nc', 'us', 'ak', 'mb', 'uw', 'nn', 'pr', 'se', 'nm', 'ismp', 'hv', 'uu', 'ott', 'guc'], 'magSource': ['ci', 'nc', 'us', 'ak', 'mb', 'uw', 'nn', 'pr', 'se', 'nm', 'ismp', 'hv', 'uu', 'ott', 'guc']}

I am trying to write a json which looks like --
data = [
            {
               'name' : 'dmin',
               'type' : 'quant',
               'minmax' : [0.003163, 14.325]
            },
            {
               'name' : 'magNSt',
               'type' : 'quant',
               'minmax' : [0.0, 414.0]
             },
             {....},
             {....},
             {
                'name' : 'magType',
                'type' : 'categor',
                'categories' : ['ml', 'md', 'mb', 'mb_lg', 'mwr', 'Md', 'mwb', nan, 'mww']
              },
              {
                 'name' : 'net',
                'type' : 'categor',
                'categories' : ['ci', 'nc', 'us', 'ak', 'mb', 'uw', 'nn', 'pr', 'se', 'nm', 'ismpkansas', 'hv', 'uu']
               }
]

Comment: So you implicitly require to merge the two dictionaries while checking the type of data that are at some position in your dictionary (I mean `[0.003163, 14.325]` is `quant` while `['ml', 'md', 'mb', ... ]` is `categor`)? Or do you know it before hand (as the names of your dictionaries suggest)?
Comment: Also, what have you tried so far?
Comment: Yes I find out through some preconditions, so in dictionary_quant all are quantative variables and dictionary_categor all are categorical
Comment: https://stackoverflow.com/questions/17043860/python-dump-dict-to-json-file. I tried this example but it gives me error of I add type in it
Comment: What have you tried? Do you know how to get a dictionary's items (`(key, value)` pairs)? From a particular `(key, value)` pair, could you construct a single dictionary in the form that you want? Given a list of pairs and a way to turn a pair into the data you want, do you know how to combine them to get a new list of dicts? Do you know how to combine two lists (you'll have to process `quant` and `categor` differently) into a single one?
Comment: print json.dumps([{'name': k, 'minmax': v, 'type': "quant"} for k,v in dictionary_quant.items()], indent=4)  . I tried this
Answer: Assuming that the exact output format can be flexible (see comment below), this can be done as follow.
import json

dictionary_quant = {'dmin': [0.003163, 14.325], 'magNst': [0.0, 414.0], 'horizontalError': [0.12, 12.9], 'nst': [3.0, 96.0], 'depth': [-3.09, 581.37], 'latitude': [-43.3468, 67.1524], 'rms': [0.0, 1.49], 'depthError': [0.0, 32.0], 'magError': [0.0, 1.34], 'mag': [-0.57, 6.9], 'gap': [18.0, 342.0], 'longitude': [-179.8024, 179.3064]}

# Replaced the undefined keyword / variable "nan" with None
dictionary_categorical = {'magType': ['ml', 'md', 'mb', 'mb_lg', 'mwr', 'Md', 'mwb', None, 'mww'], 'net': ['ci', 'nc', 'us', 'ak', 'mb', 'uw', 'nn', 'pr', 'se', 'nm', 'ismpkansas', 'hv', 'uu'], 'type': ['earthquake', 'explosion'], 'status': ['reviewed', 'automatic'], 'locationSource': ['ci', 'nc', 'us', 'ak', 'mb', 'uw', 'nn', 'pr', 'se', 'nm', 'ismp', 'hv', 'uu', 'ott', 'guc'], 'magSource': ['ci', 'nc', 'us', 'ak', 'mb', 'uw', 'nn', 'pr', 'se', 'nm', 'ismp', 'hv', 'uu', 'ott', 'guc']}

#Start with an empty data list
data = []

# Add each item in dictionary_quant with type set to "quant" and the
# value on key minmax
for k, v in dictionary_quant.items():
    data.append({'type': 'quant',
                 'name': k,
                 'minmax': v})

# Add each item in dictionary_categorical with type set to "categor"
# and the value on key "categories"
for k, v in dictionary_categorical.items():
    data.append({'type': 'categor',
                 'name': k,
                 'categories': v})

# Note: The json.dumps() function will output list attribute elements
# one-per-line when using indented output.
print(json.dumps(data, indent=4))

Answer: Assuming you know beforehand the type of each subsequent dictionary, you could do the following:
def format_data(data, data_type, value_name):
    return [{'name': key, 'type': data_type, value_name: val} for key, val in data.items()]

where data is your dict, data_type is either quant or categor and value_name is either minmax or categories.
Then, combined that would be:
combined = format(dictionary_quant, 'quant', 'minmax') + format_data(dictionary_categorical, 'categor', 'categories')

Add two dictionaries into a json


Can you summon a Mob Spawner of any type with commands? If so, how?

Question: I know there is some way to use monster spawners another way than to use them in their natural location...I just don't know how. Especially in normal Minecraft. There has to be some command you can use.
Answer: The wiki has a list of NBT data for spawners here: https://minecraft.wiki/w/Mob_spawner#Data_values
And a list all entity data here: https://minecraft.wiki/w/Chunk_format#Entity_format

The /setblock command can create a physical block in the world, adding necessary data to tile entities:
/setblock X Y Z <block ID> [Damage] [replacement method] {dataTags}

An example, where a creeper will spawn with a fuse timer of 1 tick. Any data not specified for the spawner will use the defaults.
/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {EntityId:"Creeper",SpawnData:{Fuse:1s}}

The /give command can create a mob spawner for inventories. The BlockEntityTag tag for the item format will hold potential tile data for the block when it is placed.
/give <player> <item ID> [Count] [Damage] {dataTags}

/give @p minecraft:mob_spawner 1 0 {BlockEntityTag:{EntityId:"Creeper",SpawnData:{Fuse:1s}}}

Comment: what about special spawners like killer rabbit, giant, elder guardian,or  ender dragon spawners?
Comment: @JoshRimell Entity's NBT data goes inside `SpawnData`. See the Chunk Format page I linked for all NBT data for entities. Replace the `EntityId` tag with the entity ID desired (which is also included on the linked page).
Answer: There's this really useful tool on minecraft.tools  that allows you to do this.
Go to http://minecraft.tools/en/spawn.php, then click on the large "Create a MobSpawner" button. Fill in all the necessary inputs, and click "Generate the Command". This will generate a command that will place down a mob spawner.
Comment: I already have discovered that and I only use Minecraft tools now. :D


CSS Pseudo Classes with Article

Question: I'm trying to get the first article on the page using CSS. I have tried the following:
article:first {
    background: blue;
}

and
article:first-child {
    background: blue;
}

However neither of these seem to be doing anything.
My HTML markup is as follows (head removed and content ellipsed):
...

            <hgroup>
                ...
            </hgroup>

            ...

            ...

I'm also using the latest version of chrome.
Comment: There is no :first pseudo-class in CSS.
Answer: What you're looking for is #wrapper article:first-of-type, but unfortunately it's not widely supported yet.
You could try #wrapper header + article though, for which support is more widespread.
Comment: Nice that works... I'm not too fussed if its fully supported, I'm only using it for something minor. The site doesn't break if I am unable to style the first article. =D
Answer: Try modifying your markup:
...

            <hgroup>
                ...
            </hgroup>

                ...

                ...

:first-child works only with real first children elements (it was header in your case).
Comment: Or just use `:nth-child(2)` (CSS3)

CSS Pseudo Classes with Article


Cant install JavaEE in my computer

Question: I tried to install JavaEE on my computer. I already have JDK 7 and Netbeans 7.1.2.
But when I try to install it, it shows this error..

application needs version 1.6 or higher of java(TM)2 Runtime
  environment.....
Comment: What version of JEE you are trying to install?
Comment: question would be ask on [Superuser](http://superuser.com)
Comment: ... and what JavaEE implementation?  If you're trying to install Glassfish, why not just install the Netbeans installer that includes Glassfish?
Comment: @Asif tools commonly used by programmers are allowed here as per http://stackoverflow.com/faq#questions
Comment: or ditch it and use spring ;-) then you won't need a hulking mass of EE server like glassfish, just tomcat and a few jars
Comment: @fvu Well yeah its a _programming tool_ but its more related as OS specific installation purpose question rather than _use_ of that tool in programming.. :)
Answer: The JDK installer for Windows doesn't do its job entirely right. Some registry keys for the JRE are missing. The Java EE installer is relying on them. You basically need to install JRE as well which you can get from http://java.com. You don't need to uninstall the JDK. Just install JRE over it, it'll set the proper registry keys and your Java EE installer will then continue.
Note that the Java EE pack basically contains the Glassfish server and optionally also bundles the Netbeans IDE. You can alternatively also just download and install Glassfish separately from http://glassfish.java.net. Or if you happen to have installed Glassfish already or already have another server like Tomcat or JBoss AS, then you don't need the Java EE pack at all.
See also:

What exactly is Java EE?

Cant install JavaEE in my computer


Same XP when evolving vs catching a pokemon?

Question: If I evolve a pokemon and it turns into a pokemon that's not registered in my pokedex, will I get the same XP, candies, and stardust that I'd get if I caught one in the wild?
Answer: If not in your Pokédex, you get extra 500 xp, the same as catching it, but catching also provides candies (3) and 100 stardust, while evolving only gives 1 candy.
Comment: Do note, you will receive a single candy when evolving.
Comment: And evolving will also (obviously) remove your old pokemon and the cost of evolving
Answer: Evolving will give the following:

500 xp
1 candy
the evolved pokemon

Catching will give the following:

100 xp
100 stardust
3 candies
bonus exp based upon the throw
the caught pokemon

Both instances will give an additional 500 xp if the resulting pokemon is not yet in your pokedex.
So they don't give the same thing. Exp: yes. Candies: no. Stardust: no.


Does points are closed in L-spaces

Question: Does one point $x\in X$ is closed where $X$ is an $L$-spaces,
which is called also Limit-spaces and introduced for the first time by Fréchet.
Answer: If you mean sequential convergence spaces with the two usual axioms (constant sequences converge to their constant, and any subsequence of a convergent sequence converges to the same limit):
Define $X = \{0,1\}$ and every sequence converges to $0$ and every sequences also converges to $1$. You can check pretty easily that this obeys the above axioms.
Then by definition the closed sets in this convergence space are exactly those sets that are closed under sequential limits. So if $A \neq \emptyset$ is closed, we have $p \in \{0,1\}, p \in A$, and the sequence $p,p,p,p,\ldots$ converges to both $0$ and $1$ and so $0,1 \in A$, so the only closed sets are $\emptyset$ and $X$, i.e. $X$ is indiscrete. So points need not be closed.
As slightly more interesting example (which is $T_0$) can be made using the Sierpinski two-point space, which I leave to you.
Answer: This is comment rather than an answer. I am posting it as an answer for two reasons: 1) Better formatting. 2) Easier for the OP to copy the source.
I found the following axioms in Engelking's book:

1.7.18 (Frechet [1906] and [1918], Urysohn [1926a]). An $\mathcal L^*$-space is a pair $(X, \lambda)$, where $X$ is a set and $\lambda$ a function (called the limit operator) assigning to some sequences of points of $X$ an element of $X$ (called the limit of the sequence) in such a way that the following conditions are satisfied (we write $\lambda x_i$ instead of $\lambda(\{x_i\})$ and say that $\{x_i\}$ converges to $x$ if $\lambda x_i=x$):
  (L1) If $x_i=i$ for $i = 1,2,\dots,$ then $\lambda x_i=x$.
  (L2) If $\lambda x_i=x$, then $\lambda x_{k_i}=x$ for every subsequence $\{x_{k_i}\}$ of $\{x_i\}$.
  (L3) If a sequence $\{x_i\}$ does not converge to $x$, then it contains a subsequence $\{x_{k_i}\}$ such that no subsequence of $\{x_{k_i}\}$ converges to $x$.
  An $\mathcal L^*$ space is called $\mathcal S^*$-space if it fulfills also
  (L4) If $\lambda x_i=x$ and $\lambda x^i_j=x_i$ for $i=1,2,\dots$, then there exist sequences of positive integers $i_1,i_2,\dots$ and $j_1,j_2,\dots$ such that $\lambda x^{i_k}_{j_k}=x$.

If some of these axioms are what you mean by L-space, you should copy them to your post and give precise definition of what you mean. (So that your post is not as unclear as in the current state.)
If you want copy part of the text from this post, simply click on "edit" or click on "source" in the revision history.
Comment: The L3 axiom makes it what is now known as a topological convergence space. L4 makes it sequential, or Fréchet-Urysohn, IIRC, I forgot which.

Does points are closed in L-spaces