text:
Q: Dynamically exporting functions in firebase I'm having the typical (according to many posts) issue with cold boot times in cloud functions. A solution that seemed promised suggests to import / export only the function actually being executed, as can be seen here:
https://github.com/firebase/functions-samples/issues/170#issuecomment-323375462
if (!process.env.FUNCTION_NAME || process.env.FUNCTION_NAME === 'sendFollowerNotification') {
  exports.sendFollowerNotification = require('./sendFollowerNotification');
}

Which is a Javascript example, but I'm using typescript. I've tried a number of variations, and while some build, in the end I'm always stuck with my function not being exported and deploy warning me that I'm going to delete the existing function.
This is one of the numerous attempts:
if (!process.env.FUNCTION_NAME || process.env.FUNCTION_NAME === 'generateInviteURL') {
  import ('./invite_functions').then ((mod) => { console.log ("mod follows" ); console.log (mod);  exports.generateInviteURL = functions.https.onRequest( mod.generateInviteURL ); } )
  .catch ((err) => {console.log ("Trying to import/export generateInviteURL ", err);}) ;
}

At mentioned, at deploy time what happens is that I get a warning about the function being deleted.
I was able to "avoid" that message with something like this:
console.log ("Function name: ", process.env.FUNCTION_NAME);

function dummy_generateInviteURL (req, res) { ; }
exports.generateInviteURL = functions.https.onRequest( dummy_generateInviteURL );

if (!process.env.FUNCTION_NAME || process.env.FUNCTION_NAME === 'generateInviteURL') {
console.log ("Doing the good import");
import ('./invite_functions').then ((mod) => { console.log ("mod follows" ); console.log (mod);  exports.generateInviteURL = functions.https.onRequest( mod.generateInviteURL ); } )
  .catch ((err) => {console.log ("Trying to import/export generateInviteURL ", err);}) ;
}

console.log ("Exported");
console.log (exports.generateInviteURL);

Which the idea of course that an empty function would be always be exported but would be replaced with the real one if that's the one being called.
In that case logs look like this:
generateInviteURL Function name:  generateInviteURL generateInviteURL
generateInviteURL Exported generateInviteURL
{ [Function: cloudFunction] __trigger: { httpsTrigger: {} } }

So the first part looks promising (the environment variable is defined), then the import does something (enters the then block, never the catch), but the exported variable is not replaced.
I'm not sure if this is a TypeScript problem, a firebase problem, or a developer problem - probably I'm just missing something obvious.
So the question - how can I avoid importing/exporting anything I don't need for each specific function?

A: You can stick to the original index.js, with minor changes. I have tried a few times and came with a solution. Am including a sample dir structure and two typescript files (index.ts and another for your custom function). With this you will never have to change the index.ts to modify or add functions.
Directory Structure
+ functions
|
 -- + src
|   |
|    -- index.ts
|   |
|    -- + get
|       |
|        -- status.f.ts
 -- package.json (auto generated)
|
 -- package-lock.json (auto generated)
|
 -- tsconfig.json (auto generated)
|
 -- tslint.json (auto generated)
|
 -- + lib (auto generated)
|
 -- + node_modules (auto generated)

src/index.ts
import * as glob from "glob";
import * as camelCase from "camelcase";
const files = glob.sync('./**/*.f.js', { cwd: __dirname, ignore: './node_modules/**'});
for(let f=0,fl=files.length; f<fl; f++){
  const file = files[f];
  const functionName = camelCase(file.slice(0, -5).split('/').join('_')); // Strip off '.f.js'
  if (!process.env.FUNCTION_NAME || process.env.FUNCTION_NAME === functionName) {
    exports[functionName] = require(file);
  }
}

src/get/status.f.ts
import * as functions from 'firebase-functions';

exports = module.exports = functions.https.onRequest((req, res) => {
    res.status(200).json({'status':'OK'})
})

Once you have created the above file install npm packages 'glob' and 'camelcase',
then try to deploy the firebase functions
Firebase will deploy a function named 'getStatus'
NOTE that the name of the function is camel case version of folder names and the file name where the function exists, so you can export only one function per .f.ts file
EDIT
I have updated the dir structure. Note that index.ts and all the subsequent files and folders resides within the parent folder 'src'

A: I've been having similar issues, and I wrote a pretty cool solution that worked for me.
I decided to release it as an open-source package - I've never done that before so if anyone can check it out, contribute or give feedback that would be great.
The package is called better-firebase-functions - https://www.npmjs.com/package/better-firebase-functions
All you have to do is import and run it. Two lines. Pretty much everything else is automated.
It will pick up the default exports of all function files in your directory and deploy them as properly named functions.
Here is an example:
import { exportFunctions } from 'better-firebase-functions';

exportFunctions({
   __filename,                         // standard node var (leave as is).
   exports,                            // standard node var (leave as is).
   functionDirectoryPath: './myFuncs', // define root functions folder
                                       // relative to this file.
   searchGlob: '**/*.js'               // file search glob pattern.
});

The only other thing you need to do is export your function.http.onRequest()... as a default export from every file that contains a cloud function that you want to deploy. So:
export default functions.http.onRequest()...
/// OR
const func1 = functions.http.onRequest()...
export default func1;

And that's it!
UPDATE: Answer edited to reflect newer version of package.


text:
Q: How to center image in div (height - % of screen) My website has a header and it takes 20% of screen. I want an image (which is 90% of header height) right in the center of the header. I had no problems to center the image horizontally, but I can't center it vertically. Here's the code:
<!doctype html>

    <meta charset="utf-8" />
    <title>Website</title>
    <link rel="stylesheet" href="stylingpercent.css" />

body {
    margin:0px;
}

.logoheader{
    height: 20vh;
    background:rgb(1,1,1);
    margin:0px;
    text-align: center;
}

.mainlogo {
    max-height:90%;
}

A: Add this:
line-height: 20vh;

to .logoheader. DEMONstration.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to set up firebase function in flutter web project I am trying to configure the firebase real-time database in my flutter web project is there any suggestion for me to config the firebase real-time database in flutter web project?
https://pub.dev/packages/firebase#-installing-tab-
I have followed the above link to config the firebase libraray but how can I use the firebase real-time data base function?

A: You can use a helper class to init your database
import 'package:firebase/firebase.dart' as fb;

class FirebaseHelper {
  static fb.Database initDatabase() {
    try {
      if (fb.apps.isEmpty) {
        fb.initializeApp(
          apiKey: "add_your_own",
          authDomain: "add_your_own",
          databaseURL: "add_your_own",
          projectId: "add_your_own",
          messagingSenderId: "add_your_own",
        );
      }
    } on fb.FirebaseJsNotLoadedException catch (e) {
      print(e);
    }
    return fb.database();
  }
}

Then use it as follow
// global variable, not the best
Database database = FirebaseHelper.initDatabase();

void main() {
  runApp(FirebaseApp());
}

Then in your widget use
 var databaseRef = database.ref("my_database").child("my_data");


text:
Q: Using fgets() but program skipping first fgets Hear me out because I'm a noob and I know this is a potential duplicate but I've browsed so much pages and I still can't figure this out. I'm trying to take a name but for some reason it's not allowing me to input data into first fgets.
void getModuleDetails(struct moduleInfo* moduleInfo)
{

    FILE *fp;
    fp = fopen("moduleInfo.txt", "a+");
    if(fp == NULL)
        exit(1);

    char name[100];
    char code[100];
    int id;
    int ca;
    int exam;

    while((ch =getchar())!= '\n' && ch != EOF)
    {
        printf("Module Name:");
        if(fgets(name, 100, stdin) != NULL)
        {
            fprintf(fp,"%s", name);
        }
    }

    printf("Module Code:");
    if(fgets(code, 100, stdin) != NULL)
        fprintf(fp,"%s", code);

    printf("Module ID:");
    if(scanf("%d", &id) != NULL)
        fprintf(fp,"%d\n", id);

    printf("CA%:");
    if(scanf("%d", &ca) != NULL)
        fprintf(fp,"%d\n", ca);

    printf("Exam%:");
    if(scanf("%d", &exam) != NULL)
        fprintf(fp,"%d\n", exam);

    fclose(fp);
}

As you can see I have removed all '\n's that I had after my printf's, added getchar to handle a \n. I also know I shouldn't be mixing fgets with scanf but it's what our lecturer wants. If anyone could point out where I'm going wrong, it'd be extremely appreciated.


text:
Q: there are components such as infragistics or telerik for java or netbeans? are there any components such as infragistics or telerik for Java/Netbeans ?
I couldn't find any info regarding this.
thanks in advance.

A: have a look at PrimeFaces. These are some JSF Components and also usable on Mobiles.
If you want to have an Overview over all Components and what they can do have a look at the Showcase.


text:
Q: Perl - call scripts from another script with relative path I have Perl script that call other Perl scripts, I use this line for that :
system($^X, "script.pl", @ARGV);

All scripts exists on same folder but I want to call the main one from another folder, meaning scripts are under D:\TEST\Perl but I open command line from C:\ and call the main one from this location.
Probably a Silly question, but how can I call the child scripts that their location is relative to the main one?
Do I really need to use module for that? Which one?

A: Sounds like you want the FindBin module
use FindBin '$Bin'; # $Bin will contain the directory containing the executable file

# Then, later in your code
system($^X, "$Bin/script.pl", @ARGV);


text:
Q: How To Integrate HTMLHint into Codemirror 6 I'm trying to add HTMLHint into Codemirror 6 by following the lint documentation and the eslint-linter-browserify demo for Codemirror 6. Not sure what I'm doing wrong but the lints are not showing.
Can someone explain what I'm doing wrong and how can I add HTMLHint into Codemirror 6?
lang-html:
function HTMLHint(htmlhint, config) {
    config = {
        rules: {
            "tagname-lowercase": true,
            "attr-lowercase": true,
            "attr-value-double-quotes": true,
            "doctype-first": true,
            "tag-pair": true,
            "spec-char-escape": true,
            "id-unique": true,
            "src-not-empty": true,
            "attr-no-duplication": true
        }
    }
    return (view) => {
        let { state } = view, found = [];
        for (let { from, to } of htmlLanguage.findRegions(state)) {
            let fromLine = state.doc.lineAt(from), offset = { line: fromLine.number - 1, col: from - fromLine.from, pos: from };
            for (let d of htmlhint.verify(state.sliceDoc(from, to)))
                found.push(translateDiagnostic(d, state.doc, offset));
        }
        return found;
    };
}
function mapPos(line, col, doc, offset) {
    return doc.line(line + offset.line).from + col + (line == 1 ? offset.col - 1 : -1);
}
function translateDiagnostic(input, doc, offset) {
    let start = mapPos(input.line, input.column, doc, offset);
    let result = {
        from: start,
        to: input.endLine != null && input.endColumn != 1 ? mapPos(input.endLine, input.endColumn, doc, offset) : start,
        message: input.message,
        source: input.ruleId ? "htmlhint:" + input.ruleId : "htmlhint",
        severity: input.severity == 1 ? "warning" : "error",
    };
    if (input.fix) {
        let { range, text } = input.fix, from = range[0] + offset.pos - start, to = range[1] + offset.pos - start;
        result.actions = [{
                name: "fix",
                apply(view, start) {
                    view.dispatch({ changes: { from: start + from, to: start + to, insert: text }, scrollIntoView: true });
                }
            }];
    }
    return result;
}

export { autoCloseTags, HTMLHint, html, htmlCompletionSource, htmlCompletionSourceWith, htmlLanguage };

editor.js:
import { EditorView } from '@codemirror/view';
import { lineNumbers, highlightActiveLineGutter, highlightSpecialChars, drawSelection, dropCursor, rectangularSelection, crosshairCursor, highlightActiveLine, keymap } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
import { foldGutter, indentOnInput, syntaxHighlighting, defaultHighlightStyle, bracketMatching, foldKeymap } from '@codemirror/language';
import { history, defaultKeymap, historyKeymap } from '@codemirror/commands';
import { highlightSelectionMatches, searchKeymap } from '@codemirror/search';
import { closeBrackets, autocompletion, closeBracketsKeymap, completionKeymap } from '@codemirror/autocomplete';
import { linter, lintKeymap, lintGutter } from '@codemirror/lint';
import { javascript } from "@codemirror/lang-javascript";
import { html, HTMLHint } from "@codemirror/lang-html";
import { htmlhint } from 'htmlhint';

// ruleSets for HTMLLint
let ruleSets = {
  "tagname-lowercase": true,
  "attr-lowercase": true,
  "attr-value-double-quotes": true,
  "doctype-first": false,
  "tag-pair": true,
  "spec-char-escape": true,
  "id-unique": true,
  "src-not-empty": true,
  "attr-no-duplication": true
};

const basicSetup = [
    lineNumbers(),
    highlightActiveLineGutter(),
    highlightSpecialChars(),
    history(),
    foldGutter(),
    drawSelection(),
    dropCursor(),
    EditorState.allowMultipleSelections.of(true),
    indentOnInput(),
    syntaxHighlighting(defaultHighlightStyle),
    bracketMatching(),
    closeBrackets(),
    autocompletion(),
    rectangularSelection(),
    crosshairCursor(),
    highlightActiveLine(),
    highlightSelectionMatches(),
    lintGutter(),
    linter(HTMLHint(ruleSets)),
    keymap.of([
        ...closeBracketsKeymap,
        ...defaultKeymap,
        ...searchKeymap,
        ...historyKeymap,
        ...foldKeymap,
        ...completionKeymap,
        ...lintKeymap,
    ]),
    html(),
];

const editor = new EditorView({
  state: EditorState.create({
    doc: `hello world
hello world`,
    extensions: [basicSetup],
  }),
  parent: document.getElementById('editor'),
});

index.html:
<!DOCTYPE html>

    <title>CodeMirror 6 Test</title>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="styles.css" />

I was able to accomplish this with Codemirror v5- with....
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/5/LICENSE

// Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js

// declare global: HTMLHint

(function(mod) {
  if (typeof exports == "object" && typeof module == "object") // CommonJS
    mod(require("../../lib/codemirror"), require("htmlhint"));
  else if (typeof define == "function" && define.amd) // AMD
    define(["../../lib/codemirror", "htmlhint"], mod);
  else // Plain browser env
    mod(CodeMirror, window.HTMLHint);
})(function(CodeMirror, HTMLHint) {
  "use strict";

  var defaultRules = {
    "tagname-lowercase": true,
    "attr-lowercase": true,
    "attr-value-double-quotes": true,
    "doctype-first": false,
    "tag-pair": true,
    "spec-char-escape": true,
    "id-unique": true,
    "src-not-empty": true,
    "attr-no-duplication": true
  };

  CodeMirror.registerHelper("lint", "html", function(text, options) {
    var found = [];
    if (HTMLHint && !HTMLHint.verify) {
      if(typeof HTMLHint.default !== 'undefined') {
        HTMLHint = HTMLHint.default;
      } else {
        HTMLHint = HTMLHint.HTMLHint;
      }
    }
    if (!HTMLHint) HTMLHint = window.HTMLHint;
    if (!HTMLHint) {
      if (window.console) {
          window.console.error("Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run.");
      }
      return found;
    }
    var messages = HTMLHint.verify(text, options && options.rules || defaultRules);
    for (var i = 0; i < messages.length; i++) {
      var message = messages[i];
      var startLine = message.line - 1, endLine = message.line - 1, startCol = message.col - 1, endCol = message.col;
      found.push({
        from: CodeMirror.Pos(startLine, startCol),
        to: CodeMirror.Pos(endLine, endCol),
        message: message.message,
        severity : message.type
      });
    }
    return found;
  });
});

A: You're using the javascriptLanguage.findRegions method in your HTMLHint function to find the parts of the page to lint, however this is wrong.
Because you're working with HTML rather than JavaScript, you should use the htmlLanguage.findRegions function instead.
Additionally, before you can utilise the htmlhint module in the linter extension, you must import it in your editor.js file.


text:
Q: the difference between unset and = null From a random php.net post:

If you are doing $whatever = null; then you are rewriting variable's
  data. You might get memory freed / shrunk faster, but it may steal CPU
  cycles from the code that truly needs them sooner, resulting in a
  longer overall execution time.

Apparently this is the undisputed truth so maybe someone would be so kind as to explain.
I mean, what, does unset magically not execute any assembly instructions whereas $whatever = null; does? The answer, as given, is about as useful as saying

$whatever = null resets the buffer and the L1 cache whereas unset clears the buffer and resets the L2 cache.

Techno mumbo jumbo doesn't constitute an answer.

A: When using unset, memory usage and processing time is less.
http://php.net/manual/en/function.unset.php#105980

A: An important difference between both methods is that unset($a) also removes $a from the symbol table; for example:
$a = str_repeat('hello world ', 100);
unset($a);
var_dump($a);

Outputs:
Notice: Undefined variable: a in xxx
NULL

But when $a = null is used:
$a = str_repeat('hello world ', 100);
$a = null;
var_dump($a);

Outputs:
NULL

I ran the code through a benchmark as well and found that $a = null is roughly 6% faster than its unset() counterpart. It seems that updating a symbol table entry is faster than removing it.
Addendum
The other difference (as seen in this small script) seems to be how much memory is restored after each call:
echo memory_get_usage(), PHP_EOL;
$a = str_repeat('hello world ', 100);
echo memory_get_usage(), PHP_EOL;
// EITHER unset($a); OR $a = null;
echo memory_get_usage(), PHP_EOL;

When using unset() all but 64 bytes of memory are given back, whereas $a = null; frees all but 272 bytes of memory. I don't have enough knowledge to know why there's a 208 bytes difference between both methods, but it's a difference nonetheless.

A: I made a simple test.
Considering a simple class like this:
class Cat{
    public $eyes  = 2;
    public $claws = 4;
    public $name  = "Kitty";
    public $sound = ['Meow', 'Miaou'];
}

I run this code code
$start = microtime(true);

for($i = 10000000; $i > 0; --$i){
    $cat = new Cat;
    $cat = null;
}

$end = microtime(true);

printf("Run in %s and use %s memory",
        round($end - $start, 2), round(memory_get_usage() / 1000, 2));

Run in 1.95 and use 233.29 memory

And this
for($i = 10000000; $i > 0; --$i){
    $cat = new Cat;
    unset($cat);
}

Run in 2.28 and use 233.1 memory

For what is worth it seem the null method run faster.

A: The answers above are great, especially the comment that "An important difference between both methods is that unset($a) also removes $a from the symbol table".
However, I don't think anyone has really fully answered the question in a practical sense because they don't describe how the two are used. OK I think we know that they both basically do the same thing. Why use one over the other?
null
Reclaims memory immediately (at the expense taking longer) despite PHP self managing memory /garbage collection.
unset()
Is usually recommended as it reclaims memory "when I can get to it" and is therefore considered faster as it doesn't dedicate resources immediately to it.
When should use null vs unset?
Basic (small data) data arrays etc. are good candidates for unset because memory won't become an issue. Larger data sets and/or anywhere the need to reclaim memory immediately is better for null. For example such large database requests can cannibalize your PHP memory ceiling very quickly if called multiple times in a function etc. which will cause page 500 errors from memory being full etc.. Therefore, unset should be preferred when speed is important (or in general) and when there is little concern for memory build up.
Example: Taking a large array and placing it into MemCache:
            list($inv1, $inv2, $inv3, $inv4) = array_chunk($inventory_array),
            ceil(count($val['inventory']) / 4));
            MemCache::set($cacheKeyInv1, $inv1, $expiry);
            MemCache::set($cacheKeyInv2, $inv2, $expiry);
            MemCache::set($cacheKeyInv3, $inv3, $expiry);
            MemCache::set($cacheKeyInv4, $inv4, $expiry);
            for ($i = 1; $i < 5; $i++) {
                ${"inv" . $i} = null; // why not use unset ?
            }

The for loop is cleaning up the data, null or unset could be used, but since it is a large dataset, perhaps null is preferred as it will reclaim the memory quicker.

A: Using the code
$a = str_repeat('hello world ', 10000);

$start1 = microtime(true);
unset($a);
$stop1 = microtime(true);

$a = str_repeat('hello world ', 10000);

$start2 = microtime(true);
$a = null;
$stop2 = microtime(true);

echo 'unset time lap of '. ( $stop1 - $start1 ) .'
';
echo 'null time lap of '. ( $stop2 - $start2 ) .'
';

for 10 times:
unset time lap of 5.0067901611328E-6
null time lap of 1.1920928955078E-6

unset time lap of 9.5367431640625E-7
null time lap of 9.5367431640625E-7

unset time lap of 0
null time lap of 9.5367431640625E-7

unset time lap of 2.1457672119141E-6
null time lap of 1.1920928955078E-6

unset time lap of 2.1457672119141E-6
null time lap of 0

unset time lap of 9.5367431640625E-7
null time lap of 0

unset time lap of 1.9073486328125E-6
null time lap of 9.5367431640625E-7

unset time lap of 9.5367431640625E-7
null time lap of 0

unset time lap of 1.9073486328125E-6
null time lap of 9.5367431640625E-7

unset time lap of 0
null time lap of 0

Looks like null assignment has less processing time more often.

A: The difference is that assignment of null is assignment of null and not uninitialization. If you do not work on performance critical issue, you shut use unset, if you do test both possibility on your PHP version.
Main difference came with PHP 7.4, and properties types, you can unset not nullable property, but you can't assign null.
class C {
    public int $value;
}

$c = new C();
var_dump(isset($c->value));   // false
$c->value = 5;
var_dump($c->value);          //5
unset($c->value);
//var_dump($c->value);       //Error: Typed property C::$value must not be accessed before initialization
var_dump(isset($c->value));  // false
$c->value = 5;
$c->value = null;            //Error Typed property C::$value must be int, null used

https://3v4l.org/VUVD1


text:
Q: Rate Dimensions en ConstrainsDimensions esconde la imagen al escalar 1- Estoy aprendiendo android y siguendo un video, a la hora de dar proporciones a una imagen, tiene un comportamiento inesperado que no puedo resolver desde hace algunos días.
Al poner las proporciones 2:3 para el ancho de la imagen, esto se aplica cuando la imagen no tiene constrain, pero cuando le aplico los constrain, la imagen desaparece en un solo plano.
Estoy buscando en la web pero no encuentro ha nadie que comente este problema.
Cuando pongo el ratio son constrain alguno, o sólo top y bottom, la imagen se dimensiona con rate sin problema, pero cuando le pongo el constrain latera ya no.
2- Al mismo tiempo no veo claro cual es la sintaxis para poner el ratio en el archivo XML. a veces lo veo como por ejemplo "16:9", otras como "W,16:9" o "w,16:9", cual actualmente la sintaxis aceptada?
Pongo unas fotos para ilustrar los problemnas que surgen en la primera cuestión.

*

*Aquí la imagen sin constrain se proporciona correctamente.

*Aquí también:

*Si hago el constrain con la imagen de arriba también funciona:

-Pero cuando hago el constrain con el "parent" entonces pierde la imagen, el ratio y solo se produce un plano sin que se vea la imagen:


text:
Q: Does the phone need to be connected to the internet so that the network provider can determine a location?  Does the phone need to be connected to the internet all the time, so that the network provider can determine a location?
When I test my app on my phone, and in Settings->Location only Use wireless network is checked, and I am not connected to the internet via Wi-Fi, I can not get a location fix.
I know there was something that the network provider uses availability of cell tower, but I don't know how that works exactly and should I have full internet access.
Please someone make this clear for me.

A: Yes, you need to be connected to the Internet in order to get correct network location fixes. At least most of the time.
The phone collects the following data (it does not need a connection to the Internet to do this):

*

*nearby wifi information by scanning for wifi access points

*nearby mobile cell information is available from the phone's cellular radio

The phone then sends this data to a server. The server uses this data to look in its database to determine the phone's most likely position. The server sends the location information back to the phone. This is all done using data connection via Internet (either mobile Internet or wifi).
Some implementations additionally download a small amount of the server's database to the phone (describing a small area around the phone's current position) so that the phone doesn't have to query the Internet all the time. However, once the phone has moved outside of this small area it will need to access the Internet to get correct locations again.
So, basically, without Internet connectivity you can't (reliably) use network location.

A: I would expect network location to work differently depending on the carrier.  It will need connection to the network, and really I wouldn't be surprised if that's classified as a data connection.
You can figure it out yourself through experimenting, but that's probably what prompted the question.
To get a definitive answer you'd probably have to talk to someone from the carrier. If they have a developer program that'd be your best bet.
I hope that helps.


text: Q: Touchpad alienware ubuntu 15.04 my touchpad stop working. I tried to enable it by fn+f3 or the hot keys from my Alienware user's guide fn+insert or fn+f11 but nothing work. Moreover I have already try to update my Synaptics but nothing even if I try xinput my touchpad doesn't appear in pointer devices neither mouse and touchpad. Something weird also it's when I try to click in the icon pointer devices (the one that appear next to mouse and touchpad when you write in control mouse) it gives me an error. Thanks in advance for any advice or comment.


text:
Q: Trying to download pdf file but getting downloadManager.enqueue error. not able to read ContentResolver.insert while downloading the pdf file but getting error at dm1.enqueue(request).it required WRITE_EXTERNAL_STORAGE permission. but a i have already added this permission.
please check  method and error log
private void downloadFileInTask1(Context v, String url) {
    if (TextUtils.isEmpty(url)) {
        throw new IllegalArgumentException("url cannot be empty or null");
    }

    String resolvedFile = getPDFname(url, "unknown_file");//resolveFile(url, "unknown_file");
    DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);

    if (isExternalStorageWritable()) {
        File file = new File(v.getExternalFilesDir(null), resolvedFile);
        Uri destinationUri = Uri.fromFile(file);
        destinationUri1 = file;
        request.setMimeType("application/pdf");
        request.setDestinationUri(destinationUri);
        dm1.enqueue(request);
    }
}

Error Log :
java.lang.SecurityException: need WRITE_EXTERNAL_STORAGE permission to use DESTINATION_FILE_URI: uid 11110 does not have android.permission.WRITE_EXTERNAL_STORAGE.
at android.os.Parcel.readException(Parcel.java:1489)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:468)
at android.content.ContentResolver.insert(ContentResolver.java:1212)
at android.app.DownloadManager.enqueue(DownloadManager.java:1390)
at com.srllimited.srl.ShowWebView.downloadFileInTask(ShowWebView.java:560)
at com.srllimited.srl.ShowWebView.access$100(ShowWebView.java:51)
at com.srllimited.srl.ShowWebView$2$1.run(ShowWebView.java:116)
at java.lang.Thread.run(Thread.java:841)

A: replace
File file = new File(v.getExternalFilesDir(null), resolvedFile);

by
final File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), resolvedFile);


text:
Q: Pass spring property to a jmx file I need to pass a spring property(that's defined via property source) to a jmx file.
The spring property is defined as @PropertySource(value="file:/etc/secrets/secret.properties")

Within this file, we have a property called as pass.key that I am trying to extract out.
I can do this in spring via
@Value("${pass.key}")
private string passKey

I have defined a jmx file that firsts calls an authentication API, gets the token as response, then we use the token to authorize the user and call subsequent API's.
For the authentication API, I need to pass in username,password(password would be the pass.key)
But when I pass this to jmx file for one of the API calls as an argument, its not able to parse that property.
Here's how I am passing it:
<stringProp name="Argument.value"> {
"password": ${pass.key}&#xd
}</stringProp>

Instead, I get the output as "password": ${pass.key} instead of the value associated with the secret.
I believe I am unable to pass spring properties to a JMX file. I need a way to pass them either via global variable or some other way.
Please assist.


text:
Q: how to repartition rdd based on data size I am working on spark streaming project which takes the data from Kafka applied some rules and save data in Hive. My problem is ingestion rate of data is not fixed. 60seconds may be 1 million message come or may be 1. I want to add repartition on Dstream. Because there is only 3 partition of Dstream, unable to process millions record within minute. repartition gives problem at the time of less than 20 records. It creates multiple small files in Hive.
dataStream.map(_._2).repartition(20)

My question is how I can rdd repartition based on rdd size. So that it can handle a single message or 1 million message.

A: You cannot do it in any useful way. Even if you decide to use transform
 stream.transform { rdd => {
   val n = rdd.count
   rdd.repartition(getNumParttitions(n))
 }}

this beats a whole purpose of the operation, as you have to scan all data before repartitioning and initial distribution will remain the bottleneck.
Instead, I'd recommend proper configuration, based either on spark.streaming.kafka.maxRatePerPartition (old API) or configure backpressure (spark.streaming.backpressure.enabled, spark.streaming.backpressure.initialRate, newer API)


text:
Q: HTML month spin boxes How do I make a month spin box using just HTML? I'm looking for something on the lines of:
<input type="number" min="10" max="20" />

Except months instead of numbers.

A: Do not use input type=month. This is currenty unsupported by major browsers.
You need to create one on your own or use a ready solution, like something for jQuery.
This question has been discussed here: month selection dropdown in html, javascript


text:
Q: How to create an Access crosstab query with totals for the columns AND the rows? I want my query result to look like this:
          Person1 Person2 Person3 Person4    Total
Status1         2       4       7       3      16
Status2         0       1       0       3      4
Status3         0       0       0       0      0
Status4         0       1       3       0      4
Total           2       6       10      6      24

I'm able to get everything except that bottom row with:
TRANSFORM Count(personName)
SELECT status, Count(status) AS Total
FROM table1
GROUP BY status
PIVOT personName

I found something about using a UNION to tack on the last row, but I can't seem to quite get that right.  Seems like this should be a common activity.

A: You'd basically have to run your query twice - once to get the data and then a second time to provide the aggregates. If you're set on doing this, make the first query to return data its own object. Then make another query to aggregate the first one another object. Create a final third query object to combine the two using a UNION as you mentioned.
Although I have to say I don't really recommend this. It sounds like you're trying to force the SQL to generate something that's really presentational information (i.e. it doesn't belong in the same dataset).

A: There is actually a simple solution to this issue. Once you have designed your crosstab query, go into design mode within the query and select "Totals" in the Records section on the Home tab. Then you can select the Sum or Count etc....
Here is a link that gives steps: http://office.microsoft.com/en-us/access-help/display-column-totals-in-a-datasheet-HA001233062.aspx

A: I've been looking for a solution too. Could not find one either except writing a query based on the crosstab and then summing that one and adding in to the bottom in a union query. Since I try to do all SQL statements from inside a form (more manageable to deploy) I do not like this approach: writing or refilling a Querydef/view from code etc.
If you display the results in a subform on your form, you might do the following:

below the subform, and another subform short enough to hold only 1
  record.

Bind the controls in the form to a function as follows:
control1 = fnADOSum(yourCrosstabfield1, yourCrosstabSQL)

Public Function fnADOSum(fldName As String, strInputSQL As String) As Double
    On Error GoTo ERRHANDLER

    Dim RS1 As ADODB.Recordset
    Dim cnn As ADODB.Connection
    Dim StrSQL As String
    Dim dblRunTot As Double

    Set RS1 = New ADODB.Recordset
    RS1.CursorLocation = adUseServer
    Set cnn = CurrentProject.Connection

    dblRunTot = 0

    With RS1
    .Open strInputSQL, cnn, adOpenForwardOnly, adLockReadOnly
        If Not .EOF And Not .BOF Then
            .MoveFirst
            Do Until .EOF
            dblRunTot = dblRunTot + Nz(.Fields(fldName).Value, 0)
            .MoveNext
            Loop
        End If
    .Close
    End With

    fnADOSum = dblRunTot

    'CLEAN UP:
    cnn.Close
    Set RS1 = Nothing
    Set cnn = Nothing

    EXITHANDLER:
    Exit Function

    ERRHANDLER:
    '' your own error handling proc
    '' LogError err.Number, err.Description

End Function

A: Lydia wrote: "There is actually a simple solution to this issue. Once you have designed your crosstab query, go into design mode within the query and select "Totals" in the Records section on the Home tab. Then you can select the Sum or Count etc...."
Going into the design mode did not work for me:

*

*I ran the query.

*Then went to the Home tab

*Selected Totals in the Records section

*The label "Totals" appeared at the bottom of the Crosstab query results, but no actual totals yet.

*Clicked on the empty cell to the right of the Totals label.

*An arrow appeared, and I chose "Sum".

[I am using Access 2013]

A: Found after much trial and error...
To toggle the totals rows ON when you enter a form or sub-form you can add the following VBA in the form's code:
Private Sub YourFormName_Enter()
    If Application.CommandBars.GetPressedMso("RecordsTotals") = False Then
        Application.CommandBars.ExecuteMso "RecordsTotals"
    End If
End Sub


text:
Q: What is the difference between these two ways of appending tuples to a list I have the following code that breaks:
l = []
tup = ('a', 'b')
l = l + tup

which gives the below error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can only concatenate list (not "tuple") to list

but the below code runs
l = []
tup = ('a','b')
l += tup

without any error.
I always thought l+= is the same as l = l +
What is going on over here?

A: The thing is that l = l + is calling list's __add__ method, whilst l += is calling __iadd__ method, which is addition in place (equivalent to calling extend method).


text:
Q: Vue - getting data attribute value in css Is there any option to get data attribute value in Vue css?
<template>

 TEST

</template>

A: You could use CSS variables for this case.

new Vue({
  el: '#app',
  data: {
    elStyle: {
      '--background': 'lightblue',
    }
  }
});
p:after {
  content: 'A pseudo element';
  background: var(--background, red); // Red is the fallback value
}


text:
Q: How to display more than one row from database in a textarea I'm trying to get all rows of beneficiaries table where localgovernment is the content of a text field "search" to display in a single textarea "result". the database is not having fix number of rows.
here is my code:
String bs = search.getText();

String SQL = "select * from BENEFICIARIES where localgovernment = '" +bs+"'";
        rs = stmt.executeQuery(SQL);

        String[] kjh;
        kjh = new String[20];
        int sd = 0;
        while(rs.next()){

        int id = rs.getInt("bid");
        String name = rs.getString("name");
        String gender = rs.getString("gender");
        String Phone = rs.getString("phone");
        String mail = rs.getString("email");
        String lga = rs.getString("localgovernment");
        String address = rs.getString("address");
        String etype = rs.getString("typeofempowerment");
        String benefits = rs.getString("listofbenefits");
        mega = id + " "+ name +" "+gender+" "+Phone+" "+mail+" "+lga+" "+address+" "+etype+" "+benefits;
       kjh[sd] = mega;
       sd = sd + 1;
        }
        String jhg = kjh[0] +"\n"+ kjh[1] +"\n"+ kjh[2] +"\n"+ kjh[3] +"\n"+ kjh[4] +"\n"+ kjh[5] +"\n"+ kjh[6] +"\n"+ kjh[7] +"\n"+ kjh[8] +"\n"+ kjh[9] +"\n"+ kjh[10] +"\n"+ kjh[11] +"\n"+ kjh[12] +"\n"+ kjh[13] +"\n"+ kjh[14] +"\n"+ kjh[15] +"\n"+ kjh[16] +"\n"+ kjh[17] +"\n"+ kjh[18] +"\n"+ kjh[19];

        result.setText(jhg);

how do i make this to display rows of variable length in a textarea?

A: Simply use loop.
One more thing to add, you can use List types like ArrayList or LinkedList.
Another simple way to display data is to use JTable instead of Textarea.
Try this...
String bs = search.getText();
String SQL = "select * from BENEFICIARIES where localgovernment = '" +bs+"'";
rs = stmt.executeQuery(SQL);
List<String> kjh = new ArrayList<String>();
while(rs.next()){
    int id = rs.getInt("bid");
    String name = rs.getString("name");
    String gender = rs.getString("gender");
    String Phone = rs.getString("phone");
    String mail = rs.getString("email");
    String lga = rs.getString("localgovernment");
    String address = rs.getString("address");
    String etype = rs.getString("typeofempowerment");
    String benefits = rs.getString("listofbenefits");
    mega = id + " "+ name +" "+gender+" "+Phone+" "+mail+" "+lga+" "+address+" "+etype+" "+benefits;
    kjh.add(mega);
}
String jhg="";
for(String s:kjh)
    jhg+=s+"\n";
result.setText(jhg);


text:
Q: Restore from last hibernation state on reboot I restored my PC from hibernation earlier today.  10 minutes after booting, there was a power cut.   These things happen.
Is there any way to tell my PC on next boot to use the previous hibernation state to boot into?  Some motherboard setting or such?  I don't know how the machine determines to boot from scratch or from hibernation.  I know that hiberfil.sys gets left lying around after booting from hibernation but I don't know if it's reusable or not.  If it's not then I assume I'm definitely out of luck at that point.
From reading I suspect I might be out of luck, however I feel my question differs from the others on this subject because I'm not looking to set this up as a regular process.
I've not yet powered the machine in question back up yet, just in case there is a chance it can be restored.
My OS is Windows 8.1.
The motherboard is a RoG Maximus VI Hero.
EDIT
Whilst my question has been answered with confirmation that restoring a previous hibernation state does not appear to be possible, this question is not a duplicate of the ones highlighted in the comments; I'd already read those before I posted my own.
842161 Refers to a different operating system (I've since added the Windows-8-1 tag) and also for a normal reboot through a Windows update, which could easily have made all sorts of changes.  My situation related to direct power loss barely 10 minutes after booting from hibernation (and thus, I would presume, minimal harddisk changes following the past hibernation).
607300 Relates to an entirely different request where they appear to want to set up some sort of regular system that would be able to automatically save a state like with hibernation that can be restored from so that on sudden power loss they can jump right back to where they were.

A: What you want to do is not possible and in fact Windows has gone to considerable lengths to ensure it does not. And for good reason. Doing so would almost certainly result in some level of data corruption. The exact nature and extent of the corruption is unpredictable but you can be sure it would not be pleasant.
Early in the boot process Windows checks for a special signature in the hiberfil.sys file. If this signature is present and verified a restore from hibernation is started. If the signature is not present or in any way invalid a normal boot will begin. The details of how this works are undocumented. After the restore is completed the signature is invalidated. This is to ensure the current hiberfil.sys contents is used only once.
When the system is put in hibernation the system state in memory is saved to hiberfil.sys so it can later be restored. But the hiberfil.sys file does not contain the entire system state. The state is also in the pagefile, the registry, and your data files on disk. The memory contents in hiberfil.sys contains portions of these and all must be 100% consistent with each other or the restored state would be corrupt. This would happen be the inevitable result if a previous hiberfil.sys contents were used. For that reason it is not allowed.


text:
Q: Explanation of how to go from polar to parametric equations. I was wondering how you can make a polar equation parametric, and I just don't get it. My book says that for $r = f(\theta)$, $x = f(t) \cos t$ and $y = f(t) \sin t$, but this makes absolutely no sense to me.
If you need an example problem, $r = \frac{4}{2 - \cos \theta}$ would work very well. Thanks in advance.

A: In your example, $f(\theta) = \dfrac{4}{2 - \cos \theta}$.  Therefore, your parametric equations would be $$\begin{align*} x(t) &= f(t) \cos t = \frac{4}{2 - \cos t} \cos t = \frac{4 \cos t}{2 - \cos t}, \\ y(t) &= f(t) \sin t = \frac{4}{2 - \cos t} \sin t = \frac{4 \sin t}{2 - \cos t}. \end{align*}$$  That is it.
The reason why this works is because a polar curve can be interpreted as a special kind of parametrization, where the parameter $t$ is the angle $\theta$ as measured counterclockwise from the positive $x$-axis; and the radius $r$ is broken into its horizontal ($x$) and vertical ($y$) components via the relationship $x = r \cos \theta$, $y = r \sin \theta$.  Since $r$ is a function of angle $\theta$, then $x$ and $y$ become a function of $\theta$ and in turn the parameter $t = \theta$.

A: In two dimensions you have:
$$x=r\cos(\theta)$$
$$y=r\sin(\theta)$$
So, taking the square of both equations and summing them you get:
$$r^2=x^2+y^2$$
$$r = \sqrt{x^2+y^2}$$
Now we'll get the relation for $\theta$. Dividing the second equation over the first one:
$$\frac{y}{x}=\frac{\sin (\theta)}{\cos (\theta)}$$
$$\frac{y}{x}=\tan(\theta)$$
$$\theta=\arctan \frac{y}{x}$$
There you have the inverse change of variables for polar coordinates.


text:
Q: Calling CXF webservice through Apache Camel I am trying to integrate Apache CXF with Apache Camel.
Configuration for camel:
<cxf:cxfEndpoint id="authTest"
        address="/cxfAuth"
        serviceClass="com.test.AuthService" >
        <cxf:properties>
            <entry key="dataFormat" value="POJO" />
            <entry key="setDefaultBus" value="true" />
        </cxf:properties>
    </cxf:cxfEndpoint>

     <camel:camelContext trace="true">
        <camel:route>
            <camel:from uri="cxf:bean:authTest" />
            <camel:to uri="bean:routeExitResponseProcessor"/>
        </camel:route>
    </camel:camelContext>

Now to invoke specific operation on web service I am using this:
<camel:route>
            <camel:from uri="direct:startAuthTest"/>
            <camel:setHeader headerName="getEmployee">
                <camel:constant>gid</camel:constant>
            </camel:setHeader>
            <camel:to uri="cxf:bean:authTest" />
            <camel:log message=">>> data is : ${body}"/>
            <camel:to uri="bean:routeExitResponseProcessor"/>
        </camel:route>

But after including above config I am getting WARN ServletController:149 - Can't find the the request for http://localhost:8080/CXFService/services/cxfAuth's Observer on the server console and my webservice is not found on browser.
Please help.

A: you can call the following to get the CXF operation name being called...see http://camel.apache.org/cxf.html for more details
String operation = (String)in.getHeader(CxfConstants.OPERATION_NAME);

also, see this unit test for example usage...
http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java

A: At CXF Endpoint
    <cxf:cxfEndpoint id="yourServiceCall"
    address="http://localhost:8181/yourservice/services/yourserviceport"
    wsdlURL="wsdl/yourwsdl.wsdl" xmlns:ns="http://service.your.com"
    endpointName="ns:YourServicePort" serviceName="ns:yourService"
    serviceClass="com.service.YourServicePortType">

and at Camel Endpoint
   camelContext id="camelId" xmlns="http://camel.apache.org/schema/spring">
   <camel:dataFormats>
        <camel:jaxb contextPath="com.your.service" id="jaxb" />
    </camel:dataFormats>

    <route id="route1">
        <from uri="cxf:bean:yourServiceCall?dataFormat=PAYLOAD" />
        <camel:unmarshal ref="jaxb" />
        <log message="log: Called from cxf endpoint" />
        <!-- Your Logic -->
        <camel:process ref="ExitResponseProcessor"/>
        <camel:marshal ref="jaxb" />
    </camel:route>

Based On Himanshu Yadav Comments: Update
 <camel:choice>
 <camel:when>
 <camel:simple>${body} is com.your.service.YourRequest</camel:simple>
 <!-- Your Logic or call any bean method with <camel:bean ref="YourBean " method="YourMethod" /      /> -->
 </camel:when>
 <camel:when> </camel:when>
 <camel:otherwise> </camel:otherwise>
 </camel:choice


text:
Q: Three INNER JOINs for 4 tables, some values may or may not be null in query On one of the pages of my site, I am using an inner join on 4 tables (login, stats, poll, and announce) as follows:
$login_user = mysqli_real_escape_string($cxn, $_SESSION['user']);

$sqlAll = mysqli_fetch_assoc(mysqli_query($cxn,
    "SELECT login.picture, login.statement,
    stats.wealth,
    MAX(poll.polltime) AS pollunixtime,
    MAX(announce.announcetime) AS announceunixtime
    FROM login
    INNER JOIN stats ON login.user = stats.user
    INNER JOIN poll ON login.user = poll.user
    INNER JOIN announce ON login.user = announce.source
    WHERE (login.user = '$login_user' AND announce.announcetype = 'feedback')"));

This inner join works fine as long as at least one row in the table announce and one row in the table poll is populated for that user, e.g., this form input's value is defined:
<form id="myForm"><input type="hidden" name="wealth" value="<?= $sqlAll['wealth'] ?>"></form>//"View Page Source" shows this value is defined and shows up as value="number"

However, I noticed that when there is no row exists for either table for a user, the query fails in that certain values from the query are undefined. For example, if no rows for either table, the value of this form input is undefined:
<form id="myForm"><input type="hidden" name="wealth" value="<?= $sqlAll['wealth'] ?>"></form>//"View Page Source" shows this value is undefined and shows up as value=""

I tried introducing CASE into my query in a variety of ways, for example:
$sqlAll = mysqli_fetch_assoc(mysqli_query($cxn,
    "SELECT login.picture, login.statement,
     stats.wealth,
     MAX(poll.polltime) AS pollunixtime,
     MAX(announce.announcetime) AS announceunixtime
     FROM login
     INNER JOIN stats ON login.user = stats.user
     INNER JOIN poll ON CASE WHEN poll.polltime IS NOT NULL THEN login.user = poll.user END
     INNER JOIN announce ON CASE WHEN announce.announcetime IS NOT NULL THEN login.user = announce.source END
     WHERE (login.user = '$login_user' AND announce.announcetype = 'feedback')"));

Since polltime and announcetime are of type INT, I also tried to use ">" as follows:
$sqlAll = mysqli_fetch_assoc(mysqli_query($cxn,
    "SELECT login.picture, login.statement,
    stats.wealth,
    MAX(poll.polltime) AS pollunixtime,
    MAX(announce.announcetime) AS announceunixtime
    FROM login
    INNER JOIN stats ON login.user = stats.user
    INNER JOIN poll ON CASE WHEN poll.polltime > 0 THEN login.user = poll.user END
    INNER JOIN announce ON CASE WHEN announce.announcetime > 0 THEN login.user = announce.source END
    WHERE (login.user = '$login_user' AND announce.announcetype = 'feedback')"));

I also tried variations where the CASE statement was placed with poll and announce as follows:
$sqlAll = mysqli_fetch_assoc(mysqli_query($cxn,
    "SELECT login.picture, login.statement,
     stats.wealth,
     CASE WHEN MAX(poll.polltime) IS NOT NULL THEN 'pollunixtime' END,
     CASE WHEN MAX(announce.announcetime) IS NOT NULL THEN 'announceunixtime' END
     FROM login
     INNER JOIN stats ON login.user = stats.user
     INNER JOIN poll ON login.user = poll.user
     INNER JOIN announce ON login.user = announce.source
     WHERE (login.user = '$login_user' AND announce.announcetype = 'feedback')"));

No variation I have tried has worked. Basically, I need a CONDITIONAL INNER JOIN such that the 2nd and 3rd inner joins are performed if polltime and announcetime both exist for a given user, else the 2nd and 3rd inner joins are not performed. Is this possible?
Please note that I already have a hack solution, which in this system involves breaking up the one query above into 3 separate queries and use ISSET to test for the existence of polltime and announcetime for a given user. I would like to do better than this solution!

A: You can do something somewhat similar to what you're asking by using a LEFT JOIN instead of an INNER JOIN.


text:
Q: What are some ways to increase the performance of a Bind caching nameserver? I have a BIND nameserver on my network sitting on a machine with a lot of RAM. How can I increase performance? Any way to increase the TTL for which resolutions are stored in memory? Any way to "pre fetch" top domain names?

A: BIND does it's own memory management, and so long as you've got plenty of RAM free no tweaking is necessary. Please do not screw with TTLs or anything else specified in an RFC. Seriously, people will want to hurt you just for asking that question. As for pre-caching, you can certainly do a nslookup example.com for all the various "common" domain names you want cached, but there should be relatively little benefit to this.
It sounds like you're either chasing performance without a performance problem, or not filling us in on the actual problem you're facing. If it ain't broke, don't fix it. If DNS lookups are taking a notable amount of time you may want to use your ISPs (or other relatively-local) DNS servers as forwarders, as their "distance" should be less than your server doing fully recursive lookups, and you'd get the benefit of their caching as well.


text:
Q: LICENSE_LIMIT_EXCEEDED:License Limit Exceeded Salesforce Hi I am working with sales force and from my code i am trying to create a salesforce user and the attributes which i am passing is mention below:
{
"User" : "freeuser",
"Alias" : "freeuser",
"Email" : "freeuser.freeuser@freeuser.com",
"EmailEncodingKey" : "ISO-8859-1",
"LanguageLocaleKey" : "en_US",
"LastName" : "freeuser",
"LocaleSidKey" : "en_US",
"TimeZoneSidKey" : "America/Los_Angeles",
"Username" : "freeuser.freeuser@freeuser.com",
"UserPermissionsCallCenterAutoLogin":"false",
"UserPermissionsMarketingUser":"false",
"UserPermissionsOfflineUser":"false",
"ProfileId" : "00e280000016hS2AAI"
}

Below is the error I am getting:
[SaveResult  errors='{[2][Error  fields='{[0]}'
 message='License Limit Exceeded'
 statusCode='LICENSE_LIMIT_EXCEEDED'
]
,[Error  fields='{[0]}'
message='license limit exceeded'
statusCode='LICENSE_LIMIT_EXCEEDED'
]
,}'
id='null'
success='false'
]

A: Your Error itself stating that you are exceeding license limit. In that case you need to purchase new license or you need to deactivate a user for that particular license.
You can check remaining license count under
Setup-> Company Information -> User Licenses related list.

A: You need to buy more Salesforce licenses, currently you are at the maximum and Salesforce does not permit you to create another user. That's what the error message is trying to tell you.


text:
Q: Chaining futures to an Option future extern crate futures; // 0.1.25

use futures::Future;

fn another_future(a: u8)  -> impl Future<Item=u8, Error=()> {
    println!("a is {}", a);
    futures::future::ok(a)
}

fn example() -> impl Future<Item=(), Error=()> {
    futures::future::ok(Some(127))
    .and_then(|opt| {
        if opt.is_some() {
        match opt {
            Some(n) => {
                another_future(n).and_then(|n| {
                    Ok(())
                })
            },
            None => {
                // i really don't want to call another
                // what to put in this branch to make the type check?
            },
        }
    })
}

fn main() {
    println!("Hello, world!");
}

Playground
I need to sort of conditionally apply and_then. In the example, the future resolves to and Option, and the result is passed to the next future by and_then only if it's not a None. But doing so leaves match arms with incompatible types.
One workaround is to not use Option and return errors instead of None. I wonder if there are more idiomatic alternatives.


text:
Q: Is the Confluent Platform based on Kafka free? open source? Kafka itself is completely free and open source.
Confluent is the for profit company by the creators of Kafka. The Confluent Platform is Kafka plus various extras such as the schema registry and database connectors. I presume Confluent makes money by selling support contracts and services.
Is the Confluent Platform free and/or open source? Am I obligated to purchase licensing or paid support?

A: Taken from their website's product page.

The Confluent Platform is an open source platform that contains all the components you need to create a scalable data platform built around Apache Kafka. These components draw on our experience building some of the largest streaming data pipelines in the world.

Here's the download link for their product. It seems like they only make money off supporting their product if you choose to pay for it. They now offer a managed cloud service as well as support for their open source products.

A: The Confluent Platform is free and open source (see https://github.com/confluentinc/ for the source).
There is also a Confluent Platform Enterprise version that includes the Control Center monitoring app (which is not open source) and includes support for the core Kafka, Confluent Platform OS components, and Control Center.
See http://www.confluent.io/product for more details.
UPDATE for Version 5.1 and above
On Dec 14th, 2018 Confluent announced that that new versions of the Confluent Platform (starting with Version 5.1) will be distributed under a new Confluent Community License.
The detailed FAQ about the new license located at
https://www.confluent.io/confluent-community-license-faq includes the following question and answer:
"Is Confluent Community License open source?
Strictly speaking it is "source-available." Many people use the phrase "open source" in a loose sense to mean that you can freely download, modify, and redistribute the code, and those things are all true of the code under the Confluent Community License. However, in the strictest sense "open source" means a license approved by the Open Source Initiative ("OSI") which meets a particular set of criteria. The Confluent Community License is not approved by the OSI and likely would not be as it excludes the use case of creating a SaaS offering of the code. Because of this, we will not refer to the Confluent Community License or any code released under it as open source."
Announcement of License changes:
https://www.confluent.io/blog/license-changes-confluent-platform
The actual Confluent Community License
https://www.confluent.io/confluent-community-license


text:
Q: JSR-352 : Stackoverflow error in DB2DataStoreHelper.findMappingClass Caused by: java.lang.StackOverflowError
       at java.lang.Integer.valueOf(Integer.java:844)
       at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:430)
       at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445)
       at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445)
       at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445)
       at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445)
       at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445)
       at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445)
       at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445)
       at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445)
       at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445)
       at
........
This com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445) keeps happening till there is a stackoverflow error. The error occurs when i call executeBatch() in the Writers writeItems() so i am not sure where or why exactly it happens.
This question was asked 3 years ago by a user facing a similar problem. But there are no responses and re running did not help.
Infinite loop in DB2 JDBC driver

A: This looks like a bug with how the SQLException is getting created.
What is happening in the DB2DataStoreHelper.findMappingClass() in your scenario is effectively this:
public Class<?> findMappingClass(SQLException e) {
    // Check if 'e' is in the error map anywhere,
    // if it is, return the class.

    // otherwise, check the next exception in the chain
    SQLException next = e.getNextException();
    return findMappingClass(next);
}

So if you have 2 or more SQLExceptions that create a cycle, such as:
SQLException a = new SQLException();
SQLException b = new SQLException();

a.setNextException(b);
b.setNextException(a);

then your exception is invalid, because it creates a cycle.  Therefore, any code which attempts to process the SQLException chain will run into an infinite loop as you are observing.
Review your application code to make sure that there are no cycles created in any of your exceptions.


text:
Q: How to click an element which is not loaded in DOM using selenium java? There is div with many internal divs as seen in screenshot
As seen in screenshot there are 6col and 1 checkbox col so total 7 columns are visble. But there are more columns till col40 if you scroll right. But the divs of all 40 cols are not loaded at one time but loads upon scrolling
I want to validate if col35-col40(or any random col after col6) are visible and is editable and clickable.
I have tried below options but none of them working.

*

*Javascript executor (with or without webelement for scrolling horizontally)

*Robot keys.tab/keys.cntrl+keys.end/all keys option using which we can manually go to that particular column

*Sendkeys

*Action class

*Zoom out (this is not the feasible/ correct way to do but still tried but this is also not working as expected)

Need some solution for this.
Please note: The scroll bar is not having any identifier/attribute but it is inside the main div without any unique identity.

A: If your element is not loaded yet in DOM, you cannot perform any actions on it since is not there.
A workaround for your problem is to design a method to scroll until your element is available in DOM, and then perform desired actions (check, click etc).
Note that you cannot scroll to your element (because is not there) so you can scroll to another reference (locator) or based on pixels using javascript executor object.


text:
Q: Issue with Postback and Custom Validators in asp.net I need some help on an issue, related with asp.net validators and postback.
The issue is that I have a page say 'p1' and it has a master page 'm1'. In addition to these I also have a usercontrol 'u1'.
Now, the issue is that on master page 'm1', I have a button that initiates a postback. And on my usercontrol 'u1', I have some fields which I need to check/validate and stop the postback if the fields are invalid.
I have tried using customvalidators and forcefully calling Page.Validate() method. But by doing this, I can see the page.IsValid property is false but sill the postback happens. I have even tried to write a return statement if the control fields are invalid but it doesn't helps..
Please note that I do not want to make any changes in the masterpage as this may have high impact on the other pages.

A: If clicking a button causes postbacks even when the page is invalid (as in your case it is proven with Page.IsValid property is False), then this means the button isn't configured to check for validations on the client side.
Solution 1:
You need to intialize the "CausesValidation" Property of the Button with the value True"
However, this requires changing the markup of the "Button" on the markup. And this isn't something you wish to perform.
Solution 2:
You can from within your page, access the Button of the Master page from within the Load Event and Initialize the CausesValidation property of the button to True.
Have a look at the following link to find the button from within the master page:
https://msdn.microsoft.com/en-us/library/xxwa0ff0.aspx


text:
Q: Creating an embeddable javascript widget that uses other js libraries Objective
I am trying to build a widget that puts a floating button on my users' sites. On click the button, I would show a web form (that sits on my server) in the form of a lightbox - I am currently using Fancybox.
Problem
In this case my widget relies on two dependent libraries, jQuery and Fancybox. How can I ensure that they are both loaded before I call my fancybox codes to load my URL? I have tried looking at few SO questions (here, here, and here and some others) and also Alex Marandon's great tutorial but they don't seem to rely on another library such as in my case fancybox.
I did something like the below but my main problem was with the Fancybox libraries being loaded asynchronously using $.getScript and hence not available for calling when I called for them few lines after.
/******** Our main function ********/
function main() {
jQuery(document).ready(function($) {
  /******* Load FANCYBOX *******/
  var fancy_link = $("<link>", {
    rel: "stylesheet",
    type: "text/css",
    href: widgetURL + "fancybox/source/jquery.fancybox.css?v=2.1.5",
    media: "screen"
  });
  fancy_link.appendTo('head');
  var fancy2_link = $("<link>", {
    rel: "stylesheet",
    type: "text/css",
    href: widgetURL + "fancybox/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7",
    media: "screen"
  });
  fancy2_link.appendTo('head');

  var fancyboxScript = widgetURL + "fancybox/source/jquery.fancybox.pack.js?v=2.1.5";
  $.getScript(fancyboxScript);

  var fancyboxScript2 = widgetURL + "fancybox/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7";
  $.getScript(fancyboxScript2);

  /******* Load CSS *******/
  var css_link = $("<link>", {
    rel: "stylesheet",
    type: "text/css",
    href: widgetURL + "myWidget.css"
  });
  css_link.appendTo('head');

  /******* Load Javascript *******/

  var widgetJS = widgetURL + "widgetFunction.js";
  $.getScript(widgetJS);

  /******* Load HTML *******/
  var jsonp_url = widgetURL + "myWidgetCall.php?callback=?";

  $.getJSON(jsonp_url,params, function(data) {
    $('#widget-container').html(data.html);
  });
});
}

I am no expert in this field, so if there are other alternative methods to achieve the same objective stated above, I will be happy to try.

A: $.getScript has a callback success function:
jQuery.getScript( url [, success(script, textStatus, jqXHR) ] )

So, you can make it as follows:
$.getScript(fancyboxScript, function(script, textStatus, jqXHR){
      "call your methods here";
});


text:
Q: Python Kivy - Adding a GridLayout to a BoxLayout I want to create an UI with Buttons on top and a few Labels on bottom and if the labels exceeds the height it should be scrollable.
Something like this:

So far this is my code:
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.scrollview import ScrollView
from kivy.uix.gridlayout import GridLayout

class MyApp(App):

    main_layout = BoxLayout(orientation='vertical')
    top_layout = BoxLayout(orientation='horizontal')

    scrollView = ScrollView()
    gridLayout = GridLayout()
    gridLayout.cols = 1
    gridLayout.minimum_height = 10
    gridLayout.padding = [0, 0, 0, 0]
    scrollView.add_widget(gridLayout)

    main_layout.add_widget(top_layout)
    main_layout.add_widget(scrollView)

    def btn_create(self, instance):
        self.gridLayout.add_widget(Label(text='test'))

    def btn_edit(self, instance):
        pass

    def btn_delete(self, instance):
        pass

    def build(self):
        self.top_layout.size_hint=(1, .1)

        # Button 'Erstellen'
        btnCreate = Button()
        btnCreate.text = 'Erstellen'
        btnCreate.bind(on_press=self.btn_create)

        # Button 'Bearbeiten'
        btnEdit = Button()
        btnEdit.text = 'Bearbeiten'
        btnEdit.bind(on_press=self.btn_edit)

        # Button 'Löschen'
        btnDelete = Button()
        btnDelete.text = 'Löschen'
        btnDelete.bind(on_press=self.btn_delete)

        self.top_layout.add_widget(btnCreate)
        self.top_layout.add_widget(btnEdit)
        self.top_layout.add_widget(btnDelete)

        return self.main_layout

if __name__ == '__main__':
    MyApp().run()

I added a GridLayout to a ScrollView, but this doesn't seem to work.
How can i make a scrollable list?

A: You have to set the size_hint_y of the GridLayout to None so that the height does not depend on the ScrollView and the size is minimum equal to the size of the GridLayout. On the other hand the Label must have size_hint_y to None so that the height does not depend on the GridLayout.
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.scrollview import ScrollView
from kivy.uix.gridlayout import GridLayout

class MyApp(App):

    main_layout = BoxLayout(orientation='vertical')
    top_layout = BoxLayout(orientation='horizontal')

    scrollView = ScrollView()
    gridLayout = GridLayout(size_hint_y=None)

    gridLayout.cols = 1
    gridLayout.padding = [0, 0, 0, 0]
    gridLayout.bind(minimum_height=gridLayout.setter('height'))
    scrollView.add_widget(gridLayout)

    main_layout.add_widget(top_layout)
    main_layout.add_widget(scrollView)

    def btn_create(self, instance):
        self.gridLayout.add_widget(Label(text='test', size_hint_y=None))

    def btn_edit(self, instance):
        pass

    def btn_delete(self, instance):
        pass

    def build(self):
        self.top_layout.size_hint=(1, .1)

        # Button 'Erstellen'
        btnCreate = Button()
        btnCreate.text = 'Erstellen'
        btnCreate.bind(on_press=self.btn_create)

        # Button 'Bearbeiten'
        btnEdit = Button()
        btnEdit.text = 'Bearbeiten'
        btnEdit.bind(on_press=self.btn_edit)

        # Button 'Löschen'
        btnDelete = Button()
        btnDelete.text = 'Löschen'
        btnDelete.bind(on_press=self.btn_delete)

        self.top_layout.add_widget(btnCreate)
        self.top_layout.add_widget(btnEdit)
        self.top_layout.add_widget(btnDelete)

        return self.main_layout

if __name__ == '__main__':
    MyApp().run()


text:
Q: Tab Content IFrame Not Loading Currently I am trying to load an Iframe within TabContent.
Why is this external webpage not loading correctly when the tab is selected?
Fiddle: https://jsfiddle.net/hpjnkmz1/1/
HTML:
<!doctype html>

    <meta name="viewport" content="width=device-width, initial-scale=1">

      <button class="tablinks" onclick="openCity(event, 'PageOne')">Page One</button>
      <button class="tablinks" onclick="openCity(event, 'PageTwo')">Page Two</button>
      <button class="tablinks" onclick="openCity(event, 'PageThree')">Page Three</button>

London

London is the capital city of England.

Paris

Paris is the capital of France.

JavaScript:
function loadContent(id, url) {
  var node = document.getElementById(id);
  node.innerHTML = url;
}

function openCity(evt, cityName) {
  var i, tabcontent, tablinks;

  if (cityName == 'PageThree') {
    alert("Load External Content");
    $("#siteloader").html('');
  }

  tabcontent = document.getElementsByClassName("tabcontent");
  for (i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }
  tablinks = document.getElementsByClassName("tablinks");
  for (i = 0; i < tablinks.length; i++) {
    tablinks[i].className = tablinks[i].className.replace(" active", "");
  }
  document.getElementById(cityName).style.display = "block";
  evt.currentTarget.className += " active";
}

A: You get an error (look in the console):

Mixed Content: The page at '' was loaded over HTTPS, but requested an insecure frame ''. This request has been blocked; the content must be served over HTTPS.

Why does the error appear?
This error was initiated by the browser and appears due to the fact that a secure page (loaded via https) cannot use resources (scripts, styles) from unsafe sources (i.e. those that work via http).
Therefore, the browser blocks the download of such resources and reports this in the log.
What does this error affect?
The error results in the site being unable to load the required resources.
If the error is related to the loading of js scripts, then part of the functionality for which this script is loaded will not work on the site.
How do I fix the error?
The error correction itself is very simple: you need to replace http:// with https:// when connecting third-party scripts and styles - but this is if the third-party resource supports a secure protocol. If it does not support it, then downloading from it is impossible, you need to look for other solutions to this problem.
Try this:
$("#siteloader").html("");


text:
Q: Turn display of marker tooltips on/off in layer control in Leaflet I want to add tooltip which will show magnitude for each earthquake epicenter and was able to make it but I have a problem that with many epicenters in one area tooltips are overlapped.
My question is can I first hide tooltips (magnitudes) and then on control when clicked to show them?
This is my code that shows epicenters, and at the end you will see that I have added .bindTooltip.
var earthquakes = L.geoJson([], {
        onEachFeature: function (feature, layer) {
            var props = feature.properties;

        },
        pointToLayer: function (feature, latlng) {
            var color,
                mag,
                radius,
                weight;
                mag = feature.properties.mag;
                label = String(mag);
            if (mag === null) {
                color = '#FF0000';
                radius = 2;
                weight = 1;
            } else {
                color = '#FF0000';
                radius = 2 * Math.max(mag, 1);
                weight = 1;
            }
            if (feature.properties.type === 'quarry blast') {
                color = '#FF00FF';
            }
            return L.circleMarker(latlng, {
                color: color,
                radius: radius,
                weight: weight
            }).bindTooltip(label, {
                permanent: true,
                direction: 'center',
                opacity: 0.65,
                className: 'pointlabel'
            }).openTooltip();
        }
    }).addTo(map);

At the beginning of code I have below code for controls where I can switch map and also show lines (earth faults), so can I somehow by using overlays control be able to bintooltip when checked and unbindtooltip when unchecked?
var Faults = new L.LayerGroup();
var Tooltip = new L.LayerGroup();
var Base = {
  "Arcgis map": Arcmap,
  "Google terrain": googlemap
};
var overlays = {
  "Faults": Faults,
  "Tooltip": Tooltip
};

L.control.layers(Base, overlays, {collapsed:false}).addTo(map);

In layer control I would like to have checkbox called tooltip so when checked it show tooltip and when unchecked hide it, see image below:

Here is complete code: https://jsfiddle.net/Tkalac/f5mqo6Lj/1/#&togetherjs=9KtCAh7Unw

A: Group layer Tooltip can be used not to actually display tooltips, bust just as a switch in layer control to trigger tooltips display on/off.
When layer Tooltip is selected in the control, it fires layer event add. In event processing function markers from earthquakesEMSC are iterated and tooltips made permanent. When layer Tooltip is deselected in the control,  it fires layer event remove. In event processing function markers from earthquakesEMSC are iterated and tooltips made not permanent.
Logic of the code below is that initially tooltips are not displayed.
var earthquakesEMSC = L.geoJson([], {
  onEachFeature: function (feature, layer) {
    var props = feature.properties;

    var datum = props.time,
    split = datum.split('T');
    var vrijeme = split[1],
    split2 = split[1].split('.');
    layer.bindPopup('Date: ' + split[0] + '
' + 'Time: ' + split2[0] + '
' + 'Type: ' + props.magtype + '
' + 'Mag: ' + props.mag + '
' + 'Depth: ' + props.depth + ' km' + '
' + 'Station: ' + props.auth + '
' +'source: ' + props.source_catalog);
  },
  pointToLayer: function (feature, latlng) {
    label = String(feature.properties.mag)
    var color,
      mag,
      radius,
      weight;
      mag = feature.properties.mag;
      label = String(mag);
    if (mag === null) {
      color = '#FF0000';
      radius = 2;
      weight = 1;
    } else {
      color = '#FF0000';
      radius = 2 * Math.max(mag, 1);
      weight = 1;
    }
    if (feature.properties.type === 'quarry blast') {
      color = '#FF00FF';
    }
    return L.circleMarker(latlng, {
      color: color,
      radius: radius,
      weight: weight
    }).bindTooltip(label, {
      direction: 'center',
      opacity: 0.5,
      className: 'pointlabel'
    });
  }
}).addTo(map);

var Tooltip = new L.LayerGroup();

Tooltip.on('add', function() {
  earthquakesEMSC.eachLayer(function(marker) {
    var tooltip = marker.getTooltip();
    marker.unbindTooltip();
    tooltip.options.permanent = true;
    marker.bindTooltip(tooltip);
  });
});
Tooltip.on('remove', function() {
  earthquakesEMSC.eachLayer(function(marker) {
    var tooltip = marker.getTooltip();
    marker.unbindTooltip();
    tooltip.options.permanent = false;
    marker.bindTooltip(tooltip);
  });
});


text:
Q: How to retrieve Facebook-like people counter with SQL Server? Here in my app I have problems, and a list of people who faced them. Today I'm retrieving all people names through STUFF function like the sample below:
select problem.*,
(
    STUFF
    (
        (
            SELECT TOP(3)', ' + person.name
            FROM
                problem_person
                LEFT JOIN person ON problem_person.personId = person.Id
            WHERE
                problem_person.problemId = problem.Id
                order by person.name
            FOR XML PATH(''), TYPE
        ).value('.', 'NVARCHAR(MAX)'), 1, 1, ''
    )
) as peopleWhoFaced from problem

However, when a lot of people face the same problem, peopleWhoFaced field gets huge. How to retrieve something like Person 1, Person 2 and 36 more faced the problem ? I know that I could do this at API-level, but I'm trying to avoid doing so, and keep API code clean.
How could I accomplish that? Will I need a cursor or something like that?
Thank you in advance.

A: Append COUNT(*) - 3:
DECLARE @count int = (SELECT COUNT(*) - 3
                      FROM problem
                      LEFT JOIN person
                      ON problem.problemId = person.problemId
                      INNER JOIN
                         problem_person
                      ON problem_person.personId = person.Id)

select problem.*,
(
    STUFF
    (
        (
            SELECT TOP(3)', ' + person.name
            FROM
                problem_person
                LEFT JOIN person ON problem_person.personId = person.Id
            WHERE
                problem_person.problemId = problem.Id
                order by person.name
            FOR XML PATH(''), TYPE
        ).value('.', 'NVARCHAR(MAX)'), 1, 1, ''
    ) + CASE WHEN @count > 0 THEN N' and ' + CAST(@count as NVARCHAR(20)) + N' more faced the problem' ELSE N'' END
) as peopleWhoFaced from problem


text:
Q: Join statement for MySQL I have a MySQL database containing the following tables:
Table: Professor
Attributes: ID, ProfessorName

Table: Class
Attributes: ID, ClassName, SubjectID (secondary)

Table: Subject
Attributes: ID, SubjectName

Table: DocCategory
Attributes: ID, DocCategoryName

Table: Document
Attributes: ID, DocName, ProfessorID (secondary), ClassID (secondary), DocCategoryID (secondary)

Can someone point me in the right direction with a query so that I get a report containing:
a list of all ProfessorName with a second column containing a count for documents in the document table related to that professor?
Thanks in advance!

A: Use:
  SELECT p.professorname,
         COUNT(*) AS numDocuments
    FROM PROFESSOR p
    JOIN DOCUMENT d ON d.professorid = p.id
GROUP BY p.professorname

To see a list of all professors -- those without documents will list a value of zero -- use:
   SELECT p.professorname,
          COALESCE(COUNT(d.id), 0) AS numDocuments
     FROM PROFESSOR p
LEFT JOIN DOCUMENT d ON d.professorid = p.id
 GROUP BY p.professorname


text:
Q: VPS Ubuntu php artisan commands not working I can't run any php artisan command, it shows always the same error. I understand what it say but I can't execute php artisan migrate to make that table. I'm on VPS Ubuntu 16.04. Everything works perfectly on my localhost,this problem appears only when deploy app on vps
error image
error is:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cv.contacts' doesn't exist (SQL: select * from `contacts` where `contacts`.`deleted_at` is null)

My routes:
Route::get('/', 'HomeController@index')->name('home');
Route::post('/', 'ContactController@store')->name('contact.store');
//eng
Route::get('/en', 'HomeController@index_en')->name('home.en');
Route::post('/en', 'ContactController@store')->name('contact.store');


text:
Q: Can we configure Talend for data integration to use SSL Can we configure Talend for data integration to use SSL.
I have gone through some the links and talend community and learnt that it could be done for Talend ESB .Wanted to know how we do the same for Talend for data integration

A: Try to add -Dhttps.protocols=TLSv1.2,TLSv1.1,TLSv1 option to your JVM.
If you are facing some problems with component (like tRest) and you are using java <= 7 know that the TLSv1 is used by default to perform TLS handshake. This can block connection with servers using greater version of TLS.
Think that this issue is resolved with java 8.


text:
Q: Identifying and removing outliers based on more than one condition in a dataset using Python I am preparing a dataset for regression modelling. I would like to remove all outliers prior to doing so. The dataset has 7 variables which are continuous in nature. Five of the variables can be addressed universally. However, two variables need to be divided between male and female participants first, these two variables are height and weight. Clearly these two measurements will differ between males and females, therefore to acquire the outliers I need to differentiate the data by male and females, then assess/remove the outliers across both height and weight for each, then incorporate this data back with the data I have already prepared. Is there a simple way of doing this ? I have been using the inter quartile range thus far on the adjacent 5 variables which do not need to be divided by males and females, using this code for each variable...
Q1 = df["Variable"].quantile(0.25)
Q3 = df["Variable"].quantile(0.75)

IQR = Q3-Q1
Lower_Fence = Q1 - (1.5*IQR)
Upper_Fence = Q3 + (1.5*IQR)

print(Lower_Fence)
 print(Upper_Fence)

df[((df["Variable"] < Lower_Fence) | (df["Variable"]  > Upper_Fence))] # Detection of outliers
df[~((df["Variable"] < Lower_Fence) | (df["Variable"]  > Upper_Fence))]` # Removal of outliers

I am relatively new to python.

A: You can define a function for your "outlier" logic, then apply that repeatedly for all columns, with or without groupby:
def is_outlier(s, quantiles=[.25, .75], thresholds=[-.5, .5]):
    # change the thresholds to [-1.5, 1.5] to reflect IQR as per your question
    a, b = s.quantile(quantiles)
    iqr = b - a
    lo, hi = np.array(thresholds) * iqr + [a, b]
    return (s < lo) | (s > hi)

Simple test:
n = 20
np.random.seed(0)
df = pd.DataFrame(dict(
    status=np.random.choice(['dead', 'alive'], n),
    gender=np.random.choice(['M', 'F'], n),
    weight=np.random.normal(150, 40, n),
    diastolic=np.random.normal(80, 10, n),
    cholesterol=np.random.normal(200, 20, n),
))

Example usage:
mask = is_outlier(df['diastolic'])  # overall outliers
# or
mask = df.groupby('gender')['weight'].apply(is_outlier)  # per gender group

Usage to filter out data:
mask = False

# overall outliers
for k in ['diastolic', 'cholesterol']:  # etc
    mask |= is_outlier(df[k])

# per-gender outliers
gb = df.groupby('gender')
for k in ['weight']:  # and any other columns needed for per-gender
    mask |= gb[k].apply(is_outlier)

# finally, select the non-outliers
df_filtered = df.loc[~mask]

BTW, note how per-gender outliers are different than overall, e.g. for 'weight':
df.groupby('gender')['weight'].apply(is_outlier) == is_outlier(df['weight'])


text:
Q: Flutter Awesome notifications not showing in background or when app is terminated Good day.
I am using Awesome notifications in a food ordering app to notify users when their food is ready.
Notifications come through when the app is open, but not when the app is in the background/terminated. Once I re-open the app, all the notifcations that triggered while the app was in the background/terminated come through at once.
I have activated listeners in my main.dart file. These listeners listen for changes made to the my database (I am using Firebase), and generate local notifications  when specific changes occur. For example, if the "order status" attribute in the database changes from "accepted" to "completed", the user will get a notification that their order is ready to collect.
Am I missing something? I thought this plugin automatically handled notifcations when the app is in the background or is terminated.
Any help would be greatly appreciated!!
Listeners are activated in my main.dart file when the app builds and a user is logged in:
class AuthenticationWrapper extends StatelessWidget {
  const AuthenticationWrapper({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) => Scaffold(
        body: StreamBuilder<User?>(
          stream: FirebaseAuth.instance.authStateChanges(),
          builder: (context, snapshot) {
            if (snapshot.hasError) {
              return const Center(child: Text("Something went wrong :("));
            } else if (snapshot.hasData) {
              //The following methods are only executed if a user is logged in.
              //The methods below require the userID, therefore the user must fist be logged in for them to work
              listenForAcceptedOrders();
              listenForRejectedOrders();
              listenForCompletedOrders();

              //Listner for tapping on a notification or dismissing one
              AwesomeNotifications().setListeners(
                  onActionReceivedMethod:
                      NotificationController.onActionReceivedMethod,
                  onDismissActionReceivedMethod:
                      NotificationController.onDismissActionReceivedMethod);

              return const HomePage();
            } else {
              return SignInPage();
            }
          },
        ),
      );
}

The notificationlistner methods:
void listenForAcceptedOrders() async {
  print("Current User ID-------->>>$loggedInUserID");
//This method listens for accepted orders and displays a notification
//It checks for new records entered into the managedOrders table containing the same customerID as the user currently logged in.
//If the customerID matches the ID of the current user logged in, it means that an order placed by THIS user has been accepted.
  _orderStream = _dbRef.child("ManagedOrders").onChildAdded.listen((event) {
    databaseMapper = event.snapshot.value as Map;
    String customerID = databaseMapper["customerID"].toString();
    String orderNum = databaseMapper["orderNum"].toString();
    String status = databaseMapper["status"].toString();

    print("CUSTOMERID ______......>>$customerID");

    if (customerID == loggedInUserID && status == "accepted") {
      acceptedOrderNotification(orderNum);
    } else {
      print("NO MATCH FOUND");
    }
  });
}

void listenForRejectedOrders() async {
  print("Current User ID-------->>>$loggedInUserID");
//This method listens for rejected orders and displays a notification
//It checks for new records entered into the managedOrders table containing the same customerID as the user currently logged in AND a status = rejetced
//If the customerID matches the ID of the current user logged in, it means that an order placed by THIS user has been accepted.
  _orderStream = _dbRef.child("ManagedOrders").onChildAdded.listen((event) {
    databaseMapper = event.snapshot.value as Map;
    String customerID = databaseMapper["customerID"].toString();
    String orderNum = databaseMapper["orderNum"].toString();
    String status = databaseMapper["status"].toString();

    print("CUSTOMERID ______......>>$customerID");

    if (customerID == loggedInUserID && status == "rejected") {
      rejectedOrderNotification(orderNum);
    }
  });
}

void listenForCompletedOrders() async {
//This method listens for completed orders and displays a notification
//It checks for new records entered into the CompleteOrders table containing the same customerID as the user currently logged in.
//If the customerID matches the ID of the current user logged in, it means that an order placed by THIS user has been completed.

  _orderStream = _dbRef.child("CompleteOrders").onChildAdded.listen((event) {
    databaseMapper = event.snapshot.value as Map;
    String customerID = databaseMapper["customerID"].toString();
    String orderNum = databaseMapper["orderNum"].toString();

    if (customerID == loggedInUserID) {
      completedOrderNotification(orderNum);
    } else {
      print("NO MATCH FOUND");
    }
  });

Notifications code:
import 'package:awesome_notifications/awesome_notifications.dart';

Future<void> placeOrderNotification(String orderNo) async {
  await AwesomeNotifications().createNotification(
      content: NotificationContent(
          id: 001,
          channelKey: 'basic_channel',
          title:
              "${Emojis.activites_balloon} Your order request has been sent! (OrderNo: $orderNo)",
          body: "Nandos will update your order status shortly..."));
}

Future<void> acceptedOrderNotification(String orderNo) async {
  await AwesomeNotifications().createNotification(
      content: NotificationContent(
          id: 002,
          channelKey: 'basic_channel',
          title:
              "${Emojis.hand_thumbs_up} Your order (OrderNo: $orderNo) has been accepted!",
          body: "Nandos is now preparing your order"));
}

Future<void> rejectedOrderNotification(String orderNo) async {
  await AwesomeNotifications().createNotification(
      content: NotificationContent(
          id: 003,
          channelKey: 'basic_channel',
          title:
              "${Emojis.hand_thumbs_down} Your order (OrderNo: $orderNo) has been rejected!",
          body: "Nandos cannot take your order at this time"));
}

Future<void> completedOrderNotification(String orderNo) async {
  await AwesomeNotifications().createNotification(
      content: NotificationContent(
          id: 004,
          channelKey: 'basic_channel',
          title:
              "${Emojis.activites_fireworks} Your order (OrderNo: $orderNo) is ready to be collected!",
          body: "Please go collect your order at Nandos"));
}


text:
Q: Lagrangian Constraint Help - why is this the answer? Q: a factory produces bodies & wheels for standard cars. Each car has to be fitted with one spare wheel. Total number of wheels produced is denoted by W. Number of car bodies is B.
Profit function: $$110B - 3B^2 - 2BW - 2W^2 + 140W$$
Write down the constraint.
Answer: $$lambda(5B - W)$$
Why is this the constraint?

A: The text says that each car must be fitted with 1 spare wheel, along with the 4 wheels it would normally have. This means for every 1 body, you must have 5 wheels. So the number of wheels ($W$) is 5 times more than the number of bodies ($B$), i.e. $$W=5B$$ So the constraint is $$\lambda (5B-W)$$

A: One car must fit five wheels: four driving and one spare. Then the constraint is $W=5B$. The Lagrange function is:
$$L=profit+\lambda(5B-W).$$

A: It is not an answer !!
You are given the function and a constraint with Lagrange multiplier $\lambda$ and they are linked , so not yet started solving the problem and so nowhere near the answer.
Remove $\lambda $ from last line to get the constraint, viz., $ (5B-W). $  and start solving it.
EDIT1:
Or it may be a typo error for $ \lambda (B-5 W ). $


text:
Q: CFAjaxProxy or Javascript I have been looking into AJAX technologies for my company recently. I am having trouble deciding between CFAjaxProxy and a Javascript (we use jQuery) call. IMO CFAjaxProxy is extremely easy to implement and jQuery is a little harder. Is there much performance difference between the two? Are there overheads that I might have overlooked? Are there any other options available for a ColdFusion environment?
EDIT
I don't know if i made my self clear. I was wondering whether CFAjaxProxy or javascript's XMLHttpRequest() object or jQuery's $.ajax() call is the best.

A: The answer is "Yes". Use both :). I use cfajaxproxy to get easy access to my CFCs, and I use jQuery to take the data that's returned and manipulate it to adjust the UI. You can see an example of that at http://www.lakehousesofamerica.com/america/searchforlandbymap.cfm. I use cfajaxproxy to pull data from a CFC that pulls properties from our database based on the viewport of the map. I then use custom javascript and jquery to manipulate the map based on those return values.

A: $.ajax() is a wrapper around the HTMLHttpRequest() object. I believe this is also true of CFAjaxProxy at a low level.
I don't think there is actually a "best" to this question. Personally, I use jQuery and $.ajax() more than either of the other solutions simply because it is the most portable (It doesn't care what it is talking to). Not a big fan of tying front end operations to the backend system, personally.
Whichever solution you choose make sure that you research the security implications it presents so you aren't opening your system up to much.

A: You have more control with jQuery as well as it scales better and you can always hit a CF page or a CFC, you can use jSon to serialize objects between server and client side. My team wrote a new feature we could of used anything we wanted, the pattern we chose was use jQuery for all Ajax communication between the UI and server side, the implementation was swift and can scale for many other platforms not just CF. We could swap out the server side at anytime, and the transition would be seamless.


text:
Q: Android WebView always reporting landscape orientation We were having trouble getting media queries to properly target Android tablets when in portrait orientation for an app I am currently developing. I did some testing using http://pieroxy.net/blog/pages/css-media-queries/test-features.html and discovered that Chrome works as expected when that page is loaded into it, but my app's WebView always registers as being in landscape orientation. I tried locking the activity to portrait only, to no effect. I've combed through my WebView code and AndroidManifest.xml looking for something I may have done to cause this behavior, but have come up empty. I would post relevant code, but I've been unable to find it. Google hasn't helped me so far, does anyone know what may likely be causing this issue? Any guidance on where to continue my bug search would be greatly appreciated.

A: After much hair pulling, I determined this was happening because it was reporting a height of 0px to the media query. Therefore width > height and it determined it must be a landscape orientation. I assumed it was a timing issue and moved a lot of code to onViewStateRestored but this changed nothing. The solution wound up being, of all things, to change the layout_height of my WebView from wrap_content to 0dp in the XML layout. This minor tweak apparently allowed it to determine a correct height at the right point and all media queries now target as expected.


text:
Q: Using XmlTextReader I am a beginner programmer starting off with C#, and web services.
In the Service.cs file of my web service, I create a ReadXMLFile() method where I am trying to read an existing XML file, take the data from it and place it to the corresponding properties (DataMembers) that I created in the IService.cs file.
My problem is that my code is basically not doing anything. I've tried looking for web sites and tutorials on this but there really isn't much out there, especially for a beginner like myself. Anyone have any idea how I should go about this, because what I've been trying so far is obviously wrong.
Below is my ReadXMLFile() method.
void ReadXMLFile()
{
    XmlTextReader reader = new XmlTextReader("ClassRoll.xml");
    reader.Read();
    while (reader.Read())
    {
        if (reader.Name == "id")
        {
            id = reader.ReadString();
        }
        else if (reader.Name == "firstname")
        {
            link = reader.ReadString();
        }
        else if (reader.Name == "lastname")
        {
            description = reader.ReadString();
        }
        else if (reader.Name == "count")
        {
            description = reader.ReadString();
        }
        else if (reader.Name == "testscore")
        {
            description = reader.ReadString();
        }
    }
}

this is an example of my xml file
<classroll>
  <student>
    <id>101010</id>
    <lastname>Smith</lastname>
    <firstname>Joe</firstname>
    <testscores count="5">
      <score>65</score>
      <score>77</score>
      <score>67</score>
      <score>64</score>
      <score>80</score>
    </testscores>
  </student>
</classroll>

A: You're probably missing IsStartElement() condition in your while loop:
while (reader.Read())
{
    if (reader.IsStartElement())
    {
       if (reader.Name == "id")
       {
           id = reader.ReadString();
       }
...
}

Also, it would be easier to use XPath or LINQ to XML to read your XML, of course it depends on the file. Here are some examples: XPath and LINQ.
EDIT: after seeing XML file details
You should update your logic to keep track of current student and its testscores. Also, note that count is an attribute. It can get messy pretty soon, I suggest you take a look at the samples mentioned above.

A: I think, that you get best result using XmlDocument
public void ReadXML()
{
    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.Load("<name file>.xml");
    xmlEntities = new List<XmlEntity>();

    foreach(XmlNode item in xmlDoc.ChildNodes)
    {
        GetChildren(item);
    }
}

private void GetChildren(XmlNode node)
{
    if (node.LocalName == "Строка")
    {
       //<you get the element here and work with it>
    }
    else
    {
       foreach (XmlNode item in node.ChildNodes)
       {
             GetChildren(item);
       }
    }
}

A: The reason its not working because, example: when reader.Name == "firstname" is true but its not true with its  elements value. What it exactly means is reader object reads next Nodetype, which is XmlNodeType.Element. So in this case looking at your XML file, using reader.Read(); function again reads next node, which is XmlNodeType.Text, and its value is then Joe. Im givin you example of working version.
void ReadXMLFile()
{
XmlTextReader reader = new XmlTextReader("ClassRoll.xml");
reader.Read();
while (reader.Read())
{
    if (reader.Name == "id")
    {
         reader.Read();
         if(reader.NodeType == XmlNodeType.Text)
         {
           id = reader.Value;
           reader.Read();
         }

    }
 }

}