text:
Q: Failed to create configuration database during installation I am stuck with sharepoint foundation 2010 configuration.
The error is:

Failed to create configuration database, An exception of
  system.io.filenotfoundexception was thrown

This is the log entry

07/23/2013 15:58:20  6  INF                Leaving function
  Command.this[string key] 07/23/2013 15:58:20  6  INF
  The parameter password is NOT chosen, the default value as null
  07/23/2013 15:58:20  6  INF                Entering function
  Command.this[string key] 07/23/2013 15:58:20  6  INF
  Entering function CommandCollectionBase.Get 07/23/2013 15:58:20  6
  INF                    Found value in collection for key passphrase
  07/23/2013 15:58:20  6  INF                  Leaving function
  CommandCollectionBase.Get 07/23/2013 15:58:20  6  INF
  Found parameter passphrase in collection 07/23/2013 15:58:20  6  INF
  Leaving function Command.this[string key] 07/23/2013 15:58:20  6  INF
  The parameter passphrase is NOT chosen, the default value as null
  07/23/2013 15:58:20  6  INF                Entering function
  Farm.IsJoinedToFarm 07/23/2013 15:58:20  6  INF
  Entering function Farm.TryIsJoinedToFarm 07/23/2013 15:58:20  6  INF
  Entering function get CommandCollection.this[string key] 07/23/2013
  15:58:20  6  INF                      Entering function
  CommandCollectionBase.Get 07/23/2013 15:58:20  6  INF
  Found value in collection for key initialize 07/23/2013 15:58:20  6
  INF                      Leaving function CommandCollectionBase.Get
  07/23/2013 15:58:20  6  INF                      Found command
  initialize in collection 07/23/2013 15:58:20  6  INF
  Leaving function get CommandCollection.this[string key] 07/23/2013
  15:58:20  6  INF                    Entering function
  Command.this[string key] 07/23/2013 15:58:20  6  INF
  Entering function CommandCollectionBase.Get 07/23/2013 15:58:20  6
  INF                        Found value in collection for key
  B2B_UPGRADE 07/23/2013 15:58:20  6  INF                      Leaving
  function CommandCollectionBase.Get 07/23/2013 15:58:20  6  INF
  Found parameter B2B_UPGRADE in collection 07/23/2013 15:58:20  6  INF
  Leaving function Command.this[string key] 07/23/2013 15:58:20  6  INF
  My cached Farm object is null, so will load it 07/23/2013 15:58:20  6
  INF                    Calling SPFarm.Local and SPServer.Local to get
  the local farm objects 07/23/2013 15:58:20  6  INF
  SPFarm.Local returned null.  This usually means that the server is not
  joined.  But, you can delete a server from the configdb without
  unjoining, which would mean that this machine still thinks it is
  joined. 07/23/2013 15:58:20  6  INF                    Trying to
  access the server farm connection string 07/23/2013 15:58:20  6  INF
  Entering function TaskCommon.TryGetWssVersion4ConnectionStringExists
  07/23/2013 15:58:20  6  INF                      Entering function
  RegistryHelper.RegistryHelper 07/23/2013 15:58:20  6  INF
  The RegistryHelper has the key name as Software\Microsoft\Shared
  Tools\Web Server Extensions\14.0\Secure\ConfigDB and the registry hive
  as LocalMachine 07/23/2013 15:58:20  6  INF
  Leaving function RegistryHelper.RegistryHelper 07/23/2013 15:58:20  6
  INF                      Microsoft SharePoint Foundation 2010 registry
  key Software\Microsoft\Shared Tools\Web Server
  Extensions\14.0\Secure\ConfigDB for the connection string does not
  exist 07/23/2013 15:58:20  6  INF                      Unable to get
  the Microsoft SharePoint Foundation 2010 connection string 07/23/2013
  15:58:20  6  INF                    Leaving function
  TaskCommon.TryGetWssVersion4ConnectionStringExists 07/23/2013 15:58:20
  6  INF                    DID NOT discover a v4 connection string and
  SPFarm.Local indicates that this machine is not joined. 07/23/2013
  15:58:20  6  INF                    Entering function Farm.Clear
  07/23/2013 15:58:20  6  INF                      Entering function
  CentralAdminServiceInstance.Reset 07/23/2013 15:58:20  6  INF
  Leaving function CentralAdminServiceInstance.Reset 07/23/2013 15:58:20
  6  INF                    Leaving function Farm.Clear 07/23/2013
  15:58:20  6  INF                  Leaving function
  Farm.TryIsJoinedToFarm 07/23/2013 15:58:20  6  INF
  Leaving function Farm.IsJoinedToFarm 07/23/2013 15:58:20  6  INF
  Creating connection string for config db
  SharePoint_Config_d459b728-3ec9-45a8-95b8-d9ed0cca6df2 server
  CLBBLR-6240\Sharepoint 07/23/2013 15:58:20  6  INF
  Creating connection string for admin content db
  SharePoint_AdminContent_5616403b-4ffc-4e74-a574-ea8d5a851607 server
  CLBBLR-6240\Sharepoint 07/23/2013 15:58:20  6  INF
  Using NTLM for sql connection string 07/23/2013 15:58:20  6  INF
  Creating a new farm with config db
  SharePoint_Config_d459b728-3ec9-45a8-95b8-d9ed0cca6df2 content db
  SharePoint_AdminContent_5616403b-4ffc-4e74-a574-ea8d5a851607 server
  CLBBLR-6240\Sharepoint for eval mode 07/23/2013 15:58:20  1  INF
  Not running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  1  INF                Not
  running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 15:58:20  107/23/2013 16:53:09  1  INF
  Not running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 16:54:51  1  INF        Not running in
  high contrast, so we will paint the background with our trademarked
  image 07/23/2013 16:54:51  1  INF        Not running in high contrast,
  so we will paint the background with our trademarked image 07/23/2013
  16:54:51  1  INF        Old location for the navigation panel is
  {X=-264,Y=-39}, new location is {X=351,Y=466} 07/23/2013 16:54:51  1
  INF        Not running in high contrast, so we will paint the
  background with our trademarked image 07/23/2013 16:54:51  1  INF
  Not running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 16:54:51  1  INF        Not running in
  high contrast, so we will paint the background with our trademarked
  image 07/23/2013 16:54:51  1  INF        Not running in high contrast,
  so we will paint the background with our trademarked image 07/23/2013
  16:54:51  1  INF        Not running in high contrast, so we will paint
  the background with our trademarked image 07/23/2013 16:54:51  1  INF
  Not running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 16:54:51  1  INF        Not running in
  high contrast, so we will paint the background with our trademarked
  image 07/23/2013 16:54:51  1  INF        Not running in high contrast,
  so we will paint the background with our trademarked image 07/23/2013
  16:54:51  1  INF        Not running in high contrast, so we will paint
  the background with our trademarked image 07/23/2013 16:54:51  1  INF
  Not running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 16:54:51  1  INF        Not running in
  high contrast, so we will paint the background with our trademarked
  image 07/23/2013 16:54:51  1  INF        Not running in high contrast,
  so we will paint the background with our trademarked image 07/23/2013
  16:54:51  1  INF        Not running in high contrast, so we will paint
  the background with our trademarked image 07/23/2013 16:54:51  1  INF
  Not running in high contrast, so we will paint the background with our
  trademarked image 07/23/2013 16:54:51  1  INF        Not running in
  high contrast, so we will paint the background with our trademarked
  image 07/23/2013 16:54:53  1  INF        Not running in high contrast,
  so we will paint the background with our trademarked image 07/23/2013
  16:54:53  1  INF        Not running in high contrast, so we will paint
  the background with our trademarked image 07/23/2013 16:54:53  1  INF
  Entering function PsconfigLinkLabel.LinkLabelClickedEventHandler
  07/23/2013 16:54:53  1  INF          Clicking the link data C:\Program
  Files\Common Files\Microsoft Shared\Web Server
  Extensions\14\LOGS\PSCDiagnostics_7_23_2013_15_57_22_699_1523409182.log
  07/23/2013 16:54:53  1  INF          Not running in high contrast, so
  we will paint the background with our trademarked image 07/23/2013
  16:54:53  1  INF        Leaving function
  PsconfigLinkLabel.LinkLabelClickedEventHandler 07/23/2013 16:54:53  1
  INF        Not running in high contrast, so we will paint the
  background with our trademarked image

A: I found the solution here :
http://shareatsharepoint.blogspot.in/2012/12/could-not-load-file-or-assembly.html#!/2012/12/could-not-load-file-or-assembly.html
Now it works


text:
Q: cardview not showing cornerRadius and elevation I created a card view in a recycler view and my codes work well but the problem now is that the cardview does not show the rounded edges and elevation at runtime but it shows in the design codes. my codes are shown blow
activity_main
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Controller.MainActivity">

    <uk.co.markormesher.android_fab.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:buttonIcon="@drawable/ic_add_group"
        />

    <android.support.v7.widget.RecyclerView
        android:id="@+id/groupListView"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="8dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

my card_view.xml
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.v7.widget.CardView
    android:id="@+id/groupCardView"
    android:layout_width="match_parent"
    android:layout_height="128dp"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="24dp"
    app:cardCornerRadius="10dp"
    app:cardElevation="5dp"
    app:cardUseCompatPadding="true"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/transparent">

        <TextView
            android:id="@+id/groupTitle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:text="Trips"
            android:textAlignment="center"
            android:textSize="30sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    </android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>

I do not know what I have done wrong

A: Anyone could encounter this issue and the solution is very simple and caused by a mistake.there's a difference between backgroundColor and cardbackgroundColor. use setcardbackgroundColor and it should work.

A: You need to set
android:background="@android:color/transparent"

for main constraint, and set
app:cardBackgroundColor="@color/white"

to cardview, np

redpajama_set_name: RedPajamaStackExchange


text:
Q: Почему при выдачи index.php через try_files $uri/index.php не работает php? Есть сервер, который около года использовал только ради прокси
Тут захотел поучиться писать что-то простенькое на PHP и столкнулся с проблемой
При запросе site.com выдаётся index.php, лежащий в корне (классика). Но проблема в том, что php скрипт не обрабатывается. Если же обратиться к site.com/index.php, то php обрабатывается нормально. Вроде настройки nginx выставил правильно, а что-то никак...
Конфиг сервера:
location / {
    autoindex off;
    try_files $uri/index.php $uri/index.html =404;
  }
location ~ \.php$ {
    try_files $uri $uri/index.php =404;
    include /etc/nginx/fastcgi.conf;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  }

PHP 7.0, там настройки, вроде, не трогал
В Гугле искал, но либо искал неправильно, либо подобного в Гугле нет (скорее первое)
Решение:
Добавил
    include /etc/nginx/fastcgi.conf;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;

в location / {...}. Теперь всё работает исправно!

A: При обращении к site.com nginx пользуется location /, а для него у вас не объявлен fastcgi_pass.


text:
Q: How to find identity columns of a table in HSQLDB 1.8 In DB2 it can be done with the help of below query, but I can't find a way to do this in HSQLDB
SELECT COLNAME FROM SYSCAT.COLUMNS WHERE IDENTITY = 'Y' AND TABNAME='XXX'.

Below are the columns of the table SYSTEM_COLUMNS that I can see, I cannot determine which of these will indicate that it is a identity column
TYPE_SUB
TYPE_NAME
TABLE_SCHEM
TABLE_NAME
TABLE_CAT
SQL_DATETIME_SUB
SQL_DATA_TYPE
SOURCE_DATA_TYPE
SCOPE_TABLE
SCOPE_SCHEMA
SCOPE_CATLOG
REMARKS
ORDINAL_POSITION
NUM_PREC_RADIX
NULLABLE
IS_NULLABLE
DECIMAL_DIGITS
DATA_TYPE
COLUMN_SIZE
COLUMN_NAME
COLUMN_DEF
CHAR_OCTET_LENGTH
BUFFER_LENGTH

A: This should do it:
select column_name,
       generation_expression,
       is_generated,
       is_identity,
       identity_generation,
       identity_start,
       identity_increment
from information_schema.columns
where table_name =  'XXX'
  and table_schema =  'PUBLIC'
  and is_identity = 'YES'


text:
Q: Referencing JavaScript library in GWT for JavaScript Code I'm using the d3.js library and have some javascript code written that already draws the animation I want. For the sake of simplicity/ size, say I want to use this sample source code. I'm trying to use GWT to build a richer user interface around the animation. For example, if I designed a button in GWT java to toggle the particle animation on/off and trigger a "StopAnimation()" javascript function, where would I place the d3.js library so it is correctly referenced?
I've read the following posts related to this topic:
Post 1
Post 2
Post 3
I'm really new to GWT so I may have missed something but all of these examples talk about having direct contact with the javascript library from your GWT code or interfacing with javascript code. In my case, the only javascript code I need to interface with from GWT is the particle example so I don't believe d3.js should need any special JSNI interface correct?...since the particle example code is the only part that utilizes d3.js. The problem I'm running into is that when I place the javascript code into the compiled html file, it never produces the animation.
<!DOCTYPE html>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <link type="text/css" rel="stylesheet" href="MenuViewer.css">

    <title>Wrapper HTML for MenuViewer</title>

I see the stuff I created in GWT but no particles. Initially I was getting reference errors because d3.js was not in the right folder, however once I put it in the war directory, they went away so the problem can't be a reference error. Am I allowed to place javascript code right into the html file like that? As of right now, I'm not worried about getting the GWT/ javascript interaction with the particle code working. I just want to see the appropriate GWT code and particle code animations on the same page. I'll worry about stopping the animation later.
The RootPanel is assigned to the "menu" div and the particle code assigned to the "graph" div. When I check the html through firebug, nothing is created in the "graph" div. Can someone explain what I'm doing wrong?

A: This bit is incorrect:
d3.select("body").select("graph")

There are no elements called "graph", so this will be an empty selection.
D3 uses CSS3 to select elements. I think you wanted to select the element with ID "graph", so it should be:
d3.select("body").select("#graph")

A: In addition to the answers above: Check out the source code for Protovis-GWT.
Protovis is the predecessor of D3.js and Protovis-GWT is a GWT wrapper for it.
You can look at the source code of the GWT wrapper to see how they interact with Protovis and as Protovis and d3.js share some common design patterns it might help you with your use case.


text:
Q: Change the "/api" part of the url in ASP.Net Core When I run a .NET Core Web API project, I get a URL that looks like this:  http://localhost:5000/api/...
How can I change the /api/ part of the URL to something else? i.e. - http://localhost:5000/myservice/...
I am using Kestrel as my web host.

A: You could just install microsoft.aspnetcore.http.abstractions nuget package and use UsePathBaseExtensionsextension method on IApplicationBuilder in your Startup.Configure method like so:
app.UsePathBase("/api/v1");

A: It depends on how you have the project setup.  By default I believe it uses attribute routing.  In your controller you should see something like this
[Route("api/[controller]")]
public class ValuesController : Controller
{

Where the [Route("api/[controller]")] would just need to be changed to     [Route("myservice/[controller]")]
If you wanted to do it Globally you could do it like this.
app.UseMvc(routes =>
{
   routes.MapRoute("default",  "myservice/{controller=values}/{action=get}/{id?}");
});

Although I myself don't use this, and it's not exactly what MS Recommends for a Web Api.  You can read more here.

Mixed Routing
  MVC applications can mix the use of conventional routing and attribute routing. It's typical to use conventional routes for controllers serving HTML pages for browsers, and attribute routing for controllers serving REST APIs.


text:
Q: Add two split string values in c# I need to add split string values to get the rounded value.
string Temp1="0.0154275894165039,1.11531066894531,0.294834136962891,";

string[] Temp2=Temp1.Split(',');

How to sum the values coming in "temp2" and assign it to another parameter.

A: Try this:
double dSum = 0;

foreach (string sStr in Temp2)
    dSum += Double.parse(sStr);

A: You can use LINQ:
values.Select(double.Parse).Sum()

A: Consider also passing CultureInfo.InvariantCulture to double.Parse. Otherwise your solution will fail on systems running on certain localization settings.


text:
Q: OCaml lazy evaluation: 'a lazy_t vs unit -> 'a Both achieve the same thing
# let x = fun () -> begin print_endline "Hello"; 1 end;;
val x : unit -> int = <fun>
# x ();;
Hello
- : int = 1
# let y = lazy begin print_endline "World"; 2 end;;
val y : int lazy_t = <lazy>
# Lazy.force y;;
World
- : int = 2

Is there any reason one should be preferred over the other? Which one is more efficient?

A: First of all, they do not behave the same, try to do Lazy.force y yet another time, and you will notice the difference, the "World" message is no longer printed, so the computation is not repeated, as the result was remembered in the lazy value.
This is the main difference between lazy computations and thunks. They both defer the computation until the time when they are forced. But the thunk will  evaluate its body every time, where the lazy value will be evaluated once, and the result of the computation will be memoized.
Underneath the hood, the lazy value is implemented as a thunk object with a special flag. When runtime first calls the lazy value, it substitutes the body of the thunk with the result of computation. So, after the first call to Lazy.force y, the y object actually became an integer 2. So the consequent calls to Lazy.force do nothing.

A: Lazy.force returns the same value again without recomputing it.
Exemple
let ra = ref 0 ;;
let y = lazy (ra:= !ra+1);;
Lazy.force y;;
# Lazy.force y;;
- : unit = ()
# !ra;;
- : int = 1
# Lazy.force y;;
- : unit = ()
# !ra;;
- : int = 1


text:
Q: How Should I Design TAX Table? I have a db with many tables. Some tables have unit price column, no tax, gst and such columns. What should i do now? Should i create GST table, HST table and PST table separately. In other words, what is the standard schema of designing the tax table?

A: You only need one table for tax percentages:
CDN_TAXES

*

*tax_id (primary key)

*tax_name (GST, HST, PST)

*tax_percentage

Because HST covers both PST and GST, I'd model this as three columns in the PRODUCT/etc table and use a CHECK constraint to enforce that either the HST column be associated, or at least one of PST/GST is associated to the product.
The amount of tax per sale, should be stored in a SALES table.  Tax tables in Canada are updated twice a year, and the percentage can change.  Which means if you want to reprint a receipt that is accurate, you have to capture the tax amounts at the time of sale.

A: I think it depends.  For storing the type of tax and a rate, sure, you can normalize it in a table - and even capture it changing over time with a start and end date (although the actual tax charged on a sale would always need to be stored).
However, typically you will need more tax configuration.  In the US, for instance, we have some things which are never taxed (milk), tax free days when nothing (with some exceptions like cars) is taxed temporarily, and special days when certain things are not taxed (hurricane preparation items like batteries and generators).
So your product table would certainly not hold a tax amount, but may hold some tax flags.  Other tables may link the product to a jurisdiction which has taxes.  If you have a multi-store company, some jurisdictions may tax things differently, yet you may have a common product master file and pricing might be the same across stores, but taxes would vary.

A: I'd say depends on the amount of columns.  If you're only talking about 3 columns then i'd add them into the table and leave them empty if not used.
If however you want to expand this further and further, create a single table to hold the value, description etc.
Then maybe have a lookup table called unitGST and unitHST etc.  Each of these tables contains the unit id and the id to your single table holding the value.


text:
Q: chrome extension in angular 2/4 chrome.history not binding to modal I am tryin to build an chrome extension in angular2, part of it will display users chrome history. The component:
/// <reference types="chrome/chrome-app"/>
import { Http, Response } from '@angular/http';
import 'rxjs/add/operator/toPromise';
import { Component, OnInit } from '@angular/core';
import { mockHistory } from  './chrome-history-mock';

@Component({
  selector: 'app-chrome-history',
  templateUrl: './chrome-history.component.html',
  styleUrls: ['./chrome-history.component.css']
})
export class ChromeHistoryComponent implements OnInit {
  historyData: any = [];
  constructor(private http: Http) {}

  ngOnInit() {
    var microsecondsPerWeek = 1000 * 60 * 60 * 24 * 7;
    var oneWeekAgo = (new Date).getTime() - microsecondsPerWeek;
    chrome.history.search({
     'text': '',
      'startTime': oneWeekAgo,
      // 'maxResults': 10
    }, this.constructHistory);
  }
  constructHistory(historyObj): any {
    console.log(historyObj[0]);                     //prints first obj
    this.historyData = historyObj;
    console.log(this.historyData.length);           //prints 100
    console.log(historyObj);                        //prints data
    console.log(JSON.stringify(historyObj));        //prints data
    console.log(JSON.stringify(this.historyData));  //prints data
  }
}

The template:

 0">

<input type="checkbox" />{{item.title}}

  {{item.url}}

I am getting the response inside callback function constructHistory and am able to set it to class property historyData as I can see in console logs, but this doesn't display in template. I've tried to find the answer for more than 3 days. Searched a lot many blogs but couldn't find any solution. Most were about databinding in http.get case. Also tried async pipe but couldnt solve. Sorry about the code formatting. Any help appreciated.


text:
Q: how to select a complete row on pressing a key and then search the element stored in the JTable and select that row? i have a JTable and JLabel , i have put some values in the Table !
i want to implement search in that table and then set the value from the searched value on the JLabel.
suppose i type 'f' so myfunction will search where in myTable's row and 0th column the value starts with f , thus i ll get that row value ! now i want to select/highlight that entire row and print the value on JLabel.
I don't know how to highlight this row!
is there any better method to do searching , i have read about SwingX , but i did not find how to actually use JXTables.

A: Maybe it would be better for you to use the filtering capabilities of JTable.
The Swing tutorial on Sorting and Filtering give a working example on how this can be done to filter all the rows that start with the text entered in your text field.
I don't understand your question about updating a "label", since it is possible that multiple rows could start with the search string.


text:
Q: Apply Module Code to Multiple Sheets I have created a worksheet that calls multiple modules to make different actions such as calculations or hide rows etc.
I created that workbook and codes to work with only 1 sheet, but now I copied that sheet and created 10 more, what I'm trying to do is using the same modules I created and applying that code to the new sheets.
I'm very basic in excel VBA and the topics I have found either I don't understand them or don't meet my needs.
Example of my code:
I put this code in Sheet1
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$E$2" Then
    ModuloAct
End If
If Target.Address = "$E$10" Then
    Colaborador
End If
If Target.Address = "$E$11" Then
    Dias
End If
End Sub

Example of module
Sub ModuloAct()

If Worksheets("Hoja1").Cells(2, 5).Value = "T" Then
Worksheets("Hoja1").Cells(8, 5).Value = 0.16
Worksheets("Hoja1").Cells(2, 5).Value = "Tension"

End Sub

I know the problem is that my module is referenced to a single sheet, but I haven't found a way to make that module apply to the active sheet.

A: You are going to want to abandon the individual Worksheet_Change event macros in favor of a single Workbook_SheetChange event macro.
In ThisWorkbook code sheet:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub

    On Error GoTo bm_Safe_Exit
    'check for a valid worksheet name
    Select Case Sh.Name
        Case "Hoja1", "Hoja2", "Hoja3", "Hoja4"
            Application.EnableEvents = False
            Select Case Target.Address
                Case "$E$2"
                    ModuloAct Sh
                Case "$E$10"
                    Colaborador Sh
                Case "$E$11"
                    Dias Sh
                Case Else
                    'do nothing
            End Select
        Case Else
            'do nothing
    End Select
bm_Safe_Exit:
    Application.EnableEvents = True
End Sub

In Module1 code sheet:
Sub ModuloAct(ws As Worksheet)

    With ws
        If .Cells(2, 5).Value = "T" Then
            .Cells(8, 5).Value = 0.16
            .Cells(2, 5).Value = "Tension"
        End If
    End With

End Sub

The Workbook_SheetChange catches changes made to any worksheet. First check to see if the worksheet is one of the ones that you want to be processed. If it is, check the Target address to see what sub procedure should be run. Pass the worksheet along to the appropriate sub procedure as a Worksheet object and use that parameter in a With ... End With statement to assign the parent worksheet for all further processing.
You should remove all of the similar code in the individual worksheet code sheets' Worksheet_Change subs.


text:
Q: Calculating $\displaystyle{\lim_{x \to 0+}}{\frac{3e^{\log^3x}\log^2x}{x}}$ I have problem to calculate this limit:
$$\displaystyle{\lim_{x \to 0+}}{\frac{3e^{\log^3x}\log^2x}{x}}$$
Here's what I've tried:
$$\begin{aligned} \displaystyle{
\lim_{x \to 0+}}{\frac{3e^{\log^3x}\log^2x}{x}} &=
3\lim_{x \to 0+}{e^{\log^3x + 2\log(-\log x) - \log x}} \\
&= 3e^{\lim_{x \to 0+}{\log^3x + 2\log(-\log x) - \log x}}
\end{aligned}$$
Maybe not best approach, but here is where I am stuck.
I don't know how to simplify limit here, as it's in indeterminate form $-\inf + \inf$
Thanks.

A: Let $x=e^{-t}$, then $$L=\lim_{t\to \infty} \frac{3t^2}{\exp{(-t+t^3)}}.$$
By two times L-Hospital, $$L=\lim_{t\to \infty} \frac{6t}{(3t^2-1)\exp(t^3-t)}=\lim_{t\to \infty} \frac{6}{6t\exp(t^3-t)+6t(3t^2-1)\exp(t^3-t)}=0$$


text:
Q: GRPC TLS c++ communication returns ssl_transport_security.cc:1723] No match found for server name: 10.100.102.5 I created a grpc insecure server correctly.
Now i am trying to make it secured.
my code is :
server:
std::string key = readFileContent("server.key");
std::string cert = readFileContent("server.crt");
std::string root = readFileContent("ca.crt");
grpc::SslServerCredentialsOptions::PemKeyCertPair pkcp = {key, cert};
grpc::SslServerCredentialsOptions ssl_opts;
ssl_opts.pem_root_certs = root;
ssl_opts.pem_key_cert_pairs.push_back(pkcp);
ssl_opts.client_certificate_request = GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY;
std::shared_ptrgrpc::ServerCredentials creds = grpc::SslServerCredentials(ssl_opts);
builder.AddListeningPort("10.100.102.5:5055", cred);
builder.RegisterService(service);
std::unique_ptrgrpc::Server serverPtr = builder.BuildAndStart();
std::unique_ptr server(std::move(serverPtr));
server->Wait();
client:
std::string key = readFileContent("client.key");
std::string cert = readFileContent("client.crt");
std::string root = readFileContent("ca.crt");
grpc::SslCredentialsOptions ssl_opts {root, key, cert};
auto ssl_creds = grpc::SslCredentials(ssl_opts);
uto stub_ = RemoteSigner::NewStub("10.100.102.5:5055",ssl_creds);
ethereum::validator::accounts::v2::ListPublicKeysResponse reply;
ClientContext context;
stub_->ListValidatingPublicKeys(&context, ::google::protobuf::Empty(), &reply);
generate my keys with :
openssl genrsa -passout pass:1234 -des3 -out ca.key 4096
openssl req -passin pass:1234 -new -x509 -days 365 -key ca.key -out ca.crt -subj  "/C=SP/ST=Spain/L=Valdepenias/O=Test/OU=Test/CN=Root"
openssl genrsa -passout pass:1234 -des3 -out server.key 4096
openssl req -passin pass:1234 -new -key server.key -out server.csr -subj  "/C=SP/ST=Spain/L=Valdepenias/O=Test/OU=Server/CN=10.100.102.5"
openssl x509 -req -passin pass:1234 -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
openssl rsa -passin pass:1234 -in server.key -out server.key
openssl genrsa -passout pass:1234 -des3 -out client.key 4096
openssl req -passin pass:1234 -new -key client.key -out client.csr -subj  "/C=SP/ST=Spain/L=Valdepenias/O=Test/OU=Client/CN=10.100.102.5"
openssl x509 -passin pass:1234 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt
openssl rsa -passin pass:1234 -in client.key -out client.key
receive this error : transport_security.cc:1723] No match found for server name: 10.100.102.5.
can you help me find the problem please?


text:
Q: redirection don't work correctly (Navigation) My component is in the record page of MyObj__c  .
MyObj__c  has a master detail with Account
I tried to navigate from MyObj__c to the account assorted bu I always get an error
Error : {"status":500,"body":{"message":"Value provided is invalid for action parameter 'MyId2' of type 'Id'"},"headers":{},"ok":false,"statusText":"Server Error","errorType":"fetchResponse"}

=> Apex
 @AuraEnabled(cacheable=true)
    public static Id Class2(Id MyId2) {
        Id account = [SELECT Station__c FROM MyObj__c WHERE Id =:MyId2 LIMIT 1]Station__c;
                   return  account;
    }

=> HTML
<template>
    <div class="slds-box slds-theme_shade">
      <lightning-button label="Back to the station"  onclick={navigateToAccountPage}> </lightning-button>
    </div>
  </template>

=> JS
import { LightningElement, api , wire, track } from 'lwc';
import Class2 from '@salesforce/apex/MyClass.Class2';
import { NavigationMixin } from "lightning/navigation";

export default class RedirectToStation extends NavigationMixin (LightningElement) {
    @api recordId ;
    @track MyId2;
    navigateToAccountPage() {

        Class2({ MyId2: '$recordId' }).then(data => {

            if (data)
       {

        this[NavigationMixin.Navigate]({
            type: 'standard__recordPage',
            attributes: {
                recordId :  data.Id,
                objectApiName: 'Account',
                actionName: 'view'
                 }        });

       }

    }).catch(error => {

        console.log('Error : ' + JSON.stringify(error));
    })

}
}

A: There are a few mistakes in your code, please refer to the below code -
 @AuraEnabled(cacheable=true)
    //pass the recordId as a string
    public static Id Class2(String MyId2) {
        Id account = [SELECT Station__c FROM MyObj__c WHERE Id =:MyId2 LIMIT 1].Station__c;
        return  account;
    }

import { LightningElement, api, wire, track } from 'lwc';
import Class2 from '@salesforce/apex/MyClass.Class2';
import { NavigationMixin } from "lightning/navigation";
export default class RedirectToStation extends NavigationMixin(LightningElement) {
    @api recordId;
    navigateToAccountPage() {
        console.log('recordId', this.recordId);
        Class2({ MyId2: this.recordId }).then(data => {

            if (data) {
                // data is the recordId
                console.log('data', data);
                this[NavigationMixin.Navigate]({
                    type: 'standard__recordPage',
                    attributes: {
                        recordId: data,
                        //objectApiName: 'Account',
                        actionName: 'view'
                    }
                });

            }

        }).catch(error => {

            console.log('Error : ' + JSON.stringify(error));
        })

    }
}

You were passing the recordId in the wrong syntax. Removed the track variable MyId2.


text:
Q: assign to a number named variable to mimic command line argument I have a script where I am passing commands to processes with an arguments passed from command line and from environment variables as well.
To simplify my use case lets assume my processes are echo command.
I noticed that variable expansion is more easy for numeric variables $1 passed from command line than for environment variables $VAR.
For numeric variables I don't need to have white spaces around to make it work, see example below:
f1() {
  echo "this is 1 $1 and var $VAR done"
}
VAR=2 f1 1
#this is 1 1 and var 2 done
f2() {
  echo "this_is_1_$1_and_var_$VAR_done"
}
VAR=2 f2 1
#this_is_1_1_and_var_

As you can see, if I replace spaces with underlines, then named variable is no longer interpreted while numeric variable still works fine.
I learned how to workaround this limitation by extra quoting
f3() {
  echo "this_is_1_$1_and_var_""$VAR"'_done'
}
VAR=2 f3 1
#this_is_1_1_and_var_2_done

The problem is that my script requires quite a lot of substitution in long SQL statements. Putting extra quotes in each places will make it much more difficult to read and maintain. Therefore I would find it useful to mimic command line argument but it (obviously) doesn't work:
1=echo $VAR
$1

Is there any trick I can make it work?


text:
Q: Which blocks of code should be synchronized? I have three different classes:

*

*Managed bean (singleton scope)

*Managed bean (session scope)

*Spring @Controller
I read few posts here about synchronization, but I still don't understand how it should be and how it works.
Short examples:
1) Managed bean (singleton scope).
Here all class fields should be the same for all users. All user work with one instance of this object or with his copies(???).
    public class CategoryService implements Serializable {
private CategoryDao categoryDao;
private TreeNode root; //should be the same for all users
private List<String> categories = new ArrayList<String>();//should be the same for all users
private List<CategoryEntity> mainCategories = new ArrayList<CategoryEntity>();
//should be the same for all users

public void initCategories() {
    //get categories from database
}

public List<CategoryEntity> getMainCategories() {
    return mainCategories;
}}

2) Managed bean (session scope)
In this case, every user have his own instance of object.
When user trying to delete category he should check are another users which  trying to delete the same category, so we need to use synchronized block???
public class CategoryServiceSession implements Serializable {
private CategoryDao categoryDao;
private CategoryService categoryService;

private TreeNode selectedNode;

public TreeNode getSelectedNode() {
    return selectedNode;
}
public void setSelectedNode(TreeNode selectedNode) {
    this.selectedNode = selectedNode;
}

public void deleteCategory() {
    CategoryEntity current = (CategoryEntity) selectedNode.getData();

    synchronized (this) {
        //configure tree
        selectedNode = null;
        categoryDao.delete(current);
    }
    categoryService.initCategories();
}}

3) Spring @Controller
Here all user may have an instance (or each user have his own instance???).   But when some admin try to change parameter of some user he should check is another admin trying to do the same operation??
@Controller
@RequestMapping("/rest")
public class UserResource {
   @Autowired
   private UserDao userDao;

   @RequestMapping(value = "/user/{id}", method = RequestMethod.PUT)
    public @ResponseBody UserEntity changeBannedStatus(@PathVariable Long id) {
        UserEntity user = userDao.findById(id);
        synchronized (id) {
           user.setBanned(!user.getBanned());
           userDao.update(user);
        }
    return user;
    }
}

So, how it should to be?
Sorry for my English.

A: In the code that you've posted -- nothing in particular needs to be synchronised, and the synchronised blocks you've defined won't protect you from anything.  Your controller scope is singleton by default.
If your singletons change shared objects ( mostly just their fields) then you should likely flag the whole method as synchronised.
Method level variables and final parameters will likely never need synchronization ( at least in the programming model you seem to be using ) so don't worry about it.
The session object is guarded by serialisation, mostly, but you can still have data races if your user has concurrent requests -- you'll have to imagine creative ways to deal with this.
You may/will have concurrency issues in the database ( multiple users trying to delete or modify a database row concurrently ) but this should be handled by a pessimistic or optimistic locking and transaction policy in your DAO.
Luck.

A: Generally speaking, using synchronized statements in your code reduces scalability. If your ever try to use multiple server instances, your  synchronized will most likely be useless. Transaction semantics (using either optimistic or pessimistic locking)  should be enough to ensure that your object remains consistent. So in 2 und 3 you don't need that.
As for shared variables in CategoryService it may be possible to synchronize it, but your categories seem to be some kind of cache. If this is the case, you might try to use a cache of your persistence provider (e.g. in Hibernate a second-level cache or query cache) or of your database.
Also calling categoryService.initCategories() in deleteCategory() probably means you are reloading the whole list, which is not a good idea, especially if you have many categories.


text:
Q: Get values of dynamically named inputs in Angular In my fees-list.component.html template, I have something like the following:

      Amount owing (AUD)
      Fee type
      Title
      Amount to pay (AUD)

      {{ fee.balance }}
      {{ fee.type.desc }}
      {{ fee.title }}
      <input id="{{ fee.id }}" type="text" name="toPay" value="{{ fee.balance }}">

Total to pay: <input type="text" name="total" value="{{ meta.total_sum }}">

The requirement for my interface is twofold. If users change the value of an individual fee (fee.balance), the value in the total text input field should be updated.
Secondly, if the total input field is updated, I need to update the value(s) in the individual fees accordingly (reducing those by the appropriate amount from oldest fee to newest fee).
My question is, how do I do binding for these input fields which are dynamically generated, though they do have unique ids (id="{{ fee.id }})? I cannot work out how to target an individual fee field in my typescript file.

A: One approach ( preferred) is to create the controls dynamically.
your typescript file :
  constructor(){
    this.formGroup = new FormGroup();

     const controls = meta.fee.map((fee)=>{
         this.formGroup.addControl(fee.id, new FormControl(fee.balance))
     });

    // now you have a formGroup with all the controls and their value are initialized, you just need to use it in your template
  }

your template :

      {{ fee.balance }}
      {{ fee.type.desc }}
      {{ fee.title }}
      <input id="{{ fee.id }}" [formControl]="formGroup.get(fee.id)" type="text" name="toPay">

So obviously, after this, you have the full power to do anything, for example, if you want to update a specific one of them:
  updateValue(){
   this.formGroup.get('oneOfThoseFeeIds').setValue('new value')
  }

NOTE :
I haven't done Angular for a while and don't remember the exact syntaxes, but I hope this gives you a path

A: Use two way binding with ngModel
<input [name]="fee.id" type="text" [(ngModel)]="fee.balance">

Now when the user types in the textbox it will update the value in the array directly.
Also you should not be using {{}} binding on your attributes like that, use attribute binding with the [box] syntax.
<input type="text" name="total" [value]="total_sum">

You can calculate the total in your TypeScript like
get total_sum() {
    return meta.fees.reduce((total, fee) => total + fee.balance, 0);
}

A: Can't you just use a service for that? I guess this is a way to go here, since you should try keeping your components as small as possible and communicate them by services.
Please, have a look at this chapter in angular documentation: https://angular.io/tutorial/toh-pt4


text:
Q: Adding a standard error column to my data set so error bars can be plotted Data <- data.frame(id, consumption, Day, Hour)
#The data is a large time series data set with thousands of valued per household id.
#eg.
consumption <- c(99, 119, 130, 110, 109, 118) etc.
#Hour and Day were calculated from the Date Time of the dataset.

I have created a two separate line graphs using ggplot2 for total mean energy consumption and mean energy consumption between 4 and 8pm for a range of households. I am looking to add value specific (not constant) error bars which correspond to the standard error for each value. I am unsure of how to add a standard error column to my data set corresponding to each individual value. If you could use pipes that would be great!
I have looked online for different methods to calculate individual standard errors and add a column with them however nothing has worked. It may be because I am not plotting the raw data, but instead plotting data that has been summarised (sum and mean). The two plots 1) and 2) will have different error bars for the same dates. I have included a picture to what the plot should look like at the end.
These are my plots:
1) Overall Daily Mean Consumption
Data %>%
 group_by(id, Day)%>%
#id is household identification
  summarise(DailyCons = sum(consumption))%>%
#Sum for total daily consumption per household
group_by(Day)%>%
 summarise(MeanDailyCons = mean(DailyCons))%>%
#Find mean daily consumption for all households
  ggplot()+
  geom_line(aes(x= Day, y= MeanDailyCons))

2) Daily Mean between 16:00-20:00
Data %>%
  mutate(TimeInt = ifelse(Hour %in% c(16, 17, 18, 19, 20), Hour, NA))%>%
#removing Hours outside of range 16-20
  group_by(id, TimeInt, Day) %>%
  na.omit(TimeInt)%>%
  summarise(sumPeakCons = sum(consumption)) %>%
#sum for total consumption for each hour in interval for each house
  group_by(bmg_id, Day) %>%
  summarise(PeakCons = sum(sumPeakCons)) %>%
#sum for total daily consumption in interval for each house
  group_by(Day) %>%
  summarise(DailyPeakCons = mean(PeakCons)) %>%
# Daily mean consumption for all houses
  ggplot()+
  geom_line(aes(x= Day, y= DailyPeakCons))

An image is included to show the desired result.
https://i.stack.imgur.com/WDT8Z.png

A: You are correct that you cannot add the standard error after you summarize the data by day. Any function that would try would just receive a mean and a datetime, not enough to create an error. The standard error must be added when you summarize from the raw data.
Add another column to your summarise statement:
summarise(DailyPeakCons = mean(PeakCons),DailyPeakConsErr = sd(PeakCons)) %>%

This will give the standard deviation of each day's peak consumptions.


text:
Q: The cause for TypeError: access to strict mode caller function censoered I'm working on a web application that uses the JMol Javascript extension with Angular. This is challenging. It's been working quite well, but today it stopped working on Firefox. When I try something JMol complains with the error

TypeError: access to strict mode caller function censored

This is happening in 3rd party code, only on Firefox (which has updated itself yesterday). It works well on Chrome.
I found some people complaining about a similar error over the years (without using JMol). They all received interesting answers - downgrading jQuery to 1.1, wrapping some function call in setTimeout and other such answers.
I could not find an explanation for the cause of this error. What is a strict mode caller, which access is censored, and why? I would also love to see a minimal piece of code that generates this error on Firefox - so I can understand what I'm trying to fix.

A: What's happening is that code that tries to use the caller property of a function is being called by strict-mode code. Example:

function attemptToUseCaller() {
    console.log(attemptToUseCaller.caller.name);
}
function loose() {
    attemptToUseCaller();
}

function strict() {
    "use strict";
    attemptToUseCaller();
}
loose();
strict();

If you run that in an up-to-date version of Firefox, you'll see this in the console:

loose
TypeError: access to strict mode caller function is censored

As you can see, accessing attemptToUseCaller.caller worked when the calling function was in loose mode, but failed when the calling function was in strict mode. Accessing the caller property is disallowed in strict mode, and even disallowed when used in "loose" code, if the caller function is itself strict. Firefox raises a specific error, whereas with Chrome's V8 JavaScript engine, it just returns the value null for .caller in strict mode.
Using caller is an anti-pattern. You'll need to fork whatever 3rd-party code is using it and correct it.


text:
Q: Can't login due to losing power during an update Few days ago while Ubuntu 12.04 was doing a common system update, my laptop turned off in the middle of process due to bad AC power. Since then, I can only login but nothing else. A message about compiz appears, but mouse, keyboard, icons, Unity are not working.
The only thing I was able to do is a boot repair, as described in Ubuntu's site, but neither this helped. Hope you can help me.

A: Can you boot to recovery mode entry? If you can, it should show you a small menu.
In that menu:

*

*select Network to activate the network (internet),

*then select Drop    to root shell.

That will load a command prompt as root.
Then you can try:
dpkg --configure -a
apt-get install -f

Usually that can help with broken packages.


text:
Q: Probability questions involving complements Among 35 students in a class, 17 earned "A" on the midterm, 14 earned "A" on the final exam, and 11 did not earn "A" on either exam. What is the probability that a randomly selected student from this class earned "A" on both exams?
So in my solution I did:
Let A = students who earned "A" on the midterm
Let B = students who earned "A" on final
So the formula that I follow is:
P(A ∪ B) = P(A) + P(B) - P(A ∩ B)
My only question is, why is P(A ∪ B) a complement?

A: $P(A\cup B)$ is not a complement, it is a probability.
$A\cup B$ is the complement of $(A\cup B)^c=A^c\cap B^c$, by (de Morgan and) the very definition of complement. ($C^c$ denotes the complement of $C$ with respect to a base set $\Omega$ here, i.e. $C^c=\Omega\setminus C$. Omega denotes the set of all students of the class in your case.)
In your context, $A\cup B$ is the set of all students who received an "A" on at least 1 of the 2 exams. $A^c$ is the set of students who didn't received an "A" on midterms, $B^c$ is the set of students who didn't received an "A" on endterms, so $A^c\cap B^c=(A\cup B)^c$ is the set of students who didn't received an "A" on either exam.
That way, you would calculate the probability of people who passed by
$$P(A\cup B) = 1-P((A\cup B)^c) = 1-P(A^c\cap B^c)$$

Since you select randomly, which means uniformly distributed in this case, so you are conducting a Laplace experiment and thus, for any $C\subseteq \Omega$
$$P(C)=\frac{|C|}{|\Omega|}$$
where $|\cdot|$ denotes the number of elements in the set and $\Omega$ is teh base set (so $|\Omega|=35$ in your case).

A: Alternatively, see the Venn diagram:
$\hspace{4cm}$
$$\begin{cases}a+c=17\\ b+c=14 \\ a+b+c+11=35\end{cases} \overbrace{\Rightarrow}^{(1)+(2)-(3)} c=11-4=7 \Rightarrow \\
\color{blue}{P(A\cap B)}=\frac{c}{35}=\color{blue}{\frac{7}{35}}.$$
Now expressed in terms of probabilities:
$$\begin{align}\color{red}{P(A)}=&\frac{n(A)}{n(S)}=\frac{a+c}{35}=\frac{17}{35}; \\
\color{red}{P(B)}=&\frac{n(B)}{n(S)}=\frac{b+c}{35}=\frac{14}{35};\\
P((A\cup B)^C)=&\frac{n((A\cup B)^C)}{n(S)}=\frac{35-(a+b+c)}{35}=\\
=&1-\frac{a+b+c}{35}=1-P(A\cup B)=\frac{11}{35} \Rightarrow \\
\color{red}{P(A\cup B)}=&1-\frac{11}{35}=\frac{24}{35};\\
\color{blue}{P(A\cap B)}=&\frac{n(A\cap B)}{n(S)}=\frac{c}{35}=\frac{n(A)+n(B)-n(A\cup B)}{n(S)}=\\
=&\frac{n(A)}{n(S)}+\frac{n(B)}{n(S)}-\frac{n(A\cup B)}{n(S)}=\\
=&\color{red}{P(A)}+\color{red}{P(B)}-\color{red}{P(A\cup B)}=\\
=&\frac{17}{35}+\frac{14}{35}-\frac{24}{35}=\color{blue}{\frac{7}{35}}.\end{align}$$
Note the complements: $P((A\cup B)^C)=1-P(A\cup B)$.


text:
Q: Set important of message in reply - Microsoft Graph API We are using Microsoft graph api Reply API to send reply to incoming emails. Our requirement is to set importance to high for emails. However the request payload as shown below does not have any option to set the importance or other message parameters. Can someone suggest how to make a reply by changing message properties?
POST https://graph.microsoft.com/v1.0/me/messages/AAMkADA1MTAAAAqldOAAA=/reply
Content-Type: application/json

{
  "message":{
    "toRecipients":[
      {
        "emailAddress": {
          "address":"samanthab@contoso.onmicrosoft.com",
          "name":"Samantha Booth"
        }
      },
      {
        "emailAddress":{
          "address":"randiw@contoso.onmicrosoft.com",
          "name":"Randi Welch"
        }
      }
     ]
  },
  "comment": "Samantha, Randi, would you name the group please?"
}

Please note that if we use send api, then the conversation ID will get lost and outlook will not show the mail as a thread.

A: As per the doc, you can add you parameter while replying to the mail,

You can add the any property you want to add under message object, you can see the property importance under message

You can try with below code
https://graph.microsoft.com/v1.0/me/messages/{message_id}/reply
 {
        "message": {
            "toRecipients": [
                {
                    "emailAddress": {
                        "address": "xyz@microsoft.com",
                        "name": "Vicky"
                    }
                }
            ],
            "importance": "high"
        },
        "comment": "adding importance high"
    }

Mail with high importance

Hope this helps
Thanks


text:
Q: Set-UID Capability Leak Attack I have a C program to demonstrate the capability leak attack regarding set-uid.
// cap_leak.c
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>

void main()
{
    int fd;  char *v[2];
    /* Assume that /etc/zzz is an important system file, and it is owned by root with permission 0644. Before running this program, you should create the file /etc/zzz first. */

    fd = open("/etc/zzz", O_RDWR | O_APPEND);

    // Print out the file descriptor value
    printf("fd is %d\n", fd);
    if (fd == -1)
    {
        printf("Cannot open /etc/zzz\n");
        exit(0);
    }
    // Permanently disable the privilege by making the
    // effective uid the same as the real uid
    setuid(getuid());
    printf("Real user id is %d\n", getuid());
    printf("Effective user id is %d\n", geteuid());

    // Execute /bin/sh
    v[0] = "/bin/sh"; v[1] = 0;
    execve(v[0], v, 0);
}

Originally, cat /etc/zzz gives:
this is a very important file

Now I compile this program:
gcc -o cap_leak cap_leak.c

Change the owner to root and turn the setuid bit on:
sudo chown root cap_root
sudo chmod 4755 cap_root

Now when I run the program from a normal user, I get a shell prompt:
fd is 3
Real user id is 1000
Effective user id is 1000
$whoami
$seed
$echo bbbbbb >&3
$cat /etc/zzz
$this is a very important file
 bbbbbb

The last write to fd = 3 i.e, /etc/zzz is successful, although after opening the file the setuid() function is called which basically sets the real, effective and saved uid to the original uid. My question is, why the last write is successful even though it is performed after setuid() and to prevent capability leak in this case, where should the setuid() be placed and why?

A: There is no other place you should put the setuid(), you should not leave the file open for write.
The reason for that is that the permissions are checked when the file is opened, not at every write() call.
There is no reason to leave the file open with write access if the unprivileged shell is not supposed to write to that file.


text:
Q: How do I make a custom attribute required field on keycloak registration form I have the registration process working so that the custom attribute of "phone" is being stored when the user clicks register, if the user typed a phone number in that is. However, I would like it to be a required field and prevent registration from occurring if left blank.  I have not found any keycloak documentation about how to do this.

A: You have to implement a SPI that extend the registration form. You can use standard FormAction as base. You will have to add you validation logic to validate() method. For instance:
String phoneNumber = formData.getFirst(FIELD_PHONE_NUMBER);
if (Validation.isBlank(phoneNumber) {
  errors.add(new FormMessage(FIELD_PHONE_NUMBER, MISSING_PHONE_NUMBER));
}


text:
Q: Error when trying to get an access token in xero-laravel authorization process i am integrating Xero to a laravel application for the first time and it has been chaotic.I am trying to use this package:https://github.com/ayles-software/xero-laravel which completes the first step of redirecting users to xero,and although response with a code is returned to my redirect url,it comes with this error Calcinai\OAuth2\Client\Provider\Exception\XeroProviderException
Forbidden which i think means my code cant be exchanged for an access token.I tried another package and i get an error as well when trying to exchange the code for the access token.With postman,i sometimes get an access token but mostly i get an Authentication failed  error when i try to get my access token even though i feel i am doing everything as expected.So i was wondering if there is something i should watch out for when using a demo account in local development environment apart from the limits?


text:
Q: meteor and textareas Ok so I'm not sure why I can't render the code. First if I console.log users.content I get the content I want but I'm some how not able to pass it to a textarea so that it show's it...
Users = new Meteor.Collection("users");

if(Meteor.is_client){
  Template.inputUser.code = function(){
    var el = Users.find({name:"oscar"});
    el.forEach(function(users){
      console.log(users.content);
    })
  }
}

And then on my html template I have
<body>{{> inputUser}}</body>

<template name="inputUser">
<textarea>{{content}}</textarea>
</template>

And I would have a record on the db suck as so
if(Meteor.is_server)
  Users.insert({name:"oscar",content:"hello world"})

Thanks for your help guys.

A: Firstly your method Template.inputUser.code should return something, you should also note that it wouldn't be called with that template either as it needs a {{code}} call in it rather than {{content}}
The second point is database contents are not always available if you have disabled the autopublish package, if so check out using publish(in the server code) and subscribe(in the client code): http://docs.meteor.com/#meteor_subscribe you can use this to check when the client has all the data to display. Something like:
Meteor.subscribe('allusers', function() {
  Template.inputUser.code = function(){
    var user = Users.findOne({name:"oscar"});
    return user.content;
  }
});

...

Meteor.publish('allusers', function() {
  return Users.find();
});


text:
Q: Automatic sequence number (1,2, …) to be filled in a specific field I have a view table as below and I want to make the custom field named "number" to have as automatic sequence number (1,2,….)  to be filled in the column CUSTOMFIELDVALUE according to REQUESTID
enter image description here
I need a trigger code on the WOCUSTOMFIELD table that do what I want
Thanks in Advance
Lubna

A: The trigger grabs the max value from t and stores it in a table variable. The cte works out the row number of each insert to t and in the update phase adds it to the value stored int the table variable.
 use sandbox
    go
    --drop table t
    --create table t(workid int identity, requestid int,customfieldvalue int)
    --go
    IF EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[tGenCustomid]'))
    drop trigger tGenCustomid
    go
    CREATE TRIGGER tGenCustomid
    ON t
    after insert
    AS
    BEGIN
      DECLARE @max TABLE (
        workid int,
        requestid int,
        customfieldvalue int
      );

      INSERT INTO @max (requestid,customfieldvalue)
        select requestid,
         coalesce(max(customfieldvalue),0)
        from     t
        group by requestid

      ;with cte as
      (select i.workid,i.requestid, row_number() over (partition by i.requestid order by i.workid) rn,
            m.customfieldvalue
      from inserted i
      join @max m on m.requestid = i.requestid
      )
      update t
        set customfieldvalue = cte.rn + cte.customfieldvalue
        from t
        join cte on cte.workid = t.workid and cte.requestid = t.requestid

    END;

    go

    SET NOCOUNT ON
    truncate table debug_table
    truncate table t
    print 'First bunch of inserts'
    insert into t(requestid, customfieldvalue)
    values
    (1,0),(1,0),
    (2,0),(2,0),(2,0),
    (3,0)

    select * from t

    print 'Second bunch of inserts'
    insert into t(requestid, customfieldvalue)
    values
    (1,0),(1,0)
    select * from t

    print 'Third bunch of inserts'
    insert into t(requestid, customfieldvalue)
    values
    (1,0),(4,0),(3,0)
    select * from t

    First bunch of inserts
    workid      requestid   customfieldvalue
    ----------- ----------- ----------------
    1           1           1
    2           1           2
    3           2           1
    4           2           2
    5           2           3
    6           3           1

    Second bunch of inserts
    workid      requestid   customfieldvalue
    ----------- ----------- ----------------
    1           1           1
    2           1           2
    3           2           1
    4           2           2
    5           2           3
    6           3           1
    7           1           3
    8           1           4

    Third bunch of inserts
    workid      requestid   customfieldvalue
    ----------- ----------- ----------------
    1           1           1
    2           1           2
    3           2           1
    4           2           2
    5           2           3
    6           3           1
    7           1           3
    8           1           4
    9           1           5
    10          4           1
    11          3           2


text:
Q: Oracle Query for join from two different tables without duplicate entries I need a select query as per below requirement.
Table 1:

    DEVICEID  MobileNo DealerCode FNAME LNMAE
    1          1234     11         test test
    2          1234     11         TEST tESt

Table 2:

    DealerCode DEALERNAME
    11         JON
    12         DOE

Output:

    MobileNo DealerCode NAME       DEALERNAME
    1234     11         test test  JON

Please provide me the query for the same.

A: Something like this should work for you.
SELECT MIN (MobileNo) MobileNo,
       MIN (a.DealerCode) DealerCode,
       MIN (FNAME || ' ' || LNMAE) NAME,
       MIN (b.DEALERNAME) DEALERNAME
  FROM Table1 a JOIN Table2 b ON a.DealerCode = b.DealerCode;

A: Use distinct keyword in your select query. That should do.
select distinct t1.mobile_no, t1.dealer_code, t1.fname, t1.lname, t2.delear_name
from table1 t1
join table2 t2 on t1.dealer_code = t2.dealer_code;

A:
"without duplicate entries"

Your data does not contain duplicate entries. There is a UID (deviceid), and each row contains different values for fname and lname. Okay, they are only different in terms of case, but Oracle RDBMS is case-sensitive (by default). So those rows are different.
Perhaps your application needs a unique key on mobileno? If so you need to specify a rule to choose which row to key and which one(s) to discard. So, something like this:
select p.mobileno
       , p.dealercode
       , p.fname || ' ' || p.lname as name
       , d.dname as dealername
from phone p
     join dealer d
          on d.dealercode = p.dealercode
where p.deviceid = (select min(x.deviceid)
                    from phone x
                    where x.mobileno = p.mobileno)
/

A: It seems table2 is a look-up table for table1's DealerCode(and i assume it's primary key column in table2 and has foreign key in table1 pointing out table2's DealerCode column). Then, you may try this without too_many_rows exception:
SELECT t1.mobileno, t1.dealercode, lower(t1.fname||' '||t1.lnmae) name,
       ( select t2.dealername from table2 t2 where dealercode = t1.dealercode ) dealername
  FROM Table1 t1
  GROUP BY t1.mobileno, t1.dealercode, lower(t1.fname||' '||t1.lnmae);


text:
Q: Using --prod and --release results unstable application Ionic3 Im building an Ionic3.9 application, during the development process, i use the command:

Ionic cordova build android --device

to run the application on real device, and it works fine.
but at the end of the development process, i tried to produce a release version in order to send an APK to other devices to test the application, i used the following commands:

Ionic cordova build android --prod --release
  or:
  Ionic cordova run android --prod --release

these commands produces .apk file, i tried to install this .apk file in different android devices, but i get an unstable application with very weird behaviorand unexpected results, for example:

*

*Input fields are cannot be focused.

*the tabs navigation won't work.
.
.
.
.and many other issues.

any help will be appreciated,
thanks.

A: This issue occurs when i make the build on iMac PC, i tried to do it in Windows PC, and it work like a charm.


text:
Q: Will Sector-Administrated planets ever upgrade their Colony Ship? I threw one of my colonial planets into a sector in a recent spat of colonizing, since I needed more, newer, planets in my cores!
Today, I looked back at it, and... well...

Plenty more than 5 pop, and still rockin' that Reassembled Ship Shelter.
Since upgrading costs influence, is it even possible for sectors to upgrade this themselves?

A: Looks like, eventually... yes!

Couldn't tell ya what triggers it, though.
Additionally, I found this line in the 00_strategic_resources script file:
influence = {
    accumulative = yes
    AI_category = influence
    max = 1000
    sector_ignore_cost = yes
}

Which seems to explain how Sectors handle the influence cost (They ignore it! Those cheaters!)
And, confirmed by Paradox Developer:
https://twitter.com/Martin_Anward/status/737198287254654976

Sectors do not have influence, they ignore influence costs when building. Outposts cost for country in Clarke.


text:
Q: the meaning of the preposition "from" In the sentence "the government has accepted an enforceable undertaking from the auditor" I don't understand the meaning of the preposition "from". In this context, I think it should be "to" instead of "from".

A: You accept something from somebody else, and not to.


text:
Q: Selection Symbol dissapears when map is zoomed I have a base map layer with a feature layer of maps added.  A table of the routes is generated by FeatureTable and the color of the route changes from green to red whenever a route is clicked on the table or on the map.  My problem is the route changes back to green with a red outline if I zoom in or out with the map.  If I click on the route it will turn back to red, but I need it to stay red.  I have shown my code below.  Any help would be appreciated.
     var map, stateBaseMap, geometryLayer, routeFeature, routeDataFeature, myFeatureTable,
        stateBaseMapUrl, geometryLayerUrl, routeFeatureUrl, routeDataFeatureUrl, routeChange;

  require([ "esri/map",
            "esri/layers/ArcGISDynamicMapServiceLayer",
            "esri/layers/ArcGISTiledMapServiceLayer",
            "esri/tasks/GeometryService",
            "esri/layers/FeatureLayer",
            "esri/dijit/FeatureTable",
             "esri/symbols/SimpleLineSymbol",
             "esri/Color",
             "dijit/layout/ContentPane",
              "dijit/layout/BorderContainer",
              "esri/geometry/Extent",
              "esri/graphicsUtils",
              "esri/tasks/query",
              "dojo/dom",
              "dojo/parser",
              "dojo/ready",
              "dojo/on"],
    function(Map,
             ArcGISDynamicMapServiceLayer,
             ArcGISTiledMapServiceLayer,
             GeometryService,
             FeatureLayer,
             FeatureTable,
             SimpleLineSymbol,
             Color,
             ContentPane,
             BorderContainer,
             Extent,
             graphicsUtils,
             Query,
              dom,
              parser,
              ready,
              on) {
      parser.parse();

      ready(function(){
            esri.config.defaults.io.proxyUrl = "/llr/llrproxy";
            esri.config.defaults.io.alwaysUseProxy = false;
            esri.config.defaults.io.corsDetection = false;
            stateBaseMapUrl = document.getElementById("shipment_stateBaseMapServiceURL").value;
            geometryLayerUrl = document.getElementById("shipment_geometryServiceURL").value;
            routeFeatureUrl = document.getElementById("shipment_routeLayerURL").value;
            map = new Map("map");
            stateBaseMap = new ArcGISTiledMapServiceLayer(stateBaseMapUrl);
            map.addLayer(stateBaseMap);
            geometryLayer = new GeometryService(geometryLayerUrl);
            map.addLayer(geometryLayer);

            routeFeature = new FeatureLayer(routeFeatureUrl, {
                mode : FeatureLayer.MODE_ONDEMAND,
                outFields : [ "*" ],
                visible:true,
                id : "routeFeature"
            });
            var selectionSymbol = new  SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255,0,0]),6);

            routeFeature.setSelectionSymbol(selectionSymbol);

            map.addLayer(routeFeature);
            on(routeFeature, "load", function(){
                loadTable();
              });

            function loadTable(){
                    myFeatureTable = new FeatureTable({
                    featureLayer : routeFeature,
                    map : map,
                    editable: false,
                    showGridMenu:false,
                    gridOptions: {
                          selectionMode: "single"
                      },
                    editable: true,
                    fieldInfos: [
                              {
                                name: 'ROUTE_ID',
                                visible: false
                              },
                              {
                                name: 'ORIGIN',
                                alias: 'Entry State'
                              },
                              {
                                name: 'ROUTE_DESC',
                                alias: 'Route Description'
                              },
                              {
                                name: 'DESTNATION',
                                alias: 'Exit State'
                              }
                    ],
                    menuFunctions: [
                                        { label: "Enter a new route.",  callback: enterNewRoute }
                                  ]

                  }, 'myTableNode');

                  myFeatureTable.startup();
            }
        });
      });

A: There must be some other code, which is clearing the selection. Otherwise it should work. Here is a JSBin showing the selection remains even after zooming/panning. I have taken the sample from esri website and modified similar to your logic except, the loadTable part.

A: I found changing mode : FeatureLayer.MODE_ONDEMAND,   to mode : FeatureLayer.MODE_SNAPSHOT, solved the problem but the problem was still there if I zoomed or moved the map.  Also, I can only use the MODE_SNAPSHOT because my map has a small number of features.  To solve the zoom/move problem I redrew the route after the zoom or move was finished.
var map, stateBaseMap, geometryLayer, routeFeature, routeDataFeature, myFeatureTable,
    stateBaseMapUrl, geometryLayerUrl, routeFeatureUrl, routeDataFeatureUrl, routeChange,
    mapUpdateEnd, mapZoomEnd, mapDragEnd;

require([   "esri/map",
  "esri/layers/ArcGISDynamicMapServiceLayer",
  "esri/layers/ArcGISTiledMapServiceLayer",
  "esri/tasks/GeometryService",
  "esri/layers/FeatureLayer",
  "esri/dijit/FeatureTable",
  "esri/symbols/SimpleLineSymbol",
  "esri/Color",
  "dijit/layout/ContentPane",
  "dijit/layout/BorderContainer",
  "esri/geometry/Extent",
  "esri/graphicsUtils",
  "esri/tasks/query",
  "esri/tasks/QueryTask",
  "dojo/dom",
  "dojo/parser",
  "dojo/ready",
  "dojo/on"],
function(Map,
     ArcGISDynamicMapServiceLayer,
     ArcGISTiledMapServiceLayer,
     GeometryService,
     FeatureLayer,
     FeatureTable,
     SimpleLineSymbol,
     Color,
     ContentPane,
     BorderContainer,
     Extent,
     graphicsUtils,
     Query,
     QueryTask,
      dom,
      parser,
      ready,
      on) {
parser.parse();

ready(function(){
    esri.config.defaults.io.proxyUrl = "/llr/llrproxy";
    esri.config.defaults.io.alwaysUseProxy = false;
    esri.config.defaults.io.corsDetection = false;
    stateBaseMapUrl = document.getElementById("shipment_stateBaseMapServiceURL").value;
    geometryLayerUrl = document.getElementById("shipment_geometryServiceURL").value;
    routeFeatureUrl = document.getElementById("shipment_routeLayerURL").value;
    map = new Map("map");
    stateBaseMap = new ArcGISTiledMapServiceLayer(stateBaseMapUrl);
    map.addLayer(stateBaseMap);
    geometryLayer = new GeometryService(geometryLayerUrl);
    map.addLayer(geometryLayer);

    routeFeature = new FeatureLayer(routeFeatureUrl, {
        mode : FeatureLayer.MODE_SNAPSHOT,
        outFields : [ "*" ],
        visible:true,
        id : "routeFeature"
    });
    var selectionSymbol = new  SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255,0,0]),6);

    routeFeature.setSelectionSymbol(selectionSymbol);

    map.addLayer(routeFeature);

    on(routeFeature, "load", function(){
        mapZoomEnd = map.on("zoom-end",function(){
            mapZoomEnd.remove();
        });

        loadTable();

            mapZoomEnd = map.on("zoom-end",function(){
                reDrawRoute(document.getElementById("shipment_currentRouteId").value);
            });

            mapDragEnd = map.on("mouse-drag-end",function(){
                reDrawRoute(document.getElementById("shipment_currentRouteId").value);
            });

            myFeatureTable.on("row-select", function(evt){
                zoomToRoute(evt[0].data.ROUTE_ID);
              });

      });

    function zoomToRoute(routeId){
        if(routeId != 0){
            var query = getQueryForRouteId(routeId);
            routeFeature.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(features){
                var extent = graphicsUtils.graphicsExtent(features).expand(1.25);
                map.setExtent(extent);
            });
        }
    }

    function reDrawRoute(routeId){
        if(routeId != 0){
            var query = getQueryForRouteId(routeId);
            routeFeature.selectFeatures(query, FeatureLayer.SELECTION_NEW);
        }
    }

    function getQueryForRouteId(routeId){
        var query = new Query();
        query.returnGeometry = true;
        query.outFields = [ "*" ];
        query.where = "ROUTE_ID = '" + routeId + "'" ;
        return query;
    }

    function loadTable(){
            myFeatureTable = new FeatureTable({
            featureLayer : routeFeature,
            map : map,
            editable: false,
            showGridMenu:false,
            gridOptions: {
                  selectionMode: "single"
              },
            editable: true,
            fieldInfos: [
                      {
                        name: 'ROUTE_ID',
                        visible: false
                      },
                      {
                        name: 'ORIGIN',
                        alias: 'Entry State'
                      },
                      {
                        name: 'ROUTE_DESC',
                        alias: 'Route Description'
                      },
                      {
                        name: 'DESTNATION',
                        alias: 'Exit State'
                      }
            ]

          }, 'myTableNode');

            myFeatureTable.on('load', function () {
                myFeatureTable.grid.set('sort', [{ attribute: "ORIGIN" }]);
            });
          myFeatureTable.startup();

    }
  });
});


text:
Q: I need a regular expression First name must starts with minimum 2 characters I need a regular expression First name must starts with minimum 2 characters.
I am using following
/^[A-Z a-z]{2,25}$/

A: Your regex appears to allow spaces so I'm not sure if that's valid.
If you want a regex that dictates at least two alpha characters at the start, you can just use:
/^[A-Za-z]{2}/

This will force the first two characters to be alpha with no restriction whatsoever on the rest of the string. If you want to (as it looks) allow those same character plus spaces for up to another 23 characters after that, use:
/^[A-Za-z]{2}[A-Za-z ]{0,23}$/

Otherwise, if your definition of characters includes a space even for the first two characters, your current regex should be fine.

A: The question is which regexp are you using? I assume POSIX RE.
Your solution is fairly good, but if You check a real name, the space is useless. (Maybe You are check for mind name as well???) And (I suppose) the first character should be a capital letter, rest lower case, isn't it? If so I suggest:
/^[[:upper:]][[:lower:]]{1,24}$/

The advantage of using built in character classes, it that it can work in other languages as well.
Example:
$ echo -e "Alpha\nalpha\naLpha\nThisisaverylongfirstname\nThisfirstnameismuchlongertobesure"\
|egrep '^[[:upper:]][[:lower:]]{1,24}$'
Alpha
Thisisaverylongfirstname


text:
Q: While loops in TikZ? Is it possible to have while loops in TikZ, or some equivalent loop which only terminates after a certain condition?

A: Update \whiledo is defined in the package ifthen and not calc
TikZ is based on TeX also you can build a while loop with TeX but it's also possible to use different packages like ifthen. With ifthen  you can use the macro \whiledo and macros from TikZ.

A: You can combine the loop \foreach with the provided command \breakforeach. The following example is copied from the manual.
\begin{tikzpicture}
\foreach \x in {1,...,4}
 \foreach \y in {1,...,4}
   {
    \fill[red!50] (\x,\y) ellipse (3pt and 6pt);
    \ifnum \x<\y
     \breakforeach
    \fi
   }
\end{tikzpicture}


text:
Q: Java Formatter not allowing new line character? So, I've got the following code to write to a file:
Formatter output = ....... // Creating the formatter works, writes to appropriate file.

output.format("%d\n", records.length);
for(GradeRecord gR:records)
{
    output.format(gR.toString() + "\n");
}

Only problem is, the output doesn't have newline characters.
Doesn't work if I replace "\n" with "\r", either.
...I don't know why this doesn't work. Output is created and writes correctly. (I see the file created and everything is written in it, except for newline characters.)

A: You want to use the correct line break string regardless of what platform it's being run on.  You can do this dynamically using
String newline = System.getProperty("line.separator");
So you can later do
output.format(gR.toString() + newline);

A: you can use the format "%n" to output the platform specific newline using a formatter.

A: You can try using \\n instead of \n


text:
Q: Trigger Approval Process I created an Approval Process but I'm not aware how to trigger such approval process. What I would like to know is how to trigger the Approval Process when Opportunity stage = 'Proposal Submitted for Approval'. The stage field is a standard picklist field and when 'Proposal Submitted for Approval' in the stage picklist is selected then the Approval Process must be triggered automatically. As far as I'm concerned the Approval Process can be triggered automatically with the help of the Process Builder therefore I created a Process Builder but I'm not sure how to configure it to use my Approval Process and to be initialized when stage 'Proposal Submitted for Approval' is selected.
Please advise how to trigger the Approval Process automatically when Opportunity stage is 'Proposal Submitted for Approval'?

A: *

*Add the entry criteria for the records to be entered in the process builder.

*Check for the stage field matches 'Proposal Submitted for Approval'.

*Use Submit for approval (initiates an approval process) action.

For reference see the Document

A: You can create a flow to check if the field is set to 'Proposal Submitted for Approval'. Once the flow is created, you can create a quick action Submit for approval and place it on the page layout. Configure this quick action such that it invokes the flow. By having an entry criteria on your approval process, the concerned approval process would be invoked.


text:
Q: MySQL installed but nowhere to be found on MacOS Mojave I installed MySQL 5.7 using homebrew:
brew install mysql@5.7

As I understand, I am supposed to find mysql in /usr/local or /usr/local/bin but I see that mysql@5.7 was placed in /usr/local/opt.
So I tried adding that to the path:
echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.bash_profile

But still when I try to type mysql or mysql@5.7 in the terminal it says "command not found".
What am I doing wrong here? How do I get mysql to become available as a terminal command?

A: mysqlsh in the terminal works for me. I installed the MySQL Community Server and MySQL Shell from Oracle's binaries. I don't know if this is different when installed from the homebrew repositories.
I also had to add /usr/local/mysql/bin to /etc/paths and now the mysql command by itself works as well from anywhere.

A: I had the same problem a while ago and I am still using the full path each time but the easiest way to add a new path to $PATH (the environment variable) is with the export command. In this example we'll add "~/opt/bin" to the user PATH with export:
export PATH=$PATH:~/opt/bin
See the following for further details:
http://osxdaily.com/2014/08/14/add-new-path-to-path-command-line/

A: Force link 5.7 version - $ brew link mysql@5.7 --force
Now you can verify the installed MySQL instance : $ mysql -V.


text:
Q: Animate scroll when button taped Good Evening,
I have been trying to animate a scroll-feature when tapping on a button. Below you will find the code that isn't working, my question is why.
$(document).ready(function () {
$('a[href="#panel-body"]').on('click', function (event) {
    if(this.hash !== "") {
        event.preventDefault();
        var hash = this.hash;

        $("html, body").animate({
            scrollTop: $(hash).offset().top
        }, 800 function () {
            window.location.hash = hash;
        });
    }
});
});

I have assigned a link with the href="#panel-body". Tried with different variants and searched for a solution, still haven't managed to solve it.
Thanks for the help in advance!

A: I just found out that you want to create Up Going Button, For do this use the code below :
$(document).ready(function () {
    $('button').click(function () {
        $('html, body').animate({
            scrollTop: '0px'
        }, 750);
    });
});


text:
Q: Video downloaded from download manager class is not showing up in the gallery I have created an application where user can download reels from Instagram using its link.
Video is being downloaded perfectly and I can see that video in file manager.
The problem is that this video is not showing in the gallery.
Below is my download method where I have defined my destination file where video will be stored after the download. Is there any process or permission that I am missing ?

public class downLoadMethod {
public static String instagramFileName = "/Download/InstaReel";
public static  void download(Uri downloadPath,String destinationPath , Context context , String     filename){

    Toast.makeText(context,"Downloading started",Toast.LENGTH_LONG).show();
    DownloadManager.Request request = new DownloadManager.Request(downloadPath);
    request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE | DownloadManager.Request.NETWORK_WIFI);
    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
    request.setTitle(filename);

    request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,destinationPath);
    ((DownloadManager)context.getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);

    MediaScannerConnection.scanFile(context,
            new String[] { Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString() },
            null,
            new MediaScannerConnection.OnScanCompletedListener() {

                public void onScanCompleted(String path, Uri uri) {

                    Log.i("ExternalStorage", "Scanned " + path + ":");
                    Log.i("ExternalStorage", "-> uri=" + uri);
                }
            });

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
        Uri contentUri = Uri.fromFile(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)); // out is your output file
        mediaScanIntent.setData(contentUri);
        context.sendBroadcast(mediaScanIntent);
    } else {
        context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
                Uri.parse("file://" + Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS))));
    }
}

}

I was tried to download video from reel using its link through Download manager class. I expected it to be downloaded and show up in the gallery but it is shown only in the file manager not in gallery after the download finished.


text:
Q: Spark executors crash due to netty memory leak when running spark streaming app that consumes data from kafka topic with 100 partitions, and the streaming runs with 10 executors, 5 cores and 20GB RAM per executor, the executors crash with the following log:

ERROR ResourceLeakDetector: LEAK: ByteBuf.release() was not called
  before it's garbage-collected. Enable advanced leak reporting to find
  out where the leak occurred.
ERROR YarnClusterScheduler: Lost executor 18 on worker23.oct.com:
  Slave lost
ERROR ApplicationMaster: RECEIVED SIGNAL TERM

this exception appears in spark JIRA:
https://issues.apache.org/jira/browse/SPARK-17380
and someone wrote that after upgrading to spark 2.0.2 the problem was solved. however we use spark 2.1 as part of HDP 2.6. so I guess this bug wasn't solved in spark 2.1.
there's also someone who encountered this bug and wrote about it in spark user list but got no answer:
http://apache-spark-user-list.1001560.n3.nabble.com/Spark-Streaming-Receiver-Resource-Leak-td27857.html
BTW - the streaming app doesn't call cache() or persist(), so no caching is involved whatsoever.
Did anyone encounter a streaming app that crashed on such bug?


text:
Q: Retrieve parameters from file - Windows PowerShell I am writing a super-easy script in PowerShell. The target of this script is to read a list of server names from a txt file and a command block from another txt file. The result of the operation shold be a third txt file containing the information.
Here some code:
cls
$usr = Read-Host "Please insert username, you'll be asked for password later"
$path = Read-Host "Insert a valid path for ServerList.txt file"
$serverList = Get-Content -Path $path | Out-String

$path = Read-Host "Insert a valid path fom Command.txt file"
$commandBlock = Get-Content -Path $path | Out-String

echo "Command: " $commandBlock "will be executed on " $serverList
echo "Press CTRL+Z to abort or"
pause

Invoke-Command -ComputerName $serverList -ScriptBlock { $commandBlock } -credential $usr

Serverlist.txt is a plain text containing something like "server1,server2,server3" and command.txt contain only this "Get-WmiObject Win32_BIOS | Select-Object SerialNumber"
Why the error is Invoke-Command : One or more computer names are not valid. If you are trying to pass a URI, use the -ConnectionUri parameter, or pass URI objects
instead of strings. ?
I even tried to substitute $serverlist with $serverlist.toString() but it's not working. I read somewhere that in this case $serverlist is an Array, how do I do to make everything work?
Consider that https://technet.microsoft.com/en-us/library/hh849719.aspx Invoke-Commands work with "server1,server2,server3" format if you put the string via console.

A: Your $serverList isn't a list, it's a single string of server1,server2 etc. To make it into an array, you can use -split to split the string by commas.
$serverList = Get-Content -Path $path | Out-String
$serverList = $serverList -split ","

A: For further understanding of why this doesn't work as you expect, please see the parsing and command syntax help files:
Get-Help about_Parsing
Get-Help about_Command_Syntax

$serverlist
When your text file contains the line server1,server2,server3, this command:
Get-Content -Path .\file.txt | Out-String

Just results in the string server1,server2,server3 and a newline - that's not a valid hostname.
Either format your text file like this (Get-Content automatically splits on line breaks):
server1
server2
server3

or split the string(s) from the file yourself:
$Serverlist = Get-Content -Path $Path | ForEach-Object { $_ -split "," }

$commandblock
For the command block part to work, you can't just drop a string into a ScriptBlock and expect it to execute - you need to recreate it as executable code:
$Code = Get-Content -Path $path -Raw
$CommandBlock = [scriptblock]::Create($Code)

# Now you can do this
Invoke-Command -ScriptBlock $CommandBlock


text:
Q: Pyspark ImportError: No module named spark_df_profiling I am trying to use spark_df_profiling in pyspark databricks environment. I am getting the following error.
> pip install spark_df_profiling

from datetime import datetime
import spark_df_profiling
df = sql("select * from ab.data").cache()

ImportError: No module named 'spark_df_profiling'
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<command-2036534138125494> in <module>()
      1 from datetime import datetime
----> 2 import spark_df_profiling

How do I solve the problem?

A: For Databricks, it may be best to use the dbutils.library.installPyPI method for installing packages.
dbutils.library.installPyPI("spark_df_profiling")

import spark_df_profiling


text:
Q: Android wear 5.0.1 activity fullscreen I have a problem since 5.0.1 update. My activity on moto 360 not taking full screen (light sensor is not part of the activity) anymore and I have now this screen :

I try to add some flags :
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);

Or
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN);

or
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMIT);

On my manifest :
        <activity
            android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
            android:name=".activity.DreamActivity"
            android:excludeFromRecents="true"
            android:noHistory="true"
            android:label="${watchfaceName}"
            android:screenOrientation="reversePortrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
        </activity>

But no luck :( anyone have this problem ? Or even better a solution ? :)
Of course my activity layout is set to match_parent

A: Here is my working solution, maybe there is a better way (maybe an android wear bug ?)...
I have my basic layout and add a rotation = 90
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:custom="http://schemas.android.com/apk/res-auto"
                android:background="@color/black"
                android:id="@+id/main"
                android:rotation="90"
                android:padding="5dp"
                android:gravity="center"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

    <com.jaumard.commonlibrary.views.DigitalClock
        android:id="@+id/watchface"
        custom:onWatch="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </com.jaumard.commonlibrary.views.DigitalClock>
    <View
        android:id="@+id/dim"
        android:background="#AA000000"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</RelativeLayout>

And on my Manifest I remove the previous android:screenOrientation="reversePortrait"


text:
Q: connet to asp.net core signalR server from a javascript client I have asp.net core web api server that is streaming a signalr, And it works for asp.net client , I am trying to make a connection with the code showen beelow but it only connects to a none core servers it wouldnt work for the core servers.
//the hub class in the server code
[EnableCors("AllowAllOrigins")]
[HubName("LogNotifierHub")]
public class LogNotifierHub : Hub
{
   //methods defined here
}

startup code for the routing  :
 app.UseSignalR(routes =>
            {
                routes.MapHub<LogNotifierHub>("/NotifierHub");
            });

javascript code for making the connection
var hubUrl ="http://localhost:52273/logNotifierHub";

var connection = $.hubConnection(hubUrl, { useDefaultPath: true});
var hub = connection.createHubProxy("LogNotifierHub");

hub.on('SendStreamInit', function(data){
            console.log( data)
})

connection.start()
   .done(function(){ console.log(' connected!! connection ID=' + connection.id); })
   .fail(function(error){ console.log('Could not connect!!' + error); });

A: You can't mix and match version of the SignalR server and client. If you're using core on the server then you have to use it on the client as well.
From the MSDN SignalR alpha blog post

SignalR for ASP.NET Core is not compatible with previous versions of SignalR. This means that you cannot use the old server with the new clients or the old clients with the new server.


text:
Q: Port identification How can i check which services are listening on which ports on a server? Is there any command line tool available for this.

A: On the machine itself, run:
sudo netstat -pnltu

This will show all processes listening for TCP and UDP connections.
To scan from another machine, run:
sudo nmap -n -PN -sT -sU -p- hostname


text:
Q: Error in `[.data.frame`(data_for_analysis, , variable_name) : undefined columns selected in R I am trying to use the TVEM-function to fit 'model1' using a dataset called 'databrandSpendPromo'. I want to fit the time-varying intercept of the varibale 'sum_value_sales_N'. The time-variable used is 'Date' and is in a Date-format, while 'sum_value_sales_N' is a numeric.
This code then throws an error:
model1 <- tvem(data=databrandSpendPromo,
     formula=sum_value_sales_N~1,
     time=Date)

'Error in `[.data.frame`(data_for_analysis, , variable_name) : undefined columns selected'

When I show traceback it says:
4.stop("undefined columns selected")

3.`[.data.frame`(data_for_analysis, , variable_name)

2.data_for_analysis[, variable_name]

1.tvem(data = databrandSpendPromo, formula = sum_value_sales_N ~ 1, time = Date)

It seems like R does not find the column 'sum_value_sales_N'.
I have also tried:
model1 <- tvem(data=databrandSpendPromo,
     formula=databrandSpendPromo$sum_value_sales_N~1,
     time=Date)

With the error:
Error in `[.data.frame`(data_for_analysis, , variable_name) : undefined columns selected

And this:
model1 <- tvem(data=databrandSpendPromo,
     formula='sum_value_sales_N'~1,
     time=Date)

With the error:
Error in terms.formula(formula) : invalid term in model formula

Can you please help me understand what is wrong? The dataframe I am using looks just fine.

A: I know this question is relatively old but if someone needs it...
I came across the same problem and the only thing that worked was to write the data frame exactly as they use it in the example: a column called "id", another "time", "x1", "x2",..., "y". I don't know why but after doing so, the function tvem worked.


text:
Q: This slide menu working on desktop, but on mobile not https://jsfiddle.net/8x2b040p/3/embedded/result/
This code works perfectly on desktop, and when is browser size adjusted to mobile screen size working, but on mobile cant open menu on touch.
Thanks in advance. I am new here!
(function() {

        var bodyEl = $('body'),
            navToggleBtn = bodyEl.find('.nav-toggle-btn');

        navToggleBtn.on('click', function(e) {
            bodyEl.toggleClass('active-nav');
            e.preventDefault();
        });

})();

A: You forgot to add jQuery to the external resources of your fiddle. Add it in and it works: https://jsfiddle.net/8x2b040p/4/embedded/result/.
An alternative would be a vanilla JavaScript version that doesn't rely on jQuery:
(function() {

    document.querySelector('.nav-toggle-btn').addEventListener('click', function (e) {
        document.body.classList.toggle('active-nav');
        e.preventDefault();
    });

})();

Vanilla JS version: https://jsfiddle.net/8x2b040p/5/