text:
Q: ScreenUtilInit - flutter Im new in development, so Im having trouble with my screenutilinit function. I have added the dependencies '  flutter_screenutil: ^4.0.2+3 ' in the pubspec.yaml file but it has error saying 'The method 'ScreenUtilInit' isn't defined for the class 'MyApp'.

*

*'MyApp' is from 'package:sparks/main.dart' ('lib/main.dart').'

Last time the code works (fine) for my design but since I migrated my project files into new folder,  it has the red underline beneath it. Can anyone tell me why?
additional note: I migrated the project files into new folder because I was having trouble with my firebase set up, thus I decided to create a new project and copy and paste the lib files into the new project.
here is my main.dart:
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:sparks/screens/Welcomecomponent/welcome.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
        designSize: Size(414, 896), allowFontScaling: false,
        child: MaterialApp(
          title: 'Spark',
          theme: ThemeData(
            //primarySwatch: Colors.white,
            visualDensity: VisualDensity.adaptivePlatformDensity,
          ),
          home: WelcomeScreen(),
        ));
  }
}

this is my pubspec.yaml file:
name: sparks
description: A new Flutter project.

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.0
  flutter_screenutil: ^4.0.2+3

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:

  uses-material-design: true

  assets:
    - assets/images/
    - assets/icons/
    - assets/fonts/

here is the error:
enter image description here

A: The Widget you are trying to use needs a parameter called builder(). and ScreenUtilInit doesn't accept child: parameter.
Try this:
ScreenUtilInit(
  designSize: Size(360, 690),
  allowFontScaling: false,
  builder: () => MaterialApp(
    debugShowCheckedModeBanner: false,
    title: 'Flutter_ScreenUtil',
    theme: ThemeData(
      primarySwatch: Colors.blue,
    ),
    home: HomePage(),
  ),
);


text:
Q: VbScript to find the end character of a string suppose there is a string like "thisisatextfilea.txt" . I have to trim the .txt and find if the remaining string(thisisatextfilea) ends with character a . Thanks in Advance :)

A: Use Split() to get the part before the . and Right() to get its tail:
>> s = "thisisatextfilea.txt"
>> WScript.Echo Right(Split(s, ".")(0), 1)
>>
a

(Checking your assumptions (there is a substring left of the one and only .) might be a good idea for production code.)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Random variables/probability distribution table A discrete random variable $X$ has the following distribution table.
In the table, the $x$ values are $-2, -1, 0, 1, 2$ and their coinciding values are $0.1, 0.2, 0.2, 0.2$, and $0.3$ respectively.
a) Find the probability distribution table of the random variable $Y=X^2$
b) Compute $E(X)$ and $E(Y)$
c) Compute $E(X^2 - X + 1)$
I'm not sure how to begin with this problem. I think I start by squaring the $x$ values, but that means I would get $0, 1$, and $4$ on the table? And how exactly would I go about computing those alternate expected values? Thank you!

A: Fill out the table.
$\begin{array}{|r|r:r:r:r:r|l|} \hline X & -2 & -1 & 0 & 1 & 2
\\ \hdashline \mathsf P(X=x) & 0.1 & 0.2 & 0.2 & 0.2 & 0.3 \\ \hdashline x\,\mathsf P(X=x) & -0.2 &-0.2 & 0 & 0.2 & 0.6 & \mathsf E(X)= 0.4 \\ \hline\end{array}
\\
\begin{array}{|r|r:r:r|l|} \hline Y\textsf{ a.k.a. } X^2 & 0 & 1 & 4  \\ \hdashline \mathsf P(Y=y) \\ \hdashline y\,\mathsf P(Y=y) & & &  &\mathsf E(Y)=?\\ \hline \end{array}$
For $\mathsf E(X^2-X+1)$ recall the Linearity of Expectation.


text:
Q: PDF.js not working on IE9 Does anyone have any clue how to get PDF.js to work on IE 9? I have tried everything I can think of to get it to work and no go. I have downloaded the hack.js file and tried adding it before and after pdf.js and before and after viewer.js. That didn't work.
I then tried downloading compatability.js, viewer.js and pdf.js from their Demo (Which I can confirm is working 100% in IE9) and put them into my HTML page, no go. I am using their PDF file, which some sites say that some PDFs work and others don't. So I figured if it worked on their site it must work on mine--but no go.
The Demo of theirs works fine, but anytime I try to get mine to work in IE9, whether I use their files or my compiled version, it doesn't work.

A: Try to load compatibility.js before pdf.js. Something like this:
  <script type="text/javascript" src="/js/compatibility.js"></script>
  <script type="text/javascript" src="/js/pdf_compr.js"></script>

A: Browser support in their FAQs - check this as since the question was asked IE9 could have be supported: https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#what-browsers-are-supported

A: PDF.JS and IE9 doesn't play too well together and I wouldn't rely on it if you want to support IE 9. Some of the rendering features in PDF.JS are not well progressed enough to be useable in IE9
There are ways to get around this, you can use FlexPaper which can be used in combination with PDF.js and a HTML4 version for browsers without HTML5 support
http://flexpaper.devaldi.com/demo/
(note; I am affiliated with FlexPaper product)


text:
Q: Crystal Report Viewer is showing blank page The Crystal Report Viewer is showing blank page. I have checked all the possible causes but the http://domain.com/aspnet_client/system_web/4_6_1069/crystalreportviewers13/js/crviewer/crv.js is not found.
I have set virtual directory as aspnet_client to the website root directory.
Please help...

A: I had similar problem and installing support pack 19 from this link resolved this.

A: In some server it is looking for a folder in website directory called 4_6_1069.
Just had to copy the earlier version Cr files to that folder and it worked nicely.

A: i also faced same problem and found by inspecting with firebug that there is a missing file name crv.js. added the that file manually into my crystal report viewer page.
<script src="/crystalreportviewers13/js/crviewer/crv.js"></script>


text:
Q: puppet get node ip and use it My node's have several ip address. And i need to use only 192.168.. in my templates.
Example: server has ip 192.168.156.68 and 10.248.41.70.
In my manifest i write something like:
if $::ipaddress =~ /^192\.168\.\d{1,3}\.\d{1,3}/ {
  notice("ok")
}
else {
  warning("don't know what to do with IP address $::ipaddress")
}

and in templates:
ListenAddress <%= @ipaddress %>
In result, on the nodes conf file i get:
ListenAddress 10.248.41.70
but i have to get
ListenAddress 192.168.156.68
Can anybody can explain me how to do it ?

A: I think you should use temp variable: validIp
   if $::ipaddress =~ /^192\.168\.\d{1,3}\.\d{1,3}/ {
      notice("ok")
      $validIp= $::ipaddress
    }
    else {
      warning("don't know what to do with IP address $::ipaddress")
      $validIp= 'undefined'
    }

And in template:
ListenAddress <%= @validIp %>

Or you can check ip in template.


text:
Q: C++ Store multiple integers in one int variable I am trying to store multiple integers in one int variable.
So like this:
int num1 = 2;
int num2 = 6;
int num3 = num1 + num2;

But I get 8. I want 26. I am aware this is the result I should expect, but I would just like a method of tying the integers together instead of adding them and I couldn't think of a better example.
Thank you!

A: You can convert them to string, add them, and convert them back (which isn't efficient as the second option)
int num3 = std::stoi(std::to_string(num1) + std::to_string(num2));

or a more "mathy" way (which only works if num2 is only a digit)
int num3 = num1 * 10 + num2;

Note that the first solution works for any numbers, which also means that without storing the length of the number there is no way to get the original numbers back.

A: Well, what about just adding the digits multiplied and pushed to their intended positions?
int num3 = num1 * 10 + num2;

A: I think you want to concatenate the two string literals.
Convert the int to string and then concatenate the two strings
This will give you the concatenated string "26" from the strings "2" and "6"
If you need the int 26 then you can convert it back to an int after the concatenation.
Good luck :-)

A: You can store multiple integers as one integers using bitwise operation.
For the example you provided:
int num1 = 2; // 0010
int num2 = 6; // 0110

You can then concatenate the numbers using 4 bits:
int num3 = (2 << 4) | 6; // 00100110 num3 = 38

Or if you are using 3 bits, then it becomes:
int num3 = (2 << 3) | 6; //010110 num3 = 22

To retrieve back the numbers, you will have to do a Right shift on num3 to get num1 and  do a bitwise AND with 2 to the power of number of bits - 1 (2 ^ n - 1, where n = number of bits).
For 4 bits, num3 = 38;
num1 = num3 >> 4; // 2
num2 = num3 & (2 * 2 * 2 * 2 - 1); // 6

For 3 bits, num3 = 22:
num1 = num3 >> 3; // 2
num2 = num3 & (2 * 2 * 2 * 2 - 1); // 6

Hope this helps.

A: Little bit late, but:
You could do make a string of those two integers and then convert it back to a string.
Here's my more simple but bigger code:
int foo = 2;
int bar = 6;
string temp = to_string(foo) + to_string(bar);
int foobar = stoi(temp);
cout << foobar;

And here's my smaller one:
int foo = 6;
int bar = 2;
int foobar = stoi(string(to_string(foo)) + string(to_string(bar)));
cout << foobar;

Maybe not as efficient as the other examples but it also works if there are two-digit numbers.

A: You would have to store them as strings to concatenate them like that as so:
string str_num1 = to_string(num1);
string str_num2 = to_string(num2);
string result = num1 + num2;

This is a bad way to do it though because if you use any number that's not 1 digit, it will get way too complicated to store and/or pull out the data.
Use a vector or pair.  Much easier and less hassle:
pair<int, int> presult = make_pair(num1, num2);  ///or
vector<int> vresult;
vresult.push_back(num1);
vresult.push_back(num2);  ///num1 in spot 0, num2 in spot 1

vector should be best since it can hold arbitrarily large number of ints


text:
Q: Swift 2.1 DatePicker setDate does not set date to current day and specified time I am trying to set the minimum date to the current day on the date picker and then for the sake of user experience, set the time to 7pm or 19:00. For some reason it doesn't seem to be working. The minimum date setting works but the time doesn't get set. If I remove the minimum date line, the time gets set to 7pm, but strangely, the date gets set to Monday, Jan 1. Which isn't even this year.
Here's my code below:
    datePicker.minimumDate = NSDate()
    let calendar:NSCalendar = NSCalendar.currentCalendar()
    let components = calendar.components([NSCalendarUnit.Hour, NSCalendarUnit.Minute], fromDate: NSDate())
    components.hour = 19
    components.minute = 00
    datePicker.setDate(calendar.dateFromComponents(components)!, animated: true)

What am I doing wrong here?

A: Split that last line into:
let date = calendar.dateFromComponents(components)!
datePicker.setDate(date, animated: true)

Then look at the value of date. You'll find it is probably January 1, 2000 at the desired time.
Fix this by adding the year, month, and day components to:
let components = calendar.components([NSCalendarUnit.Hour, NSCalendarUnit.Minute], fromDate: NSDate())

In other words, you need:
let components = calendar.components([NSCalendarUnit.Year, NSCalendarUnit.Month, NSCalendarUnit.Day, NSCalendarUnit.Hour, NSCalendarUnit.Minute], fromDate: NSDate())


text:
Q: Wordpress - How to create new page (also template page for that) using plugin How to create new page and its template page using wordpress plugin ?

A: For wordpress 3.4.2, I'm using the plug in named "DX Page Template". The link is at http://wordpress.org/extend/plugins/dx-template-manager


text:
Q: error when adding a new xib in main interface downloaded here this parser launched, it works, but when I want to change main interface (the default setting is MainWindow.xib, and I want to put my xib), shows the following error. I wish that I was a structure MyNewXib.xib - MainWindow.xib - RootViewController.xib,  but when I add in MainInterface MyNewXib.xib get this error, how do I fix it.
    2015-03-23 11:27:02.686 TetraVer 1.1[411:5899] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x7fa352c30c10> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000110e1ba75 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010fad9bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x0000000110e1b6b9 -[NSException raise] + 9
    3   Foundation                          0x000000010f42fd43 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
    4   CoreFoundation                      0x0000000110d655e0 -[NSArray makeObjectsPerformSelector:] + 224
    5   UIKit                               0x000000010e3f54ed -[UINib instantiateWithOwner:options:] + 1506
    6   UIKit                               0x000000010e3f6f92 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 160
    7   UIKit                               0x000000010e12dc71 -[UIApplication _loadMainNibFileNamed:bundle:] + 46
    8   UIKit                               0x000000010e12cd2b -[UIApplication _runWithMainScene:transitionContext:completion:] + 1074
    9   UIKit                               0x000000010e12bd35 -[UIApplication workspaceDidEndTransaction:] + 179
    10  FrontBoardServices                  0x000000010fe84243 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
    11  CoreFoundation                      0x0000000110d50c7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    12  CoreFoundation                      0x0000000110d469c5 __CFRunLoopDoBlocks + 341
    13  CoreFoundation                      0x0000000110d46785 __CFRunLoopRun + 2389
    14  CoreFoundation                      0x0000000110d45bc6 CFRunLoopRunSpecific + 470
    15  UIKit                               0x000000010e12b7a2 -[UIApplication _run] + 413
    16  UIKit                               0x000000010e12e580 UIApplicationMain + 1282
    17  TetraVer 1.1                        0x000000010e06c6f4 main + 68
    18  libdyld.dylib                       0x0000000114c7d145 start + 1
    19  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

A: Make sure you have the elements linked correctly with interface and definition (check the outlet for you xib elements). This error comes usually when you have one ore more element in xib witch definition (@property) was deleted.


text:
Q: Foreach in jstl c tag I´m using jstl in jsp, creating a object result from a DTO, when I use it in this way:
<c:if test="${not empty result.billedConsumptionActive}">

<c:out value="${result.billedConsumptionActive}"></c:out>

</c:if>

This return and print:
ConsumptionDTO [consumptionHour00=37.6, consumptionHour01=null, consumptionHour02=null, consumptionHour03=50, consumptionHour04=null, consumptionHour05=null, consumptionHour06=12.5, consumptionHour07=null]
But when I try to use it in a foreach statement:
<c:if test="${not empty result.billedConsumptionActive}">
    <c:forEach var="window" items="${result}">
        <c:out value="${result.billedConsumptionActive}"/>
    </c:forEach>
</c:if>

I got an error, and I cant explain why. There's another way to call items="${result}??

A: Try this:
<c:if test="${not empty result.billedConsumptionActive}">
    <c:forEach var="window" items="${result.billedConsumptionActive}">
        <c:out value="${window}"/>
    </c:forEach>
</c:if>


text:
Q: Powershell Arrays and Parenthesis Coming from other programming languages, I would expect the following statements to all produce the same result. Can someone explain why the parenthesis make a difference here?
PS D:\>   "ab",      "cd"
ab
cd
PS D:\>  "a"+"b" ,  "c"+"d"
ab cd
PS D:\>  "a"+"b" , ("c"+"d")
ab cd
PS D:\> ("a"+"b"),  "c"+"d"
ab
c
d
PS D:\> ("a"+"b"), ("c"+"d")
ab
cd
PS D:\>

A: The applicable rules are as follows:

*

*The , is a unary or binary operator that creates an array of the operand(s), and it has higher precedence than the + operator.

*The + operator can be used for numerical addition, string concatenation, and array concatenation. The data type of the left operand determines which type of operation is performed. If possible, the right operand is cast as the data type of the left operand; if not possible, an error is thrown. *

*Where precedence is equal, evaluation occurs left to right.

*Arrays are cast as strings by listing the elements separated by spaces.

*Parentheses, as you'd expect, have higher precedence than any operator, and cause the enclosed expression to be evaluated before anything outside the parentheses.

*The default output of an array object is a list of elements, one on each line.

* That explains seemingly inconsistent results such as that "foo" + 1 evaluates to foo1, but 1 + "foo" gives you an error.
So, let's take a look at your test cases, and analyze what happens following the logic explained above.

Case I:
"ab", "cd"

This one is very straightforward: the , operator creates an array of two strings, ab and bc.

Case II:
"a" + "b", "c" + "d"

This one seems counter-intuitive at a first glance; the key is to realize that , is evaluated before +. Here's how the result is obtained, step by step:

*

*"b", "c" is evaluated first (due to ,'s precedence over +), creating an array of the elements b and c.

*Next, the + operator is applied to "a" and the array created in step 1. Since the left operand "a" is a string, a string concatenation is performed.

*To concatenate a string with an array, the array is cast as a string. An array of b and c becomes the string b c.

*Concatenating a with b c yields ab c.

*Finally, ab c is concatenated with d to produce the final result, ab cd

Case III:
"a"+"b" , ("c"+"d")

This yields the same result by coincidence; the evaluation occurs differently:

*

*("c"+"d") is evaluated first, due to the parentheses. That's a plain vanilla string concatenation, which results in the string cd.

*Next, the , operator is applied to "b" and the string from step 1, creating an array of the elements b and cd. (This is evaluated before "a" + "b" because , has higher precedence than +.)

*Then, the + operator is applied to "a" and the array created in step 2. Since the left operand is a string, a string concatenation is performed.

*The array of b and cd is cast as the string b cd.

*The strings a and b cd are concatenated, resulting in the final output ab cd.

Case IV:
("a" + "b"),  "c" + "d"

This is the most interesting test case, and probably the most counter-intuitive, because it yields results that may appear inconsistent. Here's how it's evaluated:

*

*Similar to Case III step 1, ("a" + "b") is evaluated first, producing the string ab.

*The , is applied to the string from step 1 and "c", creating an array of the elements ab and c.

*The + operator is applied to the array from step 2 and the next token, "d". This time, the left operand is an array, so an array concatenation is performed.

*The string operand "d" is cast as an array of one element.

*The two arrays are concatenated into an array of the elements ab, c, and d.

Case V:
("a" + "b"), ("c" + "d")

By now, it should be easy to see what happens here:

*

*("a" + "b") is evaluated as the string ab.

*("c" + "d") is evaluated as the string cd.

*The , is applied to the strings from steps 1 and 2, creating an array of ab and cd.

You can see the precedence table with the command
Get-Help about_Operator_Precedence

(Help doc names can be tab-completed, so to save typing, that's help about_opTABTAB)


text:
Q: how To Type Uppercase String in windows phone TextBox Wpf c# how To Type Uppercase String in windows phone TextBox Wpf c#.
I tried it on KeyDown Event.
   void TxtPanno_KeyDown(object sender, KeyEventArgs e)
   {

   TxtPanno.Text = TxtPanno.Text.ToUpper();  //1 code.

   TxtPanno.Text= CultureInfo.CurrentCulture.TextInfo.ToUpper(TxtPanno.Text); //2 code

   TxtPanno.Text=Regex.Replace(TxtPanno.Text, "^[A-Z]", m => m.Value.ToUpper());  //3 code.
   }

But Problems is that.
Cursor always go to leftside.

A: Try doing:
TxtPanno.Text = TxtPanno.Text.ToUpper();
TxtPanno.SelectionStart = TxtPanno.Text.Length;
TxtPanno.SelectionLength = 0;

It makes the text uppercase, moves the cursor to the end and selects nothing.

A: You should not try to replace text,instead you should apply styles like this
<Style TargetType="{x:Type TextBox}">
    <Setter Property="CharacterCasing" Value="Upper"/>
</Style>

The above style will make all textboxes uppercase, you can change it to only apply to a specific textbook like this
<TextBox CharacterCasing="Upper" />

then when using the text entered, make it upper case.

A: Finally I tried this code and it worked.
void TxtPanno_TextChanged(object sender, TextChangedEventArgs e)
{

  TxtPanno.Text = TxtPanno.Text.ToUpper();
  TxtPanno.SelectionStart = TxtPanno.Text.Length;

}


text:
Q: Java, access directory with relative path causes problems between different environments In between environments(local and remote Jenkins build) i have different paths to reach the same directory:
Local:
product/version/src/main/

Jenkins build:
  ../../product/version/src/main/

The project structure is as follows:
Product
---Module
      src/main/java/com.product.core.DirFetcher.class
---Version
      src/main

And the way i retrieve it(locally) is like this(from the DirFetcher class):
    try (DirectoryStream<Path> paths = Files.newDirectoryStream(Paths.get("product/version/src/main/"))) {

This goes fine locally but throws an exception on Jenkins env.
I cant figure out why this is happening as the path is relative and the project structure is of course the same for both cases.
Is there a way to reach that directoy programmatically without doing any string transformation based on the current environment?


text:
Q: Holonomy of a curve in case of principal $U(1)$ bundle Suppose $\pi : P\rightarrow M$ is principal $U(1)$ bundle. Let $\gamma$ be a loop in $M$ based at $x_0$ and write $iA$ as connection 1-form on $P$ where $A\in \Omega(P)$. Now define $hol_{\gamma}(A)\in U(1)$ as follows: let $\tilde{\gamma}$ be a horizontal lift of $\gamma$ with $\tilde{\gamma}(0)=p_0$ and $\pi(p_0)=x_0$. Then there is a unique element $hol_{\gamma}(A)$ in $U(1)$ such that $\tilde{\gamma}(1)=p_0\cdot hol_{\gamma}(A)$ because the action is free and transitive.
I now want to calculate explicitly what is this number $hol_{\gamma}(A)$. I know already it has to be $hol_{\gamma}(A)=e^{i\int_{\gamma}A}$, but I have no idea how this is calculated as I am new to holonomy. Any hint is useful for me. Thanks

A: Given a loop $\gamma: S^1 \to M$, we can form the pullback bundle $\gamma^*P$ with pullback connection $\gamma^*A$. The holonomy of the pullback along the identity loop $S^1 \to S^1$ is the same as the holonomy of the original connection along the original loop $\gamma$. The bundle is now trivial (there's only one $U(1)$-bundle over $S^1$) and the connection form we'll still call $iA$. Consider the torus for now as $\Bbb R^2/2\pi\Bbb Z^2$.
If $iA$ is explicitly $f(t)dt + d\theta$, $d\theta$ the canonical 1-form on the circle fibers, the kernel at $T_{t,\theta}$ is those points of the form $(s,-f(t)s)$. We can then see explicitly that a horizontal lift is given by a curve with derivative $\eta'(t) = (1,-f(t))$; and we can explicitly write this down as $\eta(t) = (t, -\int_{0}^t f(s)ds)$. Thus $\eta(1) = (1, - \int_0^1 f(t)dt)$. Now this says that the holonomy is $$- \int_0^1 f(t)dt \pmod 1.$$ But that's just because here I'm considering the circle fiber to be $\Bbb R/2\pi \Bbb Z$; the canonical isomorphism $\Bbb R/2\pi \Bbb Z \to S^1$ is precisely the exponential map, giving you the desired holonomy $$e^{-\int_\gamma iA}.$$


text:
Q: Add string to h5 file I have the following code:
import tables
import numpy as np

filename = "file.h5"

x = np.random.random(150)
z = np.random.random(150)
mystr = " " * 160

f = tables.open_file(filename, mode="w")
hds = f.create_carray(f.root, "x", obj=x,
                      filters=tables.Filters(complevel=5, complib='zlib'))
hds = f.create_carray(f.root, "z", obj=z,
                      filters=tables.Filters(complevel=5, complib='zlib'))
f.close()

I would like to add a string to my file with the length of 160. Is there an elegant way to do this?
Thank you in advance.

A: With h5py you can store numpy arrays containing strings (or just one) as a dataset.  Or you can store a string as an attribute of either a group or a dataset.
 http://docs.h5py.org/en/latest/strings.html

It can be as simple as:
dset.attrs["title"] = "Hello"

I haven't used tables, but it's got to have access to these attributes as well.  Isn't there something in the documentation?
The file object itself has a .attrs dictionary as well.

A: Storing string type data in H5 is somewhat tricky. It is a common problem for the first time H5 user in Python. The data type must be presented clearly before putting into an H5 dataset (i.e., whether if it is a string, integer, or float). As for string data type, you need to specify it as a variable. For example, dt = h5py.string_dtype().
Below is an example to put a string in a H5 file.
import h5py
data = 'value in string'
f= h5py.File('./fname.h5','w')
try:
    dt = h5py.string_dtype()
    f.create_dataset('str_data', data=data, dtype=dt)
except Exception as ex:
    print(ex)
finally:
    f.close()

Also, for your reference, to check if the data is stored correctly, just use the following code.
f= h5py.File('./fname.h5','r')
try:
    print(f.keys())
    print(f['str_data'][()])
except Exception as ex:
    print(ex)
finally:
    f.close()

For further reference, please read the H5 documentation about String in HDF5.
http://docs.h5py.org/en/stable/strings.html


text:
Q: flutter notification onBackgroundMesssage issue I am trying to add this following line but it gives me an error
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
packages are also added.. but it gives an error like
Try correcting the name to the name of an existing method, or defining a method named 'onBackgroundMessage'.```

A: You have used it incorrectly , use like below :

final FirebaseMessaging _auroMessaging = FirebaseMessaging();

//Method to register for FCM Messages
  void registerAuroNotifications() async {
    //Initialize Firebase
    await Firebase.initializeApp();

    //Prasad Get User permissions on  iOS
    getFCMIOSPermission();

    // Listen for Messages
    this.listenToFCMMessages();

    this.getFCMToken();
  }

  //Method getFCMIOSPermission
  void getFCMIOSPermission() {
    _auroMessaging.requestNotificationPermissions(const IosNotificationSettings(
        sound: true, badge: true, alert: true, provisional: true));
    _auroMessaging.onIosSettingsRegistered
        .listen((IosNotificationSettings settings) {
      print("IOS Settings registered: $settings");
    });
  }

  //Method to get FCM Token
  void getFCMToken() {
    _auroMessaging.getToken().then((token) {
      _fcmToken = token;
      sendTokenForFCMtoServer(_fcmToken);
      print('Token : $token');
    });
  }

  //Method to register and listen to FCM messages
  void listenToFCMMessages() {
    _auroMessaging.configure(
      onMessage: (Map<String, dynamic> message) async {
        print('onMessage : $message');
      },
      onLaunch: (Map<String, dynamic> message) async {
        print('onLaunch : $message');
      },
      onResume: (Map<String, dynamic> message) async {
        print('onResume : $message');
      },
      onBackgroundMessage: (Map<String, dynamic> message) async {
        print('onResume : $message');
      },
    );
  }


text:
Q: "Uniqueness of extension" results for measures on separable spaces Hello all.
I have the following (perhaps basic) question: Let $X$ be a separable metric space. Does there necessarily exist a countable set $\mathcal{C}$ of Borel sets in $X$ such that any two probability measures which agree on $\mathcal{C}$ must agree on the whole of $\mathcal{B}(X)$?
(And slightly more generally: Let $(X,\Sigma)$ be a countably generated measurable space. Then does there necessarily exist a countable set $\mathcal{C}$ of $\Sigma$-measurable sets such that any two probability measures which agree on $\mathcal{C}$ must agree on the whole of $\Sigma$?)
Thanks,
Julian.

A: Yes.  This can be proved using Dynkin's $\pi$-$\lambda$ theorem.  The collection $\mathcal{L} := \{ B \in \Sigma : \mu(B) = \nu(B)\}$ is a $\lambda$-system.  By Dynkin's theorem, if $\mathcal{L}$ contains a $\pi$-system which generates $\Sigma$ then $\mathcal{L} = \Sigma$, i.e. $\mu=\nu$.  If $\mathcal{C}_0$ is countable and generates $\Sigma$, then the collection $\mathcal{C}$ of all finite intersections of sets from $\mathcal{C}_0$ is a countable $\pi$-system which generates $\Sigma$.  So any two probability measures that agree on $\mathcal{C}$ must be equal.


text:
Q: How to run tasks sequentially in a loop in an Airflow DAG? Say I have this snippet of an example DAG:
variables = ['first', 'second', 'third']

def run_dag_task(variable):
  task = dag_task(variable)
  return task

for variable in variables:
  run_dag_task(variable)

This code would run the three tasks for the three variables in parallel. Now, say I want the first task to finish before commencing the second task, and to finish the second task before commencing the third task. How would I go about doing this with a loop? Is that possible?

A: In Airflow, you can define order between tasks using >>. For example:
task1 >> task2

Which would run task1 first, wait for it to complete, and only then run task2. This also allows passing a list:
task1 >> [task2, task3]

Will would run task1 first, again wait for it to complete, and then run tasks task2 and task3.
Your example could be written as:
start = 'first'
variables = ['second', 'third']

def run_dag_task(variable):
  task = dag_task(variable)
  return task

start_task = run_dag_task(start)
next_tasks = [run_dag_task(var) for var in variables]
start_task >> next_tasks

A: variables = ['first', 'second', 'third']

def run_dag_task(variable):
  task = dag_task(variable)
  return task
task_arr=[]
task_arr.append(run_dag_task(variable[0]))

for variable in variables[1:]:
  task=run_dag_task(variable)
  task_arr[-1]>>task
  task_arr.append(task)

This should do what you need. Add tasks on to an array and setup the relationship


text:
Q: Is a function-valued matrix analytic if its entries are analystic functions? Let $\boldsymbol{A}(t):\mathbb{R}\rightarrow\mathbb{C}^{n\times n}$ be a function valued Hermitian matrix. If the entries $a_{ij}(t):\mathbb{R}\rightarrow{C}$ of  $\boldsymbol{A}(t)$ are analytic functions is $\boldsymbol{A}(t)$ also analytic?

A: If I understand it correctly, it is trivial. Whenever $a_{ij} (t) = \sum_{k=0}^\infty c_{ijk} t^k$ then the matrix can be also written as infinite sum, like
$A(t) = \displaystyle \sum_{k=0}^\infty \begin{bmatrix} c_{11k} & \dots & c_{1nk} \\ \vdots & \ddots & \vdots \\ c_{n1k} & \dots & c_{nnk} \end{bmatrix} t^k$
It also looks like $A(t)$ doesn't have to be Hermitian.


text:
Q: Clear entire, transformed HTML5 Canvas while preserving context transform I want to zoom and pan an HTML5 Canvas by transforming the context using translate() and scale(), clearing the canvas, and then redrawing. Note that I am explicitly not calling save() and restore() around my transformations.
If I perform the standard ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height) then the entire visible canvas will not be cleared; downscaling or panning may cause this initial rectangle to not exactly cover the drawing area.
If I perform the Webkit-friendly clearing method...
var w=canvas.width;
canvas.width = 0;
canvas.width = w;

...then the cumulative transformation of the context is reset.
How can I best clear the entire canvas context without losing my transformation?

A: For those who care to track their full context transforms, here's my code for doing so in an on-demand, per-context basis. This is prefaced with the usage that shows how to clear the full rectangle based on the transformed coordinates. You can see the code in use on my website.
window.onload = function(){
  var canvas = document.getElementsByTagName('canvas')[0];
  var ctx = canvas.getContext('2d');
  trackTransforms(ctx);
  function redraw(){
    var p1 = ctx.transformedPoint(0,0);
    var p2 = ctx.transformedPoint(canvas.width,canvas.height);
    ctx.clearRect(p1.x,p1.y,p2.x-p1.x,p2.y-p1.y);
    // ...
  }
}

// Adds ctx.getTransform(), returning an SVGMatrix
// Adds ctx.transformedPoint(x,y), returning an SVGPoint
function trackTransforms(ctx){
  var svg = document.createElementNS("http://www.w3.org/2000/svg",'svg');
  var xform = svg.createSVGMatrix();
  ctx.getTransform = function(){ return xform; };

  var savedTransforms = [];
  var save = ctx.save;
  ctx.save = function(){
    savedTransforms.push(xform.translate(0,0));
    return save.call(ctx);
  };
  var restore = ctx.restore;
  ctx.restore = function(){
    xform = savedTransforms.pop();
    return restore.call(ctx);
  };

  var scale = ctx.scale;
  ctx.scale = function(sx,sy){
    xform = xform.scaleNonUniform(sx,sy);
    return scale.call(ctx,sx,sy);
  };
  var rotate = ctx.rotate;
  ctx.rotate = function(radians){
    xform = xform.rotate(radians*180/Math.PI);
    return rotate.call(ctx,radians);
  };
  var translate = ctx.translate;
  ctx.translate = function(dx,dy){
    xform = xform.translate(dx,dy);
    return translate.call(ctx,dx,dy);
  };
  var transform = ctx.transform;
  ctx.transform = function(a,b,c,d,e,f){
    var m2 = svg.createSVGMatrix();
    m2.a=a; m2.b=b; m2.c=c; m2.d=d; m2.e=e; m2.f=f;
    xform = xform.multiply(m2);
    return transform.call(ctx,a,b,c,d,e,f);
  };
  var setTransform = ctx.setTransform;
  ctx.setTransform = function(a,b,c,d,e,f){
    xform.a = a;
    xform.b = b;
    xform.c = c;
    xform.d = d;
    xform.e = e;
    xform.f = f;
    return setTransform.call(ctx,a,b,c,d,e,f);
  };
  var pt  = svg.createSVGPoint();
  ctx.transformedPoint = function(x,y){
    pt.x=x; pt.y=y;
    return pt.matrixTransform(xform.inverse());
  }
}

A: Keeping track of all the transformation information like you are presumably doing is what several others so far have done (like cake.js and my own library, for two). I think doing this will pretty much be an inevitability for any large canvas library.
Ilmari of cake.js even complained to mozilla:
https://bugzilla.mozilla.org/show_bug.cgi?id=408804
You could instead call save/restore around your clear method:
// I have lots of transforms right now
ctx.save();
ctx.setTransform(1,0,0,1,0,0);
// Will always clear the right space
ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height);
ctx.restore();
// Still have my old transforms

Won't that satisfy your case?


text:
Q: For the default Artemis queue, can the queue be queried for outbound transactions? If the node.config file does not have an entry for messagingServerAddress, the default Artemis queue is spun up.  Is it possible in the Corda API (V2 or V3) to query the queue for any proposed transactions, which originated from self node, and have yet to be sent/received by a counter-party node?  The business case is if a counter-party node is offline, I want to be able to see what is accumulating in the queue.

A: This is not possible as of Corda 3.
The Artemis queue is stored locally as a high performance journal that contains all kinds of metadata in case it needs to restore state from a hard bounce. Extracting info from this format is not easy.
A better way to see which messages have accumulated would be to query the node's flow checkpoints, to see which ones are blocking on an unACK'ed message send. But we haven't written the code to do this either yet.


text:
Q: unique record identifier based on combination of attribute values I have a model with several attributes MyModel(attr_1:integer, attr_2:string, attr_3:integer, attr_4: float, …etc, uid: integer)
I need to fill each record's uid field with unique value for each unique combination of attr_1 and attr_2 values
Then i could use this field to find all "semi-similar" records based on this combination with trivial select
First idea was:
"#{attr_1}_#{attr_2}".hash #=>produces long (unique?) integer

But i do not confident if it gives the value i need
Is it? Or can you propose a better solution?

A: You can try MD5 hash Algorithm
require 'digest/md5'
Digest::MD5.hexdigest("#{attr_1}_#{attr_2}")

Will create a unique hex identifier for unique attr1_attr2 combination.

A: If you can change the uid type to String, you can use following method. Other wise you will have to implement something like in public key cryptography.
If you need to find semi similar records using the unique key, it have to have two separable parts.
hash1 = Digest::MD5.new << 'attr1'
hash2 = Digest::MD5.new << 'attr2'

Then you can save uid as,
hash1[0..6] + "-" + hash2[0..6]

This will create 13 charactor string(6 + "-" + 6)
Then you can use it in a search.
Ex: If you want to search semi similars with attr1x use it in a find,
attr1xhash = Digest::MD5.new << 'attr1x'
attr1xhash = attr1xhash[0..6]
"like 'attr1x-%'"

for attr2x
attr2xhash = Digest::MD5.new << 'attr2x'
attr2xhash = attr2xhash[0..6]
"like '%-attr2x'"

Note: There is possibility of getting 2 equal strings for non equal attributes. You can minimize it by increasing the string size. (Here 6)


text:
Q: Set CommandParameter to ListBoxItem selected event I would like to pass a CommandParameter to a Command on ListBoxItem selection but can't figure out how to do it (I'm new to mvvm & commands so it may be trivial).
I tried to do this, but the CommandParameter property seems not to be available:
<ListBoxItem>
    <ListBoxItem.CommandBindings>
        <CommandBinding Command="{Binding OperationsCommand}"/>
    </ListBoxItem.CommandBindings>
    <TextBlock Text="All Items"/>
</ListBoxItem>

A: You can bind the selecteditem to your viewmodel directly and in setter for that item you can perform your operation.
<ListBox ItemSource="{Binding YourCollection}" SelectedItem="{Binding MyItem}"/>


text:
Q: How join historical and current table, but remove historical data if it's in current table? I have historical data stored in a historical table, and current table in different tables.  When I get similar data from each table, how do I join the data, but remove items from the historical data, if we have more recent, current data, when I join the data?
example:
Historical found:

ID   LastReboot1  LastReboot2
4622 11-09-2022   11-09-2022
0462 21-09-2021   21-09-2021
0099 19-10-2021   19-10-2021

Current found:
4622 18-09-2022   18-09-2022
0462 20-09-2022   20-09-2022

I figure I can do a join between the 2 queries, but wouldn't that keep the duplicated data? So I'd wind up with this:
ID   LastReboot1  LastReboot2
4622 11-09-2022   11-09-2022
4622 18-09-2022   18-09-2022
0462 20-09-2022   20-09-2022
0462 21-09-2021   21-09-2021
0099 19-10-2021   19-10-2021

I want it to wind up with this (keeping current id's with newer data, but bringing historical data where there isn't current data):
ID   LastReboot1  LastReboot2
4622 18-09-2022   18-09-2022
0462 20-09-2022   20-09-2022
0099 19-10-2021   19-10-2021

I don't think that would be a join.  I appreciate help on this.  I know it's probably basic knowledge for some of you experts out there. I tried googling it, but I'm not finding the anser to what I need.

A: You can use UNION ALL to combine the two tables and use NOT EXISTS to filter out the historical rows that are also current rows:
SELECT *
FROM   current
UNION ALL
SELECT *
FROM   historical h
WHERE  NOT EXISTS (SELECT 1 FROM current c WHERE h.id = c.id)

Which, for the sample data:
CREATE TABLE Historical (ID, LastReboot1, LastReboot2) AS
SELECT '4622', DATE '2022-09-11', DATE '2022-09-11' FROM DUAL UNION ALL
SELECT '0462', DATE '2021-09-21', DATE '2021-09-21' FROM DUAL UNION ALL
SELECT '0099', DATE '2021-10-19', DATE '2021-10-19' FROM DUAL;

CREATE TABLE "CURRENT" (ID, LastReboot1, LastReboot2) AS
SELECT '4622', DATE '2022-09-18', DATE '2022-09-18' FROM DUAL UNION ALL
SELECT '0462', DATE '2022-09-20', DATE '2022-09-20' FROM DUAL;

Outputs:

ID
LASTREBOOT1
LASTREBOOT2

4622
2022-09-18 00:00:00
2022-09-18 00:00:00

0462
2022-09-20 00:00:00
2022-09-20 00:00:00

0099
2021-10-19 00:00:00
2021-10-19 00:00:00

fiddle


text:
Q: SvelteKit with Nginx returns response error 500 Im trying to build SvelteKit project and host it on a server with nginx, using @sveltejs/adapter-static. The app works fine when developing locally but when build it and upload it im getting 500 JSON.parse: unexpected character at line 1 column 1 of the JSON data for some of the routes.
The routes in problem are sourcing their data from a json file (part of the project).
My folder structure is:
src/
├── data/
│   └── my_data.json
└── routes/
    ├── api/
    │   └── something.json.js
    └── area/
        └── [method].svelte

something.json.js
import * as siteData from "../data/my_data.json";

export async function GET({ url }) {
  const param = url.searchParams.get("method");

  const body = siteData[param];

  return {
    body
  }
})

[method].svelte
<script context="module">
    export const load = async ({ params, fetch }) => {
        const response = await fetch(`/api/something.json?method=${params.method}`);
        const posts = await response.json();

        return {
            props: {
                posts
            }
        };
    };
</script>

<script>
  export let posts;
</script>

<div>
  <!-- do something with "data" here -->
</div>

svelte.config.js
import adapter from '@sveltejs/adapter-static';

/** @type {import('@sveltejs/kit').Config} */
const config = {
    kit: {
        adapter: adapter({
            pages: 'build',
            assets: 'build',
            fallback: 'index.html',
            precompress: false
        })
    }
};

export default config;

nginx.conf
http {
   server {
      listen 80;
      include /etc/nginx/mime.types;

      location / {
         root  /usr/share/nginx/html;

         try_files $uri $uri/index.html $uri.html /index.html;
      }
   }
}

With this setup:

*

*http://localhost:3000/area/method1 displays all ok

*http://my-server.com/area/method1 displays:

My (wild) guesses:

*

*this will never work because there is no actual back-end to handle the endpoint code

*nginx misconfiguration when trying to call/serve /api/something.json


text:
Q: How to uninstall Second Life installer.sh How do I uninstall Second Life I downloaded the Second Life viewer from install.sh

A: If what you mean is that you downloaded the archive from the Secondlife web site, extracted the archive and ran the install.sh script, it depends on where you installed the client when you run the install.sh script.
If you ran the script without sudo and elected to continue as such accepting all defaults
then the client will be installed in your home directory in a folder called .secondlife-install
just delete this folder with the following command;
rm -rf ~/.secondlife-install
In System > Preferences > Main Menu, on the left select the Internet group, on the right select the secondlife icon and press the delete button.
If you ran the script as sudo and accepted all defaults then the application will be installed in a folder called secondlife-install under the /opt directory, just remove this directory with the following command;
sudo rm -rf /opt/secondlife-install
As usual just be careful with the commands.
you can remove the .secondlife folder in your home directory if you do not need it for another client or for retaining Secondlife settings if you intend to try the same or another viewer.
It may interest you to note that you do not have to run the install.sh script if you just want to try the viewer and then get rid of it, you can just run the secondlife script in the folder you extracted the archive to. just remember that a .secondlife config and cache directory is created in your home folder this can be deleted safely if you do not have another client that uses that same config and cache directory.


text:
Q: Function of diode in the following circuit schematic?
I feel that I have a semi-solid understanding of op-amps (and the circuit above) after reading quite a few explanations online. Where I'm starting to get quite lost is the function of the two diodes in the schematic above. My understanding is that diodes are meant to inhibit the flow of current into one particular direction. If op-amps have (ideally) infinite impedance at the inputs and outputs, what are the diodes doing below? Why is the output of IC1-B (right side of image) connected to the voltage divider at the positive input of IC1-A?

A: The bottom diode provides positive feedback to the first opamp so it oscillates.


text:
Q: Rails3 Twitter Bootstrap: async loading of a div I have a set of nav-pills vertically stacked along the left. Each time I click on a pill I would like the div "report-html-content" to be loaded with the contents of html produced by the controller action corresponding to: program_reports_path(@program).
Seems very simple (sure, sure.) Here's the view:

          Trend lines for all questions

           <%= link_to "Summary of all questions", program_reports_path(@program),
                :remote => true, id: "reports-navlist", data: {toggle: "tab"} %>

          Trend lines for all questions

          Details on all questions

Here's the controller action:
  def report1
    @program = Program.find(params[:program_id])
    render :partial => "report1", layout: false
  end

It ALMOST works. Except that asking a nav-pill set to do a remote: true to a different URL for some reason makes the activation and deactivation of the tabs not work anymore.
I have two questions:
1) Can you see my bug?
2) What's the best practice way for me to achieve this with Rails 3 and Twitter Bootstrap, noting that I definitely want the content of the clicked tab to be fetched with ajax because those reports can be costly to compute.
Thank you!

A: Overwrite show event like this:

          Trend lines for all questions

          Summary of all questions

          Trend lines for all questions

          Details on all questions

You can read more about tabs events at http://twitter.github.com/bootstrap/javascript.html#tabs


text:
Q: Improving Speed of Histogram Back Projection I am currently using OpenCV's built-in patch-based histogram back projection (cv::calcBackProjectPatch()) to identify regions of a target material in an image. With an image resolution of 640 x 480 and a window size of 10 x 10, processing a single image requires ~1200 ms. While the results are great, this far too slow for a real-time application (which should have a processing time of no more than ~100 ms).
I have already tried reducing the window size and switching from CV_COMP_CORREL to CV_COMP_INTERSECT to speed up the processing, but have not seen any appreciable speed up. This may be explained by the OpenCV documentation (emphasis mine):

Each new image is measured and then
  converted into an image image array
  over a chosen ROI. Histograms are
  taken from this image image in an area
  covered by a "patch" with an anchor at
  center as shown in the picture below.
  The histogram is normalized using the
  parameter norm_factor so that it may
  be compared with hist. The calculated
  histogram is compared to the model
  histogram; hist uses The function
  cvCompareHist() with the comparison
  method=method). The resulting
  output is placed at the location
  corresponding to the patch anchor in
  the probability image dst. This
  process is repeated as the patch is
  slid over the ROI. Iterative histogram
  update by subtracting trailing pixels
  covered by the patch and adding newly
  covered pixels to the histogram can
  save a lot of operations, though it is
  not implemented yet.

This leaves me with a few questions:

*

*Is there another library that supports iterative histogram updates?

*How significant of a speed-up should I expect from using an iterative update?

*Are there any other techniques for speeding up this type of operation?

A: As mentioned in OpenCV Integral Histograms will definitely improve speed.
Please take a look at a sample implementation in the following link
http://smsoftdev-solutions.blogspot.com/2009/08/integral-histogram-for-fast-calculation.html


text:
Q: I can't generate the file due to I'm trying to generate this file but I'm getting an error that pdflatex-halt-on-error-inter...  I added the package  \usepackage{graphicx}, but its not working, any idea?
\documentclass[12pt]{article}
\usepackage{amsmath,amsthm, amssymb, latexsym}
\usepackage{tikz}
\makeatletter
\renewcommand*\env@matrix[1][c]{\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{*\c@MaxMatrixCols #1}}
\makeatother
\usepackage{moodle}
\usetikzlibrary{external} % set this
\tikzexternalize          % explicitly
\usepackage{graphicx}

\begin{document}
\begin{quiz}{Revisiting Linear Algebra}
\begin{multi}[points=2]{Matrix Form of a Linear System}
Consider the following system

\begin{tikzpicture} % matrix inside of tikzpicture node
\node{
$\begin{matrix}[r]
3.0 x_1    &+2.0 x_2     &+2.0  x_3      & -5.0 x_4 & =8 .0   \\
0.6 x_1   &+ 1.5 x_2     &+1.5 x_3       & -5.4 x_4 & =2.7 \\
1.2 x_1   & -0.3 x_2      & -0.3 x_3      & 2.4 x_4   &  =2.1 , \\
\end{matrix}
$};
\end{tikzpicture}

which may be written as a single vector equation; i.e, $\mathbf{AB}=\mathbf{B}$.\\
The $\mathbf{A}$ matrix associated with the system is:
\item*
\begin{tikzpicture}
\node{ $
\begin{bmatrix}[r]
3.0    &+2.0      &+2.0        & -5.0   \\
0.6    &+ 1.5      &+1.5        & -5.4   \\
1.2    & -0.3      & -0.3      & 2.4 , \\
\end{bmatrix}
$};\end{tikzpicture}
\item\begin{tikzpicture}
\node{ $
\begin{bmatrix}[r]
8 .0   \\
2.7 \\
2.1  \\
\end{bmatrix}
$};\end{tikzpicture}
  \item \begin{tikzpicture}
\node{$
\begin{bmatrix}[r]
x_1 &\\
x_2& \\
x_3 &\\
x_4 &\\
\end{bmatrix}
$};\end{tikzpicture}
\item
\begin{tikzpicture}
\node{$
\begin{bmatrix}[r]
3.0    &+2.0      &+2.0        & -5.0 &  8.0 \\
0.6    &+ 1.5     &+1.5       & -5.4  & 2.7 \\
1.2    & -0.3      & -0.3       & 2.4 , & 2.1\\
\end{bmatrix}
$};
\end{tikzpicture}
\end{multi}
 \end{quiz}
\end{document}


text:
Q: Frequency distribution of volumes of spheres is positively skew if the radii are symmetrically distributed
Suppose the frequency distribution of radii of $n$ spheres is symmetric. Show that the frequency distribution of the volumes of these spheres is positively skew.

I am trying to show this using Bowley's measure of skewness.
Denoting the radius by $r(>0)$, we have $Q_3(r)-Q_2(r)=Q_2(r)-Q_1(r)$ where $Q_i$ denotes the $i$th quartile. Then I need to prove that $Q_3(f(r))-Q_2(f(r))>Q_2(f(r))-Q_1(f(r))$ where $f(r)=\frac{4}{3}\pi r^3$. Is there a neat argument to prove the result without much calculation? My guess is that the median is getting pushed towards the right in the case of volume, but I cannot justify that.

A: This follows from the fact that the local effect of the function $R\to R^3$ is to expand values more and more as $R$ increases.  We don't actually need any ideas of Calculus to demonstrate this, though: by formulating the situation in the right way, it comes down to demonstrating a simple inequality.  Just don't lose site of the meaning of that inequality.

To simplify the exposition, without any loss of generality, choose a unit of radial measure for which the median radius $R$ is $1$.
The implications of symmetry
The symmetry of the distribution of $R$ implies its quantiles are equidistant from the median.  Specifically, for any $\delta$ with $0 \lt \delta\le 1$,
$$\Pr(R \le 1-\delta) = \Pr(R \ge 1 + \delta) = \alpha,$$
say. This makes $1-\delta$ an $\alpha$ quantile of $R$ and $1+\delta$ a $1-\alpha$ quantile, its "complementary quantile."  (Since $\delta\gt 0$, note that $\alpha\le 1/2$.)  Geometrically, this asserts that all pairs of complementary quantiles are equally spaced around the median.
The effect of cubing
Cubing of positive numbers is a monotonically, strictly increasing operation, whence cubing the radius preserves these inequalities.  Consequently, writing $C$ for the constant factor $4\pi/3$ and $V=CR^3$ for the volume, we can obtain useful information about the distribution of $V:$
$$\eqalign{\Pr(V \le C(1-\delta)^3) &= \Pr(R^3 \le (1-\delta)^3) &\\&= \Pr(R^3 \ge (1+\delta)^3) = \Pr(V \ge C(1+\delta)^3).\tag{1}
}$$
The assumption $0\lt \delta \le 1$ when multiplied by the inequality $2\delta^2 \le 6 \delta^2$ shows $2\delta^2 \lt 6\delta^3$, which is equivalent to
$$(1+\delta)^3 - 1 \gt 1 - (1-\delta)^3.$$
The consequences
In light of $(1)$, this shows that

for all possible quantiles $\alpha \le 1/2$, a $1-\alpha$ quantile of $V$--namely, $C(1+\delta)^3$--is further from its median $C$ than is the complementary $\alpha$ quantile--namely, $C(1-\delta)^3$.

Geometrically, it says that in any pair of complementary quantiles, the upper quantile lies further from the median than the lower one.
That is a very strong statement of positive skewness.

Ramifications
A comparable argument holds for any power $p \gt 1$ in place of $p=3$ and any positive constant $C$.  With a minor modification it will show that for $p \lt 1$, $p\ne 0$, the distribution of $CR^p / p$ is negatively skewed.  This provides insight into what the Box-Cox transformations $R \to (R^p-1)/p$ accomplish in terms of making distributions more or less skewed.


text:
Q: Subclassing the Django ImageFileField I'm interested in subclassing django's ImageFileField to allow access to the image IPTC metadata, something like:
>>> from myapp.models import SomeModel
>>> obj = SomeModel.objects.all()[0] # or what have you
>>> obj.image.iptc['keywords']
('keyword','anotherkeyword','etc')

... the docs say to read over django's internal code, which I did; I've tried to produce a working implementation and I am not sure what I'm doing -- I've defined custom fields before, but I can't come up with boilerplate setup for a file-based field.
I know I need to define an attr_class and a descriptor_class to make it work. Does anyone have a straightforward example or suggestion, with which I could get started?

A: It's not clear from your question: have you tried something like this?
class ImageMetadataMixin(object):
    """Mixin can be added to any image file"""
    @property
    def iptc(self):
        """Or something like this"""

class ImageWithMetadataFieldFile(ImageMetadataMixin, ImageFieldFile):
    pass

class ImageWithMetadataField(ImageField):
    attr_class = ImageWithMetadataFieldFile

I think it's all what necessary. Why do you think you need to redefine descriptor_class?

A: UPDATE: I have figured this one out -- thanks in part to the answer @valya provided. An example of a successful implementation can be found in my fork of django-imagekit:
https://github.com/fish2000/django-imagekit/blob/icc-develop/imagekit/modelfields.py


text:
Q: custom dialog box in Office Add-ins Is it possible to have custom dialog boxes in Office Add-ins. I have googled around but can't to find anything relevant.
If it's not possible, is there a work around someone can suggest.
It's a Word add-in with a task pane. I need to open a dialog box on click of a button within the pane, so that some selections can be done in the box and communicated back to the Document.
Thank you.

A: Update answer
There is a Dialog API that you can use to do this.

A: There are currently no APIs in Word nor Office for creating dialog boxes. However, you could create your own dialog using JQuery UI or you could open a new window using window.open() and have your own dialog in there.
Hope that helps,
Gabriel Royer
Developer on the Office Extensibility Team, MSFT


text:
Q: DDR-HP2 Wii friendship mode: Different levels for different players - how? As a family we play Dance Dance Revolution Hottest Party 2 on the Nintendo Wii. It's the European edition (product code B002ATNS0S on the website of a popular online retailer).
We have 2 dance-mats (might get more in the future). We're really enjoying it - particularly 'friendship mode', because it allows us to work as a team.
So we've often got an adult playing on one mat and a child playing on the other mat. It would be really useful if we could have a different difficulty level for each of the players. Ideally in 'friendship mode' but it doesn't have to be - although we'd rather it wasn't a 'battle' kind of mode.
But I can't work out how to do this. Before the start of a game (when we're choosing a track and a difficultly level), if player one presses up/down then it changes the difficulty level for both players. If player two presses up/down then it changes the difficulty level for both players.
So my question is: how do I change the difficulty level for each player individually?
I've already tried: going through all the different modes, looking in the options, reading the manual, and looking online. I can't find anything.
I realise that in 'friendship mode' it doesn't matter if one of the players misses some of the arrows, but we'd like to have an easier set of arrows for one of the players, otherwise it's confusing for our youngest. Doesn't have to be 'friendship mode', that's just a preference.
I feel like I'm missing something obvious - sorry if I'm being stupid.


text:
Q: Apache Beam GroupByKey() fails when running on Google DataFlow in Python I have a pipeline using the Python SDK 2.2.0 for Apache Beam.
This pipeline is almost a typical word count: I have pairs of names in the format ("John Doe, Jane Smith", 1), and I'm trying to figure out how many times each pair of names appears together, like this:
p_collection
            | "PairWithOne" >> beam.Map(lambda pair: (', '.join(pair).encode("ascii", errors="ignore").decode(), 1))
            | "GroupByKey" >> beam.GroupByKey()
            | "AggregateGroups" >> beam.Map(lambda (pair, ones): (pair, sum(ones)))
            | "Format" >> beam.Map(lambda element: {'pair': element[0], 'pair_count': element[1]})

When I run this code locally, with a small dataset, it works perfectly.
But when I deploy it to Google Cloud DataFlow, I get the following error:

An exception was raised when trying to execute the workitem
  423109085466017585 : Traceback (most recent call last): File
  "/usr/local/lib/python2.7/dist-packages/dataflow_worker/batchworker.py",
  line 582, in do_work work_executor.execute() File
  "/usr/local/lib/python2.7/dist-packages/dataflow_worker/executor.py",
  line 167, in execute op.start() File
  "dataflow_worker/shuffle_operations.py", line 49, in
  dataflow_worker.shuffle_operations.GroupedShuffleReadOperation.start
  def start(self): File "dataflow_worker/shuffle_operations.py", line
  50, in
  dataflow_worker.shuffle_operations.GroupedShuffleReadOperation.start
  with self.scoped_start_state: File
  "dataflow_worker/shuffle_operations.py", line 65, in
  dataflow_worker.shuffle_operations.GroupedShuffleReadOperation.start
  with self.shuffle_source.reader() as reader: File
  "dataflow_worker/shuffle_operations.py", line 69, in
  dataflow_worker.shuffle_operations.GroupedShuffleReadOperation.start
  self.output(windowed_value) File
  "apache_beam/runners/worker/operations.py", line 154, in
  apache_beam.runners.worker.operations.Operation.output
  cython.cast(Receiver,
  self.receivers[output_index]).receive(windowed_value) File
  "apache_beam/runners/worker/operations.py", line 86, in
  apache_beam.runners.worker.operations.ConsumerSet.receive
  cython.cast(Operation, consumer).process(windowed_value) File
  "dataflow_worker/shuffle_operations.py", line 233, in
  dataflow_worker.shuffle_operations.BatchGroupAlsoByWindowsOperation.process
  self.output(wvalue.with_value((k, wvalue.value))) File
  "apache_beam/runners/worker/operations.py", line 154, in
  apache_beam.runners.worker.operations.Operation.output
  cython.cast(Receiver,
  self.receivers[output_index]).receive(windowed_value) File
  "apache_beam/runners/worker/operations.py", line 86, in
  apache_beam.runners.worker.operations.ConsumerSet.receive
  cython.cast(Operation, consumer).process(windowed_value) File
  "apache_beam/runners/worker/operations.py", line 339, in
  apache_beam.runners.worker.operations.DoOperation.process with
  self.scoped_process_state: File
  "apache_beam/runners/worker/operations.py", line 340, in
  apache_beam.runners.worker.operations.DoOperation.process
  self.dofn_receiver.receive(o) File "apache_beam/runners/common.py",
  line 382, in apache_beam.runners.common.DoFnRunner.receive
  self.process(windowed_value) File "apache_beam/runners/common.py",
  line 390, in apache_beam.runners.common.DoFnRunner.process
  self._reraise_augmented(exn) File "apache_beam/runners/common.py",
  line 415, in apache_beam.runners.common.DoFnRunner._reraise_augmented
  raise File "apache_beam/runners/common.py", line 388, in
  apache_beam.runners.common.DoFnRunner.process
  self.do_fn_invoker.invoke_process(windowed_value) File
  "apache_beam/runners/common.py", line 189, in
  apache_beam.runners.common.SimpleInvoker.invoke_process
  self.output_processor.process_outputs( File
  "apache_beam/runners/common.py", line 480, in
  apache_beam.runners.common._OutputProcessor.process_outputs
  self.main_receivers.receive(windowed_value) File
  "apache_beam/runners/worker/operations.py", line 86, in
  apache_beam.runners.worker.operations.ConsumerSet.receive
  cython.cast(Operation, consumer).process(windowed_value) File
  "apache_beam/runners/worker/operations.py", line 339, in
  apache_beam.runners.worker.operations.DoOperation.process with
  self.scoped_process_state: File
  "apache_beam/runners/worker/operations.py", line 340, in
  apache_beam.runners.worker.operations.DoOperation.process
  self.dofn_receiver.receive(o) File "apache_beam/runners/common.py",
  line 382, in apache_beam.runners.common.DoFnRunner.receive
  self.process(windowed_value) File "apache_beam/runners/common.py",
  line 390, in apache_beam.runners.common.DoFnRunner.process
  self._reraise_augmented(exn) File "apache_beam/runners/common.py",
  line 431, in apache_beam.runners.common.DoFnRunner._reraise_augmented
  raise new_exn, None, original_traceback File
  "apache_beam/runners/common.py", line 388, in
  apache_beam.runners.common.DoFnRunner.process
  self.do_fn_invoker.invoke_process(windowed_value) File
  "apache_beam/runners/common.py", line 189, in
  apache_beam.runners.common.SimpleInvoker.invoke_process
  self.output_processor.process_outputs( File
  "apache_beam/runners/common.py", line 480, in
  apache_beam.runners.common._OutputProcessor.process_outputs
  self.main_receivers.receive(windowed_value) File
  "apache_beam/runners/worker/operations.py", line 84, in
  apache_beam.runners.worker.operations.ConsumerSet.receive
  self.update_counters_start(windowed_value) File
  "apache_beam/runners/worker/operations.py", line 90, in
  apache_beam.runners.worker.operations.ConsumerSet.update_counters_start
  self.opcounter.update_from(windowed_value) File
  "apache_beam/runners/worker/opcounters.py", line 63, in
  apache_beam.runners.worker.opcounters.OperationCounters.update_from
  self.do_sample(windowed_value) File
  "apache_beam/runners/worker/opcounters.py", line 81, in
  apache_beam.runners.worker.opcounters.OperationCounters.do_sample
  self.coder_impl.get_estimated_size_and_observables(windowed_value))
  File "apache_beam/coders/coder_impl.py", line 730, in
  apache_beam.coders.coder_impl.WindowedValueCoderImpl.get_estimated_size_and_observables
  def get_estimated_size_and_observables(self, value, nested=False):
  File "apache_beam/coders/coder_impl.py", line 739, in
  apache_beam.coders.coder_impl.WindowedValueCoderImpl.get_estimated_size_and_observables
  self._value_coder.get_estimated_size_and_observables( File
  "apache_beam/coders/coder_impl.py", line 518, in
  apache_beam.coders.coder_impl.AbstractComponentCoderImpl.get_estimated_size_and_observables
  values[i], nested=nested or i + 1 < len(self._coder_impls)))
  RuntimeError: KeyError: 0 [while running 'Transform/Format']

Looking at the source code of where this error pops up from, I thought it could be cause due to the fact that some of the names contain some weird encoded characters, so in a desperate act I tried using the .encode("ascii", errors="ignore").decode() you see on the code, but no luck.
Any ideas as to why this pipeline executes successfully locally, but fails on DataFlow runner?
Thanks!

A: This isn't so much of a fix to my problem as it is avoiding the problem in the first place, but it did make my code run, thanks to the suggestion of user1093967 in the comments.
I just replaced the GroupByKey and the AggregateGroups by a CombinePerKey(sum) step and the problem didn't occur anymore.
p_collection
        | "PairWithOne" >> beam.Map(lambda pair: (', '.join(pair).encode("ascii", errors="ignore").decode(), 1))
        | "GroupAndSum" >> beam.CombinePerKey(sum)
        | "Format" >> beam.Map(lambda element: {'pair': element[0], 'pair_count': element[1]})

I'd be happy to hear why it works, though.

A: In some cases, like my own, you need the intermediate grouped values, so CombinePerKey isn't ideal. In this more general case, you can replace GroupByKey() with CombineValues(ToListCombineFn()).
I'm not confident as to why this works while GroupByKey doesn't. My guess is that consuming the _UnwindowedValues iterable returned by GroupByKey like a list fails in a parallel execution environment. I was doing something like:
... | beam.GroupByKey()
    | beam.Map(lambda k_v: (k_v[0], foo(list(k_v[1]))))
    | ...

where foo requires the full, indexable list and is not easily composable. I'm not sure why this sort of restriction would have caused issues for you, though; sum can operate on an iterable.
This solution isn't ideal in that (I believe) you lose some parallelization with the ToList conversion. That being said, at least it's an option if anybody else faces this same issue!

A: GroupByKey groups all elements with the same key and produces multiple PCollections. The next stage receives an Iterable collecting all elements with the same key. The important note is that this Iterable is evaluated lazily, at least when GroupByKey is executed on the Dataflow runner. This means that elements are loaded into memory on demand — when requested from the iterator.
CombinePerKey on the other hand, also groups all elements with the same key, but does an aggregation before emitting a single value.
pcollection_obj
        | "MapWithOne" >> beam.Map(lambda pair: (', '.join(pair).encode("ascii", errors="ignore").decode(), 1))
        | "GroupByKeyAndSum" >> beam.CombinePerKey(sum)
        | "CreateDictionary" >> beam.Map(lambda element: {'pair': element[0], 'pair_count': element[1]})

@Hannon César I hope this answers your question.
Cheers !!


text:
Q: Can I call .post value into a hidden input in this situation? Is that possible I call the .post data to a hidden input, and then get the hidden input value. The reason I am doing this because bp_core_get_user_domain() is not working in URL(search.php), I am using wordpress.

$('#tag').click(function(){
$.post("search.php", {
   search_id: $("#id_tag").text()
   },
   function(data)
   {
    $("#member_id").val(data);
   }
  );//$.post

  });
//this is not search.php

<?php
<input type="hidden" id="member_id" />
$member_id=(hidden input value);
$user_link=bp_core_get_user_domain( $member_id );
<input type="text" id="tag"/>
?>

A: Use WordPress Ajax and store the value with update_option('member_id'); and than do a query to check if what that value is.


text:
Q: Passing a stream to a method via .NET remoting Let me briefly describe the situation.
First, I have a WCF RestFul webservice with this method :
[WebInvoke(UriTemplate = "/Dynamic/{*sParameter}", Method = "POST", ResponseFormat = WebMessageFormat.Json)]
    public string ExecuteWebAPIRequest(string sParameter, Stream streamPost)
    {
        ...

        var oClientFormatSinkProvider = new BinaryClientFormatterSinkProvider();
        IDictionary aoProps = new Hashtable();
        aoProps["port"] = 4626;
        aoProps["timeout"] = "-1";
        aoProps["name"] = "clientChan";
        TcpClientChannel channel = new TcpClientChannel(aoProps, oClientFormatSinkProvider);
        ChannelServices.RegisterChannel(channel, false);

        //-- Call Bridge
        string result = GetBridgeObject().ExecuteWebAPIRequest(sIpAddress, streamPost, sParameter);

        //-- Return result
        return result ?? "";
    }

here is the content of the GetBridgeObject() method (that would be the remoting client):
private IBridge GetBridgeObject()
    {
        return (IBridge)Activator.GetObject(typeof(IBridge), "tcp://localhost:4626/RemoteBridge");
    }

Next, there is the bridge process containing this method (that would be the remoting server):
public void StartService()
    {
        //-- Initialize .NET remoting
        var oServerFormatSinkProvider = new BinaryServerFormatterSinkProvider();
        oServerFormatSinkProvider.TypeFilterLevel = TypeFilterLevel.Full;
        IDictionary aoProps = new Hashtable();
        aoProps["port"] = 4626;
        aoProps["timeout"] = "-1";
        aoProps["name"] = "serverChan";
        TcpServerChannel channel = new TcpServerChannel(aoProps, oServerFormatSinkProvider);
        ChannelServices.RegisterChannel(channel, false);
        RemotingConfiguration.RegisterWellKnownServiceType(typeof (Bridge), "RemoteBridge", WellKnownObjectMode.Singleton);
    }

And finaly, in the remote bridge object, this method :
public string WUPP_ExecuteWebAPIRequestI(string sPPInstanceName, Stream oInputStream, string sParameter)
    {
        ...

        int read = oInputStream.Read(buffer, 0, buffer.Length); //That's where the problem is
        ...
    }

As stated in the code snippet, the problem occurs when I try to read the stream, i get this error :

Exception: System.Runtime.Remoting.RemotingException: This remoting proxy has no channel sink which means either the server has no registered server channels that are listening, or this application has no suitable client channel to talk to the server.
     at System.Runtime.Remoting.Proxies.RemotingProxy.InternalInvoke(IMethodCallMessage reqMcmMsg, Boolean useDispatchMessage, Int32 callType)
     at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(IMessage reqMsg)
     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
     at System.IO.Stream.Read(Byte[] buffer, Int32 offset, Int32 count)

I know for sure I can pass streams via .NET remoting because in the bridge, there are other methods that return streams and that work well.
I guess the problem is somewhere in the remoting server or client when I register the channels but after two days of research and tests, i still haven't found an answer.
Thanks in advance for your help.

A: Since I had a similar problem and needed a solution as well, I finally found a solution: the client channel needs to be registered differently to make it work.
        // Creating a custom formatter for a TcpChannel sink chain.
        BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();
        BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
        provider.TypeFilterLevel = TypeFilterLevel.Full;

        Dictionary<string, object> dict = new Dictionary<string, object>();
        dict.Add("typeFilterLevel", "Full");
        dict.Add("port", "0");

        ChannelServices.RegisterChannel(new TcpChannel(dict, clientProvider, provider), false);

The interessting things here are

*

*the channel is bidirectional

*port 0 tells remoting framework to decide which port it should use.

*for up- and download of streams the typeFilterLevel Full needs to be
set.

Would be interested to know why my answer got a downvote as the solution works in production code.


text:
Q: Regular Expression with php Error i have the following html structure :
<div data-provincia="mi" data-nazione="it" ecc...

I'm trying to take "mi" with preg_match function.
This is my code :
$pattern = '/data-provincia=*"[a-zA-Z]*"/';
preg_match($pattern,$element,$provincia);

I think that the code is right but it doesn't match with anything.
Where i'm wrong?
Thanks.

A: You might want to use the quantifier + (1 or more) next to the character class between brackets, and remove the first star. Also added a subtpattern for you to get exactly the part you want. Give it a try :
$pattern = '/data-provincia="([a-zA-Z]+)"/';
preg_match($pattern,$element,$provincia);
echo $provincia[1];

A: $element = '
';
$pattern = '/
]*data-provincia=\"([^\"]+)\"[^>]*>/';
preg_match($pattern,$element,$provincia);
print_r($provincia[1]);

A: In addition to my comment, for this simple attribute you can use the following regex:
$regex = '/data-provincia="([^"]*)/i';
preg_match($regex,$element,$matches);
echo $matches[1];

Basically match everything except a double quote as many times as possible (or none). But please at least consider using a Parser for this task, regular expressions were not meant to deal with it.

A: Its working fine for me
$element = '

';
$pattern = '/data-provincia=*"[a-zA-Z]*"/';
$matches= array();
preg_match($pattern,$element, $matches);
if (!empty($matches)) {
    foreach ($matches as $eachOne) {
        //code to remove unwanted
        $text = trim(preg_replace('/^data-provincia\=/', '', $eachOne), '""');
        echo " $eachOne; $text";
    }

}


text:
Q: How do I disallow shared folder when user is not logged in windows 7? One of my customers has to sign very strict NDAs that force him to find a way to block file sharing and lock his office when he is not on the premises. He also has the companies quickbooks files located on this computer. He would like to have a way that would allow him to block sharing of the protected files when he is not there, but allow sharing of the quickbooks file at all times.
He does not want to move the quickbooks to another computer, of course if he is out to another location or even just out to lunch the secretaries can not do anything in quickbooks as the computer is shutdown. The way the NDA reads is that if he can block access to the files when he is not there then all is well. According to him his lawyer says that a "reasonable effort" for protecting the files must be made, so he wants the files protected and piece of mind but not Fort Knox of computing.
Is it possible to share a specified folder only when the local account to that folder location is logged in? Is it possible to turn on such a feature without effecting the quickbooks file which is located in the Public user directory?
Windows 7 Home Premium 64x for all computers that are supposed to be on the network (5), 1 is supposed to have shared access to the files when he is there, and 3 need access to quickbooks at all times.

A: I would recommend you set up the secured files in a folder locked down with appropriate NTFS permissions (I don't know what those might be, but hopefully you can sort that out).
You could then simply create a batch file that is set to run on login, and another on logout:
On login:
net share sharename="c:\path\to\share" /UNLIMITED
And on logout:
net share sharename /delete


text:
Q: When does a x100 2000V scope probe not work at 2000V? I refer to this X100 scope lead, and to this relevant question & answer for that product:

Q: According to the 4100 user's guide the voltage rating at 10 MHz is only 100 V. shouldn't it be 2000 V all the way to 100 MHz as implied in the spec?

A: Sorry but no, that is normal for such probes. Even high priced Keysight and other top makers probes have similar deratings.

I assumed that I could use this lead to safely measure noise on the UK 240 V mains. That only runs @ 50 Hz (<< 10 MHz). Yet the input resistance is 100 megaohms. Can anyone explain or correct this?

A: Maybe you are missing how a probe would look like when you draw it as a circuit:

simulate this circuit – Schematic created using CircuitLab
With this, it might be easier to understand why in case of high frequencies the voltage divider and input impedance is not what it is for DC.
The 6 pF capacity will turn into a very small impedance like Andy Aka explained - and result in a high current if you would measure a source at that frequency.
For noise measurement this is no concern - if your noise at 10 MHz would be in the order of 100 V, you could harvest a lot of energy out of it. It's usually only millivolts.

A:
shouldn't it be 2000v all the way to 100 MHz as implied in the spec?

Well, the Shamazon spec says this: -

*

*Input capacitance of 6 pF

*Maximum operating voltage: 2 KV (Vp-p)

*100:1 attenuation

So, at 100 MHz, 6 pF has an impedance of 265 Ω. So, if you applied a 100 MHz sinewave of amplitude 707 volts RMS, that's a current into your probe of 2.67 amps RMS and that ain't happening big time.

Yet input resistance is 100 megaohms Can anyone explain or correct
this?

Standard (basic scope probes) have an input resistance of normally 1 MΩ. Most x10 probes offer 10 MΩ input resistance so, it makes sense that a probe that attenuates x100 has something like 100 MΩ input resistance.

The probe circuit will look something like this: -

Image modified (to focus on the important elements) from here
So, at low frequencies, the input resistance is 99 MΩ + 1 MΩ. At high frequencies the input capacitance will be: -
$$\dfrac{1}{\dfrac{1}{8}+\dfrac{1}{22}}\text{ pF} = 5.9\text{ pF}$$


text:
Q: I am trying to install web3 module through npm Latest code snippet to show what version of Web2.min.js I am using
This is the warning i m getting in browser and i am able to intract with remix contractCommand Used :C:\Users\Hp\Desktop\BC_Project>npm install web3
providing the image showing error message

A: Have you got the things required for node-gyp environment?

*

*Python

*MSBuild Tools

*Visual C++ Build Tools core features

*Windows 8.1 SDK

*Windows 10 SDK (10.0.x.x)


text:
Q: How can I determine the effective Protection from a shield? Is the block % and block absorption of a shield included in the calculated Protection value for that shield?  If not, is there an easy way to determine which shield will provide better average damage mitigation between one with higher armor and one with better blocking?

A: I do not believe that the 'Protection' value on a shield when comparing to another item does not take into consideration 'Block Chance' or 'Block Value'. I say this because a shield in comparison to a magic source on my Wizard rarely leaves more than ~0.2 difference in protection, yet my shield (Lidless Wall) has a 20% block chance for 2-3k or so.
With this in mind, when comparing shields to shields, take the 'Protection' value at face value but then do your own comparison for 'Block Chance' and 'Block Value'.

A: What I would do is calculate the damage reduction % and the % chance to block (assuming that the blocked damage is somewhat equal)
Add the two together and whichever has the higher total percentage I would use. (again taking into account the damage blocked)

A: You may find an EHP calculator that will do the comparison for you.  For example, D3Up used to allow you to compare EHP for two items for a specific character.  It will also tell you how much an increased block chance will help you under EHP Gains by Stat.  Unfortunately, I don't know how he did his calculation.  You could try looking it up in his github repositories:  V1; V2.


text:
Q: Unable to create SAAJ meta-factoryProvider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found We are upgrading from java8 to java11 and we tried solutions provided in following links

*

*Unable to create SAAJ meta-factory: Provider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found

*Unable to create SAAJ meta-factory after packaging as JAR
but none of solution works. We even added system property also, but it was not useful.
Dependencies I have imported are
    <dependency>
        <groupId>jakarta.xml.bind</groupId>
        <artifactId>jakarta.xml.bind-api</artifactId>
        <version>4.0.0</version>
    </dependency>
    <dependency>
        <groupId>jakarta.annotation</groupId>
        <artifactId>jakarta.annotation-api</artifactId>
        <version>2.1.1</version>
    </dependency>
    <dependency>
        <groupId>jakarta.xml.ws</groupId>
        <artifactId>jakarta.xml.ws-api</artifactId>
        <version>4.0.0</version>
    </dependency>
    <dependency>
        <groupId>jakarta.activation</groupId>
        <artifactId>jakarta.activation-api</artifactId>
        <version>2.1.0</version>
    </dependency>
    <dependency>
        <groupId>jakarta.jws</groupId>
        <artifactId>jakarta.jws-api</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.messaging.saaj</groupId>
        <artifactId>saaj-impl</artifactId>
        <version>1.5.2</version>
    </dependency>
    <dependency>
        <groupId>javax.xml.soap</groupId>
        <artifactId>saaj-api</artifactId>
        <version>1.3.5</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-runtime</artifactId>
        <version>4.0.0</version>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>4.0.0</version>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-ri</artifactId>
        <version>4.0.0</version>
        <type>pom</type>
    </dependency>


text:
Q: C# - Avoid duplicating logic between WinForm and UserControl I found a question that I belive is what I was looking for, but there were certain things that I was not following in the answers.  Therefore, I'd like to ask the question in a different way (Thanks for your patience).  Here is the link I am referring to:
How to avoid duplicating logic on two similar WinForms?
OK.  I have a dialog that I created.  We've got controls for User Input, buttons to display other dialogs (to gain other input), etc.  Aesthetically, I prefer the dialog with the controls laid out vertically.  Anyhow, I was also thinking of creating a UserControl version of this dialog.  This UserControl would have all the same controls, and all the same logic, but the controls would be laid out entirely different (more horizontal, then vertical).
So, I can't just create another (3rd) UserControl that I drop on the orignal form, and on the UserControl I want to create.  (This 3rd UserControl would then contain all logic - thus, sharing between the two).  I can't do this because of the different layouts.
I have no problem creating the two (Form, UserControl), with the controls laid out differently, but I don't want to 'cut-and-paste' all the logic from one to the other.
This does not seem like a case for MVP, or MVC.  My model is the dialog itself.  The dialog is intialized with some values, yes, but once initialized the "Model" becomes further User Input (which I then grab when they press the OK button).
Take for example this code (an event for one of my buttons on this dialog):
    private void EditQuery_Click(object sender, EventArgs e)
    {
        try
        {
            EditQueryParameters();
        }
        catch (System.Exception ex)
        {
            // TODO: Write ErrMsg to Log file.
            MessageBox.Show("Edit Query Parameters Error:\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }

    private void EditQueryParameters()
    {
        if (m_ReportType.QueryScoreDetails && optPickDetail.Checked)
        {
            // This brings up a different type of dialog
            QueryDetails();
            return;
        }

        // DateRange, StartDate, and EndDate are all saved from the last time
        // I called this dialog
        DateType DtType = new DateType(m_ReportType.DBDateRangeField,
            m_DateRange, m_StartDate, m_EndDate);
        // StartTime, EndTime too!
        TimeType TmType = new TimeType(m_ReportType.DBTimeRangeField,
            m_StartTime, m_EndTime);

        List<AdvancedFilter> Filters = null;
        if (lstAdvancedQuery.Items.Count > 0)
        {
            Filters = new List<AdvancedFilter>();
        }
        for (int i = 0; i < lstAdvancedQuery.Items.Count; ++i)
        {
            Filters.Add((AdvancedFilter)lstAdvancedQuery.Items[i]);
        }

        // QueryType is also saved from the last time I called QueryBuilder
        QueryBuilder QryBuilder = new QueryBuilder(m_ReportType.DBCatalog, m_ReportType.DBTable,
            m_QueryType, ref DtType, ref TmType, ref Filters);

        // I am using Visual WebGUI, I have to do it this way
        QryBuilder.Closed += new EventHandler(QryBuilder_Closed);
        QryBuilder.ShowDialog();
    }

I mean, I suppose I could have some "logic" class, which exposes something like:
    public void EditQueryParameters(ref ReportType RptType, bool PickDetail,
         string DateRange, DateTime StartDate, DateTime EndDate,
         DateTime StartTime, DateTime EndTime, string QueryType)
    {
        if (ReportType.QueryScoreDetails && PickDetail)
        {
            // This brings up a different type of dialog
            QueryDetails();
            return;
        }

        DateType DtType = new DateType(ReportType.DBDateRangeField,
            DateRange, StartDate, EndDate);
        TimeType TmType = new TimeType(ReportType.DBTimeRangeField,
            StartTime, EndTime);

        // Yikes, more stuff to add to the signature of my method
        // Will have to pull this outside the method and pass in Filters
        List<AdvancedFilter> Filters = null;
        if (lstAdvancedQuery.Items.Count > 0)
        {
            Filters = new List<AdvancedFilter>();
        }
        for (int i = 0; i < lstAdvancedQuery.Items.Count; ++i)
        {
            Filters.Add((AdvancedFilter)lstAdvancedQuery.Items[i]);
        }

        // QueryType is also saved from the last time I called QueryBuilder
        QueryBuilder QryBuilder = new QueryBuilder(ReportType.DBCatalog, ReportType.DBTable,
            QueryType, ref DtType, ref TmType, ref Filters);

        // I am using Visual WebGUI, I have to do it this way
        QryBuilder.Closed += new EventHandler(QryBuilder_Closed);
        QryBuilder.ShowDialog();
    }

There's a lot of set-up to use this method.  I don't know, maybe I'm looking for something more .. "slick"?
On top of that, look at some (not all) of my init code (this is called from constructor or form_Load; it doesn't seem worth it to add this to the logic class, so that's all still "cut and paste" between the two):
    private void InitializeUserDefinedTitle()
    {
        txtUserTitle.Text = m_UserTitle;
    }

    private void InitializePrintSelectionCriteria()
    {
        // Print Selection Criteria
        chkSelectionCriteria.Checked = m_printSelectionCriteria;
    }

    private void InitializeTrendBy()
    {
        cmbTrend.Items.AddRange(Enum.GetNames(typeof(TrendBy)));
        cmbTrend.SelectedIndex = (int)m_TrendBy;
        cmbTrend.Visible = m_ReportType.TrendVisible;
        lblTrend.Visible = m_ReportType.TrendVisible;
    }

In summary, the original WinForm is a dialog that is intialized with data (constructor), is displayed to the user for input, when they OK the dialog that data is retrieved (and that data is stored outside the dialog, in member variables, for the next time they call the dialog - this is because we want to show what they last picked/entered).
That type of dialog I just described will also be a user control, and the logic should be shared between the two.
Thanks.

A: You can make two controls A and B, each containing the same buttons and/or other input controls arranged differently. Controls A and B will have identical properties, and events. The form (or third control) will contain the event handlers that allow the logic to be contained in only one place.
You can display either control A or B using the visible property or by adding one to the container.controls property, the container being the containing form or control.
And, for example, instead of having a handler for button1 in controls A and B that handles the complete logic of the button press, the handlers for button1 in control A and B would just raise an event that will be handled by the container of control A or B.

A: Instead of encapsulating the logic, I would encapsulate the layout.  Use a property of the user control to specify which layout yout want.  Then wherever it is (standalone form, one of three instances on the same form, whatever) you access it and specify the layout the same way.
As for how to encapsulate the layout, there are a bunch of possibilities.  You could just do it programatically, i.e. write each version of the layout code.  (The programamatic version would be cleaner if you used some kind of layout containers, like the Panels in WPF.)  You could draw the layout in a designer, and copy the generated code.  The different versions of the layout logic could be stuffed into private methods, or encapsulated into objects.


text:
Q: "the sun is hitting my face." vs "the sunshine is touching my face" Please advise me. If I want to say that the sunshine is coming to my face,
do I say

the sun is hitting my face.

or

the sunshine is touching my face.

?
I am trying to check online, but didn't find the exact way of posting this question on google!
Whats the best way to say that?

A:
The sunshine is on my face.
  The sunshine is hitting my face.

would be ways to express you have sunshine directly on your face


text:
Q: Approach to connect SAP BW to Azure? Having a big database in SAP BW and wanting to move it to Azure for storing and querying, what is the approach you would take?
Connect SAP BW to Azure Data Factory -> Data Lake / Azure SQL Warehouse / Azure SQL Database??
What are your suggestions? Any extra details / steps would help a lot. Thanks
My final goal is then to create dashboards in PowerBI retrieving data from Azure.

A: It's very subjective and hard to answer.
First you must check if you have any licence issues. You can extract data from BW (Netweaver) if you have OpenHub licence. You can use HANA connection if your HANA is Enterprise.
Secondlly, about the data lake. Dou you need it? Do you have non or semi structured data, do you have data from other sources like IoT? A datalake must be carefully planned or you will end with a bigger problem in your hands.
Yes, let's do it: here are a lot of articles talking about structuring your data Lake like this one (https://medium.com/@Nicholas_Hurt/building-your-data-lake-on-adls-gen2-3f196fc6b430). You can ingest your data to a "raw" stage using data Factory, treat it to a cleansed/curated area using DataBricks or Data Factory, depending on the volume, concorrency you could need Azure Synapse/SSAS, finally you can access your data using PowerBI.
No, I only have small data: You can acess your data directly from PowerBI to BW using a PowerBI Gateway, it's the simplest way to consume BW data using PowerBI. You can Integrate it to an ADLS Gen2, isert your data on a SQLDb and finally Access using PowerBI.


text:
Q: Live USB boots to black screen after grub menu I created a Ubuntu USB using rufus so that i can install Ubuntu on my Acer One 10 laptop/tablet convertible. The first time I booted using the USB i tried Ubuntu without installing to make sure it worked correctly, and it did, except for the keyboard. Then i shut it down, and booted it back up to actually install Ubuntu; the keyboard still didn't work, so i got up to plug in a separate keyboard, and I dropped it and the USB came out in the middle of the installation process. Now I can't get past the grub menu. I have tried it with 2 other USB's, and my sister's computer (same model), re-downloaded the ISO and re-imaged all three USB's several times, trying to troubleshoot the issue. The screen still just goes black after selecting an option from the grub menu.

A: As you were not able to complete the installation process. Try reinstalling it by USB, grub won't work as the OS is currently not installed.

A: The grub menu has three options "try ubuntu without installing", "install ubuntu", and "check disk for errors", and all three of them only boot to a black screen.
Without the USB, it just boots to this EFI shell:


text:
Q: Proof of Sylvester's Law of Inertia I'm getting confused about the proof in my notes of Sylvester's Law of Inertia, and positive definiteness in general. I'll try to state my problems explicitly:

The theorem states that if $ \psi : V\times V \to \mathbb{R} $ is a real symmetric bilinear form, represented by
 $$
\left(
  \begin{array}{c c c}
    I_p  \\
     & -I_q &  \\
     & & 0
  \end{array}
\right) \;\;\text{and}\;\;
\left(
  \begin{array}{c c c}
    I_p'  \\
     & -I_q' &  \\
     & & 0
  \end{array}
\right) $$
then $ p = p' $ and $ q = q' $.

*

*The proof I have shows that $ p $ is the largest possible dimension of a positive definite subspace, and so $ p = p' $. Why is this implication true?

*It then goes on to say that "similarly, $ q = q'$". What exactly does this mean?

*Wouldn't it suffice, after having shown uniqueness of $ p$, to say that the rank($ = p + q $) of a matrix is well-defined, and so it follows $ q $ is well-defined?

*What does it actually mean for a real symmetric bilinear form to be positive definite? The definition of positive-definitness in my notes is in terms of subspaces. Does it mean that the entire space is positive definite (w.r.t that particular form)? If so, how does this relate to matrices representing the form? How do we get from this definition to the one I'm finding online, which states that $A$ is positive definite iff $ x^T A x > 0 $ for all x in the space?
Thanks. I know that I'm asking a lot, and will greatly appreciate any help.

A: *

*If you can show that $p$ is the dimension of the largest subspace on which the form is positive definite, then the same argument shows that $p'$ is also the dimensions of the largest subspace on which the form is positive definite.  Thus $p = p'$.  Think of it this way, a priori $p$ seems to depend on the choice of basis, but then you show that you can also define $p$ in a basis invariant way.

*& 3.  Yes, 3. definitely implies 2.

*A form $\psi$ is positive definite if $\psi(v,v) > 0$ for all $v \ne 0$.  A consequence Grahm-Schmidt and Sylvester's law of interia is that a matrix $A$ represents a positive definite form if and only if $A = P Id P^t = P P^t$ for some invertible matrix $P$.


text:
Q: Problems checking user-grabbed values in while loops (only else block works) I have a problem validating the error messages of the two while, when I fill in the right values the loop ends, when I enter incorrect values or leave blank nothing happens. Only what works is the else in each loop.
         while (true){
            try {
                System.out.print("Enter the year of manufacture of the motorcycle: ");
                m1.setYear(keyboard.nextInt());
                if (m1.getYear() <= 0){
                    System.out.println("Year field cannot be less than or equal to zero, redo the operation.");
                } else {
                    break;
                }
            } catch (Exception e) {
                System.out.println("Field must contain only integers, redo the operation.");
            }
        }
        while (true){
            try {
                System.out.print("Enter the value of the motorcycle: ");
                m1.setValue(keyboard.nextDouble());
                if (m1.getValue() <= 0){
                    System.out.println("Value field cannot be less than or equal to zero, redo the operation.");
                } else {
                    break;
                }
            } catch (Exception e) {
                System.out.println("Field must contain only decimal numbers, redo the operation.");
            }
        }

A: Try using nextLine instead of nextInt/nextDouble:
    while (true){
        try {
            System.out.print("Enter the year of manufacture of the motorcycle: ");
            m1.setYear(Integer.parseInt(keyboard.nextLine()));
            if (m1.getYear() <= 0){
                System.out.println("Year field cannot be less than or equal to zero, redo the operation.");
            } else {
                break;
            }
        } catch (Exception e) {
            System.out.println("Field must contain only integers, redo the operation.");
        }
    }
    while (true){
        try {
            System.out.print("Enter the value of the motorcycle: ");
            m1.setValue(Double.parseDouble(keyboard.nextLine()));
            if (m1.getValue() <= 0){
                System.out.println("Value field cannot be less than or equal to zero, redo the operation.");
            } else {
                break;
            }
        } catch (Exception e) {
            System.out.println("Field must contain only decimal numbers, redo the operation.");
        }
    }


text:
Q: Specific profiles for workspace members Is it possible to specify specific profiles for members of a workspace?
If I write a profile into the member Cargo.toml I get:

warning: profiles for the non root package will be ignored, specify profiles at the workspace root:

I also tried to put a specific profile into workspace root's Cargo.toml:
[profile.release]
opt-level = 3

[profile.release.hal]
# optimizer kills assembly code
opt-level = 1

However, it seems to be ignored too, as the applied options in the the verbose output show:

Running `rustc --crate-name hal src/hal/lib.rs --crate-type lib -C opt-level=3 --emit=dep-info,link [...]

Is there any other way beside avoiding workspaces at all?

A: This is now supported and stabilized since Rust 1.43:
[profile.release]
opt-level = 3

[profile.release.package.hal]
# optimizer kills assembly code
opt-level = 1

See: https://doc.rust-lang.org/cargo/reference/profiles.html#overrides