text:
Q: jboss eap error org.jboss.jca.adapters.jdbc.jdk8.WrappedConnectionJDK8 cannot be cast to oracle.jdbc.internal.OracleConnection I'm developing camel route to connect to Oracle AQ on Jboss EAP Fuse.
I managed to do it using the connection factory as follows:
<bean class="org.apache.camel.component.jms.JmsComponent" id="oracleAQQueue">
    <property name="connectionFactory" ref="oracleQueueAQCredentials"/>
</bean>
<bean
    class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter"
    id="oracleQueueAQCredentials" primary="true">
    <property name="targetConnectionFactory">
        <ref bean="connectionFactoryOracleAQAQQueue"/>
    </property>
</bean>
<bean class="oracle.jms.AQjmsFactory"
    factory-method="getQueueConnectionFactory" id="connectionFactoryOracleAQAQQueue">
    <constructor-arg index="0">
        <value>jdbc:oracle:thin:xx/xx@localhost:1521/orclpdb</value>
    </constructor-arg>
    <constructor-arg index="1" type="java.util.Properties">
        <value/>
    </constructor-arg>
</bean>

What I'm trying to do next is to use the JNDI Datasource on the Jboss EAP instead of the connection string.
So I configured the datasource on jboss
<datasource jta="true" jndi-name="java:/AQ_DB" pool-name="AQ_DB_DataSource" enabled="true" use-java-context="true">
    <connection-url>jdbc:oracle:thin:@localhost:1521/orclpdb</connection-url>
    <driver>oracle</driver>
    <security>
        <user-name>xx</user-name>
        <password>xx</password>
    </security>
</datasource>

<driver name="oracle" module="com.oracle">
    <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>

then I change my code to use the connection as follows:
<jee:jndi-lookup id="jndiConnectionFactory" jndi-name="java:/AQ_DB" />

    <bean class="oracle.jms.AQjmsFactory"
        factory-method="getQueueConnectionFactory" id="connectionFactoryOracleAQAQQueue">
        <constructor-arg index="0">
            <ref bean="jndiConnectionFactory"/>
        </constructor-arg>
    </bean>

however, upon starting the Jboss EAP, the following error shown.
Cause: Error creating the db_connection; nested exception is java.lang.ClassCastException: org.jboss.jca.adapters.jdbc.jdk8.WrappedConnectionJDK8 cannot be cast to oracle.jdbc.internal.OracleConnection: oracle.jms.AQjmsException: Error creating the db_connection
        at oracle.jms.AQjmsDBConnMgr.getConnection(AQjmsDBConnMgr.java:625)
        at oracle.jms.AQjmsDBConnMgr.<init>(AQjmsDBConnMgr.java:399)
        at oracle.jms.AQjmsConnection.<init>(AQjmsConnection.java:259)
        at oracle.jms.AQjmsConnectionFactory.createConnection(AQjmsConnectionFactory.java:529)
        at org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.doCreateConnection(UserCredentialsConnectionFactoryAdapter.java:181)
        at org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.createConnection(UserCredentialsConnectionFactoryAdapter.java:152)
        at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180)
        at org.springframework.jms.listener.AbstractJmsListeningContainer.createSharedConnection(AbstractJmsListeningContainer.java:411)
        at org.springframework.jms.listener.AbstractJmsListeningContainer.refreshSharedConnection(AbstractJmsListeningContainer.java:396)
        at org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful(DefaultMessageListenerContainer.java:927)
        at org.springframework.jms.listener.DefaultMessageListenerContainer.recoverAfterListenerSetupFailure(DefaultMessageListenerContainer.java:901)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1079)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassCastException: org.jboss.jca.adapters.jdbc.jdk8.WrappedConnectionJDK8 cannot be cast to oracle.jdbc.internal.OracleConnection
        at oracle.jms.AQjmsGeneralDBConnection.getProviderKey(AQjmsGeneralDBConnection.java:99)
        at oracle.jms.AQjmsGeneralDBConnection.<init>(AQjmsGeneralDBConnection.java:68)
        at oracle.jms.AQjmsDBConnMgr.getConnection(AQjmsDBConnMgr.java:566)

Anyone can help?

A: You need to unwrap your connection as it comes from an ironjacamar pool.

A: Thanks you ehsavoie. you pointed me to the right direction.
So I have to extend the oracle class to come with the solution:
private class OracleAqGetUnderlyingConnectionFactory extends AQjmsConnectionFactory {
   private DataSource dataSource;

   public void setDataSource(DataSource dataSource) {
       this.dataSource = dataSource;
   }

   @Override
   public javax.jms.Connection createConnection() throws javax.jms.JMSException {
    WrappedConnectionJDK8 connection = null;
    OracleConnection underlyingOracleConnection = null;
try {
connection = (WrappedConnectionJDK8) dataSource.getConnection();
underlyingOracleConnection = (OracleConnection) connection.getUnderlyingConnection();
} catch (SQLException e) {
e.printStackTrace();
}
       return AQjmsQueueConnectionFactory.createQueueConnection(underlyingOracleConnection);
   }

}


text:
Q: Annotation @SequenceGenerator and compilation error I'm .Net programmer but this time I'm working on Java project and I'm encountering some difficulties.
This java project isn't mine, it was developed by other developer and it uses Hibernate.
When I run the Ant builder I receive this error:
9: error: annotation type not applicable to this kind of declaration
@SequenceGenerator( name="companynameSequence" , sequenceName="COMPANYNAME_SEQUENCE" , allocationSize=1 )
^

This annotation is in a file called package-info.java. The content of this file is just these few lines of code:
@SequenceGenerator( name="companynameSequence" , sequenceName="COMPANYNAME_SEQUENCE" , allocationSize=1 )
package com.companyname.application.model;

import javax.persistence.SequenceGenerator;

import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.TypeDef;
import org.jasypt.hibernate.type.EncryptedStringType;

If I remove that annotation the project compiles successfully but I have have a runtime error:
Invocation of init method failed; nested exception is org.hibernate.AnnotationException: Unknown Id.generator: companynameSequence

I'm using Eclipse Juno and JRE 1.7
Can you help me ?
Thank you

A: You need to write something like this :
//different annotations
class className{
        @Id
        @SequenceGenerator(sequenceName = "COMPANYNAME_SEQUENCE", name = "companynameSequence")
        @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="companynameSequence")
        @Column(name="ID", nullable=false, unique=true)
        private int id;
//other fields and methods
}

or this :
//different annotations
class className{
        @Id
        @SequenceGenerator(sequenceName = "COMPANYNAME_SEQUENCE", name = "companynameSequence")
        @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="companynameSequence")
        @Column(name="ID", nullable=false, unique=true)
        public int getId(){};
//other fields and methods
}

this is only example and field names may differ from mine.
and read this post about identifiers and generators

A: Annotations should not affect run-time behavior.  Therefore, I would suggest commenting the annotation out and fixing the bug.  I can't explain, however, the intent of the annotation or why it would throw an error.

A: i am just running into this issue when migrating from 1.6 to 1.8. The problem here was that @javax.persistence.SequenceGenerator only targets @Target({ TYPE, METHOD, FIELD }), but not the packages. It was a bug until java 1.7 that annotations were not being handled properly. I dont know what the fix is, but I am looking for it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Stop flex-grow div growing more than parent container I'm trying to add an Angular Material Expansion Panel with scrollable content within.
However, I have the expansion panel within a div which is in a flexbox container.
I want the expansion panel to fill the available space within the div but not expand it.
I've added overflow: auto to the div within the panel-content div so I can have the scrollable content within the panel.
But how do I get the div with a class of panel-content to fill the available space without increasing the parent div's height?
I know that the overall parent has a height of 400px but that is only for this example. That is likely to be 100% of the screen size so I can't manually set a height or max-height of the panel-content div. I just want it to fill the space automatically.
If you try my example you'll see the red div increase in size when the panel is expanded.

    <mat-expansion-panel>
            <mat-expansion-panel-header>
                <mat-panel-title>
                    header
                </mat-panel-title>
            </mat-expansion-panel-header>

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

        </mat-expansion-panel>

https://stackblitz.com/edit/angular-9-material-starter-cbiquu?file=src/app/app.component.html

A: In the panel-content you can set the following style:
max-height: 200px; overflow-y: scroll;

This will limit the height to 200px and enable the vertical scrolling if needed. I am not sure if that's the effect you were expecting but it's not expanding the red area in your fiddle.


text:
Q: how to get attendances Track from the Google API? We are using the API of google calendar to create events and we have some invites to that, the problem is that we want to get the Attendance, we know that calendar has the feature Attendance Tracking, and that works perfectly, but we need to get that information from the google API. for now it sends me a email at the end of the meet with an excel with that information. but I need to get it from the API cos, we have a lot of meeting and need to update this information automaticly.
thanks a lot if you give some route or some idea to reach it!!!
I am triging to get this information from the caelndar API V3 following this doc but I just get the event info and attendees, but I need to get the Attendance.


text:
Q: How can I use a word that contains a special character(ü) in a .dic file?(Python) I'm trying to classify texts with a translated LIWC Dictionary. But the library I'm using($pip install liwc) is not able to parse words that contains special Turkish characters for example "ü".
Here is the .dic file I'm using for test purposes.
%
4   sad
19  health
%
terketmek   4
kürtaj  19

So when I try to parse this sentence "kabul terketmek naber yawru a asit kürtaj yapabilmek." it does not classify the word "kürtaj" because it contains "ü".
I tried to solve it by myself and I only could find that the library I'm using parses the word "kürtaj" like this "kürtaj" when it is reading the lines from the .dic file I provided.
So, probably that's why the library doesn't classify the word "kürtaj" because it gets lost in translation :)
Thanks in advance!
Python liwc package.

A: I just tried adding encoding='utf8' as a parameter to the open function where it reads the file and it worked.


text:
Q: How to make the style is applied How to make the style is applied only to the chosen object, and not all at once?
 $('#add_text').mousedown
        (
            function()
            {
                $('#add_text').css('background-color', 'blue'),
    $('#template').prepend('
<input class="input_text"/>
'),

                $('div#text_frame').attr("class", function (arr) {return "nomber" + arr;}),

                $('div#text_frame').mousedown(function(){$('div#text_frame').addClass('select_text_frame');}),

                $('#text_frame').draggable('enable'),
     $('#text_frame').draggable({containment: '#template', distance: 1});
            }
        );

A: You can do the following to modify only the element that invoked the event in JQuery:
$(document).ready(function() {

    $('#add_text').mousedown(function() {

        // the this keyword references the element where the mousedown
        // event has occurred
        $(this).css(...);

    });

});


text:
Q: Send command output in shell expect Following is the code I'm trying to execute with expect in shell script.
send "date +%d%m%y \n"
set date1 "$expect_out(buffer)"
puts "$date1"
expect "#"

The output I'm getting is
date +%d%m%y
111217

Is there any way to suppress the command(date +%d%m%y) and only store the output in variale date1?

A: Try this: expect to see 6 digits as a whole word
send "date +%d%m%y\r"         ;# typically we use \r to "hit enter"
expect -re {\m(\d{6})\M}
set date1 "$expect_out(1,string)"
puts "$date1"
expect "#"

More generally, to select the text between the first line (the command) and the last line (the prompt), you can do:
lassign [regexp -inline {.*?\n(.*)\r\n#} $expect_out(buffer)] _ date1

where _ is a throw-away variable that will hold the entire matching text of the regex, and date1 will hold only the captured text.
See https://tcl.tk/man/tcl8.6/TclCmd/re_syntax.htm for Tcl regex syntax.

Without lassign, you could write
regexp {.*?\n(.*)\r\n#} $expect_out(buffer) _ date1


text:
Q: Tweet multiple accounts using OAuth in twitter using PHP? I wanted an application wherein I have a tweet textbox and when the user click on the submit button the tweet will be posted to multiple twitter account.
I already made this working but only on a single account. Using this example: https://dev.twitter.com/docs/auth/oauth/single-user-with-examples
I also have this code:
function getConnectionWithAccessToken($oauth_token, $oauth_token_secret) {
  $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $oauth_token, $oauth_token_secret);
  return $connection;
}

$connection = getConnectionWithAccessToken('myAuthTokenInAppDetail', 'myAuthTokenSecretInAppDetail');
$content = $connection->post('statuses/update', array('status'=>'hello world') );

This code works when the $oauth_token and $oauth_token_secret values are the one that can be found in my App details( https://dev.twitter.com/apps/1482596/show ), but when I use a different twitter account, it will go the the Authorize Page then Redirect Back to my application and says:
stdClass Object
(
    [error] => Could not authenticate you.
    [request] => /1/statuses/update.json
)

This is my code when this happens, I just get the $_SESSION that was being generated once it got back to my application:
function getConnectionWithAccessToken($oauth_token, $oauth_token_secret) {
  $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $oauth_token, $oauth_token_secret);
  return $connection;
}

$oauth_token = $_SESSION['oauth_token'];
$oauth_token_secret = $_SESSION['oauth_token_secret'];

$connection = getConnectionWithAccessToken($oauth_token, $oauth_token_secret);
$content = $connection->get("statuses/home_timeline");
$content = $connection->post('statuses/update', array('status'=>'hello world') );

I don't know why this happens. Kindly share some idea how to implement that app that I wanted. Any idea will be greatly appreciated and rewarded! Thanks! :)

A: If this is @Abraham's TwitterOAuth and you're using the default callback.php, you'll need to change your session lines to:
$oauth_token = $_SESSION['access_token']['oauth_token'];
$oauth_token_secret = $_SESSION['access_token']['oauth_token_secret'];

A: just have to mention  oauth_token and  oauth_token_secret in App details are called TokenKey and Tokensecret and for the new users you should get back  $oauth_token and $oauth_token_secret from twitter API after they click on authorization link
if ( empty($_GET["oauth_token"]) && empty($_SESSION['oauth_token'])    )
//you could add another conditions here using cookies or using DB .
 {
    $request_token = $connection->oauth('oauth/request_token',
            array('oauth_callback' => OAUTH_CALLBACK));
    $url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
    echo "
Sign-in
";
$_SESSION['oauth_token'] = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
    }

else {

$oauth_verifier =  $_SESSION['oauth_token']   ;
$oauth_token = $_SESSION['oauth_token_secret'] ;
// return user details
$request_token2 = $connection->oauth('oauth/access_token',
 array(  'oauth_verifier' => $oauth_verifier  , 'oauth_token' => $oauth_token  )  )  ;
$connection2=new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$request_token2[oauth_token] , $request_token2[oauth_token_secret] );

// send out other user new status .
$statues = $connection2->post("statuses/update",  ["status" => "hello world"]  );
}

of course you can improve that code using other function condensations and add DB table for each new authorized user ,
but keep in mind requesting a new request_token will generate new oauth_token & oauth_token_secret keys each time .
last one of most thing confused me when post other user status CONSUMER_KEY, CONSUMER_SECRET twitter uses the same key for main app authorization and other users authorization , i know some people still fall into this .


text:
Q: angular 4 "Cannot read property 'toggle' of undefined" while using *ngIf="sidemenuu == true" to side menu angular 4  "Cannot read property 'toggle' of undefined"  while using *ngIf="sidemenuu == true" to side menu
side-menu.html
<button mat-icon-button (click)="snav.toggle()" value="sidebarclosed">
<mat-icon>menu</mat-icon>
</button>

<app-header></app-header>
 </mat-toolbar>
 <mat-sidenav-container class="example-sidenav-container"
[style.marginTop.px]="mobileQuery.matches ? 0 : 0">
    <mat-sidenav #snav id="snav" class="dark-sidebar pl-xs"
[mode]="mobileQuery.matches ? 'side' : 'over'" fixedTopGap="0"
[opened]="mobileQuery.matches" [disableClose]="mobileQuery.matches"
*ngIf="sidemenuu == true" >
        <app-sidebar  ></app-sidebar>
    </mat-sidenav>
    <mat-sidenav-content class="page-wrapper">

            <router-outlet>
                <app-spinner></app-spinner>
            </router-outlet>

    </mat-sidenav-content>

 </mat-sidenav-container>

Here am seeing if  location.path(); has indexOf('day') then sidemenuu to false
side-menu.ts
export class SideMenuComponent implements OnDestroy, AfterViewInit {
mobileQuery: MediaQueryList;
url = '';
public sidemenuu: boolean = false;
private _mobileQueryListener: () => void;

constructor(changeDetectorRef: ChangeDetectorRef, media: MediaMatcher,
location: Location, router: Router, public menuItems: MenuItems) {
this.mobileQuery = media.matchMedia('(min-width: 768px)');
this._mobileQueryListener = () => changeDetectorRef.detectChanges();
this.mobileQuery.addListener(this._mobileQueryListener);
router.events.subscribe((val) => {
  this.url = location.path();
  this.sidemenuu = true;
  if (((this.url.indexOf('day')) > -1)) {
    this.sidemenuu = false;
  } else {
    this.sidemenuu = true;
    }
  });
 }

ngOnDestroy(): void {
this.mobileQuery.removeListener(this._mobileQueryListener);
}
ngAfterViewInit() {

}

}

this is the error am getting for other paths
Error
SideMenuComponent.html:40 ERROR TypeError: Cannot read property 'toggle' of
undefined
at Object.eval [as handleEvent] (SideMenuComponent.html:40)
at handleEvent (core.js:13589)
at callWithDebugContext (core.js:15098)
at Object.debugHandleEvent [as handleEvent] (core.js:14685)
at dispatchEvent (core.js:10004)
at eval (core.js:10629)
at HTMLButtonElement.eval (platform-browser.js:2628)
at ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:4751)
at ZoneDelegate.invokeTask (zone.js:420)

A: as your button is "outside" of mat-sidenav-container you can use ViewChild
//In component.ts
@ViewChild('sidenav') sidenav:any;
toggleSidenav()
  {
    this.sidenav.toggle();
    console.log(this.sidenav.toggle);
  }

//In your .html
<button mat-icon-button (click)="toggleSidenav()" value="sidebarclosed">

A: For those that will follow up on this question adding to you component.ts will solve this error
@ViewChild('sidenav') sidenav: any;

A: it may be Viewchild problem ... sometimes viewchild need two parameters..
in this case you can user this..
 @ViewChild('blabla', {static: false})


text:
Q: How does a mathematician read this question?
Ten people are sitting in a row, and each is thinking of a negative integer no smaller than $-15$. Each person subtracts, from his own number, the number of the person sitting to his right (the rightmost person does nothing). Because he has nothing else to do, the rightmost person observes that all the differences were positive. Let $x$ be the greatest integer owned by one of the 10 people at the beginning. What is the minimum possible value of $x$?

I was completely thrown off this problem because of the sentence, "Let $x$ be the greatest integer owned by one of the 10 people at the beginning.", which I intepretted as the first value we start with is -1, because the largest negative integer is -1. It doesn't even come off as ambigious, and yet, to find the minumum value of x, the first value needs to be -15. So, I'm curious at what I'm missing here. Word problems have never been my forté, so any advice on how one should approach these types of questions would be appreciated. Thanks!

A: The question, simplified:

There are ten integers $-15\le x_1,\dots,x_{10}\le-1$ with $x_1-x_2,x_2-x_3,\dots,x_9-x_{10}>0$. What is the smallest possible value of $\max x_i$?

Immediately we see $x_1>x_2>x_3>\dots>x_{10}\ge-15$, that $\max x_i=x_1$ and that the minimum gap between adjacent $x_i$ is one. The minimum $x$ turns out to be $-6$:
$$(-6,-7,-8,-9,-10,-11,-12,-13,-14,-15)$$


text:
Q: Can a dense set $X$ in $\mathbb R$ contain a proper subset $A$ such that $A$ and $X-A$ are not dense in $\mathbb R$? Suppose $X$ is dense in $\mathbb R$ and $A\subset X$,then is it possible that $A$ and $X-A$ are both non-dense in $\mathbb R$.I think that at least one of them must be dense but I am having some problem to prove it.

A: How about $X=\mathbb R, A=(0,1)$?


text:
Q: Что произойдет если прописать некорректное значение в .htaccess Большинство из вас прекрасно понимают как работают функции в различных языках программирования, один момент из всей кучи - возврат значения. То есть мы можем вызвать допустим функцию intval() - возвращает целое число, а принимает что попало! Есть такие моменты что при неправильном аргументе функция может выдать специальный ответ.
Так вот подходим к сути вопроса, есть у нас файл .htaccess и в нем строчка, она может быть любой! В данном случае я захотел написать это php_value output_buffering blablabla. Как на такую строку отреагирует apache?
Дополнительная информация:
php.ini:
output_buffering=On

php.ini: output_buffering=On
Вариант 1:
.htaccess
php_value output_buffering blablabla

отключенный буфер
Вариант 2:
.htaccess
php_value output_buffering 4096

включенный буфер

php.ini: output_buffering=off
Вариант 1:
.htaccess
php_value output_buffering blablabla

отключенный буфер
Вариант 2:
.htaccess
php_value output_buffering 4096

включенный буфер
Вывод: ответы идентичны, хотя когда output_buffering=On и мы пишем в .htaccess мусор мы получаем деактивацию...почему?

A: *

*У вас появится страница с ошибкой 500.

*Либо "чистый лист", зависит от настроек.

.


text:
Q: Is the expectation concave? $E[g(f(x)−y)]$ I want to find out whether the following expectation is concave or convex in $y$.
$$E[g(f(x)−y)]$$
Given $g$ and $f$ are both concave functions, and $x\sim U(i,i+y)$ where $i>0$ is the only constant and $y\geq 0$. This is a follow-up from this thread.
I think I would start by substituting $h(x)\equiv g(f(x)-y)$, through which I get
$$E[h(x)]=y^{-1}\int^{i+y}_{i}h(z)\;dz$$
I do not know how to proceed from this, however. The above form also does not give much information regarding the concavity of the expectation. Is it possible to actually know whether it is concave or convex, or do we need a more specific form of either $g$ or $f$?

A: Let's $y_1,\,y_2\ge 0$ and $t\in[0,1]$. As $g$ in concave, we have $$\begin{align*}
g\left(f(x)+ty_1+(1-t)y_2\right) &= g\left(tf(x) + (1-t)f(x) +ty_1+(1-t)y_2\right)\\
&= g\left(t(f(x)+y_1) + (1-t)(f(x)+y_2)\right)\\
&\ge tg(f(x)+y_1) + (1-t)g(f(x)+y_2)
\end{align*}$$
Then $$\begin{align*}
E\left[g\left(f(x)+ty_1+(1-t)y_2\right)\right]
&\ge E\left[tg(f(x)+y_1) + (1-t)g(f(x)+y_2)\right]\\
E\left[g\left(f(x)+ty_1+(1-t)y_2\right)\right]&\ge tE\left[g(f(x)+y_1)\right] + (1-t)E\left[g(f(x)+y_2)\right]\\
\end{align*}$$
Conclusion : The expression is concave in $y$.


text:
Q: Generic rule from makefile to CMake I am trying to "translate" the flowing vanilla makefile lines into CMake syntax.
SRCS = $(wildcard *.foo)
OBJS = $(SRCS:.foo=.bar)

my_rule: $(OBJS)

%.bar: %.foo
    make_bar_from_foo  $@  $<

Working ugly attempt
FILE(GLOB SRCS "*.foo")
SET(outFiles)
FOREACH(SRC ${SRCS})
    SET(OUTPUT_FILE_NAME "${SRC}.bar")

    ADD_CUSTOM_COMMAND(
      OUTPUT "${OUTPUT_FILE_NAME}"
      COMMAND make_bar_from_foo ${SRC} ${OUTPUT_FILE_NAME}
      DEPENDS "${SRC}")

    SET(outFiles ${outFiles} "${OUTPUT_FILE_NAME}")
ENDFOREACH(SRC)
ADD_CUSTOM_TARGET(my_rule ALL DEPENDS ${outFiles})

I understand that it's going to generate one command per file instead of something generic. Any simplest/cleanest way to do it?

A: In CMake you can always declare your own compiler language. So in your case you can e.g. do:
cmake_minimum_required(VERSION 2.8)

project(MakeBarFromFoo NONE)

set(
   CMAKE_FOO_COMPILE_OBJECT
       "make_bar_from_foo <SOURCE> <OBJECT>"
)

file(GLOB SRCS "*.foo")
add_library(my_rule OBJECT ${SRCS})
set_source_files_properties(${SRCS} PROPERTIES LANGUAGE FOO)

Then you can simply work with it as you would with other object library targets. But you will only get things like the .bar extension if you enable_language(FOO) (and that requires more work, see below).
Examples delivered with CMake itself are ASM or RC compilers.

The enable_language(FOO) Version
This needs four more files you could put in e.g. your project's CMake folder:
CMake\CMakeDetermineFOOCompiler.cmake
# Find the compiler
find_program(
    CMAKE_FOO_COMPILER
        NAMES "make_bar_from_foo"
        HINTS "${CMAKE_SOURCE_DIR}"
        DOC "FOO compiler"
)
mark_as_advanced(CMAKE_FOO_COMPILER)

set(CMAKE_FOO_SOURCE_FILE_EXTENSIONS foo;FOO)
set(CMAKE_FOO_OUTPUT_EXTENSION .bar)
set(CMAKE_FOO_COMPILER_ENV_VAR "FOO")

# Configure variables set in this file for fast reload later on
configure_file(${CMAKE_CURRENT_LIST_DIR}/CMakeFOOCompiler.cmake.in
               ${CMAKE_PLATFORM_INFO_DIR}/CMakeFOOCompiler.cmake)

CMake\CMakeFOOCompiler.cmake.in
set(CMAKE_FOO_COMPILER "@CMAKE_FOO_COMPILER@")
set(CMAKE_FOO_COMPILER_LOADED 1)
set(CMAKE_FOO_SOURCE_FILE_EXTENSIONS @CMAKE_FOO_SOURCE_FILE_EXTENSIONS@)
set(CMAKE_FOO_OUTPUT_EXTENSION @CMAKE_FOO_OUTPUT_EXTENSION@)
set(CMAKE_FOO_COMPILER_ENV_VAR "@CMAKE_FOO_COMPILER_ENV_VAR@")

CMake\CMakeFOOInformation.cmake
# This file sets the basic flags for the FOO compiler
if(NOT CMAKE_FOO_COMPILE_OBJECT)
    set(CMAKE_FOO_COMPILE_OBJECT "<CMAKE_FOO_COMPILER> <SOURCE> <OBJECT>")
endif()
set(CMAKE_FOO_INFORMATION_LOADED 1)

CMake\CMakeTestFOOCompiler.cmake
# For now just do nothing in here
set(CMAKE_FOO_COMPILER_WORKS 1 CACHE INTERNAL "")

Then your CMakeLists.txt file just looks like this:
CMakeLists.txt
cmake_minimum_required(VERSION 2.8)

project(MakeBarFromFoo NONE)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
enable_language(FOO)

file(GLOB SRCS "*.foo")
add_library(my_rule OBJECT ${SRCS})

A: Your attempt is correct, and it hardly can be significantly improved.
This is just how CMake works: each of its "rules" is concrete; you cannot create a "template rule". The reason for that is platform independence: not every build systems supports "templates" for rules.
On the other side, CMake supports creation of the "rules" within functions/macros. So typing repeated parts can be easily reduced.


text:
Q: Difference between Cumulative Update and Rollup I am integrating CRM 2011 with AX 2012 and I noticed that the updated for AX are called Cumulative Updates instead of Rollups as in CRM.
Is there a difference between the two?

A: Seems like a terminology difference, no real difference. There is a technical definition here

Update: A widely released fix for a specific problem. An update addresses a noncritical, non-security-related bug.
Update rollup: A tested, cumulative set of hotfixes, security updates, critical updates, and updates that are packaged together for
  easy deployment. A rollup generally targets a specific area, such as
  security, or a component of a product, such as Internet Information
  Services (IIS).

And for some interesting commentary here:

Did you read through this a few times and go, "Where's the
  difference?" Yeah…so did I. While some may be able to swim the subtle
  nuances of this to find a clear sort of "smoking gun" defining
  difference, in my mind and from what you will find on the Microsoft
  Download center, the phrase "service pack" has not been used in
  regards to Microsoft CRM for a while now. - See more at:
  http://dynamicsuniversity.com/blog/what-update-rollup-it-merely-service-pack-or-it-more#sthash.QorOi3vb.dpuf

A: Also see Apply updates and hotfixes and where to find them.
Quoting from the text (the term "Service pack" seems to have been replaced with "rollup"):
Hotfixes
A hotfix is created to address a specific issue, problem, or customer scenario. A hotfix can address either a single issue or a cumulative set of issues. Hotfixes are distributed only to those customers, partners, and organizations that Microsoft technical support personnel determine can benefit from the changes that are made to the code. Each hotfix includes documentation that indicates what files, tables, code, or functions are changed by the hotfix.
Microsoft publishes a corresponding Knowledge Base (KB) article for every hotfix that is released for every Microsoft product. These products include Microsoft Dynamics AX. These KB articles describe the changes that the hotfix makes to objects, database tables, or files, or other code. Each hotfix is released to address a specific issue or scenario to restore the regular operation of the software. You must review the corresponding KB article to evaluate whether you have to apply the hotfix in your Microsoft Dynamics AX implementation.
Cumulative updates
A cumulative update (CU) is an update that contains all previous hotfixes to date. Additionally, a CU contains fixes for issues that meet the criteria for hotfix acceptance. These criteria may include the availability of a workaround, the effect on the customer, the reproducibility of the problem, and the complexity of the code that must be changed.
When you plan a deployment that will use any of the industry solutions, we recommend that you install the industry solution before you install cumulative updates.
Important:
Any hotfixes that you previously applied are not included in a cumulative update are lost after you install the cumulative update. You must reapply those hotfixes after your installation.
Service packs
A service pack is a tested, cumulative set of all hotfixes and updates. Service packs may also contain additional fixes for problems that have been found internally since the release of the product, and a limited number of design changes or features that were requested by customers.
Feature packs
A feature pack is a group of updates that relate to a feature area or group of functionality. Feature packs contain design changes or features that were requested by customers, and may also contain additional fixes for problems that have been found internally since the release of the product.


text:
Q: How to zoom when scroll UIScrollView I add few labels in UIScrollView and I want when I scroll, the the middle label font size can become bigger. And the previous middle label font size shrinks to smaller. And the change happens gradually. Like below. Label 1 move to left shrink smaller and label 2 move to middle becomes bigger. All labels in a UIScroll view.

I tried some, like when scroll I tried zoom scroll page, seems complex than I thought...
Anyone has good idea? Thanks!

A: Pretty simple really. Just stick a UIScrollViewDelegate to the scrollview and do something like this..
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    for (int i = 0; i < [scrollView.subviews count]; i++) {
        UIView *v = [scrollView.subviews objectAtIndex:i];
        float position = v.center.x - scrollView.contentOffset.x;
        float offset = 2.0 - (abs(scrollView.center.x - position) * 1.0) / scrollView.center.x;
        v.transform = CGAffineTransformIdentity;
        v.transform = CGAffineTransformScale(v.transform, offset, offset);
    }
}

But, if you aren't impressed by the affine transform, you could still scale the rect using the offset factor and set the UILabel to adjustsFontSizeToFitWidth... and you are done!
Just make sure there is enough space! Else it could get out of hand very easily.
Assumptions :

*

*There are no other views in the scrollview apart from these labels.

*Its required to work just horizontally.

A: It could be done with CoreAnimation. You have to keep the index of the main label (that one in the center), and after scrolling is done or when scrolling starts (use some proper for you method in UIScrollViewDelegate) and simply shrink side labels by animation.

A: Just make the size of the font bigger (with an animation block) when it is the middle one, and smaller when it is not.
You can add a category to UILabel with -(BOOL)isMiddle and set it to true/false.


text:
Q: How to plot a chart on Windows Form in real time? I want to be able to plot a chart in Windows Form in real time using Microphone input. How would I plot points on a chart whilst constantly refreshing them?
Something like this is the end goal:
https://www.youtube.com/watch?v=q9cRZuosrOs


text:
Q: Force acting on a polar molecule What kind of force does act on a polar molecule? I mean, there must be a force that is acting on the molecule to keep the negative and positive centre away ( like in H2O). Why the positive and negative centre of charges do not attract and make it a polar molecule? Also energy is needed to keep the positive and negative centre away from each other. Is the energy supplied in the form of heat at the time of formation of the molecule or there is something else i am not understanding?

A: The picture of a positive center and negative center is an effective description, and not a literal one. Because indeed as you thought, electric charges cannot be maintained at a stable stationary equilibrium (i.e. without external forces). This is called Earnshaw's theorem in electrostatics.
To understand precisely what's happening in molecules, you should use the laws of quantum
mechanics to determine what probabilistic configuration minimizes energy. In the case of $H_2 O$ you will find a tetrahedral configuration for electronic orbitals, two of which form covalent bonds with hydrogen. As we know from geometry the angle between hydrogen atoms should then be $109.5$ (it is actually a bit less due to lone pairs...).
However consider this classically metastable example from electrodynamics. A positive sphere slowly orbiting a negative sphere of much larger magnitude of charge (this is metastable because of electromagnetic radiation, but for low velocities we can ignore this effect for an appropriately short time interval). If the orbit is circular you don't have any polarity. But if it is an ellipse for example you can easily see how the positive center of charge is at the center of the ellipse, whereas the negative is located at one of the foci, then the polarity will be along the major axis pointing from the winter towards the summer solstice.


text:
Q: Junit + Ant + Eclipse unit test attempts to run but always returns 1 execution I have an ant task that I am running via Eclipse that fails to properly execute the test case.  The output from Ant is as follows:
[junit] Running my.custom.test.GoTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 seconds
[junit] Test my.custom.test.GoTest FAILED

Ant script minimum possible:
<project>
    <target name="test">
      <javac srcdir="Test/src" destdir="Test/bin" />
      <junit fork="true" printsummary="true">
          <batchtest>
             <fileset dir="Test/test">
                 <include name="**/*Test.*"/>
             </fileset>
          </batchtest>
      </junit>
    </target>
</project>

Java file:
package my.custom.test

public class GoTest
{
     @Test
     public void test_1() throws Exception
     {
         assertTrue(true);
     }
     @Test
     public void test_2() throws Exception
     {
         assertFalse(false);
     }
}

I expect the output above from the ant junit task to produce two tests being run.  However, only one is being run.  I am looking for any reasoning as to why this would happen or if there is a configuration issue that I am missing.

A: In case someone else runs into this exact same issue or something very similar the following change will be of great benefit:
<junit fork="true" printsummary="true">
          <formatter type="plain" usefile="false" />
          <batchtest>
             <fileset dir="Test/test">
                 <include name="**/*Test.*"/>
             </fileset>
          </batchtest>
</junit>

This led me to a ClassNotFoundException


text:
Q: terminal was slow(after finishing the process)after fixing it: unknown characters in terminal appears My terminal was slow.
Every time after finishing the process like:

*

*Installing software or sudo apt update etc...

I should wait for the shell for about 5-10 sec to type next commands.
So i searched to fix this problem.
I found one:
Add: set -x in the first of the .profile and .bashrc and set +x in the last line of that file again(.profile and .bashrc), then run bash --login in terminal.
The problem fixed and everything works perfect...
But after rebooting now i see unknown characters in terminal every-time when i press CTRL+ALT+T:

So i should type clear to have normal terminal like before!
What are these!? And how can i clear them from the terminal without slow down from the terminals speed!?
My .bashrc:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
set -x
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    # We have color support; assume it's compliant with Ecma-48
    # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
    # a case would tend to support setf rather than setaf.)
    color_prompt=yes
    else
    color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi
set +x

My .profile:
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
set -x
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
set +x

A: What you see is the effect of set -x as explained in man bash:

-x      After  expanding  each simple command, for command, case
                        command, select  command,  or  arithmetic  for  command,
                        display  the  expanded  value  of  PS4,  followed by the
                        command and its expanded arguments  or  associated  word
                        list.

As the commands in your ~/.bashrc are executed when you open a terminal and to this time apparently set -x is set, you get all its output in your fresh terminal. To disable it, just remove all the set -x and set +x line you introduced.


text:
Q: Order by the Compute of Count in SQL Hi I get the results that I'm looking for however, I want to order it by the count from the compute. Anyone have any ideas.
Break on 'Movie Title' skip 2
COMPUTE COUNT Label '# of Times Rented' of "Customer" on "Movie Title"
select film_title "Movie Title", star_rating "Customer Rating",
        name "Customer"
from TITLE t join RENTAL r on(t.TITLE_NO = r.TITLE_NO)
    join CUSTOMER c on(r.CUSTOMER_NO = c.CUSTOMER_NO)
order by 1,3;

A: One approach is to use window functions to calculate and order by that value.
The following orders the result by n descending, but doesn't include n in the final SELECT list.
I kept your original order criteria to break any ties.
Break on 'Movie Title' skip 2
COMPUTE COUNT Label '# of Times Rented' of "Customer" on "Movie Title"

WITH cte1 AS (
        SELECT film_title, star_rating
             , name
             , COUNT(*) OVER (PARTITION BY t.title_no) AS n
          FROM ddr_title t
          JOIN rental    r
            ON t.title_no = r.title_no
          JOIN customer c
            ON r.customer_no = c.customer_no
     )
SELECT film_title "Movie Title", star_rating "Customer Rating"
     , name "Customer"
  FROM cte1
 ORDER BY n DESC, 1, 3
;

Example result:
Movie Title                    Customer Rating Customer
------------------------------ --------------- ------------------------------
title1                                       3 Customer1
                                             3 Customer1
                                             3 Customer1
                                             3 Customer2
******************************                 ------------------------------
# of Times Rented                                                           4

title3                                       1 Customer1
                                             1 Customer2
******************************                 ------------------------------

Movie Title                    Customer Rating Customer
------------------------------ --------------- ------------------------------
# of Times Rented                                                           2

title2                                       2 Customer2
******************************                 ------------------------------
# of Times Rented                                                           1

7 rows selected.


text:
Q: Trying to convert int fields to string inside a inherited class I have a base class provided to me, with these fields:
public class OrdersModel
{
  public int orderType {get; set;}
  public int status {get; set;}
  public int accountType {get; set;}
}

I want to create a new class which can override these fields, each field will return a string, depending on the int value the database sends back. For example:
public class OrdersViewModel : OrdersModel
{
  public int orderType {
     get {
           case: (orderType == 0)
               return ("Standard Shipping");
               break;
           case: (orderType == 1)
               return ("Express Shipping");
               break;
           default:
               return ("Value Shipping");

         set{}

         }
     }
}

Unfortunately, I get errors: Code is unreacheable or cannot convert type string to return type int
I could just turn these fields into strings in the base class, but the parent class is being used elsewhere. I just want the inherited class to display human readable values.
My question is the following: Is there a way I can cast or override the fields and make them return string instead of int?
thank you

A: You can't override just by changing the return type, but you can hide a property:
public class OrdersViewModel : OrdersModel
{
    public new string orderType {
        get
        {
            switch(((OrdersModel)this).orderType)
            {
                case(0):
                    return ("Standard Shipping");
                case (1):
                    return ("Express Shipping");
                default:
                    return ("Value Shipping");
            }
        }
        set{ /* reverse mapping from string to int */ ;}
    }
}

However inheriting a viewmodel from a Model is generally not the best option.  It may seem like you're reducing duplication, but tools like AutoMapper make it very easy to map from one class to another, and you don't pollute your model with validation logic or have to override/hide properties that you want slightly different in your viewmodel.  Consider either encapsulating or mapping.  I also prefer mapping because it decouples your viewmodel from a specific model implementation.

A: You can try this
Change type to dynamic
public class OrdersModel
{
    public  dynamic orderType { get; set; }
    public int status { get; set; }
    public int accountType { get; set; }
}

and then Change type to dynamic here also
public class OrdersViewModel : OrdersModel
{
    private int _OT;
    public  dynamic orderType
    {
        get
        {
            switch (this._OT)
            {
                case 0:
                    return ("Standard Shipping");

                case 1:
                    return ("Express Shipping");

                default:
                    return ("Value Shipping");
            }
        }

        set {
            this._OT = value;
        }

    }

}

By this, it might not break implementation wherever using parent class
Please find screenshot. It worked


text:
Q: What is a bispectrum analysis? I am in the atmospheric sciences and when I read papers on non linear interactions I came up with this term - bispectrum. It is not very clear what a 2nd order cumulant is .
So assuming I have wind speed magnitude across a latitude circle as a function of longitude and time I know that I can take a Fourier expansion of the wind speed across the entire globe. So then I can check for wavenumber from that Fourier expansion. I can also check for the temporal frequency of a wave. Then I am lost. Why would I want to take the bispectrum analysis ?
So the paper I am reading talks of a cross spectrum analysis. I am not sure what that means but I am presuming if a particular time series has different temporal frequencies and assuming if the energies associated with these temporal frequencies interact with each other will that show up in a bispectrum analysis as explained in the introduction of this article - Introduction to bispectrum?
Here is a paper(not from my field) but from plasma physics that talks of the cross bispectrum.
By taking simple use cases can somebody explain what is a bispectrum and from that a cross bispectrum ?

A: I know my response is a bit late but I hope it can help someone who got stuck on the bispectrum just as I have in the last few days. Since I've just learnt about it today, you should proof check everything in this comment. Anyway, my goal is mostly to give you an overall and intuitive view of what it is. You should also refer to : Digital Bispectral Analysis and Its Applications to
Nonlinear Wave Interactions by Young C. Kim (1979).
Here's my match plan :

*

*Introduce moment-generating function (MGF) and cumulant generating function (CGF).

*Introduce the formula for the bispectrum

*Try to interpret what it means

1)  The first order MGF $M_X(t)$ can be thought of as the expected value of a function $f(x)$ of a random variable and is written
$$ M_X(t)= E[f(x)] = \int_{-\infty}^\infty e^{tx} f(x) dx $$
where E denote the expected value. An higher order only means we deal with more than 1 function. Knowing probability density function, we do the convolution $*$ of our sequence of function $$ M_{X_1...X_N}(t)= E[f_1(x)...f_N(x)] = \int_{-\infty}^\infty e^{tx} f_1(x)*...*f_N(x) dx $$
The CGF is more complex but as long as we assume stationary wave (which is usually assumed and means $x(t)=\sum_k X_k e^{-i\omega_kt}$ where $X_k$ doesn't depend on $t$, we can write $C_X(t)=M_X(t)$ for second and third order.
2) From Wikipedia : The bispectrum is the third-order cumulant-generating function.
What does it means ? First, we need 3 functions since it is third order : $f_1$, $f_2$ and $f_{1+2}$. The bispectra is defined
$$B(k,l) = F\{C_3(f_1, f_2, f_1+f_2)\} = F\{ E[f_1 \cdot f_2 \cdot f^C(f_1 + f_2)]\} $$ where F is the Fourier transform, $C$ means complex conjugate and we are doing regular multiplication (instead of convolution). To be honest, I'm not really familiar with the cumulant spectra but it seems close to a quantum mechanical wavefunction. Using the convolution theorem, we get
$$ B(f_1,f_2) = \int_{-\infty}^\infty e^{tx} f_1*f_2*(f_1+f_2) dx = F[f_1] \cdot F[f_2] \cdot F^C[f_1 + f_2]$$
3) What is it actually. The bispectrum is the Fourier-transformed counterpart of the three-point correlation function. The three-point correlation function is a function which if given two values at two points, gives us the expected value for a third point. i.e. If we have the density at two points $\rho(r_1), \rho(r_2)$ of a nebulae, it will gives us the correlation at a third point (We assume the value we want to find as a circular distribution which doesn't depend on the angle). A correlation function measure the order of a system as how the spin or the density at different positions are related. So if I understand correctly, and as I said, take this with a grain of salt as I'm no expert, instead of getting the value at two points, we get the value at two frequencies. To continue the example, we would get the density $\rho(f_1), \rho(f_2)$ and determine the correlation with a third frequency.
Normally, we will study correlation function knowing only one position or one frequency and try to determine it at another value. The power of the bispectra is that, since it depends on two values, it can captures higher order effect.


text:
Q: Is it possible to download Azure Spatial Anchor(and feature points) for offline alignment in Unity? I would like to ask if it's possible to download the Azure Spatial Anchor (and the feature points) and load it into Unity so that we can align the hologram/virtual objects to the anchor offline in Unity. I think this support is extremely important for application developers. If it's not possible now, is there any workaround, and is it one of the road-map item?

A: @marklinmao,There is no option to export the feature points out of the sdk today. We are collecting suggestions and feedback for future improvements please feel free to add an item here for us to consider it in the future.
You can leave your feedback here:Azure Spatial Anchors Feedback


text:
Q: Newlines in JEditorPane I am currently using a JEditorPane to display text that is being read from a Socket. I create the JEditorPane, get its Document and add the text as it comes using
document.insertString(document.getEndPosition().getOffset(), string, null);

This works as expected, except that when It encounters a '\n' (The character being used for a newline), it seems to ignore it (i.e. not print anything), and everything comes out on one line. I've looked around for a solution but I can't seem to find anything that works (Tried replacing '\n' with
, didn't help, it just printed out the
.

A: It works as you expected.
Here is the code.
doc.insertString(doc.getEndPosition().getOffset(), "test\n", null);
doc.insertString(doc.getEndPosition().getOffset(), "test\n", null);
doc.insertString(doc.getEndPosition().getOffset(), "test\n", null);
doc.insertString(doc.getEndPosition().getOffset(), "test\n", null);

the complete  code.
    jScrollPane1 = new javax.swing.JScrollPane();
    jEditorPane1 = new javax.swing.JEditorPane();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    jScrollPane1.setViewportView(jEditorPane1);

    getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);

    pack();

*

*Check whether any other property has been set on the editorpane.

*What editor kit are you using?

*try printing the input and ensure that it comes with '\n'

You can also use,
    doc.insertString(doc.getLength(), "test\n", null);


text:
Q: Reading dependency versions in pom.xml from external properties file I am trying to read the versions of the dependencies from the external properties file using "properties-maven-plugin",but the properties are still not getting resolved.
I have tried keeping the phase to pre-clean as well as initialize but it is still not working.
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>properties-maven-plugin</artifactId>
  <version>1.0.0</version>
  <executions>
    <execution>
      <phase>initialize</phase>
      <goals>
        <goal>read-project-properties</goal>
      </goals>
      <configuration>
        <files>
          <file>D:\workspace\dev.properties</file>
        </files>
      </configuration>
    </execution>
  </executions>
</plugin>

<properties>
  <acc.version>${acc.version}</acc.version>
</properties>

<dependency>
  <groupId>com.acc</groupId>
  <artifactId>accounting</artifactId>
  <version>${acc.version}</version>
</dependency>

dev.properties file:
acc.version=1.0


text:
Q: Magento 2 : I Can get Collection from database but cannot save data in database I have a custom table in which I want to save data.
I tried below different methods to save data in table.But cannot get success.
Please check below methods :
Method 1 :
$model = $this->_objectManager->create('Namesapce\Modulename\Model\Test\Product');
$model->setRowId(1);
$model->setProductId(2048);
$model->save();

Method 2 :
$model = $this->_objectManager->create('Namesapce\Modulename\Model\Test\Product');
$data = ['row_id' => 1, 'product_id' => '2048'] ;
$model->setData($data);
$model->save();

For testing purpose I have manually insert data in table and then try to getcollection.
Strange thing is I can sucessfully get collection of data from table.but can not save. I also put above code in try catch but it always going in try. Not in catch.
Please take me out from this issue.
Thank you.

A: You need to be using a resource model ModelFactory, rather than trying to create through the object manager.

A: Please Flush magento cache and try to save again if it's not work, then
See your log folder and do some debugging in your module:

A: $model = $this->_objectManager->create('Namesapce\Modulename\Model\Test\Product')->getCollection();
$model->setRowId(1);
$model->setProductId(2048);
$model->save();

A: I had faced same problem when working on Magento2 CRUD. Never use Primary Key with model save() method.
Definately row_id will be primary key.
How to check we created the correct model , resource & collection class in magento.
In magento2 $this->_objectManager interface use for creating the model object.
$subscription = $this->_objectManager->create('path-to-model class');
Example: Abc\Hello\Model\Subscription.
Use get_class($subscription) method. This will show the full class path.


text:
Q: Razor components vs Blazor I'm confused whats different between Razor components and Blazor and which is better and in the last release .NET Core 3.0 Preview 3 the add those  to Razor Components
Razor Components improvements:

*

*Single project template

*New .razor extension

*Endpoint routing integration

*Prerendering

*Razor Components in Razor Class Libraries

*Improved event handling

*Forms & validation

A: You have every right to be confused, the naming has changed a lot and when you wrote the original question the Blazor team had recently renamed 'Server Side Blazor' as 'Razor Components'.  That has thankfully since been abandoned, see the timeline below for more on that.
To anyone finding that the naming conventions in the answers here don't seem to marry up with what they are reading in older blog posts it's worth knowing that the meaning of 'Razor Components' has changed repeatedly over time.
This may also help anyone like me who has been using Blazor since near the beginning and feels sure that the names have changed!
TL; DR
The naming has evolved a lot during the pre-release period.  Kudos to the Microsoft and the Blazor team for trying to come up with clear names and being willing to change back when needed.  However, this has left a legacy of mixed naming conventions in older articles and some Blazor veterans sometimes use older naming conventions.
At the time of writing in September 2020, with Blazor at version 3.2, the official naming convention is:

*

*Blazor Components (formally called 'Razor Components') can be used in...

*Blazor Server apps, or ..

*Blazor WebAssembly apps

The exciting history of Blazor naming
October 2018: 'Razor Components' becomes the new name for 'Blazor Server Side'
When Blazor 0.6.0 was released it was decided to officially name server side Blazor as 'Razor Components'.
Dan Roth discusses that in his Blazor 0.6.0 experimental release now available blog post in October 2018:

We announced last month at .NET Conf that we've decided to move
forward with shipping the Blazor server-side model as part of ASP.NET
Core in .NET Core 3.0. About half of Blazor users have indicated they
would use the Blazor server-side model, and shipping it in .NET Core
3.0 will make it available for production use. As part of integrating the Blazor component model into the ASP.NET Core we've decided to give
it a new name to differentiate it from the ability to run .NET in the
browser: Razor Components.

It's also discussed more in the ASP.NET Core updates in .NET Core 3.0 Preview 2 blog post.
Feb 19:  Naming is hard...
Probably due to confusion that was arising, the Razor Components name for Server Side Blazor was expanded to 'ASP.NET Core Razor Components'.  This is mentioned in the Blazor 0.8.0 release notes:

Server-side Blazor is now ASP.NET Core Razor Components in .NET Core
3.0 As was recently announced, server-side Blazor is now shipping as ASP.NET Core Razor Components in .NET Core 3.0. We've integrated the
Blazor component model into ASP.NET Core 3.0 and renamed it to Razor
Components. Blazor 0.8.0 is now built on Razor Components and enables
you to host Razor Components in the browser on WebAssembly.

April 2019: Switching back to Server-side Blazor
In April 2019 Blazor server side went into official preview and as part of that the naming for server side Blazor was switched back:

Simplifying the naming and versioning
For a while, we've used the terminology Razor Components in some cases, and Blazor in other
cases. This has proven to be confusing, so following a lot of
community feedback, we've decided to drop the name ASP.NET Core Razor
Components, and return to the name Server-side Blazor instead.
This emphasizes that Blazor is a single client app model with multiple
hosting models:

*

*Server-side Blazor runs on the server via SignalR

*Client-side Blazor runs client-side on WebAssembly

… but either way, it's the same programming model. The same Blazor
components can be hosted in both environments.

Note that in the above description there is no mention of Razor Components at all, now we have two different Blazor hosting models (Client-side and server-side) as ways of delivering Blazor Components to the browser.
Sept 2019 The return of 'Razor Components'
Dan Roth's Blazor and .NET Core release notes for the next few versions no longer mention the term 'Razor Components' at all until .NET Core 3.0 Preview 9 when the term emerges again in the name of the 'Razor component unit test framework prototype'.
May 2020 'Razor Components' = 'Blazor Components'. Introducing 'Blazor Server' and 'Blazor WebAssembly'
By the time we get to May 2020 Razor Components and Blazor Components are now being used as synonyms for each other and the naming for the two hosting models has evolved.
The Blazor WebAssembly 3.2.0 now available blog describes that as follows (my emphasis):

Blazor components can then be hosted in different ways to create your web app. The first supported way is called Blazor Server. In
a Blazor Server app, the components run on the server using .NET Core.

And...

Blazor WebAssembly is now the second supported way to host your Blazor components: client-side in the browser using a WebAssembly-based .NET
runtime.

So.. the term 'Razor Components' is officially dead, right?
It would be so much easier if it was.. it does seem like 'Blazor Component' would be a more natural fit.  But no, from the Components section of the official documentation:

Components in Blazor are formally referred to as Razor components.

A: Essentially there are 3 parts to understand.
Razor Components
This is the name for the core, out of process, component model which was created back in July 2018, for the first release of Server-side Blazor.
Razor Components is the core of the framework and contains all the following things.

*

*Parameters

*Event handling

*Data binding

*Routing

*Dependency injection

*Layouts

*Templating

*Cascading values

Server-side Blazor
This is the server-side hosting model, running on ASP.NET Core, for Razor Components. This version hosts the Razor Components model on the server. It uses a small runtime to send UI events from the browser to the server. Once processed by Razor Components, any UI updates get sent back from the server to the browser and the runtime handles updating the DOM. All this communication is handled via a SignalR connection. Even JS interop calls are handled this way.
Client-side Blazor
This is the client-side hosting model for Razor Components.
In this model, everything is hosted in the browser. Mono, compiled to WebAssembly, is the .NET runtime. On top of this sits Razor Components and then finally the application.
The great thing about this architecture is that any feature added to Razor Components should, in theory, be available to both hosting models. Although in reality, this is not always the case.
What's better?
That very much depends on what you want to do.
Client-side Blazors biggest drawback is its download size. This alone could rule it out for many developers. Downloads are easily into multiple MBs which if someone is trying to view your app on a mobile with a slow connection, they are not going to have a great experience. However, it's worth noting that after the first download a lot of the content is cached so subsequent loads can be a few 100kb.
Client-side Blazors debugging experience is very primitive right now as well. Which means working on it as a developer can be challenging at times.
Server-side Blazor has a much nicer developer experience in terms of debugging. The app is much faster to download and only has a size of a few 100kb before any caching takes place.
The downside is potentially scalability. But this will very much depend on the number of concurrent users you are expecting. Because this model uses SignalR your app will have a top limit on concurrent connections. But, you can manage this by plugging into Azure SignalR to allow a far greater number of connections to your app.
Ultimately, both hosting models of Razor Components have a long way to go. The authentication stories for both are in very early days, although client-side Blazor is arguably in a better place. The routing engine is still limited, forms and validation have only just had it's first release and there is still work to do.
Another thing to keep in mind is that it is possible to swap between the models pretty easily. So whatever decision you make you're not tied into it. There will even be a way of doing this built into the framework at some point so nothing you do now will be wasted.
Any questions, please ask. But I hope this helps.

A: Razor Components is a framework with which you can create SPA web applications. It is divided into two mode of execution. When the web app is hosted and executed on the browser, it is called Blazor. Blazor applications are written in C# and compiled into .NET assemblies. They are executed and run on the browser as .NET assemblies by the Mono run time, which itself is compiled to Web Assembly.
The second mode of execution is server-side. That is, your web app is executed on the server, not on the browser. Note that here the runtime environment is not Mono Web Assembly but the Asp.net Core run time. This is called server-side Blazor, but the term Razor Components is used as well, so that the confused get perplexed. The reason for this is historic:  At the beginning, there was only Blazor running on the browser. But then came the idea that a web app can run on the server, and only the diffs can be send to the browser by means of SignalR. Running the web app on the server is much easier than running on the browser, and the developer can use many elements he can't use on the browser, such as debugging, etc. As a result of this possibility, the Asp.Net renamed the Blazor framework as Razor Components, which you can treat as a super structure on which Blazor is built. This is why the confusion. Let's emphasize this division as follows:
Razor Components --> Blazor (front end; browser)
Razor Components --> Razor Components (server-side Blazor )
I know this is a source of confusion, but this is it...
As to the question which is better, I may only say that it depends exclusively on your requirements. Each of these mode of executions has its benefits and drawbacks. Blazor applications are more suitable for running on the internet as public web sites, whereas server-side Blazor application are best used on the Intranet as enterprise web sites.
The list you displayed is related to Razor Components framework. Some improvements, for the time being, may only be relevant to Blazor, others to server-side Blazor. There is only one way to know which is which: To learn Razor Components. It takes time to learn it, less than Angular, especially if you are a .Net developer, but it is still something which requires some investment.
Hope this helps...
I'll improve on it later on, but if you have specific question don't hesitate to ask...


text:
Q: Laravel elixir and autoprefixer So I saw that elixir doesn't automatically use autoprefixer. This is how my gulp file looks:
var Elixir = require('laravel-elixir');
var autoprefixer = require('gulp-autoprefixer');
var gulp = require('gulp');

Elixir.config.sourcemaps = false;

gulp.task('sass', function() {
    return gulp.src('resources/sass/app.scss')
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(gulp.dest('public/css/app.css'));
});

Elixir(function(mix) {

    // Copy bootstrap.min.js to node vendor directory until it becomes a node module
    mix.copy('public/vendor/bootstrap-4', 'node_modules/bootstrap-4');

    // Combine all vendor scripts
    mix.scripts([
        'bootstrap-4/dist/js/bootstrap.min.js',
        'vue/dist/vue.min.js'
    ], 'public/js/vendor.js', 'node_modules');

    // Combine all files into one single CSS file
    mix.task('sass', 'resources/sass/**/*.scss');

    // Get rid of cached version
    mix.version([
        'public/js/vendor.js',
        'public/css/app.css'
    ]);

});

But it's not issuing autoprefixer still. I get no gulp errors. And when I run gulp watch, it doesn't update whenever I update a .scss file. All my sass files are located under resources/sass
Thanks for any help!
I even tried:
new Task('sass', function() {
    return gulp.src('resources/sass/app.scss')
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(gulp.dest('public/css/app.css'));
})
.watch('resources/sass/**/*.scss');

A: use this configurations
var elixir = require('laravel-elixir');
config.css.autoprefix.options.browsers =  ['last 15 versions'] ;

elixir(function(mix) {
    mix.sass('index.scss');
});

A: Although currently undocumented, Laravel's Elixir indeed runs your CSS through Autoprefixer, with it's mostly default settings, as found in the package's Config.js:
{
    ...
    css: {
        autoprefix: {
            enabled: true,

            options:  {
                browsers: ['last 2 versions'],
                cascade: false
            }
        },
    }
}

To customize that configuration, you should use the following:
elixir.config.css.autoprefix = {
    enabled: true, //default, this is only here so you know how to disable
    options: {
        cascade: true,
        browsers: ['last 2 versions', '> 1%']
    }
};

elixir(function(mix) {
    ...
});

A: Your gruntfile.js should look like this:
var elixir = require('laravel-elixir');

elixir(function(mix) {
  mix
    .copy('./public/vendor/bootstrap-4', './node_modules/bootstrap-4')
    .sass('app.scss')
    .scripts([
      './node_modules/bootstrap-4/dist/js/bootstrap.js'
      './node_modules/vue/dist/vue.js'
    ], './public/js/app.js')
    .version([
      'css/app.js',
      'js/app.css'
    ]);
});

Your resources/assets/sass/app.scss file should look like this:
@import "node_modules/bootstrap-4/scss/bootstrap";

You'll now have a directory structure like this:
public/build/css/app-**********.css
public/build/css/app.css.map
public/build/js/app-**********.js
public/build/js/app.js.map
public/css/app.css
public/css/app.map
public/js/app.js
public/js/app.map.js

The asterisks will be [a-z0-9]{10} but you'll load them by calling {{ elixir('css/app.css') }} and {{ elixir('js/app.js') }}.


text:
Q: Introducir tabuladores en un fichero despues de uniq [Linux] Necesito generar un informe de procesos que fallan en un día concreto de manera que tengo un archivo que he generado con un paste después de unir dos diferentes. El problema es que necesito sacar un contador para saber si hay varios que hayan fallado el mismo día y para eso uso el uniq -c hasta ahí todo bien.
Consigo lo siguiente:

1 EF63024D     20190930
  1 EF63024M     20190919
  2 EF63O020     20190904
  2 EF63O020     20190905
  1 EF63O020     20190906
  2 EF63O020     20190910
  3 EF63O020     20190911
  4 EF63O020     20190912
  2 EF63O020     20190916

He logrado meterle un tabulador entre el nombre y la fecha mediante el paste. Pero entre el numero de contador y el nombre del proceso no soy capaz ni con un unexpand -t1 ni con unexpand -a  porque lo que hay en el medio no es un espacio (no sé que es, pero un espacio no es) lo metí en el notepad++ y parece un blanco pero no sé como referirme esa "cosa" para sustituirla.

A: Considera usar sed para sustituir la "cosa" (interpretada aquí como cualquier caracter no alfanumérico) por un tabulador.
sed 's/[^[:alnum:]]/\t/g' <entrada.txt >salida.txt


text:
Q: ¿Como hacer que un objeto sea reactivo en vuejs? Hola a todos antes que nada, gracias por sus respuestas y opiniones,me encuentro el siguiente problema quiero generar formularios dinámicamente, tengo una vista que recibe un objeto, este objeto es variante es decir, puede tener diferentes valores he logrado mostrar los formularios dinamicamente, pero no puedo hacerlo reactivo cuando el usuario ingresa datos. Comparto parte del código parte del código de la vista.
<template>
 <q-card-section v-for="(column, key, index) in tableColumns" :key="index" >

          <q-input square outlined :label="key" :value="column" />

</q-card-section>
</template>

En la etiqueta de script tengo el código de esta menera:

Estoy buscando que al ingresar un dato en los inputs que son recorridos en un v-for este se refleje en tableColums osea que el objeto sea reactivo, cualquier ayuda u orientación es bien recibida, muchas gracias.

A: Puedes plantear algo como, definiendo el v-model tableColumns como un array de objetos.

&lttemplate&gt
 &ltq-card-section v-for="(column, key, index) in items" :key="index" &gt
    &ltdiv class="row q-col-gutter-sm"&gt
        &ltdiv class="col-xs-12 col-sm-12 col-md-12"&gt
          &ltq-input v-model = "tableColumns[index].nombre" square outlined :label="key" :value="column" /&gt
          &ltq-input v-model = "tableColumns[index].apellidos" square outlined :label="key" :value="column" /&gt
          &ltq-input v-model = "tableColumns[index].edad" square outlined :label="key" :value="column" /&gt
        &lt/div&gt
    &lt/div&gt
&lt/q-card-section&gt
&lt/template&gt

Aunque también si generas los cards y quieres ir guardando los datos en tableColumns, podrías a partir del formulario con los tres v-model generar un array de objetos en tableColumns.

&ltinput v-model="nombre"&gt
&ltinput v-model="apellidos"&gt
&ltinput v-model="edad"&gt
&ltbutton v-on:click="addData"&gt Guardar &lt/button&gt

&ltscript&gt
    var app = new Vue({
        el: '#app',
        data: {
            nombre: '',
            apellidos: '',
            edad: '',
            tableColumns: []
        },
        methods: {
            addData: function() {
                let obj = {};
                obj.nombre = this.nombre;
                obj.apellidos = this.apellidos;
                obj.edad = this.edad;
                this.tableColumns.push(obj);
            }
        }
    })
&lt/script&gt


text:
Q: How does yui improve performance? Just curious to know if yui improves performance? As all the css and javascript files are on the YAHOO servers and only a part of it is loaded when needed. so does it help in improving performance?
Thanks

A: YUI does not improves performances by itself, it's a set of tools that can help you to develop faster. Now, you may be confused by something you read previously on the net about perf, and here is what you have to know :

*

*YUI includes tools to compress and load dynamically your jJavascript files. Therefor you can make their loading more efficient. You can gain performances, or perceived performances,  from using it.

*YUI contains a Javascript framework that is probably better that any code you can write yourself. Since you can include this code to replace yours, and knowing that you can make it so it is downloaded from the very fast Yahoo! servers, then yes, you gain performances here too.

*Therefor, if a file comes from Yahoo! servers, a lot of people will likely have already visited a page doing the same, and already downloaded the javascript code. In that case, their browser kept a copy of the files in cache, so they don't have to download it twice and no download means better performances.
Now, you must know that this is not specific to YUI. Closure, Mootools, Prototypes and JQuery offer similar features, and you can use the Google servers to provide them.

A: What exactly do you mean by "performance"?
Yahoo's servers are probably faster than yours, it saves you bandwidth, other visitors might already have the file cached, and of course not loading stuff you don't need will speed things up.


text:
Q: Are Nagios error messages set somewhere in the configuration or web interface? From what little I know about Nagios, there are little programs that get run on different machines across the network, and they return a status of OK, WARN, or CRITICAL based on a value returned when the program runs and what thresholds have been set for WARN and CRITICAL for the call to the checker.  Do the error messages get set by somebody else configuring that in Nagios or it's web client?

A: The thresholds can be passed by arguments or can be fixed directly in the script on your client.
Nagios doesnt store any of these values. Nagios reads these values from the perfdatas sent in the results of the command.
If the thresolds are passed by arguments you can modify them in the concerned service in your nagios conf.


text:
Q: How to add leading zero to time using VB.NET? In the code below, I'm using the current date and time, with the help of which I am generating a file name. My problem is that it's giving me an output without leading zeros:
Dim strDateTime As String = DateTime.Now.Day.ToString() & "" & _
DateTime.Now.Month.ToString() & "" & DateTime.Now.Year.ToString() & "" & _
DateTime.Now.Hour.ToString() & "" & DateTime.Now.Minute.ToString() & "" & _
DateTime.Now.Second.ToString() & DateTime.Now.Millisecond.ToString()

For example, my query is giving output as below currently:
Assume time is 1:5:30  :: hh:mm:ss
Required output is: 01:05:30
How can I achieve this?

A: Try this,
DateTime.Now.Hour.ToString("00") & ":" & DateTime.Now.Minute.ToString("00") & ":" & DateTime.Now.Second.ToString("00")

EDIT :
As suggested by 'mdb' in the answers, using Custom Date and Time Format Strings would be more efficient and cleaner
DateTime.Now.ToString("hh:mm:ss tt") '12 Hour format with AM/PM designator, Eg :- 09:01:01 PM
DateTime.Now.ToString("HH:mm:ss") '24 Hour format  Eg :- 21:01:01

A: Instead of concatenating strings, which is highly inefficient, you'll want to use String.Format. This also supports Custom Date and Time Format Strings, which make it trivial to achieve what you want.


text:
Q: Docker + Mongodb: Initiating replicaset inside Dockerfile I need to create a Dockerfile starting mongodb and initiating replicaset after that.
First I created a Dockefile as below:
FROM mongo:latest
EXPOSE 27017
ADD setup.sh /root/setup.sh
CMD ["bash","/root/setup.sh"]

Then I created the setup.sh file like this:
#!/bin/bash
mongod --fork --replSet rs0 --noprealloc --smallfiles
sleep 5
mongo --eval "rs.initiate()"

The problem is that it´s not working, am I doing something wrong?
Thanks!


text:
Q: Run multiples detectMultiScale() on parallel I'm working on a mobile application that detects closed and opened eyes. For now it is running sequentially, since I'm a novice on parallelization, but I want the two 'detectMultiScale' methods to be running on multiple cores, because frame per second number needs to be increased. The raw detectMultiScale code is shown below:
eyes_cascade.detectMultiScale( faceTrackedROI, eyes, 1.1, 5, 0 |CV_HAAR_SCALE_IMAGE, Size(10,5));
eyesclosed_cascade.detectMultiScale( faceTrackedROI, eyesclosed, 1.25, 6, 0 |CV_HAAR_SCALE_IMAGE, Size(10, 5), Size(50,25) );

I have done a lot of researches, which have led me to TBB and OpenMP. Which one is recommended for this application? How can I use it to parallel these methods?


text:
Q: Embedding Python, using Non-Python threads in Grand Central Dispatch causes Py_Finalize errors This is happening in Python 3.4.3 from non-python created threads:
https://docs.python.org/3.4/c-api/init.html#non-python-created-threads
There are a couple question on SO that take a look at a similar issue from within C/C++ applications.
AssertionError (3.X only) when calling Py_Finalize with threads
Fatal error during Py_Finalize in embedded Python application
PyEval_InitThreads in Python 3: How/when to call it? (the saga continues ad nauseum)
But none of those specifically deal with Grand Central Dispatch. I don't know if it matters or not as it's likely all just threads under the hood.
Attempting to apply the knowledge from those posts however, still causes me issues.
So here is where I am at currently, I have an obj-c class that represents my Python Runtime, and I have the following relevant methods:
- (void)initialize
{
    Py_Initialize();
    PyEval_InitThreads();

    PyObject* sysPath = PySys_GetObject((char*)"path");

    for(NSString * path in self.pythonPath){
        PyList_Append(sysPath, objc_convert_string(path));
    }

    // not calling PyEval_SaveThread
    // causes beginTask below to die on
    // PyEval_AcquireThread

    // self.threadState = PyThreadState_Get();
    // release the GIL, this shouldn't need to be
    // done, as I understand it,
    // but as the comment above states, if I don't
    // beginTask will fail at PyEval_AcquireThread
    self.threadState = PyEval_SaveThread();
    self.running = YES;
}

That is how I initialize Python. I then invoke python commands via:
- (void)beginTask:(nonnull void (^)(void))task completion:(nullable void (^)(void))completion
{
    dispatch_async(self.pythonQueue, ^{

        PyInterpreterState * mainInterpreterState = self.threadState->interp;
        PyThreadState * myThreadState = PyThreadState_New(mainInterpreterState);
        PyEval_AcquireThread(myThreadState);

        // Perform any Py_* related functions here
        task();

        PyEval_ReleaseThread(PyThreadState_Get());

        if (completion){
            dispatch_async(dispatch_get_main_queue(), ^{
                completion();
            });
        }

    });
}

In the case of doing a long running operation, I have some code that does quite of bit of Jinja template rendering an saving to the filesystem. I want to clean up after that is done, so I call Py_Finalize and then go and reinitialize, using the above method enter my issue:
- (void)finalize
{
    PyEval_RestoreThread(self.threadState);

    // Problems here
    Py_Finalize();

    self.running = NO;
}

This causes the following error in Python:
Exception ignored in: <module 'threading' from '/Users/blitz6/Library/Developer/Xcode/DerivedData/Live-cblwxzmbsdpraeebpregeuhikwzh/Build/Products/Debug/LivePython.framework/Resources/python3.4/lib/python3.4/threading.py'>
Traceback (most recent call last):
  File "/Users/blitz6/Library/Developer/Xcode/DerivedData/Live-cblwxzmbsdpraeebpregeuhikwzh/Build/Products/Debug/LivePython.framework/Resources/python3.4/lib/python3.4/threading.py", line 1296, in _shutdown
    _main_thread._delete()
  File "/Users/blitz6/Library/Developer/Xcode/DerivedData/Live-cblwxzmbsdpraeebpregeuhikwzh/Build/Products/Debug/LivePython.framework/Resources/python3.4/lib/python3.4/threading.py", line 1019, in _delete
    del _active[get_ident()]
KeyError: 140735266947840

I have tried to deal with this a few different ways including, using PyGILState_Ensure() and PyGILState_Release(myState); in beginTask:
- (void)beginTask:(nonnull void (^)(void))task completion:(nullable void (^)(void))completion
{

    dispatch_async(self.pythonQueue, ^{

        PyGILState_STATE state = PyGILState_Ensure();

        task();

        PyGILState_Release(state);

        if (completion){
            dispatch_async(dispatch_get_main_queue(), ^{
                completion();
            });
        }
    });
}

But that will cause this error in the finalize method above:
Exception ignored in: <module 'threading' from '/Users/blitz6/Library/Developer/Xcode/DerivedData/Live-cblwxzmbsdpraeebpregeuhikwzh/Build/Products/Debug/LivePython.framework/Resources/python3.4/lib/python3.4/threading.py'>
Traceback (most recent call last):
  File "/Users/blitz6/Library/Developer/Xcode/DerivedData/Live-cblwxzmbsdpraeebpregeuhikwzh/Build/Products/Debug/LivePython.framework/Resources/python3.4/lib/python3.4/threading.py", line 1289, in _shutdown
    assert tlock.locked()
AssertionError:

So I'm pretty much stuck with: How do I Py_Finalize without getting some kind of error. Clearly I'm not understanding something. I can also confirm, via xcode when I hit my breakpoints, that my dispatch_async block is being run from another thread that is not the main thread.
Update
Tinkering a bit, I discovered that, this:
PyObject* module = PyImport_ImportModule("requests");

while I am on another thread, will cause this error when I Py_Finalize
Exception ignored in: <module 'threading' from '/Users/blitz6/Library/Developer/Xcode/DerivedData/Live-cblwxzmbsdpraeebpregeuhikwzh/Build/Products/Debug/LivePython.framework/Resources/python3.4/lib/python3.4/threading.py'>
Traceback (most recent call last):
  File "/Users/blitz6/Library/Developer/Xcode/DerivedData/Live-cblwxzmbsdpraeebpregeuhikwzh/Build/Products/Debug/LivePython.framework/Resources/python3.4/lib/python3.4/threading.py", line 1296, in _shutdown
    _main_thread._delete()
  File "/Users/blitz6/Library/Developer/Xcode/DerivedData/Live-cblwxzmbsdpraeebpregeuhikwzh/Build/Products/Debug/LivePython.framework/Resources/python3.4/lib/python3.4/threading.py", line 1019, in _delete
    del _active[get_ident()]
KeyError: 140735266947840

If I import:
PyObject* module = PyImport_ImportModule("os");
OR
PyObject* module = PyImport_ImportModule("json");

everything runs fine as examples. When I start importing my own modules, is where I run into the problems.
Inside Py_Finalize, wait_for_thread_shutdown(); is where I run into this issue. I guess, according to the comments, it's related to:

/* Wait until threading._shutdown completes, provided
     the threading module was imported in the first place.
     The shutdown routine will wait until all non-daemon
     "threading" threads have completed. */

Specifically in wait_for_thread_shutdown:
PyThreadState *tstate = PyThreadState_GET();
PyObject *threading = PyMapping_GetItemString(tstate->interp->modules,
                                              "threading");
if (threading == NULL) {
    /* threading not imported */
    PyErr_Clear();
    return;
}

tstate comes back NULL but threading is not NULL which skips the the PyErr_Clear() code path and executes:
result = _PyObject_CallMethodId(threading, &PyId__shutdown, "");
if (result == NULL) {
    PyErr_WriteUnraisable(threading);
}
else {
    Py_DECREF(result);
}
Py_DECREF(threading);

If I just:
PyObject* module = PyImport_ImportModule("json");

Then, PyErr_WriteUnraisable(threading); is executed in wait_for_thread_shutdown
result = _PyObject_CallMethodId(threading, &PyId__shutdown, "");
if (result == NULL) {
    PyErr_WriteUnraisable(threading);
}

A: As mentioned previously, I was thinking about my code and I was thinking about the embedded Python Interpreter incorrectly. It had nothing to do with GCD and everything to do with my misunderstanding of some facets of embedded Python. I may still have misunderstandings, but the logic below matches my expectations of what I thought it should be doing, and my error is gone.
What I was attempting to do was run one-off tasks, not keep anything around. Thinking I needed threading here is what tripped me up.
What I was doing, was acquiring the GIL and then importing some python code that used the threading module. When you do that, the interpreter registers that you have brought in the threading module, as when you Py_Finalize it jumps though some hoops to ensure all of the child threads you that may or may not be present are shut down. I was effectively pulling the rug out from under it, which was causing my error.  Instead, the work I needed done was more conducive to Py_NewInterpreter. It runs the exact same threading shutdown procedure as Py_Finalize when you call Py_EndInterpreter but is isolated to itself.
So my final GCD one-and-done code looks as follows:
Initialization
- (void)initialize
{
    Py_Initialize();
    PyEval_InitThreads();

    [self updateSysPath];

    // Release the GIL
    self.threadState = PyEval_SaveThread();
    self.running = YES;

}

Task Execution
- (void)beginTask:(nonnull void (^)(Runtime * __nonnull))task completion:(nullable void (^)(Runtime * __nonnull))completion
{
    dispatch_async(self.pythonQueue, ^{

        PyInterpreterState * mainInterpreterState = self.threadState->interp;
        PyThreadState * taskState = PyThreadState_New(mainInterpreterState);

        // Acquire the GIL
        PyEval_AcquireThread(taskState);

        PyThreadState* tstate = Py_NewInterpreter();
        [self updateSysPath];

        task(self);

        // when Py_EndInterpreter is called, the current
        // thread state is set to NULL,
        // so we need to put ourselves back on
        // the taskState, and release the GIL
        Py_EndInterpreter(tstate);
        PyThreadState_Swap(taskState);

        // release the GIL
        PyEval_ReleaseThread(taskState);

        // cleanup
        PyThreadState_Clear(taskState);
        PyThreadState_Delete(taskState);

        if (completion){
            dispatch_async(dispatch_get_main_queue(), ^{
                completion(self);
            });
        }
    });
}

Finalization
- (void)finalize
{
    // acquire the GIL
    PyEval_RestoreThread(self.threadState);
    Py_Finalize();
    self.running = NO;
}

A: You said:

But none of those specifically deal with Grand Central Dispatch. I
  don't know if it matters or not as it's likely all just threads under
  the hood

Yes, ultimately, GCD blocks must execute on one OS thread or another, but GCD queues are not an abstraction on top of a single thread, and (with the exception of the main queue) make no promises about thread affinity at all. In other words, there's no way to guarantee that submitted blocks are executed on the same thread or any specific thread, nor is it wise to make any assumptions about the thread they end up executing on.
The safest, most straightforward way to go about this will likely be for you to explicitly manage the OS threads (either via NSThread or the pthreads API) that you plan to use for running Python code. The thread management inside GCD is, at the end of the day, a private implementation detail, meaning that even if you manage to get something that works now, Apple could make some subtle change to the thread management in GCD and break your app in the future.
In sum, GCD queues probably aren't the right tool for this job.
I recently posted another answer describing a way to manage a private thread for wrapping a third-party library that demanded thread affinity. It may be of some interest to you.


text:
Q: Sperner's Lemma in infinite-dimensional spaces? I've been looking at Sperner's Lemma for a little while and have managed to come to grips with some of the combinatorial proofs. Some descriptions I have encountered claim to prove it for "simplices" and some for "$n$-simplices", and there didn't seem to be any particularly large differences between the proofs. On the other hand, it seems nontrivial to formulate Sperner's Lemma in infinite dimensions.
It doesn't seem like there should be anything preventing us from defining simplices in arbitrary real infinite-dimensional topological vector spaces (RIDTVSs). But having little experience with them, I don't know how Sperner's Lemma would work there. In particular I know that closed balls in RIDTVSs are not compact, which could reasonably be hiding in the background of the combinatorial proofs. It certainly plays a role in the equivalent Brouwer's Fixed Point Theorem.
Does anyone know of a formulation of Sperner's Lemma in RIDTVSs, or at least have a reference to an analytic proof in finite dimensions that might be illuminating?

A: We can just consider $\mathbb R^\infty $, the set of all infinite sequences of real numbers with almost all entries equal to $0$. Then the infinite dimensional simplex is most naturally defined to be the closure of the convex hall of all the standard basis vectors (i.e., all zeros with only one $1$). Things basically work. See this artilce.

A: Although I haven't read the paper in any detail, I believe that Theorem 6.1 from this article like a theorem I was hoping for:

Let $n\in\mathbb{N}$ and let $\phi:[n]^\omega\to\{0,1\}^\omega$. Then there is $\sigma\in [n]^\omega$ such that $\phi(K_\sigma)$ is infinite.

It is formulated on a cube instead of a simplex, and appears to be only able to handle countable dimensions, but it's a start.


text:
Q: NSPageController bad transition I have a problem with page controller transition, it looks like this

Here is the code of my page controller
class PageController: NSPageController, NSPageControllerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()

        delegate = self
        arrangedObjects = ["FirstViewController", "SecondViewController"]
    }

    func pageController(_ pageController: NSPageController, identifierFor object: Any) -> String {
        return object as! String
    }

    @IBAction func forward(_ sender: Any) {
        self.navigateForward(self)
    }

    @IBAction func back(_ sender: Any) {
        navigateBack(self)
    }

    func pageController(_ pageController: NSPageController, viewControllerForIdentifier identifier: String) -> NSViewController {
        return storyboard!.instantiateController(withIdentifier: identifier) as! NSViewController
    }

    func pageControllerDidEndLiveTransition(_ pageController: NSPageController) {
        pageController.completeTransition()
    }
}

Why does it look like this and what can I do to achieve normal transition?

A: When you push a new page the original page is still in the view hierarchy because it has to be shown while the new page animates into view. Once the new view completely covers the original view it is removed. Because you have a transparent background on the second view, you can still see the buttons underneath.
When you push the new page off the screen, the view underneath is added to the hierarchy so you can see it as the top view animates away. Because the top view is transparent, the buttons appear before the view animates.
If you make the view opaque instead of transparent, the view underneath cannot be seen through the transparent background, so it works as you expect.


text:
Q: How to Create Widget when press button on application (Android) I must make something like that.
I run my application and press button "Create widget" and the widget is created on Home screen.
I don't know how to do it, Just i know how to take widget to home screen when i choose my widget in widgets menu and write text what i want in this widget
And I know how to run ConfigureActivity on my application but when i writte some text and press add "widget" it don't create. I think i don't have any id's to create widget but how to get that? Random or something.
I used in Android Studio New > Widget > App Widget.

A:
I run my application and press button "Create widget" and the widget is created on Home screen.

This is not possible. The only app that can add an app widget to the home screen is the home screen itself.


text:
Q: Limit of ratio of inverse trigonometric functions The question asks to prove/disprove continuity of the following function:

My approach:
1) Take y = mx.
2) Put x + 2mx = (1+2m) x = kx.
3) Now continue as if k is a constant and how that the final limit depends on k.

A: $$f(x,y)=\frac{\frac{\sin^{-1}(x+2y)}{x+2y}}{\frac{\tan^{-1} (2x+4y)}{2x+4y}} \frac{x+2y}{2x+4y} \implies \lim_{x,y \rightarrow 0} f(x,y)= \lim_{z \rightarrow 0} \frac{\frac{\sin^{-1}z}{z}}{\frac{\tan^{-1}{z}}{z}}  \lim_{x,y \rightarrow 0} \frac{x+2y}{2x+4y} =\frac{1}{2}.$$
Here we have used $$\lim_{z \rightarrow 0} \frac{\sin^{-1}z}{z}=1 = \lim_{z \rightarrow 0} \frac{\tan^{-1}z}{z}.$$


text:
Q: Will Apple reject my app if i use VOIP Capability in chat app(WhatsApp like application) We are developing a chat application like WhatsApp. It's XMPP based application, the XMPP complaint servers are follows push model for sending the messages, presence..etc.
So when user is offline the messages goes into offline stack and pushes again once user comes into online.
We want know that when app is killed , Can we use voip capabilities to run in background? or we really need go push notification model?
Please help Me .

A: You cannot add VOIP for chat application but there are other background task execution options by which you can achieve this.
Modify your server side piece send notifications to the app at reasonable time intervals if user if not online and your app will get opportunity to execute in background when these notifications are delivered.

A: Yes Apple will reject your app if you use VOIP Capability in chat app(WhatsApp like application)
if are you trying to use in background with help of VOIP but you primary not implemented VOIP functionality then apple will reject your app i tried before this for my streaming music player.