text:
Q: in php code the col-md-4 divs appear underneath each other not side by side the following php code is performing just as I expect, but the "col-md-4" divs are appearing underneath each other, rather than showing three in a row.
Can anybody help me with what I have done wrong?
<?php

$previousCat = null; // starts the category at NULL

while(!$DETAILS->atEnd()) {

// Check if GENUS if different. If yes then display GENUS and start row to contain all varieties
if($DETAILS->getColumnVal("GENUS") != $previousCat) {

    echo '

'.$DETAILS->getColumnVal("GENUS").'

';
 }

// now we output whatever is needed at the start of a new group - in this case,
// user name and date, since we want those only once
echo '

getColumnVal("IMAGE").'" title="'.$DETAILS->getColumnVal("VARIETY").'" class="img-fluid" />

'.$DETAILS->getColumnVal("VARIETY").'

'.$DETAILS->getColumnVal("DESCRIPTION").'

'.$DETAILS->getColumnVal("TYPE").'

';

// if GENUS is different end the row that contains the varieties
if($DETAILS->getColumnVal("GENUS") != $previousCat) {

    echo '
';
}

// save the GENUS for comparison with next GENUS
$previousCat = $DETAILS->getColumnVal("GENUS");

$DETAILS->moveNext();
}
$DETAILS->moveFirst(); //return RS to first record

?>

Output code is as follows - it looks like an extra div is being placed after the first col-md-4

Asian Greens

Tatsoi

dark spicy asian green

Beets

Baby Beats

Blankoma

white, round

A: Your problem seems to be that you are creating a new row with this condition:
if($DETAILS->getColumnVal("GENUS") != $previousCat)

You are then using that same condition to end your row. The first iteration of the loop creating the row will therefore always end the row after the first col-md-4 div because you are only changing the value of $previousCat afterwards. However, changing the value of $previousCat before will also likely give you problems with closing your row div as intended.
For a less elegant solution, a boolean variable that you check for in that last conditional statement and set in your first conditional would work. This would let you determine if a new row has been freshly created in that iteration and therefore should not be ended in that same iteration. This is usually indicative that there are some changes to logic to be made.

A: The solution I came up with was take the class "row" out of the php, and working with col-md-12 and col-md-4 in the php coding, using an if else statement as follows...

<?php

$previousCat = null; // starts the category at NULL

while(!$DETAILS->atEnd()) {

  // Check if GENUS if different. If yes then display GENUS and start row to contain all varieties

  if($DETAILS->getColumnVal("GENUS") != $previousCat) {

    echo '

'.$DETAILS->getColumnVal("GENUS").'

getColumnVal("IMAGE").'" title="'.$DETAILS->getColumnVal("VARIETY").'" class="img-fluid " style="max-width:80%" />

'.$DETAILS->getColumnVal("VARIETY").'

'.$DETAILS->getColumnVal("DESCRIPTION").'

'.$DETAILS->getColumnVal("TYPE").'

';
}
// if GENUS is not different
else {

echo '

getColumnVal("IMAGE").'" title="'.$DETAILS->getColumnVal("VARIETY").'" class="img-fluid " style="max-width:80%" />

'.$DETAILS->getColumnVal("VARIETY").'

'.$DETAILS->getColumnVal("DESCRIPTION").'

'.$DETAILS->getColumnVal("TYPE").'

';
    }

  // save the GENUS for comparison with next GENUS
  $previousCat = $DETAILS->getColumnVal("GENUS");

  $DETAILS->moveNext();
}
$DETAILS->moveFirst(); //return RS to first record

?>


text:
Q: ShareKit assert: "ShareKit has been refactored to be used as Xcode subproject." I'm having trouble getting ShareKit 2.0 to work in my app. I've followed the latest installation instructions, creating a submodule for ShareKit, and tried cleaning and rebuilding, deleting and replacing the submodule, and so on. But when I try to create an SHKActionSheet I get this assert:

2013-03-03 15:48:39.998 Symmetry Lab[4170:907] *** Assertion failure
  in NSString *SHKLocalizedStringFormat(NSString *)(),
  /Users/lukebradford/Apps/Symmetry
  Lab/Submodules/ShareKit/Classes/ShareKit/Core/SHK.m:811 2013-03-03
  15:48:40.004 Symmetry Lab[4170:907] *** Terminating app due to
  uncaught exception 'NSInternalInconsistencyException', reason:
  'ShareKit has been refactored to be used as Xcode subproject. Please
  follow the updated installation wiki and re-add it to the project.
  Please do not forget to clean project and clean build folder
  afterwards. In case you use CocoaPods override - (NSNumber
  *)isUsingCocoaPods; method in your configurator subclass and return [NSNumber numberWithBool:YES]'

I've used ShareKit for other apps without issues with both the old and new installation method. Has anyone run into anything similar or have a suspicion as to what could be causing this?
I don't do anything crazy with ShareKit, just set my custom configurator and then launch an action sheet with an image. Thanks for any help you might be able to offer!

A: Which version of sharekit are you using? Are you using the newest version (which they're calling "2.0") from https://github.com/ShareKit/ ? I recently used that in a project, and had all kinds of pain until I realized that the version most turned up on the web (http://getsharekit.com) is a big bag of hurt with current iOS.

redpajama_set_name: RedPajamaStackExchange


text:
Q: With CUDA, is there a limit to the amount of computation or number of blocks allowed? I am exploring CUDA 8.0 with Visual Studio 2015 (running on a GeForce GTX 1060).
I tried setting 2000 blocks to run 1024 threads each (values that are supported) but I get an error code 4 after launching the kernel. The blocks are not doing anything exotic, in fact I'm not even using shared memory. What am I doing wrong?
My code is as follows:
#include "cuda_runtime.h"
#include "device_launch_parameters.h"

#include <stdio.h>
#include <stdlib.h>

__global__
void addKernel()
{
    unsigned int i, ans = 0;
    for (i = 0; i < 100000; i++)
    {
        ans += i;
    }
}

int main()
{
    addKernel << <2000, 1024 >> >();

    cudaError_t cudaStatus = cudaDeviceSynchronize();
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "cudaDeviceSynchronize returned error code %d after launching addKernel!\n", cudaStatus);
    }

    cudaDeviceReset();
    getchar();
    return 0;
}

Output:
cudaDeviceSynchronize returned error code 4 after launching addKernel!

When I cut the number of blocks in half, the error goes away. Interestingly, I can eliminate the error by reducing the 100,000 iterations of the loop in the kernel to 1,000 as well.


text:
Q: Single shortcut to move a running process to the background in bash I know how to move a process to the background by suspending it first, discussed here and here:

*

*Type Ctrl+Z

*Run either %& or bg
However I'd like to do this without interrupting the process too much (not have it paused for ages while I type to start it up again). For example if it's playing audio and I don't want to interfere. It looks like there's no way to actually move it while running (see this and this), but I'll happily accept a single shortcut that does both the above operations in one step.
A similar question is here, but about zsh: How can I do Ctrl-Z and bg in one keypress to make process continue in background?

A: The commands can certainly be combined, but triggering them is difficult.
One option is binding Ctrl-Z in the shell so you can hit it once to suspend and again to bg.
My solution is to set a global shortcut to run a script which does the work.
Firstly, the PID of the shell running in the active terminal window is obtained. Then get the process in the foreground, and finally suspend and resume it. The same works if you want to kill it.
An annoying issue is KDE's konsole which has a single process for every terminal window. I found the answer here, or at least it pointed me in the right direction: http://wundermark.blogspot.com.au/2013/01/the-sick-and-twisted-world-of.html?m=1
Here's the script:
#!/bin/bash

#get the active window
WID=$( xprop -root _NET_ACTIVE_WINDOW | grep -o '0x[0-9a-f]\+' )

#get the parent's process ID (looks like I don't need this as there's only ever one konsole/gnome-terminal process running)
TPID=$( xprop -id $WID _NET_WM_PID | grep -o '[0-9a-f]\+' )

#get the window class, to check what terminal is running
TERM=$( xprop -id $WID WM_CLASS | grep -o 'konsole\|gnome-terminal' ) #change this to match your terminal. only tested with konsole

#quit if a terminal is not active
if [[ -z "$TERM" ]] ; then
    exit -1
fi

#get bash PID for the window, somehow
if [[ "$TERM" == "konsole" ]] ; then
    #this seems really really roundabout, but here goes..
    #for every konsole window (which may have many tabs/sessions)
    for WINDOW in $( qdbus org.kde.konsole /Windows org.freedesktop.DBus.Introspectable.Introspect | grep "node name" | grep -o "[0-9]\+" ) ; do
        #get the "current" session, which I guess is the active tab. seems to work
        SESSION=$( qdbus org.kde.konsole /Windows/$WINDOW org.kde.konsole.Window.currentSession )

        #get the window ID from the environment variables (why is not available via qdbus??)
        KWID=$( qdbus org.kde.konsole /Sessions/$SESSION org.kde.konsole.Session.environment | grep WINDOWID | grep -o "[0-9]\+" )

        #convert it to hex, to match the query at the top
        KWID=$( printf "0x%x\n" $KWID )

        #if this active tab is in the active window, it's the one we want. grab the PID of the shell
        if [[ "$WID" == "$KWID" ]] ; then
            SHELL_PID=$( qdbus org.kde.konsole /Sessions/$SESSION org.kde.konsole.Session.processId )
            break
        fi
    done
else
    ps --ppid $TPID #<- need to figure out which bash PID for the WID, as above for KDE
    echo "only works for KDE atm. sorry"
    exit -1
fi

echo WID=$WID PID=$PID TERM=$TERM SHELL_PID=$SHELL_PID

#find the foreground process
ps -O stat --ppid $SHELL_PID | grep -v PID | while read CHILD ; do
    if [[ -n "$(echo $CHILD | awk '{print $2}' | grep \+)" ]] ; then
        PID=$( echo $CHILD | awk '{print $1}' )
        kill -SIGSTOP $PID
        sleep 0.0001 #??
        kill -SIGCONT $PID
        break
    fi
done

This works just fine. For example,
>>> sleep 100 #press shortcut here

[1]+  Stopped                 sleep 100
>>> jobs #check it's been restarted
[1]+  Running                 sleep 100 &
>>>

However it does rely on the window manager being able to set global shortcuts and being able to get the active terminal and shell, which is pretty damn roundabout. I guess there might also be issues if say ssh is running, not sure.


text:
Q: In MongoDB's pymongo, how do I do a count()? for post in db.datasets.find({"test_set":"abc"}).sort("abc",pymongo.DESCENDING).skip((page-1)*num).limit(num):

How do I get the count()?

A: Not sure why you want the count if you are already passing limit 'num'. Anyway if you want to assert, here is what you should do.
results = db.datasets.find({"test_set":"abc"}).sort("abc",pymongo.DESCENDING).skip((page-1)*num).limit(num)

results_count = results.count(True)

That will match results_count with num

A: Since pymongo version 3.7.0 and above count() is deprecated. Instead use Collection.count_documents. Running cursor.count or collection.count will result in following warning message:
DeprecationWarning: count is deprecated. Use Collection.count_documents instead.

To use count_documents the code can be adjusted as follows
import pymongo

db = pymongo.MongoClient()
col = db[DATABASE][COLLECTION]

find = {"test_set":"abc"}
sort = [("abc",pymongo.DESCENDING)]
skip = 10
limit = 10

doc_count = col.count_documents(find, skip=skip)
results = col.find(find).sort(sort).skip(skip).limit(limit)

for doc in result:
   //Process Document

Note: count_documents method performs relatively slow as compared to count method. In order to optimize you can use collection.estimated_document_count. This method will return estimated number of docs(as the name suggested) based on collection metadata.

A: If you're using pymongo version 3.7.0 or higher, see this answer instead.

If you want results_count to ignore your limit():
results = db.datasets.find({"test_set":"abc"}).sort("abc",pymongo.DESCENDING).skip((page-1)*num).limit(num)
results_count = results.count()

for post in results:

If you want the results_count to be capped at your limit(), set applySkipLimit to True:
results = db.datasets.find({"test_set":"abc"}).sort("abc",pymongo.DESCENDING).skip((page-1)*num).limit(num)
results_count = results.count(True)

for post in results:

A: Cannot comment unfortuantely on @Sohaib Farooqi's answer... Quick note: although, cursor.count() has been deprecated it is significantly faster, than collection.count_documents() in all of my tests, when counting all documents in a collection (ie. filter={}). Running db.currentOp() reveals that collection.count_documents() uses an aggregation pipeline, while cursor.count() doesn't. This might be a cause.

A: This thread happens to be 11 years old. However, in 2022 the 'count()' function has been deprecated. Here is a way I came up with to count documents in MongoDB using Python. Here is a picture of the code snippet. Making a empty list is not needed I just wanted to be outlandish. Hope this helps :). Code snippet here.

A: The thing in my case relies in the count of matched elements for a given query, and surely not to repeat this query twice:
one to get the count, and
two to get the result set.
no way
I know the query result set is not quite big and fits in memory, therefore, I can convert it to a list, and get the list length.
This code illustrates the use case:
# pymongo 3.9.0
while not is_over:
  it = items.find({"some": "/value/"}).skip(offset).size(limit)
  # List will load the cursor content into memory
  it = list(it)
  if len(it) < size:
    is_over = True
  offset += size

A: If you want to use cursor and also want count, you can try this way
# Have 27 items in collection
db = MongoClient(_URI)[DB_NAME][COLLECTION_NAME]

cursor = db.find()
count = db.find().explain().get("executionStats", {}).get("nReturned")
# Output: 27

cursor = db.find().limit(5)
count = db.find().explain().get("executionStats", {}).get("nReturned")
# Output: 5

# Can also use cursor
for item in cursor:
      ...

You can read more about it from https://pymongo.readthedocs.io/en/stable/api/pymongo/cursor.html#pymongo.cursor.Cursor.explain


text:
Q: JQ grid Date format(Month date, year) Ex- June 26, 2015 Am using JQ a grid the date format which I get this (yyyy-mm-dd) format. I want to change the date format to be mm date, year.
Example: June 26, 2015
If my input date format is null then I want to show dots(...)
Grid data should be like this,
Task Date
June 26, 2015
...
July 26, 2015

A: Use moment and specify the format.
var dateString = '1995-12-25', formatted = '...';

if (dateString) {
   formatted = moment(dateString).fomat('MM DD, YYYY');
}

Then inject the formatted  string wherever required.
More on formats - http://momentjs.com/docs/#/displaying/format/


text:
Q: Recurly API : the remote certificate is invalid according to the validation procedure I have been trying to integrate the recurly API in our .Net application.
Public, Private Keys are being used as mentioned in the API Credentials Section. Domain name is also set to [mydomainname].
When it is trying to establish a connection. It throws an exception as follows

"The remote certificate is invalid according to the validation
  procedure"

What can I do?

A: Have a look at where you've configured your Recurly site subdomain and confirm if you've formatted as subdomain="mysubdomain" instead of mysubdomain.recurly.com. It's a common error that can cause a certificate validation error. The value "mysubdomain" is prepended to the base url within the library to form the call. More detail can be found at this link https://github.com/recurly/recurly-client-net#configuration


text:
Q: How I get Angular input field value? I successfully passed data to my form input field like below.
<div class="input" >
      <mat-form-field appearance="outline" class="input-text">
      <mat-label>Name</mat-label>
      <input matInput placeholder="" style=" width: 100%;" value="{{userDetail.name}}"  >
      </mat-form-field>
    </div>

Output without formControl
I want to update and get this input field value to update the database. So I used "formControl" to get the input field value.
 [formControl]="nameControl"

But when I add this property I can't see the input field value. How I get this input field value?
Output with formControl

A: you can has a FormControl
control=new FormControl()

<!--see that not use value and use [formControl]-->
<input matInput placeholder="" style=" width: 100%;" [formControl]="control">

And then, you can give value when create the control
control=new FormControl('my value')

or using setValue
this.control.setValue('my value')

or you can has a formGroup and inside a FromControl
form=new FormGroup({
  control:new FormControl();
}))

<form [formGroup]="form">
  <!--see that not use value else FormControlName (without [])-->
  <input matInput placeholder="" style=" width: 100%;" formControlName="control">
</form>

Again, you can give value when create the form
form=new FormGroup({
  control:new FormControl('my value');
}))

or using setValue
this.form.setValue({control:'my value'}) //to all the form
//or
this.form.get('control').setValue('my value') //only to the control of the formControl
//you can also using patchValue
this.form.patchValue({control:'my value'}) //to all the form

A:
value="{{userDetail.name}}"

interpolation on attribute it's a bad practice!  You should to use angular attribute and property binding instead:

*

*https://angular.io/guide/attribute-binding

*https://angular.io/guide/property-binding

How I get this input field value?

Angular provides two different approaches to handling user input through forms: reactive and template-drive.
template-drive
public name: string;

<input matInput placeholder="" style=" width: 100%;" [(ngModel)]="name" />

reactive
public nameControl = new FormControl();

<input matInput placeholder="" style=" width: 100%;" [formControl]="nameControl" />

in both cases, if you want to set an initial value, you have to do it yourself by operating on the field
template-drive
public name = "initial name";

or
myMethod(): void {
    this.name = "initial name";
}

reactive
public nameControl = new FormControl("initial name");

or
myMethod(): void {
    this.nameControl.setValue("initial name");
}

For more info about input binding, you can visit the official Angular documentation: https://angular.io/guide/forms-overview


text:
Q: How to access the nominal values and uncertainties in a Pandas DataFrame? I am using the uncertainties module along with Pandas. At present, I am able to output the dataframe with the uncertainties together to a spreadsheet. My main objective is to write the dataframe with the uncertainties in an adjacent column. But how to access the nominal values or uncertainties within dataframes. A MWE is given below.
Present output

A
B

63.2+/-0.9
75.4+/-0.9

41.94+/-0.05
53.12+/-0.21

4.1+/-0.4
89.51+/-0.32

28.2+/-0.5
10.6+/-0.6

25.8+/-0.9
39.03+/-0.08

27.26+/-0.09
44.61+/-0.35

25.04+/-0.13
37.7+/-0.6

2.4+/-0.5
50.0+/-0.8

0.92+/-0.21
3.1+/-0.5

57.69+/-0.34
21.8+/-0.8

Desired output

A
+/-
B
+/-

63.2
0.9
75.4
0.9

41.94
0.05
53.12
0.21

4.1
0.4
89.51
0.32

28.2
0.5
10.6
0.6

25.8
0.9
39.03
0.08

27.26
0.09
44.61
0.35

25.04
0.13
37.7
0.6

2.4
0.5
50
0.8

0.92
0.21
3.1
0.5

57.69
0.34
21.8
0.8

MWE
from uncertainties import unumpy
import pandas as pd
import numpy as np

A_n = 100 * np.random.rand(10)
A_s = np.random.rand(10)

B_n = 100 * np.random.rand(10)
B_s = np.random.rand(10)

AB = pd.DataFrame({'A':unumpy.uarray(A_n, A_s), 'B': unumpy.uarray(B_n, B_s)})

AB_writer = pd.ExcelWriter('A.xlsx', engine = 'xlsxwriter', options={'strings_to_numbers': True})
AB.to_excel(AB_writer, sheet_name = 'Data', index=False, na_rep='nan')
AB_writer.close()

Update
I forgot to mention that AB is not created as shown in MWE, but is a result of previous calculations not given in the MWE. For the sake of MWE, I created the AB. So in short, I won't have access to the A and B nominal and uncertainty values.

A: Just split them into different columns:
Au = unumpy.uarray(A_n, A_s)
Bu = unumpy.uarray(B_n, B_s)
AB = pd.DataFrame({'A': unumpy.nominal_values(Au), 'A+/-': unumpy.std_devs(Au), 'B': unumpy.nominal_values(Bu), 'B+/-': unumpy.std_devs(Bu)})

A: You can map the column(s) to get the outcome you're looking for. The following code maps the A column (make sure to not assign two columns to the same column key '+/-')
AB[['A', '+/-']] = AB.A.apply(lambda x: str(x).split('+/-')).to_list()

A: You can use str.split() to split each column into one column of main value and one column of the uncertainties, as follows:
# add the column labels here if you have more columns to process
# e.g. `for col in AB[['A', 'B', 'C']]:` if you want to process columns `A`, `B` and `C`
for col in AB[['A', 'B']]:
    AB[[col, f'{col}+/-']] = AB[col].str.split(r'\+/-', expand=True)

# sort the columns to put the related columns together
AB = AB.sort_index(axis=1)

It is not recommended to have 2 columns of the same column labels in the same dataframe.  Here, we name the +/- columns with together with their respective source column name in order to distinguish them.
Here, we also use .sort_index() to sort the column names to put related columns adjacent to each other.
Result:
print(AB)

       A  A+/-      B  B+/-
0   63.2   0.9   75.4   0.9
1  41.94  0.05  53.12  0.21
2    4.1   0.4  89.51  0.32
3   28.2   0.5   10.6   0.6
4   25.8   0.9  39.03  0.08
5  27.26  0.09  44.61  0.35
6  25.04  0.13   37.7   0.6
7    2.4   0.5   50.0   0.8
8   0.92  0.21    3.1   0.5
9  57.69  0.34   21.8   0.8


text:
Q: Meaning of 'to' in the dictionaries The word 'set' is defined in certain dictionaries as:
[OED] put, lay, or stand (something) in a specified place or position
[Random House] to put (something or someone) in a particular place
The latter dictionary's explanation for 'set' starts with 'to.' Does this imply 'this word means to-'?

A: To in this case is not the preposition but the infinitive marker.
It is attached to the infinitive form (the bare infinitive) in 'abstract' contexts like this and in a variety of actual syntactical constructions to make clear that it is the infinitive which is intended. This is necessary because the infinitive of almost every English verb has exactly the same form as the present tense form.
(The exceptions are be, whose present tense form is are, and the full modals can, may, must, shall, will, which have no infinitive form.)
This convention is so strong that the marked infinitive, with to, is often said in sub-academic texts to be "the infinitive form"; but this is not quite accurate: it is "an infinitive form".
ADDENDUM:
Since writing this I have been informed by Prof. Lawler at ELU that the preferred term among  Very Advanced Students is not infinitive marker but complementizer. I was beginning to lean toward nominalizer, but Prof. Lawler does not approve that.

A: "to put" is the infinitive form and is often used in dictionary definitions of verbs.


text:
Q: Vim: language independent fall back to syntax folding with foldmethod=expr My goal is to extend the foldmethod=syntax with an additional custom defined rule of my own.
My approach in doing so is to use foldmethod=expr and define this rule in my foldexpr (e.g. add a fold for '///' comments). After that the resources I found usually fall back to something similar to indentation folding. So is there a good way to fall back to syntax folding after the custom rules, without reproducing the complete grammar for whatever language I am using?
My attempt so far is this, which is not a very satisfying approximation of syntax folding:
function! GetFold(lnum)
  let this_line=getline(a:lnum)
  let pprev_i=indent(a:lnum - 2)/&shiftwidth
  let prev_i=indent(a:lnum - 1)/&shiftwidth
  let this_i=indent(a:lnum)/&shiftwidth
  " comments
  if this_line =~? '^\s*\/\/\/.*'
    return this_i + 1
  endif
  " like indent folding, but includes the closing bracket line to the fold
  if empty(this_line)
    if prev_i < pprev_i
      return prev_i
    endif
    return -1
  endif
  if this_i < prev_i
    return prev_i
  endif
  return this_i
endfunction

A: The solution is to just use set fold=syntax and add a syntax region for the comments to your .vimrc. There you can use the fold keyword to mark the region as foldable (see :h syn-fold for more information):
 syn region myFold start="///" end="///" transparent fold

(Note, take also a look at :h syn-transparent it is quite useful here)

A: No, there isn't a way to make Vim "fall back"; only one 'foldmethod' can be active at a time, and there's no API to evaluate another fold method "as if".
You could temporarily switch to syntax folding, store the generated folds, and then use that information in your fold information, extended with what your algorithm determines. (Or you could keep the same buffer in a window split, have syntax folding enabled there, and query it from the; this would save the complete re-creation of the folds, but you'd probably need to synchronize the cursor positions.)
This is cumbersome and possibly slow; I wouldn't recommend it.


text:
Q: Can't execute composer.phar in shared hosting I've installed Composer on a shared-host (hostgator) following this guide:
https://laravel.io/forum/02-13-2014-how-to-install-laravel-on-a-hostgator-shared-server
It was installed using this command:
curl -sS https://getcomposer.org/installer | php

When I try to run composer I get the message "/home2/georger/composer.phar: no such file or directory" although the file does exist, I can open it. Other questions that deal with this suggest moving it to /usr/local/bin but that's not an option for me.

A: As outlined in the installation instructions, you will need to pass it to the php interpreter:
$ php composer.phar

Alternatively, you might want to reconsider whether you really want to execute composer in a production environment or rather execute it during the deployment and then deploy the artifacts. In other words, you probably want to run composer install on the machine from which you want to deploy to the production system, and then synchronize files from there to the production system, for example, using rsync.
For reference, see https://getcomposer.org/doc/00-intro.md.


text:
Q: Google Drive Implementation to Android app and Downloading the file from Google drive Drive Quick-start App example  works for only uploading files from Android Device to user account. I want to download the files from Gdrive to android app. any help will be appreciated.
I want exact reverse process of this Demo example https://developers.google.com/drive/quickstart-android (download it from Gdrive)

A: There are two steps to download file contents from Drive. First, retrieve the file's metadata and a downloadUrl for the file:
// retrieve metadata
File file = drive.files().get(fileId).execute();

And, make an authenticated request to the downloadUrl:
// download contents a
GenericUrl url = new GenericUrl(file.getDownloadUrl());
HttpResponse response = drive.getRequestFactory().buildGetRequest(url).execute();
String contents = new Scanner(response.getContent()).useDelimiter("\\A").next();


text:
Q: Rails SimpleForm. translate option labels in collection I use Rails 5 and SimpleForm
and try build collection from enum, for instance:
class User
  enum gender: {
    male: 0,
    female: 1
  }
end

and  in simple form:
= f.input :gender,
          label: false,
          collection: User.genders,
          label_method: :first,
          value_method: :second

So how I can translate label_method? Text in options in select tag.
Is it possible to do in Rails-way without additional steps like .map?
Thanks


text:
Q: Promise is not being handled I am writing a unit test for my Angular application using Jasmine with a mock service. However, the promise I am trying to run is not working.
Here's the service:
CreateItemController = $controller('CreateItemController', {
    ItemService: {

        createItem: function(data) {
            console.log('Service running');
            var defer = $q.defer();
            defer.resolve('1');
            return defer.promise;
        }

The test:
it('should create an item', function() {

    var created = false;
    $scope.createItem().then(function(response) {
        // This is not being run
        console.log("We got through");
        created = true;
    });

    expect(created).toBe(true);

})

And finally the actual function:
    $scope.createItem = function() {
        var postData = {
            name: 'Jeans'
        };

        return ItemService.createItem(postData).then(function(response) {
            // This is not being run
            console.log('Promise recieved');
        });
    }

What am I doing wrong?

A: You should mock the $q service so that the resolution of the promise is not async anymore in your test.
There is no point testing the $q service itself, you only want to test your custom logic.
  describe('controller: CreateItemController', function () {
    var subject, $scope;
    beforeEach(module('myModule'));
    beforeEach(inject(function ($rootScope, $controller, $q) {
      $scope = $rootScope.$new();

      subject = $controller('CreateItemController', {
        $scope: $scope,
        ItemService: {
          createItem: function () {
            var defer = $q.defer();
            spyOn(defer.promise, 'then').andCallFake(function (callback) {
              callback();
              return this;
            });
            return defer.promise;
          }
        }
      });
    }));

    it('should create an item', function () {
      var created = false;
      var subject = $scope.createItem().then(function () {
        created = true;
      });

      //deferred.resolve('1'); // useless as our callbacks are called as soon as they are registered

      expect(created).toEqual(true);
    });
  });

If you want to keep the delay though, you could call $scope.$apply() after resolving the deferred object as follow:
  describe('controlle: stack overflow', function () {
    var subject, $scope, deferred;
    beforeEach(module('myModule'));
    beforeEach(inject(function ($rootScope, $controller, $q) {
      $scope = $rootScope.$new();

      subject = $controller('CreateItemController', {
        $scope: $scope,
        ItemService: {
        createItem: function () {
            deferred = $q.defer();
            return deferred.promise;
          }
        }
      });
    }));

    it('should create an item', function () {
      var expected = {
        one: false,
        two: false,
      };
      var subject = $scope.createItem();
      subject.then(function () {
        expected.one = true;
      }).then(function () {
        expected.two = true;
      });

      deferred.resolve();
      expect(expected.one).toEqual(false);
      expect(expected.two).toEqual(false);

      $scope.$apply();

      expect(expected.one).toEqual(true);
      expect(expected.two).toEqual(true);
    });
  });
});


text:
Q: Resolvent definition: bounded operator vs. unbounded operator Maybe my question is obvious in some sense, but I ask here because I didn't find a "satisfactory" answer on the web.
If we have a bounded or unbounded operator, the definition of resolvent changes? And, in general, why one should prefer to work with a bounded operator instead of an unbounded one?
Also some references will be appreciated.
Thank you!

A: There isn't significant difference.
Let $V$ be a Banach space, and $T:V\rightarrow V$ be unbounded, closed, and densely-defined with domain $D(T)$. The resolvent set $\rho (T)$ is the collection of all $\zeta\in \mathbb{C}$ for which $\zeta-T:D(T)\rightarrow V$ is bijective. The resolvent is the operator $R_\zeta:=(\zeta-T)^{-1}:V\rightarrow D(T)$, which is defined for $\zeta\in\rho(T).$ Just like in the case of $T$ bounded, the resolvent is a bounded operator, by the closed-graph theorem.
One should note that this requires an appropriate choice of domain, and the resolvent set (and spectrum) can look quite a bit different for unbounded operators.
To answer your second question, bounded operators are easier to work with. Unbounded operators lead to more technicalities, much of which is a byproduct of needing to make a "nice" choice of domain.
For a reference, see the functional analysis appendix of Michael Taylor's Partial Differential Equations I: Basic Theory.


text:
Q: Storing image/data in MySQL and naming conventions What are some ideas out there for storing images on web servers. Im Interacting with PHP and MySQL for the application.
Question 1
Do we change the name of the physical file to a000000001.jpg and store it in a base directory or keep the user's unmanaged file name, i.e 'Justin Beiber Found dead.jpg'? For example
wwroot/imgdir/a0000001.jpg

and all meta data in a database, such as FileName and ReadableName, Size, Location, etc.
I need to make a custom Filemanager and just weighing out some pros and cons of the underlying stucture of how to store the images.
Question 2
How would I secure an Image from being downloaded if my app/database has not set it to be published/public?
In my app I can publish images, or secure them from download, if I stored the image in a db table I could store it as a BLOB and using php prevent the user from downloading it. I want to be able to do the same with the image if it was store in the FileSystem, but im not sure if this is possible with PHP and Files in the system.

A: Keeping relevant file names can be good for SEO, but you must also make sure you don't duplicate.
In all cases I would rename files to lowercase and replace spaces by underscores (or hyphens)
Justin Beiber Found dead.jpg => justin_beiber_finally_dead.jpg
If the photo's belongs to an article or something specific you can perhaps add the article ID to the image, i.e. 123_justin_beiber_found_dead.jpg. Alternatively you can store the images in an article specific folder, i.e. /images/123/justin_beiber_found_dead.jpg.
Naming the files like a0000001 removes all relevance to the files and adds no value whatsoever.
Store (full) filepaths only in the database.
For part 2;
I'm not sure what the best solution here is, but using the filesystem, I think you will have to configure apache to serve all files in a particular directory by PHP. In PHP you can then check if the file can be published and then spit it out. If not, you can serve a dummy image. This however is not very efficient and will be much heavier on apache.


text:
Q: inject jquery into every ASP.Net page Is there any way to inject JQuery into every page on an ASP.Net site without adding the script tag to every page individually?

A: Use Master Page. Inject the JQuery into MasterPage only, all your aspx pages will use the MasterPage.

A: Using Master Page is easy way to do that. But if you already constructed your site, implementing this with master page may be mass of work. Instead of that you can create BasePage class which is inherited System.Web.UI.Page as below:
Check this out
public class BasePage:System.Web.UI.Page
    {

        protected override void OnInit(EventArgs e)
        {
            // Define the name, type and url of the client script on the page.
            String csname = "ButtonClickScript";
            String csurl = "~/script_include.js";
            Type cstype = this.GetType();

            // Get a ClientScriptManager reference from the Page class.
            ClientScriptManager cs = Page.ClientScript;

            // Check to see if the include script exists already.
            if (!cs.IsClientScriptIncludeRegistered(cstype, csname))
            {
                cs.RegisterClientScriptInclude(cstype, csname, ResolveClientUrl(csurl));
            }

            base.OnInit(e);
        }
    }

Every page which derived from BasePage includes that script source dynamically. (see below)
public partial class Default : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //Some code ...
        }
    }

But, if you didn't create your site yet, Master Page is the easiest way to do that.

A: use document.write


text:
Q: The argument type 'Object?' can't be assigned to the parameter type 'Map I want to get a category section from Firebase Firestore so I used this class
class CategoryModel {
  late String name, image;

  CategoryModel({
    required this.name,
    required this.image,
  });

  CategoryModel.fromJson(Map<dynamic, dynamic> map) {
    if (map == null) {
      return;
    }

    name = map['name'];
    image = map['image'];
  }

  toJson() {
    return {
      'name': name,
      'image': image,
    };
  }
}

and then I created this with gets
class HomeViewModel extends GetxController {
  ValueNotifier<bool> get loading => _loading;
  ValueNotifier<bool> _loading = ValueNotifier(false);

  List<CategoryModel> get categoryModel => _categoryModel;
  List<CategoryModel> _categoryModel = [];

  HomeViewModel() {
    getCategory();
  }
  getCategory() async {
    _loading.value = true;
    await HomeService().getCategory().then((value) {
      for (int i = 0; i < value.length; i++) {
        _categoryModel.add(
          CategoryModel.fromJson(
            value[i].data(),
          ),
        );

        _loading.value = false;
      }
      update();
    });
  }
}

but when I try to get categories from Firestore with the function getCategory() this error comes
Error in vs code
Error in Problems scetion

A: Try it this way and tell me if it's fixed.
CategoryModel.fromJson(
            value[i].data() as Map<String,dynamic>,
          ),

A: You can read more about Cloud Firestore 2.0 here.
The basic idea is that wherever you are trying to read the data from a DocumentSnapshot, you need to cast the Object? to Map<String, dynamic>.
You can do this in a few ways.

*

*Cast the Object? to Map<String, dynamic> in your toJson method

    CategoryModel.fromJson(
         value[i].data() as Map<String,dynamic>,
    ),

*Specify the type in your constructors

DocumentReference<Map<String, dynamic>> documentReference;

*Specify the type in your StreamBuilder

StreamBuilder<QuerySnapshot<Map<String, dynamic>>>(
                stream: model.testSnap,
                builder: (context, snapshot) {
                  return Container();
                },
              )


text:
Q: Access JSON sub levels by name I have the following example JSON
var data = {
  "menu": [
    {
      "name": "Event A",
      "sub": [{
          "name": "Sub Event A 1",
          "sub": null
        },
        {
          "name": "Sub Event A 2",
          "sub": [{
              "name": "Sub Sub Event A 2",
              "sub": null
            }]
        }
      ]
    },
    {
      "name": "Event B",
      "sub": [{
          "name": "Sub Event B 1",
          "sub": null
        },
        {
          "name": "Sub Event B 2",
          "sub": [{
              "name": "Sub Sub Event B 2",
              "sub": null
            }]
        }
      ]
    }
  ]
}

When I'm creating a menu I can easily choose whether to use Event A or Event B as the source as follows:
$(data.menu[0].sub).each(function(){ /* menu[0] therefore first, Event A */
    $menu1.append(
      getMenuItem1(this)
    );
});

Question
Is it possible to select this by the value of the name field?
Something like: $(data.menu[name="Event A"].sub)

A:
Is it possible to select this by the value of the name field?

Yes, using either Array#find (if you just want the first one) or Array#filter (if you want all matching ones).
Array#find (ES2015+, but can be shimmed):
var firstMatchingItem = data.menu.find(function(entry) {
    return entry.name == "Event A";
});

Array#filter (ES5+, but can be shimmed):
var matchingItems = data.menu.filter(function(entry) {
    return entry.name == "Event A";
});

They both look simpler with ES2015's arrow functions:
var firstMatchingItem = data.menu.find(entry => entry.name == "Event A");

var matchingItems = data.menu.filter(entry => entry.name == "Event A");

A: You have to iterate and find the menu you want:
for (var i = 0; i < data.menu.length; i++) {
    if (data.menu[i].name == "Event A") {
        var menu = data.menu[i];
        //do stuff!
    }
}

A: you can use lodash or similar for this. Its very easy to use. Using lodash filter:
_.filter(data, { name: "Event A" });

In your case:
$(_.filter(data, { name: "Event A" })[0].sub)


text:
Q: How can i write in text Files on a FTP Server? I'm working on a Project where Users can upload their own files etc.
And i want to make a list with all files.
But how i can i write in text files on a FTP Server?
Heres my code:
public static void write(String url, String password, String name, String text, String pathOnServer) {
    FTPClient client = new FTPClient();
    try {
        client.connect(url, 21);
        client.login(name, password);

        OutputStream out1 = client
                .storeFileStream("/Centio/Configs/User/" + UsernameUtil.getUsername() + "/ConfigList.txt");
        BufferedWriter bufferedWriter1 = new BufferedWriter(new OutputStreamWriter(out1));

        bufferedWriter1.write(text);
        bufferedWriter1.newLine();

        bufferedWriter1.close();
        out1.close();

    } catch (Exception e) {
        // TODO: handle exception
    }
}


text:
Q: How to get hexcode based on the RGB values in iPhone(iOS) I have the values of RGBA (Red, Green, Blue, Alpha). I know that we can get the UIColor value based on these things by using
UIColor *currentColor = [UIColor colorWithRed: 1 green:1 blue:0 alpha:1];
But is there a way in which i can directly get the Hex code string of a color using the RGBA values in iOS.

A: I don't think you can directly get hex string from a UIColor object. You need to get Red, Green and Blue components from the UIColor object and convert them to hex and append.
You can always create something like this
-(NSString *) UIColorToHexString:(UIColor *)uiColor{
    CGColorRef color = [uiColor CGColor];

    int numComponents = CGColorGetNumberOfComponents(color);
    int red,green,blue, alpha;
    const CGFloat *components = CGColorGetComponents(color);
    if (numComponents == 4){
        red =  (int)(components[0] * 255.0) ;
        green = (int)(components[1] * 255.0);
        blue = (int)(components[2] * 255.0);
        alpha = (int)(components[3] * 255.0);
    }else{
        red  =  (int)(components[0] * 255.0) ;
        green  =  (int)(components[0] * 255.0) ;
        blue  =  (int)(components[0] * 255.0) ;
        alpha = (int)(components[1] * 255.0);
    }

    NSString *hexString  = [NSString stringWithFormat:@"#%02x%02x%02x%02x",
                            alpha,red,green,blue];
    return hexString;
}

EDIT : in iOS 5.0 you can get red,green,blue components very easly like
CGFloat red,green,blue,alpha;
[uicolor getRed:&red green:&green blue:&blue alpha:&alpha]

so the above function can be changed to
-(NSString *) UIColorToHexString:(UIColor *)uiColor{
    CGFloat red,green,blue,alpha;
    [uiColor getRed:&red green:&green blue:&blue alpha:&alpha]

    NSString *hexString  = [NSString stringWithFormat:@"#%02x%02x%02x%02x",
                            ((int)alpha),((int)red),((int)green),((int)blue)];
    return hexString;
}

A: You can convert your float values to a NSString with this code :
float r = 0.5, g = 1.0, b = 1.0, a = 1.0;
NSString *s = [[NSString alloc] initWithFormat: @"%02x%02x%02x%02x",
    (int) (r * 255), (int) (g * 255), (int) (b * 255), (int) (a * 255)];
NSLog(@"%@", s);

A: you can manually convert the color value to hex. It is pretty easy.
if you have color value say
float redValue = 0.5;

you can compute corresponding hex value as follows.
redValue*=255;
    NSString *hex = [NSString stringWithFormat:@"%02x",(int)redValue];


text:
Q: Show $\int _{\mathbb{R}}[F(x+c) - F(x)] dx =0 $ is incorrect Proof $F$ is CDF  (probability distribution function)
$\int _{\mathbb{R}}[F(x+c) - F(x)]  dx $
$= \int _{\mathbb{R}}F(x+c)  dx -\int _{\mathbb{R}} F(x)  dx$  ( (by linearity of the integral)
$=\int _{\mathbb{R}}F(x)  dx -\int _{\mathbb{R}}F(x)  dx $ ( By change of variables theorem )
$=0$
For change of variables we used the known theorem (see below) with $\Omega = \Omega' = \mathbb{R} $ , $T(x) = x + c $ and $ \mu= \lambda$ ( Lebesgue measure)
Question: Why is the above Proof incorrect? How can we show it is not correct analytically?
My thought:
I am not sure how to show it, maybe
because the density does not exist? ( Even assumption of continuity would not imply the existence of the density) ( e.g. Cantor function is a continuous CDF which does not have a density with respect to Lebesgue measure)
Below is the known Theorem that we used

Why is the above proof wrong ?
In other words why is this step $=\int _{\mathbb{R}}F(x)  dx -\int _{\mathbb{R}}F(x)
> dx $ ( By change of variables theorem )  Incorrect ?
We use the change of variable theorem (see above) with $\Omega =
 \Omega' = \mathbb{R} $ , $T(x) = x + c $ and $ \mu= \lambda$ (
Lebesgue measure)

A: For any CDF $F$ we have $\int_{\mathbb R} F(x)dx=\infty$. This is because $F(x) \to 1$ as $ x \to \infty$. If we choose $a$ such that $F(x)>\frac 1  2$ for all $x >a$ then we get $\int_{\mathbb R} F(x)dx \geq \int_a^{\infty} \frac 1 2  dx=\infty$. So splitting the integral into two terms gives you $\infty-\infty$.
For an example where the integral is not $0$ consider $exp(1)$ distribution and take $c=1$ You can easily compute the integral in this case and the answer is not $0$.
Actually the value of the integral is $c$. Let $\mu$ the probability measure corresponding to $F$. Then (by Fubini/Tonelli's Theorem)  $\int_{\mathbb R} [F(x+c)-F(x)]dx=\int_{\mathbb R} \int_{(x,x+c]} d\mu(y)dx=\int \int_{y-c}^{c}dx d\mu (y)=\int c d\mu(y)=c$.

A: Since $F$ is a CDF, $\displaystyle\lim_{x\rightarrow\infty}F(x)=1$. Therefore, the integral $\int_{\mathbb{R}}F(x)\,\mathrm{d}x$ diverges. When you get the expression
$$\int _{\mathbb{R}}F(x+c)\, \mathrm{d}x -\int _{\mathbb{R}} F(x)\, \mathrm{d}x$$
this becomes $\infty-\infty$, which is an indeterminate form, so it cannot be simplified to $0$.
With regard to how one would correctly evaluate this integral, there is a simple way to do it using Fubini's Theorem.


text:
Q: Xamarin Create Binding project for StripeTerminal I am attempting to create a binding project for the StripeTerminal CocoaPod (Stripe Terminal iOS). I setup the pod file. Then using the Xamarin docs, I installed Objective Sharpie, and used
sharpie pod bind
which created two files. StripeTerminal_ApiDefinitions.cs and StripeTerminal_StructsAndEnums.cs. Those files look good and have the methods I am expecting when I was using a XCode project.
I then pointed added a Native Reference to the StripeTerminal framework file, but it seems a link file was not created. The Xamarin help documentions mention that a iOS Native Library ends in .a, while this framework does not. I tried pointing the native reference to the folder of the framework, to the extensionless library, and even renamed the library project to .a. Each time when I attempt to build it gives me an error of "No API definition file specified".

A: Your API definition file(s) should have a build action of ObjcBindingApiDefinition:
<ItemGroup>
    <ObjcBindingApiDefinition Include="ApiDefinition.cs" />
</ItemGroup>

And your Enum|Structs file(s) should have a build action of ObjcBindingCoreSource:
<ItemGroup>
    <ObjcBindingCoreSource Include="Structs.cs" />
</ItemGroup>


text:
Q: User groups got empty array Wrote an inspec-test for groups. The groups are asigned to the user pi on bash but I got an empty array from inspec-test.
Here the bash output:
id
uid=1000(pi) gid=1000(pi) Gruppen=1000(pi),4(adm),20(dialout),27(sudo),33(www-data),44(video),100(users),998(docker),999(gpio)

When I run my inspec I got this:
  ×  users-1.0: Ensure users are known (1 failed)
     ✔  User pi should exist
     ✔  User pi group should eq "pi"
     ×  User pi groups should eq ["pi", "sudo"]

     expected: ["pi", "sudo"]
          got: []

     (compared using ==)

     ✔  User pi home should eq "/home/pi"

In my rb-file I wrote this:
users = {
    :pi => {
        :uname => 'pi',
        :gname => 'pi',
        :groups => [
            'adm',
            'dialout',
            'sudo',
            'www-data',
            'video',
            'users',
            'docker',
            'gpio'
        ],
        :home => '/home/pi'
    }
}
...
control 'users-1.0' do
    impact 1.0
    title 'Ensure users are known'
    users.each do |key, value|
        describe user(value[:uname]) do
            it { should exist }
            its('group') { should eq "#{value[:gname]}" }
            its('groups') { should eq [ 'pi', 'sudo' ] }
            its('home') { should eq "#{value[:home]}" }
            #its('shell') { should eq '/bin/bash' }
            #its('mindays') { should eq 0 }
            #its('maxdays') { should eq 90 }
            #its('warndays') { should eq 8 }
        end
    end
end

I expected to see an array of groups from user pi.
I don't know how to start searching. I'm a inspec newbee.
Thanks

A: It is a known InSpec bug. InSpect expects id (and any other command) output with LC_MESSAGES=C or any other US locale.


text:
Q: Statistically insignificant correlation vs. correlation of 0? I am having trouble isolating these two concepts.
If the sample correlation, using Pearson's r, is 0 and statistically significant then we can conclude the data are not linearly related - there is no correlation.
If the sample correlation, whatever it may be, is statistically insignificant then we fail to reject the null hypothesis that the population correlation is 0. So essentially we are saying the population correlation is 0.
How are these two observation different?


text:
Q: Will using "Erase all contents and settings" restore to factory OS? I just upgraded my iPhone 5 to iOS 8, but I want to restore it to iOS 7 for testing purposes. Is it the right way to do it?
Thanks

A: Apart from beta versions of iOS, it appears to be no longer possible to install any version of iOS except the most recent release. "Erase all content and settings" will clean all of your content out, but leave the OS intact. The older iOS version isn't there, and you wouldn't be allowed to install it if you had a copy.
And even if you try to install an older iOS version with Xcode, Apple's servers will refuse to authorize any version but the most recent.
Looks like you're stuck this way until people stop trying to jailbreak...


text:
Q: How to set Shadow on Bottom for UIView control + iOS swift Before asking this question, I found so many answers at stack overflow but none worked for my case.
Requirement:

I tried:
private func setShadow() {
    contentView.layer.masksToBounds = false
    contentView.layer.shadowOffset = CGSize(width: 0, height: 1.5)
    contentView.layer.shadowRadius = 0.5
    contentView.layer.shadowOpacity = 0.5
    layer.shadowColor = UIColor.lightGray.cgColor
}

I also play around with offset, radius, opacity; studied about each property, but none combination results in desired output. Any suggestions please.

A: You can achieve the effect by static layer.
contentView.layer.masksToBounds = false

let shadowLayer = CALayer()
shadowLayer.frame = contentView.bounds
shadowLayer.shadowOffset = CGSize(width: 0, height: 1.5);
shadowLayer.shadowRadius = 0.5
shadowLayer.shadowOpacity = 0.5;
shadowLayer.shadowColor = UIColor.lightGray.cgColor
contentView.layer.addSublayer(shadowLayer)

Please remember to input it in layoutSubviews if you use autolayout .
override func layoutSubviews() {
    super.layoutSubviews()
    shadowLayer.frame = contentView.bounds
}


text:
Q: getComputedStyle() and cssText in IE and Firefox Please refer to this fiddle which illustrates the problem.
I am trying to get the cssText property of a
 via window.getComputedStyle(element) (which returns a CSSStyleDeclaration object). This works just fine in Chrome (version right out of the repos), but it does not work in Firefox and IE10 and IE11. Actually, cssText is a property on the returned object, it's just an empty string.
It may not work in older versions of IE but I haven't tested it in those versions. I cannot seem to find any reference to this specifically not working in recent versions of IE. Actually Microsoft's documentation has led me to believe that it SHOULD work when in fact it does not ("Sets or retrieves the persisted representation of the style rule"). I am trying a little rubber duck debugging here to see if there is something obvious I've missed, or perhaps it's the VM images I'm using to test code on IE. What am I doing wrong? Thanks!
EDIT: What I'm looking for specifically is a way to get a list of CURRENT styles applied to an element, as happens when getting cssText from the object returned by getComputedStyle() in Chrome, but which does not happen in Firefox or IE. To clarify, it appears using the style.cssText property of an element in IE retrieves a list of styles applied to an element via stylesheets, style tags, and inline style rules, but NOT styles which were applied programmatically via scripts. This may be by design and as intended, but: How can I replicate the behavior seen when using cssText from a CSSStyleDeclaration object in Chrome (as returned by getComputedStyle()), but in Internet Explorer and Firefox?

A: You should be able to use node.currentStyle to access specific style properties which is much more reliable than cssText.
http://msdn.microsoft.com/en-us/library/ie/ms535231%28v=vs.85%29.aspx
Notice in this example cssText doesn't provide the background color.  I'm not sure when runtimeStyle is supposed to work but it doesn't seem to work pre or post javascript manipulation. These are likely bugs in IE.
Note: The getComputedCSSText function is a quick hack for demonstration purposes and likely needs some modifications for use in a production environment.
<!DOCTYPE html>

<title>Test</title>

FooBar!

<button onclick="MyTest()">Test</button>


text:
Q: MongoDB data disappeared after kernal panic in Ubuntu The DB disappeared after 2019-07-25T06:36:53.999+0900. Below is log file. I am just installing some ubuntu packages but there some problem like /boot foler disk space issues or not, the kernel disrupted and I tried to boot with recover mode, and then succeed it. But after booting, my mongodb data looks disappeared - If I access my website there should be some articles but I cannot find this articles - perhaps it disappeared.
What I did is ...  In grup selection window when access to ubuntu recovery mode, I choose "clean" one time and it looks like excuting apt-get autoremove. After I realize data gone, I typed mongod --repair one time. This two thing are all I did. Ah, I update ubutu version 3 days ago. But that time the db has no problem.
Where is my DB? Can you guess? I don't have backups so I am very confused.
2019-07-25T06:36:53.902+0900 I NETWORK  [listener] connection accepted from 127.0.0.1:35460 #1938 (9 connections now open)
2019-07-25T06:36:53.930+0900 I NETWORK  [listener] connection accepted from 127.0.0.1:35461 #1939 (10 connections now open)
2019-07-25T06:36:53.950+0900 I NETWORK  [listener] connection accepted from 127.0.0.1:35462 #1940 (11 connections now open)
2019-07-25T06:36:53.952+0900 I NETWORK  [listener] connection accepted from 127.0.0.1:35463 #1941 (12 connections now open)
2019-07-25T06:36:53.999+0900 I NETWORK  [conn1941] end connection 127.0.0.1:35463 (11 connections now open)
2019-07-25T06:36:53.999+0900 I NETWORK  [conn1940] end connection 127.0.0.1:35462 (10 connections now open)
2019-07-25T06:36:53.999+0900 I NETWORK  [conn1939] end connection 127.0.0.1:35461 (9 connections now open)
2019-07-25T06:36:53.999+0900 I NETWORK  [conn1938] end connection 127.0.0.1:35460 (8 connections now open)
2019-07-26T01:03:53.557+0900 I CONTROL  [main] ***** SERVER RESTARTED *****
2019-07-26T01:03:53.747+0900 I CONTROL  [initandlisten] MongoDB starting : pid=854 port=27017 dbpath=/var/lib/mongodb 64-bit host=ubuntu
2019-07-26T01:03:53.747+0900 I CONTROL  [initandlisten] db version v4.0.0
2019-07-26T01:03:53.747+0900 I CONTROL  [initandlisten] git version: 3b07af3d4f471ae89e8186d33bbb1d5259597d51
2019-07-26T01:03:53.747+0900 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2019-07-26T01:03:53.747+0900 I CONTROL  [initandlisten] allocator: tcmalloc
2019-07-26T01:03:53.747+0900 I CONTROL  [initandlisten] modules: none
2019-07-26T01:03:53.747+0900 I CONTROL  [initandlisten] build environment:
2019-07-26T01:03:53.747+0900 I CONTROL  [initandlisten]     distmod: ubuntu1404
2019-07-26T01:03:53.747+0900 I CONTROL  [initandlisten]     distarch: x86_64
2019-07-26T01:03:53.747+0900 I CONTROL  [initandlisten]     target_arch: x86_64
2019-07-26T01:03:53.747+0900 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2019-07-26T01:03:53.748+0900 W STORAGE  [initandlisten] Detected unclean shutdown - /var/lib/mongodb/mongod.lock is not empty.
2019-07-26T01:03:53.750+0900 I STORAGE  [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2019-07-26T01:03:53.750+0900 W STORAGE  [initandlisten] Recovering data from the last clean checkpoint.
2019-07-26T01:03:53.750+0900 I STORAGE  [initandlisten]
2019-07-26T01:03:53.750+0900 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-07-26T01:03:53.750+0900 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-07-26T01:03:53.750+0900 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2019-07-26T01:03:55.375+0900 I STORAGE  [initandlisten] WiredTiger message [1564070635:375844][854:0x7f9600196a00], txn-recover: Main recovery loop: starting at 4/38038144
2019-07-26T01:03:55.376+0900 I STORAGE  [initandlisten] WiredTiger message [1564070635:376299][854:0x7f9600196a00], txn-recover: Recovering log 4 through 5
2019-07-26T01:03:55.452+0900 I STORAGE  [initandlisten] WiredTiger message [1564070635:452166][854:0x7f9600196a00], txn-recover: Recovering log 5 through 5
2019-07-26T01:03:55.553+0900 I STORAGE  [initandlisten] WiredTiger message [1564070635:553501][854:0x7f9600196a00], txn-recover: Set global recovery timestamp: 0
2019-07-26T01:03:55.743+0900 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2019-07-26T01:03:56.093+0900 I CONTROL  [initandlisten]
2019-07-26T01:03:56.093+0900 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-07-26T01:03:56.093+0900 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-07-26T01:03:56.093+0900 I CONTROL  [initandlisten]
2019-07-26T01:03:56.093+0900 I CONTROL  [initandlisten]
2019-07-26T01:03:56.093+0900 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2019-07-26T01:03:56.093+0900 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2019-07-26T01:03:56.093+0900 I CONTROL  [initandlisten]
2019-07-26T01:03:56.093+0900 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2019-07-26T01:03:56.093+0900 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2019-07-26T01:03:56.093+0900 I CONTROL  [initandlisten]
2019-07-26T01:03:56.437+0900 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/var/lib/mongodb/diagnostic.data'
2019-07-26T01:03:56.440+0900 I NETWORK  [initandlisten] waiting for connections on port 27017
2019-07-26T01:03:57.017+0900 I FTDC     [ftdc] Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost. OK

root@ubuntu:/data/db# ls -al
합계 332
drwxr-xr-x 4 root root  4096  7월 26 00:57 .
drwxr-xr-x 3 root root  4096  7월 20  2018 ..
-rw------- 1 root root    46  7월 26 00:45 WiredTiger
-rw------- 1 root root    21  7월 26 00:45 WiredTiger.lock
-rw------- 1 root root  1044  7월 26 00:57 WiredTiger.turtle
-rw------- 1 root root 61440  7월 26 00:57 WiredTiger.wt
-rw------- 1 root root  4096  7월 26 00:55 WiredTigerLAS.wt
-rw------- 1 root root 32768  7월 26 00:55 _mdb_catalog.wt
-rw------- 1 root root 16384  7월 26 00:55 collection-0-6981595682191946835.wt
-rw------- 1 root root 36864  7월 26 00:56 collection-2-6981595682191946835.wt
-rw------- 1 root root  4096  7월 26 00:55 collection-4-6981595682191946835.wt
-rw------- 1 root root 32768  7월 26 00:55 collection-7-6981595682191946835.wt
drwx------ 2 root root  4096  7월 26 01:00 diagnostic.data
-rw------- 1 root root 16384  7월 26 00:55 index-0--23645261368052429.wt
-rw------- 1 root root  4096  7월 26 00:55 index-1--23645261368052429.wt
-rw------- 1 root root  4096  7월 26 00:56 index-2--23645261368052429.wt
-rw------- 1 root root 16384  7월 26 00:55 index-3--23645261368052429.wt
-rw------- 1 root root 32768  7월 26 00:56 index-4--23645261368052429.wt
drwx------ 2 root root  4096  7월 26 00:55 journal
-rw------- 1 root root     6  7월 26 00:55 mongod.lock
-rw------- 1 root root 36864  7월 26 00:57 sizeStorer.wt
-rw------- 1 root root   114  7월 26 00:45 storage.bson

root@ubuntu:/var/lib/mongodb# ls -al
합계 2468
drwxr-xr-x  4 mongodb mongodb   4096  7월 26 01:05 .
drwxr-xr-x 48 root    root      4096  7월 21 20:50 ..
-rw-------  1 mongodb mongodb     46  7월 18  2018 WiredTiger
-rw-------  1 mongodb mongodb     21  7월 18  2018 WiredTiger.lock
-rw-------  1 mongodb mongodb   1056  7월 26 01:05 WiredTiger.turtle
-rw-------  1 mongodb mongodb 192512  7월 26 01:05 WiredTiger.wt
-rw-------  1 mongodb mongodb   4096  7월 26 01:03 WiredTigerLAS.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:03 _mdb_catalog.wt
-rw-------  1 mongodb mongodb  16384  7월 26 01:03 collection-0--6413199990932768598.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:03 collection-10-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:03 collection-12-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:03 collection-14-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:03 collection-16-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:03 collection-18-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:04 collection-2--6413199990932768598.wt
-rw-------  1 mongodb mongodb  16384  7월 26 01:03 collection-20-6605498715908891783.wt
-rw-------  1 mongodb mongodb  45056  7월 26 01:03 collection-22-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:03 collection-24-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:03 collection-26-6605498715908891783.wt
-rw-------  1 mongodb mongodb 196608  7월 26 01:03 collection-28-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:03 collection-30-6605498715908891783.wt
-rw-------  1 mongodb mongodb  61440  7월 26 01:03 collection-32-6605498715908891783.wt
-rw-------  1 mongodb mongodb  24576  7월 26 01:03 collection-34-6605498715908891783.wt
-rw-------  1 mongodb mongodb  32768  7월 26 01:03 collection-36-6605498715908891783.wt
-rw-------  1 mongodb mongodb 151552  7월 26 01:03 collection-38-6605498715908891783.wt
-rw-------  1 mongodb mongodb  20480  7월 26 01:03 collection-4--6413199990932768598.wt
-rw-------  1 mongodb mongodb 114688  7월 26 01:03 collection-40-6605498715908891783.wt
-rw-------  1 mongodb mongodb  45056  7월 26 01:03 collection-42-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:03 collection-44-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:03 collection-46-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:03 collection-6-6605498715908891783.wt
-rw-------  1 mongodb mongodb 147456  7월 26 01:03 collection-8-6605498715908891783.wt
drwx------  2 mongodb mongodb   4096  7월 26 01:27 diagnostic.data
-rw-------  1 mongodb mongodb  16384  7월 26 01:03 index-1--6413199990932768598.wt
-rw-------  1 mongodb mongodb  36864  1월  8  2019 index-11-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  1월 31 00:32 index-13-6605498715908891783.wt
-rw-------  1 mongodb mongodb  16384 12월 16  2018 index-15-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864 12월 16  2018 index-17-6605498715908891783.wt
-rw-------  1 mongodb mongodb  32768 12월 19  2018 index-19-6605498715908891783.wt
-rw-------  1 mongodb mongodb  16384 12월 19  2018 index-21-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 25 00:05 index-23-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 10 16:36 index-25-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  2월 26 10:29 index-27-6605498715908891783.wt
-rw-------  1 mongodb mongodb  69632  7월 25 10:00 index-29-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 26 01:04 index-3--6413199990932768598.wt
-rw-------  1 mongodb mongodb  36864  2월 26 11:20 index-31-6605498715908891783.wt
-rw-------  1 mongodb mongodb  32768  2월 18 11:25 index-33-6605498715908891783.wt
-rw-------  1 mongodb mongodb  24576  4월  9 21:59 index-35-6605498715908891783.wt
-rw-------  1 mongodb mongodb  32768  2월 21 17:50 index-37-6605498715908891783.wt
-rw-------  1 mongodb mongodb  53248  7월 21 09:00 index-39-6605498715908891783.wt
-rw-------  1 mongodb mongodb  53248  6월 10 22:36 index-41-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  7월 25 00:00 index-43-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  5월 13 10:02 index-45-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864  4월  9 16:10 index-47-6605498715908891783.wt
-rw-------  1 mongodb mongodb  20480  8월  9  2018 index-5--6413199990932768598.wt
-rw-------  1 mongodb mongodb  20480  7월 26 01:04 index-6--6413199990932768598.wt
-rw-------  1 mongodb mongodb  36864  2월 26 13:46 index-7-6605498715908891783.wt
-rw-------  1 mongodb mongodb  36864 10월 25  2018 index-9-6605498715908891783.wt
drwx------  2 mongodb mongodb   4096  7월 26 01:04 journal
-rw-------  1 mongodb mongodb      4  7월 26 01:03 mongod.lock
-rw-------  1 mongodb mongodb  36864  7월 26 01:05 sizeStorer.wt
-rw-------  1 mongodb mongodb    114  7월 18  2018 storage.bson

A: When I start mongodb I just typed mongod then I cannot find database.
But when I start mongodb like service mongod start I can see database.
I don't know why and what's diffrent between two, but second way I can see db.


text:
Q: To make a user logout I made a base application in Android Studio using Java. I did everything perfectly after login and register it opens the Main activity(connected with firebase for login) and I made a logout button in Main activity, so when I click on logout button, the activity switches to the login page we can see the login page but when I close the app and open it again, I am still at the main activity which means I am logged in what code I need to correctly logout a user and next time he opens shows the login page please answer me?

A: You need to do two things
1 - launcher activity, you need to add your flow logic, like if a user is logged-in navigate to mainActivity, else, navigate to LoginActivity
1 - on logout logic, you need to clear the flag you used in launcher activity that tells the application that the user is logged-in or no, whatever logic you check by what the user is logged in or not, either shared preferences or you are based on google sign-in account, whatever you set, please base on it in the two places (logout, and launcher activity)


text:
Q: facebook php sdk: get friends username I've this code for get all my friends name:
$user_id = $facebook->getUser();

$user_friends = $facebook->api('/me/friends', 'GET');
$friend_array = $user_friends['data'];
foreach ($friend_array as $current) {
   echo($current['name']."<br>");
}

but there's a way to get also friends facebook usernames (if they have it)?

A: You can modify your API call to include the username field:
$user_friends = $facebook->api( '/me/friends', 'GET', array( 'fields' => 'name,username' ) );
$friend_array = $user_friends['data'];
foreach ( $friend_array as $current ) {
   print_r( $current );
}

You can add other values to the field attribute too, like location, date of birth etc.
The output will now include the friend's ID, Name and Username (if they have one):
{
  "data": [
    {
      "name": "John Smith",
      "username": "john.smith",
      "id": "1234"
    },
    ...
  ]
}


text:
Q: generate sandcastle documentation for c# solution I have a vs2012 solution that has a number of C# projects. I would like to generate some documentation using Sandcastle for the entire library.
I have been reviewing Sandcastle documentation and not clear how I could generate the documentation for entire project.
How could I achieve this for the entire solution?

A: I used Sandcastle Helpfile Builder (instead of using Sandcastle directly).
In a SHFB project, you can specify multiple DLLs+XMLs in the <DocumentationSources> section.

A: As ChrisW indicated, you should use Sandcastle Help File Builder (SHFB). However, even with the clean and simple GUI provided by SHFB, however, there are quite a number of issues that you may need or want to consider in order to produce a tidy, professional documentation set. My article ("Taming Sandcastle: A .NET Programmer's Guide to Documenting Your Code") documenting my experience with a variety of potential pitfalls, published on Simple-Talk.com, may save you some time, effort, and agony :-).
Once you have digested the article, and perhaps of more interest, I put a complete syntax and usage guide to SHFB and Sandcastle on this one-page wallchart, available on Simple-Talk.com. Here's a glimpse:


text:
Q: Falling body with drag I was doing a question and I couldn't figure out the answer, when I checked the worked solutions it did a thing and I'm not entirely sure what I am missing.
The general gist of the question is as follows:

A particle $A$ is dropped from a high height with no initial velocity, after a time $T$ another particle, $B$, is dropped from the same height with an initial velocity $u$. We want to show that it must be true that  $T\le\frac{u}{g}$ if we want the particles to ever pass each other (that is have the same displacement).

The acceleration of both the particles is $g-kv$ for $v$ being their respective velocities.
After a bit of work I found (and the answers agree) that:
$$T=\frac{-1}{k}\ln{(\frac{g-ku}{g}\frac{g-kv_A}{g-kv_B})}$$,
$$x_A=\frac{1}{k}(-v_A+\frac{g}{k}\ln{(\frac{g}{g-kv_A})})$$
and
$$x_B=\frac{1}{k}(u-v_B+\frac{g}{k}\ln{(\frac{g-ku}{g-kv_B})})$$
After equating $x_A$ and $x_B$ and doing a bit of algerbra we get:
$$\frac{g}{k}\ln{(\frac{g-ku}{g}\frac{g-kv_A}{g-kv_B})}=v_B-v_A-u$$
Up until this point everything is fine, the problem occurs now because the answers state that "because that is true, at the point of contact:
$$\frac{-1}{k}\ln{(\frac{g-ku}{g}\frac{g-kv_A}{g-kv_B})}=\frac{u}{g}$$"
And that pretty much finishes off the worked solution.
It appears that they have equated $v_A=v_B$ and I don't understand how that could be true, it seems that if it were true the particles wouldn't overtake each other. IDK though, maybe that's not what the answers are doing and I'm just missing something else.
Anyway, any help would be appreciated, perhaps the answers are wrong. If what I have said isn't clear the question is "question 14 (a) (iii) of the 2020 North Sydney Boys HSC trial paper" available at https://thsconline.github.io/s/v/5348/North%20Sydney%20Boys%202020%20w.%20sol (this website takes about half a min to load but its not broken.)

A: The important fact in this excercise is that both particles experience the same drag force. It follows that they will both have the same final (maximum) velocity. When reaching this velocity they must either have already passed each other, have the same displacement or will never pass each other.
So if you set
$$
x_A = x_B
$$
and then do algebra until you reach at the equation you showed (I replaced the left side with the time T)
$$
T = \frac{-v_B + v_A + u}{g}
$$
you can see that when both particles reach their final velocity (when we know that $v_A = v_B$) the maximum allowed time between them so that there is still a solution to the equation $x_A = x_B$ is for
$$ T = \frac{u}{g}.$$
You are right that in this limit they not really "pass" each other. They only reach the same displacement and then travel on together. Only when T is smaller than u/g the one particle passes the other in the sense that $x_B > x_A$. Taking both cases together we get show the desired condition:
$$
T \leq \frac{u}{g}
$$


text:
Q: Error while building Spark-jobserver unresolved dependency: com.ning#async-http-client;1.8.10: org.sonatype.oss#oss-parent;9!oss-parent.pom(pom.original) origin location must be absolute: file:
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:313)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:191)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:168)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:133)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
at xsbt.boot.Using$.withResource(Using.scala:10)
at xsbt.boot.Using$.apply(Using.scala:9)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
at xsbt.boot.Locks$.apply0(Locks.scala:31)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
at sbt.IvySbt.withIvy(Ivy.scala:128)
at sbt.IvySbt.withIvy(Ivy.scala:125)
at sbt.IvySbt$Module.withModule(Ivy.scala:156)
at sbt.IvyActions$.updateEither(IvyActions.scala:168)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1442)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$

A: Apparently this would some sort of corrupted Ivy 2 cache issue, deleting the ~/.ivy2/ directory entirely and relaunching SBT resolved the problem.


text:
Q: PIC24 setting bits in registers I am doing some programming for PIC24FJ192GA106 in MPLABX with XC16 compiler using C. I get the following  problem during compilation
error: request for member 'UARTEN' in something not a structure or union

the line is question is:
U1MODE.UARTEN = '1';

U1MODE is a structure defined within #include "p24FJ192GA106.h" (header is included within the file) and the certain strcture is as follows
`#define U1MODE U1MODE
extern volatile unsigned int  U1MODE __attribute__((__sfr__));
__extension__ typedef struct tagU1MODEBITS {
  union {
    struct {
      unsigned STSEL:1;
      unsigned PDSEL:2;
      unsigned BRGH:1;
      unsigned RXINV:1;
      unsigned ABAUD:1;
      unsigned LPBACK:1;
      unsigned WAKE:1;
      unsigned UEN:2;
      unsigned :1;
      unsigned RTSMD:1;
      unsigned IREN:1;
      unsigned USIDL:1;
      unsigned :1;
      unsigned UARTEN:1;
    };
    struct {
      unsigned :1;
      unsigned PDSEL0:1;
      unsigned PDSEL1:1;
      unsigned :5;
      unsigned UEN0:1;
      unsigned UEN1:1;
    };
  };
} U1MODEBITS;
extern volatile U1MODEBITS U1MODEbits __attribute__((__sfr__));`

I have also tried
U1MODEbits.UARTEN = '1';
U1MODEBITS.UARTEN = '1';

or different values
U1MODEbits.UARTEN = 0b1;
U1MODEbits.UARTEN = 1;

but no LUCK, any ideas what am I doing wrong?
---- main.c ----
// PIC24 HEADER
#include "p24FJ192GA106.h"
// CONFIGURATION WORDS 2
#pragma config POSCMOD = NONE           // Primary Oscillator Select (Primary oscillator disabled)
#pragma config IOL1WAY = OFF            // IOLOCK One-Way Set Enable bit (Unlimited Writes To RP Registers)
#pragma config OSCIOFNC = OFF           // Primary Oscillator Output Function (OSCO functions as CLKO (FOSC/2))
#pragma config FCKSM = CSDCMD           // Clock Switching and Monitor (Both Clock Switching and Fail-safe Clock Monitor are disabled)
#pragma config FNOSC = FRCDIV           // Oscillator Select (Fast RC oscillator with Postscaler (FRCDIV))
#pragma config IESO = ON                // Internal External Switch Over Mode (IESO mode (Two-speed start-up) enabled)
// CONFIGURATION WORDS 1
#pragma config WDTPS = PS32768          // Watchdog Timer Postscaler (1:32,768)
#pragma config FWPSA = PR128            // WDT Prescaler (Prescaler ratio of 1:128)
#pragma config WINDIS = OFF             // Watchdog Timer Window (Standard Watchdog Timer is enabled,(Windowed-mode is disabled))
#pragma config FWDTEN = OFF             // Watchdog Timer Enable (Watchdog Timer is disabled)
#pragma config ICS = PGx1               // Comm Channel Select (Emulator functions are shared with PGEC1/PGED1)
#pragma config GWRP = OFF               // General Code Segment Write Protect (Writes to program memory are allowed)
#pragma config GCP = OFF                // General Code Segment Code Protect (Code protection is disabled)
#pragma config JTAGEN = ON              // JTAG Port Enable (JTAG port is enabled)

int main() {

    U1MODEbits.UARTEN = 1; // Unable to resolve identifier U1MODEbits

    U1MODEbits.UARTEN = 1; // above mentioned problem during compilation

    while(1){};

};

A: U1MODEbits.UARTEN = 1; is the correct syntax, '1' is definitely wrong because it represents the character '1', which is 0x31.
Also Unable to resolve identifier is not a compiler error, but a message given by MPLABX (when it underline in red). MPLABX can often give false red lines, so you shouldn't rely on it too much and compile anyway.


text:
Q: Firestore how make query with one key but multiple values In tutorial there is an example when the value is single. It can be multiple keys but each key will have the single value. But I need to make the query and get results when I am showing multiple variants of value for one key.
For example, I need to get from collection only that users which ID's are in the list


text:
Q: FFmpeg - capture a rtsp stream and re-stream it to another rtsp-server I want to capture a Rtsp-stream from a Live-CAM which I then want to re-stream to another Rtsp-server.
Basically, my computer will work as a relay-server using FFMpeg.
I have tried this temporary command but I cannot get it working i.e.
ffmpeg.exe -i rtsp://InputIPAddress:554/mystream -preset medium -vcodec libx264 -tune zerolatency -f rtsp -rtsp_transport tcp rtsp://localhost:8554/mysecondstream

I have then tried, for testing purposes, using FFplay to watch the stream from localhost as follows:
ffplay rtsp://localhost:8554/mysecondstream

but no luck.
Anyone who can help me out? Thanks.

A: Well, I found that this one works:
ffmpeg -rtsp_transport tcp -i "rtsp://123.123.123.123:554/mystream1" -rtsp_transport tcp -c:v copy -f rtsp rtsp://234.234.234.234:554/mystream2

Works even on an Android phone where I have FFmeg running.
However, I am not really pleased with it. I hope I can improve it further.
EDIT: adding "-use_wallclock_as_timestamps 1" makes the stream stable.


text:
Q: "Edit Bot..." button disabled after upgrading Xcode I've updated my Xcode from 9.2 to 9.3 (It seems to be an issue with later versions as well) and now I'm not able to edit the bots anymore.

What I tried:

*

*I installed the additional components on the server and local machine that you will be prompted about on first open after updating Xcode.

*I restarted the server and local machine.

*I checked the option "Create and View Bots" on the server. It is set to "logged in users". Just as before the update.

*Everytime I want to open the Xcode Server preference pane in on the local machine in Xcode settings under accounts it gives me an error. When I try it a second time it works though. But it aways fails at the first time:

*

*I removed the Xcode Server from the accounts pane and added it again.

A: I solved it by removing and adding the server by IP address:

Then it was possible again to Edit the bot.

Still strange...

A: Got the same issue by upgrading to XCode 10 today. Fix it by completely shutting down the Mac and restarting.


text:
Q: Xfce with Kde Plasma 5: How to automatically give focus to newly created windows? I am using Xfce with Kde Plamsa5 as Window Manager. I cant open Xfce Window Settings anymore but KDE System Settings. I cant find an option to
automatically focus to newly created windows.
When I open up a new window the focus stays on the window it was on before, but I want the new window to be raised and focused automatically.

A: It's "focus stealing prevention" in the Kwin Window Settings. If it's set to "medium", newly opened windows get the focus automatically.

A: The clean solution
I do not use plasma, so I cannot look into what causes the issue. No need to explain that eliminating the cause would be the "cleanest" solution.
If that seems impossible, and you do want to use this combination, you can however use the bandage below to make it work. The solution is an extremely "light" background script, keeping an eye on newly created windows, raising them if they appear.
How to use

*

*The script uses wmctrl
sudo apt-get install wmctrl

*Copy the script below into an empty file, save it as raise_window.py

*Test-run it from a terminal by the command:
python3 /path/to/raise_window.py

Open some applications and see if their windows are automatically raised.

*If all works fine, add it to your startup applications: Dash > Startup Applications > Add the command.

The script
#!/usr/bin/env python3
import subprocess
import time
import os

get = lambda cmd: subprocess.check_output(cmd).decode("utf-8").strip()
curr_1 = get(["wmctrl", "-l"]).splitlines()

while True:
    try:
        curr_2 = get(["wmctrl", "-l"]).splitlines()
        new = [w for w in curr_2 if not w in curr_1]
        for w in new:
            w = w.split()[0]
            command = "wmctrl -ia "+w
            subprocess.Popen(["/bin/bash", "-c", command])
    except:
        pass
    curr_1 = curr_2
    time.sleep(1)


text:
Q: Синий экран смерти после командной строки Windows Сначала командная строка с этой надписью:

DISPLAY: 'oYIoIQAFC' TYPE: DOWNLOAD STATE: TRANSFERRING PRIORITY: HIGH FILES: 0 / 1 BYTES: 91589 / 388652 (23%) TRANSFER RATE: 32,43 KB/S TIME REMAINING: 9 Seconds

Потом появляется синий экран смерти ошибка 0x00000f4.
Установлена Windows 7 64-разрядная система.


text:
Q: Remove all occurrences of an integer from list In python, how can I remove all occurrences of an integer from a list. For example:
list_a = [5, 20, 15, 10, 55, 30, 65]
list_a.METHOD(5)
print(list_a)
[20, 10, 30]

Essentially, the method removes anything that contains a 5. Not specifically multiples of 5, given that 10 and 20 do not contain a 5. Thanks.

A: list_a = [5, 20, 15, 10, 55, 30, 65]
list_a = [x for x in list_a if "5" not in str(x)]
print(list_a)
[20, 10, 30]

A: This is one way:
[x for x in list_a if str(x).find('5') < 0]

That's a list comprehension that converts each number to a string and then searches the string for the character 5. find returns -1 if not found so we keep only things where the 5 wasn't found.

A: You can use filter and lambda.
filter(lambda x:"5" not in str(x) , [5, 20, 15, 10, 55, 30, 65])


text:
Q: Elasticsearch endpoint to test users without any roles I just defined the user in Elasticsearch (through Kibana UI) and want to test the user can reach and authorize in Elastic.
What endpoint can I use for testing a user is known to Elastic from the user's perspective? (no high privileges admin API)
All I tries required some kind of roles, requests looked like:
curl --basic --user user:pass https://evil.com:9200/_cat/indices

UPDTE With curl -v I see 401 / 403 to differentiate if password is correct, I'd like to have some endpoint that returns 200 for the correct password and 401 for incorrect or non existing user...

A: If I am understanding right so you just want to check if kibana is opening only with defined username and password or not.
So you can just hit
https://your_ip or kibana_ip_whichever_given:5601
or
http://your_ip or kibana_ip_whichever_given:5601

if you have used xpack.security in it then try https otherwise try it with http

A: You can use the X-Pack API to test if the user is known to the Elasticsearch cluster, without requiring high privileges. The API is available at the endpoint /_xpack/security/user/<username> and will return a 200 status code if the user is known and an error code (e.g. 401 or 403) if the user is not known or not authorized.
for more... https://discuss.elastic.co/t/216937


text:
Q: Compiling Firefox from source with custom defines? I've been doing some tinkering with the Firefox source code, and I'd like to be able to compile it with some custom defines.
For example, the Firefox source code has some ifdef blocks like this, where EXAMPLE is one of many constants.
#ifdef EXAMPLE
    // code here
#endif

What I'd like to do is enable some of these constants, presumable by configuring my .mozconfig file to set them somehow.
I haven't found any documentation on how to do this, but based on some examples, I thought maybe adding this might do the trick.
mk_add_options EXAMPLE=1

But it didn't work, and neither does this (DEFINES: command not found):
DEFINES += -DEXAMPLE

It must be possible somehow though, as presumably Firefox developers are using this feature.
How can I set some custom defines for the Firefox build scripts?


text:
Q: Bootstrap 5 carousel indicator not showing up I have checked my code up and down and cannot find the problem. I do not see any typos or other errors. Can someone please let me know where I went wrong? I just want the tabs at the bottom to be visible and interactive as they should. Any help would be greatly appreciated.

Activity

Fun DIY activites that will entertain and educate your little ones

Activity

Fun DIY activites that will entertain and educate your little ones

A: I'm assum your are using Bootstrap v5.2+. As Bootstrap v5+, data-bs-ride instead of data-ride, On the carouse indicator, data-bs-target instead of data-target. you just change data-target to data-bs-target and data-ride to data-bs-ride to fix it.
you can visit this demo: https://fastbootstrap.com/components/carousel/#with-indicators


text:
Q: Installing Xcode and iOS SDK Issue? I just recently downloaded Xcode 3.2.6 for my computer. When I got it installed, I opened it up to find that the iOS SDK was not installed. Why? Do I have to download it separately? Is there a place for me to download it instead of re-installing Xcode?
I did some research, and saw this, but can not remember if I saw the iOS SDK to install. I think it only said Xcode Toolset.


text:
Q: Exclude mlocate.db from the Locate searches Can the search be excluded in /var/lib/mlocate/mlocate.db? I just want you to look at the one I generated locally. With -d or modifying LOCATE_PATH, only the one created in local is added, but continue searching in /var/lib/mlocate/mlocate.db Thank you.

A: According to the man page, the databases specified with the -d option should replace the default database.
If the --statistics option reports that the default database is used with your search, then check if there is an alias or something else in effect that adds /var/lib/mlocate/mlocate.db explicitely.


text:
Q: Is it ok to create a UIView on a background thread? I know UIView are not thread safe so i cant add a view on a background thread, to work around this is it ok to create a UIView on a background thread then add it on the main thread?
Note: the reason im not doing this on the main thread is because my actual code is a lot more complex and therefor takes a while to create all the views and fill the values. I dont want the UI to become un-responsive when I do this so im trying to work around this.
for example..
-(void)addLabel//called on background thread
{
    UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(0,0,40,100)];
    [label setText:@"example"]
    [self.view performSelector:@selector(addSubview:) onThread:[NSThread mainThread] withObject:example waitUntilDone:YES];
}

Thanks in advance.

A: I use Xcode Version 9.0 beta 3 (9M174d), receiving a warning.

[UView init] must be called from main thread only

So I think you should create UI in main thread better
Show the picture below :

A: From UIView:

Threading Considerations
Manipulations to your application's user interface must occur on the main thread. Thus, you should always call the methods of the UIView class from code running in the main thread of your application. The only time this may not be strictly necessary is when creating the view object itself but all other manipulations should occur on the main thread.

The call to initWithFrame: is explicitly not thread safe. The call to setText: is likely not thread-safe, falling under the "manipulations" clause. These certainly are not promised to be thread-safe.
Do your work to figure out the data on a background thread. Then create your views on the main thread. If there are a huge number of views, you can try splitting up the work using several dispatch_async() calls onto the main queue. This may let the UI remain responsive; I haven't experimented extensively with it.
You may also want to consider switching from UIView to CALayer where possible. Most CALayer work can be done on background threads. If you have a huge number of views, that's probably inefficient anyway. If it's just that it takes a long time to calculate the data for the views, that suggests you're not properly separating Model and View information. The Model classes should calculate everything needed independently of creating the Views.

A: The Drawing and Printing Guide states:

Important The UIKit classes are generally not thread safe. All drawing-related operations should be performed on your application's main thread.

Thus, as I understand this, it seems that the only problem is related to "drawing-related operations". If we assume that a correct class only execute such operation in its drawRect: method, then the approach you suggest should be fine.


text:
Q: How to install Google Chrome completely offline and without checking for new version? I have downloaded the offline (consumer, i.e. not msi package) installer for Google Chrome. But when I run it, it tries to contact a Google server to check for a newer version. If it finds it, it will download that first, and then install that version. It doesn't use the version that is already there, as part of the EXE file. For me, that defeats the point of having an offline installer. I keep a repository of all the free and purchased software locally, so that I can install them quickly whenever I need to. But as more and more people get access to broadband Internet connections, many developers and companies are pushing for offline installers with new releases. Many software titles, like Google Chrome, are almost exclusively distributed with online installers.
File name: ChromeStandaloneSetup.exe
File version: 1.3.21.115
Size: 36.6 MB (38 416 368 bytes)
SHA-1: 2393BAB7F408DC8D30F039FCA5D6B45600A0C4E7

How do I install Chrome as is, without automatically checking for and getting a newer version?
Will Chromium command switches work with Chrome installer? Is there a switch to disable version check when running the installer?
Update:
The "duplicate" question linked to below points out File Hippo as a possible repository where you one can get previous versions of Chrome. They do have a healthy listing of pretty much every single Chrome version ever released on Windows, both beta, dev and stable versions. Unfortunately they don't host the installer files, they only redirect to Google servers for downloads, which only spits out the installers for the latest versions of Chrome. It's not just File Hippo, I also tried downloading an older version of Chrome from CNET Downloads, and they too just redirect you to Google servers for download.
For whatever the reason (security related probably), Google doesn't like anyone to install an older version of Chrome on any system. Apparently not even your common source for downloading an older version of a software, like the CNET Downloads, not even they are allowed to host the Chrome installer files on their own servers. The redirects to Google is probably dictated by Google.

Google is a dictator!

They don't even allow full standalone offline installers to be installed as is, without checking for newer version. I tried running the installer from cmd with some of the command line switches used for Chromium. I only ended up with errors.

The business oriented msi installer (GoogleChromeStandaloneEnterprise.msi) might have some additional command line options you can use, but I wouldn't know if there is one that disables the check for a newer version. I have yet to find a complete list of switches you can use. The only one I've found so far is /update but that only does the opposite thing. So I'll give up here and go back to the trusty Firefox.

A: Disabling Google's desire to update is actually much more complex than it ever should be.  Steps you must take:

*

*Install the MSI with the "NOGOOGLEUPDATING" parameter, if possible

*Kill the running update task (which usually starts during the install) and do NOT open Chrome until you have completed the following steps.

*Remove the update folder manually and remove "GoogleUpdate.exe"

*Set both Google Update services "gupdate" and "gupdatem" to "disabled"

*Disable the scheduled tasks for GoogleUpdate (note if you remove them, they will likely get replaced;  disabling will deter the replacement that Google tries to push)

*Set the registry keys to disable updating (or download the Google GPO admin template and set the keys via GPO.)

*Check the additional registry keys under HKLM|Software|Google|Update and remove any "client"-related entries

There is an NSA document that details how to really disable the updating, at https://www.iad.gov/iad/library/ia-guidance/security-configuration/applications/deploying-and-securing-google-chrome-in-a-windows-enterprise.cfm but it does not include the last registry edit that I mention above.
Please note that if you install Chrome and run it before disabling all the places needed to disable updating, it will already be at the new version before you get a chance to do anything.
Also, Google has gone to great lengths to remove all but the latest version from all repositories, so you'd have to find someone who has an older MSI.

A: *

*Disconnect/disable the network connection on the machine.

*Install the version of Chrome you have the installer for.

*Run it, and disable it's auto-update.

*Exit Chrome.

*Enable networking again.


text:
Q: Moving Bitmaps in all directions What I have is something so when I click and drag my bitmap it will follow your finger, but it really only lets me move it to the right, i can co on a bit of a downward angle to the left as well if I want to but other than that it is nearly impossible to get the thing to move. I need to be able to move it in all Directions though, could you help me? this is my code:
@Override
    protected void onDraw(Canvas canvas)
    {
        super.onDraw(canvas);
        clear.setARGB(0, 0, 0, 0);
        AndroidDudeHitbox.set(AndroidX, AndroidY, AndroidX + AndroidDude.getWidth(), AndroidY + AndroidDude.getHeight());
        canvas.drawRect(AndroidDudeHitbox, clear);
        canvas.drawBitmap(AndroidDude, AndroidX - (AndroidDude.getWidth()/2), AndroidY - (AndroidDude.getHeight()/2), null);
        if (AndroidX > canvas.getWidth() || AndroidX < 0 || AndroidY > canvas.getHeight() || AndroidY < 0) {AndroidX = 30; AndroidY = canvas.getHeight()/2;}
        invalidate();
    }
@Override
    public boolean onTouch(View v, MotionEvent event)
    {
        try {
            Thread.sleep(30);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        if (AndroidDudeHitbox.contains((int)event.getX(), (int) event.getY()))
        {
            switch (event.getAction())
            {
            case MotionEvent.ACTION_MOVE:
                AndroidX = (int) event.getX();
                AndroidY = (int) event.getY();
                break;
            }
        }

        return true;
    }

EDIT :
I just found out that I can NOT move the bitmap directly to right. I can move it directly down and down and to the right. But no were else.

A: Your checking if the AndroidDudeHitbox contains points if its touched, yet your drawing AndroidDude on top of it. Either rid the if statement below or draw the hitbox on top of AndroidDude.
if (AndroidDudeHitbox.contains((int)event.getX(), (int) event.getY())){

A: First of all: Don't do a 'sleep' call in your onTouch method. This is asking for trouble.
First, just temporarily, remove the if statement checking AndroidDudeHitbox.contains((int)event.getX(), (int) event.getY()). Just always update AndroidX and AndroidY with event.getX() and event.getY().
And last, and I think most importantly, call 'invalidate()' after you change the AndroidX and/or AndroidY values in your onTouch. Only a call to 'invalidate()' will cause the onDraw to be called again later.
public boolean onTouch(View v, MotionEvent event)
{
    if (true /*AndroidDudeHitbox.contains((int)event.getX(), (int) event.getY())*/)
    {
        switch (event.getAction())
        {
        case MotionEvent.ACTION_MOVE:
            AndroidX = (int) event.getX();
            AndroidY = (int) event.getY();
            invalidate(); // important!!!
            break;
        }
    }

    return true;
}

If adding a call to 'invalidate()' works, add the 'if' statement again that your removed temporarily and see if everything still works.