text:
Q: Named Page Sizes I recall at one point reading somewhere that PostScript includes some type of named page sizes, or some sort of preset default media sizes somewhere, but I am unable to find where I might have found this anywhere. (I know one can write /Letter <</PageSize [612 792]>> def to name a page media oneself, but that is not what I am looking for.)
Can anyone conform this, or have some idea where this might have been, if it exists?
Also, how can one get locations of the corners of the current page (or the page bounding box), for drawing borders or the like?

A: Language level 1 implementations did have some predefined media sizes, but this is pretty much deprecated with later implementations. However many interpreters still carry definitions around in userdict or statusdict.
From the 3rd Edition PLRM
6.4 Output Device Dictionary
In LanguageLevel 3, certain capabilities of a page device, such as the possible page
sizes or resolutions, can be summarized in an output device dictionary that is
stored as an instance of the OutputDevice resource category. This enables applications
to query device capabilities directly and also maintains functional equivalence
with LanguageLevel 1 (where information on page size capabilities is
indicated by the presence of userdict entries such as letter, legal, and a4).
From the second edition PLRM
userdict operators There are operators defined in the userdict dictionary that cause an
imageable region to be defined. Examples of these operators include,
but are not limited to: a4, a4small, b5, ledger, legal, letter, lettersmall,
and note. These operators perform the equivalent of an initgraphics
and an erasepage. These operators must not be used in an EPS file, as
they will erase the entire page that includes the EPS file.
Sadly I no longer have a copy of the first edition PLRM.
The canonical method for finding the page bounding box is something like
initgraphics     %% reset graphics state to the initial state
clippath         %% set the currant path to be the current clip path (ie the page)
flattenpath      %% shouldn't be required, as the initial clip should be rectangular...
pathbbox         %% get the path bounding box


text:
Q: UIDatePicker slows things down I have spent a good time and concluded that UIDatePicker slows presentModalViewController: down by a few seconds. I have a view controller with two buttons and a date picker. In another class, I present this view controller with this code:
RandomClass *class = [[RandomClass alloc] init];
[class setModalTransitionStyle: UIModalTransitionStyleCrossDissolve]; //an animation
[self presentModalViewController: class animated: YES];
[class release];

I have removed the date picker in RandomClass and noticed that I can present RandomClass fairly quickly, when I insert a date picker inside the view, it slows things down again. I have tried to add the date picker programmatically, and presenting the modal view controller in a different thread, but there is still lag.
Do you have the same problem? Do you know how to fix it? I would really appreciate your answers and help. Thanks!

A: To solve performance problems with UIDatePicker, create your picker programmatically and only in viewDidAppear. If you create it in viewDidLoad, for example, the slow instantiation will block the view from appearing on screen.

A: I was experiencing the same sluggish performance with modal view presentation. I arrived to a solution by sacrificing some memory in favour of performance.
BACKGROUND:
My app was using the Model-View-Controller-Store model. The Store was a singleton which was taking care of my model, hence it was virtually accessible from any of my classes once it was instantiated. I was using the Store class to keep around certain expensive classes (such as NSCalendar, NSDateFormatter etc) through properties.
SOLUTION:
I crated a UIDatePicker property in the Store singleton, which allowed it to be accessed through any class.
In the interface of the Singleton:
@property (strong, nonatomic) UIDatePicker *datePicker;

In the implementation of the Singleton I implemented a getter for the datePicker.
- (UIDatePicker *)datePicker
{
    if (!_datePicker) {
        _datePicker = [[UIDatePicker alloc] init];
    }

    return _datePicker;
}

This ensured datePicker was being created only once, and it can be accessed from anywhere in my app.
Now in the viewDidLoad method of the class where you would need to use the picker, get the property through the getter method:
UIDatePicker *aDatePicker = [[MySingleton shareInstance] datePicker];
// Set it's location.
    [aDatePicker setFrame:CGRectMake(0.0, 236.0, self.view.frame.size.width, 216.0)];
// Connect to any actions
    [aDatePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged];
// Add it to you view
    [self.view addSubview:[[MySingleton shareInstance] datePicker]];

The sluggish behaviour will happen for the first time when the date picker is being created. Every other time the modal view will appear blazingly fast (depending what else you had in the view).
Essentially I was creating a global variable and keeping it around so that I didn't have to create it every time, at the cost of memory. The performance difference made it worthwhile in my apps case.
NOTE:
There is one caveat to watch for though. Since the datePicker will most likely outlive the modal view, it is imperative to make sure that the datePicker is not pointing to any deallocated memory.
So if "self" was assigned as a target in viewDidLoad:
[aDatePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged];

It's important that in a method such as viewDidDisappear to add this code to prevent a crash:
[aDatePicker removeTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged];

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to use multiprocessing package in Python? I have to calculate continuous wavelet transform of huge set of signals. For this purpose I use scipy.signal.cwt function. However, using of only one CPU takes a lot of time, that's why I wanna use all CPU's.
Here is convinient way:
(I create random signal only for reproducibility)
import numpy as np
import random
from scipy import signal

random.seed(0)
comp = 10
trace = np.zeros(1000)
t = np.linspace(0,1,1000)

for i in range(comp):
    frq = random.gauss(40,10)
    ampl = random.uniform(0,.01)
    fi = random.uniform(-np.pi,np.pi)
    comp_i = ampl*np.sin(2*np.pi*frq*t+fi)
    trace += comp_i

sampling_freq = 500 # Hz

def width(freq, sampling_freq):
    return sampling_freq*(2.0*np.pi*freq)**(-.5)

def cwt(f):
    cwt = signal.cwt(trace, signal.ricker, [width(i,sampling_freq)])
    return cwt

cwt_all = []

for i in range(1,81):
    cwt_i = cwt(i)
    cwt_all.append(cwt_i)

And that's how I use multiproccessing package:
import multiprocessing as mp

results = []

def collect_results(result):
    results.extend(result.tolist())

if __name__ == '__main__':

    pool = mp.Pool(processes=mp.cpu_count())
    for i in range(1,81):
        pool.apply_async(cwt, args=(i), callback=collect_results)
        pool.close()
        pool.join()

And now it's running infinitely long and python doesn't use CPU.
What am I doing wrong?
Thank you in advance!


text:
Q: How do I call an outside method within a callback object? I'm currently trying to implement a way for customers to pay online through my company's website, but I'm having troubles being able to call other methods that are outside the callback object.  Here is a snippet of the code that I'm trying to execute and having issues with:
OpenLightBox(txn_type, invoices, amount, customer){

        $.get('/token_req',
            {
                amount: amount,
                invoice: `#9999999`,
                type: txn_type == "cc" ? "ccsale" : "ecspurchase",
                email: customer.Email,

            }, (response) => {

            let token = response;

            let paymentFields = {
                ssl_txn_auth_token: token
            }

            let callback = {
                onError: (error) => {
                    console.error(error);   // api/payment_error
                },
                onDeclined: (response) => {
                    console.error(response.ssl_result_message); // api/payment_decline
                },
                onApproval: (response) => {
                    this.PayInvoices(response, invoices); // error this.PayInvoices is not defined
                }
            };

            PayWithConverge.open(paymentFields, callback);

        })
    }

    PayInvoices(response, invoices){
        console.log({invoices});
        console.log({response});
    }

    FormatDate2(dateIn){
       let [month,day,year] = dateIn.split('/');
       return `${year}-${month}-${day}`;
    }

PayWithConverge is a method that comes from an asynchronous script inside my index.html file.
The issue occurs when I have a successful transaction and when I try to call my PayInvoices method.
I tried using .bind(this); on just about everything that I could think of but still run into the same issue.
I want to know if it's possible to call methods that are outside this callback object, and if so, how could I do that given the code I have here?  Thanks!
EDIT
The OpenLightBox method is being called like this within my code:

Pay Invoice

                    <Invoice invoices={this.state.Invoices} customer={this.state.Customer} getToken={this.OpenLightBox}></Invoice>

A: It is because this refers to the Object inside get function.
Move it outside, above $.get
OpenLightBox(txn_type, invoices, amount, customer){

        let callback = {
            onError: (error) => {
                console.error(error);
            },
            onDeclined: (response) => {
                console.error(response.ssl_result_message);
            },
            onApproval: (response) => {
                this.PayInvoices(response, invoices);
            }
        };
// .... rest of your code

Because arrow functions have lexical this binding.
You can also keep it where it is but use regular functions, i.e:
    let callback = {
        onApproval: function(response) {
            this.PayInvoices(response, invoices);
        }
        // ... rest of code
    };


text:
Q: Flex 3: Which components to use to build a custom video bar (like Youtube player)? I need to develop a custom FLV video player with some features like Youtube's player: a "double" progress bar with loading and playing information, and the ability to click it to navigate the video.
Which components should I use to accomplish this?
Maybe 2 progress bars on top of each other? If so, then how can I click on it to navigate to a certain part of the video?
Thanks in advance!


text:
Q: TLS Handshake timeout in AWS ECR login I'm trying to push docker image from my local machine CMD into AWS ECR. And for that first I'm trying to get the ECR login & password and then piping it into docker login. Below command is giving me error. Please advise.
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin .dkr.ecr.us-east-1.amazonaws.com
Error - Error response from daemon: Get "https://.dkr.ecr.us-east-1.amazonaws.com/v2/": net/http: TLS handshake timeout

A: It looks like you're missing the aws_account_id in you URI (which belongs before the dkr.ecr.us-east-1.amazonaws.com part of the command you cite)
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin <aws_account_id>.dkr.ecr.us-east-1.amazonaws.com


text:
Q: SQL Server Integration Service Error message I have the next query in a SSIS task
UPDATE Table_A
SET
   Table_A.column1 = Table_B.column1,
   Table_A.column2 = Table_B.column2,
   Table_A.column3 = Table_B.column3,
   Table_A.column4 = Table_B.column4,
   Table_A.column5 = Table_B.column5
FROM
   Table_A
INNER JOIN
   Table_B ON (Table_A.column6 = Table_B.column6)
            AND (Table_A.column7 = Table_B.column7)
            AND (Table_A.column8 = Table_B.column8)

But when I execute the program, I get this error:

Execute SQL Task Error: Executing the query "UPDATE Tabla_A
  SET
  Tabla_A..." failed with the following error: "The statement has been terminated.".
  Possible failure reasons: Problems with the query,
  "ResultSet" property not set correctly, parameters not set correctly,
  or connection not established correctly.

Is there something wrong with the query?. I am using Microsoft Visual Studio 2010


text:
Q: Sparse File Compression Zones vs Sparse Ranges I am new to sparse files and wondering if compression zones and sparse ranges are the same thing.
I recently learned the term compression units from here:
http://www.flexhex.com/docs/articles/sparse-files.phtml

When it comes to a compressed or a sparse file, NTFS divides the file into chunks called compression units.

However in this example they have sparse ranges:
https://code.msdn.microsoft.com/windowsdesktop/CSSparseFile-6e26dc97

SetSparseRange...The minimum sparse size is 64KB.

From reading elsewhere I see that NTFS disk clusters are 4kb in size and windows defines a compression unit as a collection of 16 units each 4kb...
16 * 4 == 64kb so are they the same?
I can how in Microsoft NT world they have a different term (compression units) than others (sparse ranges) but I'm not sure if I have this correct.
I am having a tough time finding thorough documentation so if you know of any resources I will gladly look into them.
TIA


text:
Q: PIL show Image only RGB Values (Image from PlanetScope Planet Product) I have this image (which was taken from Planet Lab's PlanetScope product (not sure if that matters)). The image file is a .tif file and has 4 channels: R, G, B, and NIR. Link to original image here: https://drive.google.com/open?id=1g9tZar41tU3E_y5oev1Gy77hGiKB1q7L
I'm just trying to do something basic where I am trying to load the image into Pillow using Python and using Matplotlib to show the image. But, I think what's happening is that the fourth channel is being assumed to be an alpha channel so the images look a bit weird. I want to only visualize the R, G, B components. How do I do this?
I currently have something like this:
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image

img = Image.open(image_file)
plt.imshow(img)

# Subsetting the array
img_arr = np.array(img)

# Plotting only the first 3 channels
plt.imshow(img_arr[:, :, 0:3])

# After asking PIL to drop NIR Channel
img_rgb = Image.open(image_files).convert('RGB')
plt.imshow(img_rgb)

In both cases, the images look like it's not really plotting RGB

EDIT: I did img = Image.open(image_file).convert('RGB') and the image looks roughly the same?


text:
Q: Need to make a list by splitting the given string in python Input string has 'n' times of X. Like this "XXXXX"
Need to split the string and make out a list in which each character of the string(X) is each element of list.
Constraints:
0 <= X <= any number
'n' is unknown
Example 1: X is 12,
Input string : "121212121212121212"
Output list : [12,12,12,12,12,12,12,12,12]
Example 2: X is 2,
Input string : "2222"
Output list : [2,2,2,2]
Example 3: X is 489,
Input string : "489489489"
Output list : [489,489,489]
I tried this approach
my_list = list(input_string)
I am getting output like,
[1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2]
Can anyone help me to resolve this?
Edit 1: I am new to stackoverflow. Please help me to edit this question properly.
Edit 2: As this question is clear and understandable, please consider upvoting.

A: To decode this string you need 'n' and X anyway.
Why not build it directly with:
li = [X] * n

Edit:
If you don't have 'n', you could get it easily from the given string.
(Under the condition that givenString only consist of X)
n = len(givenString) / len(str(X))
li = [X] * n

A: You can use regular expressions:
import re

x = input('Enter Your X : ')
mystr = input('Enter Your Input String : ')

result = re.findall(x, mystr)
print(result)

This outputs:
Enter Your X : 12
Enter Your Input String : 121212121212
['12', '12', '12', '12', '12', '12']

A: Here's a variant that makes sure the substrings all match the given pattern:
input_ = "121212121212121212"
x = "12"
res = []
while input_.startswith(x):
    res.append(x)
    input_ = input_[len(x):]

A: If X is also unknown, you can use this:
import textwrap

def find_shortest_pattern(input_):
     for len_ in range(1, int(len(input_) / 2) + 1):
          patterns = textwrap.wrap(input_, len_)
          if all(pattern == patterns[0] for pattern in patterns):
               return patterns[0]

find_shortest_pattern("123123123")


text:
Q: Insert React component into a String variable with html content I need to insert a React component into a String variable that contains html content.
This variable will be render with dangerouslySetInnerHTML.
I replace my placeholder "!#ShareButton" with the content of my React component, but it renders [object Object] instead of the component itself
React component:
const ShareThis = ({ text }) => {
  return (

{text}

)}

export default ShareThis

var content (string variable with html content)

Text 1

!#ShareButton

Text 2

Page:
const htmlcontent = content.replace(/!#ShareThis/g,
  <ShareThis
    text="Hello"
  />)

return (

)

Result:
Text 1
[object Object]
Text 2

Do you know how to insert a React component into a String variable with html content?

A: You can't render React component as innerHTML because its an object, don't confuse between JSX and HTML.
To solve it your need content to be a valid HTML.
Can be done by making ShareThis a function returning a valid HTML as a string:
const ShareThis = ({ text }) => {
  return `<div class="one-line">${text}</div>`;
};

const content = `

Text 1

!#ShareButton

Text 2

`;

const htmlcontent = content.replace(
  /!#ShareButton/g,
  ShareThis({ text: "Hello" })
);

const App = () => {
  return
;
};

Note that you have a typo in regex expression: /!#ShareButton/

A: I don't know what use case are you trying to solve using this but you can edit your shareThis function like this to return html as a string to use it as innerHtml later:
const ShareThis = ({ text }) => {return (
   `<div class="one-line">${text}</div>`
)}
export default ShareThis

This should work..

A: Another possible alternative would be to use the utility React HTML Parser which can convert HTML strings into react components (JSX).
Building on the example provided by Dennis:
import React from "react";
import ReactHtmlParser from "react-html-parser";

const ShareThis = ({ text }) => {
  return `<div class="one-line">${text}</div>`;
};

const content = `

Text 1

!#ShareButton

Text 2

`;

const htmlcontent = content.replace(
  /!#ShareButton/g,
  ShareThis({ text: "Hello" })
);

export default function App() {
  return
{ReactHtmlParser(htmlcontent)}
;
}

Working example


text:
Q: Parser JSON not responding as it should respond I am trying to check some details from my JSON object but the problem is when I get the data from the JSON and comparing to another there is a problem that I cannot figure out.
I am trying to take the "status" (string of true / false) field from the JSON and compare to string of true string and then print another field from the JSON the problem is that it not enter into the if segment even though it need to true == true
The JSON object -
[
{
    "latitude":"33.33",
        "longitude":"44.44",
        "name":"test1",
        "Notification":"true",
        "status":"true"
},
{
    "latitude":null,
        "longitude":null,
        "name":null,
        "Notification":null,
        "status":"false"
}
]

        try {

        JSONArray jsonarray = new JSONArray(answer);
        for (int i = 0; i < jsonarray.length() - 1; i++) {
            JSONObject jsonobject = jsonarray.getJSONObject(i);

            String a = jsonobject.getString("status"); // for the first is true and the second is false

            if(a == "true"){ // not enter to this if a equal to true
                Log.d("test",jsonobject.getString("status"));
            }
        }
    }catch(Exception e)
    {
        e.printStackTrace();
    }

I would be happy if someone can help me to understand what is the problem.  Thanks.

A: Use this
   try {

    JSONArray jsonarray = new JSONArray(answer);
    for (int i = 0; i < jsonarray.length() - 1; i++) {
        JSONObject jsonobject = jsonarray.getJSONObject(i);

        String a = jsonobject.getString("status"); // for the first is true and the second is false

        if(a.equals("true")){ // not enter to this if a equal to true
            Log.d("test",jsonobject.getString("status"));
        }
    }
}catch(Exception e)
{
    e.printStackTrace();
}


text:
Q: authentication redirect with offline webapp (gae python, html5) To GAE+html5 gurus out there :)
When user logs on to a GAE hosted application, his credentials are stored locally in a cookie (correct?).
After this cookie expires (e.g. if users hits logout on another browser tab), no login_required protected methods will work.
Regular webapp will require re-authentication next time the user navigates to a login_protected url by  automatically redirecting to a login screen.
What would be the right way for a cached webapp to be handling this?
My test is a simple login_protected page accessed by Chrome and iOS browser. It's cached and accessible offline as expected. Then, (while online) and after the authentication expires, the server log shows a 302 response which is followed by 200 response of the authentication dialog page, but of course no authentication happens.
Thanks!

A: If you are using google authentication to provide access to your page . Which means even if you are logged in one of the other google services. Your cookie still exists in the browser. login_required will assume that you are logged on based on the cookie. What you are seeing is a redirection to google's page that's 302. If you want you can manage sessions on your own and check for authentication based on your data in data Store.There are lot of solutions availble for both Python and Java .


text:
Q: What is a transfer function? If:

*

*$N$ is a set of nodes in a program dependence graph, which is a graph with two type of edge

*$L$ is a lattice of security levels

What does the following mean:
"For every $x\in N$, a so-called transfer function $f_{x}:L\rightarrow L$ must be defined". Of specific interest is what the notation $f_{x}$ represents, and understanding the purpose/definition of a transfer function.
Furthermore, in this context what does this mean:
"The theory demands that all $f_{x}$ are monotone."
I am having a hard time determining what "monotone" means, possibly because I don't understand the notation $f_{x}$.
The text I'm referring to can be found in the third and fourth paragraphs of section 4.2 of this document. It is related to the computer science concept "monotone data flow analysis framework."

A: The notation $f_x$ denotes a separate function specified at each node $x$. For each $x$, the transfer function $f_x$ of node $x$ must be monotone. On this, see e.g. Wikipedia. The condition for monotonicity is $x\le y\implies f(x)\le f(y)$. If you think of lattices as algebraic structures rather than partial orders, see, again, Wikipedia for the connection.
As regards the "transfer function": This term is being used in a way specific to this field; you'll need to understand the theory to understand why they call it that; it doesn't correspond to any general mathematical usage. It sounds as if the reference [$29]$ should explain the term, but I don't know, since it's not freely available.


text:
Q: How to sort an array(in ascending order) based on the ranks of each element which is in the another array? Let two arrays
arr = [1,5,6,3,10]

rank = [100,0,1,100,2]

Based on the rank array (Which holds the ranks of the mirror elements in the arr) the result should be
[5,6,10,1,3]

The first element in the result is 5

(The index of 5 in arr is arr[1] and the index of 0 in rank is
rank[1]. This is how we have to take ranks.  0 is smallest of all ranks so 5 is printed first )

The second element in the result is 6

The index of 6 in arr array is at the index arr[2] and its rank is
1 because that is at the index rank[2]. 1 is the second smallest
of all ranks so 6 is printed next)
This is how we have to sort the array based on the rank array.
Here if two ranks are same then we have to compare the values in the array itself and print the smaller first
arr[0] = 1 and arr[3] = 3 Both having same ranks 100. So compare those elements and print the smallest value. That gives the

result
5,6,10,1,3

A: The short answer is: std::sort.
The long answer depends on how you store the values and the ranks, whether you can afford to copy them, and whether you also need the ranks sorted. For the following I assumed that you do not need the ranks sorted and the sorting is done on the original container of values. It is not the most efficient implementation, but it is simple enough to get you started:
#include <vector>
#include <utility>
#include <algorithm>
#include <iostream>
#include <iterator>

template <typename Iter,typename RankIter>
void rank_sort(Iter begin,Iter end,RankIter rankbegin){
    std::vector<std::pair<typename std::iterator_traits<RankIter>::value_type,
                          typename std::iterator_traits<Iter>::value_type >> res;
    for (auto beg = begin; beg != end; ++beg,++rankbegin) res.emplace_back(*rankbegin,*beg);
    std::sort(res.begin(),res.end());
    for (const auto& e : res){
        *begin = e.second;
        ++begin;
    }
}

int main() {
    std::vector<int> arr{1,5,6,3,10};
    std::vector<int> rank{100,0,1,100,2};
    rank_sort(arr.begin(),arr.end(),rank.begin());
    for (const auto& a : arr) { std::cout << a << " ";}
}

The basic idea is to create a std::vector<std::pair<int,int>> and then simply sort that via std::sort. The rest of the code is about copying the values and ranks into that vector and copying the values out of it after sorting.
If possible you should store the values and ranks in a std::vector<std::pair<int,int>> in the first place. Then sorting them is trivial. Alternatively, as mentioned in a comment, you can use a sorted container, like eg a std::map.


text:
Q: Spring Data QuerydslBinderCustomizer MongoDb List querying I have 2 documents mapped to MongoDb
    @Document
    public class Blog {
        @Id
        private String id;
        private String name;
        private List<Article> articles = new ArrayList<>();
....

and
    @Document
    public class Article {
        @Id
        private String id;
        private String name;
        private String author;
...

I'm using QuerydslBinderCustomizer for binding. When I`m binding for example String.class all works perfectly:
/blogs?name=blog_name&id=3409845jk45

public interface BlogRepository extends MongoRepository<Blog, String>
        , QueryDslPredicateExecutor<Blog>, QuerydslBinderCustomizer<QBlog> {

    @Override
    default public void customize(QuerydslBindings bindings, QBlog root) {

        bindings.bind(String.class)
            .first((StringPath path, String value) -> {
                return path.eq(value);
             });
    }
}

But I can`t find out how to bind something like this:
/blogs?name=blog_name&articles.name=nice_article

for querying in Mongo something like this:
Predicate filterBlog = qBlog.name.eq(parameters.getFirst("name"))
                .and(qBlog.articles.any().author.eq(parameters.getFirst("articles.name")));

return (List<Blog>) blogRepository.findAll(filterBlog );


text:
Q: Excel VBA - Error with sheet selection and check multiple sheets My code stands like this:
Sub Tele()

    Dim rowLoop As Long
    rowLoop = 1
    strValueToFind = Application.InputBox("Enter a Search value in format xx.xx.xxxx, remember that this will only work if you are on 'Tidal' tab", Title:="DATE FIND", Default:=Format(Date, "Short Date"), Type:=1)
    ' Loop column A to find value, number corrosponds to letter position in alphabet
    For rowLoop = 1 To Rows.Count
        If Sheets("2015").Cells(rowLoop, 1).Value = strValueToFind Then ' If value is in C then do something
            ' start on cell found from date needed - look at copying range on same Column
            ' -------------------------------------------------------------------------------------------'
            Sheets("Vessels").Range("C09").Value = Cells(rowLoop, 1).Offset(0, 1).Resize(1).Value
            Sheets("Vessels").Range("C10").Value = Cells(rowLoop, 1).Offset(0, 3).Resize(1).Value
            Sheets("Vessels").Range("C11").Value = Cells(rowLoop, 1).Offset(0, 5).Resize(1).Value
            Sheets("Vessels").Range("C12").Value = Cells(rowLoop, 1).Offset(0, 7).Resize(1).Value
            ' Copy cells 1 cell below found value - Montrose?
            Sheets("Vessels").Range("D09").Value = Cells(rowLoop, 1).Offset(0, 2).Resize(1).Value
            Sheets("Vessels").Range("D10").Value = Cells(rowLoop, 1).Offset(0, 4).Resize(1).Value
            Sheets("Vessels").Range("D11").Value = Cells(rowLoop, 1).Offset(0, 6).Resize(1).Value
            Sheets("Vessels").Range("D12").Value = Cells(rowLoop, 1).Offset(0, 8).Resize(1).Value
            MsgBox ("Found value on col " & rowLoop) '
            Exit Sub
        End If
    Next rowLoop ' This is row number, do something with this

    ' This MsgBox will only show if the loop completes with no success
    MsgBox ("Date not found, make sure you have input the date correctly and on the right tab")

End Sub

So here we make the user input a date it searches sheet 2015 and copies some cells based off that position.
Problem:
If on a different sheet, macro does some strange things, using the cell position on that particular sheet.
Currently the code can only check one sheet for the date, I need it to check a total of 5 sheets, 2015 to 2020.
I tried seperating by commas on the if statement inside the sheets parenthesis but I suppose it's not that easy.
Any help or clarification on the error would be great, thank you in advance!

A: The code needs to be modified in two ways:-

*

*Setup a loop for the worksheets from 2015-2020

*Set explicit references to Cells so that they operate on the correct worksheet

You still have a logic problem. The code below will iterate through 5 sheets (or whatever you add to the array), but each one will overwrite the same cells on the `Vessels' worksheet. I doubt this is what you are looking for.
Try this (in concept):-
Sub Tele()

    Dim rowLoop As Long
    rowLoop = 1
    strValueToFind = Application.InputBox("Enter a Search value in format xx.xx.xxxx, remember that this will only work if you are on 'Tidal' tab", Title:="DATE FIND", Default:=Format(Date, "Short Date"), Type:=1)

    '*** REFACTOR THIS - change how sheets are selected. You haven't said if other sheets exists
    'Select the sheets to work through
    Sheets(Array("2015", "2016", "2017", "2018", "2019", "2020")).Select

    For Each ws In ActiveWindow.SelectedSheets

      Debug.Print "Checking " & ws.Name

      ' Loop column A to find value, number corrosponds to letter position in alphabet
      For rowLoop = 1 To Rows.Count
        If ws.Cells(rowLoop, 1).Value = strValueToFind Then ' If value is in C then do something
          ' start on cell found from date needed - look at copying range on same Column
          ' -------------------------------------------------------------------------------------------'

          '*** CHANGE THE LOGIC HERE SO SUBSEQUENT SHEETS DON'T OVERWRITE THE VALUES IN "Vessels" ***
          Sheets("Vessels").Range("C09").Value = ws.Cells(rowLoop, 1).Offset(0, 1).Resize(1).Value
          Sheets("Vessels").Range("C10").Value = ws.Cells(rowLoop, 1).Offset(0, 3).Resize(1).Value
          Sheets("Vessels").Range("C11").Value = ws.Cells(rowLoop, 1).Offset(0, 5).Resize(1).Value
          Sheets("Vessels").Range("C12").Value = ws.Cells(rowLoop, 1).Offset(0, 7).Resize(1).Value
          ' Copy cells 1 cell below found value - Montrose?
          Sheets("Vessels").Range("D09").Value = ws.Cells(rowLoop, 1).Offset(0, 2).Resize(1).Value
          Sheets("Vessels").Range("D10").Value = ws.Cells(rowLoop, 1).Offset(0, 4).Resize(1).Value
          Sheets("Vessels").Range("D11").Value = ws.Cells(rowLoop, 1).Offset(0, 6).Resize(1).Value
          Sheets("Vessels").Range("D12").Value = ws.Cells(rowLoop, 1).Offset(0, 8).Resize(1).Value
          MsgBox ("Found value on col " & rowLoop) '
          Exit Sub
        End If
      Next rowLoop ' This is row number, do something with this

    'Back for next sheet
    Next ws

    ' This MsgBox will only show if the loop completes with no success
    MsgBox ("Date not found, make sure you have input the date correctly and on the right tab")

End Sub


text:
Q: Возможно ли сохранять в localStorage динамически добавляемые input, а после перезагрузки страницы возвращать их вместе с value? Представьте, что есть плюс нажимая на который вставляется input. Таких input можно вставить сколько угодно (пусть будет 30 штук). В эти input будет вводится временная информация, которая ежедневно в определенное время будет копироваться в txt файл по нажатию кнопки(это будет делать php, а не js).
Меня волнует могу ли реализовать сохранение в localStorage динамически добавляемые input + вносимую информацию, чтобы при перезагрузки страницы, все добавленное и записанное было восстановлено до того, как я очищу хранилище?
Меня так же интересует мнение по реализации этой затеи, или все же стоит найти другой путь. Благодарю за внимание!

A: В localStorage можно сохранить любую текстовую информацию (в пределах разрешенных объемов, конечно). Эти объемы измеряются мегабайтами, так что тридцать инпутов туда поместятся. Располагайте эти инпуты внутри одного родителя, тогда Вы сможете их сохранять и восстанавливать, используя innerHTML этого родителя.

A: Реализовать такую задумку вполне возможно. Предлагаю для хранения введённых значений на форме использовать какой-то предопределённый ключ, а значением будет сериализованный массив, описывающий состояния полей ввода.
Вот пример. Запустить его можно на отдельном сайте.

document.getElementById('b').addEventListener('click', function() {
  // Сохраняем значения в виде массива.
  var data = [];
  data.push(document.getElementById('t1').value);
  data.push(document.getElementById('t2').value);
  data.push(document.getElementById('t3').value);
  localStorage.setItem('k', JSON.stringify(data));
});
window.addEventListener('load', function() {
  // Загружаем их, распаковывая сохранённый массив.
  var data = JSON.parse(localStorage.getItem('k'));
  document.getElementById('t1').value = data[0];
  document.getElementById('t2').value = data[1];
  document.getElementById('t3').value = data[2];
});
<input id="t1">

<input id="t2">

<input id="t3">

<button id="b">Save</button>


text:
Q: SwiftUI: Malfunctioning NavigationBar and TabBar in iOS 15 In SwiftUI, I would like to use a background color for my view while also setting navigationViewStyle to .stack, to force a single-column stack navigation Plus-sized devices.
    var body: some View {
        TabView {
            NavigationView {
                ScrollView {
                    ForEach(0..<100) { _ in
                        Text("Hello, world!")
                            .padding()
                    }
                    .frame(maxWidth: .infinity)
                }
                .navigationTitle("Demo")
//                .background(Color.yellow) // I can do this …
            }
//            .navigationViewStyle(.stack) // … or this, but not both!
            .tabItem {
                Label("Demo", systemImage: "swift")
            }
        }
    }

However, when I do both, the navigation bar won't collapse when I scroll down. Also both the navigation bar and tab bar appear without background.

When I only set the background, but leave out the line that sets the navigationViewStyle, everything looks fine in portrait mode, or smaller devices. But on a Plus-size device in landscape, it looks like this:

So I guess I really can't do this without setting the navigationViewStyle.
What can I do to fix this? Is this a bug that should be fixed by Apple? All help is greatly appreciated.

A: Use the .navigationViewStyle  view modifier on the ScrollView
struct ContentView: View {
    var body: some View {
           TabView {
               NavigationView {
                   ScrollView {
                       ForEach(0..<100) { _ in
                           Text("Hello, world!")
                               .padding()
                       }
                       .frame(maxWidth: .infinity)
                   }
                   .navigationTitle("Demo")
                   .background(Color.yellow)
                   .navigationViewStyle(.stack)

               }
               .tabItem {
                   Label("Demo", systemImage: "swift")
               }
           }
       }
}

Update
I guess, it is a bug. It does not work.
1
If all of your ScrollViews have the same background, use this once on a view.
struct ScrollViewBackground: ViewModifier {

    let color: Color

    func body(content: Content) -> some View {
        content
            .ignoresSafeArea(edges: .horizontal)
            .onAppear {
                UIScrollView.appearance().backgroundColor = UIColor(color)
            }

    }
}

extension View {
    func setBackgroundColor(color: Color) -> some View {
        return self.modifier(ScrollViewBackground(color: color))
    }
}

2
Use introspect to access the underlaying UIScrollView and change its background. You need to also use .ignoresSafeArea(edges: .horizontal) on the ScrollView.
ScrollView {
    Text("Item 2")
}
.introspectScrollView { scrollView in
    scrollView.backgroundColor = UIColor(color.yellow)
}


text:
Q: Using .htaccess to run PHP code within index.html I'm trying to test executing php code within my index.html. To test this I'm using:
<?php
        phpinfo();
?>

If I change the file to .php it works fine, but I want it to execute as .html . I set up a .htaccess to do this but it's not working. This is my .htaccess:
<Files index.html>
AddType application/x-httpd-php5 .html
</Files>

Both index.html and .htaccess are located in var/www/html. Why is the .html file not processing as .php when it has php code?

A: The reason why the web server is not passing the index.html file thru the PHP interpreter is that the mime-type has not been associated with it.
You need to use the AddHandler directive to set it.
In order to associate the type you've added, it really depends on what your setup is. Various scenarios might be: php-fpm, mod_php, cgi.
An example using CGI is:
Action application/x-httpd-php5 "/path/to/php"

Bear in mind that this setting is usually not available on shared hosting. If you are using one, consider contacting the support helpdesk.
Consider having a look at this duplicate question: Parsing HTML files as PHP
I would suggest against adding a handler. You should rather rename the index.html file to index.php. If this is not picked by Apache, you can correct it using DirectoryIndex index.php.
I hope this helps.


text:
Q: I need help with this rate of change problem The solid shown in the figure below consists of a cylinder of the radius (r) and height (h)
and a hemispherical void of the radius (r). The dimensions at a given instant (t) are:
$$h(t)=3t^2+2;r(t)=8-\frac{t^2}{4}$$
Find the rate of change of the volume (V) and surface area (S) of the solid at $t = 4$
seconds. State whether (V) and (S) are increasing, decreasing or neither.
Note:
The volume of Sphere =$\frac{4}{3}πr^3$
$(Ans: \frac{dV}{dt} = - 1105.84 (Deceasing))$

I tried this:
$$\frac{dV}{dt}=\frac{\partial{V}}{\partial{r}}*\frac{dr}{dt}$$
and said:
$$t=4$$
$$r(4)=4$$
$$\frac{\partial{V}}{\partial{r}}=4πr^2;\frac{dr}{dt}=\frac{-t}{2}$$
so:$$\frac{dV}{dt}=(4πr^2)*(\frac{-t}{2})$$
and the final result I get:
$$\frac{dV}{dt}=128π$$
What am I doing wrong?

A: Volume-->
$$V=\pi r^2h-\frac{2}{3}\pi r^3$$
$$V=\pi (8-\frac{t^2}{4})^2(3t^2+2)-\frac{2}{3}\pi (8-\frac{t^2}{4})^3$$
$$\frac{dV}{dt}=\pi[(3t^2+2)*2(8-\frac{t^2}{4})*(\frac{-t}{2})+(8-\frac{t^2}{4})^2*6t]-[\frac{2}{3}\pi *3(8-\frac{t^2}{4})^2*(\frac{-t}{2})]$$
$$\frac{dV}{dt}=\pi[\frac{19}{16}t^5-\frac{103}{2}t^3+432t]$$
At $t=4s$,
$$\frac{dV}{dt}=\pi[\frac{19}{16}*4^5-\frac{103}{2}*4^3+432*4]=-352\pi\approx-1105.84$$
Surface Area-->
$$A=2\pi rh+3\pi r^2$$
$$A=2\pi(8-\frac{t^2}{4})(3t^2+2)+3\pi(8-\frac{t^2}{4})^2$$
$$\frac{dA}{dt}=\pi[2(3t^2+2)(\frac{-t}{2})+3*2(8-\frac{t^2}{4})(\frac{-t}{2})]$$
$$\frac{dA}{dt}=\pi[\frac{-9}{4}t^3-26t]$$
At $t=4s$,
$$\frac{dA}{dt}=\pi[\frac{-9}{4}*4^3-26*4]=-248\pi\approx-779.115$$


text:
Q: How can i make a call from an android app ? I am doing it in Detail Activity I want to make a call from my android app (from Detail Activity). I am using this code, there's not any error in it but when i run the app on my virtual device, Call button isn't work.
Kindly help if anyone got this.
Here is my Detail Activity class
    package com.example.sj.dgapps3;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.google.android.gms.appindexing.Action;
import com.google.android.gms.appindexing.AppIndex;
import com.google.android.gms.common.api.GoogleApiClient;

public class DetailActivity extends AppCompatActivity {
    protected String name;
    Button b;
    /**
     * ATTENTION: This was auto-generated to implement the App Indexing API.
     * See https://g.co/AppIndexing/AndroidStudio for more information.
     */
    private GoogleApiClient client;
    //protected String pos;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        name = getIntent().getStringExtra(MainActivity.Name);
        TextView textView = (TextView) findViewById(R.id.name);
        textView.setText(name);

        String pos = getIntent().getStringExtra(MainActivity.Position);
        TextView textView1 = (TextView) findViewById(R.id.position);
        textView1.setText(pos);

        String qual = getIntent().getStringExtra(MainActivity.Qualification);
        TextView textView2 = (TextView) findViewById(R.id.qualification1);
        textView2.setText(qual);

        String exp = getIntent().getStringExtra(MainActivity.Expertise);
        TextView textView3 = (TextView) findViewById(R.id.expertise1);
        textView3.setText(exp);

        final String con = getIntent().getStringExtra(MainActivity.Contact);
        TextView textView4 = (TextView) findViewById(R.id.contact1);
        textView4.setText(con);

        String pic1 = getIntent().getStringExtra(MainActivity.Pic);
        ImageView imageView = (ImageView) findViewById(R.id.imageView);
        int pic = getResources().getIdentifier(pic1, "drawable", getPackageName());
        imageView.setImageResource(pic);

        b = (Button) findViewById(R.id.button);
        b.setOnClickListener(
                new View.OnClickListener() {
                    public void onClick(View view) {

                        String phNum = "tel:" + con;
                        Intent myIntent = new Intent(Intent.ACTION_CALL, Uri.parse(phNum));
                        //myIntent.setData(Uri.parse(phNum));
                        if (ActivityCompat.checkSelfPermission(DetailActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
                            // TODO: Consider calling
                            //    ActivityCompat#requestPermissions
                            // here to request the missing permissions, and then overriding
                            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
                            //                                          int[] grantResults)
                            // to handle the case where the user grants the permission. See the documentation
                            // for ActivityCompat#requestPermissions for more details.
                            return;
                        }
                        startActivity(myIntent);
                    }
                });
        /*b.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent in = new Intent(Intent.ACTION_CALL);
                String phone = "tel:" + con;
                in.setData(Uri.parse(phone));
                startActivity(in);
            }
        });
*/
        /*Button b = (Button) this.findViewById(R.id.button);
        b.setOnClickListener(new View.OnClickListener() {
            @Override*//*
            public void onClick(View v) {
        Intent callIntent = new Intent(Intent.ACTION_CALL);
        String phone = "tel:" + con;
        callIntent.setData(Uri.parse(phone));
        startActivity(callIntent);
    }*/

                /*if (ActivityCompat.checkSelfPermission(DetailActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
                    // TODO: Consider calling
                    //    ActivityCompat#requestPermissions
                    // here to request the missing permissions, and then overriding
                    //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
                    //                                          int[] grantResults)
                    // to handle the case where the user grants the permission. See the documentation
                    // for ActivityCompat#requestPermissions for more details.
                    return;
                }*/

        /*});*/

        /*ImageView imageView = (ImageView) findViewById(R.id.imageView);
        int res = getResources().getIdentifier(TeamDetails.getPic(), "drawable", context.getPackageName());
        imageView.setImageResource(res);*/

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
        // ATTENTION: This was auto-generated to implement the App Indexing API.
        // See https://g.co/AppIndexing/AndroidStudio for more information.
        client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
    }

    @Override
    public void onStart() {
        super.onStart();

        // ATTENTION: This was auto-generated to implement the App Indexing API.
        // See https://g.co/AppIndexing/AndroidStudio for more information.
        client.connect();
        Action viewAction = Action.newAction(
                Action.TYPE_VIEW, // TODO: choose an action type.
                "Detail Page", // TODO: Define a title for the content shown.
                // TODO: If you have web page content that matches this app activity's content,
                // make sure this auto-generated web page URL is correct.
                // Otherwise, set the URL to null.
                Uri.parse("http://host/path"),
                // TODO: Make sure this auto-generated app deep link URI is correct.
                Uri.parse("android-app://com.example.sj.dgapps3/http/host/path")
        );
        AppIndex.AppIndexApi.start(client, viewAction);
    }

    @Override
    public void onStop() {
        super.onStop();

        // ATTENTION: This was auto-generated to implement the App Indexing API.
        // See https://g.co/AppIndexing/AndroidStudio for more information.
        Action viewAction = Action.newAction(
                Action.TYPE_VIEW, // TODO: choose an action type.
                "Detail Page", // TODO: Define a title for the content shown.
                // TODO: If you have web page content that matches this app activity's content,
                // make sure this auto-generated web page URL is correct.
                // Otherwise, set the URL to null.
                Uri.parse("http://host/path"),
                // TODO: Make sure this auto-generated app deep link URI is correct.
                Uri.parse("android-app://com.example.sj.dgapps3/http/host/path")
        );
        AppIndex.AppIndexApi.end(client, viewAction);
        client.disconnect();
    }
}

And here is my XML file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.example.sj.dgapps3.DetailActivity"
    tools:showIn="@layout/activity_detail">

    <ImageView
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:id="@+id/imageView"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/name"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/imageView"
        android:layout_marginTop="45dp"
        android:layout_marginLeft="40dp"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/position"
        android:layout_below="@+id/name"
        android:layout_toRightOf="@+id/imageView"
        android:layout_alignParentRight="true"
        android:layout_marginLeft="50dp"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/qualification"
        android:text="Qualification:"
        android:layout_below="@+id/imageView"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginTop="43dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/expertise"
        android:text="Expertise:"
        android:layout_below="@+id/qualification"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/contact"
        android:text="Contact:"
        android:layout_below="@+id/expertise"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/qualification1"
        android:layout_alignBottom="@+id/qualification"
        android:layout_toRightOf="@+id/qualification"
        android:layout_marginLeft="50dp"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/expertise1"
        android:layout_alignBottom="@+id/expertise"
        android:layout_alignLeft="@+id/qualification1"
        android:layout_alignStart="@+id/qualification1" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/contact1"
        android:layout_alignBottom="@+id/contact"
        android:layout_alignLeft="@+id/qualification1"
        android:layout_alignStart="@+id/qualification1" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Call"
        android:id="@+id/button"
        android:layout_marginBottom="68dp"
        android:onClick="onClickCall"
        android:layout_alignParentBottom="true"
        android:layout_alignRight="@+id/imageView"
        android:layout_alignEnd="@+id/imageView" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="SMS"
        android:id="@+id/button2"
        android:layout_alignTop="@+id/button"
        android:layout_alignLeft="@+id/name"
        android:layout_alignStart="@+id/name" />

</RelativeLayout>

A: Try removing this line android:onClick="onClickCall" in
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Call"
    android:id="@+id/button"
    android:layout_marginBottom="68dp"
    android:onClick="onClickCall"
    android:layout_alignParentBottom="true"
    android:layout_alignRight="@+id/imageView"
    android:layout_alignEnd="@+id/imageView" />

A: Try something like this..
Intent intent = new Intent(Intent.ACTION_CALL);

    intent.setData(Uri.parse("tel:" + number));

    try {

        startActivity(intent);

    } catch (Exception e) {
        Toast.makeText(MyActivity.this, "Error", Toast.LENGTH_SHORT).show();
    }

A: Solution 1:
remove  android:onClick="onClickCall" from your layout xml for the button
or
Solution 2:
to use onclick from xml you should declare a method like this without Listner
public void onClickCall(View v) {
    // does something
}

so you should remove this
 b.setOnClickListener(
                new View.OnClickListener() {
                    public void onClick(View view) {

                        String phNum = "tel:" + con;
                        Intent myIntent = new Intent(Intent.ACTION_CALL, Uri.parse(phNum));
                        //myIntent.setData(Uri.parse(phNum));
                        if (ActivityCompat.checkSelfPermission(DetailActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
                            // TODO: Consider calling
                            //    ActivityCompat#requestPermissions
                            // here to request the missing permissions, and then overriding
                            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
                            //                                          int[] grantResults)
                            // to handle the case where the user grants the permission. See the documentation
                            // for ActivityCompat#requestPermissions for more details.
                            return;
                        }
                        startActivity(myIntent);
                    }
                });

and do this :
public void onClickCall(View v) {
    String phNum = "tel:" + con;
                        Intent myIntent = new Intent(Intent.ACTION_CALL, Uri.parse(phNum));
                        //myIntent.setData(Uri.parse(phNum));
                        if (ActivityCompat.checkSelfPermission(DetailActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
                            // TODO: Consider calling
                            //    ActivityCompat#requestPermissions
                            // here to request the missing permissions, and then overriding
                            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
                            //                                          int[] grantResults)
                            // to handle the case where the user grants the permission. See the documentation
                            // for ActivityCompat#requestPermissions for more details.
                            return;
                        }
                        startActivity(myIntent);}


text:
Q: Ajax ViewComponent triggering multiple times I have an issue with an on-click Ajax event, triggering a Controller action/ViewComponent multiple times.
I used Ajax on a button-click to call a Controller Action, which inserts some data into the database, and then redirects to the Controller Index action/ViewComponent.
Everytime the button is clicked, more and more Ajax events are triggered (duplicate data inserted).
Here's my setup:
Add to Cart Button:
Add to Cart

JS:
 $("a[ajax-call='y']").click(function (event) {
        $(this).attr("ajax-call", "n");
        event.preventDefault();
        var urlCall = $(this).attr("href");
        var divRes = $(this).attr("ajax-res");

        $.ajax({
            type: "GET",
            url: urlCall ,
            async: true,
            success: function (data) {
                $("#" + divRes).html(data);
            }
        });
    });

CartController:
public IActionResult Index() => ViewComponent("Cart");

public IActionResult Add(int id)
{
    ... adds into db ...
    return RedirectToAction("Index");
}

CartViewComponent ~ "Cart":
public IViewComponentResult Invoke()
{
    ... populates view model ...
    return View(Model);
}

I load my JS files in the shared _Layout.cshtml. I do use a PartialView from where the  Add to Cart button is being clicked though, I think that's okay or is that someway causing this issue?
I started learning ASP.NET only recently, so I hope I'm not missing something very simple.
Thanks!

A: I think somehow you are adding multiple click events to the same element. I suggest clearing the events before adding a new click event to the element. You can use .off() just before you do click event. That will remove all click events and make sure you are only adding one. This often happens in single page applications


text:
Q: problems with adding library to my project I have created a project with intention of using hunspell functions in it. I am working in Ubuntu. I installed and compiled hunspell library and linked it with g++ -o wc.exe -lhunspell-1.6 wordcheck.cxx and everything seemed ok. But when I tried to compile and launch my project I got some errors.
#include <iostream>
#include "hunspell/hunspell.hxx"

using namespace std;

int main(int argc,char** argv)
{
    FILE* lst=fopen("wordlist.txt","r");
    if(!lst)
    {
        cerr<<"Can not open file\n";
        return 1;
    }
    Hunspell* hs=new Hunspell(argv[1],argv[2]);
    delete hs;
    return 0;
}

and the errors were:
/home/alex2/Документы/bO/wordcheck.cxx:14: undefined reference to Hunspell::Hunspell(char const*, char const*, char const*)'
/home/alex2/Документы/bO/wordcheck.cxx:15: undefined reference toHunspell::~Hunspell()'
collect2: error: ld returned 1 exit status
atus
I have no idea what is wrong. I tried using
Hunspell* hs=new Hunspell();

and got that there is a candidate for it that requires three parameters:
/usr/local/include/hunspell/hunspell.hxx:115:3: note: candidate: Hunspell::Hunspell(const char*, const char*, const char*)
   Hunspell(const char* affpath, const char* dpath, const char* key = NULL);
The only difference is char const* and const char* but I always thought it is the same thing. The entire project is similar to the example file hunspell provides and I have no idea what am I doing wrong and why my thing is not working.


text:
Q: Problems with Ant Design, mountNode I'm developing at the time a concept for an own app and I'm using Ant Design. every time I'm trying to render there are the following errors:
Failed to compile

./src/App.js   Line 59:  'ReactDOM' is not defined   no-undef   Line
  59:  'mountNode' is not defined  no-undef

Search for the keywords to learn more about each error.
This error occurred during the build time and cannot be dismissed.
can someone tell me how to fix it?

A: You are using ReactDOM but haven't imported it. Use import ReactDOM from 'react-dom'; at the top for removing first error.
For second error:
You need to tell React where to mount your component.
You probably want to replace mountNode with document.getElementById('help') to refer to your

 element.


text:
Q: How to get a clojure array-map to maintain insertion order after assoc? I have an array-map which I am associng some values into it.  After a certain size the returned value is a PersistentHashMap rather than the original PersistentArrayMap.  I've read about this behavior on a few web sites.  Is there any way to force the insertion order even after assoc?
I do have a separate function which will take a ash-map and a vector of keys, and return a "fresh" array-map with keys in this order, but it means that for each assoc, I have to extract the keys first, cons/conj the new key to the vector, then create a new array-map.  Seems kludgey, even if written in a separate function.
Is there a more direct language-supported way of keeping insertion order even on large-ish (>10, but < 50) keys array-map?
In case it's relevant, I'm using a list of array-maps as data into an incanter dataset and then outputting to excel.  The save-xls function keeps the order of the keys/columns.
Thanks

A: You can use an ordered map: https://github.com/flatland/ordered


text:
Q: Stopping services started in django appconfig ready() function? If I am starting some services or threads inside ready() function of a django application.
Here are few questions that I have in same regards:

*

*How to gracefully shutdown django server?

*Similar to ready() function is there some sort of shutdown function or should I be doing such things in some other fashion or style in django ?


text:
Q: Adding perpendicular lines to points along a polyline I'm looking for a method to add perpendicular lines at points along a polyline. Essentially I'm searching for a solution in QGIS or Python (I'm aware of an ArcGIS solution available here: http://www.arcgis.com/home/item.html?id=3f05ef15203e4a3ca88fc1d92347512b.

A similar question (How to add a perpendicular line to the start & end nodes of every polyline?) addresses what I'm looking to achieve, but again, I need a QGIS/Python solution.
Does anybody have any advice? Currently I'm using the QChainage plugin to generate equally spaced points across lines (see below), but can't find a method to generate perpendicular lines from the points.


text:
Q: Do I have to sync gradle project in Android studio everytime I start a new project? Everytime whenever I start a new project it shows the gradle sync is failed[![enter image description here][1]][1]....is this necessary to sync the gradle every time whenever i start a new project

A: What is synced here is the project configuration expressed in the *.gradle files with the project configuration native in Android Studio. So, yes, this is necessary for each project. It is also necessary after you made changes to any of the *.gradle files.

A: Yes,Whenever you open a project in android studio,it will sync the gradle files everytime,And when you edit or implement any new library in .gradle file,that time also gradle build sync.
In your project gradle build is keep failing,this happens when your code have some error or its possible that error is in .gradle file.


text:
Q: What determines which configurable option shows first, second, etc? I have configurable shirts with colors and sizes. Sizes show first in the detail view, but I want Colors to show first... how do I change this?

A: If you go into the configurable product and then click on Associated Products on the left section, you can re-sort the configurable options.
About mid-way down the page under the header of 'Super product attributes configuration', you will see a section that looks like this:

You can hover over the little orange up/down arrows and drag/drop them into the order you prefer.
As a note, I belive the default sorting comes from which attribute was created first and thus gets the lower ID number (so it's sorting by ID number until you manually change it).


text:
Q: multivaluedictkeyerror after uploading file Error when trying to upload file
There are my files below to see
and error message after files
sdfsfsdfsfd
sf
sdf
sdf
s
df
sdf
sd
fs
dfsdfsdfsdf
sdf
sd
fs
dfsd
f
sf
sf
sd
f
sf
sf
Model.py
import uuid

from django.conf import settings from django.db import models from django.urls import reverse from django.utils.translation import ugettext_lazy as _

from asgiref.sync import async_to_sync

from channels.layers import get_channel_layer

from bootcamp.notifications.models import Notification, notification_handler

class Document(models.Model):
    description = models.CharField(max_length=255, blank=True)
    document = models.FileField(upload_to='documents/')
    uploaded_at = models.DateTimeField(auto_now_add=True)

class News(models.Model):
    """News model to contain small information snippets in the same manner as
    Twitter does."""
    user = models.ForeignKey(
        settings.AUTH_USER_MODEL, null=True, related_name="publisher",
        on_delete=models.SET_NULL)
    parent = models.ForeignKey("self", blank=True,
        null=True, on_delete=models.CASCADE, related_name="thread")
    #myfile = models.FileField(null = True,blank=True)
    timestamp = models.DateTimeField(auto_now_add=True)
    uuid_id = models.UUIDField(
        primary_key=True, default=uuid.uuid4, editable=False)
    content = models.TextField(max_length=280)
    liked = models.ManyToManyField(settings.AUTH_USER_MODEL,
        blank=True, related_name="liked_news")
    reply = models.BooleanField(verbose_name=_("Is a reply?"), default=False)

    class Meta:
        verbose_name = _("News")
        verbose_name_plural = _("News")
        ordering = ("-timestamp",)

    def __str__(self):
        return str(self.content)

    def save(self, *args, **kwargs):
        super().save(*args, **kwargs)
        if not self.reply:
            channel_layer = get_channel_layer()
            payload = {
                    "type": "receive",
                    "key": "additional_news",
                    "actor_name": self.user.username

                }
            async_to_sync(channel_layer.group_send)('notifications', payload)

    def get_absolute_url(self):
        return reverse("news:detail", kwargs={"uuid_id": self.uuid})

    def switch_like(self, user):
        if user in self.liked.all():
            self.liked.remove(user)

        else:
            self.liked.add(user)
            notification_handler(user, self.user,
                                 Notification.LIKED, action_object=self,
                                 id_value=str(self.uuid_id),
                                 key='social_update')

    def get_parent(self):
        if self.parent:
            return self.parent

        else:
            return self

    def reply_this(self, user, text):
        """Handler function to create a News instance as a reply to any
        published news.

        :requires:

        :param user: The logged in user who is doing the reply.
        :param content: String with the reply.
        """
        parent = self.get_parent()
        reply_news = News.objects.create(
            user=user,
            content=text,
            reply=True,
            parent=parent
        )
        notification_handler(
            user, parent.user, Notification.REPLY, action_object=reply_news,
            id_value=str(parent.uuid_id), key='social_update')

    def get_thread(self):
        parent = self.get_parent()
        return parent.thread.all()

    def count_thread(self):
        return self.get_thread().count()

    def count_likers(self):
        return self.liked.count()

    def get_likers(self):
        return self.liked.all()

Html
{% load i18n %}
{% block content %}

{% trans "Share something new!" %}

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          ×
        </button>

        <form id="postNewsForm" method="post" action="" enctype="multipart/form-data">
          {% csrf_token %}

            <textarea id="newsInput" name="post" rows="3" class="form-control" maxlength="280"></textarea>
            280

          <input type="file" name="myfile">

        <button type="submit" id="postNews" class="btn btn-primary">
           {% trans 'Post' %}
        </button>
         <button type="button" class="btn btn-primary" data-dismiss="modal">{% trans 'Upload' %}</button>

              <button type="button" class="btn btn-default" data-dismiss="modal">{% trans 'Cancel' %}</button>
              </form>

{% endblock content %}

View.py
Dana Zholdykhairova, [29.07.18 05:48]
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponse, HttpResponseBadRequest, JsonResponse
from django.template.loader import render_to_string
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView, DeleteView
from django.core.files.storage import FileSystemStorage
from bootcamp.helpers import ajax_required, AuthorRequiredMixin
from bootcamp.news.models import News
from django.core.files.storage import FileSystemStorage
from .models import News
#from uploads.core.models import Document
#from uploads.core.forms import DocumentForm

def home(request):
    documents = Document.objects.all()
    return render(request, 'core/home.html', { 'documents': documents })

def simple_upload(request):
    if request.method == 'POST' and request.FILES['myfile']:
        myfile = request.FILES['myfile']
        fs = FileSystemStorage()
        filename = fs.save(myfile.name, myfile)
        uploaded_file_url = fs.url(filename)
        return render(request, 'core/simple_upload.html', {
            'uploaded_file_url': uploaded_file_url
        })
    return render(request, 'core/simple_upload.html')

def model_form_upload(request):
    if request.method == 'POST':
        form = DocumentForm(request.POST, request.FILES)
        if form.is_valid():
            form.save()
            return redirect('home')
    else:
        form = DocumentForm()
    return render(request, 'core/model_form_upload.html', {
        'form': form
    })

class NewsListView(LoginRequiredMixin, ListView):
    """A really simple ListView, with some JS magic on the UI."""
    model = News
    paginate_by = 15

    def get_queryset(self, **kwargs):
        return News.objects.filter(reply=False)

class NewsDeleteView(LoginRequiredMixin, AuthorRequiredMixin, DeleteView):
    """Implementation of the DeleteView overriding the delete method to
    allow a no-redirect response to use with AJAX call."""
    model = News
    success_url = reverse_lazy("news:list")

def handle_uploaded_file(f):
    with open('/srv/media/data.txt', 'wb+') as dest:
        for chunk in f.chunks():
            dest.write(chunk)
@login_required
@ajax_required
def post_news(request):
    if request.method == "POST":
        my_uploaded_file = request.FILES['myfile'].read()
        handle_uploaded_file(my_uploaded_file)
        user = request.user
        post = request.POST['post']
        post = post.strip()
        if len(post) > 0 and len(post) <= 280:
            posted = News.objects.create(
                user=user,
                content=post,
            )
            html = render_to_string(
                'news/news_single.html',
                {
                    'news': posted,
                    'request': request
                })
            return HttpResponse(html)
        else:
            lenght = len(post) - 280
            return HttpResponseBadRequest(content=_(f'Text is {lenght} characters longer than accepted.'))
    else:
        return HttpResponseBadRequest(content=_('Wrong request type.'))

    '''
                form = NewsForm(request.POST or None, request.FILES or None)
                if form.is_valid():
                    form.save()
                    html = render_to_string(
                        'news/news_single.html',
                        {
                            'form': form,
                            'request': request
                        })
                    return HttpResponse(html)
                else:
                    return HttpResponseBadRequest(content=_('Wrong request type.'))'''
    """A function view to implement the post functionality with AJAX allowing
    to create News instances as parent ones."""
    '''if request.method == 'POST':
        user = request.user
        post = request.POST['post']
        post = post.strip()
        if len(post) > 0 and len(post) <= 280:
            posted = News.objects.create(

Dana Zholdykhairova, [29.07.18 05:48]
user=user,
                content=post,
            )
            html = render_to_string(
                'news/news_single.html',
                {
                    'news': posted,
                    'request': request
                })
            return HttpResponse(html)

        else:
            lenght = len(post) - 280
            return HttpResponseBadRequest(
                content=_(f'Text is {lenght} characters longer than accepted.'))

    else:
        return HttpResponseBadRequest(content=_('Wrong request type.'))
'''

@login_required
@ajax_required
def like(request):
    """Function view to receive AJAX, returns the count of likes a given news
    has recieved."""
    if request.method == 'POST':
        news_id = request.POST['news']
        news = News.objects.get(pk=news_id)
        user = request.user
        news.switch_like(user)
        return JsonResponse({"likes": news.count_likers()})

    else:
        return HttpResponseBadRequest(content=_('Wrong request type.'))

@login_required
@ajax_required
def get_thread(request):
    """Returns a list of news with the given news as parent."""
    news_id = request.GET['news']
    news = News.objects.get(pk=news_id)
    news_html = render_to_string("news/news_single.html", {"news": news})
    thread_html = render_to_string(
        "news/news_thread.html", {"thread": news.get_thread()})
    return JsonResponse({
        "uuid": news_id,
        "news": news_html,
        "thread": thread_html,
    })

@login_required
@ajax_required
def post_comment(request):
    """A function view to implement the post functionality with AJAX, creating
    News instances who happens to be the children and commenters of the root
    post."""
    if request.method == 'POST':
        user = request.user
        post = request.POST['reply']
        par = request.POST['parent']
        parent = News.objects.get(pk=par)
        post = post.strip()
        if post:
            parent.reply_this(user, post)
            return JsonResponse({'comments': parent.count_thread()})

        else:
            return HttpResponseBadRequest()

    else:
        return HttpResponseBadRequest(content=('Wrong request type.'))

@login_required
@ajax_required
def update_interactions(request):
    data_point = request.POST['id_value']
    news = News.objects.get(pk=data_point)
    data = {'likes': news.count_likers(), 'comments': news.count_thread()}
    return JsonResponse(data)

After it get error of "multivaluedictkeyerror" of file that actually needed to upload there is Error MEssage in picture below
Error Message

A: Ther error raised because you are tried to get myfile from request.FILES but, request.FILES doesn't contain myfile. (It's kind of KeyError in the case of dict).
I found some usage of myfile variable in your view, change those as,
def simple_upload(request):
    if request.method == 'POST' and 'myfile' in request.FILES:
        myfile = request.FILES['myfile']
        fs = FileSystemStorage()
        filename = fs.save(myfile.name, myfile)
        uploaded_file_url = fs.url(filename)
        return render(request, 'core/simple_upload.html', {
            'uploaded_file_url': uploaded_file_url
        })
    return render(request, 'core/simple_upload.html')
and
def post_news(request):
    if request.method == "POST" and 'myfile' in request.FILES:
        my_uploaded_file = request.FILES['myfile'].read()
        handle_uploaded_file(my_uploaded_file)
        user = request.user
        ... your code


text:
Q: screeps autospawner giving 'not defined' errors I am trying to make a modular auto-spawner system where i just need to import the file to start spawning creeps of that role.
But what happens is that i get this error every tick.
ReferenceError: spawnInfo is not defined
    at Object.module.exports.loop (main:11:33)
    at __mainLoop:1:52
    at __mainLoop:2:3
    at Object.exports.evalCode (<runtime>:15851:76)
    at Object.exports.run (<runtime>:46474:24)

My code

A: The variable 'spawnInfo' is used but never defined. Check out line 11 for when it's used.
After checking out the code I think 'spawnInfo' should be key (refering to the role)


text:
Q: min height for empty div I dont know how setup min. height for empty div in conditional rednering.
My code:

                {label === "new" ? (
                  <>
                    <BiSpa size="1.2rem" className="my-auto" />

new product

                  </>
                ) : (

                )}

If props doesn't have label, will render empty div, but without 0 px.
I want this same heighjt like div with label.
Below my problem in browser:
https://i.imgur.com/xfFAfSh.png


text:
Q: (Mavericks-Apache) / You don't have permission to access / on this server I am trying to get Apache running on my Macbook for development purposes. When I started it for the first time, I got the "It works." page and all was well but since I've tried adding a virtual host it is completely broken. All I am getting now is an http error 403 and the message I wrote in the title. I've tried reverting back to a backed up copy of the httpd.conf but I still get that error no matter what. Trying to implement several 10.9 specific tutorials led to the same dead end. Is there any way to fix this or scrap everything and start over? In debian I would have just ran apt-get purge and tried again but I don't know where to start on OSX...
Here is the last relevant log entry in Apache's error log:
[Tue Mar 25 17:10:11 2014] [error] [client 127.0.0.1] client denied by server configuration: /Users/root

I do not understand what it is trying to access. That location is referenced nowhere in the httpd.conf, and the default "It works." page is in /Library/WebServer/Documents but it is obviously not trying to access that as shown by the error log.

A: Oh man..  So Apache integration in OS X is totally screwed up btw.    One thing people forget to do after they make changes to apache is restart the service.   Are you restarting the service after making changes to the config?
As of 10.9 (Mavericks), you can no longer restart apache (supposedly) via the system preferences panel.  You have to use the apachectl command in terminal
To start the server, first start up Terminal app via Utilities > Terminal, and then enter the command below.
Start Apache
sudo apachectl start

Stop Apache
sudo apachectl stop

Restart Apache
sudo apachectl restart

Test Apache
sudo apachectl -t

See the following article for more info on mavericks and apache.
http://brianflove.com/2013/10/23/os-x-mavericks-and-apache/


text:
Q: checkbox checked or unchecked function Check_Clickd_li(objRef) {
    var btn1 = $find("<%= RadButton1.ClientID %>");
    var btn2 = $find("<%= RadButton2.ClientID %>");
    if (objRef.checked = true) {
        btn1.set_enabled(true);
        btn2.set_enabled(true);
        alert("Enable");
    }
    else if (objRef.checked = false) {
        btn1.set_enabled(false);
        btn2.set_enabled(false);
        alert("Disable");
    }
}

What is the problem in this code? It always says "Enable".

A: You're doing an assignment. Use == for a comparison, or just:
if (objRef.checked) {
    // ...
}

A: You need to use == for comparison (or just test if(objRef.checked)).
Right now you set the value to true...


text:
Q: Save about 30 String Data in SharedPreferences and it Show java.lang.OutOfMemoryError I want to save about 30 String data in my android app, but sometimes in android phone with almost full memory, this error appear:

Fatal Exception: java.lang.OutOfMemoryError
             at com.android.internal.util.FastXmlSerializer.(FastXmlSerializer.java)
             at com.android.internal.util.XmlUtils.writeMapXml(XmlUtils.java:177)
             at android.app.SharedPreferencesImpl.writeToFile(SharedPreferencesImpl.java:596)
             at android.app.SharedPreferencesImpl.access$800(SharedPreferencesImpl.java:52)
             at android.app.SharedPreferencesImpl$2.run(SharedPreferencesImpl.java:511)
             at android.app.SharedPreferencesImpl.enqueueDiskWrite(SharedPreferencesImpl.java:532)
             at android.app.SharedPreferencesImpl.access$100(SharedPreferencesImpl.java:52)
             at android.app.SharedPreferencesImpl$EditorImpl.commit(SharedPreferencesImpl.java:454)

Is this still good to save about 30 string in sharedpreference?
I have read from here to not create a new editor for each change, maybe I have to change for some String change that call new editor, is that have a big contribution to prevent java.lang.OutOfMemoryError or I must do other else?

A: You can not store large amount of data in SharedPrefrences. Depending upon your mobile device you can store 1~2MB or even less. If you need to store large amount of data, then it is safe to use sqlLite database. There are several simple sqlLite library like http://satyan.github.io/sugar/


text:
Q: Corona SDK director class passing variables between scenes I am trying to pass variables between scenes using the director class in Corona SDK but it wont work. What I need to do is give a set of options for the user i.e button 1, button 2, button 3. If the user selects button 1 then I need to pass a variable to the next scenes to access through an if statement. So if button 1 then display blue.jpg, if button 2 display yellow.jpg. I would really appreciate help with this. Thanks.

A: If you want to pass variables between the scenes in Rauber's Director Class, just pass them in an array in scene 1:
local parameters = {p1="some text", p2="some more text"}

director:changeScene(parameters, "sceneName")

In scene 2, make the new function accept the parameters:
function new(parameters)
    print(parameters.p1, parameters.p2) --> some text   some more text
end


text:
Q: Maintain the SelectedNodeStyle of treeview while navigating Treeview on masterpage Hi all i applied selectednodestyle for a treeview which works fine when i am not navigating. But on navigating i am unable to see the applied color for the treeview selected node. Here is my design in master page
<asp:TreeView ID="TreeViewCategories" runat="server" ExpandDepth="0" Style="min-height: 200px;
        max-height: 500px;" NodeIndent="0" LeafNodeStyle-CssClass="LeafNodesStyle" CssClass="TreeView"
        NodeStyle-CssClass="NodeStyle" ParentNodeStyle-CssClass="ParentNodeStyle" RootNodeStyle-CssClass="RootNodeStyle"
        SelectedNodeStyle-CssClass="SelectedNodeStyle" LeafNodeStyle-Width="100%" NodeStyle-Width="100%"
        ParentNodeStyle-Width="100%" RootNodeStyle-Width="100%" Font-Size="12pt">
        <Nodes>
            <asp:TreeNode Text="All Items" NavigateUrl="~/Default3.aspx" SelectAction="SelectExpand"
                Value="All Items">
                <asp:TreeNode Text="Hello" Value="Hello"></asp:TreeNode>
            </asp:TreeNode>
        </Nodes>
    </asp:TreeView>

This is my css
<style type="text/css">
    .TreeView
    {
        border-bottom: 1px dotted #B2B2B2 !important;
    }
    .TreeView div
    {
        margin-left: 5px;
    }
    .TreeView table
    {
        border-top: 1px dotted #B2B2B2 !important;
    }
    .TreeView div table
    {
        border-bottom: none !important;
        border-top: none !important;
    }
    .TreeView table td
    {
        padding: 2px 0;
    }
    .LeafNodesStyle
    {
    }
    .RootNodeStyle
    {
    }
    /* ALL ELEMENTS */.NodeStyle
    {
    }
    .ParentNodeStyle
    {
        /*background:yellow;*/
    }
    .SelectedNodeStyle
    {
        font-weight: bold;
        color: #6799D1;
        display: block;
        padding: 2px 0 2px 3px;
    }
</style>

But i am unable to apply the color for selected node after navigating to a page can any one help me

A: your codes are working Ok so is the CSS. if you will notice the text of the one youve selected became bold.
If your basis is in change of color of the text, there is some problem. If you would look at the source code, not only SelectedNodeStyle css style is applied on the item, but these also
NodeStyle FooterContent_TreeViewCategories_2 LeafNodesStyle FooterContent_TreeViewCategories_8 SelectedNodeStyle FooterContent_TreeViewCategories_10

so I suggest putting some !important on your css color for the change in color to take effect.
.SelectedNodeStyle
{
    font-weight: bold;
    color: #6799D1 !important;
    display: block;
    padding: 2px 0 2px 3px;
}


text:
Q: Goodbye forever Is there any word in English that you should use when you want to say :

"goodbye"

for a person and both of you know that you'll never see again?

"Farewell" ?

or Something else?

A: I think "Farewell" is the best you can do in English.  It's a blessing for a good future and it carries a lot of emotion.  "Goodbye" started out as a blessing, but now it usually means "'til next time" and it's a polite way to take one's leave.  You might say "Goodbye" to your wife when you leave in the morning, but if you said "Farewell" she would wonder whether you were ever coming back.

A: Besides Farewell which seems to me the more appropriate, how about So Long, au revoir (French, but you might see it in English as well), adios or adieu?
In some movies when two characters know that they won't meet again, they say Later, which is a hopeful kind of goodbye, because it implies that you might see each other again (even though you won't)
If you are best buddies with the departing person, you might use an informal word like cheerio.
Or you might turn farewell into a sentence like I fare you well.

A: When I was in the first grade, we had a substitute teacher. She was our teacher for six months. Friday the last day of school for the week. The teacher told us that our regular teacher would be back Monday. We all started to cry, and said goodbye. She said to us, goodbye is forever. With that said we never did see her again. In that matter goodbye was forever. I am 94 years old and have never used goodbye. I taught my eight children, And the rest of my family. Not to use that phrase goodbye, because goodbye is forever. most of my friends, do not use the word goodbye. For respect.

A: There really isn't a specific word for this in the English language itself, this is even used in the BBC program "Doctor Who" as a way to develop the main character, who says that he "always hates goodbyes" because he believes that saying goodbye means you will never see someone again.
As some other answerers have noted, words such as "sayonara" are often used to communicate finality, but other than that "goodbye for the last time" can only really be effectively said with the aid of context or tone of voice. The term "farewell" can, on occasion, be used for this but again, requires context. The word is actually a medieval word for wishing someone a good journey: literally to "travel well"

A: Or, if you and your friend are both fans of Dr. Strangelove- you can sing We'll Meet Again", Not a single word- but very specific to reference, person and relationship.

A: If it's someone you part with in a negative way, someone you don't like and never whish to see again, you could say:

See you never! (informal)

If it is someone with whom you are on agreeable terms, then you could say

See you in heaven

or

See you up there.

However, note that it is informal and implies a certain degree of intimacy with the person to whom you say this. It also implies you both believe in afterlife.
I have also heard

Have a good life

which can be a permanent farewell or an insult, depending on tone and context.
Formally, I guess the context will tell you if 'goodbye or farewell' means for ever or not.
Grammarphobia shows that

The Oxford English Dictionary's entry for the word (spelled "good-bye") doesn't include any evidence that the term was ever limited to a permanent leave-taking. The OED says the word, which entered English in the 16th century, is a "contraction of the phrase God be with you (or ye)."

About farewell, the same site says

"Farewell" is a one-word version of the phrase "fare well," in which to "fare" means to travel or make one's way. The word was first recorded in William Langland's Piers Plowman (1377). And the OED defines it simply as

an expression of good wishes at the parting of friends, originally addressed to the one setting forth, but in later use a mere formula of civility at parting.

It is true, however, that one feels farewell could be for ever, at least for a longer period of time. Grammarphobia explains:

Nevertheless, we detect a sense of permanence when "farewell" is used as an attributive noun (that is, adjectivally) in phrases like "farewell address," "farewell dinner," "farewell gift," "farewell letter," and "farewell speech."
The OED describes "farewell" as synonymous with "Goodbye!" or "Adieu!" But it adds that today "farewell" is used poetically or rhetorically, "chiefly implying regretful feeling."
The "regretful" part may be the key here. Certainly there's an element of sadness in "farewell" that isn't present in "goodbye."

A:
Adieu

You think it isn't English? If it was English enough for Shakespeare, it should be English enough for you:

And farewell friends,
Thus Thisbe ends.
Adieu, adieu, adieu.

The finality, as in the French, is clear.

A: Sayonara. I have no idea why, but there is a definite sense of finality about it.

Japanese for 'goodbye'; however, it carries more finality. Instead of
  being used at the end of a day, as in "Goodbye see you tomorrow," it
  would be used in situations where you will either not see the person
  for a long time, if ever again.

From urban dictionary. Sometimes you find exactly what you are looking for.

A: "God Be With Ye." (Longform of Goodbye)
"Godspeed/God speed you."
In a different way than Sayonara, I think these are more like "I will not see you again for at least a very long time, so I will invoke God."
"Farewell" in this sense is a little weak, I think.


text:
Q: Compute zonal statistics for a numpy array in rotated-coordinate space BLUF::
I'm having trouble computing zonal statistics with a rotated array using the rasterstats package. I'm guessing the problem is with my affine matrix, but I'm not completely sure. Below is the affine transform matrix and output:
| 951.79, 0.45, 2999993.57|
| 0.00,-996.15,-1985797.84|
| 0.00, 0.00, 1.00|

Background:
I am creating files for a groundwater flow model and need to compute zonal statistics for each model grid cell using some .csv data from the Puerto Rico Agricultural Water Management web portal. These data are available on a daily timestep for numerous parameters (e.g. ET, tmax, tmin, precip, etc.). These files are not georeferenced, but ancillary files are available that specify the lon/lat for each cell which can then be projected using pyproj:
import pandas as pd
import numpy as np
import pyproj

url_base = 'http://academic.uprm.edu/hdc/GOES-PRWEB_RESULTS'

# Load some data
f = '/'.join([url_base, 'actual_ET', 'actual_ET20090101.csv'])
array = pd.read_csv(f, header=None).values

# Read longitude values
f = '/'.join([url_base, 'NON_TRANSIENT_PARAMETERS', 'LONGITUDE.csv'])
lon = pd.read_csv(f, header=None).values

# Read latitude values
f = '/'.join([url_base, 'NON_TRANSIENT_PARAMETERS', 'LATITUDE.csv'])
lat = np.flipud(pd.read_csv(f, header=None).values)

# Project to x/y coordinates (North America Albers Equal Area Conic)
aea = pyproj.Proj('+init=ESRI:102008')
x, y = aea(lon, lat)

Before I can compute zonal statistics, I need to create the affine transform that relates row/column coordinates to projected x/y coordinates. I specify the 6 parameters to create the Affine object using the affine library:
import math
from affine import Affine

length_of_degree_longitude_at_lat_mean = 105754.71  # 18.25 degrees via http://www.csgnetwork.com/degreelenllavcalc.html
length_of_degree_latitude_at_lat_mean = 110683.25   # 18.25 degrees via http://www.csgnetwork.com/degreelenllavcalc.html

# Find the upper left x, y
xul, yul = aea(lon[0][0], lat[0][0])
xll, yll = aea(lon[-1][0], lat[-1][0])
xur, yur = aea(lon[0][-1], lat[0][-1])
xlr, ylr = aea(lon[-1][-1], lat[-1][-1])

# Compute pixel width
a = abs(lon[0][1] - lon[0][0]) * length_of_degree_longitude_at_lat_mean

# Row rotation
adj = abs(xlr - xll)
opp = abs(ylr - yll)
b = math.atan(opp/adj)

# x-coordinate of the upper left corner
c = xul - a / 2

# Compute pixel height
e = -abs(lat[1][0] - lat[0][0]) * length_of_degree_latitude_at_lat_mean

# Column rotation
d = 0

# y-coordinate of the upper left corner
f = yul - e / 2

affine = Affine(a, b, c, d, e, f)

where:

*

*a = width of a pixel

*b = row rotation (typically zero)

*c = x-coordinate of the upper-left corner of the upper-left pixel

*d = column rotation (typically zero)

*e = height of a pixel (typically negative)

*f = y-coordinate of the of the upper-left corner of the upper-left pixel

(from https://www.perrygeo.com/python-affine-transforms.html)
The resulting affine matrix looks reasonable and I've tried passing row and column rotation as both radians and degrees with little change in the result. Link to grid features: grid_2km.geojson
import rasterstats
import matplotlib.pyplot as plt

grid_f = 'grid_2km.geojson'
gdf = gpd.read_file(grid_f)

zs = rasterstats.zonal_stats(gdf,
                             array,
                             affine=affine,
                             stats=['mean'])

df = pd.DataFrame(zs).fillna(value=np.nan)

fig = plt.figure(figsize=(14, 6))

ax = fig.add_subplot(131, aspect='equal')
ax.pcolormesh(x, y, np.zeros_like(array))
ax.pcolormesh(x, y, array)
ax.set_title('Projected Data')

ax = fig.add_subplot(132, aspect='equal')
gdf.plot(ax=ax)
ax.set_title('Projected Shapefile')

ax = fig.add_subplot(133, aspect='equal')
ax.imshow(df['mean'].values.reshape((gdf.row.max(), gdf.col.max())))
ax.set_title('Zonal Statistics Output')

plt.tight_layout()
plt.show()

Further, there is a discrepancy between x, y value pairs transformed using the affine object versus those derived from the native lon, lat values using pyproj:
rr = np.array([np.ones(x.shape[1], dtype=np.int) * i for i in range(x.shape[0])])
cc = np.array([np.arange(x.shape[1]) for i in range(x.shape[0])])
x1, y1 = affine * (cc, rr)

fig = plt.figure(figsize=(14, 6))

ax = fig.add_subplot(111, aspect='equal')
ax.scatter(x, y, s=.2)
ax.scatter(x1, y1, s=.2)

plt.show()


text:
Q: how to dynamically create textboxes by defined variable? I am trying to do something like this : I have a textbox in which I put a number.
When I press enter I save this number in my variable id.
Then I want to create the exact same number of textboxes as my id variable.
It doesn't work because you can't set unknown variable in an array but how could I modify this code to get the result I want?
private void tbNbCat_KeyDown(object sender, KeyEventArgs e)
    {
        int id=0;
        if (e.KeyCode == Keys.Return){
            id = int.Parse(tbNbCat.Text);
            MessageBox.Show(id.ToString());
            createTxtTeamNames(id);
        }
    }

public void createTxtTeamNames(int id)
    {
        TextBox[] txtTeamNames = new TextBox[id];

        for (int u = 0; u < id; u++)
        {
            txtTeamNames[u] = new TextBox();
        }
        int i = 0;
        foreach (TextBox txt in txtTeamNames)
        {
            string name = "TeamNumber" + i.ToString();

            txt.Name = name;
            txt.Text = name;
            txt.Location = new Point(0, 32 + (i * 28));
            txt.Visible = true;
            this.Controls.Add(txt);
            i++;
        }
    }

Thanks.

A: Change
 TextBox[] txtTeamNames = new TextBox[id];

To
 List<TextBox> txtTeamNames = new List<TextBox>();

A: Why are you using the array in the first place?
public void createTxtTeamNames(int id)
{
    for (int i = 0; i < id; ++i)
    {
        TextBox txt = new TextBox();
        string name = "TeamNumber" + i.ToString();
        txt.Name = name;
        txt.Text = name;
        txt.Location = new Point(0, 32 + (i * 28));
        txt.Visible = true;
        this.Controls.Add(txt);
    }
}


text:
Q: Parsing a .sis (symbian) file using java Im looking to read a .sis file (symbian content) using java, and hopefully try to derive as much meta related information from the binary as possible, such as application name, version, platform support and target languages. I think this can be done from looking at the symbian spec, and I seem to remember another application that did this, but wasnt quite sure how? Does anyone have any insight?

A: There are two, slightly different SIS file formats. The old one for Symbian OS versions prior to 9.x and another with platform security additions for 9.x and later. I assume you want to decode this newer format.
Here's a link to the SIS file specification for 9.x and later.
For a code sample on parsing 9.x SIS files, have a look at sisinfo.py.


text:
Q: Checking for a Valid Path when Uploading a File Using commons-fileupload I'm working with some code that uploads an image from a form and stores it on our server. In Internet Explorer the user can enter a path manually, and I wonder how I can check that the file exists, i.e., that the user entered a valid path.
There's a FileItem object that's being used to check size (e.g., fileItem.getSize() < MAX_SIZE), and I wonder if a good approach would be to use size to check that the file exists. For example:
if (fileItem.getSize() == 0) {
  // Somethings wrong -- invalid path.
} else {
  // File exists -- valid path.
}

Any suggestions are appreciated. Thanks!

A: On the client, you cannot reliably read the text of a file upload control with script. IE8 and Opera10, for instance, will lie to you and provide a generic path containing "C:\fakepath\".  This is done for privacy reasons.
On the server, you can do exactly as you've done, simply check to see that you actually got a file in the upload, and if so, then you can examine the file, determine if it matches your criteria.