text:
Q: Fatal error when calling a crontab I've just set my crontab php file which is trying to require_once another path.
This is my script crontab which is called crontab.php and it's located in the first folder my hosting allows me (my vissible root):
<?php require_once ('/kunden/homepage/XX/XXXXXXXXXX/htdocs/folder1/folder2/file.inc.php'); ?>

Before I've set my path, I've checked with the command pwd to get the full path of my server, that means:
(uiserver) :uXXXXX:~ > pwd
/kunden/homepages/XX/XXXXXXXXXX/htdocs

To make sure it works, I've tried to test it through the command php cron.php but unfortunatelly I received this error:
Fatal error:  main() [function.require]: Failed opening required '/homepages/XX/XXXXXXXXXX/folder1/folder2/test.inc.php' (include_path='.:/usr/lib/php') in /homepages/31/d466491669/htdocs/cron.php on line 3

It's obvious that the problem is on my path but after testing many different possibilities, I can't find the right one.


text:
Q: How to create a thread that will start immediately (even though there are many threads ready)? I'm trying to build a load tester, by creating one thread that makes rapid async http requests, ignoring the server response, and another thread that samples the server every 500 ms by sending a request and measuring the response time. Pseudo code:
for (int i = 0; i < input.Length; i++)
{
    Console.WriteLine("Load: {0} requests/second", input[i]);
    var trd = LunchSamlper();
    var callsPerSecond = input[i];
    for (j = 0; j < callsPerSecond * BATCH_TIME; j++)
    {
        tasks.Add(Task.Factory.StartNew(async () =>
        {
            await SendRequestAsyncIgnoreResponse(address, payload);
        }));
        Thread.Sleep(1000 / callsPerSecond);
    }
    Task.WaitAll(tasks.ToArray());
    tasks.Clear();
    trd.Abort();
}

private static async Task SendRequestAsyncIgnoreResponse(Uri url, string data)
{
    WebClient client = new WebClient();
    client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
    await Task.Factory.StartNew(() => client.UploadStringAsync(url, data));
}

private static Thread LunchSamlper()
{
    var t = new Thread(() =>
    {
        Thread.CurrentThread.Priority = ThreadPriority.AboveNormal;
        Stopwatch sw = new Stopwatch();
        while (true)
        {
            sw.Restart();
            SendRequestAndProcessResponse();
            sw.Stop();
            Console.WriteLine("Time:{0}, Threads in process: {1}, Response Time: {2}", DateTime.Now.TimeOfDay, Process.GetCurrentProcess().Threads.Count, sw.ElapsedMilliseconds);
            Thread.Sleep(500);
        }
    });
    t.Priority = ThreadPriority.Highest;
    t.Start();
    return t;
}

Ideally, the sampler thread would wake up every 500ms, make the request, and measure the response time.
Practically, the thread wakes up every 10+ seconds, making the test irrelevant. I'm not familiar with the CLR internals too well, but I'm guessing whats happening is that the async responses get queued up fast, requiring more and more threads to handle them, thus pushing the sampler thread down the scheduler.
What I would like to do (but don't know how), is to force the sampler thread to stay at the top of the queue, kind of cheating the round robin Microsoft states they use. I tried giving it 'Highest' priority, but it didn't help.
EDIT:
Please see the new code above, this is the actual code I have executed, and the output is below. All of your comments were right - the sampler is not affected by the rest of the threads (the server response was too long)
However, you can clearly see that the more load there is, the more threads are presented in the process. I believe this reinforces my claim that the more async tasks there are, more threads are needed from the thread pool to handle them when the tasks are ready (that is, when the async part had finished). When too many tasks are ready in the queue, the thread pool has no choice but to create more threads. If I'm wrong, please explain to me what's really going on behind the scene.
Output:
Threads in process: 5

Load: 2 requests/second
Time :10:38:46.2552818, Threads in process: 19, Response     Time : 454
Time :10:38:47.1143283, Threads in process: 22, Response     Time : 357
Time :10:38:47.9765673, Threads in process: 22, Response     Time : 359
Time :10:38:48.8408045, Threads in process: 22, Response     Time : 360
.
. (same stats for 30 seconds)
.
Time :10:39:15.6071230, Threads in process: 23, Response     Time : 351
Load: 20 requests/second
Time :10:39:16.2120124, Threads in process: 23, Response     Time : 369
Time :10:39:17.0811746, Threads in process: 23, Response     Time : 365
Time :10:39:17.9329613, Threads in process: 24, Response     Time : 348
Time :10:39:18.7825313, Threads in process: 24, Response     Time : 346
Time :10:39:19.6345169, Threads in process: 24, Response     Time : 345
Time :10:39:20.4919706, Threads in process: 24, Response     Time : 354
.
.
.
.
Time :10:39:41.9171558, Threads in process: 26, Response     Time : 359
Time :10:39:42.7701623, Threads in process: 26, Response     Time : 351
Time :10:39:43.6266869, Threads in process: 26, Response     Time : 353
Time :10:39:44.4826907, Threads in process: 26, Response     Time : 352
Time :10:39:45.3433820, Threads in process: 26, Response     Time : 358
Load: 50 requests/second
Time :10:39:46.5745915, Threads in process: 26, Response     Time : 358
Time :10:39:47.9899573, Threads in process: 28, Response     Time : 912
Time :10:39:50.5339321, Threads in process: 30, Response     Time : 2039
Time :10:39:54.8185811, Threads in process: 28, Response     Time : 3780
Time :10:40:02.5677990, Threads in process: 28, Response     Time : 7244
Time :10:40:16.3460440, Threads in process: 30, Response     Time : 13273

Side note:
At first, I didn't use a sampling thread. The code looked kind of like this:
    for (int i = 0; i < numOfRequests; i++)
    {
        Stopwatch sw = new Stopwatch();
        Task.Factory.StartNew(async () => await SendRequestIgnoreResponse(sw))
            .ContinueWith(p=> MeasureServerResponse(sw));
        Thread.Sleep(1000 / requestsPerSecond);
    }

But I realized the measured time was incorrect, because the stopwatch was also counting the time the task spent in queue when the response was ready. This is how I came up with the idea of the sampler thread, which makes it's calls synchronously. Any new ideas will be seriously considered!
Last note:
For what is worth, the server under the load is local, on the same machine that generates the load. The method behind the addressed url makes a call to external resource, which takes ~300 ms.

A: You have to keep in mind that when you IO is properly async there is no spoon thread.  You're creating new threads just to spend a minuscule amount of time starting an asynchronous operation, as well as consuming thread pool time handling results that you never use.
Just don't do that:
for (int i = 0; i < numOfRequests; i++)
{
    SendRequestIgnoreResponse();
    Thread.Sleep(1000 / requestsPerSecond);
}

Also keep in mind that Thread.Sleep doesn't have a particularly high level of precision.  It has precision down to a few dozen milliseconds at best, and possibly even hundreds of milliseconds in a system under stress.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Getting the error while creating spark context py4j.protocol.Py4JNetworkError: An error occurred while trying to connect to the Java server I am trying to create spark context object with the following commands on pyspark:
from pyspark import SparkContext, SparkConf
conf = SparkConf().setAppName('App_name').setMaster("spark://local-or-remote-ip:7077").set('spark.cassandra.connection.host', 'cassandra-machine-ip').set('spark.storage.memoryFraction', '0.2').set('spark.rdd.compress', 'true').set('spark.streaming.blockInterval', 500).set('spark.serializer', 'org.apache.spark.serializer.KryoSerializer').set('spark.scheduler.mode', 'FAIR').set('spark.mesos.coarse', 'true')
sc = SparkContext(conf=conf)

but I am getting the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/spark-1.4.1/python/pyspark/conf.py", line 106, in __init__
  self._jconf = _jvm.SparkConf(loadDefaults)
File "/usr/local/lib/spark-1.4.1/python/lib/py4j-0.8.2.1-src.zip/py4j/java_gateway.py", line 766, in __getattr__
File "/usr/local/lib/spark-1.4.1/python/lib/py4j-0.8.2.1-src.zip/py4j/java_gateway.py", line 362, in send_command
File "/usr/local/lib/spark-1.4.1/python/lib/py4j-0.8.2.1-src.zip/py4j/java_gateway.py", line 318, in _get_connection
File "/usr/local/lib/spark-1.4.1/python/lib/py4j-0.8.2.1-src.zip/py4j/java_gateway.py", line 325, in _create_connection
File "/usr/local/lib/spark-1.4.1/python/lib/py4j-0.8.2.1-src.zip/py4j/java_gateway.py", line 432, in start
py4j.protocol.Py4JNetworkError: An error occurred while trying to connect to the Java server

I have built spark jar using sbt and when when I ran it through scala I got this error:
ERROR SparkUncaughtExceptionHandler: Uncaught exception in thread Thread[sparkDriver-akka.actor.default-dispatcher-18,5,main] org.apache.spark.SparkException: Exiting due to error from cluster scheduler: All masters are unresponsive! Giving up

Though master is working.


text:
Q: Manually calculate robust standard errors of 2SLS regression I used the "systemfit" function in R to estimate a 2SLS model as it allows to specify the first and second stage separately which is important for my estimation. I need robust standard errors but I am having problems replicating the robust standard errors obtained when estimating the model using "iv_robust" or "ivreg" in combination with "coeftest".
I tried to calculate the robust standard errors manually as follows:
firststagehfsystem <- H ~ HL1
secondstageivsystem <- Index ~ H
system = list(firststagehfsystem, secondstageivsystem)
inst <- ~ HL1
ivhfsystem = systemfit(system, method = "2SLS", inst = inst, data = DataControls)
coef <- ivhfsystem$eq[[2]]$coefficients
vcov <- ivhfsystem$eq[[2]]$coefCov
se <- sqrt(diag(vcov))
residuals <- ivhfsystem$eq[[2]]$residuals
n <- nrow(DataControls)
k <- length(coef)
X <- model.matrix(ivhfsystem$eq[[2]])
hc1 <- (n/(n-k))*ivhfsystem$eq[[2]]$residuals^2
vce_hc1 <- solve(t(X) %*% X) %*% (t(X) %*% (hc1*diag(n)) %*% X) %*% solve(t(X) %*% X)
sqrt(diag(vce_hc1))

Can anyone point out my mistake? I already googled it for two days and could not find a solution. Thank you!


text:
Q: how to put background image for navigation bar? I want to put background image for navigation bar. I tried the following code but it hides the title for navigation.
self.title = @"My title";
UINavigationBar *navBar = self.navigationController.navigationBar;
UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"top.png"]];
[navBar addSubview:image];
[navBar sendSubviewToBack:image];

Any buddy know why is it so?

A: This should go where your navigation controller is initialized, i.e. MainViewController.m
// Set the background image of the navigation bar
UIImage *image = [UIImage imageNamed:@"banner-with-logo.png"];
[self.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];

A: [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"background.png"] forBarMetrics:UIBarMetricsDefault];

A: You can done by override the drawRect method
@implementation UINavigationBar (TENavigationBar)

- (void) drawRect:(CGRect)rect
{
    UIImage *image = [UIImage imageNamed:@"navigation_background"];

    [image drawInRect:CGRectMake(0,
                                 0,
                                 self.frame.size.width,
                                 self.frame.size.height)];
}

@end

A: Solution by WaiLam will work but if you are playing movies in your app the player navigation bar will also get change. Here is a better approach -
@implementation UINavigationBar (UINavigationBarCategory)

- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
{
    if([self isMemberOfClass:[UINavigationBar class]])
    {
        UIImage *image;
        image=[UIImage imageNamed:@"hor_bar"];
        CGContextClip(ctx);
        CGContextTranslateCTM(ctx, 0, image.size.height);
        CGContextScaleCTM(ctx, 1.0, -1.0);
        CGContextDrawImage(ctx,
                           CGRectMake(0, 0, self.frame.size.width, self.frame.size.height), image.CGImage);
    }
    else
    {
        [super drawLayer:layer inContext:ctx];
    }
}
@end

A: This will add an image, with the correct sizing, to the NavigationBar, centered.
/*  custom navbar logo, centered with same height as navbar  */
UIImageView *logo = [[UIImageView alloc] initWithFrame:
        CGRectMake(self.navigationController.navigationBar.frame.size.width/2-75,0,150,
                   self.navigationController.navigationBar.frame.size.height-1)];
[logo setImage:[UIImage imageNamed:@"text_logo.png"]];
[self.navigationController.navigationBar addSubview:logo];
[self.navigationController.navigationBar sendSubviewToBack:logo];

A: If you want to add the image so that it is always the same throughout the application than use this:
- (void)drawRect:(CGRect)rect {
    // Drawing code
    UIImage *img = [UIImage imageNamed: @"background-image.png"];
    [img drawInRect:CGRectMake(0,
                               0,
                               self.frame.size.width,
                               self.frame.size.height)];
}

otherwise if you want to set the image at a particular screen only than it is bit tricky like:
- (void) viewWillAppear{
  ...
  ...
  [self addNavigationBarImage:YES];
}

- (void) viewWillDisappear{
  ...
  ...
  [self addTheNavigationBarImage:NO];
}

- (void) addTheNavigationBarImage:(BOOL)add{
  UIImageView *imgView = (UIImageView *)[[self.navigationController navigationBar] viewWithTag:TAG];
  if(add){
    if(imgView == nil){
      imgView = [[[UIImageView alloc] initWithImage:IMAGE] autorelease];
      [self.navigationController.navigationBar insertSubview:imgView atIndex:0];
    }
    //EDIT:
    else{
      [self.navigationController.navigationBar sendSubviewToBack:imgView];
    }

  }
  else{
   if(imgView)
      [imgView removeFromSuperview];
  }
}

Hope this helps.


text:
Q: Dataset level access control in BigQuery So I have a number of datasets under the same GCP BQ project, and I want to allow an external user to have read-only and read/write access on a few of them, but other datasets should not be visible to him. What's the best approach for this?
P.S. Probably not going to create an email account for him under our domain, so I'm thinking service accounts.

A: Just figured out one way to do it:

*

*Create service account for external user (with BigQuery Job User role so it can be used to run queries in this project)

*In GCP console web UI, for each dataset to share, click "SHARE DATASET", and in the pop-up panel add the service account created in step 1, with appropriate roles (BigQuery Data Viewer or BigQuery Data Editor)

Not sure if there's a cleaner way.


text:
Q: Autodelete person from group in Directory Assistance We have a server with DA (associated address book) configured.
The DA is used mainly to created mail groups (it does not have any person documents).
Whenever a person is removed from main address book, the person is also automatically removed from all the groups that he/she was listed in (in the main address book). However, a user doesn't get removed from any of the groups that he/she is listed in the Associates Address Book.
Is this misconfiguration? or it just does not work in a way we expect.
Do we have to do some extra work (like create a schedule agent in DA) that verify groups and perform clean up?
Thanks.

A: The administration process takes care for renames and deletions. But it has to KNOW that it is responsible for your secondary address book.
Modify the ACL of that secondary names.nsf and set its server as "Administration Server" and select "Modify all Names Fields" from the options. Now the server knows, that on the next run of an admin process it has to take care of that addressbook as well.


text:
Q: How to remove ant-click-animating of button Ant design After I click on the button, it has the animation around the button. So I want to turn it off, I try to set CSS for element and Pseudo-classes but it's not working.
.ant-switch,
.ant-switch:focus,
.ant-switch:active {
  border-color: white !important;
  box-shadow: none !important;
  outline: unset;
}

My code:
import React from 'react';
import { Switch } from 'antd';
import styled from 'styled-components';

const RSwitch = styled(Switch)`
  background-color: ${props => props.backgroundcolor};

  .ant-switch-handle::before {
    background-color: #9b9b9b;
    right: 0;
  }

  &[aria-checked='true'] {
    .ant-switch-handle {
      ::before {
        background-color: ${props => props.color};
      }
    }
  }
`;

export default function SwitchComponent({
  onChange,
  checked,
  color = '#00afdb',
  backgroundColor = ''
}) {
  return (
    <RSwitch
      onChange={onChange}
      checked={checked}
      size="small"
      color={color}
      backgroundcolor={backgroundColor}
    />
  );
}

ant switch picture
HTML of switch

A: I fixed it with this solution
create a button.less file in your ant overrides and put this inside
[ant-click-animating-without-extra-node='true']::after{display:none;}
and it will work like a charm.

A: I realize it is just a div tag so I don't display it. If everybody has a better solution, please let me know.
.ant-click-animating-node {
  display: none;
}

A:

.ant-btn {
        &::after {
            all: unset;
        }
    }


text:
Q: Can I change the styles of the last p only with CSS? I've got several p tags in the content of a page. I want to change the color of the last one before the div that hold them. Can I do this just with CSS?

P One

P Two

P Three

P Four (this is the one I'd like to modify)

Thanks

A: The easy, portable way:

P Four (this is the one I'd like to modify)

.text p.last {}

The easy, less-portable way uses :last-child:
.text p:last-child {}

Or :last-of-type:
.text p:last-of-type {}


text:
Q: [Vue warn]: Injection "$validator" not found Error on attempt to use vee-validate I'm new to VueJS so I decided to use it for a small project. I needed to validate client entries..I googled and found vee-validate would be appropriate for my style of creating a component so I used the style found in this post https://jsfiddle.net/787g7q0e/ Below are the steps I took to reproduce the error I got.
First, I installed the vee-validate via a CDN link like so:

in my Layout file for APS.NET MVC
Secondly, following https://jsfiddle.net/787g7q0e/, I registered and used vee-validate like so:
const config = {
    aria: false,
    classNames: {},
    classes: false,
    delay: 0,
    errorBagName: 'errors',
    events: 'input|blur',
    fieldsBagName: 'fields',
    i18n: null,
    i18nRootKey: 'validations',
    inject: true,
    locale: 'en',
    strict: true,
    validity: false
}
Vue.use(VeeValidate, config);

Vue.component('loan-calc', {
    template: `

                <form>

                      Loan Amount

The amount you want to take

                              <svg width="15"
                                   height="13"
                                   viewBox="0 0 15 13"
                                   fill="none"
                                   xmlns="http://www.w3.org/2000/svg">
                                  <path opacity="0.4"
                                        d="M14.814 5.764H13.302V7.726H14.814V9.22H13.302V13H11.286L8.244 9.22H4.716V13H2.232V9.22H0.684V7.726H2.232V5.764H0.684V4.288H2.232V0.219999H4.158L7.38 4.288H10.818V0.237999H13.302V4.288H14.814V5.764ZM4.716 7.726H7.056L5.472 5.764H4.716V7.726ZM10.116 7.726H10.818V5.764H8.55L10.116 7.726Z"
                                        fill="#03293D" />
                              </svg>

                          <input
                                type="text"
                                name="LoanAmount"
                                v-validate="'required'"
                                v-model="LoanAmount"/>

                              <svg width="20"
                                   height="20"
                                   viewBox="0 0 20 20"
                                   fill="none"
                                   xmlns="http://www.w3.org/2000/svg">
                                  <path opacity="0.4"
                                        d="M10 0C4.47 0 0 4.47 0 10C0 15.53 4.47 20 10 20C15.53 20 20 15.53 20 10C20 4.47 15.53 0 10 0ZM13.1035 5.0684C13.2435 5.0684 13.3833 5.1224 13.4883 5.2324L14.7676 6.5117C14.9876 6.7217 14.9876 7.0732 14.7676 7.2832L13.7676 8.2812L11.7188 6.2324L12.7188 5.2324C12.8237 5.1224 12.9635 5.0684 13.1035 5.0684ZM11.1289 6.8145L13.1875 8.8711L7.12891 14.9316H5.06836V12.8711L11.1289 6.8145Z"
                                        fill="#03293D" />
                              </svg>

          </form>

`,
    data() {
        return {
            LoanAmount: null,
            LoanTenure: null,
            RepaymentType: null,
            Repayment: null
        }
    }
})

From the above template, I tried using vee-validate to validate the required field like so:
                          <input
                            type="text"
                            name="LoanAmount"
                            v-validate="'required'"
                            v-model="LoanAmount"/>

                          <svg width="20"
                               height="20"
                               viewBox="0 0 20 20"
                               fill="none"
                               xmlns="http://www.w3.org/2000/svg">
                              <path opacity="0.4"
                                    d="M10 0C4.47 0 0 4.47 0 10C0 15.53 4.47 20 10 20C15.53 20 20 15.53 20 10C20 4.47 15.53 0 10 0ZM13.1035 5.0684C13.2435 5.0684 13.3833 5.1224 13.4883 5.2324L14.7676 6.5117C14.9876 6.7217 14.9876 7.0732 14.7676 7.2832L13.7676 8.2812L11.7188 6.2324L12.7188 5.2324C12.8237 5.1224 12.9635 5.0684 13.1035 5.0684ZM11.1289 6.8145L13.1875 8.8711L7.12891 14.9316H5.06836V12.8711L11.1289 6.8145Z"
                                    fill="#03293D" />

Kindly help or show me how I can resolve the above error and use vee-validate effectively.


text:
Q: "Well-known classical phrase" What is the "well-known classical phrase"? All Quiet On The Western Front

Himmelstoss is a raging book of army regulations. The Kaiser couldn't be more insulted. "Tjaden, I command you, as your superior officer: Stand up!" "Anything else you would like?" asks Tjaden. "Will you obey my order or not. Tjaden replies, without knowing it, in the well-known classical phrase.

A: This exact question was asked, and answered, with multiple sources cited, in this Literature.SE thread to be exact.
That thread says (in an answer by user Tsundoku dated 4 Match 2020 in the link above) the answer is:

The most famous phrase from Goethe's play Götz von Berlichingen and goes on to say:
The most famous phrase from Goethe's play Götz von Berlichingen is     > > er kann mich im Arsche lecken!

This is taken from the third act, when Götz von Berlichingen's castle is being besieged and a herald comes to tell him it were better to surrender. This leads to a response that made the play famous:

Mich ergeben! Auf Gnad und Ungnad! Mit wem redet Ihr! Bin ich ein Räuber! Sag deinem Hauptmann: Vor Ihro Kaiserliche Majestät hab ich, wie immer, schuldigen Respekt. Er aber, sag's ihm, er kann mich im Arsche lecken!
[Schmeißt das Fenster zu.]

Translation (1885, hosted by The Online Library of Liberty):

Surrender—surrender at discretion. With whom speak you? Am I a robber? Tell your captain, that for the emperor I entertain, as I have ever done, all due respect; but as for him, he may lick my arse!
[Shuts the window with violence.]

Probably only the last phrase is intended here.
One might note that in the version I found online, the passage (which is from chapter 10) reads:

We put on extraordinary airs, every man treats the other as his valet, bounces him and gives him orders. "There is something itching under my foot; Kropp my man, catch that louse at once," says Leer, poking out his leg at him like a ballet girl, and Albert drags him up the stairs by the foot. "Tjaden!" – "What?" – "Stand at ease, Tjaden; and what's more, don't say 'What,' say 'Yes, Sir,' – now: Tjaden!" Tjaden retorts in the well-known phrase from Goethe's Gotz von Berlichingen, with which he is always free.

I suspect this is from a different translation from the German original than the one quoted in the question.


text:
Q: Cannot cache dependencies on Github Actions using Pipenv I am trying to cache dependencies for a Github Action workflow. I use Pipenv.
this is my config:
    - uses: actions/cache@v1
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile') }}
        restore-keys: |
          ${{ runner.os }}-pip-

I got this config from Github's own examples for using pip. I have only changed requirements.txt to Pipfile since we don't use a requirements.txt. But even with the requirements.txt I get the same issue anyway.
the Cache Dependencies step always give this issue:

and then after running the tests:

There's no error on the workflow and it finishes as normal, however, it never seems to be able to find or update the dependency cache.

A: pipenv needed to be installed before the cache step...
 - name: Install pipenv, libpq, and pandoc
      run: |
        sudo apt-get install libpq-dev -y
        pip install pipenv


text:
Q: Determine convergence of a series Let a series be given as
$$\sum_{m=2}^{\infty}\frac{\cos(\pi m)}{\ln(\ln(m))}$$
Is it converges conditionally, converges absolutely or diverges.
Attempt
From computation I see that it does indeed converge (and I can show that it converges using alternating series test / Leibnitz). The thing that is left is to show that the $$\sum_{m=2}^{\infty}\left | \frac{\cos(\pi k)}{\log(\log(k))} \right |$$
diverges and thus that it does not converge  absolutely but only conditionally. But trying to use that if $a_n$ does not converge to $0$ then the series diverges I get stock as I see that the sequence $a_n$ does converge to $0$.

A: For $m\in\mathbb{Z}$ we have $\cos(\pi m)=(-1)^m$, so we may write
$$\sum_{m=2}^{\infty}\left | \frac{\cos(\pi m)}{\log(\log(m))} \right |=\sum_{m=2}^{\infty}\left | \frac{(-1)^m}{\log(\log(m))} \right|=\sum_{m=2}^{\infty}\frac{1}{\lvert\log(\log(m))\rvert}.$$
Also observe that $\log\log m <m$ for $m>1$. So a lower bound is the harmonic series.


text:
Q: Font weight isn't working with variable fonts? I downloaded the Inter font from google fonts and then took the variable font file and uploaded it to font squirrel so that I could just embed the base64 directly into my CSS.
The problem is that the font weight is not accurate as compared to using the separate downloaded weights (400, 500, 600). I read elsewhere that with variable fonts you can use any font weight under the sun.
Instead, it looks like the only font weights available are 500 and 600. 500 is the regular one and 600 is extremely bolded (and kind of ugly). Am I doing something wrong? Here is my CSS declaration for the inline font:
@font-face {
  font-family: 'Inter';
  src: url(data:application/font-woff2;charset=utf-8;base64,[encoded data, 19728 characters]) format('woff2');
}

Then in my code I set the font family to Inter and try altering its font-weight, but it only lets my choose two values instead of what I assumed would be an infinite amount due to the fact it's a variable font.
Here's a fiddle demonstrating the problem: https://jsfiddle.net/tnc4y0w5/
My end goal is to be able to embed the Inter font (with just the Western languages subset) into my CSS and have it basically look-wise to the external google fonts link.

A: For variable fonts, you want to use the font-variation-settings CSS property, not the font-weight.
Also the file you are using represents one of the static versions of this font, to use variable fonts from GoogleFonts you can request a range of weights by appending :wght@min..max to the stylesheet's URL:

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200..900');
.t1 {
  font-family: 'Inter';
  font-variation-settings: 'wght' 200;
}

.t2 {
  font-family: 'Inter';
  font-variation-settings: 'wght' 400;
}

.t3 {
  font-family: 'Inter';
  font-variation-settings: 'wght' 500;
}

.t4 {
  font-family: 'Inter';
  font-variation-settings: 'wght' 200;
  animation: weight 2s infinite;
}
@keyframes weight {
  50% { font-variation-settings: 'wght' 900; }
}
<main>
  <span class="t1">hellofg</span>
  <span class="t2">hellofg</span>
  <span class="t3">hellofg</span>
  <span class="t4">hellofg</span>
</main>

A: The information available online around this change is quite confusing. You can use font-variation-settings to set the font weight and that will work, but the actual problem here was just that the @font-face was missing a font-weight in the declaration:
@font-face {
  font-family: 'Inter';
  /* need to specify a range of weights that are covered by this font face declaration */
  font-weight: 100 900;
  src: url(data:application/font-woff2;charset=utf-8;base64,[encoded data, 19728 characters]) format('woff2');
}

If you set the font-weight in the declaration, you get what the original asker was expecting without needing to use the font-variation-settings property. For example, this will now work:
h1 {
  font-family: Inter, sans-serif;
  font-weight: bold;
}

In Kaiido's answer they mentioned using the following import along-side font-variation-settings:
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200..900');

That doesn't seem to be necessary; if you inspect the source for the imported CSS you can see that it includes font-weight settings for the @font-faces, so it should work fine with regular font-weights.
There's some more information on this available on the MDN font-weight page and the MDN variable fonts guide.

A: @font-face {
font-family: 'Inter';
font-weight: 600; //700, 800 or ...
src: url(font);
}

A: As commented by @Kaiido:
font squirrel's generator apparently converts variable fonts to static/single-weight fonts.
This also applies to other converters like transfonter.
If you need to convert font files – make sure your converter definitely supports variable fonts.
Subset google fonts via subset query
To circumvent this problem you could retrieve an subsetted woff2 file via &text query parameter from google fonts like so:
https://fonts.googleapis.com/css2?family=Inter:wght@200..900&text=helofg

(resulting in a subset containing only the glyphs "h, e, l, o, f, g")
Test the returned @font-face output.
Due to googles user-agent detection, you might get static rules in some browsers – even though they support variable fonts flawlessly (e.g. chromium/blink based Opera browser). Firefox or Chrome should work perfectly.
Base64 Data-URL conversion
Use a "neutral" Base64 encoder that's only encoding the binary file without any font-optimizations.
See this answer by @Ilyich Converting and rendering web fonts to base64 - keep original look
Working example

body{
  font-size:5vw
}

@font-face {
  font-family: 'InterBase64';
  font-style: normal;
  font-weight: 200 900;
  src: url(data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAAmoABMAAAAAD9wAAAlCAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGjsbgWAcKj9IVkFSbAZgP1NUQVSBOABML2wRCAqFHIRICxIAMIlEATYCJAMgBCAFhVwHIAwHGzEOyMQoclo9uwtCgCUk44zO2IczzrKPywKFkkNWussKKVzdroT/UPAdDhmHrLflmPkz9lMWzig4Zc6PdfgeZ6z5//dzdW9oFav2EO9xu+9N3r8z/xvilv6hEgohcmgsYeKVVDmdHmmJhzmDpBOT1KkRmfhzJ7OBgEUwmg0qMCA1FM8SALmp944IE6xXQwDFUX8ApI3j9QfJTi3Kw0dgIqKmx0CVk1iSlxJKBjyOxJHrvzVqYFCGCK+Zhxli5aTDv0KtKAB4eVQMyiIzEM0s7D8g6CuM7CGPgmCG8tw5p4gAEVzXCTelvDRIlDE/w2GcAgxRSxMIZSuskukQ2ELAcqSl5EjB5dmeaHB5qvCINIVw1AoLtWEzQPuCQMKxICIx4wfObwwxQwT4DRWvAtO1RRp7A1a2ioGIJR3N8cAwANmF6TB33ox5sDYXypc2f0gApM1MMzjIOrVJXBlU21omkJTBr4RUbqkBU56eUUICgeKcvBLi8pMooYYWOkQjBj8jBxUw8q8lQUgxRR3pCfsmrhfRslKVkz7EjF7mhLqsH/FiygAmQRkSnDKQVcuDWCONmjDzm145R0eOSjUs4jjoUMplKAM1MpCDfGcF1UjdjKBPqYWupMvdN4nbgGXAHxLuwAnKzPJtAAkkQQIORU+U7OwcQANKA1HspF9d8rJxAA0XCeEbSwYCDzcZRNOVgFCKwDz5GYWKc06D4j8ts740/NpQis5LI4MSN9xlGBc0VNGHUyh+EFVzVS1zxeI7VDY8uEGEmw9ljW1t14FgEiS0t0sbnE6Ab2uTNXZ0xMc6nc5qKEhltdDRIWtsGxKz9by0wYnKyob29rj4nWFSCSttUUqJ1h4tI7JK3nmvqrGjg6So9bpWi6XVMk6WTpfrEEv9hOMzqiul1QVZ+v518J334ho7bhLhRmunTvDX217/CjMAsyRsMT1j3f3PYpJVfSfM1pLkdrdkTD5/ueKvWaf3FQ7pSFnv2FOb1nqilF/gaMi9/atpV4Wno+aPH5aF5maFzHr49cfF/9719mfoomD/wh74L0DsNFbvPhufF587YEd4a6/7E0vTSosgtiDU8POOl3Ebm8bOOl73NjFn++zGYy/2W3XKlT9W7flx2bGhu7fP8ri3/DjM+ueyPUk/1izv630EsfbcvjfaEjk7/fczQur/t29N/nDmD/Oyc8uTqGV9ivdcA1ThFosbErg9ykllnU0H1/yvphbnLruth0/Yt5UcSsw4DlU0IIEbEiCUV1/Wnd2V3OXZlao7e/my7uyuVE/XrmTd2UvX1rZuSPRbtSrRv3XT2rWtmxL9V61K9GvdAJy37MxwY+i5REYefhhW4wGZTy6Se0wkMyMMVvAM5BjQCHeIGlA6nWbzZB2E0RRhuUxKmOZcED0FJxCNQcI1EJGk2EpcsY/XP0Sj0Xzk53738q7D4bBYamqmSdw3m8NpDa3oPpG86U/vkFlxMZu32rvgEYSgHsGS7g8cxz1ofaadPdtme/+9AStgCVE6ORDa76iB5sAVRKv3mVue+Bn9FW/abTZbR7dqbgRq0QAjHIvY7XpaQcvZNc+HF0XiEt7hDTzlSdE3qjfWZSYDLNiK35kpiBbEHOfzSaSiWv9H5x3uy5dDQ70LDHQ2LCPaqEpY4asMxwFYdh0pnB6GJuZnDVfHkejIlIv1tlgqKmJiYj5VclfWrL3433Z3V3PzVrQIvB4m3EnwG67o9vl88oAIrMV6Lu1Jyc9GPdbjVSSdnZs3b97zQDVmCn6DBWYYUQwTduMelOBRIvB6qttSCKMJZNGtWuLzRdIv6NeHWqzKQbOxJGQR2foaamd3/4HDm3c43U6pRqMZN/ihzdUl02g0AZ5H5x+rtCqVQfOrb7hov8Gq1Wrupv340iNHYZccwxFBYLueYUkETaHf0gJ5tOCjvpSUgDsul+sd43W/5DiOsemdMFBg5b16wEBjsEcNe8bTP91aX8jmazxWPa2iMXWc1rOmcU84kcCDizCJv3huMpmaTHqaTfMkln3nHA7HtVNL9LSAZhPeGFkEJ06Io2z1T48W7zYajTu56CgsQhfpC0eFG2YeBYIArR5G2JmIL/MM2AyX7JGgdrvt7T6f79GdN4MH1rLKAJdLYMdNHAAD9sAydcwYrzWCplItrJDLnvcOrgjDnrrzlnxCZjxz36Ymna6piefXmubPN5lMoaGhLxxHLE2wCsipY3y+D7XMa7lOINE/hGMJ5uSRU6eHJxc5cGAqbi3diXb8jUd4hr/xQqkSPcNB+kWuHqfxgg+DRYCtjnE4XLXMX084Aesj6HdUiaHP0VAa4h/bQ60W7Qyb8BvLEIYxwEMPYHNtMImNTced+rtYlUajUbGuC/tbWloOXHA91yQkJHz83PVop3VTWx7i8nY9ZAru9VuO49684hQyuLEH13CR+6zadUfnqj/jLjaE0Zw66fDuazab7Vr38Lm/GNA0Wob9Za7WGUHzaAQslUec2ijweEDk0BkPwPOYfVltKhJzoLUiCk4s4gywY3cjO1LytMEQr4lteCoZ6b5AHfi3DSLuxofRvkLd/WsTlrs9SxH65KfAL15KBsi8TsCtf44PWCxzO3Z2++t7vhpV1msZiu90LAF/q5k3hH99z+tVZT3PYXhbidSDN+IMmNk3iBYfgFnMo5OxoFNshpnte+cMT4IlkKMAfklRtBvoiWfvFnbOv2Eyv4NInJNCUpg3lEEAVlEW49BMOfRHJxVhMv6hYvQnwzMDEEoMhUgg5KSMKiAltTQIEtJEe0JJltBekJJmRZ/8e5B+kJN9SAdAQU7REEjIRToQwaT9eoMgJS6EIx8FqEQRMpGODJRAjQkYNzmMGjHIQCrUmII8lCAVRdhxNoqQj6wGJkdcXI9SlCAD+ShCcR2HE/hLUCCHfoaxGIt0ZAYuX4okjEEy8pGLsRH9uShGayaxckQuv3EuUpGOUuQgEUWYiDEYh/H4FJ9jLuZhBubhcznV6MaE0k6ixDjhL0amEHn1CaS8lD/paIxDIiZhPMZhMlIxDkm56JnyulyMZDOKgroolpCHnIMxhlksHWMxC1GYjnihNzXOowBiMDSYwR+JChRF0jo9wrjV4jOQihRkohS5mNcguX0NyEcOUrrjEo9TQg5yMrLfm7Utd/e4T5TJhp2PEDp/D7cA);
}

/* format("woff2-variations") */

@font-face {
  font-family: 'InterSub';
  font-style: normal;
  font-weight: 200 900;
  src: url(https://fonts.gstatic.com/l/font?kit=UcC73FwrK3iLTeHuS_fvQtMwCp50KnMq14D4FCBW97h6&skey=c491285d6722e4fa&v=v12) format('woff2');
}

.InterBase64{
  font-family: 'InterBase64';
  font-weight: 400;
}

.interSub{
  font-family: 'InterSub';
}

.t1 {
  font-weight: 200;
}

.t2 {
  font-weight: 600;
}

.t3 {
  font-weight: 900;

}

.variableTest{
  transition: 0.5s;
}
  <p style="font-family:sans-serif; font-size:12px">Font-weight: <input type="range" id="fontWeight" value="100" min="100" max="900" step="50"></p>
  <p id="variableTest" style="font-weight:100" class="InterBase64 variableTest">hellofg</p>

  <div class="InterBase64">
    <span class="t1">hellofg</span>
    <span class="t2">hellofg</span>
    <span class="t3">hellofg</span>
  </div>

  <div class="interSub">
    <span class="t1">hellofg</span>
    <span class="t2">hellofg</span>
    <span class="t3">hellofg</span>
  </div>

  <script>
    fontWeight.addEventListener('change', (e) => {
      variableTest.style.fontWeight = e.currentTarget.value;
    })
  </script>

The above excerpt shows a range slider that seamlessly interpolates the font-weight. If you see fine-grained transitions, you have applied the correct variable font format.
As suggested by @gpoole add a font-weight range like font-weight:200 900 to you @font-face rule for best compatibility.


text:
Q: Make PHP login and show selected fields of SQL database how to make php user login and after login show selected feilds of sql database in the web page

A: The easiest way for you to get started would be to use Basic Auth.  See http://php.net/manual/en/features.http-auth.php
Now, all that does is get you a username and password, but saves you the hassle from building a login form and dealing with sessions for the moment.  (Later on, investigate sessions.)
After you get that far, make a new question on Stack Overflow with your specific question for querying a database.  Be sure to include what DB server you are using, your DB schema, and what you have tried thus far.


text:
Q: Mulesoft: taking more than 3 min to generate txt file We are reading a txt file which is size of less than 100 KB and generating output txt file using below transformation logic. To generate output txt file in production, it is taking more than 3 minutes . Is there anyway to reduce processing time.

*

*Mule Runtime: 4.2.1

import * from dw::core::Strings
//output application/csv
output application/flatfile schemaPath = "output-fixed-witdh.ffd" , segmentIdent = "output-fixed-witdh"
---

payload map {
    FirstName_Out: $.ParticipantFirstName,
    LastName_Out: $.ParticipantLastName,
    IssueDate_Out: ($.ReimbursementDate splitBy ("/") map (if(sizeOf($)==1) "0" ++ $ else $) joinBy "/")  as Date {format: "MM/dd/yyyy"} as String {format: "MMddyy"},
    Amount_Out: ($.Amount as Number*100) as String {format: "0000000000"},
    CheckType_Out: $.Method,
    CheckNumber_Out: $.PaymentNumber
}

Below is the schema used:
form: FIXEDWIDTH
id: 'output-fixed-witdh'
name: 'output-fixed-witdh'
values:
- { name: 'FirstName_Out', usage: M, type: String, length: 20 }
- { name: 'LastName_Out', usage: M, type: String, length: 20 }
- { name: 'IssueDate_Out', usage: M, type: String, length: 6 }
- { name: 'Amount_Out', usage: M, type: String, length: 10 }
- { name: 'CheckType_Out', usage: M, type: String, length: 2 }
- { name: 'CheckNumber_Out', usage: M, type: String, length: 8 }

A: I would say it is Windows issue. Try it on Linux. We have app which does work on Windows for 6 hours and 10 minutes on Linux. Give it a try.


text:
Q: How can I enable ssh onTP-Link TD-W8961N? I was trying to work on AAA (authentication authorization and accounting) project but my keep facing access denied (permission denied) issue. Telnet works, but how can I enable SSH on this router?

A: If you get permission denied errors SSH is already enabled.
But the user-account you use to attempt to login doesn't have permission.
I'm not familiar with that particular router, but usually you need to configure somewhere in the router which accounts have permission for which of the various management interfaces.
(And please disable telnet asap. It is very insecure because it doesn't do any encryption and will happily send everything (including your user-name and password when you login) in plain text over the network.)


text:
Q: Converting List to Datatable to be passed a table type in Stored proc I have a Web API call where I'm sending a list of objects to a stored proc. I am creating a datatable to be sent to my stored proc however when I try to add to my datatable it returns back a 500 status right away.
    private static DataTable CreateTable()
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("Project_Name", typeof(int));
        dt.Columns.Add("Project_Staffing_Period", typeof(DateTime));
        dt.Columns.Add("Employment_Start_Date", typeof(DateTime));
        dt.Columns.Add("Employment_Rate_Type_Code", typeof(string));
        dt.Columns.Add("Employment_Rate_Effective_Date", typeof(DateTime));
        dt.Columns.Add("Company_ID", typeof(int));
        dt.Columns.Add("Person_ID", typeof(int));
        dt.Columns.Add("Project_Role_Type_Code", typeof(string));
        dt.Columns.Add("Staffed_Hours", typeof(decimal));
        dt.Columns.Add("CreateID", typeof(string));
        dt.Columns.Add("CreateTS", typeof(DateTime));
        dt.Columns.Add("UpdateID", typeof(string));
        dt.Columns.Add("UpdateTS", typeof(DateTime));
        return dt;
    }

This is my DataTable format.
    public class ProjectStaffing
    {
        public string ProjectName { get; set; }
        public DateTime ProjectStaffingPeriod { get; set; }
        public DateTime EmploymentStartDate { get; set; }
        public string EmploymentRateTypeCode { get; set; }
        public DateTime EmploymentRateEffectiveDate { get; set; }
        public int CompanyID { get; set; }
        public int PersonID { get; set; }
        public string ProjectRoleTypeCode { get; set; }
        public decimal StaffedHours { get;set; }
        public string CreateID { get; set; }
        public string UpdateID { get; set; }
        public DateTime CreateTS { get; set; }
        public DateTime UpdateTS { get; set; }

Here is my class format

        public async Task<string> CreateProjectStaffingByDateRange(List<ProjectStaffing> projectstaffings)
        {
            string statusMessage;
            DataTable dt = CreateTable();

            for(int i = 0; i < projectstaffings.Count; i++)
            {
                dt.Rows.Add(projectstaffings[i].ProjectName, projectstaffings[i].ProjectStaffingPeriod,
                    projectstaffings[i].EmploymentStartDate, projectstaffings[i].EmploymentRateTypeCode,
                    projectstaffings[i].EmploymentRateEffectiveDate, projectstaffings[i].CompanyID,
                    projectstaffings[i].PersonID, projectstaffings[i].ProjectRoleTypeCode, projectstaffings[i].StaffedHours,
                    projectstaffings[i].CreateID, projectstaffings[i].CreateTS, projectstaffings[i].UpdateID, projectstaffings[i].UpdateTS);
            }

            using (SqlConnection conn = new SqlConnection(Connection))
            {
                conn.Open();
                SqlParameter returnValue; //Holds the bit that determines if insert was successful or not
                SqlCommand command;
                returnValue = new SqlParameter();
                command = new SqlCommand();
                command.Connection = conn;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "USP_Add_Project_Staffing_By_Date_Range";
                command.Parameters.AddWithValue("@TempTable", dt);

                command.Parameters.Add(new SqlParameter("@statusMessage", SqlDbType.NVarChar, -1)).Direction = ParameterDirection.Output;
                returnValue.Direction = ParameterDirection.ReturnValue;
                command.Parameters.Add(returnValue);

                await command.ExecuteNonQueryAsync().ConfigureAwait(false);
                statusMessage = command.Parameters["@statusMessage"].Value.ToString().Trim();
            }
            return statusMessage;
        }

This is my call to the server. and where I add the rows to my datatable is where it fails and returns a 500 status.
Am I inserting into my datatable incorrectly? I matched the datatypes. I have check the ordering that I am inserting. All the values are not null.
Some sample values could be
ProjectName: "Project 1"
ProjectStaffingPeriod: "Oct 4, 2019"
EmploymentStartDate: "Oct 4, 2019"
EmploymentRateTypeCode: "NA Rate"
EmploymentRateEffectiveDate: "Oct 4, 2019"
CompanyID: 1
PersonID: 1
ProjectRoleTypeCode: "BA"
StaffedHours: 8.0
CreateID: "person1"
UpdateID: "person1"
CreateTS: "Oct 4, 2019 11:00 AM"
UpdateTS: "Oct 4, 2019 11:00 AM"

A: I don't know about the rest of your set up but you seem to add the column  project name as an int to the datatable
    dt.Columns.Add("Project_Name", typeof(int));

but it is a String in your class
    public string ProjectName { get; set; }


text:
Q: How To Prevent Query String but use routes in Html.BeginForm (GET)? I have a search page. I a search-panel I filled a model like this:
public class SearchVm
{
    public long? CategoryId { get; set; }
    public long? ProductId { get; set; }
    public DateTime? FromDate { get; set; }
    public DateTime? ToDate { get; set; }
    public string Text { get; set; }
}

And as we are interested in SEO,So I want use GET Method, to get search result. so my form is like this:
@using (@Html.BeginForm("Search", "Products", FormMethod.Get))
{...}

And here is action signature:
 public ActionResult Search(SearchVM esm){...}

But my URL is so ugly and if I don't fill property "IT IS" in URL as a query string:
http://localhost:8080/Products/Search?CategoryId=2&ProductId=&Text=&FromDate=&ToDate=
Here in this URL,I just filled "CategoryId"!
But how can I have a dynamic route for my searches like this:
"Products/Search/cat{CategoryId}/prod{ProductId}/{Text}/{FromDate}/{ToDate}"
"Products/Search/prod{ProductId}/{Text}/{FromDate}/{ToDate}"
"Products/Search/prod{ProductId}"
"Products/Search/cat{CategoryId}"
"Products/Search/{FromDate}/{ToDate}"
"Products/Search/{FromDate}"

Actually How Can I have all of these combination to be redirected to same action

A: Actually, you should use the query param for your search fields and not path param. But if you insist, use route attribute(System.Web.Mvc.Route) on your action like this:
Route("Products/Search/{FromDate}")

use all of the routes you would like to fire the related "ActionResult" method


text:
Q: Apollo server context initialization function parameter? In Apollo server docs, Apollo server constructor  run with some configurations, one of them is a context  initialization function  that is called with every request, and according to the docs, this function parameter is an object that get the request (req) automatically as one field of that object.
const server = new ApolloServer({
  typeDefs,
  resolvers,
  context: ({ req }) => ({
    authScope: getScope(req.headers.authorization)
  }),
});

This is ok for me, but in one project i got from Github that creates a what's app clone, the parameter object is different which i couldn't relate, something i searched for and i couldn't find anything can relate
export const server = new ApolloServer({
  schema: rootModule.schema,
  context: (session: any) => {
    if (session.connection) {
      const req = session.connection.context.session.request;
      const cookies = req.headers.cookie;

      if (cookies) {
        req.cookies = cookie.parse(cookies);
      }
    }

    return rootModule.context(session);
  },
});

The context function parameter is a session object, and the developer need to get the request from that session object using that verbose code:
 const req = session.connection.context.session.request;

I searched about that session parameter but couldn't find anything in the docs or anywhere else
I am confused about this inconsistency, or am i missing something?

A: In general, the actual context object can change dependending on the apollo server configuration (see: https://www.apollographql.com/docs/apollo-server/v2/api/apollo-server#middleware-specific-context-fields)
My guess in the "WhatsApp-clone", the parameter comes from the subscription support of Apollo Server (here as in the github repo from Version 2):  https://www.apollographql.com/docs/apollo-server/v2/data/subscriptions/#operation-context
For whatever reason the argument in the example project is called session it is propably that object described in the documentation.
The subscription support is added here to the example server: https://github.com/Urigo/WhatsApp-Clone-Server/blob/master/index.ts#L13


text:
Q: Android NDK socket creation null pointer For adding TCP-socket-options, I need to use the C-sockets of Android NDK instead of Java sockets. The following function is called by a button-click-event.
When creating such a socket, the syscall leads me to a null pointer (see log output at the end).
As the log shows, the line above gets called (Create Socket) but then (so it has to be in the socket()-call), the app crashes due to a null pointer before it is possible to evaluate the return value.
What did I do wrong?
#include <jni.h>
#include <string.h>
#include <android/log.h>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

#define DEBUG_TAG "NDK_AndroidNDK1SampleActivity"

void error(const char *msg)
{
    __android_log_print(ANDROID_LOG_DEBUG, DEBUG_TAG, "NDK:LC: [%s]", msg);
    exit(0);
}

int Java_com_example_ndk1_AndroidNDK1SampleActivity_sendUrgent(JNIEnv * env, jobject this,
        jstring jurl, int portno, jstring jdata, jboolean jSetUrgentFlag)
{

    int sockfd = 0;
    error("Create Socket");
    sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    error("Socket created");
    if (sockfd < 0)
        error("ERROR opening socket");
    return 1;
}

05-18 14:47:54.002  11500-11500/com.example.ndk1 D/NDK_AndroidNDK1SampleActivity﹕ NDK:LC: [Create Socket]
05-18 14:47:54.022     780-1221/? I/WindowState﹕ WIN DEATH: Window{42bde4f8 u0 com.example.ndk1/com.example.ndk1.AndroidNDK1SampleActivity}
05-18 14:47:54.022     780-1222/? I/ActivityManager﹕ Process com.example.ndk1 (pid 11500) has died.
05-18 14:47:54.022     780-1222/? W/ActivityManager﹕ Force removing ActivityRecord{42ae6278 u0 com.example.ndk1/.AndroidNDK1SampleActivity t17}: app died, no saved state
05-18 14:47:54.062     988-1000/? W/Binder﹕ Caught a RuntimeException from the binder stub implementation.
    java.lang.NullPointerException
            at android.inputmethodservice.IInputMethodWrapper.setSessionEnabled(IInputMethodWrapper.java:280)
            at com.android.internal.view.IInputMethod$Stub.onTransact(IInputMethod.java:129)
            at android.os.Binder.execTransact(Binder.java:404)
            at dalvik.system.NativeStart.run(Native Method)

dmesg-log:
<3>[11101.768759] init: untracked pid 11500 exited

A: Remove the "exit(0)" from the void error() functions


text:
Q: Remove Unlisted Application I am running Fedora 37 on my home computer, and have attempted to install Amazon Workspaces via Flatpak, which was successful (package: 'app/com.amazon.Workspaces/x86_64/stable').  I was having issues with the application and had attempted to uninstall it - which according to Flatpak's CLI, was successful. Within the 'Software' store, it also shows the application as an install candidate and not currently installed. However, this application is listed in my app drawer, and can successfully launch.
I am making the assumption that this may have been installed by dpkg but cannot be certain. It does not show as an installed package when I attempt to dnf remove it does not show as an installed candidate, nor is it found when I run rpm -qa | grep work .
If I attempt to "open files" from Task Manager when launching the app, it crashes. If I check the running process, I can locate the running app:
↪ ps -aux | grep works
michael+   13267  1.8  0.4 4462024 144492 ?      Sl   10:25   0:01 /opt/workspacesclient/workspacesclient

I can simply delete the directory (once ending all process), but is this the cleanest method to do? What am I missing in terms of package managment?


text:
Q: Why the original window doesn't close after submit?

function login() {
  var un = document.getElementById("username").value;
  var pw = document.getElementById("password").value;
  if (un == "admin" && pw == "admin") {
    window.open("TXL.html", '_blank');
    this.window.close();
    return true;
  }
  else {
    alert("FAIL");
    return false;
  }
}

  <form action="" class="form center-block" onsubmit="login()">

      <input type="text" id="username" class="form-control input-lg" placeholder="">

      <input type="password" id="password" class="form-control input-lg" placeholder="">

      <button class="btn btn-primary btn-lg btn-block" type="submit">Login</button>

  </form>

The login-window just refresh after submit.
And I tried "window.open("TXL.html", '_self');" and it doesn't work,even can't open the new window.
I also tried window.location.href=""; ,it still doesn't work.
Thanks for reading!

A: Working fiddle.
You've to add return in the onsubmit event :
<form action="" class="form center-block" onsubmit="return login()">

Hope this helps.

A: <form action="" class="form center-block" onsubmit="login()">
Maybe i should use 'onclick' instead of 'onsubmit'?


text:
Q: How can I deploy a MySQL database to Docker? I want to deploy MYSQL Database to Docker container but I don't know how can I do that. I deployed my Spring Boot project and works fine. I created Dockerfile in this project:
FROM openjdk:8-jre-alpine
ADD ./target/Family-0.0.1-SNAPSHOT.jar Family-0.0.1-SNAPSHOT.jar
EXPOSE 8081
ENTRYPOINT ["java", "-jar", "Family-0.0.1-SNAPSHOT.jar"]

But I don't know how can I do with MySQL. I used MySQL Workbench when I created my database.

A: Ideally docker containers should one one service at a time, that means that you would have:

*

*app-docker-container: Container with your Java application

*db-docker-container: Container with your database

And then link the database db-docker-container to the app-docker-container. But this involves too many manual commands that might confuse you more, as an starting point I would suggest you to use docker-compose (link to an example).

A: You need to simply add MYSQL original image from docker-hub
https://hub.docker.com/_/mysql/ --> check for various in line commands to run
Add docker-compose.yml to link both the microservice and database.
https://github.com/thoopalliamar/Spring-Boot-And-Database-Docker -->check this to refer docker-compose.
network mode and hostname creates a network and links between them.
You need to stop the mysql in localmachine and to get into docker of mysql
sudo docker mysql -u root -p
to check the databases


text:
Q: Getting Your connection is not secure with marionette firefox selenium 3.0 grid I have updated the web driver to selenium 3.0.1
When i use firefox browser and try to open the https website I get Your connection is not secure exception.
With selenium 2.53.1 web driver below code was working fine.
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("acceptSslCerts", "true");
driver = new RemoteWebDriver(new URL(hubUrl), caps);

As selenium 3.0.1 uses marionette to run latest firefox browsers i tried below 2 code. but both did work
1.
        FirefoxProfile profile = new FirefoxProfile();
        profile.setPreference("acceptSslCerts", "true");
        caps = DesiredCapabilities.firefox();
        caps.setCapability("marionette", true);
        caps.setCapability(FirefoxDriver.PROFILE, profile);
        driver = new RemoteWebDriver(new URL(hubUrl), caps);

2.
        caps = DesiredCapabilities.firefox();
        caps.setCapability("marionette", true);
        caps.setCapability("acceptSslCerts", "true")
        driver = new RemoteWebDriver(new URL(hubUrl), caps);

Here is the screenshot

Anyone tried to access https websites using seleniumGrid/selenium 3.0/marionette
Can someone point-out how to overcome this issue. I have multiple selenium grids with 20+nodes. Installing the certificate on each is not feasible. I this we need a proper solution to this when used.
Thanks
Shankar KC


text:
Q: SQL Full Text Index on multiple tables and columns We have electronic forms that filers fill out online and we store the data in an SQL Server.  We want to provide a search feature that allows us to search inside each electronic filing for matching keywords.  We don't need to know what word matched or where in the form it matches, we just need a ranked list of forms that match our keywords. We think SQL Full-Text Searching would be our best option because we are already using SQL server 2016.  We just started with implementing a solution but would like some guidance since this is new territory for us.
Here is an example of how our tables are structured.
Filing is our top-level table for all electronic forms.  We have sub tables that are all related through the FilingId.  The Form Six Published Filings table has child tables to store information like Assets.  The Form One Published Filings table has child tables to store information like Liabilities.

CREATE SCHEMA [Forms]
GO
CREATE SCHEMA [Form6]
GO
CREATE SCHEMA [Form1]
GO
CREATE TABLE [Forms].[Filing](
       [FilingId] INT NOT NULL IDENTITY(1,1)
              CONSTRAINT [PK_Forms_Filing_FilingId] PRIMARY KEY CLUSTERED,
       [FilerUserId] [int] NOT NULL,
       [FormYear] [int] NOT NULL,
       [FormTypeId] [int] NOT NULL,
       [FilingStatusId] [int] NOT NULL,
       [FilerSignatureId] INT NULL,
       [SubmissionDate] DATETIME2(0) NULL,
    [IsScannedForm] BIT NOT NULL
        CONSTRAINT [DF_Forms_Filing_IsScannedForm] DEFAULT(0)
)
GO
CREATE TABLE [Form6].[FormSixPublishedFilings](
       [FormSixPublishedFilingId] INT NOT NULL IDENTITY(1,1)
           CONSTRAINT [PK_Form6_FormSixPublishedFilings_FormSixPublishedFilingId] PRIMARY KEY CLUSTERED,
       [FilingId] INT NOT NULL
       CONSTRAINT [FK_Form6_FormSixPublishedFilings_Filings] FOREIGN KEY ([FilingId]) REFERENCES [Forms].[Filing] ([FilingId]),
       [LastDateOfEmployment] DATE NULL,
    [NetWorthDate] DATE NULL,
       [NetWorth] MONEY NULL
)
GO
CREATE TABLE [Form6].[FormSixPublishedAssets](
       [FormSixPublishedAssetId] INT NOT NULL IDENTITY(1,1)
        CONSTRAINT [PK_Form6_FormSixPublishedAssets_FormSixPublishedAssetId] PRIMARY KEY CLUSTERED,
       [FormSixPublishedFilingId] INT NOT NULL
        CONSTRAINT [FK_Form6_FormSixPublishedAssets_FormSixPublishedFilings] FOREIGN KEY ([FormSixPublishedFilingId]) REFERENCES [Form6].[FormSixPublishedFilings] ([FormSixPublishedFilingId]),
       [Name] VARCHAR(8000) NOT NULL,
    [Amount] MONEY NOT NULL
)
GO

CREATE TABLE [Form1].[FormOnePublishedFilings]
(
       [FormOnePublishedFilingId] INT NOT NULL IDENTITY(1,1)
           CONSTRAINT [PK_Form1_FormOnePublishedFilings_FormOnePublishedFilingId] PRIMARY KEY CLUSTERED,
    [FilingId] INT NOT NULL,
        CONSTRAINT [FK_Form1_FormOnePublishedFilings_Filing] FOREIGN KEY ([FilingId]) REFERENCES [Forms].[Filing] ([FilingId]),
    [HasServedAsAgent] BIT NULL,
    [LastDateOfEmployment] DATE NULL,
    [AmendmentReason] VARCHAR(1024) NULL,
)
GO

CREATE TABLE [Form1].[FormOnePublishedLiabilities]
(
       [FormOnePublishedLiabilityId] INT NOT NULL IDENTITY(1,1)
              CONSTRAINT [PK_Form1_FormOnePublishedLiabilities_FormOnePublishedLiabilityId] PRIMARY KEY CLUSTERED,
       [FormOnePublishedFilingId] INT NOT NULL,
           CONSTRAINT [FK_Form1_FormOnePublishedLiabilities_FormOnePublishedFilings] FOREIGN KEY ([FormOnePublishedFilingId]) REFERENCES [Form1].[FormOnePublishedFilings] ([FormOnePublishedFilingId]),
       [NameOfCreditor] VARCHAR(8000) NOT NULL,
       [AddressOfCreditor] VARCHAR(8000) NOT NULL
)
GO

In order to be able to search through all the forms, I think we need to create a view that just has two columns. One for the FilingId and the other column would be an XML data type which would be an XML representation of all the data in each electronic filing. This XML column is what we will be using to set up our full-text index. I think we will be using the FreeTextTable search because we would like to have the results ranked and also the search terms will be entered by end-users.
create view ViewForFullTextSearching with schemabinding as
select f.FilingId,
    (select
        filing.FilingId
        ,filing.FormYear
        ,filing.FormTypeId
        ,filing.FilingStatusId
        ,filing.FilerSignatureId
        ,filing.SubmissionDate
        ,filing.IsScannedForm
        ,form6Filing.LastDateOfEmployment 'Form6LastDateOfEmployment'
        ,form6Filing.NetWorthDate
        ,form6Filing.NetWorth
        ,form6Asset.Name
        ,form6Asset.Amount
        ,form1Filing.HasServedAsAgent
        ,form1Filing.LastDateOfEmployment 'Form1LastDateOfEmployment'
        ,form1Filing.AmendmentReason
        ,form1Liability.NameOfCreditor
        ,form1Liability.AddressOfCreditor
    from Forms.Filing filing
    left join Form6.FormSixPublishedFilings form6Filing on filing.FilingId = form6Filing.FilingId
    left join Form6.FormSixPublishedAssets form6Asset on form6Filing.FormSixPublishedFilingId = form6Asset.FormSixPublishedFilingId
    left join Form1.FormOnePublishedFilings form1Filing on filing.FilingId = form1Filing.FilingId
    left join Form1.FormOnePublishedLiabilities form1Liability on form1Liability.FormOnePublishedFilingId = form1Filing.FormOnePublishedFilingId
    where filing.FilingId = f.FilingId
    for xml auto, type
    ) as 'Filing'
from Forms.Filing f
GO
create unique clustered index [IX_ViewForFullTextSearching_FilingId] ON [Forms].[ViewForFullTextSearching] ([FilingId])
GO

The above SQL does not actually work because I get this error.

Cannot create an index on view "EthicsFdms.Forms.ViewForFullTextSearching" because it contains one or more subqueries. Consider changing the view to use only joins instead of subqueries. Alternatively, consider not indexing this view.

So, I'm a bit lost on how to create a view with XML to search over if I'm not allowed to create a materialized view that has subqueries.
This view results look like this:

Next we setup our Full Text Catalog and Index on this view:
CREATE FULLTEXT CATALOG [FtcFilings];
GO
CREATE FULLTEXT INDEX ON [Forms].[ViewForFullTextSearching] ([Filing] language 1033) key index [IX_ViewForFullTextSearching_FilingId] on [FtcFilings];
GO

Then I was hoping we could search the filings like so:
select ftt.*
from [Forms].[Filing] filing
inner join freetextable(Forms.ViewForFullTextSearching, Filing, 'APPLE') as ftt on filing.FilingId = ftt.[KEY]
order by rank desc

Right now my challenges are, is it possible to create a materialized view like this? Seems like I can't because materialized views can't have subqueries. I'm not sure how to build the XML field w/out subqueries.
If I'm not able to create a materialized view then how else can I create a full-text index that can search electronic Forms?

A: You cannot create an indexed view (which is a synchronous materialized view in SQL Server) only if there is a mathematical surjection and all scalar computation is deterministic and precise. By the way OUTER JOIN, SUBQUERIES and set operators (UNION, EXCEPT, INTERSECT) cannot be used...
The best ways to design your systeme is to do it in the reverse way...

*

*Create a persistent computed column using the CONCAT function of all the columns you want to fulltext index.

*Create fulltext indexes on the computed columns

*Create an UDF that search in the fulltext index on each tables and concatenate the result by UNION, and then aggregate results to     compute the rank.

Let me know if you want more assistance to do so...

A: If these form filling data are seldom changed once created and it makes sense in business to store data of form1 and form6 together with its Filling, you may consider to go with document oriented design.
SQL server has good json support now. You can save all the Filling and form info in json, against which you can do full text search, and create views to simulate your current design if needed.
Here is an example -
    create table tst.form (
      form_id int not null identity primary key
     ,content_json nvarchar(max)
    )

-- inside content_json, the json may look like -
{
  "filler_user_id": 111,
  "filler_type_id": 1,
  "is_scanned_form": 1,
  "form1": [
    {
      "form1_filling_id": 101,
      "has_served_as_agent":0,
      "liabilities": [{"name_of_creditor": "abc"}]
    }
  ]
}

I only modelled form1 related info. You can add form6 related info as needed.
Then you can do full text search against this content_json column.
Then create views to simulate your current design if needed -
create or alter view tst.form_base WITH SCHEMABINDING as
select form_id
      ,convert(int, JSON_VALUE(content_json, '$.filler_user_id')) filler_user_id
      ,convert(int, JSON_VALUE(content_json, '$.filler_type_id')) filler_type_id
      ,convert(bit, JSON_VALUE(content_json, '$.is_scanned_form')) is_scanned_form
      ,JSON_QUERY(content_json, '$.form1') form1_json
  from tst.form

create unique clustered index idx_form_base_form_id on tst.form_base(form_id);
-- you can create index as needed
create index idx_form_base_filler_user_id on tst.form_base(filler_user_id);

create or alter view tst.form1 as
select form_id
      ,a.form1_filling_id
      ,a.has_served_as_agent
      ,a.liabilities liabilities_json
  from tst.form_base cross apply OPENJSON(form1_json) WITH (
                                 form1_filling_id int '$.form1_filling_id',
                                 has_served_as_agent int '$.has_served_as_agent',
                                 liabilities nvarchar(max) '$.liabilities' as json) a

create or alter view tst.form1_liabilities as
select form_id
      ,form1_filling_id
      ,a.name_of_creditor
  from tst.form1 cross apply OPENJSON(liabilities_json) WITH (
                                 name_of_creditor nvarchar(max) '$.name_of_creditor') a

Then create some test data -
insert into tst.form (content_json) values ('{
  "filler_user_id": 111,
  "filler_type_id": 1,
  "is_scanned_form": 1,
  "form1": [
    {
      "form1_filling_id": 101,
      "has_served_as_agent":0,
      "liabilities": [{"name_of_creditor": "abc"}]
    }
  ]
}');

insert into tst.form (content_json) values ('{
  "filler_user_id": 222,
  "filler_type_id": 1,
  "is_scanned_form": 0,
  "form1": [
    {
      "form1_filling_id": 102,
      "has_served_as_agent":1,
      "liabilities": [{"name_of_creditor": "def"}]
    }
  ]
}');

Try it -
select *
  from tst.form1_liabilities


text:
Q: Python dict question. How to group similar strings? for i in names:
    dict[i] = {'firstname': name[i]['firstname'],
               'lastname': name[i]['lastname']}
    print dict[0]['firstname'] # John
    print dict[0]['lastname'] # Doe

    # group similar lastnames, along with their firstnames
    # ...
return render_to_response('index.html', dict)

I want to group names that end with similar last-names.
For example, the output should be:
<html>
  <body>
    <h1> Doe </h1>
    <p> John, Jason, Peter </p>

    <h1> Avery </h1>
    <p> Kelly, Brittany </p>
  </body>
</html>

The 'h1' tags are supposed to contain the last-names and the 'p' tags the first-names.
How should I do this?

A: You mean something like this:
import collections

data = [
    {'firstname': 'John', 'lastname': 'Smith'},
    {'firstname': 'Samantha', 'lastname': 'Smith'},
    {'firstname': 'shawn', 'lastname': 'Spencer'},
]

new_data = collections.defaultdict(list)

for d in data:
    new_data[d['lastname']].append(d['firstname'])

print new_data

Output :
defaultdict(<type 'list'>, {'Smith': ['John', 'Samantha'], 'Spencer': ['shawn']})

in your template do:
{% for lastname, firstname in data.items %}
    <h1> {{ lastname }} </h1>
    <p> {{ firstname|join:", " }} </p>
{% endfor %}

output:
<h1> Smith </h1>
<p> John, Samantha </p>

<h1> Spencer </h1>
<p> shawn </p>

A: You may also use groupby after you have sorted the names. You can see it here: http://docs.python.org/library/itertools.html#itertools.groupby


text:
Q: iphone gdb breakpoint is not working my iphone(and my friend's iphone too)'s breakpoint(in gdb) is not working!
i'm downloaded gdb in cydia
does any one knows about this problems ?
Tester-ui-iPhone:/tmp root# uname -a
Darwin Tester-ui-iPhone 11.0.0 Darwin Kernel Version 11.0.0: Tue Nov  1 20:33:22 PDT 2011; root:xnu-1878.4.46~1/RELEASE_ARM_S5L8920X iPhone2,1 arm N88AP Darwin
Tester-ui-iPhone:/tmp root# gdb test
GNU gdb 6.3.50.20050815-cvs (Fri May 20 08:08:42 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=arm-apple-darwin9 --target="...
Reading symbols for shared libraries . done

(gdb) b main
Breakpoint 1 at 0x2d2e
(gdb) r
Starting program: /private/var/tmp/test
Syntax: /private/var/tmp/test <arg>
Program exited with code 01.
(gdb)

A: Are you trying to breakpoint in a specific app?
If so, you need to attach to the process first with
attach target
For example you want to attach to Fruit Ninja game. When attaching the you need to attach to the binary part which is not always the same as the app name.
attach Fruit
Alternatively you could search for a process id and attach to that.
Once you are attached you can set a breakpoint using
b *0x00123456
or if you have the function name
b function()
If you experience any crashing, try this
handle SIGKILL stop


text:
Q: Error al crear Job ORACLE ---ORA-06550 estoy creando un Job en Oracle, la cual ejecutara todos los dias a las 00:00 Horas un procedimiento almacenado.
Al crearlo arroja el siguiente error.
Fallo al procesar el comando SQL
- ORA-06550: línea 19, columna 5:
PLS-00103: Se ha encontrado el símbolo "DBMS_SCHEDULER" cuando se esperaba uno de los siguientes:

   ;
El símbolo ";" ha sido sustituido por "DBMS_SCHEDULER" para continuar.

Este es el codigo.
BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
            job_name => '"VINCULADO"."JobBorrado"',
            job_type => 'STORED_PROCEDURE',
            job_action => 'VINCULADO.ELIMINACIONLOG',
            number_of_arguments => 0,
            start_date => TO_TIMESTAMP_TZ('2022-02-01 00:00:00.000000000 AMERICA/BOGOTA','YYYY-MM-DD HH24:MI:SS.FF TZR'),
            repeat_interval => 'FREQ=DAILY;BYTIME=230000;BYDAY=MON,TUE,WED,THU,FRI,SAT,SUN',
            end_date => TO_TIMESTAMP_TZ('2050-01-01 00:00:00.000000000 AMERICA/BOGOTA','YYYY-MM-DD HH24:MI:SS.FF TZR'),
            enabled => FALSE,
            auto_drop => FALSE,
            comments => '');

    DBMS_SCHEDULER.SET_ATTRIBUTE(
             name => '"VINCULADO"."JobBorrado"',
             attribute => 'logging_level', value => DBMS_SCHEDULER.LOGGING_OFF);

null
    DBMS_SCHEDULER.enable(
             name => '"VINCULADO"."JobBorrado"');
END;

Al procedimiento almacenado al hacerle un EXECUTE, lo ejecuta sin problema.


text:
Q: Reversing the order of displayed data from a SELECT query My website (thanks to help from many of you here on SO) is set up to display a fixed number of updates (52) where each Friday, one rotates out, and a new one rotates in. The 52 updates are displayed 4 per page across 13 pages. It works perfectly.
However, the new update appears at the END of the displayed updates. I would like the new update to be the first one people will see.
Here is my query:
$conn = dbConnect('query');
$updates = "SELECT update_id, update_title, update_desc, path
    FROM updates
    WHERE flag_live = ?
    ORDER BY update_id DESC
    LIMIT ?, ?";
$stmt = $conn->prepare($updates);
$stmt->bind_param('sii', $uLive, $offset, $limit);
$stmt->bind_result($uId, $uTitle, $uDesc, $uPath);
$stmt->execute();
$stmt->store_result();
$stmt->fetch();

I want the items to display in reverse order as they currently do. If I change the ORDER BY from DESC to ASC it picks a different set of data which I do not want. Thus, from my research I have seen that either array_reverse() or rsort would do the trick. I need to know what syntax is correct to use array_reverse() properly here.

A: Maybe try something like this:
$results = $stmt->fetchAll();
$results = array_reverse( $results );

The next part can be done a few different ways so it really depends on how you are going to use the results and paginate them.
You could use a for loop: http://us3.php.net/manual/en/control-structures.for.php
Or foreach: http://us3.php.net/manual/en/control-structures.foreach.php

A: I don't get along well with PHP, but something like this?
$results = $stmt->fetchAll();
$results = array_reverse( $results );
foreach ($results as $row)
{
  /* $row will contain each row in the reversed array one at a time. do your usual process-one-row logic here */
}

Btw, when you don't know what a PHP function returns when you call it, there is a very useful debugging function, var_dump. You can call it on anything and it'll print what it's composed of, recursively.
http://au1.php.net/manual/en/function.var-dump.php

A: Okay, after a lot of headbanging, I was able to accomplish this task, though not in a manner that I had considered when I posted this question. What I ended up doing was writing a subquery which allowed me to reverse the order of the updates displayed on each page, and as you'll know, this only reverses the order of the four updates visible on the page, NOT the overall order of the 52 chosen (see original question).
The next step was to 'reverse' my pagination system...no small task...rewriting logic, testing code, etc. So by reversing things with a subquery and reversing my pagination, I achieved my goal.
All of your suggestions her helped with the final outcome, though not in a way expected. I apologize in advance if this is not as concise as answering my own question should be.


text:
Q: I can't assign display:none to a toggle button I am creating a website which menu is toggleable. but when I am on widescreen the menu is always displayed. I want it to display only when I click the button.
in the html, this is the button:

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

    </button>

Productos

Contacto

Distribuidores

Cotizacion

Descargas

Videos

Nosotros

FAQ

and this is the css:
.navbar-toggle
{
    display: block !important;
}
.navbar-collapse.collapse
{
    display: none !important;
}
.navbar-nav>li
{
    float: none !important;
}
.collapse.in
{
  display:block !important;
}

so the problem is i am writing:
.navbar-collapse.collapse
{
   display: none !important;
}

but it's not taking it. I am working with bootstrap too. and I think something about it is blocking it. how do I force the menu to be collapsed if it isn't taking the display: none

A: Here are the steps to achieve what you want:

*

*Remove the collapsed class from this line: class="navbar-toggle collapsed" so it'll look like this: class="navbar-toggle"

*Add this class navbar-header to your botonera div like this class="navbar-header botonera col-xs-12"

*Edit your css as follows:

CSS:
.navbar-header {
  float: none;
}
.navbar-toggle {
  display: block;
}
.navbar-collapse.collapse {
  display: none!important;
}
.navbar-nav {
  float: none!important;
}
.navbar-nav>li {
  float: none;
}
.navbar-collapse.collapse.in{
  display:block !important;
}

Link to jsFiddle: https://jsfiddle.net/AndrewL32/8eqdhLwr/1/

A: I found the solution. You see, I was writing on my css
.navbar-collapse.collapse
{
    display: none !important;
}
.collapse.in
{
    display:block !important;
}

the way I managed to get a grip on those, was just to be more specific. I did that like this:
div#navbar.navbar-collapse.collapse
{
    display: none !important;
}
div#navbar.collapse.in
{
    display:block !important;
}

thank you for all your help, I truly appreciate it!


text:
Q: SQL: Get all dates between two dates with shift I have a table that content the column "startbooking" and "endbooking"
I have other that content the shift:
id |start  |end
M  | 06:00 |14:00
T  | 14:00 |20:00
N  | 20:00 |06:00

so, i need to get all dates between startbooking and endbooking with the shifts
example:
startbooking: 01/05/2015 12:00  endbooking: 02/05/2015 16:00

result:
01/05/2015 |M
01/05/2015 |T
01/05/2015 |N
02/05/2015 |M
02/05/2015 |T

A: Perhaps you will need recursive cte with cross join :
with t as (
     select startdt, enddt
     from table
     union all
     select dateadd(day, 1, startdt), enddt
     from t
     where startdt < enddt
)

select t.startdt, sft.id
from t cross join (select distinct id from shifttable) sft
option (maxrecursion 0);

Here is a Demo.


text:
Q: Has vs had (past tense) Which one is grammatically correct?

It was not until grade 2 when I discovered the 'earth' has a name.

Or

It was not until grade 2 when I discovered the 'earth' had a name.

A: Either. Normally we back=shift, so with a past-tense matrix verb ('discovered') we use a past-tense verb in the embedded clause.
But when the embedded clause denotes a state which continues to the present, we can use the present instead.
To my ear, the past sounds more natural: if you use the present, you are emphasising that the state still exists.


text:
Q: writing to a file with standard libraries I've never had so much trouble writing data to files!  I'm running GCC from MinGW, because I'm used to using GCC in Linux.  I usually use the Linux system calls open(), write(), and read(), but I'm writing a Windows program now and I had trouble using read()/write() in Windows, so I'm just using the standard libraries.  Anyway, the problem I'm having is I have no idea how to write to a file!  I've defined "FILE *" variables, used fopen(), with "r+b", "wb", and "w+b", but I still cannot write to my output file with fwrite() or fprintf().  I don't know what I'm even doing wrong!  Here's my source:
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>

#define DEBUG   1

/*** Global functions ***/
double  highfreq(double deg);

/*** Global variables ***/
double  sin_now;

unsigned int    *ptr;
unsigned char   *key,   *infilename,    *outfilename;
FILE    *infile,    *outfile,   *keyfile;

const char  *pipe_name="[pipe]";

int main(int argc, char *argv[]) {
    unsigned int    x,  y,  z;

    if(argc!=3) {
        fprintf(stderr, "Syntax error: %s <infile.txt> <outfile.wav>", argv[0]);
        return 1;
    }
    if(argv[1][0]=='-') {
        infile=stdin;
        infilename=(unsigned char *)pipe_name;
    }
    else {
        infilename=argv[1];
        if((infile=fopen(infilename, "rb"))==NULL) {
            fprintf(stderr, "Could not open input file for modulation.\n", infile);
            return 2;
        }
    }
    if(argv[2][0]=='-') {
        outfile=stdout;
        outfilename=(unsigned char *)pipe_name;
    }
    else {
        outfilename=argv[2];
        if((infile=fopen(outfilename, "wb"))==NULL) {
            fprintf(stderr, "Could not open/create output file for modulation.\n", outfile);
            return 3;
        }
    }
    if(DEBUG) printf("Input file:\t%s\nOutput file:\t%s\n", infilename, outfilename);

    fprintf(outfile, "Why won't this work!?\n");

    fclose(infile);
    fclose(outfile);
    return 0;
}

double highfreq(double deg) {
    double  conv,   rad;

    conv=M_PI/180;
    rad=deg*conv;
    return sin(rad);
}

I'm eventually going to make a WAV file as output, hence the "highfreq()" function, but for now I can't even get it to write to a file!  fprintf() returns with an error value of -1, if that helps anyone.  I don't really understand, though because from what I read, this simply indicates there was an error, but nothing more.

A:     outfilename=argv[2];
    if((infile=fopen(outfilename, "wb"))==NULL) {

That's the second time in your code you assign the result of fopen to infile. You probably wanted outfile there.


text:
Q: 4th parameter of Boltzmann sigmoid must be greater than .9 in R I'm trying to fit a 4 parameter boltzmann sigmoid and get an error: "Error in nls(y ~ a0 + (a1 - a0)/(1 + exp((a2 - x)/a3)), start = list(a0 = max(y),  :
  singular gradient"
I have figured out that the code runs if the a3 parameter is set to .9 or greater, or -.9 or less.  Does anyone have the reason this is?  I want to provide a starting parameter for a3 as the slope according to the description on this website: http://www.originlab.com/doc/Origin-Help/Boltzmann-FitFunc .  That is why I have the linear fit coefficient a3.s, but the result is < .9 and I get the error.  Is there a way to estimate a3.s prior to use as starting parameter for nls?  I am simply using a linear fit of the midpoint of the sigmoid +/- 10 x units - is that the correct interpretation of the a3 parameter?
Here is my code:
#fit boltzman sigmoid
a0.s=max(y); a1.s=min(y); a2.i=which.min( abs(((a0.s+a1.s)/2) - y) ); a2.s=x[a2.i]
lin.x.i=x<a2.s+10 & x>a2.s-10
a3.s=unname(coef(lm(y[lin.x.i]~so[lin.x.i]))[2])
fit <- nls(y ~ a0 + (a1-a0)/(1+exp((a2-x)/a3)),
start=list(a0=max(y), a1=min(y), a2=a2.s,a3=.9) , trace=TRUE)
params=coef(fit)
curve(params[1]+(params[2]-params[1])/(1+exp((params[3]-x)/params[4])), 1,100,col='black',add=T,type='l')

Here is the data:
x=c( 75,  40,  90,  55, 15, 100,  10,  70,  90,  50,  15,   5,   5,  70, 100,  20,  60,  65,  20,  50,  30,  85,  60,  80,  55,  40,  45,  95,  10,  55, 60,  10,  35,  80,  75,  25,  30,   5,  35,  50, 100,  40,  30,  80,  20,  45,  25,  25,  95,  95,  65,  35,  90,  85,  70,  15,  75,  45,  85,  65);

y=c(4.673686, 0.034781, 5.014355, 0.843847, 0.013337, 4.214557, 0.015299, 5.017280, 4.327815, 0.041139, 0.008704, 0.007437, 0.005125, 4.725786, 3.869776, 0.018725, 4.514051, 3.232932, 0.012979, 0.257651, 0.028170, 4.723512, 2.676991, 5.018232, 0.633399, 0.040133, 0.051864, 5.019395, 0.006505, 0.642376, 2.752317, 0.010827, 0.029303, 4.050711, 3.698887, 0.018385, 0.029491, 0.013894, 0.032034, 0.053761, 5.029349, 0.038272, 0.032619, 5.030450, 0.022356, 0.053421, 0.025370, 0.024763, 4.948973, 3.254528, 1.149153, 0.038530, 4.612227, 4.048692, 4.809153, 0.016246, 5.014711, 0.062841, 5.026961, 2.951881)

Related to this question: the formula on the linked to website has a slight variation in the equation, where the the a2 parameter is used in the form "x-a2", while the equation I provided, and got from my data acquisition software's curve fitting function is the one I provided in the code with "a2-x".  Which form of the Boltzmann is correct?  Does the difference matter?

A: Why are you reinventing the wheel? Use the native function SSfpl for your model.
fitr <- nls(y ~ SSfpl(x, a1, a0, a2, ma3))

The parameter ma3 is -a3 in your notation, but otherwise the parametrization is identical, and you get slightly better convergence.
You should probably be using weighted least squares, since ordinary least squares assumes the variability of $y-E(y)$ does not depend on the value of $x$; which is clearly violated in your data.

A: I guess this would also give an idea:
df <- data.frame(x,y)

# using drm() in "aomisc" package should give a solution
model.df <- drm(y ~ x, fct = L.4(), data = df)
summary(model.df)
plot(model.df, log="", main = "df")


text:
Q: Breaking /unbreaking line in a graph in Excel I have to work with an excel graph (this was already handed to me).

As you can see above the graph has a break between 2018 and 2019. I don't know how that was made. I now need to remove the break between 2018 and 2019 (this I believe I can do) and add a break between the data from 2019 and the new data for 2020. How can I do this?
Thank you in advance.

A: In my opinion, the line between markers of 2018 and 2019 is deleted. To remove the break between 2018 and 2019, you could try the following steps.

*

*Please select the series of line, click the marker of 2019.

*Go to Fill & Line > Line > Solid Line.

To add a break between the data from 2019 and the new data for 2020, please add the data for 2020 first. You may right click the chart > Select Data > Edit the series of line.
Then do the same as above for the marker of 2020, in addition to choose "No line".


text:
Q: Android Record set button got wrong I am trying study how to use Android record and playback function.
Through Google Android record example(https://developer.android.com/guide/topics/media/mediarecorder.html), I want change the Layout and button.
But after I reset all of them, programing is not working, I do not know what is happen.
Please advise.
import android.app.Activity;
import android.content.Context;
import android.media.MediaPlayer;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import java.io.IOException;

public class ArecordActivity extends Activity{
private static final String LOG_TAG = "AudioRecordTest";
private static String mFileName = null;

private RecordButton btn_record = null;
private MediaRecorder mRecorder = null;

private PlayButton   btn_play = null;
private MediaPlayer mPlayer = null;

private void onRecord(boolean start) {
    if (start) {
        startRecording();
    } else {
        stopRecording();
    }
}

private void onPlay(boolean start) {
    if (start) {
        startPlaying();
    } else {
        stopPlaying();
    }
}

private void startPlaying() {
    mPlayer = new MediaPlayer();
    try {
        mPlayer.setDataSource(mFileName);
        mPlayer.prepare();
        mPlayer.start();
    } catch (IOException e) {
        Log.e(LOG_TAG, "prepare() failed");
    }
}

private void stopPlaying() {
    mPlayer.release();
    mPlayer = null;
}

private void startRecording() {
    mRecorder = new MediaRecorder();
    mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    mRecorder.setOutputFile(mFileName);
    mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

    try {
        mRecorder.prepare();
    } catch (IOException e) {
        Log.e(LOG_TAG, "prepare() failed");
    }

    mRecorder.start();
}

private void stopRecording() {
    mRecorder.stop();
    mRecorder.release();
    mRecorder = null;
}

class RecordButton extends Button {
    boolean mStartRecording = true;
    OnClickListener clicker = new OnClickListener() {
        public void onClick(View v) {
            onRecord(mStartRecording);
            if (mStartRecording) {
                setText("Stop recording");
            } else {
                setText("Start recording");
            }
            mStartRecording = !mStartRecording;
        }
    };

    public RecordButton(Context ctx) {
        super(ctx);
        setText("Start recording");
        setOnClickListener(clicker);
    }
}

class PlayButton extends Button {
    boolean mStartPlaying = true;

    OnClickListener clicker = new OnClickListener() {
        public void onClick(View v) {
            onPlay(mStartPlaying);
            if (mStartPlaying) {
                setText("Stop playing");
            } else {
                setText("Start playing");
            }
            mStartPlaying = !mStartPlaying;
        }
    };

    public PlayButton(Context ctx) {
        super(ctx);
        setText("Start playing");
        setOnClickListener(clicker);
    }
}

public ArecordActivity() {
    mFileName = Environment.getExternalStorageDirectory().getAbsolutePath();
    mFileName += "/audiorecordtest.3gp";
}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_arecord);
    btn_record = new RecordButton(this);
    btn_record.findViewById(R.id.button_1);
    btn_play = new PlayButton(this);
    btn_play.findViewById(R.id.button_2);

}

@Override
public void onPause() {
    super.onPause();
    if (mRecorder != null) {
        mRecorder.release();
        mRecorder = null;
    }

    if (mPlayer != null) {
        mPlayer.release();
        mPlayer = null;
    }
}


text:
Q: GAC assembly reading registry - c# I have an assembly that installed in the GAC. Can this assembly access registry values in HKEY_LOCAL_MACHINE\SOFTWARE\COMPANYNAME
I do not get any error but am not able to read subkey from above path. My assembly is strongly signed.
Reason I am using registry is because use of config file is not permitted.
Sample code
string regKey = "HKEY_LOCAL_MACHINE\SOFTWARE\COMPANYNAME";
string userGUID = (string)Registry.GetValue(regKey, "userGUID", "-1");

A: If you are running 64-bit OS and your assembly is x86, or called by a x86 process, then your registry call is redirected to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\COMPANYNAME node. This can be the source of your problem.


text:
Q: what is the difference between using a tab and using a button(to try to make it looks like the tabs)? From the UI point of view, those 2 ways can be more less the same.
Is there any real difference?
Because using the Buttons way to implement Tabs really make thing easier, you just simply copy and paste the Buttons on each page to make it looks like a Tab.

A: The big difference is that android designed Tabs with all the normal functionality of Tabs. Giving you a lot of the expected features of a Tab.
Buttons are designed with the functionality that you would expect for a Button.
If you are wanting to use Tabs in your application, you should use Tabs, do not try to re-invent the wheel.

A: Tab is available in all screens and uses tab host.best example is music player app in any android device..
Button are mores specific for user event control.you can configure any user click event on button
they both can be used in different situation.
Tab can be used same as web tab which is available in all screens(or pages in web site)
and button may be used in situation like send button or cancel button etc..


text:
Q: Web frontend for a Python application I created a nice RSS application in Python.  It took a while and most of the code just does heavy work, like formatting XML, downloading feeds, etc. To the application itself requires very little user interaction, just a initial list of RSS feeds and some parameters.
What would be really nice, is if I was able to have a web front-end which allowed me to have the user edit their feeds and parameters, then they could click a create button and it runs.
I don't really want to have to rewrite the thing in a web framework. Is there anything that will allow me to build a nice front-end allowing it to interact with the normal Python underneath?

A: It depends on your needs, free time, etc.
I recommend two solutions:

*

*Django - a very rich framework which allows you to create full featured sites using only accessible components (in most cases they are good enough)

*http://werkzeug.pocoo.org/ - collections of tools if you want to have possibility to control everything from the low level

A: web.py is a very lightweight 'library' (not framework) that you can put as a front end to your app. Just import your app within the main controller and use it as you would.
The Python standard library also includes a builting SimpleHTTPServer module which might be what you need to create a front end for your app.

A: You may also either deploy your Python code as CGI script on a webserver of your choice, e.g. Tomcat:

The CGI (Common Gateway Interface) defines a way for a web server to
  interact with external content-generating programs, which are often
  referred to as CGI programs or CGI scripts.

According to a Qura-question this might be appropriate only for small projects, but I do not say anything wrong with that since it worked well for me for perl-scripts. The same source suggests a Python WSGI (web-service gateway) service like uwsgi another service dedicated to running Python code.
Last but not least, there is the solution to encapsulate your Python into Java-code: I stumbled upon the Quora-question "How do I run Java and Python in Tomcat?" which refered to using Jython and plyJy, the latter project is not alive anymore. However, there is also a related question on the topic of bundling Python and Java..


text:
Q: Create a Dax Measure to get the average Hi I have a Fact table called FactUser and Dimension table called Target. Target Dimension contains the target values for each user. I need to get the average target value for each user using a measure in tabular. How can I do that? If target value is in the Fact table its no issue. Since the Target value is in a Dimension I'm bit confused to get the average over a user and over a day. Below show my tabular model

A: If you provided example and test cases with solution, it would be much easier.
If you need to perform aggregation on a field, then why it is not in the Fact Table?
According to best practices, Power BI models should be designed as Star Schema and in Star Schema measures are calculated only on Fact Tables. So my suggestion in this case is not to solve the problem with DAX, but solve it by changing your Model.
However, you might try something like the following measure:
AVERAGEX('FactUser', RELATED('Targets'[Value])

Sources:
https://dax.guide/related/
https://dax.guide/averagex/

A: I have added the target value inside Fact table and got the average as below. I want to get the average over username and date.
var Pivoted= ADDCOLUMNS(
        SUMMARIZE(FactUser,DateDimension[Date],User[username])
        ,"AVERAGE TARGET",CALCULATE(sum(FactUser[Target]))

    )

return averagex(Pivoted,[AVERAGE TARGET])


text:
Q: Traversing Hierarchy Tree Adjacency List Model in Yii2 I was stuck on a logic I can't understand how it would be done and traverse the list.
Actually I was creating a category list that would be further used in creating the products. I wanted the category list should be in the form of parent and its sub nodes like adjacency list model.
Database:
id        categoryname        parent [id is the foreign key for the parent]
 1           a                  1
 2           b                  2
 3           c                  2
 4           e                  2
 5           f                  3
 6           g                  4

Fetching the details with ActiveQuery in yii2:
$rows = Category::find()
             ->asArray()
             ->all();

$rows array contains the data like this form
Array
(
  [0] => Array
    (
        [id] => 1
        [categoryname] => a
        [parent] => 1
   )

  [1] => Array
    (
        [id] => 2
        [categoryname] => b
        [parent] =>2
    )

  [2] => Array
    (
        [id] => 3
        [categoryname] => c
        [parent] => 2
    )
)
And so on...

I wanted the desired output should be like this form of list
[
  [
    'id' => 1,
    'categoryname' => 'a'
  ],
  [
    'id' => 2,
    'categoryname' => 'b'
  ],
  [
    'id' => 3,
    'categoryname' => 'b > c'
  ],
  [
    'id' => 4,
    'categoryname' => 'b>c>f'
  ]
 ]

I tried: when I get the rows from the table and stores them in an associative array. The child-ids for each branch node are stored in another associative array.
foreach ($rows as $row){
        $id = $row["id"];
        $parent_id = $row["parent"] === NULL ? "NULL" : $row["parent"];
        $data[$id] = $row;
        $index[$parent_id][] = $id;
    }
    function display_child_nodes($parent_id, $level,$data,$index)
    {

        $parent_id = $parent_id === NULL ? "NULL" : $parent_id;
        if (isset($index[$parent_id])) {
            foreach ($index[$parent_id] as $id) {
                $result['id'] = $data[$id]['id'];
                $result['name'] = $data[$id]['categoryname'];
                $result['level'] = $level;
                echo str_repeat("-", $level) . $data[$id]["categoryname"] . "\n";
                display_child_nodes($id, $level + 1,$data,$index);
            }

        }
    }
    display_child_nodes(NULL, 0,$data,$index);

I followed this reference for result but i cant get the desired output.
I had gone through with stack overflow question but none is useful for me .
So anybody can help Appreciated in advanced.

A: You can use Iterators for that. Let's extend RecursiveArrayIterator and call new iterator AdjacencyListIterator:
class AdjacencyListIterator extends RecursiveArrayIterator
{
    private $adjacencyList;

    public function __construct(
        array $adjacencyList,
        array $array = null,
        $flags = 0
    ) {
        $this->adjacencyList = $adjacencyList;

        $array = !is_null($array)
            ? $array
            : array_filter($adjacencyList, function ($node) {
                return is_null($node['parent']);
            });

        parent::__construct($array, $flags);
    }

    private $children;

    public function hasChildren()
    {
        $children = array_filter($this->adjacencyList, function ($node) {
            return $node['parent'] === $this->current()['id'];
        });

        if (!empty($children)) {
            $this->children = $children;
            return true;
        }

        return false;
    }

    public function getChildren()
    {
        return new static($this->adjacencyList, $this->children);
    }
}

By the way, take a notice, for top level parents parent should be null (and not the same as id).
Having this iterator you can generate paths like that:
$iterator = new RecursiveIteratorIterator(
    new AdjacencyListIterator($rows),
    RecursiveIteratorIterator::SELF_FIRST
);

$path = [];
foreach ($iterator as $node) {
    $depth = $iterator->getDepth();
    $path[$depth] = $node['categoryname'];

    echo implode(' > ', array_slice($path, 0, $depth + 1)), PHP_EOL;
}

Here is working demo.
This approach can be a bit slower, than custom recursive function. But it is actually more flexible. By changing only the mode of traversing, you can get leafs only, for example:
$iterator = new RecursiveIteratorIterator(
    new AdjacencyListIterator($rows)
);

foreach ($iterator as $leaf) {
    echo $leaf['categoryname'], PHP_EOL;
}

This case differs from previous in that we set $mode of the RecursiveIteratorIterator to the default one RecursiveIteratorIterator::LEAVES_ONLY.