text:
Q: How to execute http requests in a Spring application without using WebFlux/RestTemplate (webmvc)? In my Spring application, I need to perform GET and rarely POST requests. The application is standalone (not a WEB application). It will not process any incoming requests. It lacks controllers/routers, etc. I'm trying to find a "convenient" solution for making requests. I made a choice in the direction of WebFlux, but realized that in this case, this is the same thing that I connected to my webmvc application and it became a WEB application. I would like to avoid connecting so much of a large component, most of which will not be used. How would it be in this situation? Abandon WebFlux in the direction of java.net.http.HttpClient (Java 11) or another analog, or a bare HttpConnection?
Java 18, SpringBoot 2.7.5-SNAPSHOT
dependencies {
    // implementation 'org.springframework.boot:spring-boot-starter-webflux' ?
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    // testImplementation 'io.projectreactor:reactor-test' ?
}

A: You can use java.net.http.HttpClient of Java 11 as you already mentioned. Using HttpConnection is an option but I wouldn't recommend it. In addition you can just use any 3d party Http client. Here are 2 most popular ones:

*

*Apache Http Client

*OK Http client
Besides those - and this is shameless self-promotion - I wrote my own Http client. I don't mean to compete with fullness of features with any of the above clients, but my client is very simple in use and does support basic functionality which in most cases is enough. It is part of MgntUtils Open source library written and maintained by me. Here is a Javadoc for HttpClient class. The library you can get as maven artifacts on Maven central here or on Github here with source code and Javadoc.


text:
Q: Test Method for callout in Future method I have a trigger on Account. On Account insert, I am sending a callout through future method. I am trying to write a test class for this but I am getting either of these two errors - 1) You have uncommitted work pending. Please commit or rollback before calling out and 2)  Methods defined as TestMethod do not support Web service callouts, test skipped.
I do not want to use Test.isRunningTest(), I want to use mock callout. Its just that I am not getting when to insert account and when to use startTest() and stopTest() and when to send mock callout. I searched for this, but do not get the code example. Help with a code example is highly appreciated.
Thanks in Advance.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Place element in LinearLayout with minimal space between them I have a vertical LinearLayout with two TextView, the default space between them is to much big for me, I try to minimize it to almost 0 without success.
 <LinearLayout
         android:id="@+id/main"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:gravity="center"
         android:orientation="vertical"
          >

         <TextView
             android:id="@+id/text1"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:gravity="center"/>

         <TextView
             android:id="@+id/text2"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:gravity="center"/>

     </LinearLayout>

I tried to set android:padding,android:layout_margin on the LinearLayout but it doesnt work. I also tried to give to each TextEdit padding but it didnt halped aslo.
How can I place them near to each other?

A: may be you can use android:layout_marginTop="-xxdp" for second textView
or layout_marginBottom="-xxdp" for first textView
<LinearLayout
     android:id="@+id/main"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:gravity="center"
     android:orientation="vertical"
      >

     <TextView
         android:id="@+id/text1"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:gravity="center"/>

     <TextView
         android:layout_marginTop="-xxdp"
         android:id="@+id/text2"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:gravity="center"/>

 </LinearLayout>

A: Set a negative layout_marginTop value to your text2 can minimize the space between the text showing, your layout goes like this:
 <LinearLayout
         android:id="@+id/main"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:gravity="center"
         android:orientation="vertical"
          >

         <TextView
             android:id="@+id/text1"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:gravity="center"/>

         <TextView
             android:id="@+id/text2"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginTop="-7dp"
             android:gravity="center"/>

     </LinearLayout>


text:
Q: Proof Verification of a Limit in Real Analysis Is this following proof correct?
The limit
\begin{align*}
\lim_{n\to\infty}\frac{t^{n+1}}{(n+1)!}
\end{align*}
tends to zero if for every $\epsilon>0$, there exists $N_\epsilon$ such that
\begin{align*}
n\geq N_\epsilon\implies \left|\frac{t^{n+1}}{(n+1)!}\right|<\epsilon
\end{align*}
For any $t\in\mathbb{R}$, there exists $N\in\mathbb{N}$ such that $t<N$. Let $N$ be the least such natural number. Then
\begin{align*}
\frac{t^{N+k}}{(N+k)!}&=\frac{t\cdot t\cdots t\cdot t\cdots t\cdot t}{1\cdot 2\cdots (N-1)N\cdots(N+k-1)(N+k)}\\
&<\frac{t\cdot t\cdots t \cdot t\cdots t\cdot t}{1\cdot 1\cdots 1\cdot N\cdots N\cdot N}\\
&=t^N\left(\frac{t}{N}\right)^{k}
\end{align*}
Let $a=\frac{t}{N}$. Since $t<N$, $a=\frac{t}{N}<1$. If
\begin{align*}
\frac{t^{N+k}}{(N+k)!}<t^N\left(\frac{t}{N}\right)^{k}=t^Na^{k}<\epsilon
\end{align*}
then dividing both sides by $t^N$,
\begin{align*}
a^{k}<\frac{\epsilon}{t^N}
\end{align*}
Taking $\log_a$ of both sides reverses the inequality because it is a decreasing function. Hence
\begin{align*}
k>\log_{a}\left(\frac{\epsilon}{t^N}\right).
\end{align*}
Any value for $k$ greater than this expression will ensure the limit remains within the desired bounds. Therefore, take $N_\epsilon=N+k$. Since the choice of $t$ was arbitrary, we may conclude that the limit converges throughout the entirety of $\mathbb{R}$.

A: The proof looks good (actually very good) to me.  The only improvement I can suggest is to turn it around a little, so that no cleverness is invoked.
Proof: Given $t>0$ and $\epsilon > 0$ arbitrary, put:
$$\begin{align*}
  N &= \lfloor t \rfloor + 1  & (\text{$N$ is the smallest natural number strictly greater than 1})
\\
  a &= \tfrac{t}{N}           & (\text{so $a < 1$})
\\
  k &= \left\lceil \log_{a}\left( \frac{\epsilon}{t^N} \right) \right\rceil
\\
  N_{\epsilon} &= N+k
\end{align*}$$
Then if $n > N_{\epsilon}$ we have
$$\begin{align*}
  \frac{t^{n+1}}{(n+1)!} &= \frac{t^{N+n-N+1}}{N!(N+1)(N+2)\dots(n+1)}
\\
  &<
  \frac{t^N}{1^N} \cdot \left( \frac{t}{N} \right)^{n+1-N}
\\
  &=
  t^N a^{n - N_{\epsilon} + N_{\epsilon} +1-N}
\\
  &<
  t^N a^{k+1} & (\text{via $N_{\epsilon} = N+k$, $n > N_{\epsilon}, a < 1$)}
\\
  &<
  t^N \frac{\epsilon}{t^N}  & (\text{via construction of $k$})
\\
  &=
  \epsilon
\end{align*}$$
as required.
Remark: Your calculations did all the hard work of finding $N_{\epsilon}$.  All this answer suggests is to summarize it into easier(?) steps from 'if $n > N_{\epsilon}$' to 'then $(\ldots) < \epsilon$'.


text:
Q: How to solve race condition in memory access on OpenMP? I'm working on a project where i need to load and process gigabytes of sequences from a file. Since i'm dealing with a lot of data, i can't save it on RAM. So i'm using one thread to load data from this file and save in a queue and one thread to, once detect that there is something on queue, unload it to some temporary file.
I'm having some trouble doing this. Looks like there is a racing condition. Sometimes it works, sometimes it return a segmentation fault.
I wrote a minimal code example with the bug.
This is my queue code:
//####################
// STRUCTS
//####################
struct queue_item{
    char *seq;
    struct queue_item *prox;//Next element
};
typedef struct queue_item QueueItem;

struct Queue{
    QueueItem *first;//First element on queue
    QueueItem *end;//Last element on queue
    int size;//Queue size
};
typedef struct Queue Queue;

//####################

Queue* create_queue(){
    Queue *f;
    f = (Queue*)malloc(sizeof(Queue));
    f->size = 0;
    return f;
}

QueueItem* new_queue_item(char *seq){
    QueueItem* new;
    int n;

    n = strlen(seq);
    new = (QueueItem*)malloc(sizeof(QueueItem));
    new->seq = (char*)malloc((n+1)*sizeof(char));

    strcpy(new->seq,seq);

    return new;
}

void enqueue(Queue *f,char *seq){
    QueueItem* new;
    new = new_queue_item(seq);

    switch(f->size){
        case 0:
            f->first = new;
        break;
        case 1:
            f->end = new;
            f->first->prox = f->end;
        break;
        default:
            f->end->prox = new;
            f->end = new;
        break;
    }

    f->size = f->size + 1;
    return;
}

char* dequeue(Queue *f){
    QueueItem *hold;
    char *seq;

    if(f->size > 0){
        hold = f->first;
        seq = f->first->seq;
        f->first = f->first->prox;
        free(hold);
        f->size--;
    }

    return seq;
}

int queue_size(Queue *f){
    return f->size;
}

void seq_to_file(char *seq,FILE *f){
    if(seq != NULL){
        fputs(seq,f);
        free(seq);
    }
    return;
}

This is my main code:
Queue *f;
int i;
int end_flag;
char *seq;

f = create_queue();
end_flag = 0;

#pragma omp parallel shared(f) shared(end_flag)
{
    #pragma omp sections
    {
        #pragma omp section
        {
            FILE *tmp;
            tmp = fopen("tmp","w");
            while(!end_flag){
                if(queue_size(f) > 0)
                    seq_to_file(dequeue(f),tmp);
            }

            fclose(tmp);
        }
        #pragma omp section
        {
            seq = (char*)malloc(21*sizeof(char));
            strcpy(seq,"ABCDEFGHIJKLMNOPQRST");

            for(i=0;i < NSEQS;i++)
                enqueue(f,seq);
            end_flag = 1;
        }
    }
}

Some errors that i detected:
1 - malloc error on new_queue_item() line:
        new->seq = (char*)malloc((n+1)*sizeof(char));
* glibc detected * /home/pedro/Dropbox/Programação/C/Queue/fila_teste: double free or corruption (out): 0x00000000006f3bd0 *
 glibc detected  /home/pedro/Dropbox/Programação/C/Queue/fila_teste: malloc(): memory corruption (fast): 0x00000000006f3b70 *
2 - malloc error on new_queu_item() line:
        new = (QueueItem*)malloc(sizeof(QueueItem));
3 - free error on seq_to_file() line:
            free(seq);
* glibc detected * /home/pedro/Dropbox/Programação/C/Queue/fila_teste: double free or corruption (out): 0x0000000000cdd3f0 *
Checking with gdb i have:
(gdb) print *f
$16 = {first = 0x0, end = 0x611180, size = 426}
This third error make me think that this really is a race condition situation.
I tried to simulate a semaphore with "end_flag", but don't think it is sufficient. Also,don't think "critical" and "atomic" clauses will help here since they only protect access on code areas, not memory.
Any idea how to solve this problem?

A: If you are not planning to reuse this code, you may use the following:
#pragma omp critical(queueLock)
This directive will act as a "named" mutex, "queueLock", in the above example. In you case, you must use it in enqueue, dequeue and queue_size functions, since they all use shared data.
If you plan to reuse this code, you should learn about the OpenMP locks (omp_lock_t).


text:
Q: Distribution of transformed lognormal random variable I was wondering:
if $X \tilde{} N(0,1)$ then
$P=\exp(x)$ is lognormally distributed.
However, what is the distribution of
$P=c\exp(x)-d$
Will it still be lognormally distributed?
Thanks for your help!

A: You can try to use the transformation formula, i.e., for $b>0$,
$Y = aX+b$ where $X \sim \ln \mathcal{N}(0,1)$, thus $g^{-1}(Y)=\frac{1}{a}(Y-b)$, hence
$$
f_Y(y) = f_X(g^{-1}(Y))|\partial/\partial yg^{-1}(Y)|=f_X(\frac{1}{a}(Y-b))|1/a|.
$$
I.e., $Y$ is shifted log-normal r.v., with $\ln \mathcal{N}(\ln b, 1)$ and $y>b$.


text:
Q: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' I need help for understand the error on my application, help me !
Error console
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'personController' defined in file [D:\IntelliJ\projetcs\personapi\target\classes\one\digitalinnovation\personapi\controller\PersonController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' defined in file [D:\IntelliJ\projetcs\personapi\target\classes\one\digitalinnovation\personapi\service\PersonService.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [one.digitalinnovation.personapi.service.PersonService]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError

A: As the exception message said:
[one.digitalinnovation.personapi.service.PersonService]: Constructor threw exception

PersonService constructor has thrown an exception. Double check that constructor, debug it or surround the constructor code with a try...catch to log the root cause of the exception


text:
Q: AngularJS document.write() won't work in partial I want to include the current year in the copy-write notice in the footer of AngularJS app I'm building with:
<script type="text/javascript">document.write(new Date().getFullYear())</script>

The problem is when I try to add it in a partial that has been added to document with ng-include it won't work:
<footer ng-include="'app/static/partials/footer.html'" class="main"></footer>

It works when I add it directly to index.html.  What is the best way to achieve this in AngularJS?
Do I need to turn the footer into a directive and add a controller for this?

A: You need to set a scope variable in your footer's controller. e.g. $scope.year = new Date().getFullYear(); then you can use it in your HTML like this: {{year}}.
It need not be a directive. You can also use ng-controller="footerCtrl" etc. as an HTML property for your footer to point to the controller you want to use for your footer.


text:
Q: PHPExcel - why is there no cell->setStyle() method? I noticed that the developer of PHPExcel reads this forum, so I'm formatting my problem as a direct question to him.
I'm trying to take the full styling of a cell from a template excel document and copy it to a new document.
As far as I can see, there is a Cell->getStyle() method, which gives back a style object. But there is no way to apply this style object to another cell.
To apply a style, one has to use a different function, Cell->getStyle('A1')->applyFromArray($styleArray) . This function take a differently formatting input - a style array. And there is not way to convert from a style object to a style array. Why is that? Why isn't here a method cell->setStyle()?
I also noticed that there is yet another method that might help me, Worksheet->duplicateStyle():
$targetWorksheet->duplicateStyle(
    $sourceWorksheet->getStyle($sourceCellCoordinate),
    $targetCellCoordinate
);

But, when using this method to copy TemplateA1->TargetA1, then TemplateB2->TargetB2, the moment that I copy the second cell, the first cell (TargetA1) gets re-styled to also have the second style (TargetB2). So that does not work neither.
I've invested about an hour looking into this, and my next step would probably be to implement a style object -> style array converter.
Any help would be appreciated.
Thanks!

A: This was already answered in this external discussion:
https://phpexcel.codeplex.com/discussions/286662
Worksheet->duplicateStyle() does indeed not work across files. But there is a workaround: temporarily add the source sheet into the target document as a new sheet using addExternalSheet(), copy formattings over, then remove the temporary sheet again.
I still did not found any answer why there is no cell->setStyle() method, though.


text:
Q: Formatting substrings in SpreadsheetML cells using Xelem When looking for a Java library which can produce (and read) SpreadsheetML 2003 files, I came across the Xelem library.
It almost perfectly fits all my needs; however, it does not seem to provide the possibility to format parts of strings in cells individually.
I.e. I need to be able to write some words in cells in bold text while others are not bold, which is why I cannot use styles (as they format the whole cell uniformly):
"non-bold-text and bold-text"
When creating and saving files containing such cells with Excel, Excel uses bold tags of the HTML namespace like this:
...
<Cell><ss:Data ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">non-bold-text and <B>bold-text</B></ss:Data></Cell>
...

However, I cannot find any possibility to get Xelem to generate such code. It does not seem to offer the ability to specify additional namespaces for a cell.
Am I missing something here, and if not, is there a (simple) workaround for this?
Hints for alternative libraries are also appreciated, but the file format needs to be SpreadsheetML 2003.


text:
Q: Convert string to Datetime c# I get two string.
string a and string b.
string a="\n 17 Oct \n \n 2013";

string b=//I get UTC time in string format

I need to convert this to "2013-10-17 00-00-00.000" in datetime format. How do I achive this?

A: I think the first example makes no problem when you remove the /n from the string
string a = "\n 17 Oct \n \n 2013";
string b = a.Replace("\n", "");

DateTime D = DateTime.Parse(b);

I am not sure if I used the correct string for the second one. This one comes from the world clock website http://www.worldtimeserver.com/current_time_in_UTC.aspx
string utc = " 4:37 AM \n Thursday, October 17, 2013";
string b1 = utc.Replace("\n", "");

DateTime DateUtc = DateTime.Parse(b1);

Both seem to get parsed as expected.

A: The cleanest way is probably to use DateTime.TryParse() with a custom IFormatProvider, or you can use DateTime.TryParseExact().
http://msdn.microsoft.com/en-us/library/9h21f14e.aspx


text:
Q: Meteor + React: cosmos:browserify error "Converting circular structure to JSON" I'm building a web application using Meteor + React and the project suddenly no longer runs and gives the incomprehensible error seen below.
A friend cloned the same repository and it run perfectly on his computer. I suspect that it has to do with some sort of incompatibility between specific meteor packages and npm packages but have no idea of how to go about fixing it. I've tried deleting and reinstalling meteor, uninstalling and reinstalling cosmos:browserify, and even downloading the entire meteor project anew. No success.
Note that "/Users/noahgrumman/.meteor/packages/meteor-tool/..." is not the project directory but instead the directory where meteor packages are downloaded.
Any ideas about what could be going wrong would be greatly appreciated.
=> Started proxy.
=> Started MongoDB.
=> Errors prevented startup:

   While processing files with cosmos:browserify (for target web.browser):
   native: Converting circular structure to JSON
   at Object.stringify (native)
   at Object.stringify
   (/Users/noahgrumman/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/core-js/modules/es6.symbol.js:127:21)
   at Object.stringify
   (/Users/noahgrumman/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/isopackets/ddp/npm/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-js/modules/es6.symbol.js:127:21)
   at Object.stringify
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-js/modules/es6.symbol.js:127:21)
   at Object.stringify
   (/Users/noahgrumman/.meteor/packages/templating/.1.1.5.7x2gis++os+web.browser+web.cordova/plugin.compileTemplatesBatch.os/npm/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-js/modules/es6.symbol.js:127:21)
   at Object.stringify
   (/Users/noahgrumman/.meteor/packages/coffeescript/.1.0.11.iqzsj2++os+web.browser+web.cordova/plugin.compileCoffeescript.os/npm/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-js/modules/es6.symbol.js:127:21)
   at Object.stringify
   (/Users/noahgrumman/.meteor/packages/less/.2.5.1.196vlrt++os+web.browser+web.cordova/plugin.compileLessBatch.os/npm/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-js/modules/es6.symbol.js:127:21)
   at BrowserifyPlugin.buildErrorMessage (<runJavaScript-61>:177:70)
   at BrowserifyPlugin.compileOneFile (<runJavaScript-61>:142:42)
   at <runJavaScript-59>:555:47
   at <runJavaScript-59>:585:11
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:182:20
   at replenish
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:317:21)
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:324:29
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:44:16
   at <runJavaScript-59>:591:9
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:182:20
   at replenish
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:317:21)
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:324:29
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:44:16
   at <runJavaScript-59>:591:9
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:182:20
   at replenish
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:317:21)
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:324:29
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:44:16
   at <runJavaScript-59>:591:9
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:182:20
   at replenish
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:317:21)
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:324:29
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:44:16
   at <runJavaScript-59>:591:9
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:182:20
   at replenish
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:317:21)
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:328:15
   at Object.async.forEachLimit.async.eachLimit
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:221:35)
   at BrowserifyPlugin.processFilesForTarget (<runJavaScript-59>:530:11)

   While processing files with cosmos:browserify (for target os.osx.x86_64):
   native: Converting circular structure to JSON
   at Object.stringify (native)
   at Object.stringify
   (/Users/noahgrumman/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/core-js/modules/es6.symbol.js:127:21)
   at Object.stringify
   (/Users/noahgrumman/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/isopackets/ddp/npm/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-js/modules/es6.symbol.js:127:21)
   at Object.stringify
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-js/modules/es6.symbol.js:127:21)
   at Object.stringify
   (/Users/noahgrumman/.meteor/packages/templating/.1.1.5.7x2gis++os+web.browser+web.cordova/plugin.compileTemplatesBatch.os/npm/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-js/modules/es6.symbol.js:127:21)
   at Object.stringify
   (/Users/noahgrumman/.meteor/packages/coffeescript/.1.0.11.iqzsj2++os+web.browser+web.cordova/plugin.compileCoffeescript.os/npm/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-js/modules/es6.symbol.js:127:21)
   at Object.stringify
   (/Users/noahgrumman/.meteor/packages/less/.2.5.1.196vlrt++os+web.browser+web.cordova/plugin.compileLessBatch.os/npm/ecmascript-runtime/node_modules/meteor-ecmascript-runtime/node_modules/core-js/modules/es6.symbol.js:127:21)
   at BrowserifyPlugin.buildErrorMessage (<runJavaScript-61>:177:70)
   at BrowserifyPlugin.compileOneFile (<runJavaScript-61>:142:42)
   at <runJavaScript-59>:555:47
   at <runJavaScript-59>:585:11
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:182:20
   at replenish
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:317:21)
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:324:29
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:44:16
   at <runJavaScript-59>:591:9
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:182:20
   at replenish
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:317:21)
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:324:29
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:44:16
   at <runJavaScript-59>:591:9
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:182:20
   at replenish
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:317:21)
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:324:29
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:44:16
   at <runJavaScript-59>:591:9
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:182:20
   at replenish
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:317:21)
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:324:29
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:44:16
   at <runJavaScript-59>:591:9
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:182:20
   at replenish
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:317:21)
   at
   /Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:328:15
   at Object.async.forEachLimit.async.eachLimit
   (/Users/noahgrumman/.meteor/packages/cosmos_browserify/.0.9.3.pipsf++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/caching-compiler/node_modules/async/lib/async.js:221:35)
   at BrowserifyPlugin.processFilesForTarget (<runJavaScript-59>:530:11)

A: The cosmos:browserify package was updated yesterday and that seems to fix it.  Try updating it again.
This happened to me a few times too.  I used to be able to fix it by going through the update process for meteorhacks:npm of deleting the packages/npm-container folder, removing npm-container, and starting the app.  Then today that didn't work anymore, so I updated cosmos:browserify and that worked.


text:
Q: How do I read a zip(which in fact is in bytes form) without creating a temporary copy? I am uploading a zip(which further contains pdf files to be read) as multipart/form-data .
I am handling the upload as below:
file = request.FILES["zipfile"].read() #gives a byte object
bytes_io = io.BytesIO(file) # gives a IO stream object

What I intend to do is to read the pdf files inside the zip, but I am stuck as to how to proceed from here. I am confused, what do I do with either the bytes object from the request or the IO object after conversion.

A: Found the answer just after asking the question.
Simply use the zipfile package as below:
from zipfile import ZipFile
file = request.FILES["zipfile"].read()
bytes_io = io.BytesIO(file)
zipfile = ZipFile(bytes_io, 'r')

And then refer the docs for further operations on the zip file.
Hope it helps!


text:
Q: How do I move files between computers while preserving file dates? I have a lot of files that I often search for based on creation date.
When I copy files from my old computer to the new one, all of my creation dates are set to the current time (i.e. I lose the original creation date).
How can I copy files between the two system that keeps the original date attributes (creation/modified/accessed)?
I have looked at 7-zip, but it does not appear to keep the creation date attribute, which is the one most needed.

A: The robocopy command preserves all three dates (created, modified, accessed).
The syntax is:
       Usage :: ROBOCOPY source destination [file [file]...] [options]

      source :: Source Directory (drive:\path or \\server\share\path).
 destination :: Destination Dir  (drive:\path or \\server\share\path).
        file :: File(s) to copy  (names/wildcards: default is "*.*").

For the full syntax, execute robocopy /?.
robocopy comes with all recent versions of Windows. However, if you don't feel comfortable using the command line, you can download the Utility Spotlight Robocopy GUI from Microsoft TechNet.

A: While robocopy preserves the created, modified, and accessed dates, there are a few problems that still remain:

*

*This is only done for files and not for folders (the main one, see poing #2, and the subfolders, so basically, all folders).

*There is no way to copy the original / head / starting folder, other than by creating it first and then copying the files and subfolders in it.  Therefore, one is unable to preserve the dates for the starting folder. I do believe I remember reading something about excluding everything else from being copied from the level / directory except the folder that one wants to copy, but though it should work, doesn't seem practical.

A: Using 7zip 9.20 or higher with tc=on (use -mtc=on on the command-line) in the parameters field helps preserve the creation time.  Admittedly I actually haven't tried to restore yet to see if it preserves it.  However, you can check that the creation time is preserved when you open the archive to inspect the contents.
If you want to be 100% sure, I offer that xxcopy works perfectly (think robocopy on steroids).  It preserves all the timestamps, including access/modified/creation time, for files and folders.  Best of all it's free for personal use.  The necessary switch is: /tc


text:
Q: Entity framework - referencing one of composite primary key columns as a foreign key In table A I've got a composite of 3 columns as a primary key. I want to have only one of these three columns as a foreign key in table B, just to make sure that the value that I insert into table B's column exists in table A.
Currently from what I've read it looks like in Entity Framework I have to add all three columns of composite PK, which is not really what I need. The latest answer that I've found was of 2015, maybe since then something changed?
I know that I can add a manual check on each insert/update call, but I don't want to do that, maybe there is more elegant way.


text:
Q: Multiple php email issue For my project I had to create a function that sends two email. One to the customer and the other to the a seller. Both emails will have different contents.
I wrote the two function using the standard PHP mail function as below.
            $to      = "xxxx@xxxx.com";
    $subject = 'xxxx';
    $message =  "hello"
    $headers  .= 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    mail($to, $subject, $message, $headers);

Now, While testing the system on my own company's web server both emails seems to be sent and received. However, when I migrated the same system into an external server. only one email gets sent. primarily, the first email in the stack.
While I suspect the issue has something to do with the later server configuration, I am wondering where should I go next to debug this issue.

A: There were a few things in your "posted" code that were missing.
A missing semi-colon at the end of $message =  "hello" (unless that was a typo/paste error?) and a dot in the first $headers
Also, not having a From: header attribute will surely result having the Email sent to and regarded as SPAM.
Having fixed those issues and added extra header information, the following code worked and did not end up in my SPAM, but the INBOX successfully.
<?php
$to      = "xxxx@xxxx.com";
$email = "email@example.com";
$subject = 'xxxx';
$message =  "hello";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$headers .= "From: $email" . "\r\n" .
"Reply-To: $email" . "\r\n" .
"X-Mailer: PHP/" . phpversion();

mail($to, $subject, $message, $headers);

?>

Or with a success echo'ed message:
<?php
$to      = "xxxx@xxxx.com";
$email = "email@example.com";
$subject = 'xxxx';
$message =  "hello";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$headers .= "From: $email" . "\r\n" .
"Reply-To: $email" . "\r\n" .
"X-Mailer: PHP/" . phpversion();

if(mail($to, $subject, $message, $headers))
{
echo "Message sent.";
}

else{
echo "Something went wrong.";
}

?>

Visit the PHP.net website for more information on the mail() and header() functions.

*

*http://php.net/manual/en/function.mail.php


text:
Q: Extracting maximum value from chart axis I have a chart sheet with 2 axis, I need to extract the maximum value of the primary axis to set the secondary one accurately. I cant seem to get the function working that will simply read the primary axis max and place it in a cell, any ideas?

A: Welcome to the board.  Have a read of ASK and MCVE.
Recording a macro while manually changing the axis will give you:
Sub Macro4()
'
' Macro4 Macro
'

'
    ActiveSheet.ChartObjects("Chart 2").Activate
    ActiveChart.Axes(xlValue).Select
    ActiveChart.Axes(xlValue).MaximumScale = 60
    ActiveChart.Axes(xlValue, xlSecondary).Select
    ActiveChart.Axes(xlValue, xlSecondary).MaximumScale = 90
    Range("L2").Select
End Sub

The code shows that you need to reference the chart within the chart object within the sheet to get to the axis.
Sub Test()

    Sheet1.ChartObjects("Chart 2").Chart.Axes(xlValue, xlSecondary).MaximumScale = _
        Sheet1.ChartObjects("Chart 2").Chart.Axes(xlValue).MaximumScale

End Sub

Note - this code can be shorted using variables and a With...End With block.

A: This will return the max value of the left axis which is usually <> max value of original data
Public Function getAxisMaxScale(cht As Chart) As Single

Dim ax As Axis
Set ax = cht.Axes(xlValue)

getAxisMaxScale= ax.MaximumScale

End Function

To adjust the secondary axes you can use

Public sub adjustAxisForChartXYZ()

Dim cht As Chart
Set cht = ThisWorkbook.Sheets("XYZ")   'insert sheetname of your chart

adjustSecondaryAxis cht

End Sub

Public Sub adjustSecondaryAxis(cht As Chart)

Dim axPrimary As Axis, axSecondary As Axis
Set axPrimary = cht.Axes(xlValue)

Set axSecondary = cht.Axes(xlValue, xlSecondary)

With axSecondary
    .MajorUnit = axPrimary.MajorUnit
    .MaximumScale = axPrimary.MaximumScale
End With

End Sub

I adjust the MajorUnit as well ... to be aligned as well

A: This is how you get the min/max of the two series in a chart:
have chart selected and then run the following
Dim ser as SeriesCollection
' `ChartArea.Parent` = `Chart` object
Set ser = Selection.Parent.SeriesCollection()

Dim temp1() As Variant, temp2() As Variant
temp1 = ser(1).values
temp2 = ser(2).values

' Get the data limits
Dim a_1 As Double, a_2 As Double, b_1 As Double, b_2 As Double
a_1 = WorksheetFunction.Min(temp1): a_2 = WorksheetFunction.Min(temp2)
b_1 = WorksheetFunction.Max(temp1): b_2 = WorksheetFunction.Max(temp2)

This is part of a macro I developed to scale the secondary axis of chart such as the tickmarks fall on the grid of the first axis.
Before

Notice how on the secondary axis the grid for 10 through 60 is not on the gridlines shown. This makes it hard to read the chart.
After

Afterward, the grid spacing on the secondary axis is adjusted in order to match the primary axis. Also, the limits are adjusted to fill the area better.
Code
Here is the code I am using to do this.
Public Sub DualYAxisChart(ByRef ch As Chart)
    Dim x_axis_1 As Axis, x_axis_2 As Axis, n As Long
    Dim ser As SeriesCollection
    Set ser = ch.SeriesCollection()
    If ser.Count <> 2 Then
        MsgBox "Please select a chart with two series", vbOKOnly, "Dual y-axis Chart"
        Exit Sub
    End If

    If UBound(ser(1).values) <> UBound(ser(2).values) Then
        MsgBox "Both series must share the same number of points", vbOKOnly, "Dual y-axis Chart"
        Exit Sub
    End If
    n = UBound(ser(1).values)

    ser(1).AxisGroup = xlPrimary
    ser(2).AxisGroup = xlSecondary

    ' Enable Both Y-axes
    ch.SetElement msoElementPrimaryValueAxisShow
    ch.SetElement msoElementSecondaryValueAxisShow
    ' Enable Both X-axes
    ch.SetElement msoElementPrimaryCategoryAxisShow
    ch.SetElement msoElementSecondaryCategoryAxisShow

    ' Delete Secondary x-axis
    ch.SetElement msoElementSecondaryCategoryAxisNone

    Set x_axis_1 = ch.Axes(xlValue, xlPrimary)
    Set x_axis_2 = ch.Axes(xlValue, xlSecondary)

    x_axis_1.format.Line.ForeColor.RGB = ser(1).format.Line.ForeColor.RGB
    x_axis_1.format.Line.EndArrowheadStyle = msoArrowheadTriangle
    x_axis_2.format.Line.ForeColor.RGB = ser(2).format.Line.ForeColor.RGB
    x_axis_2.format.Line.EndArrowheadStyle = msoArrowheadTriangle

    ' Auto Scale All
    x_axis_1.MajorUnitIsAuto = True
    x_axis_1.MaximumScaleIsAuto = True
    x_axis_1.MinimumScaleIsAuto = True
    x_axis_2.MajorUnitIsAuto = True
    x_axis_2.MaximumScaleIsAuto = True
    x_axis_2.MinimumScaleIsAuto = True

    Dim a_1 As Double, a_2 As Double, b_1 As Double, b_2 As Double
    Dim x_1 As Double, s_1 As Double, x_2 As Double, s_2 As Double, g_1 As Double, g_2 As Double
    Dim n_1 As Long, n_2 As Long, sense As Long

    ' Get the axis limits
    s_1 = x_axis_1.MinimumScale
    x_1 = x_axis_1.MaximumScale
    g_1 = x_axis_1.MajorUnit
    n_1 = CLng((x_1 - s_1) / g_1)

    s_2 = x_axis_2.MinimumScale
    x_2 = x_axis_2.MaximumScale
    g_2 = x_axis_2.MajorUnit
    n_2 = CLng((x_2 - s_2) / g_2)

    Dim temp1() As Variant, temp2() As Variant
    temp1 = ser(1).values
    temp2 = ser(2).values

    ' Get the data limits
    a_1 = WorksheetFunction.Min(temp1): a_2 = WorksheetFunction.Min(temp2)
    b_1 = WorksheetFunction.Max(temp1): b_2 = WorksheetFunction.Max(temp2)

    sense = Sgn((b_2 - a_2) / (b_1 - a_1))

    If sense < 0 Then
        x_axis_2.ReversePlotOrder = True
        Swap a_2, b_2
        x_axis_2.format.Line.EndArrowheadStyle = msoArrowheadNone
        x_axis_2.format.Line.BeginArrowheadStyle = msoArrowheadTriangle
    End If

    x_axis_1.MinimumScale = a_1: x_axis_1.MaximumScale = b_1
    g_1 = x_axis_1.MajorUnit
    n_1 = CLng((x_1 - s_1) / g_1)
    x_axis_2.MinimumScale = a_2: x_axis_2.MaximumScale = b_2
    g_2 = x_axis_2.MajorUnit
    n_2 = CLng((x_2 - s_2) / g_2)

    g_2 = (x_2 - s_2) / n_1
    x_axis_2.MajorUnit = g_2

    Dim i_1 As Long, i_2 As Long
    i_1 = WorksheetFunction.Floor_Math(a_1 / g_1)
    s_1 = i_1 * g_1
    i_2 = WorksheetFunction.Floor_Math(a_2 / g_2)
    s_2 = i_2 * g_2

    Dim j_1 As Long, j_2 As Long
    j_1 = WorksheetFunction.Ceiling_Math(b_1 / g_1)
    x_1 = j_1 * g_1
    j_2 = WorksheetFunction.Ceiling_Math(b_2 / g_2)
    x_2 = j_2 * g_2

    x_axis_1.MinimumScale = s_1: x_axis_1.MaximumScale = x_1
    x_axis_2.MinimumScale = s_2: x_axis_2.MaximumScale = x_2

    x_axis_1.MajorUnitIsAuto = True
    g_1 = x_axis_1.MajorUnit
    n_1 = CLng((x_1 - s_1) / g_1)

    g_2 = (x_2 - s_2) / n_1
    x_axis_2.MajorUnit = g_2

End Sub


text:
Q: How to tell typescript the type of a key inside a nested loop which depends on the key before? I have nested loop (playground link below):
    const foo: tFoo = Foo.getEmptyFooObject();

    // will be 'foo1' | 'foo2' | 'foo3'
    let firstDimensionKey: keyof typeof foo;
    for (firstDimensionKey in foo){
      const firstDimensionValues = foo[firstDimensionKey];

      // secondDimensionKey is never. Because typescript doesnt know what the firstDimensionValues is at this moment.
      // How can I make typescript know what it should be?
      let secondDimensionKey: keyof typeof firstDimensionValues;
      for (secondDimensionKey in firstDimensionValues) {
        // is there a away to avoid casting (firstDimensionKey + '-' + secondDimensionKey) as tFooFlattenedKeys?
        foo[firstDimensionKey][secondDimensionKey] = this.getValueOfFoo((firstDimensionKey + '-' + secondDimensionKey) as tFooFlattenedKeys);
      }
    }

The secondDimensionkey is never because it depends on the values firstDimensionValues holds. At least I think so.
Is is possible to let typescript know which key it is at the moment? Maybe with a conditional or mapped type? Currently we loop over every key on its own, having 10+ loops inside the function. This seems to be stupid (see playground last function: toObjectIWantToAvoid).
Edit: Type any is not allowed
Playground link


text:
Q: Advantage of using bitwise shifting in constant 1 in java in android source code, there is something like below. Is there any good reason to use bitwise shifting in this situation? Wouldn't be simpler just typing 1 ?
public static final int POP_BACK_STACK_INCLUSIVE = 1<<0;

What is the disadvantage of using like below or advantage of above?
public static final int POP_BACK_STACK_INCLUSIVE = 1;

A: This was done not for performance but for maintenance of the code.
Upon compilation compiler evaluates constant expressions, and this constant will be stored as 1
But in future, when this constant should be changed via shifting, the maintainer will just change 0 to another number in the source code.
Shift operator just shows to maintainer, that shift operation can be used for this constant in the future releases.

A: There is no performance advantage for either version.  In the first case, the 1<<0 expression is evaluated at compile time, and the Java and Dalvik bytecodes will actually just use a constant 1 ... in both case.
The real reason is to document that this is a "bit flag" value.  Writing the expression as 1<<0 is saying that the flag has bit zero set.

Note that this does NOT give the developers the option of changing the shifting in some future version.  POP_BACK_STACK_INCLUSIVE is a public compile-time constant, so changing it could lead to binary compatibility problems.  Specifically, code that is compiled against different versions of Android would have different values for the constant.  That could make apps non-portable across different Android releases; i.e. you would need different versions of apps for the different releases.


text:
Q: Import from file inside an archive (jar) I have an application written in Java + JavaScript. Users can write plug-ins for this application using JavaScript by placing their files inside a plugins folder next to the Jar file. Some scripts might need access to internal JavaScript classes (e.g. the plugin should default export a class that extends the JavaScript Plugin class) but these classes are defined in JavaScript files that reside inside the Jar and are therefor inaccessible from outside the Jar since you can't import Plugin from "../MyApp.jar/scripts/Plugin.js".
My only theoretical solution is to copy all script files from inside the Jar to a folder scripts/ outside the Jar, but would that even work? Wouldn't the Plugin class from inside the Jar and outside the Jar be different Plugin classes? Or is JavaScript sufficiently dynamic that it doesn't matter as long as both Plugin classes are 100% identical?

A: JavaScript has a single global namespace. It does not matter if part of the code is loaded from your source archive and part from external files. You may be worried because in Java each class loader gets a namespace of its own, and things get confusing when a class is loaded by different class loader (the two copies look the same but are incompatible).
JavaScript does not have this problem.


text:
Q: How to filter an array of words that includes a specific string pattern and of words that are in another array? I have an array of words. I can enter a text in an input field, and the array will be filtered based on my request. This is the easy part.
Now, I can also select one of the word proposed and push it into another array of selected words. As soon as a word goes into the selected array, it should not be available anymore.
I wrote this:

const words = ["hello", "allo", "test", "cool", "top"]
const selected = ["hello"]

const availableWords = (term) => words.filter((w,i)=> w.includes(term) && !selected[i].includes(term))

availableWords("llo")
// expected output: ["allo"]
// actual output: "Cannot read property 'includes' of undefined"

How to fix this?

A: You need to exclude the found word of selected if the actual word match.

const
    availableWords = term => words.filter(w => w.includes(term) && !selected.includes(w)),
    words = ["hello", "allo", "test", "cool", "top"],
    selected = ["hello"];

console.log(availableWords("llo")); // ["allo"]

A: Sounds like this is what you want:
let availableWord2 = (term) => words.filter(w => !selected.includes(w))
                                    .filter(w => w.includes(term))

availableWord2('llo') //["allo"]

Explanation: The first filter filters out all the words that are already selected. The second filter then searches for the word entered from the remaining list.


text: Q: how to export and save all data from my chrome extension I have created a chrome extension, And its working very smoothly. All data saved to AppData->Local->pjkbkijbifbaboihoamgmbklokdohlpd(extension id)->000003.log .I wish to export all data from browser directly. So don't have to go to folder and copy log file.Is there possible to export 000003.log file directly?


text:
Q: Can the word 'have' be omitted without changing the meaning here? Sorry if I'm bad at explaining, I'm not a native speaker.
I had an interesting exchange with someone regarding a very particular sentence. Here goes:
For context; they are talking about an existing restaurant and are writing a short history paragraph about it.
The sentence:
"The recipes have been passed down and become the recommended dishes".
I argued that in this particular context, it's not correct to use "and become" because you're talking about a certain event that has already passed; that is, when the recipes made it into the menu. So I argued that it had to be "and have become the recommended dishes" OR "and became the recommended dishes".
Their argument is that they can omit the second use of "have" before "become" because the entire sentence uses the same tense (present perfect).
I feel like their proposed sentence has an illogical meaning the way it is constructed, and changing it to "has become" or "became" are correct in this particular context.
Am I right or wrong here?
Thank you in advance.

A: You say this:

So I argued that it had to be "and have become the recommended dishes."

But that's what the sentence already does say, you are just not parsing it correctly.
It's a combined version of two independent clauses:

*

*The recipes have been passed down.The recipes have become the recommended dishes.

*The recipes have been passed down, and the recipes have become the recommended dishes.

*The recipes have been passed down and have become the recommended dishes.

*The recipes have been passed down and become the recommended dishes.
In short, the phrase the recipes have, including the auxiliary verb, applies to both sections of the sentence. It's just that it's a shortened method of expressing it.
The following would be the incorrect version you're thinking of:

✘ The recipes have been passed down and the recipes become the recommended dishes.

Now, whether it's stylistically or idiomatically acceptable to omit the second have is a matter of opinion. At least as far as you're concerned, it seems that omitting it does lend itself to this kind of parsing difficulty. So, you're at least right in saying that it can be awkward.

This is similar to the following:

I struggled to pass the test and drive home.

It means:

I struggled to pass the test, and I struggled to drive home.
  I struggled to pass the test and drive home.

It does not mean:

✘ I struggled to pass the test and I drive home.

A:
I argued that in this particular context, it's not correct to use "and become" because you're talking about a certain event that has already passed; that is, when the recipes made it into the menu.

But the sentence doesn't say "the recipes become the recommended dishes". It just says "become the recommended dishes". If you read the sentence literally, it says the recipes have been passed down. It also says become the recommended dishes. But that doesn't make sense. "become the recommended dishes" doesn't have a subject, so what follows "and" is not a valid clause.
The fact that you aren't objecting to the conjunction "and" linking a clause with a sentence fragment implies that you recognize that "the recipes"* is applied to both "have been passed down" and "become the recommended dishes". The word "have" is simply an extension of that principle: the entire phrase "the dishes have" is applied to "been passed down" and "become the recommended dishes".
*There is some degree of figure of speech here (metonymy, sort of), as the second subject is actually the food produced by the recipes, rather than the recipes themselves.


text:
Q: Entire function with zeros of even multiplicity is the square of another entire function Let $f: \mathbb{C} \rightarrow \mathbb{C}$ be an entire function such that the multiplicity of each of its zeros is even. Must there exist an entire $g$ such that $f(z) = g(z)^{2}$?
Progress
I thought about  using the Weierstrass Factorization Theorem, but I can't seem to get that to work. In the Weierstrass factorization theorem of $f$ we have an infinite product $\prod_{k = 1}^{\infty}(1 - z/b_{k})^{p_{k}}e^{R_{k}(z)}$ where $p_{k}$ is even, $\{b_{k}\}$ are the zeros of $f$ listed without multiplicity and $R_{k}$ is a polynomial. Then how do I know that $\prod_{k = 1}^{\infty}(1 - z/b_{k})^{p_{k}/2}e^{R_{k}(z)/2}$ is entire?

A: On the one hand, from the product representation (we disregard $f \equiv 0$, where the existence of a square root is trivial)
$$f(z) = e^{a(z)} z^{2\nu_0} \prod \left(1-\tfrac{z}{b_k}\right)^{2\nu_k}e^{p_k(z)}\tag{1}$$
of $f$, we directly obtain what should be a product representation of a square root of $f$:
$$g(z) = e^{a(z)/2} z^{\nu_0} \prod\left(1-\tfrac{z}{b_k}\right)^{\nu_k} e^{p_k(z)/2},\tag{2}$$
and then it remains to see that the product in $(2)$ converges locally uniformly on all of $\mathbb{C}$. That is maybe a little tedious if done rigorously.
We can avoid that tedium if we use the Weierstraß product theorem in a different way:
There is an entire function $g_1$ that has zeros of order $\nu_k$ in the $b_k$ (with $b_0 = 0$ and possibly $\nu_0 = 0$), and no other zeros. Then the function
$$q(z) = \frac{f(z)}{g_1(z)^2}$$
is entire and has no zeros. Hence $q$ has a logarithm, $q(z) = e^{g_2(z)}$. Now it is clear that $g(z) = g_1(z) e^{g_2(z)/2}$ is an entire square root of $f$.
An alternative way to establish the existence of a square root of $f$ considers the logarithmic derivative
$$h(z) = \frac{f'(z)}{f(z)}.$$
$h$ is an entire meromorphic function, with simple poles in the zeros of $f$, where the residue in $b_k$ is $2\nu_k$, and no other poles. Therefore the residue of $\tilde{h} = \frac{1}{2}\cdot h$ in all poles is an integer, and hence
$$g(z) = \exp \left(c_0 + \int_{z_0}^z \tilde{h}(\zeta)\,d\zeta\right),$$
where

*

*$z_0$ is an arbitrary point such that $f(z_0) \neq 0$,

*$c_0$ is chosen so that $e^{2c_0} = f(z_0)$,

*and the integral is over an arbitrary piecewise differentiable path from $z_0$ to $z$ that does not pass through any zero of $f$,

is a well-defined holomorphic function on $\mathbb{C}\setminus f^{-1}(\{0\})$ with $g(z)^2 \equiv f(z)$ there. From that, it follows that the zeros of $f$ are removable singularities of $g$, and the identity $g(z)^2 \equiv f(z)$ holds on all of $\mathbb{C}$ after removing the removable singularities.
Note: the same arguments work on any simply connected domain, but on a domain that is not simply connected, not all holomorphic functions with all zeros of even order have a square root. Also, the arguments, mutatis mutandis, also work for any $m$-th root of $f$ if the order of all zeros of $f$ is a multiple of $m$.


text:
Q: Can't run shellscript with sudo When I try to run my script like this:
sudo ./connector.sh

It give me this:
sudo: ./connector.sh: command not found

What am I doing wrong?

A: Either add a shebang at the first line of your script:
#!/bin/bash
echo "Hallo"

And/or set the executable rights
sudo chmod +x connector.sh

A: Another possible solution is to call the script in this way:
sh ./connector.sh

you can use any other shell type other than sh, depends on your code.

A: no no no.. your problem here is that when you sudo, your current directory is not fully realized. you just have to call your script by the full path, like this(assuming your script is in /tmp)
sudo /tmp/connector.sh


text:
Q: Django project not recognising Numpy Dependency my django project does not recognise my numpy and pandas dependencies.I have installed numpy and pandas through pycharm but for some reason they are not recognised. I run my project through the terminal by doing "python3 manage.py runserver"in the desired directory where I have saved the numpy and pandas libraries. Here is my code:
   from django.shortcuts import render,get_object_or_404
   from django import forms
   import pandas as pd

   def read_excel(ExcelFileName):
   File = pd.read_excel(ExcelFileName)
   return File

   template_name1 = 'multiplication/detail.html'

    class myForm(forms.Form):
    quantity1 = forms.IntegerField(required=False)
    quantity2 = forms.IntegerField(required=False)

    def multiply_two_integers(x,y):
       return x*y

  def my_view(request):
     read_excel
     if request.method == 'POST':
        form = myForm(request.POST)
        if (form.is_valid()):
           x = form.cleaned_data['quantity1']
           y = form.cleaned_data['quantity2']
           product = multiply_two_integers(x, y)
           multiplied = True
           return render(request, template_name1, {'form':
           form,'product': product, 'multiplied': multiplied })
       else:
           multiplied = False
           form = myForm()
           return render(request,template_name1,{'form': form,
           'multiplied': multiplied} )

Here is the error I am getting:
   in <module>
    from multiplication import views
    File
    "/Users/NikolasPapastavrou/firstProject/multiplication/views.py",
    line 11, in <module>
    import pandas as pd
     File "/Users/NikolasPapastavrou/firstProject/pandas/__init__.py",
     line 19, in <module>
     "Missing required dependencies {0}".format(missing_dependencies))
      ImportError: Missing required dependencies ['numpy']

Please help me understand what is wrong with my project. Find attached an image of all the libraries I am using.


text:
Q: RxJava: как подписаться на данные из другого потока? Хочу подписаться на ответ, полученный на запрос из сети.
Допустим у меня есть такой интерфейс:
interface Net {
    // Посылает запрос в сеть, а когда приходит ответ
    // дергает callback в своем сетевом потоке
    void sendRequestGetResponse(String request, Consumer<String> responseCallback);
}

Но я не хочу обрабатывать данные в сетевом потоке, мне надо обрабатывать их в нужном потоке, например в моем ThreadPoolExecutor.
И хочется сделать что-то такое:
Observable<String> observable = <как то создали свой observable, я не знаю как>;

// Подписались на обработку ответа в нужном executor
observable.subscribeOn(Schedulers.from(executor)).subscribe(response -> {
    System.out.println("received response " + response);
});

net.sendRequestGetResponse("hello!", response -> {
    // Получили ответ и положили его в observable
    observable.push(response);
});

Как это правильно делается с помощью RxJava?

A: После некоторого обдумывания кажется понял, как это делать:
net.sendRequestGetResponse("hello!", response -> {

    Observable.just(response).
            observeOn(Schedulers.from(executor)).
            subscribe(response1 -> {
                System.out.println("received response " + response1 +
                    ", thread = " + Thread.currentThread().getName());
            });
});

По крайней мере тест напечал то что требуется.


text:
Q: Error opening archive: Unrecognized archive format I have a shell script to download OpenTok framework:
curl -L "https://tokbox.com/downloads/OpenTok-iOS-2.18.0.tar.bz2" | tar -xj

Although it downloads the .bz2 file, it gives back an error:

Error opening archive: Unrecognized archive format.

So unarchiving doesn't happen even if I manually try using the archive utility. It gives an error saying unsupported format.
I tried
tar -xvf file.bz2

on the terminal to see if it unarchives the downloaded file. I also tried installing bzip2 through brew. Nothing is working out, and I am unable to fix this issue.

A: It was the file access permission which was creating issue. Once I navigated to desktop folder command executed fine.


text:
Q: How to wait for value to be in selectable state Hi I am using Page Factory to keep all my locator in a class .
@FindBy(xpath="//select[@ng-model='selectedLeadSource']")
    WebElement source_of_lead;
    public Select getSourceOptions() {
        return new Select(source_of_lead);
    }

But I am not able to use wait as its throwing me an error.
wait.until(ExpectedConditions.elementToBeClickable(onPage.getSourceOptions().selectByValue("Campaign")));
Error :
The method elementToBeClickable(By) in the type ExpectedConditions is not applicable for the arguments (void)

A: Use This::WebDriverWait wait = new WebDriverWait(driver, 100);
@FindBy(xpath="//select[@ng-model='selectedLeadSource']")
WebElement source_of_lead;
element=wait.until(ExpectedConditions.presenceOfElementLocated(source_of_lead));
Select dropdown = new Select (element);
dropdown.selectByValue("Campaign");

A: ExpectedConditions.elementToBeClickable accepts either By or web element.
You can use 1. elementSelectionStateToBe(By locator, boolean selected)
Or 2. elementSelectionStateToBe(WebElement element, boolean selected)
An expectation for checking if the given element is selected.

A: You cannot use wait methods when using the Page Factory.  The below code creates an implicit wait of however many seconds you want to use.  I used 15 in my example.
When you initialize your page object, use the AjaxElementLocatorFactory.
public LoginPage(WebDriver driver) {
       this.driver = driver;
        PageFactory.initElements(new AjaxElementLocatorFactory(driver, 15), this);
}


text:
Q: React Todo Delete Button Removes all listed items at once I have 2 files
App.js
    import React, { Component } from 'react';
    import './App.css';
    import ToDo from './components/ToDo.js';

    class App extends Component {
      constructor(props) {
        super(props);
        this.state = {
          todos: [],
          newTodoDescription: ''
        };
        this.deleteTodo = this.deleteTodo.bind(this);
      }

    handleChange(e) {
      this.setState({ newTodoDescription: e.target.value })
    }

    handleSubmit(e) {
      e.preventDefault();
      if (!this.state.newTodoDescription) { return }
      const newTodo = { id: this.state.todos.id, description: this.state.newTodoDescription, isCompleted: false };
      this.setState({ todos: [...this.state.todos, newTodo], newTodoDescription: '' });
    }

    toggleComplete(index) {
      const todos = this.state.todos.slice();
      const todo = todos[index];
      todo.isCompleted = todo.isCompleted ? false : true;
      this.setState({ todos: todos });
    }

    deleteTodo(id) {
      const remainingToDos = this.state.todos.filter((todo, remainingToDos) => {
          if(todo.id !== remainingToDos.id) return todo; });
      this.setState({ todos: remainingToDos });
    }

      render() {
        return (

Add a ToDo!

            <form onSubmit={ (e) => this.handleSubmit(e)}>
              <input type="text"
                value={ this.state.newTodoDescription }
                onChange={ (e) => this.handleChange(e) }
                />
              <input type="submit" value="Add Todo" />
            </form>

              { this.state.todos.map( (todo) =>
                <ToDo key={ todo.id }
                  description={ todo.description }
                  isCompleted={ todo.isCompleted }
                  toggleComplete={ () => this.toggleComplete(todo) }
                  onDelete={ this.deleteTodo }
                   />
              )}

        );
      }
    }

    export default App;

ToDo.js
      import React, { Component } from 'react';

      class ToDo extends Component {
        render() {
          return (

              <input type="checkbox" checked={ this.props.isCompleted } onChange={ this.props.toggleComplete } />
              { this.props.description }  {''}
              <button onClick={() => this.props.onDelete(this.props.id)}>Remove Todo</button>

          );
        }
      }

      export default ToDo;

What I am trying to accomplish: Add many todos to the list. Click on the remove todo button. ONLY the todo that is selected will be removed.
I am VERY new to react and cannot figure this out. In my deleteToDo method I am trying to filter out the todos and only keep the todos that are current. I am unclear if I am using .filter properly or not.

A: Problem is that filter() method should return a condition, not value:
deleteTodo(id) {
      const remainingToDos = this.state.todos.filter((todo, remainingToDos) => {
          return (todo.id !== remainingToDos.id)
       });
      this.setState({ todos: remainingToDos });
}

A: I am fairly sure you have simply over-complicated your code. You are not using the parameter id that you have passed into your method at all. Your deleteTodo method could simply be:
deleteTodo = (id) => {
    var remainingToDos = this.state.todos.filter((todo) => {
        return todo.id === id
    });

    this.setState({ todos: remainingToDos })
}


text:
Q: Box-shadow in the end of ifined block. Scroll I have got fixed block with scroll and when I scroll to the end of the block, the button should have a shadow. What are heights we need to be compared here?

function scrollButtonShadow() {
        if ($(window).scrollTop() >= $(document).height() - $(window).height()) {
            $('.button').css('box-shadow', '0px 0px 13px 0px rgba(0, 0, 0, 1)');
        } else {
            $('.button').css('box-shadow', 'none');
        }
    }

    $(window).on('scroll', scrollButtonShadow);
body {
  overflow: hidden;
}
.block {
  overflow: auto;
  width: 200px;
  height: 100%;
  background: #ececec;
  position: fixed;
}

.button {
  position: fixed;
  bottom: 0;
}

button {
  border: none;
  background: green;
  border-radius: 5px;
}

        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi nihil magni placeat ducimus optio cupiditate sequi deleniti dolorem minus suscipit exercitationem fuga doloribus ipsa libero itaque dicta, error esse, nulla laudantium magnam officia tempore asperiores? Autem exercitationem nihil saepe hic laboriosam quos rerum id quod beatae natus cumque, ducimus eligendi dolores voluptas labore delectus nisi quidem culpa. Ad aperiam laboriosam inventore nisi accusamus, cum, voluptate tenetur. Facilis ratione maiores quibusdam consequuntur velit illo sit explicabo voluptates minus perspiciatis voluptatem optio commodi quos sint eligendi, beatae ipsa, et nam cupiditate at ducimus, ad accusantium sed. Iure repellendus deserunt veniam fugiat amet, sed aliquam ducimus labore necessitatibus ipsum odit voluptatem dicta sit voluptatum tempore possimus a? Ullam recusandae praesentium qui dolor officiis magni et molestiae quidem dolores dolorum animi repellat, iste, dolorem similique! Voluptate labore ipsam delectus totam, dolorum adipisci dolores, corporis amet repellendus iure animi. Vero eveniet eius dolore tempora, soluta explicabo ut, qui esse commodi, fuga debitis. Facilis tempora dolorum commodi in nesciunt culpa placeat praesentium, quis dignissimos ea asperiores ut omnis adipisci vero dolore aliquid architecto est quo, necessitatibus.

<button>Click</button>

A: In HTML you must add a paragraph tag (i.e.
) to calculate width of scrolled block:

        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi nihil magni placeat ducimus optio cupiditate sequi deleniti dolorem minus suscipit exercitationem fuga doloribus ipsa libero itaque dicta, error esse, nulla laudantium magnam officia tempore asperiores? Autem exercitationem nihil saepe hic laboriosam quos rerum id quod beatae natus cumque, ducimus eligendi dolores voluptas labore delectus nisi quidem culpa. Ad aperiam laboriosam inventore nisi accusamus, cum, voluptate tenetur. Facilis ratione maiores quibusdam consequuntur velit illo sit explicabo voluptates minus perspiciatis voluptatem optio commodi quos sint eligendi, beatae ipsa, et nam cupiditate at ducimus, ad accusantium sed. Iure repellendus deserunt veniam fugiat amet, sed aliquam ducimus labore necessitatibus ipsum odit voluptatem dicta sit voluptatum tempore possimus a? Ullam recusandae praesentium qui dolor officiis magni et molestiae quidem dolores dolorum animi repellat, iste, dolorem similique! Voluptate labore ipsam delectus totam, dolorum adipisci dolores, corporis amet repellendus iure animi. Vero eveniet eius dolore tempora, soluta explicabo ut, qui esse commodi, fuga debitis. Facilis tempora dolorum commodi in nesciunt culpa placeat praesentium, quis dignissimos ea asperiores ut omnis adipisci vero dolore aliquid architecto est quo, necessitatibus.

<button>Click</button>

In script:
function scrollButtonShadow(event) {
    var blockScrool = $(this).scrollTop();
    var blockHeight = $(this).find('p').height() + $(this).find('div').height();
    var windowHeight = $(window).innerHeight();
    var delta = blockHeight - windowHeight - blockScrool;
    if (delta < 0) {
        $('.button').css('box-shadow', '0px 0px 13px 0px rgba(0, 0, 0, 1)');
    } else {
        $('.button').css('box-shadow', 'none');
    }
}


text:
Q: Convergence of an event in Probability to zero Let $A_1,...A_N$ be sets with $A_i \subset \mathbb{R}$ for all $ 1 \leq i \leq N$, $ A = \bigcup_{i=1}^NA_i$ and let $ \mathbb{P}$ be a probability measure on an appropriate probability space. The author now wants to prove the following lemma.
For every $ \epsilon >0 $ there exists a positive constant $ C_{\epsilon} < \infty$ such that
$$ \mathbb{P}(A) \leq C_{\epsilon} \cdot N^{- \epsilon} $$
Now he argues as follows:
$ \mathbb{P}(A) = \mathbb{P}({\bigcup_{i=1}^N}A_i) \leq \sum_{i=1}^N \mathbb{P}(A_i) $ holds due to the sigma subadditivity of $\mathbb{P}$. Further as it is assumed that the $A_i´s$ are indistinguishable we have $ \sum_{i=1}^N \mathbb{P}(A_i) = N \cdot \mathbb{P}(A_1).$ So all in all:
$$ \mathbb{P}(A)\leq N \cdot \mathbb{P}(A_1) $$
Until here everything is fine but he now claims that it is sufficient to prove that for every $\epsilon >0$ there exists a $C_{\epsilon}$ such that $ \mathbb{P}(A_1)\leq C_{\epsilon} N^{-\epsilon} $
But in my opinion this would yield:
$$ P(A) \leq N \mathbb{P}(A_1) \leq C_{\epsilon}\cdot N^{-\epsilon +1} $$
which could tend to infinity if $ \epsilon < 1$. But it is the goal of this lemma to prove convergence to zero. My first thought was that he could just define a new epsilon $\tilde{\epsilon}=-\epsilon +1$ and the lemma would be fulfilled. But this doesnt feel true. Any suggestions where my error in reasoning is?


text:
Q: Display scroll bar in a mobile emulator The following Jquery code produces a scroll bar in a opera mini mobile emulator browser.
<!DOCTYPE html>

        <meta charset="utf-8" />

        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

        <title>buttons_create_avoid</title>
        <meta name="description" content="" />
        <meta name="author" content="siddarth" />

        <meta name="viewport" content="width=device-width; initial-scale=1.0" />

        <link rel="stylesheet" href="./Jquery library/themes2/jquery.mobile-1.0.min.css" />

This is Buttons Page

                <button>Button</button>
                <input type="submit" value="submit" data-corners = "false" />
                <input type="reset" value="reset" data-icon = "home"/>
                <input type = "submit" value = "This button fits to the length of the word" data-inline />
                <input type="submit" value = "submit" data-shadow = "false" />

Now The standard Jquery buttons will not be created, cos of: data-role = "none"

                <input type = "submit" value="submit" data-role = "none" />

Most of the jQuery mobile pages produces that annoying vertical navigation or the scroll bar, when I open this page in the mobile emulator.
What is the reason for this.?
![The emulator](/home/siddarth/Pictures/Screenshot from 2013-03-12 20:18:42.png)


text:
Q: Data Formatting in ios I am doing a application which have a sharing note option to Ever-Note,i have done this,but my problem is ,the content of the note has to be static that means
 NSString * ENML = [[[NSString alloc] initWithString: @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">\n<en-note>"]autorelease];

this is the code i used to share a note to evernote,if i add note in
`NSString * ENML = [[[NSString alloc] initWithString: @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">\n<en-note> this is my note this is my note"]autorelease];`

it will share it to evernote
But my need is i have a textview which the user can create note dynamically with textview and i need something like that to do my need,
NSString * ENML = [[[NSString alloc] initWithString: @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">\n<en-note>textview.text"]autorelease];

but its not working.How can i do this?.please help me.
regards nipin

A: First of all, if your string is constant, you can just declare it as @"mystring";
In order to add a string inside another string, use stringWithFormat:
[NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">\n<en-note>%@", textview.text];

The %@ in the string will be replaced with the value of textview.text. See "Formatting String Objects" in Apple's Developer Documentation for more info.

A: can't you do something like
NSString * ENML = @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">\n<en-note> ";
ENML = [ENML stringByAppendingString:[textEntered text]];
ENML = [ENML stringByAppendingString:@"\">";

where textEntered is bound to a text field on the screen


text:
Q: Customize the start menu tiles without any other program I want to customize my Windows 10 start menu, with my own tiles. I tested already TileCreator, problem here is that it always pops up for around 0.5 seconds, before the actual program starts. Thats annoying. I guess this program also just make some entries in the registry or works with Powershell, so is it there another way to make this custom start tiles? The custom tiles should looks like the spotify icon in the picture below, without any other text.
Example how it looks with TileCreator

A: Sure. Here is a neat guide to customize the Start menu tiles for desktop apps. Office 2010 as an example: Customize the background colour of Office 2010 tiles on the Start screen
It's a bit lengthly tutorial so I can't repost it here. Basically, you need to create the visualelementsmanifest.xml (per-executable) and set the background color and specify a logo image in the XML file.


text:
Q: Keycloak with postgres on minikube: cannot connect to database I have one pod with postgres and one pod with keycloak on minikube.
The pod with keycloak deployed via an helm chart from codecentric (chart version 17.0.1, application version 16.1.1) is failing to initialize.
I have inspected the logs and it is failing to connect to the database:
FATAL [org.keycloak.services] (ServerService Thread Pool -- 64) Error during startup: java.lang.RuntimeException: Failed to connect to database
...

Caused by: org.postgresql.util.PSQLException: Connection to 127.0.0.1:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

values.yml used to deploy the helm chart
postgresql:
  enabled: false

extraEnv: |
  - name: DB_VENDOR
    value: postgres
  - name: DB_ADDR
    value: "127.0.0.1"
  - name: DB_PORT
    value: "5432"
  - name: DB_DATABASE
    value: keycloak
  - name: DB_USER
    value: keycloak
  - name: DB_PASSWORD
    value: keycloak
  - name: KEYCLOAK_USER
    value: "admin"
  - name: KEYCLOAK_PASSWORD
    value: "admin"
  - name: PROXY_ADDRESS_FORWARDING
    value: "true"
  - name: JDBC_PARAMS
    value: "connectTimeout=30000"

Files used to deploy the postgresql pod:
postgres-configmap.yml:
apiVersion: v1
kind: ConfigMap
metadata:
  name: postgres-config-old
  labels:
    app: postgres-old
data:
  POSTGRES_DB: keycloak
  POSTGRES_USER: keycloak
  POSTGRES_PASSWORD: keycloak

postgres-deployment.yml:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres-old
spec:
  replicas: 1
  selector:
    matchLabels:
      app: postgres-old
  template:
    metadata:
      labels:
        app: postgres-old
    spec:
      containers:
        - name: postgres-old
          image: docker.io/library/postgres:14.4
          imagePullPolicy: "IfNotPresent"
          ports:
            - containerPort: 5432
          envFrom:
            - configMapRef:
                name: postgres-config-old
          volumeMounts:
            - mountPath: /var/lib/postgresql/14/data
              name: postgredb-old
      volumes:
        - name: postgredb-old
          persistentVolumeClaim:
            claimName: postgres-pv-claim-old

postgres-service.yml:
apiVersion: v1
kind: Service
metadata:
  name: postgres-old
  labels:
    app: postgres-old
spec:
  type: NodePort
  ports:
   - port: 5432
  selector:
   app: postgres-old

postgres-storage.yml:
kind: PersistentVolume
apiVersion: v1
metadata:
  name: postgres-pv-volume-old
  labels:
    type: local
    app: postgres-old
spec:
  storageClassName: manual
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: "/mnt/data"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: postgres-pv-claim-old
  labels:
    app: postgres-old
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 5Gi

I've also tried to expose an external port with:
 minikube service postgres-old --url

and add this port on values.yml instead of 5432 but with no luck.
I am running minikube on wsl2.


text:
Q: Enabling ssh logs on ubuntu system I want to enable ssh logs on my ubuntu system to monitor actions performed by any ssh connection.
My first question is whether i can see these actions in ssh logs and if so then how can i start ssh logs in my ubuntu system.
I think the log files are enabled from the following file :
/etc/rsyslog.d/50-default.conf

What command should i put in this to enable ssh logs.
Would be great help


text:
Q: В fail2ban за 2 дня накопилось огромное количество IP В fail2ban за 2 дня накопилось огромное количество IP. Это нормальная ситуация? Такое ощущение, что просто банит 70% посетителей.
Всего посетителей 1500 с 3х сайтов. Сервер VDS - ISP.
Если это не нормально, то как это можно исправить?
Прошу обратить внимание на количество, просто огромнейшее количество строк за 2 дня. Также обратите внимание на время. Был бы рад любой помощи. Спасибо.


text:
Q: How to automatically check for lidar flight line overlaps? I have a series of lidar-based raster products created via FUSION.  Since I am working with low density lidar data, many of the raster images show significant striping where lidar returns overlap on the borders of the flight lines (displayed as red lines).  I need to automatically detect and list these striped rasters for quality control purposes.  What methods can I use to automatically check these rasters for the striped effect shown in the attached image?

A: You can try 'lasoverlap.exe' to quickly both visualize and quantify the overlap. And you can use 'lasoverage.exe' to remove the extra layers when there is overlap among points based on the scan angle. Both these modules are part of LAStools, which come with a toolbox for both ArcGIS and QGIS. Attached is a visualization of an example visualization produced by 'lasoverlap.exe' ...


text:
Q: Send Dictionary from swift to objective-c class I am implemented CRToast in my swift project. CRToast is written in Objective-c. Now i want to call a method of CRToast from swift file for which i need to send a Dictionary as a parameter. Dictionary contains different types of values in it. How can i send it successfully.
func showToast(){

     let options: [NSObject : AnyObject] = [kCRToastTextKey: "Hello World!",
        kCRToastTextAlignmentKey: NSTextAlignmet.Center,
        kCRToastBackgroundColorKey: UIColor.redColor(),
        kCRToastAnimationInTypeKey: CRToastAnimationType.Gravity,
        kCRToastAnimationOutTypeKey: CRToastAnimationType.Gravity,
        kCRToastAnimationInDirectionKey: CRToastAnimationDirection.Left,
        kCRToastAnimationOutDirectionKey: CRToastAnimationDirection.Right
]

    CRToastManager.showNotificationWithOptions(options, completionBlock: {() -> Void in
        NSLog("Completed")
    })
}

the same function when called in objective-c
NSDictionary *options = @{
                      kCRToastTextKey : @"Hello World!",
                      kCRToastTextAlignmentKey : @(NSTextAlignmentCenter),
                      kCRToastBackgroundColorKey : [UIColor redColor],
                      kCRToastAnimationInTypeKey : @(CRToastAnimationTypeGravity),
                      kCRToastAnimationOutTypeKey : @(CRToastAnimationTypeGravity),
                      kCRToastAnimationInDirectionKey : @(CRToastAnimationDirectionLeft),
                      kCRToastAnimationOutDirectionKey : @(CRToastAnimationDirectionRight)
                      };
[CRToastManager showNotificationWithOptions:options
                        completionBlock:^{
                            NSLog(@"Completed");
                        }];

The method i need to call is showNotificationWithOptions
+ (void)showNotificationWithOptions:(NSDictionary*)options completionBlock:(void (^)(void))completion {
[self showNotificationWithOptions:options
                   apperanceBlock:nil
                  completionBlock:completion];

}
The error is always get is can't cast to expected type [NSObject : AnyObject]!. Can someone guide me how to send Dictionary with different values

A: You should pass enum raw value:
func showToast(){

        let options: [NSObject : AnyObject] = [kCRToastTextKey: "Hello World!",
            kCRToastTextAlignmentKey: NSTextAlignment.Center.rawValue,
            kCRToastBackgroundColorKey: UIColor.redColor(),
            kCRToastAnimationInTypeKey: CRToastAnimationType.Gravity.rawValue,
            kCRToastAnimationOutTypeKey: CRToastAnimationType.Gravity.rawValue,
            kCRToastAnimationInDirectionKey: CRToastAnimationDirection.Left.rawValue,
            kCRToastAnimationOutDirectionKey: CRToastAnimationDirection.Right.rawValue
        ]

        CRToastManager.showNotificationWithOptions(options, completionBlock: {() -> Void in
            NSLog("Completed")
        })
    }


text:
Q: How to focus on a particular portion of an another html page when click on a button or link first i want to redirect to another page then it has to focus but first it is focusing and after that it is redirecting to another page (dynamically i am getting href values i dont want to change that)? suggest me the ideas how to achieve this

Title 1

Lorem ipsum dolor sit amet, debitis maiestatis eu duo, dolores epicurei verterem cu per. Has ea intellegat elaboraret, te legendos invenire postulant nec. An legimus assentior disputando pri. Ei omnis vulputate pertinacia nam. Ex eos errem electram omittantur,
eu ipsum mazim petentium qui, pri saepe congue id. Pri quas lobortis ut. Solum denique eu mea, ex viris incorrupte scriptorem vel. Vix ne mucius mollis, no saperet molestiae nec. Ut aliquid efficiantur vim, an sed primis oporteat. Eos simul omnes at.
Eum quod primis docendi te, sumo laudem melius te sea. In has elaboraret persequeris. Et amet insolens contentiones vel, his ignota indoctum ex, idque saepe et pro. Tation explicari accusamus eam ad, no cum nonumy cetero nonumes. Vel consetetur repudiandae
ei. Quo semper facilisi ne, quod delenit repudiandae duo ad. Regione fabulas signiferumque te quo, sed elitr numquam id. Pro diceret civibus blandit ei. Impetus euismod id cum, ea sea unum nullam intellegebat. Ex dolorum utroque eam, vide laboramus persecuti
an cum. Ut sea saperet concludaturque, audire sapientem sea ut. Alii dicat placerat vim ut, vel te diceret expetenda liberavisse. Has nisl justo sensibus ut. Per an graece honestatis, deleniti maluisset necessitatibus an cum. Ex suas dicat nobis nec,
ea vis melius argumentum repudiandae.

Title 2

Lorem ipsum dolor sit amet, debitis maiestatis eu duo, dolores epicurei verterem cu per. Has ea intellegat elaboraret, te legendos invenire postulant nec. An legimus assentior disputando pri. Ei omnis vulputate pertinacia nam. Ex eos errem electram omittantur,
eu ipsum mazim petentium qui, pri saepe congue id. Pri quas lobortis ut. Solum denique eu mea, ex viris incorrupte scriptorem vel. Vix ne mucius mollis, no saperet molestiae nec. Ut aliquid efficiantur vim, an sed primis oporteat. Eos simul omnes at.
Eum quod primis docendi te, sumo laudem melius te sea. In has elaboraret persequeris. Et amet insolens contentiones vel, his ignota indoctum ex, idque saepe et pro. Tation explicari accusamus eam ad, no cum nonumy cetero nonumes. Vel consetetur repudiandae
ei. Quo semper facilisi ne, quod delenit repudiandae duo ad. Regione fabulas signiferumque te quo, sed elitr numquam id. Pro diceret civibus blandit ei. Impetus euismod id cum, ea sea unum nullam intellegebat. Ex dolorum utroque eam, vide laboramus persecuti
an cum. Ut sea saperet concludaturque, audire sapientem sea ut. Alii dicat placerat vim ut, vel te diceret expetenda liberavisse. Has nisl justo sensibus ut. Per an graece honestatis, deleniti maluisset necessitatibus an cum. Ex suas dicat nobis nec,
ea vis melius argumentum repudiandae.

Title 3

Lorem ipsum dolor sit amet, debitis maiestatis eu duo, dolores epicurei verterem cu per. Has ea intellegat elaboraret, te legendos invenire postulant nec. An legimus assentior disputando pri. Ei omnis vulputate pertinacia nam. Ex eos errem electram omittantur,
eu ipsum mazim petentium qui, pri saepe congue id. Pri quas lobortis ut. Solum denique eu mea, ex viris incorrupte scriptorem vel. Vix ne mucius mollis, no saperet molestiae nec. Ut aliquid efficiantur vim, an sed primis oporteat. Eos simul omnes at.
Eum quod primis docendi te, sumo laudem melius te sea. In has elaboraret persequeris. Et amet insolens contentiones vel, his ignota indoctum ex, idque saepe et pro. Tation explicari accusamus eam ad, no cum nonumy cetero nonumes. Vel consetetur repudiandae
ei. Quo semper facilisi ne, quod delenit repudiandae duo ad. Regione fabulas signiferumque te quo, sed elitr numquam id. Pro diceret civibus blandit ei. Impetus euismod id cum, ea sea unum nullam intellegebat. Ex dolorum utroque eam, vide laboramus persecuti
an cum. Ut sea saperet concludaturque, audire sapientem sea ut. Alii dicat placerat vim ut, vel te diceret expetenda liberavisse. Has nisl justo sensibus ut. Per an graece honestatis, deleniti maluisset necessitatibus an cum. Ex suas dicat nobis nec,
ea vis melius argumentum repudiandae.


text:
Q: How to create self referential relationship in laravel? I am new to Laravel. I Just want to create a self referential model. For example, I want to create a product category in which the field parent_id as same as product category id. How is this possible?
Model Shown below
class Product_category extends Eloquent
{
    protected $guarded = array();

    public static $rules = array(
        'name' => 'required',
        'parent_id' => 'required'
    );

     function product_category()
    {
        return $this->belongsto('Product_category','parent_id');
    }
}

It results Maximum function nesting level of '100' reached, aborting! Error

A: You can add a relation to the model and set the custom key for the relation field.
Update:
Try this construction
class Post extends Eloquent {

    public function parent()
    {
        return $this->belongsTo('Post', 'parent_id');
    }

    public function children()
    {
        return $this->hasMany('Post', 'parent_id');
    }
}

Old answer:
class Post extends Eloquent {

    function posts(){
        return $this->hasMany('Post', 'parent_id');
    }
}

A: I've added a little more to the code based on your comments trying to access the parent!
class Person extends \Eloquent {
    protected $fillable = [];
    var $mom, $kids;

    function __construct() {
        if($this->dependency_id<>0) {
            $this->mother->with('mother');
        }
    }

    public function children() {
        $children = $this->hasMany('Person','dependency_id');
        foreach($children as $child) {
            $child->mom = $this;
        }
        return  $children;
    }

    public function mother() {
        $mother = $this->belongsTo('Person','dependency_id');
        if(isset($mother->kids)) {
            $mother->kids->merge($mother);
        }
        return $mother;
    }
}

Then you can access the parent from the child with eager loading, see more here: http://neonos.net/laravel-eloquent-model-parentchild-relationship-with-itself/

A: Your model is not at fault for producing the "maximum function nesting level of '100' reached" error. It's XDebug's configuration; increase your xdebug.max_nesting_level.
The following is from a 2015 post by @sitesense on laracasts.com:

This is not a bug in Laravel, Symfony or anything else. It only occurs when XDebug is installed.
It happens simply because 100 or more functions are called recursively. This is not a high figure as such and later versions of XDebug (>= 2.3.0) have raised this limit to 256. See here:
http://bugs.xdebug.org/bug_view_page.php?bug_id=00001100
EDIT: In fact the latest Homestead provisioning script already sets the limit to 250. See line 122 here:
https://github.com/laravel/settler/blob/master/scripts/provision.sh#L122

So the addition of xdebug.max_nesting_level = 250 to php.ini should do it.

A: you can refer self, using $this
class Post extends Eloquent {

    function posts(){
        return $this->hasMany($this, 'parent_id');
    }
}

A: Take a look at my answer here.
The key is this code below in Model.php
public function children()
    {
        return $this->hasMany(Structure::class, 'parent_id')->with('children');
    }


text:
Q: driver.connect() vs DriverManager.getConnection() The DriverManager.getConnection makes call to driver.connect() internally to get database connection.
Are there any pitfalls of using driver.connect() directly?

A: java.sql.Driver is an interface, you need an actual implementation (eg org.firebirdsql.jdbc.FBDriver for Firebird) to actually do anything with it. On the other hand, DriverManager is a concrete class that abstracts (hides) driver loading, selection and usage for you.
Normally you should not use a Driver implementation directly. Stick with either using DriverManager, or otherwise use a DataSource implementation (preferably through configuration).
Using DriverManager decouples your code from the actual driver used. That means you do not have a compile time dependency on a specific driver. Changing drivers or even database system (assuming the SQL is compatible or generated compatibly) is then just a manner of adding/replacing a driver jar on the class path and specifying the right JDBC url in the configuration. That is assuming JDBC 4 automatic driver loading, otherwise adding the specific driver name to the config and using Class.forName(<value from config>) is also necessary.
For example, for SQL Server you have the driver from Microsoft or the jTDS driver (+ other third party drivers). Switching between those is - basically - a matter of adding the right driver to the class path and changing the URL in the configuration.
In the past, Microsoft even had a breaking change in their JDBC driver, changing both the class name of the driver and the URL. If you had hard coded a dependency on the Driver implementation, your code would break if you tried to upgrade the driver. If you had just used DriverManager (and had a config option for the URL, and - this was before automatic driver loading - the driver class name for loading), things would just have continued to work after a configuration change.
There are exceptions where you would use a Driver implementation directly (usually through reflection and still not hard coded), but those situations are rare, and unless you have a very good reason (and know what you're doing) then just don't do that.


text:
Q: UIWebView in background stops the music This is my code, i´m using a uiwebview to load a web page and listen music, but when y pless the home button, the music stops. How can i allow to continous working in the backgroud.
Here is my code.
var webView: UIWebView!

override func viewWillAppear(_ animated: Bool) {
    navigationItem.title = "Desdeelcanton.com"
    view.backgroundColor = UIColor.white
}

override func viewDidLoad() {
    super.viewDidLoad()
    super.viewDidLoad()
    webView = UIWebView(frame: UIScreen.main.bounds)
    webView.delegate = self
    view.addSubview(webView)
    if let url = URL(string: "http://desdeelcanton.com") {
        let request = URLRequest(url: url)
        webView.loadRequest(request)

            }
    let notificationCenter = NotificationCenter.default
    notificationCenter.addObserver(self, selector: #selector(appMovedToBackground), name: Notification.Name.UIApplicationWillResignActive, object: nil)

        }

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}
func appMovedToBackground() {
    print("App moved to background!")
}


text:
Q: Nested Virtual Directory Deleted on msdeploy The project I have uses msdeploy to publish a package to IIS. It deploys over an existing version of the project. within the web application, I have a virtual directory, but every time I deploy the project, the virtual directory disappears.
I am calling MSDepoly in the following manner:
 -source:package='d:\[...]\9.1.0.67\application\AppName.zip' -dest:auto,computerName="hostSite.com",userName="AutoInstall",password="****",authtype="NTLM",includeAcls="False" -verb:sync -enableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"d:\...\9.1.0.67\application\AppName.SetParameters.xml" -skip:objectName=binding -skip:absolutePath="info$" -skip:objectName=dirPath,absolutePath="help$",skipAction=Delete

as you can see at the end, I have the following skip rules:
-skip:objectName=binding -skip:absolutePath="info$" -skip:objectName=dirPath,absolutePath="help$",skipAction=Delete

The binding skip rule is working, but the virtual directory, info, is still getting removed from the web application. the virtual directory is nested within the help directory, so I added the skip action to skip deleting that folder as well.
I based all of this information from the following blog article, but my virtual directory, info, is still getting removed on deployment.
Please help!

A: I encountered the same issue. In development it appears the following skip rule prevented the Virtual Directory from being removed by MSDeploy.
-skip:ObjectName=virtualDirectory,absolutePath=.*NameOfVirtualDirectory

A: I gave up on getting msdeploy to play nice. I just wrote a bat script that would be executed after msdeploy completed:
mkdir C:\inetpub\application_wwwroot\VirtualDirectoryPhysicalDir
ECHO adding read permissions to the app pool
cacls C:\inetpub\application_wwwroot\VirtualDirectoryPhysicalDir/t /e /g "IIS APPPOOL\MyAppPool":r
ECHO creating "info" virtual directory
C:\Windows\System32\inetsrv\appcmd add vdir /app.name:"WebApplication/AppVirtualDirectory" / /path:"/help/info" /physicalPath:"C:\inetpub\application_wwwroot\VirtualDirectoryPhysicalDir"
C:\Windows\System32\inetsrv\appcmd set vdir /vdir.name:"Medrio/MedrioWeb/help/info" /physicalPath:"C:\inetpub\application_wwwroot\VirtualDirectoryPhysicalDir"


text:
Q: Multidimensional distribution functions It is known that if $F:\mathbb{R}\to[0,1]$ is an Stieltjes measure function such that $\inf F(x)=0$ and $\sup F(x)=1$, then there is a random variable $X$ whose distribution function is $F$.

Is there an analogous result for multidimensional Stieltjes measure functions $F:\mathbb{R}^n\to[0,1]$ such that $\inf F(\mathbf{x})=0$ and $\sup F(\mathbf{x})=1$? Could you please give me a reference of it?

A: I think Theorem 1.1.11 in Durrett, Probability Theory and Examples, 5th Edition, is what you are looking for:
https://services.math.duke.edu/~rtd/PTE/PTE5_011119.pdf