text:
Q: lm for predicting the values of the dependent variable in R I have a dataframe with a random number of quantitative variables. I need write a function that calculate lm for predicting the values of the dependent variable. As predictors, I want to use only those variables that have p.value > 0.05. The function should return linear regression coefficients constructed only for selected predictors as a vector. If there are no such predictors in the data, then the function should  returns the warning "There are no normal variables in the data". I write the function, but it does not work.
smart_lm <-  function(x) {
  sl <- apply(x[2:dim(x)[2]], 2, function(x) shapiro.test(x)$p.value)
  my_reg <- lm(as.formula(paste("x[[1]]~",paste(x[2:dim(x)[2]], collapse = "+"))))
  return(ifelse(sl[sl > 0.05], my_reg, "There are no normal variables in the data"))
}

A: If I understand correctly, the following should do it.
Note that there is no need for an ifelse and the formula uses the dot . to include all variables of the data argument not yet in the formula, which are all but DF2[[1]].
set.seed(1665)    # Make the results reproducible
n <- 100
x1 <- rnorm(n)
x2 <- rnorm(n, 2, 6)
x3 <- rexp(n)
y <- x1 + x2 + x3 + rnorm(n)

dat <- data.frame(y, x1, x2, x3)

smart_lm <- function(DF){
    sl <- c(NA, sapply(DF[-1], function(x) shapiro.test(x)$p.value))
    DF2 <- DF[, which(sl > 0.05)]
    names(DF2) <- names(DF)[which(sl > 0.05)]
    lm(DF2[[1]] ~ ., data = DF2)
}

smart_lm(dat)
#
#Call:
#lm(formula = DF2[[1]] ~ ., data = DF2)
#
#Coefficients:
#(Intercept)           x1           x2
# -3.331e-17    1.000e+00    9.593e-18


text:
Q: How to Backup a disk with corrupted GPT? My hard disk is failing. Booting into Live Ubuntu, fdisk -l says "GPT table is corrupt, Backup appears okay, using it".
I need to take a backup of the files on the disk ASAP. It doesn't show in the file manager.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Combine list elements into a dataframe r I currently have a list with columns as individual elements.
I would like to combine list elements with the same column names (i.e. bind rows) and merge across the different columns (i.e. bind columns) into a single data frame. I'm having difficulty finding examples of how to do this.
l = list(est = c(0, 0.062220390087795, 1.1020213968139, 0.0359939361491544
), se = c(0.0737200634874046, 0.237735179934829, 0.18105632705918,
0.111359438298789), rf = structure(c(NA, NA, NA, 4L), levels = c("Never\nsmoker",
"Occasional\nsmoker", "Ex-regular\nsmoker", "Smoker"), class = "factor"),
    n = c(187L, 18L, 32L, 82L), model = c("Crude", "Crude", "Crude",
    "Crude"), est = c(0, 0.112335510453586, 0.867095253670329,
    0.144963556944891), se = c(0.163523775933409, 0.237039485900481,
    0.186247776987999, 0.119887623484768), rf = structure(c(NA,
    NA, NA, 4L), levels = c("Never\nsmoker", "Occasional\nsmoker",
    "Ex-regular\nsmoker", "Smoker"), class = "factor"), n = c(187L,
    18L, 32L, 82L), model = c("Model 1", "Model 1", "Model 1",
    "Model 1"), est = c(0, 0.107097305324242, 0.8278765140371,
    0.0958220447859447), se = c(0.164787596943329, 0.237347836229364,
    0.187201880036661, 0.120882616647714), rf = structure(c(NA,
    NA, NA, 4L), levels = c("Never\nsmoker", "Occasional\nsmoker",
    "Ex-regular\nsmoker", "Smoker"), class = "factor"), n = c(187L,
    18L, 32L, 82L), model = c("Model 2", "Model 2", "Model 2",
    "Model 2"))

I would like the data to have the following format:
data.frame(
 est = c(),
 se = c(),
 rf = c(),
 model = c()
)

Any help would be appreciated. Thank you!

A: In this solution, first the elements of l are grouped by name and then are combined using c. Finally, the resulting list is converted to a dataframe using map_dfc.
library(dplyr)
library(purrr)

cols <- c("est", "se", "rf", "model")

setNames(cols,cols) |>
    map(~l[names(l) == .x]) |>
    map_dfc(~do.call(c, .x))

#> # A tibble: 12 × 4
#>       est     se rf     model
#>     <dbl>  <dbl> <fct>  <chr>
#>  1 0      0.0737 NA     Crude
#>  2 0.0622 0.238  NA     Crude
#>  3 1.10   0.181  NA     Crude
#>  4 0.0360 0.111  Smoker Crude
#>  5 0      0.164  NA     Model 1
#>  6 0.112  0.237  NA     Model 1
#>  7 0.867  0.186  NA     Model 1
#>  8 0.145  0.120  Smoker Model 1
#>  9 0      0.165  NA     Model 2
#> 10 0.107  0.237  NA     Model 2
#> 11 0.828  0.187  NA     Model 2
#> 12 0.0958 0.121  Smoker Model 2

A: another option
library(purrr)

grp <- (seq(length(l)) - 1) %/% 5
l_split <- split(l, grp)
map_df(l_split, c)

#> # A tibble: 12 × 5
#>       est     se rf         n model
#>     <dbl>  <dbl> <fct>  <int> <chr>
#>  1 0      0.0737 <NA>     187 Crude
#>  2 0.0622 0.238  <NA>      18 Crude
#>  3 1.10   0.181  <NA>      32 Crude
#>  4 0.0360 0.111  Smoker    82 Crude
#>  5 0      0.164  <NA>     187 Model 1
#>  6 0.112  0.237  <NA>      18 Model 1
#>  7 0.867  0.186  <NA>      32 Model 1
#>  8 0.145  0.120  Smoker    82 Model 1
#>  9 0      0.165  <NA>     187 Model 2
#> 10 0.107  0.237  <NA>      18 Model 2
#> 11 0.828  0.187  <NA>      32 Model 2
#> 12 0.0958 0.121  Smoker    82 Model 2


text:
Q: Android application crashing despite exception caught I'm writing a simple app which allows a user to enter their income and it deducts tax, then saves the amount in a file for future reference. Whenever I try to enter an amount I get a warning saying the application has stopped unexpectedly. Here is my code:
public void onClick(View v) {
    // TODO Auto-generated method stub
    try {

        if (preTax !=null){
            Double incomeAmount = Double.parseDouble(preTax.getText().toString());
            incomeAmount =- (20 *100)/incomeAmount;
            Double incomeRounded = Round(incomeAmount);
            Toast.makeText(null, "Your income minus tax = "+incomeRounded, Toast.LENGTH_LONG).show();

            FileOutputStream fos = openFileOutput("income", Context.MODE_PRIVATE);
            fos.write("1000".getBytes());
            fos.close();
        }
        else {

            Double incomeAmount = Double.parseDouble(postTax.getText().toString());
            Double incomeRounded = Round(incomeAmount);
            Toast.makeText(null, "Your income is: "+ incomeRounded, Toast.LENGTH_LONG).show();

            FileOutputStream fos = openFileOutput("income", Context.MODE_PRIVATE);
            fos.write("1000".getBytes());
            fos.close();
        }

    } catch (Exception e){
        Toast.makeText(null, "Please fill in the catagories" + e, Toast.LENGTH_LONG).show();
    }
}

This issue was happening before the fileoutstream stuff was added, so I know that that isn't the issue, but it is not clear to me what is. Program crashes regardless of whether the EditText is empty or not. Surely the try/catch should catch any errors?

A: Toast.makeText(null, "Please fill in the catagories" + e, Toast.LENGTH_LONG).show();
should be
Toast.makeText(v.getContext(), "Please fill in the catagories" + e, Toast.LENGTH_LONG).show();
you can't pass null in for the context, it needs to be valid.

A: Passing in null for the context does not exactly help. Your app in blowing up, getting caught and then blowing up again.


text:
Q: Preimage of Subsets of $X_i$ in Infinite Cartesian Product I ask this question only to have a clarification about the consequences of Halmos' definition of Infinite Cartesian Product. Let $\{X_i\}_{i\in A}$ be an indexed family of subsets of a given set $X$.
As you know $\displaystyle\prod_{\substack{i\in A}}X_i$ is defined to be the set of all functions with domain $A$ and codomain $\displaystyle\bigcup_{\substack{i\in A}}X_i$ such that $f(i)\in X_i ,\forall i\in A$. Now, let $\pi_i$ be the generic projection map and let $E\subseteq X_i$: how can $\pi_i^{-1}(E)$ be equal to $\displaystyle\prod_{\substack{j\in A}}E_j$ with $E_j=E$ if $j=i$ and $E_j=X_j$ otherwise? I mean, the codomain is relevant in this definition...

A: I agree with the definition of the Cartesian product, that's completely standard (a set of functions $f$ from the index set $I$ such that $f(i) \in X_i$ for all $i \in I$). The codomain is "relevant" in the sense that it allows us to justify this as a set (from the axioms): a function is a subset of a product $A \times B$ (defined as sets of ordered pairs, e.g. with Kuratowski's definition $(a,b) := \{\{a\},\{a,b\}\}$ etc.) where $A$ and $B$ are already given to be sets. In this case we want $A = I$ (a set) and as $B$ we choose $\bigcup_i X_i$ (a set by the union axiom), because we already "know" that all values of $f$'s in the Cartesian product we want to define are going to be in this union. So this way we can garantuee from the pairs/union/comprehension etc. axioms that $\prod_i X_i$ is going to be a well-defined set. But "really" it's just some collection of ordered pairs fulfilling some conditions. I give these conditions at the end in more formal terms.
The projection $\pi_j: \prod_{i \in I} X_i \to X_j$, for any fixed $j \in I$ is defined as $\pi_j(f) = f(j)$, which indeed is in $X_j$ by definition.
If $E$ is a subset of $X_j$, then consider what it means to be some $f$ in $\pi_j^{-1}[E]$: $f \in \prod_{i \in I} X_i$ so it is a function defined on $I$ with $f(i) \in X_i$ for all $i$ and $\pi_j(f) \in E$ forces the only extra restriction that in fact $f(j) \in E$. But these are also exactly the conditions for a function on $I$ to be in $\prod_{i \in I} E_i$ where all $E_i = X_i$ except $E_j=E$. They're the same conditions on $f$ as a set of ordered pairs. Hence that we can say
$$\pi_j^{-1}[E] = \prod_{i \in I} E_i \text{ where all } E_i \text{ (except } E_j = E \text{) equal } X_i$$
So to recap a set $f$ is in $\prod_{i \in I} X_i$ iff

*

*$\forall x \in f: \exists i \in I: \exists p: x= (i,p)$.

*$\forall i \in I: \exists p: (i,p) \in f$.

*$\forall i \in I: \forall p,p': ((i,p) \in f \land (i,p') \in f) \implies p=p'$. (the last equality is equality of sets, so really $p=p'$ should be $\forall x: x \in p \leftrightarrow x \in p'$)

*$\forall i \in I: \exists x \in X_i: (i,x) \in f$.

A: It's ${\bf\pi_i}^{-1}(E)$ that is $\prod_jE_j$ with $E_j=X_j$ if $j\ne i$ and $E_i=E$.


text:
Q: Swift 4 - How to return a count of duplicate values from an array? I have an array with multiple values (Doubles), many of which are duplicates.  I'd like to return or print a list of all unique values, along with a count of how many times a given value appears in the array.  I'm pretty new to Swift and I've tried a couple of different things but I'm unsure of the best way to accomplish this.
Something like this:
[65.0, 65.0, 65.0, 55.5, 55.5, 30.25, 30.25, 27.5]
Would print (for example):
"3 at 65.0, 2 at 55.5, 2 at 30.25, 1 at 27.5."
I'm not really concerned about the output as much as the method to accomplish this.
Thanks!

A: You can enumerate through the array and add the values to the dictionary.
var array: [CGFloat] =  [65.0, 65.0, 65.0, 55.5, 55.5, 30.25, 30.25, 27.5]
var dictionary = [CGFloat: Int]()

for item in array {
   dictionary[item] = dictionary[item] ?? 0 + 1
}

print(dictionary)

or you can do foreach on array:
array.forEach { (item) in
  dictionary[item] = dictionary[item] ?? 0 + 1
}

print(dictionary)

or as @rmaddy said:
var set: NSCountedSet =  [65.0, 65.0, 65.0, 55.5, 55.5, 30.25, 30.25, 27.5]
var dictionary = [Float: Int]()
set.forEach { (item) in
  dictionary[item as! Float] = set.count(for: item)
}

print(dictionary)

A: As @rmaddy already commented you can use Foundation NSCountedSet as follow:
import Foundation // or iOS UIKit or macOS Cocoa

let values = [65.0, 65.0, 65.0, 55.5, 55.5, 30.25, 30.25, 27.5]
let countedSet = NSCountedSet(array: values)
print(countedSet.count(for: 65.0))   // 3
for value in countedSet {
    print("Element:", value, "count:", countedSet.count(for: value))
}

Xcode 11 • Swift 5.1
You can also extend NSCountedSet to return an array of tuples or a dictionary:
extension NSCountedSet {
    var occurences: [(object: Any, count: Int)] { map { ($0, count(for: $0))} }
    var dictionary: [AnyHashable: Int] {
        reduce(into: [:]) {
            guard let key = $1 as? AnyHashable else { return }
            $0[key] = count(for: key)
        }
    }
}

let values = [65.0, 65.0, 65.0, 55.5, 55.5, 30.25, 30.25, 27.5]
let countedSet = NSCountedSet(array: values)
for (key, value) in countedSet.dictionary {
    print("Element:", key, "count:", value)
}

For a Swift native solution we can extend Sequence constraining its elements to Hashable:
extension Sequence where Element: Hashable {
    var frequency: [Element: Int] { reduce(into: [:]) { $0[$1, default: 0] += 1 } }
}

let values = [65.0, 65.0, 65.0, 55.5, 55.5, 30.25, 30.25, 27.5]
let frequency = values.frequency
frequency[65] // 3
for (key, value) in frequency {
    print("Element:", key, "count:", value)
}

Those will print
Element: 27.5 count: 1
Element: 30.25 count: 2
Element: 55.5 count: 2
Element: 65 count: 3

If you have a collection of custom structure we can create a generic method and make use of keypath syntax as follow:
extension Sequence {
    func sum<T: Hashable>(of property: (Element) -> T) -> [T: Int] {
        reduce(into: [:]) { $0[property($1), default: 0] += 1 }
    }
    func sum<T: Hashable, A: AdditiveArithmetic>(of property: (Element) -> T, by adding: (Element) -> A) -> [T: A] {
        reduce(into: [:]) { $0[property($1), default: .zero] += adding($1) }
    }
}

Usage:
struct Product {
    let id: String
    let name: String
    let quantity: Int
    let price: Decimal
    let total: Decimal
}

let products = [
    ("1", "iPhone",      2,  Decimal(string: "499.99")!,  Decimal(string: "999.98")!),
    ("2", "MacBook Pro", 1, Decimal(string: "2499.99")!, Decimal(string: "2499.99")!),
    ("3", "iPhone",      3, Decimal(string: "1199.99")!, Decimal(string: "3599.97")!),
    ("4", "iPhone",      1,  Decimal(string: "999.99")!,  Decimal(string: "999.99")!),
    ("5", "MacBook Pro", 2, Decimal(string: "1499.99")!, Decimal(string: "2999.98")!)
].map(Product.init)

let sum1 = products.sum(of: \.name)
sum1["iPhone"]       // 3
sum1["MacBook Pro"]  // 2

let sum2 = products.sum(of: \.name, by: \.quantity)
sum2["iPhone"]       // 6
sum2["MacBook Pro"]  // 3

let sum3 = products.sum(of: \.name, by: \.total)
sum3["iPhone"]       // 5599.94
sum3["MacBook Pro"]  // 5499.97


text:
Q: Display and Select Bounding Boxes on Image Given coordinates for bounding boxes and an image, I would like to display clickable bounding boxes over the image in an Angular Web Application.
The goal is that the user should select one or multiple bounding boxes drawn over the image for labelling purposes.
So far I have only seen drawable bounding boxes with HTML Canvas. However, in my case, multiple bounding boxes already exist. How could I approach this task?
EDIT: I have tried layering two canvas elements on top of each other, however, I could not even get the image to display, let alone make rectangles appear.
https://stackblitz.com/edit/angular-bvnjc3
component.html:

<div style="position: relative;">
 <canvas #layer1 id="layer1" width={{imgWidth}} height={{imgHeight}}
   style="position: absolute; left: 0; top: 0; z-index: 0;"></canvas>
 <canvas #layer2 id="layer2" width={{imgWidth}} height={{imgHeight}}
   style="position: absolute; left: 0; top: 0; z-index: 1;"></canvas>
</div>

component.ts:
export class AppComponent {

  public imgWidth: number;
  public imgHeight: number;
  public url: string;
  public image;

  @ViewChild("layer1", { static: false }) layer1Canvas: ElementRef;
  private context: CanvasRenderingContext2D;
  private layer1CanvasElement: any;

  onSelectFile(event) {
    if (event.target.files && event.target.files[0]) {
      var reader = new FileReader();

      reader.readAsDataURL(event.target.files[0]);

      reader.onload = event => {
        this.image = new Image();
        this.image.src = reader.result;
        this.image.onload = () => {
          this.imgWidth = this.image.width;
          this.imgHeight = this.image.height;
          this.showImage();
        };
      };
    }
  }

  showImage() {
    this.layer1CanvasElement = this.layer1Canvas.nativeElement;
    this.context = this.layer1CanvasElement.getContext("2d");
    this.context.drawImage(this.image, this.imgWidth, this.imgHeight);
    this.drawRect();
  }

  drawRect() {
    this.context.beginPath();
    this.context.rect(200, 300, 400, 500);
    this.context.lineWidth = 10;
    this.context.strokeStyle = "black";
    this.context.stroke();
  }
}

A: Stackblitz Link
https://stackblitz.com/edit/angular-lg4lmy
Preview

Step 01

*

*remove
width={{imgWidth}} height={{imgHeight}}

Step 02

*

*add
this.layer1CanvasElement.width = this.imgWidth;
this.layer1CanvasElement.height = this.imgHeight;

Step 03

*

*change from
this.context.drawImage(this.image,this.imgWidth, this.imgHeight);

*to
this.context.drawImage(this.image, 0, 0, this.imgWidth, this.imgHeight);

Step 04

*

*add mousemove event listener
this.layer1CanvasElement.addEventListener("mousemove", function(e) {})

Step 05

*

*determine if the Point
  (PointX,PointY)

*belong to the Rectangle
  (RectangleX,RectangleY,RectangleWidth,RectangleHeight)

*by using
  (RectangleX <=       PointX       <= RectangleX + RectangleWidth)
  (RectangleY <=       PointY       <= RectangleY + RectangleHeight)

*code
  let x = 200;
  let y = 300;
  let w = 400;
  let h = 500;

  if (
       x <= e.clientX && e.clientX <= x + w
                        &&
       y <= e.clientY && e.clientY <= y + h
     )
     drawRect("red");
     else
     drawRect("black");
});

Why Step 01 && 02

*

*no sure but i think it liked to angular change detection

Why Step 03

*

*base on CanvasRenderingContext2D.drawImage() - Web APIs | MDN you are misusing the overload

void ctx.drawImage(image, dx, dy);
void ctx.drawImage(image, dx, dy, dWidth, dHeight);
void ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);

Why Step 04 && 05

*

*my understanding you needed to implement this feature

I would like to display clickable bounding boxes

Ref. important
HTMLCanvasElement.getContext() - Web APIs | MDN
CanvasRenderingContext2D.drawImage() - Web APIs | MDN
Clickable canvas circle
Hit Region Detection For HTML5 Canvas And How To Listen To Click Events On Canvas Shapes
MouseEvent.clientX - Web APIs | MDN
Ref. unimportant
getContext("2d");+ - Google Search
What is my_canvas.getContext("2d"); and how it work? | Codecademy
access angular app from console - Google Search
Debugging Angular from the Browser Console - Made by Munsters - Medium
js get image size from FileReader - Google Search
javascript - Getting width & height of an image with filereader - Stack Overflow
jquery - Get the real width and height of an image with JavaScript? (in Safari/Chrome) - Stack Overflow
onload image angluer - Google Search
image.onload - Archive of obsolete content | MDN
angular - Detect when image has loaded in img tag - Stack Overflow
angluer this.context.drawImage - Google Search
typescript - Angular 5 with Canvas drawImage not showing up - Stack Overflow
javascript - CanvasContext2D drawImage() issue [onload and CORS] - Stack Overflow
addeventlistener definition file typescript - Google Search
javascript - Adding window.event handler to typescript - Stack Overflow
clientX - Google Search
is poin Belongs to sqrae - Google Search
analytic geometry - How to check if a point is inside a rectangle? - Mathematics Stack Exchange
Plane (geometry) - Wikipedia
angular - Operator '>' cannot be applied to types 'boolean' and 'number'? - Stack Overflow
stroke() - Google Search
HTML canvas stroke() Method
canvas change path color on hover - Google Search
javascript - Change color lines in canvas when mouseover - Stack Overflow

A: You could use a tool named Annotorious. I have used it for annotating images in Angular 8. The tool is licensed under BSD License. Pretty easy to use. You could download the source code and edit the widgets if you want. Totally great tool.
Annotorious tool


text:
Q: mysql query run slow i have this query
SELECT debtDinar,
       creditDinar,
       debtDollar,
       creditDollar AS creditDollar,
       companyID,
       costCenter,
       accountnumber,
       accountName,
       activityNo,
       activityName,
       name,
       if((debtDinar-creditDinar) >= 0.000,(debtDinar-creditDinar),0.000) AS debtDinarEx,
       if((debtDinar-creditDinar) >= 0.000,0.000,abs(debtDinar-creditDinar)) AS creditDinarEx,
       if((debtDollar-creditDollar) >= 0.00,(debtDollar-creditDollar),0.00) AS debtDollarEx,
       if((debtDollar-creditDollar) >= 0.00,0.00,abs(debtDollar-creditDollar)) AS creditDollarEx
FROM
  (SELECT SUM(recordsdetails.debtor) AS debtDinar,
          SUM(recordsdetails.creditor) AS creditDinar,
          SUM(recordsdetails.debtDollar) AS debtorDollar,
          SUM(recordsdetails.creditDollar) AS creditDollar,
          companies.name AS name,
          recordsdetails.companyID AS companyID,
          costCenter AS costCenter,
          accounts.accountnumber AS accountnumber,
          accounts.accountName AS accountName,
          recordsdetails.activityNo AS activityNo,
          recordsdetails.activityName AS activityName
   FROM (records,
         accounts
         JOIN (companies
               LEFT JOIN recordsdetails on((recordsdetails.companyID = companies.companyID))))
   WHERE left(recordsdetails.accountnumber,1)=accounts.accountnumber
     AND (recordsdetails.companyID = 1)
   GROUP BY accounts.accountnumber,
            costCenter
   ORDER BY accounts.sortorder) AS recordsdetails

it's run so slowly about 30-60 sec to get data and it's got more slow when data increase , is there any idea to make this query simple

A: I'd start by neatening up your query. You have used mixed joining syntax, are missing aliases and renaming temp tables to the same name as a real table and as a result it is very hard to follow what is happening.
Are you actually using the table records? It appears to be cross joined in without any criteria..
You may be able to refactor out the SELECT FROM (SELECT ... ) as well.
Once this is all neat and tidy, you should run an EXPLAIN ... and see which indexes are being used and where the query may be falling down.


text:
Q: I have some problems with Youtube Player Flutter I've been trying to solve this problem by myself but I just accepted that I can't. So I'm here to ask you guys for help. I'm trying to use the Youtube Player Flutter plugin and I created a List of videos from a channel that I choose using ListTile, ListView, and FutureBuilder. What i'm trying to do is: when i click on some video i want it to play. So I'm trying to use GestureDetector, but the problem is that I don't know how to use Youtube Player Flutter as a player for onTap or Gesture Detector. I don't know if I'm doing this well and I accept suggestions of better ways to do that or a solution; One of my problems is: LateInitializationError: Field '_controller@25000317' has not been initialized. So to be honest I don't know how to use it late but when i use it that's my problem. So if I don't use late I have to change my code. from: late YoutubePlayerController _controller; to: YoutubePlayerController? _controller; and if i do that i have to use _controller! and i have the error: Null check operator used on a null value So i've tried a lot of ways to not use null check operator on a null value, but i can't. If you guys can help me with that too, I will be happy.
Here's the code

import 'package:flutter/material.dart';
import 'package:mood3/model/Video.dart';
import 'package:mood3/telas/Api.dart';
import 'package:youtube_player_flutter/youtube_player_flutter.dart';

class Videos extends StatefulWidget {

 @override
 State<Videos> createState() => _VideosState();
}

class _VideosState extends State<Videos> {
late YoutubePlayerController _controller;

 _listarVideos() {
   Api api = Api();
   return api.pesquisar("");
 }

 @override
 Widget build(BuildContext context) {

   return Container(

     padding: EdgeInsets.all(16),
     child: FutureBuilder<List<Video>?>(
       future: _listarVideos(),
       builder: (context, snapshot){
         switch(snapshot.connectionState){
           case ConnectionState.none:
           case ConnectionState.waiting:
             return Center(
               child: CircularProgressIndicator(),
             );
             break;
           case ConnectionState.active:
           case ConnectionState.done:
             if(snapshot.hasData){
               return ListView.separated(
                   itemBuilder: (context, index){

                     List<Video>? videos = snapshot.data;
                     Video video = videos![ index ];

                     return GestureDetector(
                       onTap: (){
                         void runYoutubeplayer() {
                           _controller = YoutubePlayerController(
                             initialVideoId: video.id.toString() ,
                             flags: YoutubePlayerFlags(
                               autoPlay: false,
                               mute: false,
                             ),
                           );
                         }
                         setState(() {
                           _controller.load(video.id.toString());

                         });

                       },
                       child: Column(
                         children: <Widget>[
                           Container(
                             height: 200,
                             decoration: BoxDecoration(
                                 image: DecorationImage(
                                     fit: BoxFit.cover,
                                     image: NetworkImage( video.imagem! )
                                 )
                             ),
                           ),
                           ListTile(
                             title: Text( video.titulo! ),
                             subtitle: Text( video.canal! ),
                           )
                         ],
                       ),
                     );

                   },
                   separatorBuilder: (context, index) => Divider(
                     height: 2,
                     color: Colors.grey,
                   ),
                   itemCount: snapshot.data!.length
               );
             }else{
               return Center(
                 child: Text("Nenhum dado a ser exibido!"),
               );

             }
             break;
         }
       },
     ),);
 }
}


text:
Q: nginx webserver with regex location and alias and xls extension i have a nginx configuration something like this,
server {
    server_name my.domain.com;
    listen 80;
    root /path/to/http/root;
    include /path/to/proxy.common.conf;

    location ~ ^/foo-(.+)$ {
        alias /path/to/static/file/$1;
    }
    location / {
        try_files $uri $uri/ =404;
        proxy_pass http://127.0.0.1:8000/;
    }
}

i'm unable to access the files with location /foo-something.xls, it always returns 404 not found...
i also tried with .xlsx, .doc, and .docx but it also shows not found...
if i access file like .js, .css, .png, .xls1, .doc1, etc, it behaves normally...
the error log shows the location with regex did not match, and tried to look at the root location...
i also tested the location with
location = /foo-test1.xls
location ^~ /foo-test2.xls

and alias to a file, and it returns the file content...
am i missing something with my configuration?
i just found this problem when developing a report generator module on my company's framework...
i also tried to read at both nginx source and pcre source, but i can't find any string that related to those extensions...

A: i found what causes the confusion with the path...
i missed at checking at the proxy.common.conf...
after rechecking, i found there's a location to check files with those extension with regex...
that's why the regex stop searching after finding matched location...
after cross checking with someone who configured the nginx before, the location have something to do with our previous framework...
thanks for your support...


text:
Q: VBA for Connecting already opned IE window I'm trying to connect to already opened IE window, but I have some problem at 2nd line

Run time error 429 ActiveX Component can't create object

I have added references also still not able to access the IE window. Below is the code.
Sub A()
  Set objShell = CreateObject("Shell.Application")
  IE_count = objShell.Windows.Count
  For x = 0 To (IE_count - 1)
     my_url = objShell.Windows(x).Document.Location
    my_title = objShell.Windows(x).Document.Title

    if my_title Like "Put your webpage title here" & "*" Then
        Set ie = objShell.Windows(x)
        Exit For
    Else
    End If
  Next
End Sub

A: Two things -

*

*Declare 'ie' in your code.

*IE_Count
IE_count = objShell.Windows.Count should be IE_count =
objShell.Windows().Count. Please refer -
https://msdn.microsoft.com/en-us/library/windows/desktop/bb773969(v=vs.85).aspx
Hope correcting these will get your code working


text:
Q: how to run anaconda python without installing on windows system? Is der any On Demand online cloud environment is available like SAS Studio? I have to work on Pandas in Jupyter Notebook but I cannt install Python (using Anaconda) or any other packages. Please, help me out. Iam looking for a cloud environment where I can practice on Pandas/Python easily

A: Try https://notebooks.azure.com
It is a free service that provides Jupyter notebooks (runs Anaconda Python) along with supporting libraries as a service.
For further details visit FAQ

A: https://cocalc.com
Try this, no sign up required.
Start coding straight away!

A: There are plenty of such services. I use pythonanywhere; and it allows users to host apps as well.
https://www.pythonanywhere.com/

A: I have not used it myself but:
https://wakari.io


text:
Q: Can i use a Graph-Algorithm on Yed-Graphs with python? I am using Yed to paint some graphs as shown in the picture below. Is there a way I can use python to compute a Depth-First exploration on these?
I would like the algorithm to protocol the Edges he has traveled and the nodes he visited.
Example graph:

Edit:
I would like to use this method to record actions of people in a sports game. At first you start at a base/Root, then you can run or jump (c or d). Running brings you to point 2, jumping to point 5.
The result that I need then is:
1.  root, ([c,2] ,[b,3]), Descript_3
2.  root, ([c,2] ,[a,4]), Descript_4
3.  root, ([c,2] ,[b,2], [a,4]), Descript_4
...

I am just using yed, so I can use a graphical interface. If there is something better in pure python, I am all up for it. But lets stick to yed for now. Can I get additional attributes to the nodes?
Edit:
Since I cannot get this thing to work for myself, I am setting a bounty for an example program. The example program should do the following:
1. Parse the graphml-File and build up the tree
2. Compute all Roundtrip-Path with Node-Coverage
3. write all paths into a table: Name of the node, Text on the arrow

From there I can figure the rest out myself. If its done by using librarys, then that's cool too, but I need to be able to extend it myself. I would also have it to be able to handle graphs, instead of trees.

A: You can use the networkx module (need to be installed pip install networkx). This module is a powerfull library for working with graphs. It can read the graphml format which yed produces and has algorithems for traversing a graph. Have a look at the documentation of it: networkx


text:
Q: iPhone 3GS (jailbreak) not recognized in iTunes I have iPhone 3GS jailbroken running some version of iOS4.
With the latest iTunes version 12.2.1 (and the previous one I had installed), the device is not recognized as plugged in. Windows sees the device just fine.

*

*I've tried restarting the device.

*I've tried restarting the computer.

*I've updated to latest iTunes.

*Bonjour and the "Apple Mobile Device Service" (sp?) are running.

Is it not recognized because it's jailbroken? Or are there other things I can try before restoring to non-jailbroken version?
Edit:
- Tried clean reinstall of iTunes 10.7 and 9.2.1 (edit 3: and 8.2.1)
- Tried different USB port
Still no luck. Windows sees the device, but iTunes does not.
Edit 2:
- Tried different cable
- Tried on a different PC
- Tried on a different Mac

A: The latest iTunes does not support as much older versions of iOS as iOS4 is.
I recommend you to uninstall your current iTunes, clear cache ... etc., reboot your computer and then download and install an older version of iTunes.
Once you are done with the above steps, I can recommend you to make sure that the USB port on your computer works well and to check the USB cable of the phone as well. Last thing that I can suggest is to have your iPhone unlocked and follow up if anything occurs on it's display.
Let us know if any additional information is needed.


text:
Q: Adding raw query parameters via Criteria API I could not find an answer to this. I found the previous similar question unanswered. I'd like to use Spring data solr for queries. But @Query is insufficient for my needs. As I understood, whatever you give here becomes a q parameter to `select' handler of solr.
In my case I need to add more parameters for example sfield for a spatial search. If @Query wont cut it, I am ready to write a custom repository implementation by autowiring SolrTemplate, But then the Criteria API does not seem to let me add a raw query parameter either.
Any help/points will be greatly appreciated.

A: I worked around it by creating a QueryParser decorator that adds the required parameters to a parsed solr query. The QueryParser was registered using solrTemplate.registerQueryParser().
Note however that I had to do a really nasty hack to get this working, since all queries that are sent to solrTemplate.queryForPage are wrapped by a static package protected inner class in QueryBase. So my registration code above had to be in a package org.springframework.data.solr.core


text:
Q: Source not found at setContentView ~ android programming I m new at android programming.I try to display simple Google map on android device (4.1.2).
I added all of the permissions and google api key on ActivityManifest.xml
this is activity_maps.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<fragment
     android:id="@+id/map"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     class="com.google.android.gms.maps.MapFragment"/>

</RelativeLayout>

And this is MapsActivity.java
package com.example.androidmapsapp;

import android.os.Bundle;
import android.view.Menu;
import android.widget.Toast;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.maps.MapActivity;

public class MapsActivity extends MapActivity {

GoogleMap googleMap;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    try {
        // Loading map
        initilizeMap();

    } catch (Exception e) {
        e.printStackTrace();
    }

    //GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
    //googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.maps, menu);
    return true;
}

@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
}

private void initilizeMap() {
    if (googleMap == null) {
        googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();

        // check if map is created successfully or not
        if (googleMap == null) {
            Toast.makeText(getApplicationContext(),
                    "Sorry! unable to create maps", Toast.LENGTH_SHORT)
                    .show();
        }
    }
}

@Override
protected void onResume() {
    super.onResume();
    initilizeMap();
}

}
log cat
09-26 17:09:51.476: E/Trace(26750): error opening trace file: No such file or directory (2)
09-26 17:09:51.501: I/System.out(26750): Sending WAIT chunk
09-26 17:09:51.501: W/ActivityThread(26750): Application com.example.androidmapsapp is waiting for the debugger on port 8100...
09-26 17:09:51.526: I/dalvikvm(26750): Debugger is active
09-26 17:09:51.716: I/System.out(26750): Debugger has connected
09-26 17:09:51.716: I/System.out(26750): waiting for debugger to settle...
09-26 17:09:51.916: I/System.out(26750): waiting for debugger to settle...
09-26 17:09:52.116: I/System.out(26750): waiting for debugger to settle...
09-26 17:09:52.316: I/System.out(26750): waiting for debugger to settle...
09-26 17:09:52.516: I/System.out(26750): waiting for debugger to settle...
09-26 17:09:52.716: I/System.out(26750): waiting for debugger to settle...
09-26 17:09:52.921: I/System.out(26750): waiting for debugger to settle...
09-26 17:09:53.121: I/System.out(26750): debugger has settled (1377)
09-26 17:09:54.416: D/dalvikvm(26750): threadid=1: still suspended after undo (sc=1 dc=1)
09-26 17:11:15.291: E/Trace(27618): error opening trace file: No such file or directory (2)
09-26 17:11:15.306: I/System.out(27618): Sending WAIT chunk
09-26 17:11:15.306: W/ActivityThread(27618): Application com.example.androidmapsapp is waiting for the debugger on port 8100...
09-26 17:11:15.316: I/dalvikvm(27618): Debugger is active
09-26 17:11:15.506: I/System.out(27618): Debugger has connected
09-26 17:11:15.506: I/System.out(27618): waiting for debugger to settle...
09-26 17:11:15.706: I/System.out(27618): waiting for debugger to settle...
09-26 17:11:15.906: I/System.out(27618): waiting for debugger to settle...
09-26 17:11:16.106: I/System.out(27618): waiting for debugger to settle...
09-26 17:11:16.306: I/System.out(27618): waiting for debugger to settle...
09-26 17:11:16.511: I/System.out(27618): waiting for debugger to settle...
09-26 17:11:16.711: I/System.out(27618): waiting for debugger to settle...
09-26 17:11:16.911: I/System.out(27618): debugger has settled (1404)
09-26 17:11:18.246: D/dalvikvm(27618): threadid=1: still suspended after undo (sc=1 dc=1)
09-26 17:11:23.271: D/dalvikvm(27618): threadid=1: still suspended after undo (sc=1 dc=1)
09-26 17:11:23.271: D/dalvikvm(27618): GC_CONCURRENT freed 172K, 9% free 9639K/10503K, paused 22ms+4ms, total 56ms
09-26 17:11:23.276: W/CursorWrapperInner(27618): Cursor finalized without prior close()

While debugging "setContentView(R.layout.activity_maps);" it gives Source not found!

A: I think that your problem is the fact that you activity extends MapActivity which was correct for Google Map API V1, but shouldn't be used for Google Maps API V2. what should be used is a simple Activity or a FragmentActivity depending on which platform you are targeting.
In you case just try to change  this line:
public class MapsActivity extends MapActivity {

to this:
public class MapsActivity extends Activity {

if you still having problems you can go over this blog post I wrote to integrate Google Maps API V2 in your application and see if this helps you:
Google Maps API V2


text:
Q: How to deal with null values when serializing arrays with protobuf-net? The following statement fails with NullReferenceException:
TypeModel.Create().DeepClone(new string[1]);

Examining the source code reveals that the exception is thrown on purpose, implying that null values in an array violate the protocol buffers spec (makes sense, null is not a repetition of any value).
OK, the spec is right, but what should we do if there is still a null value in a collection? Is there a solution, besides making sure no null values ever creep into our collections ?
Thanks.

A: See this:
http://code.google.com/p/protobuf-net/issues/detail?id=217
Citation of the relevant part:

Comment 4  by project member marc.gravell, Dec 14, 2011
I haven't documented that option yet (it was added as a specific request), but - at the moment you can only enable this via (for example):
RuntimeTypeModel.Default[typeof (YourType)][3].SupportNull = true;
where 3 is the field-number.
This should probably be available on the attribute model too...

Note to the user "will" - the deleter of my previous answer - I know this is not the best place, but I do not know of other way to message You and being simply quiet in such case is wrong: I am sorry about the "too short" answer on the first time, BUT wouldnt the editing be more constructive approach than sudden deletion? The link I provided still DID answer the problem, as also was evidenced by the comment... I only by chance found that You did delete it.

A: It is a tricky one; at the wire level, a collection is simply a repeated tag - and each element represents an object. Quite simply, there is no way of directly expressing a null in the protobuf spec.
Now, I could get dirty and have some kind of dual tag for a collection-with-nulls, but - to be honest I think it would generally be better to use a null-looking non-null object (if you see what I mean). In the case of string, maybe "" would do (it depends on context, really).
I'm open to suggestions too, but... it would need to keep the limitations of the spec in mind.


text:
Q: Total variation distance between diffusion processes with different volatility coefficient Preamble:
This question is similar to the one in total variation distance between two solutions of SDE . The difference is that in my case the drift is the same but there are different diffusion coefficients.
Question:
Consider the two SDE:
\begin{align}
dX_t &= f(X_t) dt + \frac{\sigma(X_t)}{\sqrt{n}} dW_t\\
dY_t &= f(Y_t) dt + \frac{\bar\sigma_n(Y_t)}{\sqrt{n}} dW_t,
\end{align}
where $t \in [0,T]$, $X_0 = Y_0 = 0$, $W_t$ is the standard 1-dimensional Brownian motion. The hypotheses are that the drift $f$ and the diffusion coefficient $\sigma > 0$ are bounded and Lipschitz, and the $\bar\sigma_n$ are defined as the piecewise constant approximations of $\sigma$, constant on the intervals of the form $\big[\frac{j}{n}T,\frac{j}{n}T\big)$.
Can we conclude that the total variation distance between the two solution processes tends to zero as $n$ tends to infinity?
Considerations
There should be no problem proving that there is $L^2$ convergence, thanks to Theorem 10, chapter V of Protter's "Stochastic Integration and Differential Equations", but I think that this is not enough to obtain the convergence in total variation. In the answer to the question linked above, there is a mention to a possible solution of a similar problem via Malliavin calculus, but since I am not at ease with this theory I would gladly accept any suggestion or reference in that direction.

A: No. the total variation distance is always one, since the quadratic variation of the processes is different, and so the measures are mutually absolutely singular.


text:
Q: Application of mathematical induction If $p (x)= a_0 + a_1x^2+....a_nx^n$ in $\Bbb R [x]$ and $a \in \Bbb R$,  then $p (x)$ can be written as $b_0+b_1(x-a)+.....b_n(x-a)^n$ ,Where $b_i \in\Bbb R \forall i\in\{0,1,2\ldots n\}$.
Confusion: IF two polynomials are equal they both must have the same degree and the coefficients of the corresponding unknowns with equal powers are also equal. the polynomial $f(x) = x^3 + 2x^2 + 5$ is basically the structure $( )^3 + 2( )^2 + 5$ and not what we put into those parenthesis. Then how this problem is meaningful . I must be going horribly wrong some where. Please help.
* Why can't I type mathematical symbols? I am following the codes in the link : MathJax basic tutorial and quick reference

A: Your definition is correct in a sense. In algebra one often defines a polynomial to be just the structure you mentioned. (I.e. $x$ is an "indeterminate", not a real variable.)
But this question is not asking about polynomials defined this way. When the question writes "$p(x)$ can be written as $q(x-a)$", it's not referring to $x-a$ as an indeterminate, in the way that you're thinking. It's asking, in the sense of functions on $\mathbb{R}$, for you to show there are coefficients on $q$ such that the functions $p(x)$ and $q(x-a)$ are everywhere equal.
You should be able to do the base case. Suppose it's true for degree $n-1$. Then for degree $n$, we have $$a_nx^n + \dotsb + a_1x+a_0 \\[12pt] =a_n(x-a)^n + (\text{Stuff of degree $<n$})+a_{n-1}x^{n-1}+\dotsb + a_0.$$
Can you find which terms to use induction on?
To type math code, your syntax should look like
$p(x) = a_0 + a_1x + \cdots b + a_nx^n$

gives $p(x) = a_0 + a_1x + \dotsb + a_nx^n$.
Comment: I would prefer to prove this a different way: given $p(x) = a_nx^n + \dotsb + a_0$, let $\zeta + a=x$, and expand $p(\zeta + a)$. Then substitute $\zeta = x-a$.

A: Two polynomials are called equal, if they yield the same value for any x.


text:
Q: Release python executable with dependency on python bindings of a C++ library I use the PyQt python binding of Qt C++ for creation of the GUI of my program. If I were to distribute/release the program as a simple executable, preferably for several common platforms, how should I do this the 'right' way?
Currently Qt and PyQt are installed in my environment, but I don't want any users to go through the process of installing these. I want my program to be a click-run solution. Having a hard time wrapping my head around how the Qt C++ library code and PyQt will be included locally in my project.
I am not very familiar yet with python program releases. I have noticed there isn't really much of an equivalent to .jar packages for python and it's that kind of result I'm looking for. Currently I'm using two python libraries which I place in the lib folder. The libraries are just the python sources with their own src folder. Is there any way to do the same with PyQt without having to install Qt in the users environment?

A: If you don't mind your source code can be viewed then cx_freeze will be the best option I think, otherwise nuitka also will be a option but this will hide everything. But remember depends on how complex your libs and the modules which you using it can be hard to achieve, but give a try :)
https://github.com/kayhayen/Nuitka
https://github.com/GreatFruitOmsk/cx_freeze


text:
Q: Ошибка при установке пакета на docker через менеджер Pecl Пробую установить на докер docker с расширением Phalcon
Но при попытке запуска вылазит ошибка:
#0 89.70 install ok: channel://pecl.php.net/psr-1.2.0
#0 89.70 configuration option "php_ini" is not set to php.ini location
#0 89.70 You should add "extension=psr.so" to php.ini
#0 89.72 error: 'phalcon' does not exist
#0 89.72
#0 89.72 usage: /usr/local/bin/docker-php-ext-enable [options] module-name [module-name ...]
#0 89.72    ie: /usr/local/bin/docker-php-ext-enable gd mysqli
#0 89.72        /usr/local/bin/docker-php-ext-enable pdo pdo_mysql
#0 89.72        /usr/local/bin/docker-php-ext-enable --ini-name 0-apc.ini apcu apc
#0 89.72
#0 89.72 Possible values for module-name:
#0 89.73 opcache.so psr.so sodium.so
#0 89.73
#0 89.73 Some of the above modules are already compiled into PHP; please check
#0 89.73 the output of "php -i" to see which modules are already loaded.

Dockerfile:
FROM php:8.1-fpm-alpine

RUN pecl config-set php_ini "$PHP_INI_DIR/php.ini"

# Install dependencies
RUN apk add --no-cache ${PHPIZE_DEPS} && \
    pecl install phalcon && \
    docker-php-ext-enable phalcon


text:
Q: How do I stop postgres from taking up the whole terminal with blank space after my query? Lately whenever I run psql queries in my terminal it clears the screen and adds a bunch of blank space. I feel like this has started happening since I upgraded to Fedora 36 but am not sure.

I am trying to get it back to normal and just output the query result like any other command you run, by just appending the result after my last command

A: Found the answer
I had the pager turned on and I was able to use the \pset pager command to turn it off.
postgresql.org/docs


text:
Q: How to print a line and type input in the same line I want to print a line like this:
Result: [the result are input here and after click on Enter to continue]
How can I do that?
EDIT:
This is what I want:
Scanner user1 = new Scanner(System.in);

int x = user1.nextInt();

System.out.println("Result: "+x);

But the last line won't print unless I type my input and press Enter.

A: Using java, you simply could use System.out.print(); to display it in console and after adding the capture info:
System.out.print("Result: ");
int x = user1.nextInt();

A: Hope this one will work. Please try
Input str =scanner. readLine("Result:" ) ;
Int inp =integer.parseInt(star) ;

A: The last line will not print unless you type an input and press enter as the code is run line by line. First you have to enter the value. Since it runs on console for the next step to be pressed you have to press enter.
So whatever you said will naturally happen and cannot be avoided.
Based on the code snippet you sent there is nothing wrong with the code and the logic in it and these are basic java steps.

A: This is a very old thread but since there doesn't seem to be an accepted answer, I am answering. Hope it would help someone else...
Here is what you are looking for
Scanner input = new Scanner (System.in);
System.out.print("Enter a number : ");
int num = input.nextInt();
System.out.println("Hello you entered "+num);

Note that when you use println the cursor moves to next line.
If you use just print the next statement continues on the same line.


text:
Q: iWebKit/iPhone: Chatbox with MySQL, AJAX, PHP and Javascript i am busy with a chatbox that contains MySQL, AJAX, PHP and Javascript.
Now i want to have this on my iPod Touch/iPhone, so i am building a website with iWebKit.
The following codes i provided is done now; just asking why it does not display the chatbox itself (so not the senders) after more than 2 lines are entered... What codes should i add or remove... Thanks.
I guess something with CSS or so, but i am not sure where i should apply it and what... Or maybe something else?
Download .zip here with all files

A: Your zip file is all php. I for one won't run someone else's php code on any of my servers. It would be much safer if you gave us a link to the problem page on your server.
Also, you have included the compressed CSS and not included the necessary Javascript file, so anyone wanting to help you would be facing a serious challenge.
Since it might well be an iWebKit issue, try the iWebKit forum. They are very helpful there.


text:
Q: Moved from Coldfusion 9 to 11 now Elements are Undefined Everything worked find in CF9, but after moving to a new server with CF11, when I submit a form on one of my pages, I get an error about an "Element is Undefined" or "Variable is Undefined". These elements are created via a cfloop and when I look at the source code, the element does exist within the cfform tag. The `cfloop starts from 1 and goes through (in this case) 30. The prior elements 1-11 run fine upon submission but errors out at 12. I eliminated what were elements 1-3 to make sure there was no issue with the data that was 12. But still it errors out at 12 even though the data representing 12 is different than it was prior.
If I add cfparams for everything, it'll throw 400 error on the page, but no error info goes into the CF log nor can I find it in the logs folder for HTML.
I'd list more but it's redundant from 1 through 30 within the cfform and considering all is well when cfloop writes the code from 1-11, I know it's not a user-error in a coding difference from 1-11 to 12.
Here is an example of the code:
<input type="Hidden" id="InvoiceID12" name="InvoiceID12" value="606410445">
<input type="Hidden" size="4" id="OrderID12" name="OrderID12" value="10811">
<select id="Status12" name="Status12" onChange="getlocationinfo(this.value, 'LocationID12')">
<option value="Order">Order</option>
<option value="">-----------</option>
<option value="Ordered">Ordered</option>
<option value="Backordered">Backordered</option>
</select>

Any thoughts?
Update
I think there is something more going on here than originally thought. I removed all code from the submitted page and just put in the word 'test', but upon running the same page with the in place, it throws that obscure 400 error that I can't find a log for. When I run the page apart from the submit button, it loads fine with the 'test' message...?!


text:
Q: Expression result unused, image generation I'm trying to use this code to generate a circle image.
#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;

double e, f;

double scaler (double a, double b) {
    if (a < 256) {  e = (-1) * a / 256.0;
        if (b < 256) {
            f = b / 256.0;
        } else {
            f = (-1) * (b - 256.0) / 256.0;
        }
    } else { e = (a - 256.0) / 256.0;
        if (b < 256) {
            f = b / 256.0;
        } else {
            f = (-1) * (b - 256.0) / 256.0;
        }
    }
    return e, f;
}

int main () {

    int max_color = 255;
    int dimention = 512;

    ofstream fout;
    fout.open("mandeloutput.ppm");

    fout << "P3\n" << dimention << " " << dimention << endl << max_color << endl;
    for (int i = 0; i < dimention; i++) { f = i;
        for (int j = 0; j < dimention; j++) { e = j;
            scaler (e, f);
            cout << fixed << setprecision(5) << e << " " << f << endl;
            if ( e*e + f*f <= 1) {
                fout << right << setw(4) << 0 << setw(4) << 0 << setw(4) << 0 << "   ";
            } else {fout << right << setw(4) << 255 << setw(4) << 255 << setw(4) << 255 << "   ";}
        }
        fout << endl;
    }
}

I can't understand why is my variable e always 0, and why I get the error described in the title regarding that variable inside scaler?

A: return e, f; doesn't do what you think it does. The comma operator simply evaluates and discards e and then the value of f is returned as a function result. Since these are globals anyway there is no need to return anything from this function, but it would be better not to use globals and do this properly. Delete the global declaration double e, f; and change the function to something like this:
void scaler (int a, int b, double &e, double &f) {
    if (a < 256) {  e = (-1) * a / 256.0;
        if (b < 256) {
            f = b / 256.0;
        } else {
            f = (-1) * (b - 256.0) / 256.0;
        }
    } else { e = (a - 256.0) / 256.0;
        if (b < 256) {
            f = b / 256.0;
        } else {
            f = (-1) * (b - 256.0) / 256.0;
        }
    }
}

In your main function you would then change these lines:
for (int i = 0; i < dimention; i++) { f = i;
    for (int j = 0; j < dimention; j++) { e = j;
        scaler (e, f);
        ...

to this:
for (int i = 0; i < dimention; i++) {
    for (int j = 0; j < dimention; j++) {
        double e, f;
        scaler (j, i, e, f);
        ...


text:
Q: Error Using Decimal And Bool In my syntax below I get an error of

An exception of type 'System.FormatException' occured in mscorlib.dll but was not handled in ther user code
  Additional Information: Input string was not in a correct format

And the value being passed that throws the error is 9.7000
And this is my syntax - I have a comment above the line that throws an error
private void calculate()
{
    var qtys = val(dropdownlist.SelectedItem.Text) + "|" + val(dropdownlist1.SelectedItem.Text) + "|" + val(dropdownlist2.SelectedItem.Text) ;
    var totalitems = dropdownitem.SelectedItem.Text + "|" + dropdownitem1.SelectedItem.Text + "|" + dropdownitem2.SelectedItem.Text + "|" + dropdownitem3.SelectedItem.Text;
    var amounts = dropdownamt.SelectedItem.Value + "|" + dropdownamt1.SelectedItem.Value + "|" + dropdownamt2.SelectedItem.Value + "|" + dropdownamt3.SelectedItem.Value;
    var totalitems = itemInfo.Split('|');
    var qtys = qty.Split('|');
    var amounts = amount.Split('|');

    for (int i = 0; i < totalitems.Count(); i++)
    {
        if (totalitems[i] != "" && qtys[i] != "" && qtys[i] != "0")
        {
            TotalPrice += Math.Round(val(amounts[i]), 2);
            TotalTax +=  Math.Round(val(amounts[i]) * Convert.ToDecimal(0.07), 2);
        }
    }
}

private decimal val(string p)
{
    if (p == null)
        return 0;
    else if (p == "")
        return 0;
    //The value of p = 9.7000
    return Convert.ToInt16(p);
}

A: You're trying to return a decimal but calling Convert.ToInt16 try Convert.ToDecimal
Also I would recommend using decimal.TryParse rather than calling Convert directly with some code like this:
public decimal convert(string p)
{
    decimal result;
    if(decimal.TryParse(p, out result))
        return result;
    else
        return 0;
}


text:
Q: Boost converter capacitor charging question
I don't understand this part. When the inductor is charging, the capacitor current should be decreasing because its supplying the load. When the inductor is discharging (after DT), the capacitor should be charging and hence the current should be increasing, but in the figure its decreasing, why is that so ?

A:
When the inductor is charging, the capacitor current should be decreasing because its supplying the load.

Usually we design so that the droop of the capacitor voltage  as it discharges is small relative to the average output voltage (another way to say this is, the ripple voltage is small), and so we neglect the change of capacitor current during discharge when hand-calculating.

When the inductor is discharging (after DT), the capacitor should be charging and hence the current should be increasing, but in the figure its decreasing, why is that so ?

Note the figure uses passive sign convention. Positive capacitor current is charging the capacitor and negative capacitor current is discharging it. As long as the capacitor current is positive, the capacitor is charging, no matter whether the magnitude of the current is increasing or decreasing.
In this part of the cycle, the capacitor is absorbing the part of the inductor current that is not flowing to the load (which is taking a nearly constant current because, again, we're assuming a small ripple voltage). So if the inductor current is decreasing, the capacitor current has to be decreasing also.

A: You're mixing capacitor charge with capacitor current. When the inductor is charging, the capacitor indeed provides some current to the load, hence the negative current. You have no graphics for the capacitor charge, but it would be decreasing. When the inductor is discharging, the capacitor gets the current from the inductor and provides some current to the load. The charge would be increasing.


text:
Q: flex3:How to override function set label of a button Flex 3 question:
I trying here to avoid having to bind resources to all my components labels ( ie a button) and find a way to have this automated.
Problem:
It corrupts the layout in design mode to bind directly in the mxml label="{resourceManager.getString('myResources', 'submit')}" and makes the design view useless. but when declaring bindings elsewhere, in actionScript or via a bind tag, it is counter productive and prone to many errors and miss.
Proposition:
I would like to create my own button that automatically invoke resources to localize a button label. So the author puts "Submit" in the mxml description of my button, and when running it would take the value of the label ie "submit" and use resourceManager.getString('myResources', 'submit').
but I can't find the way to override the set label function, Is it possible if yes how? else how can I go about it?
Maybe I am missing an essential process here that would make the use of resources more elegant, as well as how to override such thing as a button's label.
Thanks for your advices.

A: Create a component called MyButton, extending Button. Then use this:
override public function set label(value:String):void {
  super.label = resourceManager.getString('myResources', value) || value;
}

Assuming the resource manager returns "null" or "undefined" this will work, and will only replace the value if it exists in "myResources".
If you don't want to override every component you need to do this with, then you can add a FlexEvent.CREATION_COMPLETE event on every component. Then use a single generic function to do your label localization.


text:
Q: Storing Result like an array with countif in VBA excel I am assigning numbers their order in which they appear in the list and i do that using countif function in excel something like this,
=COUNTIF(A$2:A2,A2)

Number  Count
10        1
10        2
10        3
11        1
11        2
11        3
12        1

I wish to achieve the same using VBA. However, here are the specifics.

*

*I want to take a variable and compute the countif function and then loop them through.

*Once the variable has all numbers(array) I want to paste them in a location.

A: Assuming column A is sorted as per your list above you could use the following.
Dim arr(100,1) as double '100 = arbitrary number for this example
dim n as double

n=1

arr(roW,0) = Cell(roW + 2, 1).value
arr(roW,1) = n

For roW = 1 to 100
    IF Cell(roW + 2, 1).value = Cell(roW + 1, 1).value Then
        n = Cell(roW + 2, 1).value
    Else
        n=1
    End if
    arr(roW,0) = Cell(roW + 2, 1).value
    arr(roW,1) = n
Next

Range("C2:D102")=arr

A: This is my suggestion.
Sub Counts()
Dim ws As Worksheet
Set ws = ThisWorkbook.ActiveSheet
Dim lngLastRow As Long
lngLastRow = ws.UsedRange.Rows.Count
Dim Arr() As Variant
'Taking values in column A into an array
Arr = ws.Range("A2:A" & lngLastRow).Value
Dim Arr2() As Variant
'another Array for Countif results
ReDim Arr2(lngLastRow - 2, 0)
Dim count As Long
Dim i As Long, j As Long 'counters

    'counting
    For i = LBound(Arr) To UBound(Arr)
        count = 0
        For j = LBound(Arr) To i
            If Arr(j, 1) = Arr(i, 1) Then count = count + 1
        Next
        'filling the array with results
        Arr2(i - 1, 0) = count
    Next
    'sending results back to the worksheet
    ws.Range("B2:B" & lngLastRow).Value = Arr2

Set ws = Nothing
End Sub

A: And another option,
Sub GetUniqueAndCountif()
    Dim cUnique As Collection
    Dim Rng As Range
    Dim Cell As Range, nW As Range
    Dim sh As Worksheet
    Dim vNum As Variant

    Set sh = ThisWorkbook.Sheets("Sheet1")
    Set Rng = sh.Range("A2", sh.Range("A2").End(xlDown))
    Set cUnique = New Collection

    On Error Resume Next
    For Each Cell In Rng.Cells
        cUnique.Add Cell.Value, CStr(Cell.Value)
    Next Cell
    On Error GoTo 0

    For Each vNum In cUnique
        Set nW = Cells(Rows.Count, "C").End(xlUp).Offset(1, 0)
        nW = vNum
        nW.Offset(, 1) = WorksheetFunction.CountIf(Rng, nW)
    Next vNum

End Sub

A: The following code evaluates the results as a single array formula and assigns this to a varaiable v. You can adapt references and add variable declarations as needed.
Sub CountifArray()
v = Evaluate(Replace("INDEX(COUNTIF(OFFSET(y,,,ROW(y)-MIN(ROW(y))+1),y),)", "y", "A2:A8"))
Range("B2:B8") = v
End Sub


text:
Q: Modeling HSV color space cone with Python and Matplotlib 3D I want to create the HSV cone in python.
Tried to adapt the solution for MATLAB given in another question:
import numpy as np
import cv2

H = np.repeat([np.linspace(0, 179, 100)], 100, axis=0)
S = np.repeat([np.concatenate((np.linspace(0, 255, 50), np.linspace(255, 0, 50)))], 100, axis=0).transpose()
V = np.repeat([np.concatenate((np.ones(50)*255, np.linspace(255, 0, 50)))], 100, axis=0).transpose()

hsv = np.asarray(cv2.merge((H, S, V)), dtype=np.uint8)
C = cv2.cvtColor(hsv, cv2.COLOR_HSV2RGB)

theta = np.linspace(0, 2*np.pi, 100)
X = np.asarray([np.zeros(100), np.cos(theta), np.zeros(100)])
Y = np.asarray([np.zeros(100), np.sin(theta), np.zeros(100)])
Z = np.asarray([2*np.ones(100), 2*np.ones(100), np.zeros(100)])

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

ax.plot_surface(X, Y, Z, color=C)

but got the error: "Invalid rgba arg ... length of rgba sequence should be either 3 or 4".
Tried to reshape C with C.reshape(3, 100, 100) but got the error: "Invalid rgba arg ... only length-1 arrays can be converted to Python scalars"
Without arg color=C I've got this:
HSV cone with ax.plot_surface(X, Y, Z)
Thanks!

A: The error already tells you that you can only have a sequence of length 3 or 4 as argument to color. The color argument basically expects one single color (which can be given as a list of values (R,G,B).
Fortunately, there is another argument in plot_surface() which allows you to set the color of individual faces of the plot, namely facecolors.
ax.plot_surface(X, Y, Z, facecolors=C/255.)

While this will work and not throw an error, in the plot all colors are close to gray. This is in agreement with the array C, but I'm not sure if this is to be expected.


text:
Q: a pointer assignment ignored I am programming a C application with eclipse when happens a strange event.
I have a function to which I pass a pointer to struct, then inside of function, I allocate to this pointer other pointer of same type, a simple allocation like this
pointer = otherPointer;

Then, magically, my allocation is completely ignored by the program. I have refined with gdb and I see like the program pass for this line and the instruction is ignored.
there are some people with idea of causes of this paranormal event?
In the program there are similar functions with similar behavior and the allocation is done correctly.
Here is the funciton in question:
void uah_pcb_extract_queue_head (struct UAH_PCB * pPCB, struct UAH_PCB_Queue * pQueue)
{
  if (pQueue->head->next != NULL)
  {
    pPCB = pQueue->head;
    pQueue->head = pQueue->head->next;
  }
  else if (pQueue->head != NULL)
  {
    pPCB = pQueue->head;//this allocation
    pQueue->head = NULL;//in this line the value has not changed
    pQueue->tail = NULL;
  }
  else
  {
    pPCB = NULL;
  }
}

A: The reason you don't even see the change in gdb is that your compiler has probably optimised the assignment out of your function, since pPCB is not used again in it, and not returned.
If you want the change to affect the world outside of your function, you will need to pass in a pointer to a pointer, and then change the value it points to:
void uah_pcb_extract_queue_head (struct UAH_PCB ** pPCB, struct UAH_PCB_Queue * pQueue){
  /* code... */
  *pPCB = pQueue->head;
  /* more code... */
}

alternatively, you could return the address and avoid dealing with pointers to pointers:
 struct UAH_PCB * uah_pcb_extract_queue_head (struct UAH_PCB_Queue * pQueue){
  /* code... */
  struct UAH_PCB * pPCB = pQueue->head;
  /* more code... */
  return pPCB;
}

A: If you wish to return a pointer as a parameter, then you must use ** syntax:
EXAMPLE:
struct mystruct {
  int x, y;
};

void
myfunc (struct mystruct **pp) {
  *pp = malloc (sizeof mystruct);
}

/* ... */

int main(){
  struct mystruct *mystruct_p = NULL;
  /* After this call, mystruct_p should no longer be NULL... */
  myfunc(&mystruct_p);
  /* do some more stuff */
}

"pp", in this example, is shorthand for "a pointer to a pointer".
'Hope that helps!


text:
Q: NoneType error converting OpenGl script from .py to .exe using cx_Freeze I have a few python scripts that I have been able to convert to .exe relatively easily with cx_Freeze but I have hit a bump with a rubixcube I am creating with opengl.
I have two scripts;
import sys
from cx_Freeze import setup, Executable
#go to dir in cmd, run python setup.py build or; setup.py build... will create a folder build with name.exe
setup(
    name = "Cube",
    version = "1.1",
    description = "Cube",
    executables = [Executable("OwnCube.py", base = "Console")])

OwnCube.py is simply;
import pygame

from pygame.locals import *

from OpenGL.GL import *
from OpenGL.GLU import *

It then saves a build folder under 'Cube' with a .exe file called 'OwnCube.exe' along with all the dll's and data files. Running OwnCube.exe in cmd gives a nonetype error.
G:\Programs\PersonalPrograms\PythonScripts\Cube\build\exe.win32-3.6>OwnCube.exe
Traceback (most recent call last):
  File "C:\Users\Alex\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
    module.run()
  File "C:\Users\Alex\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
    exec(code, m.__dict__)
  File "OwnCube.py", line 5, in <module>
  File "C:\Users\Alex\AppData\Local\Programs\Python\Python36-32\lib\site-packages\OpenGL\GL\__init__.py", line 3, in <module>
    from OpenGL import error as _error
  File "C:\Users\Alex\AppData\Local\Programs\Python\Python36-32\lib\site-packages\OpenGL\error.py", line 12, in <module>
    from OpenGL import platform, _configflags
  File "C:\Users\Alex\AppData\Local\Programs\Python\Python36-32\lib\site-packages\OpenGL\platform\__init__.py", line 35, in <module>
    _load()
  File "C:\Users\Alex\AppData\Local\Programs\Python\Python36-32\lib\site-packages\OpenGL\platform\__init__.py", line 29, in _load
    plugin = plugin_class()
TypeError: 'NoneType' object is not callable

I have done this multiple times with other libraries but I can't seem to get this working with OpenGl, am I missing something?

A: i meet this problem too, and all i have done to solve this is add OpenGL.platform.win32 in includes of setup.py. i use win10.
reason of this bug is :
def load( self ):
    """Attempt to load and return our entry point"""
    try:
        return **importByName**( self.import_path )
    except ImportError as err:
        return None
def importByName( fullName ):
    """Import a class by name"""
    name = fullName.split(".")
    moduleName = name[:-1]
    className = name[-1]
    module = __import__( ".".join(moduleName), {}, {}, moduleName)
    return getattr( module, className )`

cx_freeze can not catch __import__ in your code, so we need to use import instead of __import__.

A: After much hair pulling.
Turns out I needed to include an options line in setup to include the OpenGL Library. Then I had to either set the environment variable to the TCL_LIBRARY and TK_LIBRARY or manually. I did this in the script as follows:
import sys
import os
from cx_Freeze import setup, Executable

build_exe_options = {"includes": ["OpenGL"]}
os.environ['TCL_LIBRARY'] = r'G:\python path\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'G:\python path\tcl\tcl8.6'
#go to dir in cmd, run python setup.py build or; setup.py build... will create a folder build with name.exe
setup(
    name = "Cube",
    version = "1.1",
    description = "Cube",
    options = {"build_exe": {"packages": ["OpenGL"]}},
    executables = [Executable("OwnCube.py", base = "Console")]
    )

I don't really understand why this happened, My guess would be that when compiling the OpenGL librarys to .dll or .so files it couldn't find the library tkinter or tcl that OpenGL was calling internally.
Hope this helps future searchers.


text:
Q: How to show two rows with same id in two different columns in datagridview using mysql? I have two tables here.
1st for user with user_id and name and 2nd for contacts with contact_id,contact(2 against 1 user_id) and user_id(foreign key)
Can i split the contacts in two columns of datagridview? like
User ID=1   Name=Ausaf   Contact1=0300468945    Contact2=0300733455

If it is possible, how should I do it? I am using the following code to retrieve the values from database
string sql = "select user.user_id as 'User ID', name as 'Name',contact as

'Contact' from biometric_attendance_system.user JOIN

    biometric_attendance_system.contact ON user.user_id=contact.user_id";

 try
 {
     MySqlDataAdapter load = new MySqlDataAdapter();
     load.SelectCommand = sql1;

     DataTable dt = new DataTable();
     load.Fill(dt);

     BindingSource bs = new BindingSource();
     bs.DataSource = dt;

     dataGridView1.DataSource = bs;
     load.Update(dt);
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message);
}

A: you may use something like this, keeping in mind that there are no, only one or a maximum of two contacts only
SELECT u.user_id AS 'User ID', u.user_name AS 'Name', c1.contact_num AS 'Contact1', c2.contact_num AS 'Contact2'
FROM
    users u
    LEFT OUTER JOIN (SELECT a.user_id, a.contact_id, b.contact_num FROM (SELECT user_id, MIN(contact_id) AS contact_id FROM contacts GROUP BY 1) a INNER JOIN contacts b ON a.contact_id=b.contact_id) c1 ON c1.user_id=u.user_id
    LEFT OUTER JOIN (SELECT a.user_id, a.contact_id, b.contact_num FROM (SELECT user_id, MAX(contact_id) AS contact_id FROM contacts GROUP BY 1) a INNER JOIN contacts b ON a.contact_id=b.contact_id) c2 ON c2.user_id=u.user_id


text:
Q: SelectOneRadio and Disable inputText Here is my html code.

                        <h:selectOneRadio layout="pageDirection"
                        onClick="alert('selam')" id="selectOneRadio">
                        <f:selectItem itemValue="Categori" itemLabel="Radio 1" />
                        <f:selectItem itemValue="Service" itemLabel="Radio 2" />
                        <f:selectItem itemValue="Follower" itemLabel="Radio 3" />
                    </h:selectOneRadio>

                <h:inputText value="inputText 1" />

                <h:inputText value="inputText 2" />

                <h:inputText value="inputText 3" />

I want to Select One of the radioButtons. When I click one of them I want the inputText be disabled.
For example:

*

*İf I click Radio 1 , then input Text 1 will be disabled.

*İf I click Radio 2 , then input Text 2 will be disabled.

*İf I click Radio 3 , then input Text 3 will be disabled.

How can I do this?

A: Bind the radio button value to a managed bean property and use <f:ajax> to send an ajax request and update parts of the view when the radio button changes and use disabled attribute to disable the <h:inputText> depending on the selected radio button item value.
E.g.
<h:panelGroup id="inputs">

                <h:selectOneRadio value="#{bean.radio}" layout="pageDirection">
                    <f:selectItem itemValue="Categori" itemLabel="Radio 1" />
                    <f:selectItem itemValue="Service" itemLabel="Radio 2" />
                    <f:selectItem itemValue="Follower" itemLabel="Radio 3" />
                    <f:ajax render="inputs" />
                </h:selectOneRadio>

                <h:inputText value="#{bean.input1}" disabled="#{bean.radio == 'Categori'}" />

                <h:inputText value="#{bean.input2}" disabled="#{bean.radio == 'Service'}" />

                <h:inputText value="#{bean.input3}" disabled="#{bean.radio == 'Follower'}" />

</h:panelGroup>

with
@ManagedBean
@ViewScoped
public class Bean {

    private String radio;
    private String input1;
    private String input2;
    private String input3;

    // ...
}

A: Have a look at this, i think this is what you are looking for

    <form action="" method="post" name="form">

        Radio1 <input type="radio" name="radio" value="Categori" onclick="enable_area(this.value);" />
        <textarea name="textarea1"></textarea>

        Radio2 <input type="radio" name="radio" value="service" onclick="enable_area(this.value);" />
        <textarea name="textarea2"></textarea>

        Radio3 <input type="radio" name="radio" value="Follower" onclick="enable_area(this.value);" />
        <textarea name="textarea3"></textarea>
    </form>


text:
Q: Teams webhook post (proxy authentication) failed I'm trying to post a new Teams message. If I don't use proxy, pogram fails half start count with fail: Proxy auth required. If i try to use proxy, build fail by timeout (post timeout).
Maybe some fail in proxy settings?
using (var httpClientHandler = new HttpClientHandler
{
    UseDefaultCredentials = true,
    UseProxy = true,
    Proxy = new WebProxy { UseDefaultCredentials = true }
})
{
    using (var httpClient = new HttpClient())
    {
        var httpResponse = await httpClient.PostAsync(HookUri, StringContent);
     }
}


text:
Q: Beautiful Soup - getting value from tag definition HTML Code:
<option data-formated='<span class="price">AUD $100.08</span>' data-qtyid="qty-219" value="1">
                                    Unit Price                              </option>

how do i get AUD $100.08 out of this?

A: You can use
find('option')['data-formated']

to get text AUD $100.08 and then you can slice/span()/etc. - ie [20:-7] - or you can use again BeautifulSoup to search in this HTML.
from bs4 import BeautifulSoup

text = '''<option data-formated='<span class="price">AUD $100.08</span>' data-qtyid="qty-219" value="1">
                                    Unit Price                              </option>'''

soup = BeautifulSoup(text, 'html.parser')

item = soup.find('option')['data-formated']
print(item[20:-7])  # AUD $100.08

soup = BeautifulSoup(item, 'html.parser')
print(soup.find('span').text)  # AUD $100.08


text:
Q: How to make expandable panel layout in android? I have very complex layout to do in android ?
I need two panels the if one expanded the other is extended and otherwise,
i would like to make a behavior like slidingdrawer but because i can have in view only button and nothing else i'm in deep trouble.

here is the example of what i need please help, i have spent already 3 days on it,
havent found an answer for this.
here is my code`

    <RelativeLayout android:id="@+id/imagesContent" android:orientation="vertical" android:layout_alignBottom="@+id/lhsLogo"
                    android:layout_width="wrap_content" android:layout_height="wrap_content">
        <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="3dp"
                   android:src="@drawable/orange_price_tag" android:layout_toLeftOf="@+id/lhsLogo" android:layout_alignBottom="@+id/lhsLogo" />
        <LinearLayout android:layout_centerHorizontal="true" android:orientation="vertical" android:layout_width="wrap_content"
                      android:layout_height="wrap_content">
            <TextView android:layout_width="fill_parent" android:layout_height="0dp" android:text="50%" android:singleLine="false"
                      android:textColor="#ffffff" android:textSize="17dp" android:id="@+id/discountTypeNumbers" android:layout_weight="1" />
            <TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="הנחה" android:singleLine="false"
                      android:textColor="#ffffff" android:textSize="14dp" android:id="@+id/discountTypeText" />
        </LinearLayout>
    </RelativeLayout>

    <TextView android:id="@+id/detailsTextContent"
              android:layout_below="@+id/imagesContent"
              android:layout_width="fill_parent"
              android:layout_height="200dp"
              android:textSize="11dp"
              android:layout_marginLeft="10dp"
              android:layout_marginRight="10dp"
              android:scrollbars = "vertical"
              android:layout_marginTop="10dp"
              android:text="some textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome
                            textsome textsome textsome textsome textsome"
              android:singleLine="false" />

    <RelativeLayout android:id="@+id/frame"
                    android:background="#ffffff"
                 android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
                 android:layout_alignParentBottom="true">
        <!--... stuff you want to cover at full-size ...-->
        <LinearLayout
                android:id="@+id/special_details_buttons"
                android:layout_marginTop="5dp"
                android:layout_marginLeft="5dp"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">

            <ImageView android:id="@+id/specialTerms"
                       android:layout_width="wrap_content"
                       android:layout_height="fill_parent"
                       android:layout_marginLeft="2dp"
                       android:src="@drawable/special_terms"  />

            <ImageView android:layout_width="wrap_content"
                       android:layout_height="fill_parent"
                       android:layout_marginLeft="5dp"
                       android:src="@drawable/special_details" />

            <CheckBox android:id="@+id/setFavorite" style="@style/favorites_button" android:button="@drawable/favorites_button"/>

            <ImageView android:id="@+id/acceptTerms"
                       android:src="@drawable/accept_special"
                       android:layout_width="wrap_content"
                       android:layout_height="fill_parent"
                       android:layout_marginLeft="48dp"
                    />
        </LinearLayout>

        <RelativeLayout
                android:layout_below="@+id/special_details_buttons"
                android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:layout_gravity="bottom"
                      android:orientation="vertical">

            <il.co.package.widgets.WrappingSlidingDrawer
                    android:id="@+id/drawer"
                    android:layout_width="fill_parent"
                    android:layout_height="200dp"
                    android:content="@+id/content"
                    android:handle="@+id/handle">

                <RelativeLayout
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/handle">

                    <ImageView android:id="@+id/slide_handle"
                               android:src="@drawable/expand_open"
                               android:layout_width="170dp"
                               android:layout_height="21dp"
                               android:layout_alignParentRight="true" />
                </RelativeLayout>

                <LinearLayout
                        android:gravity="center"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:background="#ffffff"
                        android:id="@+id/content">
                </LinearLayout>

            </il.co.package.widgets.WrappingSlidingDrawer>
        </RelativeLayout>
    </RelativeLayout>
</RelativeLayout>

`


text:
Q: Relative import user made module in Odoo 14 I am doing a refactor of our code base and was suggested we create a python module that will store functions that are used across different modules in Odoo 14 (sale, project for example), this is in a different file in the structure. My question is, Odoo will allow importing the new relative module and that way call the function I need?
Trying to import the module gives me ModulenotFoundError: no module named ...
from rw_utilities import working_hours_calculation

With the research that I've done, this should be possible with a simple python app but inside Odoo for the moment I'm not too clear. We run the application in the Odoo.sh cloud Not local.
File structure the goal is modules like sales and project can use the same function.

A: If you log something like that.
import logging
_logger = logging.getLogger(__name__)
_logger.info("Test")

Then you should get a log line like that, and it contains the right path to the module:
2022-01-01 00:01:01,111 1 INFO hostname odoo.addons.your_module.models.your_file: Test
And it should be usable like that
from odoo.addons.your_module.models.your_file import your_item

Another way would be:

class MyTools(models.Model):
    _inherit = 'my.tools'

    @api.model
    def _my_function(self):
        pass

# to call
self.env['my.tools']._my_function()

# or even
my_function = self.env['my.tools']._my_function
my_function()


text:
Q: Альтернативные wysiwyg activity редакторы? Есть  альтернативы тому, что есть в Eclipse и IntelliJ IDEA? html + phonehap не предлагать
A: Monodevelop.
С-качать под все платформы.
A: А чем вас эти двое не устроили? Блажь?
Имхо, лучше для разработчика под андроид чем Eclipse с ADT или IDEA 12 ничего нет.
Последняя так прекрасна во всех смыслах. Быстрый кодинг, интеграция с андроидом из коробки, интеграция с Git и Mercurial, системами сборки и кучей всего всего. Единственное, что удрачает так это непривычные типы проектов(модули, сами проекты), что лично мне кажется неявным. А в остальном, вы жируете:)
NetBeans - хорошая среда, но нет такой поддержки Андроида. Да и немного тормознее, как кажется по личным ощущениям.
Ну если уж так хочется хардкора, то можете создавать андроид-проекты из командной строки(android.bat) и использовать любую среду IDE или редактор, благо их очень много и гугл с запросом "IDE" или "Java IDE" вам найдет пару десятков.


text:
Q: Flutter - Audio Recording - How to achieve the sin wave form according to frequency when a user hits the record button? I want to achieve this look when the user starts recording his voice, the wave act accordingly to the frequencies.
How to achieve this using flutter? what's the concept?
Sin frequency wave example


text:
Q: How do I solve Modelica errors of variables, where the variables are parameters of extensions that your model is using? I've been trying to build a Rankine Power Cycle on OpenModelica for quite some time now and have been running into a reoccurring issue that I'm just not sure how to troubleshoot.
My Issue:
I'm able to get the majority of all of my Rankine Power Cycle model iterations to at least get a checked model as well as a successful instantiation. At this point I deem my model ready to try and simulate. The types of errors that usually break my simulation are variables that are located within extended models that my model is using.
For example:
Currently I am checking and verifying sub assemblies of the Rankine Power Cycle to be able to properly verify which components work and which do not under x,y,z circumstances. My heat exchanger model is checked and is able to instantiate but upon simulation I get error codes that read:
[22] 14:34:06 Symbolic Error
[ThermoPower.Gas: 1053:5-1053:66]: Model is structurally singular, error
found sorting equations
125: 0.0 = 0.0;
for variables
HX.gasFlow.vbar[5](140), HX.gasFlow.drbdX1[2,4](125)

What the issue here for me is that the error above, or all errors of these types, are hyperlinked to either partial models or packages that my own model extends. So the variables above "vbar" or "drbdX1" are no where within my HeatExchanger Model that I built, but the components inside of my own model somehow extend to these variables that are inevitably causing the error.
Things I've tried:
I've tried adding values to the extended hyperlinked models/packages in order to fix the error. This does not do anything.
I've tried copy and pasting said lines of code into my own model in order to declare whatever package/function that has already been declared within the extension. This does not work as usually produces an error for incorrect declaration.
The hyperlinked error does little to not help on how exactly I should fix the model, or where or which model I should fix it on.
If you have any insight or recommendations on how to fix such an issue, please feel free to comment below! Thank you for your time and reading this far into my plea for help :)
Heat Exchanger Code:
model HX_Turbine_Check
ThermoPower.PowerPlants.HRSG.Components.HE HX(
FluidPhaseStart = ThermoPower.Choices.FluidPhase.FluidPhases.Steam,
N_F = 6,
N_G = 6, Tstartbar_G(displayUnit = "K") = 800,
exchSurface_F = 2000,
exchSurface_G = 1000,
extSurfaceTub = 1500,
fluidNomFlowRate = 10,
fluidNomPressure = 2e+06,
fluidVol = 5,
gasNomFlowRate = 100,
gasNomPressure = 101325,
gasVol = 10,
lambda = 20,
metalVol = 10,
pstart_F = 2e+06,
pstart_G = 101325,
rhomcm = 7900,
rhonom_F(displayUnit = "kg/m3") = 0.6,
rhonom_G(displayUnit = "kg/m3") = 0.33)  annotation(
Placement(visible = true, transformation(origin = {-30, 30}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));

ThermoPower.Gas.SourceMassFlow FlueGasSource(
redeclare package Medium = ThermoPower.Media.FlueGas,
T = 800,
p0 = 101325,
w0 = 100)  annotation(
Placement(visible = true, transformation(origin = {-92, 30}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));

ThermoPower.Gas.SinkMassFlow FlueGasSink(
redeclare package Medium = ThermoPower.Media.FlueGas,
p0 = 101325,
w0 = 100)  annotation(
Placement(visible = true, transformation(origin = {32, 30}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));

ThermoPower.Water.SourceMassFlow WaterSource(
T = 212.4 + 273,
h = 2799500,
p0 = 20e5,
w0 = 10)  annotation(
Placement(visible = true, transformation(origin = {-30, 92}, extent =
{{-10, -10}, {10, 10}}, rotation = -90)));

ThermoPower.Water.SinkMassFlow SteamSink(
p0 = 1.01325e5,
w0 = 10)  annotation(
Placement(visible = true, transformation(origin = {48, 0}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));

ThermoPower.Gas.SensT TGas_Inlet(
redeclare package Medium = ThermoPower.Media.FlueGas)  annotation(
Placement(visible = true, transformation(origin = {-58, 34}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));

ThermoPower.Gas.SensT TGas_Outlet(
redeclare package Medium = ThermoPower.Media.FlueGas)  annotation(
Placement(visible = true, transformation(origin = {0, 34}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));

ThermoPower.Water.SensT TWater_Inlet annotation(
Placement(visible = true, transformation(origin = {-26, 60}, extent =
{{-10, -10}, {10, 10}}, rotation = -90)));

ThermoPower.Water.SensT TSteam_Outlet annotation(
Placement(visible = true, transformation(origin = {16, 4}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));

ThermoPower.Water.SteamTurbineStodola SteamTurbine(
Kt = 0.0131,
PRstart = 20,
pnom = 20e5,
wnom = 10,
wstart = 10)  annotation(
Placement(visible = true, transformation(origin = {-20, -30}, extent =
{{-12, -12}, {12, 12}}, rotation = 0)));

inner ThermoPower.System system annotation(
Placement(visible = true, transformation(origin = {50, 88}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));

Modelica.Mechanics.Rotational.Sensors.PowerSensor powerSensor1 annotation(
Placement(visible = true, transformation(origin = {14, -30}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));

ThermoPower.Electrical.Generator generator1 annotation(
Placement(visible = true, transformation(origin = {44, -30}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));

Modelica.Blocks.Continuous.FirstOrder firstOrder1 annotation(
Placement(visible = true, transformation(origin = {30, -70}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));

Modelica.Blocks.Interfaces.RealOutput y annotation(
Placement(visible = true, transformation(origin = {108, -70}, extent =
{{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {108,
-70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

equation
connect(firstOrder1.y, y) annotation(
Line(points = {{42, -70}, {100, -70}, {100, -70}, {108, -70}}, color = {0,
0, 127}));
connect(powerSensor1.power, firstOrder1.u) annotation(
Line(points = {{6, -42}, {6, -42}, {6, -70}, {18, -70}, {18, -70}}, color
= {0, 0, 127}));
connect(powerSensor1.flange_b, generator1.shaft) annotation(
Line(points = {{24, -30}, {36, -30}, {36, -30}, {36, -30}}));
connect(SteamTurbine.shaft_b, powerSensor1.flange_a) annotation(
Line(points = {{-12, -30}, {4, -30}, {4, -30}, {4, -30}}));
connect(SteamTurbine.outlet, TSteam_Outlet.inlet) annotation(
Line(points = {{-10, -20}, {0, -20}, {0, 0}, {10, 0}}, color = {0, 0,
255}));
connect(TSteam_Outlet.outlet, SteamSink.flange) annotation(
Line(points = {{22, 0}, {38, 0}}, color = {0, 0, 255}));
connect(HX.waterOut, SteamTurbine.inlet) annotation(
Line(points = {{-30, 20}, {-30, -20}}, color = {0, 0, 255}));
connect(TWater_Inlet.outlet, HX.waterIn) annotation(
Line(points = {{-30, 54}, {-30, 54}, {-30, 40}, {-30, 40}}, color = {0, 0,
255}));
connect(WaterSource.flange, TWater_Inlet.inlet) annotation(
Line(points = {{-30, 82}, {-30, 82}, {-30, 66}, {-30, 66}}, color = {0, 0,
255}));
connect(TGas_Outlet.outlet, FlueGasSink.flange) annotation(
Line(points = {{6, 30}, {14, 30}, {14, 30}, {22, 30}, {22, 30}, {22, 30}},
color = {159, 159, 223}));
connect(HX.gasOut, TGas_Outlet.inlet) annotation(
Line(points = {{-20, 30}, {-13, 30}, {-13, 30}, {-6, 30}, {-6, 30}, {-6,
30}, {-6, 30}, {-6, 30}}, color = {159, 159, 223}));
connect(TGas_Inlet.outlet, HX.gasIn) annotation(
Line(points = {{-52, 30}, {-46, 30}, {-46, 30}, {-40, 30}, {-40, 30},
{-40, 30}, {-40, 30}, {-40, 30}}, color = {159, 159, 223}));
connect(FlueGasSource.flange, TGas_Inlet.inlet) annotation(
Line(points = {{-82, 30}, {-64, 30}, {-64, 30}, {-64, 30}}, color = {159,
159, 223}));
connect(HX.gasOut, HX.gasIn) annotation(
Line(points = {{-20, 30}, {-40, 30}}, color = {159, 159, 223}));

annotation(
uses(ThermoPower(version = "3.1"), Modelica(version = "3.2.3")));end
HX_Turbine_Check;


text:
Q: How many days does a free Heroku app stay up? According to heroku

Starting today, Heroku accounts have an account-based pool of free dyno hours for use on free apps. This replaces the 18 hours a day limit on free apps, allowing a free app to run 24/7 if needed. New accounts receive 550 free dyno hours and you can verify your identity with a credit card for an additional 450 hours

→ How are dyno hours calculated
If my app is always up, how many days will it stay up for (If I have 550 dyno hours) or does it depend on traffic and usage?

A: An app consumes hours based on their uptime, no matter the usage or traffic your app receives.
If you do the math, 550 hours is equal to 22.92 days.
If you were to add your payment method, it would give you a thousand hours, enough for a single app to run 24/7.


text:
Q: Ponteiro de char ou array de char? Há um programa que eu peguei numa empresa, em que são utilizados ponteiros de char, tipo char*, e depois alocado uma memória para ele com o malloc(), feito as operações e no final desalocado essa memória. Recebe normalmente todos os caracteres, até o tamanho máximo.
Um array de char pode ter desempenho melhor ou mais segurança? Tipo controlar o tamanho máximo que pode receber, o estouro de memória, etc.
{
char* x;
x = (char*)malloc(16*sizeof(char));
x = (char*)NULL //aparentemente é pra alocar uma memória limpa
func(INPUT y, OUTPUT x);

free(x);         //aqui ele
x = (char*)NULL; //limpa a variável
}//essa é o tipo de função que eles usaram

{
char x[16];
memset(x,'\0',strlen(x)); //também é pra ter uma memória limpa
func(INPUT y, OUTPUT x);

memset(x,'\0',strlen(x)); //limpa a variável
}//essa seria a mesma função só que com um array de char

A: O array de char pode dar melhor performance, afinal evitará uma alocação dinâmica de memória, que é algo relativamente caro. Não importa se o tamanho será determinado em tempo de compilação ou de execução.
No exemplo da pergunta seria melhor usar essa forma, mas nem sempre isso é possível.
Segurança e confiabilidade
Segurança é sempre obtida sabendo o que está fazendo, entendendo como o computador funciona, como a linguagem trabalha, os detalhes da API que está usando, etc. O uso de array no lugar da alocação dinâmica nem ajuda nem prejudica a segurança diretamente. Não há nada em um recurso ou outro que impeça o estouro de uso de memória. Em C é um problema do programador tratar isto.
O uso de memória dinâmica costuma ser menos confiável. Não por ela em si, mas porque os programadores costumam errar mais no seu uso, e o que não é tão confiável pode ser menos seguro, mas é algo indireto.
Quando usar
Normalmente a alocação do array é feita na stack - por isso é rápido - o que não permite ter um array muito grande (muito menos se o tamanho não puder ser determinado na compilação ou pelo menos garantido que ele não será muito grande), nem que ele sobreviva ao final de uma função (ou escopo), então há casos que a alocação no heap - com malloc() - é a única solução viável.
Mesmo nos casos da alocação ser em uma estrutura, pode fazer ela ficar grande demais, e nem sempre é o que se deseja, principalmente porque praticamente obrigaria a sua alocação no heap (alocação dinâmica), o que nem sempre é desejável.
No fundo a diferença entre o array e a alocação dinâmica, está mesmo só na alocação, uma não oferece mais recursos que outra. Depois de alocado, dá na mesma, a linguagem não diferencia uma da outra.
O padrão é sempre usar a forma mais simples, que é a alocação do array, a não ser que exista um motivo para alocar dinamicamente. Isto não é otimização prematura, pelo contrário, a alocação dinâmica deve ser evitada sempre que possível, sempre que ela não trouxer problemas específicos. Ela é mais simples, mais confiável e mais rápida, só tem vantagens quando o que precisa não será limitado pela sua característica.
Conclusão
Olhando por cima, no geral este código é mal escrito e não atende padrões modernos. Aparentemente pode ter sido escrito por quem ainda não conhece a linguagem direito ainda, até por outros erros.
Veja mais sobre a decisão (é C++, mas essencialmente é a mesma coisa).

A: Na parte dos dois códigos, a função do tipo que eles usaram está errada inclusive, então seria uma escolha fácil pelo segundo tipo.
Usar essa linha logo após o malloc é um erro:
x = (char *)NULL //sem ";" ainda por cima...

Opinião considerando que os dois trechos funcionam:
Varia muito de acordo com o caso.
Alocação dinâmica costuma ser vantajoso na parte de performance e memória se há flutuações grandes de objetos. Você não precisa ficar com 256 posições alocadas se usa geralmente 3 ou 4. A parte ruim é que costuma ser mais complicado de gerenciar.
Ainda mais se você for implementar seguranças automáticas, a performance entre as duas vai ser alterada. Só que hoje em dia, o hardware costuma permitir que os programadores tenham esses "mimos". Tem que ver qual o motivo para esse código legado ser assim, mudar todo o código agora seria bobagem também se ele for muito grande e difícil de testar.
Dito isso, hoje em dia vale à pena deixar otimização como uma das últimas prioridades ao programar. Se o código vai começar a ser criado agora, de preferência a clareza e facilidade de manutenção. Depois, se perceber que algum método precisa de performance, aí você pode procurar onde espremer.