text:
Q: Product Question Extension with Instant Search Results while I wrote the title of my question, I saw that Magento Stackexchange already works exactly like the Module I require... But let's start from the beginning:
We are currently (a bit late, I know) in the process of upgrading from M1 to M2.
On our current website we're using a Product Questions module from Aheadworks (https://aheadworks.com/product-questions-extension-for-magento-1) and have gathered over 3200 questions in 6 years. So of course we want to import them to M2 as well to a new extension that has yet to be defined.
The problem is, that of course by now we also get a lot of questions that have been anwered already, because the customers don't want to search through the existing questions if - maybe - there is already an answer. So they type a new question.
Now I'm looking for an extension that starts searching through the existing questions and suggests answers based on what the customer starts to ask. So basically the same thats happening here: as soon as I start typing the title, below opens a "similar questions" field.
A good example is also Amazon. As soon as I start typing a question, it suggests results, even categorized in "All / Product Info / Customer Q&A / Customer Reviews". Only when I don't find the solution I can ask a new question with a button further below.
EDIT: See this video that explains what I mean
https://nimb.ws/UCEhkO
My question is: does anyone now an extension for Magento 2 that is capable of something like that? So far I only found extensions that offer such or similar capabilities for a general knowledge base. I need it on product level though because we have many product specific questions.
I would als pay for such a custom development, if the price is somehow reasonable (maybe up to € 3000 max).
Thanks for your help!
Best regards,
Tobias


text:
Q: Taiga front end submits custom attribute changes even if invalid I'm currently working on a custom implementation of taiga and i noticed that, even if we placed a pattern for our custom input field in app/partials/custom-attributes/custom-attribute-value-edit.jade to ping an error if the input doesn't follow the specified pattern like so
input#custom-field-value(name="value", type="tel", pattern="^\\+\\d{1,3}\\s\\d{1,3}\\s\\d{3}\\s\\d{4}$", placeholder="format: +[country_code] [area_code] [xxx] [xxxx] (e.g: +1 234 567 8910)", value!="<%- value %>")

the form is still submitted to the back-end. although i do see a quick message saying that the pattern doesn't match, the form is still submitted. the farthest i got to tracing the process was to this file
app/coffee/modules/common/custom-field-values.coffee
there's a part there for processing the submit
    submit = debounce 2000, (event) =>
        event.preventDefault()

        form = $el.find("form").checksley()
        return if not form.validate()

        input = $el.find("input[name=value], textarea[name='value'], select[name='value']")
        attributeValue.value = input.val()
        if input.prop("type") == 'checkbox'
            if input[0].checkValidity()
                attributeValue.value = !!input.prop("checked")

but that's as far as i got. my goal is to not allow the submit to occur if there are input validation issues like the input not following the specified pattern. I'm using the current version of taiga which is 3.0.0

A: I figured it out eventually. Taiga uses checksley for form validation. instead of using "pattern" for my regular expression like a normal input field validator, i used checksley's attribute data-regexp. This handled the validation that i needed.
input#custom-field-value(name="value", type="tel", data-regexp="^\\+\\d{1,3}\\s\\d{1,3}\\s\\d{3}\\s\\d{4}$", placeholder="format: +[country_code] [area_code] [xxx] [xxxx] (e.g: +1 234 567 8910)", value!="<%- value %>")

the documentation can be found in the following link
https://media.readthedocs.org/pdf/checksley/latest/checksley.pdf

redpajama_set_name: RedPajamaStackExchange


text:
Q: np.allclose throws throws an TypeError: Not implemented for this type when dataframe has strings in a row I am trying to compare the values within a data frame for equality within a given tolerance. np.allclose is the perfect candidate but when my data frames have string values it throws an TypeError: Not implemented for this type. I have no way of knowing if their will be string inside an row or not.
Example
old = pd.DataFrame({'a': [1, np.nan, 3],
                    'b': [4,"OK", 6]},
                    index=['x', 'y', 'z'])

new = pd.DataFrame({'a': [1, np.nan, 3],
                    'b': [4, "OK", 6]},
                    index=['x', 'y', 'z'])

A: The columns 'b' in the example contains mixed types; strings and ints.
You can't compare strings with allclose as strings are either different or not.
You should, if possible, have your data organised so that columns are of a single type. If you had, you could use np.allclose to compare the numeric columns and the standard == operator to compare the columns containing strings.
In the example, columns 'a' are numeric so np.allclose works:
In [25]: np.allclose(old.a, new.a)
Out[25]: False

However, it returned False because equating null values always returns False, which is another subtlety you need to be be aware of when comparing DataFrames. In this case you could do
In [25]: np.allclose(old.fillna(value=0).a, new.fillna(value=0).a)
Out[25]: True

In the small example you give, the transpose of the DataFrame has columns of a single type so maybe you should be working with that. Note, however, that simply taking the transpose won't change the data types.
In [18]: old.T.dtypes

Out[18]:
x    object
y    object
z    object

but using the convert_objects method will
In [20]: old.T.convert_objects().dtypes
Out[20]:
x    float64
y     object
z    float64
dtype: object

In general, you can check the dtypes of each columns by calling DataFrame.dtypes. You can pick out string (object) columns with something like
obj_cols = df.columns[df.dtypes == object]
num_cols = df.columns[df.dtypes != object]   #this would also include any time columns

Then do
np.allclose(df1[num_cols].fillna(0), df2[num_cols].fillna(0))

and
(df1[obj_cols].fillna('') == df2[obj_cols].fillna('')).all().all()

EDIT:
In a more general setting you might want to be a bit more careful when handling nans. You could do the above, but also make sure that the null entries match exactly, since replacing nans with 0 might give an unwanted equality (you might have a 0 in one DataFrame and nan in another and you would still get equality, likewise for strings). You can do this as follow:
(old.isnull() == new.isnull()).all().all()


text:
Q: COMMUNICATION_FAILURE during a Webdynpro BAPI call? I  have created a simple WebDynpro application that calls a BAPI. However, i am getting an error as RFC is not setup.
How do i setup the RFC call?
Error:
The URL call http://crmehp.sat.com:8024/sap/bc/webdynpro/sap/zwd_bapi_call was terminated because of an error.
The following error text was processed in system EH5 : RFC Exception COMMUNICATION_FAILURE with Message RFC destination BAPI Call does not exist. Occurred
◾ The error occurred on the application server CRMEHP2_EH5_24 and in the work process 0 .
◾ The termination type was: RABAX_STATE
◾ The ABAP call stack was:
Method: EXECUTE_BAPI_FLIGHT_GETLIST of program /1BCWDY/0AA4D2ZOSMWRNSH8KCQZ==CP
Method: IF_COMPONENTCONTROLLER~EXECUTE_BAPI_FLIGHT_GETLIST of program /1BCWDY/0AA4D2ZOSMWRNSH8KCQZ==CP
Method: WDDOINIT of program /1BCWDY/0AA4D2ZOSMWRNSH8KCQZ==CP
Method: IF_WDR_VIEW_DELEGATE~WD_DO_INIT of program /1BCWDY/0AA4D2ZOSMWRNSH8KCQZ==CP
Method: DO_INIT of program CL_WDR_DELEGATING_VIEW========CP
Method: INIT_CONTROLLER of program CL_WDR_CONTROLLER=============CP
Method: INIT_CONTROLLER of program CL_WDR_VIEW===================CP
Method: INIT of program CL_WDR_CONTROLLER=============CP
Method: GET_VIEW of program CL_WDR_VIEW_MANAGER===========CP
Method: BIND_ROOT of program CL_WDR_VIEW_MANAGER===========CP

Calling procedure bapi_flight_getlist in WDDOINIT method of webdynpro:
method WDDOINIT .
  DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
  lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).

    lo_componentcontroller->execute_bapi_flight_getlist(
     airline =    'AA'                       " bapisflkey-airlineid
*     destination_from =                  " bapisfldst
*     destination_to =                    " bapisfldst
*     max_rows =                          " bapisflaux-bapimaxrow
    ).

endmethod.

execute_bapi_flight_getlist defination:
  CALL FUNCTION 'BAPI_FLIGHT_GETLIST'
    DESTINATION  'BAPI Call'
    EXPORTING
       airline =                         airline
       destination_from =                destination_from
       destination_to =                  destination_to
       max_rows =                        max_rows
    TABLES
       date_range =                      lt_c_date_range
       extension_in =                    lt_c_extension_in
       flight_list =                     lt_c_flight_list
       extension_out =                   lt_c_extension_out
       return =                          lt_c_return
    EXCEPTIONS
      system_failure =                    1   MESSAGE    lv_rfc_error
      communication_failure =             2   MESSAGE    lv_rfc_error.

I checked sm59 and a BAPI Call RFC dosen't exist. However, there are other RFC connections that work.

A: Assuming you don't want to call a remote system:
Change
DESTINATION  'BAPI Call'

To
DESTINATION  'NONE'

If it is a remote system, create a destination in SM59 (but without the space) and reference that instead.


text:
Q: Command to print the output in a row format I am trying to print the below output in a row format to a csv file. Can someone help me using awk or bash ?
Server abc.com
osbits x64
ostype windows

I want to print the output like this and forward to a csv format
abc.com x64 windows

A: With awk you want to set the Output Field Separator (OFS) to Comma, and then print the 2nd, 4th, and 6th fields to match your example.
For multi-line input you can use sed to join the lines prior to awk
me@myvm:~ $ cat servers.txt
Server abc.com
osbits x64
ostype windows
me@myvm:~ $ cat servers.txt | sed -e 'N;N;s/\n/ /g'
Server abc.com osbits x64 ostype windows
me@myvm:~ $ cat servers.txt | sed -e 'N;N;s/\n/ /g' | awk '{ OFS=","; print $2,$4,$6}'
abc.com,x64,windows

A: This works but I'm sure there's a more idiomatic way to do it:
awk '{printf "%s%s", ((NR==1)?"":", "),$2}'

A: For the input
Server abc.com foo.com bar.com buz.org
osbits x64 x86 sparc ppc
ostype windows linux solaris mac

the awk script
{
    for (i=1;i<=NF;++i)
        a[i][NR] = $i;
}
END {
    for (i=2;i<=length(a); ++i) {
        str = a[i][1]
        for (j=2; j<=length(a[i]); ++j)
            str = str "," a[i][j]
        print str
    }
}

produces
abc.com,x64,windows
foo.com,x86,linux
bar.com,sparc,solaris
buz.org,ppc,mac

A: Assuming your input file, file.txt, looks like this:
Server abc.com
osbits x64
ostype windows

All of the following solutions will produce this output:
Server,abc.comosbits,x64ostype,windows

*

*awk
awk '{printf "%s,%s",$1,$2}END{print ""}' file.txt

*Perl
perl -000ane 'print join ",",@F,"\n"' file.txt

*shell
  while read a b ; do printf "%s,%s" "$a" "$b"; done < file.txt; echo


text:
Q: Legacy FBJS causing errors I'm having trouble with some old legacy FBJS. To validate the value of a field I was using
document.getElementById('email2').getValue()

This is now giving me the error
Error: a197943730232760_document.getElementById("email2") is null

I'm getting this for any other fields, getChecked() is also failing. I can't seem to find any other problems and this has only stopped working.
Any help would be appreciated.

A: I'm not sure this looks like a FBJS problem. Check you do actually have an element with the ID 'email2', from the sounds of that error message, your page doesn't have an 'email2' at all, which is why it can't get the value.


text:
Q: Complex parametrization of a line Suppose that i have a line which passes through the point $A(a+ib)$ and its director vector is $\vec{W}(v+iw)$ then do i have as a complex parametrization of the line the following $$(a+ib)+ t(v+iw)$$ where $t$ is the variable parameter and all the rest $a$ $b$ $v$ and $w$ are constants.

A: Yes, $$ L(t)= P+tV = (a+ib)+ t(v+iw)$$ is a parametrization of a straight line passing through $P=(a+bi)$ at $t=0$ with the direction vector  of $V=(v+iw)$

A: Although you have complex numbers, the way you use vectors is still the same as in the x,y plane. So yes, this should be correct.


text:
Q: How do I enter proxy information in odbc.ini file in Linux? I'm configuring a DSN for connecting to Amazon Redshift from my Linux machine. Since the machine is behind firewall, I need to use proxy for connecting to my redshift cluster.
In Windows, while creating DSN I was able to enter http proxy information in the dialog box (as in the pic below), so the connection was successful.
Dialog box in Windows asking for Proxy Info
But in Linux, I'm not sure how to enter the proxy information in odbc.ini. I'm not able to connect because the driver manager is not picking the proxy info.
I'm using Amazon ODBC driver for redshift and even their documentation here - http://docs.aws.amazon.com/redshift/latest/mgmt/odbc-driver-configure-linux-mac.html does not show proxy configuration. I tried setting attributes like ProxyHost and ProxyPort but it doesn't help. Can someone please guide me here? Thanks!


text:
Q: How to Create Custom Connector in PowerApps for hmacsha256 API I am trying to create custom connector in powerapps. I have apiid and apikey and prescript for hmac hash key. Its working fine in postman. Same I want to call from powerapps.
Any one please help me on this


text:
Q: How do I set default brightness after boot? Linux Mint 12 (64bit), on an Acer Aspire 7730g. Upon every boot, the screen brightness is set very very low. Easily fixed via the function keys, but still a very annoying thing to do after every boot. Is there a way to set the brightness permanently?
NB: Interestingly, I had the same problem when Ubuntu was installed on the same laptop, so I'm a bit perplexed about how did this setting survive a complete OS reinstall?
dmesg output available here.
Another update: I don't know if this is related, but every time I reboot, my wireless is off, bluetooth is on, and Num Lock is off; all three the exact opposite of what I want them to be. If this is not related, it may become another question.

A: my x120e's brightness constantly changing bothers me as well.  surprisingly (but not), when i ran
gksudo dmesg > boot.messages

and opened boot.messages in a text editor, i noticed this message:

[Firmware Bug]: ACPI: No _BQC method, cannot determine initial brightness

multiple times, as well as some interesting others.  paste that into Google and you'll find Cannibal's Candy [wordpress] - who provides an in-depth look at ACPI and a method for universally setting the screen brightness (+ so much more):
DSDT editing: Put an end to your ACPI woes
yep, prepare your mind to be blown.  i'm working through CC's post right now, but thought i would share.  best of luck!

running Linux Mint Debian (amd64) on a Thinkpad x120e

A: Your laptop should have /sys/class/backlight. For example, /sys/class/backlight/acpi_video0/brightness. You can write (echo) values to this file to adjust brightness.
cat /sys/class/backlight/acpi_video0/max_brightness > /sys/class/backlight/acpi_video0/brightness

This will set the brightness to max. Just put it in an init script on boot.


text:
Q: How to convert .crt cetificate file to .pfx I want to install the '.crt' certificate I received from a certificate provider to my IIS 7.5 server.
I have tried many times to install the .crt file by clicking on the 'certificates', and it states that it is installed correctly. So I open IIS, select "my server", open "server certificate" which is available on the menu on the right side, click "complete certificate request", select the .crt certificate on my computer and click ok. However, when I refresh IIS the certificate disappears automatically.
Our hosting provider mentions that I need to use a '.pfx' file which I do not have.

A: I have solved this issue by converting this .crt file into a .pfx file using following method.
To convert .crt to .pfx, we need CSA certificate (Private Key) provided by hosting provider. Below are the steps to convert this:

*

*Download and install OpenSSL software from below link based on your system type
https://slproweb.com/products/Win32OpenSSL.html

*Run the following command on command prompt:
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt
OR
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.txt -in certificate.crt -certfile CACert.crt
Here:
Certificate.crt = Your-domain-Name.crt
CACert.crt = NetworkSolutions_CA.crt
certificate.pfx is the new name of generated file.
PrivateKey can be in .key or .txt format
After completing this process now we have certificate.pfx file so go to IIS Server certificates in IIS Manager.
There is an import link button on right side, click on this and select the converted certificate and enter password which is enter at the time of creation of the .pfx file and complete the process.
Now select your site on IIS and right click on this, select "Edit Binding" and on the new popup window select type as https:// and "Hosting name" is your domain name and all other field is as it is, click on ok to complete this process.
Now restart IIS and your certificate is working fine with your site.

A: Small update to the super-useful answer above:
The OpenSSL versions have been updated, so the links no longer work.  Here's the full download page from which to download any version:
https://slproweb.com/products/Win32OpenSSL.html
I used Win64OpenSSL_Light-1_1_0j.exe for my Windows 10 IIS installation. Worked perfectly.
Installed into default location C:\OpenSSL-Win64\
For sslforfree.com's cert files, here's the command line for your convenience run from the folder containing the three files they provided by sslforfree.com:
C:\OpenSSL-Win64\bin\openssl.exe pkcs12 -export -out certificate.pfx -inkey private.key -in certificate.crt -certfile ca_bundle.crt


text:
Q: How do you reduce the size of GHC's type error messages? For example,
test/Spec.hs:42:18: error:
    • No instance for (genvalidity-0.8.0.0:Data.GenValidity.GenUnchecked
                         (Decl UnkindedType Identifier Location))
        arising from a use of 'forAllUnchecked'
    • In the second argument of 'it', namely
        '(forAllUnchecked
            (\ decls
               -> shouldBe
                    (either
                       (const ())
                       (const ())
        ... 50 (literally) more lines ...

is way too long that I have to scroll up my terminal/message viewer to see what happened. I only need the line number and column.
Is there a GHC flag to make it output just this?
test/Spec.hs:42:18: error:
    • No instance for (genvalidity-0.8.0.0:Data.GenValidity.GenUnchecked
                         (Decl UnkindedType Identifier Location))
        arising from a use of 'forAllUnchecked'

This gives me everything I need.

A: The best I have come up with so far is:
-dppr-user-length=0 -dppr-cols=10000

which produces
test/Spec.hs:42:18: error:
    • No instance for (genvalidity-0.8.0.0:Data.GenValidity.GenUnchecked (Decl UnkindedType Identifier Location)) arising from a use of 'forAllUnchecked'
    • In the second argument of 'it', namely '(forAllUnchecked (\ decls -> ...))'
      In a stmt of a 'do' block: it "Compiler terminates" (forAllUnchecked (\ decls -> ...))
      In the second argument of 'describe', namely '(do ...)'
   |
42 |                 (forAllUnchecked
   |                  ^^^^^^^^^^^^^^^...

It's still taking up space, but far fewer lines than before. I will accept better answers.


text:
Q: Does there exist a way by which i can use WMI classes in java Hi i want to use WMI classes to find out the application and products information. But the problem is that i want to use java or any scripting language like python, javascript or perl. I have heard about JWMI, it may be an option. Can anyone help me regarding this???

A: JavaScript and Java aren't the same thing.
JavaScript
JavaScript is available under Windows Scripting Host (WSH). With it, it is fairly easy to access WMI:
var loc = new ActiveXObject("WbemScripting.SWbemLocator");
var svc = loc.ConnectServer(".", "root\\cimv2");
coll = svc.ExecQuery("select * from Win32_Process");
var items = new Enumerator(coll);

while ( !items.atEnd() )
{
    WScript.Echo(items.item().Name);
    items.moveNext();
}

jWMI (Java)
jWMI is a small library to enable Java to make general WMI queries. It seems to be available here
http://henryranch.net/software/jwmi-query-windows-wmi-from-java/
It also seems easy to use (though I am not sure how powerful or complete it is):
String name = getWMIValue("Select Name from Win32_ComputerSystem", "Name");

WBEM (Java)
WMI is a Microsoft implementation of Web Based Enterprise Management (WBEM). There is also a Java implementation of general WBEM which will be at some level compatible with WMI.
This might be the most complete true Java implementation you're going to find. If your needs are above tiny scripting (such as implementing a WBEM/WMI provider), then you might want to look into this option.

A: For the scripting language: Download Scriptomatic 2.0 and let the wizard create WMI code for VBScript, JScript, Perl, and Python. Here is something similar for Powershell.

A: I have successfully used WMI through JACOB

A: JInterop is a good option for WMI operations in java.

A: You might want to check J-Interop too. Here's a nice example:  http://www.vijaykandy.com/2009/09/windows-management-instrumentation-wmi-from-java/

A: JWMI performing WMI operations by creating and executing vb scripts with the relevant queries.
I am using J-Interop which is an open source and a good option.
There are also JACOB, J-Integra and EZ Jcom.

A: In order to perform WMI queries I recommend you my library WMI4Java.
It is very easy to use:
Map<String, String> wmiObjectProperties =
    WMI4Java.get().getWMIObject("Win32_BIOS");


text:
Q: How to display Form component in React app from react-jsonschema-form library? 'JSONSchemaForm' is not defined no-undef I'm learning React. I'm trying to add a react FORM component from https://github.com/rjsf-team/react-jsonschema-form?fbclid=IwAR0HdGosg659-F0hdFp-milh29G_6UX5_qbti6lZBmo7OYKIxgThD5f1Ff8 to my dummy application. I used react json schema form documentation https://react-jsonschema-form.readthedocs.io/en/latest/#installation .
I have red Using React component from js source maps  and react-jsonschema-form How to use it via cdn? which might be addressing similar problem. However, I am still struggling a lot.
I did:

*

*npx create-react-app my-app

*cd my-app, npm install
My react version is
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"

*npm install @rjsf/core --save
My dummy App.js component:
import React from 'react';
import Form from "@rjsf/core";

function App() {

  const Form = JSONSchemaForm.default;
const schema = {
  type: "string"
};

  return (
    <div className="App">
      <Form schema={schema} />

    </div>
  );
}

export default App;

I hit npm start and get error:
./src/App.js
  Line 6:16:  'JSONSchemaForm' is not defined  no-undef

From what I understand, webpack can't find JSONSchemaForm module (?)
I tried adding cdn file from the documentation to index.html.
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />

    <script src="https://unpkg.com/@rjsf/core/dist/react-jsonschema-form.js"></script>

    <meta name="viewport" content="width=device-width, initial-scale=1" />

It didn't help. Documentation says I should add a source map. However, I am not familiar with source maps. I red definition on mozilla MDN, but I don't know how to implement it.  I am also not familiar with manually setting webpack configurations, nor require.js mentioned in this solution react-jsonschema-form How to use it via cdn?  .
Question is - how likely is it that adding source map would solve the problem? Do in need to learn webpack?  Do you see other reasons why I can't display Form component?
If adding source map would likely solve the problem, what webpack properties are essential to know in this case?

A: I'm a bit new to React as well, but here are my two cents on this -- when you already have imported Form using  import Form from "@rjsf/core";, I don't think you need const Form = JSONSchemaForm.default; again. Just remove the const Form = JSONSchemaForm.default; line and try again.


text:
Q: Game identification Playstation alien FPS game in urban setting I'm trying to find a game I used to play with a friend around ~2008 on a PS2 or PS3.
At first I was almost certain it was in the XCOM universe, but I couldn't find matching screenshots. Here are the details I remember:

*

*There are multiple (3 or 4 ?) character classes available. We used to play a minigun-wielding one and a laser gun one; I think the latter was supposed to be the medic.

*Missions take place in a modern near-future urban settings: one on a construction site, one in some sort of museum, one in a zoo/park, and one staring in a street where you end up in the subway, I think.

*

*Missions involved securing or recovering some stuff while fighting off the aliens in our way.

*At the beginning of the construction site and the zoo/park missions, we could hear a radio playing a jazzy tune.

*Enemies are mainly some good ol' Grey aliens with different weapons.

*

*A major part of them had more of a reptile-like skull and had some light-emitter antenna backpack or something

*An especially annoying ennemy group had projectile slowly passing through walls in the museum mission.

*There was some sort of "Grey Matter" reward currency you could use to level up your class or unlock new gear.

A: I finally found it ! The game is Resistance 2 on PS3 !
Here is a video of a coop mission on the Chicago map:

*

*They start in the street and goes on to the construction yard and into the subway. Also the jazzy tune I was talking about can be heard at 7:34

*We can see the 3 character class : Sharpshooter recording the gameplay, a bunch of laser medic and minigun wielding ones with their force field barriers.

*The Grey aliens ennemies can be seen at the beginning of the video while those I called reptile-like appear later (9:48 for example)

*At the end of the video (13:42), we can see the squad wins "Gray tech"


text:
Q: Is default quota of GAE not big enough to run phoenix project? I'm new to GCP and GAE. I'm trying to deploy elixir container of phoenix on GAE.
The requested amounnt of instances has exceeded GCE's default quota. Please see https://cloud.google.com/compute/quotas/ for more information on GCE resources

That error occurs when I deploy the container.
So I have checked the quotas of project with gcloud command, but there is no quotas which is exceeded.
quotas:
- limit: 1000.0
  metric: SNAPSHOTS
  usage: 0.0
- limit: 5.0
  metric: NETWORKS
  usage: 1.0
- limit: 100.0
  metric: FIREWALLS
  usage: 6.0
- limit: 100.0
  metric: IMAGES
  usage: 0.0
- limit: 8.0
  metric: STATIC_ADDRESSES
  usage: 0.0
- limit: 200.0
  metric: ROUTES
  usage: 1.0
- limit: 15.0
  metric: FORWARDING_RULES
  usage: 0.0
- limit: 50.0
  metric: TARGET_POOLS
  usage: 0.0
- limit: 50.0
  metric: HEALTH_CHECKS
  usage: 2.0
- limit: 4.0
  metric: IN_USE_ADDRESSES
  usage: 0.0
- limit: 50.0
  metric: TARGET_INSTANCES
  usage: 0.0
- limit: 10.0
  metric: TARGET_HTTP_PROXIES
  usage: 0.0
- limit: 10.0
  metric: URL_MAPS
  usage: 0.0
- limit: 5.0
  metric: BACKEND_SERVICES
  usage: 1.0
- limit: 100.0
  metric: INSTANCE_TEMPLATES
  usage: 1.0
- limit: 5.0
  metric: TARGET_VPN_GATEWAYS
  usage: 0.0
- limit: 10.0
  metric: VPN_TUNNELS
  usage: 0.0
- limit: 3.0
  metric: BACKEND_BUCKETS
  usage: 0.0
- limit: 10.0
  metric: ROUTERS
  usage: 0.0
- limit: 10.0
  metric: TARGET_SSL_PROXIES
  usage: 0.0
- limit: 10.0
  metric: TARGET_HTTPS_PROXIES
  usage: 0.0
- limit: 10.0
  metric: SSL_CERTIFICATES
  usage: 0.0
- limit: 100.0
  metric: SUBNETWORKS
  usage: 24.0
- limit: 10.0
  metric: TARGET_TCP_PROXIES
  usage: 0.0
- limit: 12.0
  metric: CPUS_ALL_REGIONS
  usage: 2.0
- limit: 0.0
  metric: SECURITY_POLICIES
  usage: 0.0
- limit: 0.0
  metric: SECURITY_POLICY_RULES
  usage: 0.0
- limit: 20.0
  metric: PACKET_MIRRORINGS
  usage: 0.0
- limit: 100.0
  metric: NETWORK_ENDPOINT_GROUPS
  usage: 0.0
- limit: 6.0
  metric: INTERCONNECTS
  usage: 0.0
- limit: 5000.0
  metric: GLOBAL_INTERNAL_ADDRESSES
  usage: 0.0
- limit: 5.0
  metric: VPN_GATEWAYS
  usage: 0.0
- limit: 100.0
  metric: MACHINE_IMAGES
  usage: 0.0
- limit: 0.0
  metric: SECURITY_POLICY_CEVAL_RULES
  usage: 0.0
- limit: 0.0
  metric: GPUS_ALL_REGIONS
  usage: 0.0
- limit: 5.0
  metric: EXTERNAL_VPN_GATEWAYS
  usage: 0.0
- limit: 1.0
  metric: PUBLIC_ADVERTISED_PREFIXES
  usage: 0.0
- limit: 10.0
  metric: PUBLIC_DELEGATED_PREFIXES
  usage: 0.0
- limit: 128.0
  metric: STATIC_BYOIP_ADDRESSES
  usage: 0.0

I have no clue for resolving this problem. I and my coworker are wondering that the default quota of App engine is small, so it reaches quota limit with just 1 project.(It's not really though)
I even need a little hint. Help me!

A: GAE uses Google Compute Engine's quota.
It looks like you've exceeded your GCE quota limit.
You can check GCE's VM instance quota limit at "Quota" page.
It is quota page which concludes GCE VM instance limit. ->
Quota Page for VM instance

I think you configured number of instances over 8.
If you want to mitigate such limitation, Send request to Google via "EDIT QUOTAS".->
Send request


text:
Q: snakemake parameter exploration: how to pass options to a command in shell directive? I'm performing parameter exploration using Paramspace utility as described here.  I've read parameters in a pandas dataframe and next I wish to pass these as values of options of a shell command but can't figure out how.
In the below minimal example, I wish to pass parameter s (read in dataframe df) as the value of option -n for head command in the shell directive.
from snakemake.utils import Paramspace
import pandas as pd

df = pd.DataFrame(
    {'s' : [1, 2, 3]},
    index = [1, 2, 3]
    )

paramspace_empty = Paramspace(df)

rule all:
    input:
        expand("results/{params}.tsv", params=paramspace_empty.instance_patterns)

rule simulate_empty:
    output:
        f"results/{paramspace_empty.wildcard_pattern}.tsv"
    params:
        simulation=paramspace_empty.instance
    shell: """
        head input.txt > {output}
    """

I tried the below and similar variations but nothing worked.
shell: """
    head -n {params.simulation['s']} input.txt > {output}
"""

The above example is extracted (and modified a bit) from the Snakefile here which tests paramspace utility.
I seem to be missing something fundamental or trivial. Thank you in advance for any help.

A: You're almost there, you do not need to quote the dictionary key. Here's a slightly modified working version:
import pandas as pd
from snakemake.utils import Paramspace

df = pd.DataFrame({"s": [1, 2, 3]}, index=[1, 2, 3])

paramspace_empty = Paramspace(df, filename_params="*")

rule all:
    input:
        expand("{params}.tsv", params=paramspace_empty.instance_patterns),

rule simulate_empty:
    output:
        f"{paramspace_empty.wildcard_pattern}.tsv",
    params:
        simulation=paramspace_empty.instance,
    shell:
        """
        seq 10 | head -n {params.simulation[s]} > {output}
        """


text:
Q: background-size:cover leaves blank space in Chrome for Android I'm trying to get a nice fullscreen image background for my website. It's working fine in almost every browser I tested in (browsershots.org), but in Chrome on my Android tablet it's not working as expected. As you can see there's a lot of white in the background, where it should be all image.
Link : http://test.socie.nl
CSS :
body {
    background: url(../../images/background/image1.jpg) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

Unexpected result :

A: It appears to be a four year old bug that the Android/Chrome team are ignoring:
https://code.google.com/p/android/issues/detail?id=3301
http://productforums.google.com/forum/#!topic/chrome/l6BF3W0rymo
I've tried every solution I could find mentioned in those links and other places; all fail on Android 4.3 Chrome 30. All fail even worse on Android 2.3 native browser.
The one I am going with is:
.body{
background:#fff url(background.jpg) no-repeat fixed center;
background-size:cover;
    }

(I.e. that CSS moved out of body into a class called "body"), and then in the HTML I have:

...

(BTW, the technique you can see there, to keep the footer at the bottom of the window, does not appear to be causing the problem, as in my first set of experiments I'd stripped that out.)
Aside: I was surprised to see Firefox for Android also misbehaves with background-size:cover. Are they sharing the same rendering engine?!

A: There is update to the method posted above (as published here).
html {
  background: url(images/bg.jpg) no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

Though the issue in the original question still persists despite the update. What worked for me was adding full width and height to the html CSS in addition to the above:
html {
    width: 100%;
    height: 100%
}

A: Solved by adding the following:
html {
  height:100%;
  min-height:100%;
}

body {
   min-height:100%;
}

A: Instead of a background image, try using an  instead:
HTML :

CSS :
#your-id{
    width: 100%;
    height: auto;
    position: fixed;
    top: 0;
    left: 0;
    z-index: -999;
}

A: Actually ALL I needed if your using html tag is to add:
height: 100%;

...with the caveat that still the image will resize a bit when you scroll the menu bar out of view, but I think all of other answers also have that issue.


text:
Q: Convert http://localhost/post.php?id=4 to http://localhost/post/4 with .htaccess i'd like to convert localhost/post.php?id=4 to localhost/post/4 with .htaccess, my currently code is:

# Activate RewriteEngine
RewriteEngine on
RewriteBase /
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

#HIDE .PHP
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

#locahost/username
RewriteRule ^(\w+)/?$ usuario.php?usuario=$1 [L]

RewriteCond %{QUERY_STRING} (;|<|>|'|"|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]
RewriteCond %{QUERY_STRING} \.\./\.\. [OR]
#RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]
RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]
RewriteCond %{QUERY_STRING} (<|>|'|%0A|%0D|%27|%3C|%3E|%00) [NC]
RewriteRule .* - [F]

#EXTRA
AddDefaultCharset utf-8

And if it's possible also convert localhost/username to localhost/user/username
Thanks :)

A: Use a rewrite rule for that
RewriteRule ^/post/([0-9]+)$ /post.php?id=$1 [L]
and
RewriteCond /user/%{REQUEST_URI} -d
RewriteCond /user/%{REQUEST_URI} -f
RewriteRule ^/([a-zA-Z0-9]+)$ /user/$1 [L]
The first one simply redirects  /post/X  to /post.php?id=X
The seocnd one checks if  /user/[requested URI] exists as a file or directory then if it does, forwards to that particular file
NOTE the second one will conflict if a user has the same name as another directory in the root of the site and effectively prevent anyone from accessing that folder from your site -- so I would not use the second one.


text:
Q: Is it possible to get the visual studio build folder name over azure devops? We are using azure devops for CI/CD, but we got a problem with our build pipelines.
When creating visual studio build, we would like to get the specific folder where the build is created, so we can copy the folder (add outputpath parameter to visual studio task doesn't work with some projects).
The main problem is, that name of the project and the repo can be different.
We would need something like:
$(agent.builddirectory)\s\PROJECT-NAME\bin\Release

Is there a way to get the project name or the output folder?
$(agent.builddirectory) isn't working.
EDIT: We need to use the build pipelines at this point, so currently we don't work with artifacts or release pipelines (we know we should...)

A: It seems like you are using Azure Pipelines to do what MSBuild / dotnet cli are made to help you.
You can instead use msbuild / dotnet cli to build and pack your project output to a designated location, like output in the repository root folder, that is common across all projects that use the pipeline.
If you only checkout 1 repository, all tasks will be executed in the repository folder. You do not need to mess with $(agent.builddirectory)\s\xxxx. Accessing output is as simple as output/ in your pipeline.


text:
Q: Reference to object in array in object in array For our application we have one complex global data object. Lets call this object A. Object A has a strong, nonatomic array with objects of class B, lets call them B1, B2, B3, etc. Each of these B objects can have an array again, with objects of type C, say C1, C2, etc...
Now when we create this complex structure at the first startup of the application, The C objects asynchronously starts downloading images etc. When this process is done, it calls a delegate function. This "finish loading event" clearly launches after the delegate has been set! The object is accessed through the singleton pattern.
However, when it finishes, the delegate in the C objects are nil.
We figured it had to do with referring to the object. The moment we set the delegate, we simply set the C object delegate by
[[A objectAtIndex:x] objectAtIndex:y].delegate = self;

However, when the loading of C finishes, and we check what the delegate is, it is nil. ObjectAtIndex is a read only method. Object C might contain an array itself as well, making the tree even deeper.
How to tackle this problem? Can we get a "reference" to the object in the array instead of an "copy"?
ADDITIONAL INFORMATION:
The above information is arbitrary and not actual code. It is just to give an impression of what is happening.
The problem is that there is supposed to be one object in a complex tree, however when i adjust this object and a little while later check it again, the adjustment was not applied.
Delegate declaration:
@property (strong,nonatomic) id<HKWidgetModel> delegate;

A: I thing you should use Block instead of delegate to avoid this complicity.


text:
Q: Starting jetty with spring xml as a background process/thread My goal is to set up a jetty test server and inject a custom servlet to test some REST classes in my project. I was able to launch the server with spring xml and run tests against that server. The issue I'm having is sometimes after the server started, the process stopped at the point before running the tests. It seems jetty didn't go to background. It works every time on my computer. But when I deployed to my CI server, it doesn't work. It also doesn't work when I'm on VPN. (Strange.)
The server should be completed initialized as when the tests stuck, I was able to access the server using a browser.
Here is my spring context xml:

            ....

<bean id="servletHolder" class="org.eclipse.jetty.servlet.ServletHolder">
    <constructor-arg ref="courseApiServlet"/>
</bean>

<bean id="servletHandler" class="org.eclipse.jetty.servlet.ServletContextHandler"/>

<!-- Adding the servlet holders to the handlers -->
<bean id="servletHandlerSetter" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetObject" ref="servletHandler"/>
    <property name="targetMethod" value="addServlet"/>
    <property name="arguments">
        <list>
            <ref bean="servletHolder"/>
            <value>/*</value>
        </list>
    </property>
</bean>

<bean id="httpTestServer" class="org.eclipse.jetty.server.Server" init-method="start" destroy-method="stop" depends-on="servletHandlerSetter">
    <property name="connectors">
        <list>
            <bean class="org.eclipse.jetty.server.nio.SelectChannelConnector">
                <property name="port" value="#{settings['webservice.server.port']}" />
            </bean>

        </list>
    </property>

    <property name="handler">
        <ref bean="servletHandler" />
    </property>
</bean>

Running latest Jetty 8.1.8 server and Spring 3.1.3. Any idea?

A: I figured it out. My bad. The IP address for the testing web server (jetty) that my REST client connect to is set to a internal IP address (not localhost) that only available to my local host. So that why the tests couldn't start when I'm on VPN or on CI server.
The xml is actually working and I think it is better than starting jetty in separate ant task. Because spring manage the jetty lifecycle. When the tests finish, spring will shutdown jetty automatically.

A: If you are using Maven, you can let the jetty-maven-plugin start and stop Jetty as part of your build process. You create your Spring project as usual, add the plugin to your .pom file. mvn jetty:run allows you to run the web app unassembled, and mvn jetty:run-war allows you to run a .war file. I guess that what you really want is to have Jetty started in the pre-integration test phase and stopped in the post integration test phase (ref):
<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <configuration>
    <scanIntervalSeconds>10</scanIntervalSeconds>
    <stopKey>foo</stopKey>
    <stopPort>9999</stopPort>
  </configuration>
  <executions>
    <execution>
      <id>start-jetty</id>
      <phase>pre-integration-test</phase>
      <goals>
        <goal>start</goal>
      </goals>
      <configuration>
       <scanIntervalSeconds>0</scanIntervalSeconds>
       <daemon>true</daemon>
      </configuration>
    </execution>
    <execution>
      <id>stop-jetty</id>
      <phase>post-integration-test</phase>
      <goals>
        <goal>stop</goal>
      </goals>
    </execution>
  </executions>
</plugin>


text:
Q: Marklogic entity dictionary I have created entity dictionary following this documentation:
https://docs.marklogic.com/guide/search-dev/entity
The insertion done successfully ,but when I want to see the dictionary that I have created using :
cts:entity-dictionary-get()
it returns some code <0x36d> not the dictionary.
The documentation doesn't tell how to get and view the dictionary as a table, XML, or any format.
I figured out that dictionary is stored as a document since I can delete it using document-delete(), but I cant open it using fn:doc().
Any help how can I see the inserted dictionary entities?

A: I have found the answer.
I figured out that the dictionary stored as binary file, so I use
xdmp:binary-decode(fn:doc("path"),"UTF-8")
The dictionary showed as a table.


text:
Q: ufw Linux firewall difference between reject and deny Using the uncomplicated firewall ufw,  I can set ports/services to reject and deny.
For example:
ufw deny www

ufw reject www

Can someone explain to me the difference between the two approaches?

A: "deny" uses the DROP iptables target, which silently discards incoming packets.
"reject" uses the REJECT iptables target, which sends back an error packet to the sender of the rejected packet.
From the ufw manual page:

Sometimes  it is desirable to let the sender know when traffic is being
  denied, rather than simply ignoring it. In these cases, use reject
  instead of deny.

From the point of view of the user/program that is trying to connect to your server:

*

*"deny" will keep the program waiting until the connection attempt times out, some short time later.

*"reject" will produce an immediate and very informative "Connection refused" message.
EDIT:
From a security point of view "deny" is slightly preferrable. It will force every connection from a potential attacker to time-out, thus slowing down the probing of your server.
Experienced and/or determined attackers won't be really affected - they are usually patient and there are several ways to deal with the slow down, anyway. It might discourage the occasional wannabe that did not even bother to read the nmap manual page, though.
"deny" will also save a bit of bandwidth on the uplink by not sending the error packet. This might be important on asymmetric network connections where a DoS attack could simply saturate the - usually narrower - uplink with error packets.
On the other hand, it is a bit more polite to let people know that you are rejecting their connections. A refused connection lets people know that it is most probably a permanent policy decision, rather than e.g. a short-term networking issue.


text:
Q: QT - emit signal when hover a QLabel I would like to emit a signal when hovering a QLabel with the mouse in QT.
Is it possible ?
If not, how can I do it ?
Thanks.

A: You can do hover handling without subclassing of QLabel. Try next code sample for it:
void LabelHoverHandler::attach(QLabel *label)
{
    label->setAttribute(Qt::WA_Hover, true);
    label->installEventFilter(this);
}

bool LabelHoverHandler::eventFilter(QObject *obj, QEvent *event)
{
    if (event->type() == QEvent::HoverEnter)
    {
        emit signalMouseHover(dynamic_cast<QLabel*>(obj) );
        qDebug() << "HoverEnter";
    }

    return false;
}

LabelHoverHandler header file:
class LabelHoverHandler : public QObject
{
    Q_OBJECT
public:
    LabelHoverHandler(QObject *parent);
    virtual ~LabelHoverHandler() {};

    void attach(QLabel *label);

protected:
    bool eventFilter(QObject *obj, QEvent *event);

signals:
    void signalMouseHover(QLabel*);
};

Simply create an instance of LabelHoverHandler and call method attach() with a needed label as a parameter.

A: A possible implementation:
// mylabel.h
#ifndef MYLABEL_H
#define MYLABEL_H

#include <QLabel>

class MyLabel : public QLabel
{
    Q_OBJECT

public:
    MyLabel();
    ~MyLabel();

protected:
    virtual void enterEvent(QEvent *ev);
    virtual void leaveEvent(QEvent *ev);

private:
    bool hover;

};

#endif // MYLABEL_H

and:
// mylabel.cpp
#include "mylabel.h"
#include <QEvent>

MyLabel::MyLabel()
{
    hover = false;
    setAttribute(Qt::WA_Hover, true);
}

MyLabel::~MyLabel()
{
}

void MyLabel::enterEvent(QEvent *ev)
{
    if (!hover){
        hover = true;
        setText("Send signal here");
    }
    QLabel::enterEvent(ev);
}

void MyLabel::leaveEvent(QEvent *ev)
{
    if (hover){
        hover = false;
        setText("Mouse leave area");
    }
    QLabel::leaveEvent(ev);
}


text:
Q: Want to return JSON format from my existing WCF application which is SOAP based Would like to create one wrapper for WCF application which will return JSON. Can you please suggest, how will I proceed to create wrapper for WCF application, where this wrapper will return JSON.
Do not want to change my existing application as my web application is already consuming this. I would like to consume this service for mobile application.

A: This should tell you all you need to know:
http://www.codeproject.com/Articles/167159/How-to-create-a-JSON-WCF-RESTful-Service-in-sec


text:
Q: (combinatorics) prove that on average, n-permutations have Hn cycles without mathematical induction. Prove that on average, n-permutations have $H_n$  cycles, where $H_n=1+1/2+1/3+...+1/n$  without mathematical induction.
I think that on average, the number of cycles of length i (1≤i≤n) should be 1/i to prove but, I don't know how to show this. Some books proved this using an indicator function. Do I have to use that?

A: The first step is to show that the distribution of the length of the cycle containing $1$ is uniform. Indeed, the number of permutations in which $1$ is in a cycle of length $t$ is
$$ (n-1)(n-2)\cdots(n-t+1)\cdot(n-t)! = (n-1)!. $$
Here $(n-1)(n-2)\cdots(n-t+1)$ counts the number of possible cycles containing $1$ of length $t$, and $(n-t)!$ counts the number of permutations on the remaining elements.
For a fixed permutation $\pi$, define $X_i$ (for $i \in \{1,\ldots,n\}$) to be the reciprocal of the length of the cycle containing $i$. It is not too hard to see that $\sum_{i=1}^n X_i$ is the number of cycles in $\pi$ (exercise). If $\pi$ is chosen randomly, the calculation above shows that
$$ \mathbb{E}[X_i] = \sum_{t=1}^n \frac{1}{n} \cdot \frac{1}{t} = \frac{1}{n} H_n. $$
By linearity of expectation, we deduce that
$$ \mathbb{E}\left[\sum_{i=1}^n X_i\right] = H_n. $$

A: No, you don't "HAVE" to use indicators, you GET to use indicators. It's a wonderfully nice and easy method and you should be glad whenever you can use it. And it works like a charm on this problem.
The expected number of cycles of length $i$ is equal to the number of sets of size $i$, which is $\binom ni,$ times the probability that a given set of size $i$ is permuted cyclically by a random permutation of $\{1.2,\dots,n\},$ which is $(i-1)!(n-i)!/n!.$ That is, the expected number of cycles of length $i$ is
$$\binom ni\frac{(i-1)!(n-i)!}{n!}=\frac1i$$
and so the expected number of cycles of all lengths is
$$\sum_{i=1}^n\frac1i=H_n.$$

A: One can write down the disjoint cycle representation of every permutation in $S_n$ and then tally the total number of $k$-cycles seen. For every possible $k$-cycle $\sigma$ we can count the number $N(\sigma)$ of permutations which contain $\sigma$ in its cycle representation, and then sum over all such $\sigma$. The permutations of the set $\{1,\cdots,n\}$ with $\sigma$ in its cycle representation are in bijection with the permutations of $\sigma$'s fixed points, of which there are $(n-k)!$, and so $N(\sigma)$ doesn't actually depend on $\sigma$! So, compute the number of $k$-cycles $\sigma$ in $S_n$, multiply this by $(n-k)!$ and divide by $n!$ to get the average number of $k$-cycles.

A: By way of promoting symbolic combinatorics here is the species of permutations with all cycles marked: $$\mathfrak{P}(\mathcal{U}\mathfrak{C}(\mathcal{Z})).$$
This translates to the bivariate generating function
$$G(z, u) = \exp\left(u\log\frac{1}{1-z}\right).$$
We require
$$n! [z^n] \left.\frac{\partial}{\partial u} G(z,u)\right|_{u=1}.$$
This is
$$n! [z^n]
\left.\exp\left(u\log\frac{1}{1-z}\right)\log\frac{1}{1-z}\right|_{u=1}$$
or $$n! [z^n] \frac{1}{1-z} \log\frac{1}{1-z} = n! \times H_n.$$
It follows that the desired average is $$H_n.$$
Remark. It is generally known that the exponential generating function produces the average on differentiation and substitution (EGF turns into OGF). I included it nonetheless to aid the reader.


text:
Q: How to set a role access in a Telegram group is there a way to define the role of each user , and each role has its own access
For example, VIP members can download / save all media
if users who don't have roles can only see and can't download or save anything
is it possible there is , is there any additional tools ? it's very interesting if telegram has built-in features


text:
Q: CLI php errors on FreeBSD Server I manage a FreeBSD server running usual AMP setup. Apache, Mysql, Php-fmp
Everything is working fine. In order to help out with speeding up a couple of Wordpress sites; we run php cli to run the wp_crontab.php regularly. This is running without issue; however, I am regularly getting emails with the following:
PHP Warning:  Missing arginfo for Imagick::__tostring() in Unknown on line 0
PHP Warning:  Missing arginfo for Imagick::getimagehistogram() in Unknown on line 0

Php8.0
Would like to fix; but if not, what is the best practice for disabling these emails?
I have tried using
error_reporting=0
error_reporting=E_ALL & ~E_NOTICE & ~E_Warning

And some other settings in hopes to suppress these warning until I figured out what library I need to fix.
So, 2 questions:

*

*how to disable warnings from php on the CLI?

*What are these 2 missing arginfo warnings and how could I possibly fix that?

A: Being unable to find and answer and finding a few articles of bugs specific to the 8.0 implementation when; I just returned to 7.4.16.
Cheers,
T


text:
Q: Can I use a p-value as my decision threshold estimate when calculating AUC-ROC? Sorry if the title is confusing. I essentially want to know if it's appropriate to use a p-value as the decision threshold (of the null outcome) when calculating AUC-ROC. I have a dataset of outcome values & a p-value associated with each one (generated via models that I've fit previously). I'm wondering if it makes sense to use the p-value as the decision threshold that gets varied when calculating AUC-ROC, provided of course that I specify the outcomes correctly.
I feel like this must be incorrect for some reason as it doesn't really vibe with my intuition around p-values. Would it maybe make more sense to use the effect size associated with the p-value instead (or even the adjusted p-value)? A simple reprex is below; we're assuming that the p-value refers to the null hypothesis that we cannot reject outcome B being correct vs. the alternative outcome A. The goal is to correctly classify the outcomes using the p-value / adj. p-value / test statistic as the decision threshold.
library(dplyr)
set.seed(312)
model_df <- data.frame(outcome <- sample(c("A", "B"), size = 100, replace = TRUE),
                       p_value = runif(100)) %>%
            arrange(p_value) %>%
            mutate(p_value_adj = p.adjust(p_value, method = "holm"))
yardstick::roc_auc_vec(truth = as.factor(model_df$outcome),
                       estimate = model_df$p_value,
                       event_level = "second")

I think this might be slightly related to this post about using p-values as effect sizes. I'll lastly note that I've seen the approach I detailed above used in bioinformatics papers before, which is why I'm considering it, but something just doesn't feel quite right.


text:
Q: On crossed product of L^{P} spaces Let $M$ be a von Neumann algebra with faithful normal state $\varphi$, and $G$ be a group action on $M$ preserving $\varphi$. Then is it true
\begin{align*}
L^{p}(M\rtimes G, \varphi^{M\rtimes G})\cong L^{p}(M,\varphi)\rtimes G?
\end{align*}


text:
Q: Google Mobile Vision library delays or fails on download On my app I use Google Mobile Vision in order to recognize faces.
I use gms play library and it works fine on most devices :
'com.google.android.gms:play-services-vision:9.4.0+'

Here to note that I've tried also updated versions of gms vision like 15.0.0.
Recently I received many bad reviews and some users complained that app couldn't recognize their face.
So I found some devices that had this issue and it seems that problem is Google Play Services delay a lot(or just fail) to download GMS vision even if device has much free storage.
Android Studio log says :
I/Vision: Loading library libmobile_vision_face.so
I/Vision: libmobile_vision_face.so library load status: false
W/DynamiteModule: Local module descriptor class for com.google.android.gms.vision.dynamite not found.
I/DynamiteModule: Considering local module com.google.android.gms.vision.dynamite:0 and remote module com.google.android.gms.vision.dynamite:1702
I/DynamiteModule: Selected remote version of com.google.android.gms.vision.dynamite, version >= 1702

So it's going like this : The first attempts for using my app failing since GMS Vision hasn't been downloaded or working. But after some hours on most of the cases it seems that is working fine.
For understanding better why this happening I tried when app began to work well to clear Data of Google Play Services of device.  It stopped working for a while and then after some hours its OK again without any user action.
So it seems that is a matter of Google Services.
Practically many devices would have problem using my app since they are very new enabled or user has recently wipe data etc or for any other random reason.
Can I do anything for that?


text:
Q: Action of Swap operator I am trying to understand concept of swap operator, introduced in the article http://arxiv.org/pdf/1001.2335v2.pdf by means of simple example.
Swap operator is supposed to act on two identical(?) copies of system swapping configurations within some part of system.
Definition from article:
$$Swap_{A}(\sum_{\alpha_1,\beta_{1}}C_{\alpha_1,\beta_{1}} |\alpha_{1}\rangle|\beta_{1}\rangle) \otimes (\sum_{\alpha_2,\beta_{2}}D_{\alpha_2,\beta_{2}} |\alpha_{2}\rangle|\beta_{2}\rangle)=$$
$$= \sum_{\alpha_1,\beta_{1}}C_{\alpha_1,\beta_{1}} \sum_{\alpha_2,\beta_{2}}D_{\alpha_2,\beta_{2}}(|\alpha_{2}\rangle|\beta_{1}\rangle) \otimes (|\alpha_{1}\rangle|\beta_{2}\rangle)$$
I am trying to see what does it mean for simple system:
$$Swap_{A}(|\uparrow\rangle_{1}|\downarrow\rangle_1 + |\uparrow\rangle_{1}|\downarrow\rangle_1)\otimes ( |\uparrow\rangle_{2}|\downarrow\rangle_2 + |\uparrow\rangle_{2}|\downarrow\rangle_2)=$$
$$(|\uparrow\rangle_{2}|\downarrow\rangle_1 + |\uparrow\rangle_{2}|\downarrow\rangle_1)\otimes ( |\uparrow\rangle_{1}|\downarrow\rangle_2 + |\uparrow\rangle_{1}|\downarrow\rangle_2)$$
My question is why can't I open brackets and get initial state by means of exchanging some ket vectors?
In particular why
$$|\uparrow\rangle_{2}|\downarrow\rangle_1 |\otimes \uparrow\rangle_{1}|\downarrow\rangle_2 \neq |\uparrow\rangle_{1}|\downarrow\rangle_1 \otimes |\uparrow\rangle_{2}|\downarrow\rangle_2 $$
If I try to imagine these states as two electrons on the lattice, then aforementioned statement looks counterintuitive to me.


text:
Q: How to weight the quotient of sums as a dependent variable for a regression in R? Edit - Rewrote question since the original did not makes sense:
In R - how would I go about getting a lm fit model that is a quotient of sums for two variables grouped by a third factor variable, but that weights some entries more than others? Data looks like:
Browser       Visits    Clicks
Chrome         100       25
Chrome         89        40
Chrome         10        0
Safari         40        10
Safari         30        2

From the comments this is the command for the WLS regression weighted by visits, but I don't think I'm using the weight function right since I don't know how the errors are correlated with visits, just that they are.
fit <- lm(Clicks/Visits ~ Browser, weights=(visits/sum(visits)))

A: You are asking for a rate model, i.e. events per number at risk. This is usually implemented by modeling the process as a Poisson distributed set of events:
    dat <- read.table(textConnection("Browser       Visits    Clicks
 Chrome         100       25
 Chrome         89        40
 Chrome         10        0
 Safari         40        10
 Safari         30        2"), header=TRUE)

 dat$CperV <- with(dat, Clicks/Visits)
    dat

 glm(CperV ~ Browser, data=dat, family = "poisson")

Call:  glm(formula = CperV ~ Browser, family = "poisson", data = dat)

Coefficients:
  (Intercept)  BrowserSafari
       -1.456         -0.387

Degrees of Freedom: 4 Total (i.e. Null);  3 Residual
Null Deviance:      0.772
Residual Deviance: 0.7379   AIC: Inf
    Residual Deviance: 0.1182   AIC: 1.467

> exp(-1.456  ) # estimated rate for nonSafari Visits
[1] 0.2331671
> exp(-1.456-0.387 ) # estimated rate for Safari Visits
[1] 0.1583417
> mean(dat[dat$Browser=="Safari",  "CperV"])  # actual means
[1] 0.1583333
> mean(dat[dat$Browser!="Safari",  "CperV"])  # actual means
[1] 0.2331461


text:
Q: Communicate two ionic - angular apps through node server I have two Ionic applications, and both use the same API served with node. What I need is that when one app sends a post request, the other app gets that post request and uses the information that comes from the request. How can I achieve this? I thought of listening for that particular post request, but I don't know if that's possible, or when the post request reaches the API, trigger some action in the server that sends the information to the other app. Is this possible?

A: You can use Firebase Cloud Messaging to implement this.
When one ionic application requests a service from your server by using HTTP Requests, the server will trigger the respective action and sends a push notification to your other app by using the Firebase cloud messaging service. Your 2nd app will capture this push notification by subscribing to a URL in Firebase.
For the server-side, You can use fcm-node module or Firebase NodeJS Module to implement this functionality. For the mobile app, you can use providers in ionic to subscribe to firebase cloud messages
A detailed guide on implementing push notifications can be found here


text:
Q: mysql multiple indexed column query performance Two Indexed Boolean Columns: active|online.
Out of 100000 users, 40000 is active and 12000 is online. I want to notify those who are only online. Which query should run faster? (only active users can go online)
Select * from users
where active=1
and online=1

OR
Select * from users
where online=1


text:
Q: PDO loop insert I have a database:
------------------------------
name    |extension  |filesize
------------------------------
abc     | php       | 12
def     | php       | 18
ghi     | bat       | 32
jkl     | bat       | 24
mno     | php       | 30

I want to specify all extensions and summarize filesizes, so it is working pretty well:
$sql= "SELECT extension, SUM(filesize) AS total FROM mytable GROUP BY extension";
$stmt = $pdo->query($sql);

while($row = $stmt->fetch(PDO::FETCH_BOTH)){
 echo $row['extension'] . " - " . $row['1'] . "
";
}

The output is:
php - 60
bat - 56

But now I want to insert these results in a new table (using PDO of course). I want to have a new table:
---------------------
ext     |sumfilesize
---------------------
php     | 60
bat     | 56

I suppose I have to make some query in while loop but is it possible to make a query inside a query?
How can I do it?

A: As long as you are not creating the new table inside your while loop you're good to go. Just put the query to insert the values in your database in your while loop and you are done.
Code should then look like this:
$sql= "SELECT extension, SUM(filesize) AS total FROM mytable GROUP BY extension";
$stmt = $pdo->query($sql);

while($row = $stmt->fetch(PDO::FETCH_BOTH)){
  echo $row['extension'] . " - " . $row['1'] . "
";
  $query = "INSERT INTO TableName (ext, sumfilesize) VALUES ($row['extension'], $row['1'])";
  $query->execute();
}

A: $sql="INSERT INTO myTotalTable (extension,total) SELECT extension,SUM(filesize) AS total FROM mytable GROUP BY extension";
$stmt = $pdo->query($sql);


text:
Q: Remove escaped unicode string in java with regex I have string like below
"them coming \nLove it \ud83d\ude00"

I want to remove this character "\ud83d\ude00". so it will be
"them coming \nLove it "

How can I achieve this in java? I have tried with code like below but it won't works
payload.toString().replaceAll("\\\\u\\b{4}.", "")

Thanks :)

A: I think \\\\u\\b{4}. will not work, because regex treat \ud83d as a symbol �, not a literal string. So to match this kind unwanted (for any reason) unicode characters it will be better to exclude character you accept(don't want to replace), so for ecample all ASCII character, and match everything else (what you want to replace). Try with:
[^\x00-\x7F]+

The \x00-\x7F includes Unicode Basic Latin block.
String str = "them coming \nLove it \ud83d\ude00";
System.out.println(str.replaceAll("[^\\x00-\\x7F]+", ""));

will result with:

them coming
  Love it

However, you willl hava a problem, if you use national character, any other non-ASCII symbols (ś,ą,♉,☹,etc.).


text:
Q: Magento 2: Show multiple grids in a page without using UI components I have a specific requirement in Magento 2. I need to show two grids on a single page using Block classes (without using UI components).
I have created one of the grids successfully, but I am not abler to find a way to show the second grid.
Please help me if anyone has any idea how to achieve this?
Edit:
Screenshot


text:
Q: Download thru the browser a file locally stored On the server side I create a new file (Java):
File file = new File(dataConverter.convertData(body.get("type").trim(), dataFile));

On the client side I want to download the file, so I try accessing the file using its absolute path (JavaScript):
document.open('C:\\Users\\dmuntean\\Desktop\\Minivsita\\earlyproject\\output\\downloads\\temp\\');

But because everything is stored on local disk, the browser (Chrome) doesn't let me do this, it redirects me on a blank page and nothing happens. Is there any workaround?
I tried using window.location, window.open, document.location. Also launching Chrome with --allow-file-access-from-files doesn't help.

A: document.open actually open a document for writing (and can actually erase the file content, if already exist). To do what you want, you have to use somenthing like:
document.location.href = 'file:///c:/path/to/file/document.pdf';

Tested on Firefox 68.0.1 and Chrome 75.0.3770.142


text:
Q: How to add data-dismiss inside button tag? <button aria-hidden="true">Close</button>

I have a button tag in html. I want to add <data-dismiss="modal"> inside button tag by JQuery so that it become like <button data-dismiss="modal" aria-hidden="true">Close</button> . Is there any way to do it?

A: $('button').attr("data-dismiss","modal");

.attr takes 2 parameters, attribute and the value.

A: You can do this by using .attr() . First you set the attributeName, then the value

$('button').attr("data-dismiss","modal");
console.log($('button')[0])

<button aria-hidden="true">Close</button>

A: here first of all there is no data-dismiss to the button tag, after clicking on open modal i appended data-dismiss to the button, try this

<!DOCTYPE html>

  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

Modal Example

  <button type="button" class="btn btn-info btn-lg open-modal" data-toggle="modal" data-target="#myModal">Open Modal</button>

          <button type="button" class="close">×</button>

Modal Header

Enter Text

          <input id="input_Text" type="text" class="form-control"/>

          <button type="button" class="btn btn-default" >Close</button>


text:
Q: Access symbol key of array of one hash value? Is there a better, faster, and more direct way to access the symbol key of :a2 in this array of one hash [{:a2=>nil}]?
I have tried @new_array.first.first.first and @new_array.first.keys.first.

A: I would use @new_array.first.keys.first, but this is assuming you always want the first key of the first hash.


text:
Q: Spring integration SFTP - dont redowload locally deleted files From reading the Spring SFTP docs (http://docs.spring.io/spring-integration/reference/html/sftp.html) it's not entirely clear if it's possible to prevent redownloading of successfully transferred files which subsequently get removed.
The files being transferred are large and get processed by a local task, and then can be deleted.
However, Spring SFTP is picking up that they have been removed (either at runtime or restart) and redownloading them.
I am already using the SftpPersistentAcceptOnceFileListFilter to survive restarts.

The above discussion refers to filtering the files before retrieving
  them. Once the files have been retrieved, an additional filter is
  applied to the files on the file system. By default, this is
  anAcceptOnceFileListFilter which, as discussed, retains state in
  memory and does not consider the file's modified time. Unless your
  application removes files after processing, the adapter will
  re-process the files on disk by default after an application restart.
Also, if you configure the filter to use a
  FtpPersistentAcceptOnceFileListFilter, and the remote file timestamp
  changes (causing it to be re-fetched), the default local filter will
  not allow this new file to be processed.
Use the local-filter attribute to configure the behavior of the local
  file system filter. To solve these particular use cases, you can use a
  FileSystemPersistentAcceptOnceFileListFilter as a local filter
  instead. This filter also stores the accepted file names and modified
  timestamp in an instance of theMetadataStore strategy (Section 9.5,
  "Metadata Store"), and will detect the change in the local file
  modified time.

From this, where it mentions local files being removed, I don't know what I should be doing.
Here is my relevant config:
<int-sftp:inbound-channel-adapter id="sftpInboundAdapter"
        auto-startup="true" channel="receiveChannel" session-factory="sftpSessionFactory"
        local-directory="file:local-dir" remote-directory="files"
        auto-create-local-directory="true" delete-remote-files="false"
        filter="compositeFilter">
        <int:poller fixed-rate="1000" max-messages-per-poll="1" />
    </int-sftp:inbound-channel-adapter>

<bean id="compositeFilter"
        class="org.springframework.integration.file.filters.CompositeFileListFilter">
        <constructor-arg>
            <list>
                <bean
                    class="org.springframework.integration.sftp.filters.SftpSimplePatternFileListFilter">
                    <constructor-arg value="*.zip" />
                </bean>
                <bean
                    class="org.springframework.integration.sftp.filters.SftpPersistentAcceptOnceFileListFilter">
                    <constructor-arg name="store" ref="metadataStore" />
                    <constructor-arg value="foo/bar" />
                </bean>
            </list>
        </constructor-arg>
    </bean>

A: Please edit your question with your configuration - the SftpPersistentAcceptOnceFileListFilter should prevent the files being re-downloaded, unless the timestamp on the file changes.
F[] files = session.list(remoteDirectory);
if (!ObjectUtils.isEmpty(files)) {
    List<F> filteredFiles = filterFiles(files);
    for (F file : filteredFiles) {
        try {
            if (file != null) {
                copyFileToLocalDirectory(
                        remoteDirectory, file, localDirectory,
                        session);
            }
        }
...


text:
Q: NLog with VS 2008 Unit Test I am trying log some entries in a log file (Log.Trace / Log.Debug) while my VS unit test runs. I have also copied the file NLog.config to out directory through DeploymentItem attribute over class. Still my log file is not created. Any help as to how can we log entries in a file same as we do for normal web application.

A: I've just found a solution to this problem:
Add the App.config file to yout unit test project with the following contents:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
  </configSections>

  <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <targets>
      <target name="debugLog" xsi:type="Console" />
    </targets>

    <rules>
      <logger name="*" minlevel="Debug" writeTo="debugLog"></logger>
    </rules>

  </nlog>

</configuration>

You may put any configuration you wish as with NLog.config file.

A: Unfortunately that is the only XML solution at the time. It is not only about Unit Testing, though. NLog.config does not work with just any Console Application.
Do not know if it is by design or just an oversight. Anyway I would not say that moving NLog.config to App.config section is any way satisfactory =/
Maybe it is worth to notice that there is a possibility of configuring nlog directly from code, what could be helpful in some scenarios.
One could be also glad to find nlog debug option, that will log the whole process of processing configuration file, registering targets and so on...
To turn it on, just add internalLogFile and internalLogLevel attributes to nlog element:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" internalLogFile="C:/logs/nlog.txt" internalLogLevel="Debug">

or from code:
    InternalLogger.LogFile = @"c:\logs\nlog.txt";

    InternalLogger.LogLevel = LogLevel.Trace;


text:
Q: Hyperbolic disks in AdS/CFT The embedding of AdS space into Minkowski spacetime describes a hyperboloid as e.g. shown in the corresponding Wikipedia article on AdS space. Now my questions are:

*

*How does this relate to the visualisation that is usually used in AdS/CFT, where AdS space is represented as "stacks" of hyperbolic disks?

*Do the arcs on these slices represent certain type of geodesics? And how do we obtain their description?

A: First of all, the AdS spacetime is not embedded into Minkowski spacetime. Instead, it is embedded into $\mathbb{R}^{2,d}$, whose isometry group is the conformal group $O(2,d)$.

*

*For your first question, the usual visualization of the $AdS$ spacetime is actually not the $AdS$ manifold itself, but the universal covering of the $AdS$ manifold. An $AdS_{n}$ manifold has the product topology of $\mathbb{S}\times\mathbb{R}^{n-1}$. It's universal covering space has the topology of $\mathbb{R}\times\mathbb{R}^{n-1}$. Here, $\mathbb{R}$ is the time direction, and $\mathbb{R}^{n-1}$ is the spatial slice.

To be specific, for example, the metric of the universal coverering of global $AdS_{3}$ is given by $$ds^{2}=-\cosh^{2}\rho dt^{2}+\sinh^{2}\rho d\theta^{2}+d\rho^{2}.$$
For a constant $t$, the spatial slice of the above metric gives the metric of the Poincare disk model, which is a model of two-dimensional hyperbolic geometry. Hyperbolic geometry is the Euclidean version of the $AdS$ geometry. It has maximal symmetries and negative constant scalar curvature. When you Wick-rotate the $AdS$ metric into the Euclidean signature, you end up with a hyperbolic manifodl. This means that the universal covering space of an $n$-dimensional global $AdS$ spacetime looks like stacks (in the time direction) of $n-1$ dimensional (Euclidean) Poincare balls.

*Yes. Arcs that are perpendicular to the conformal boundary (at infinity) of the Poincare disks are geodesics in Poincare balls. In the global $AdS$ spacetimes, they are space-like geodesics.


text:
Q: Poincare type inequality along the boundary Let the $C^1$ domain $\Omega\subset \mathbb{R}^n$ have connected boundary. Assume $\vec{F}:\mathbb{R}^n\rightarrow \mathbb{R}^n$ is a sufficiently smooth vector field and $\int_{\partial \Omega} \vec{F}=0$, show the inequality
$$\int_{\partial \Omega} |\vec{F}|^2\leq C\int_{\partial \Omega} |\nabla_T\vec{F}|^2$$
where $$\nabla_T \vec{F}=\nabla \vec{F}-(\nabla \vec{F}\cdot N)N=\left( \partial_j F^k-\frac{\partial F^k}{\partial N}N^j \right)_{1\leq j,k\leq n}$$
$N$ is the outer normal vector.
I have two questions:

*

*How to intuitively understand $\nabla _T F$ is the 'matrix of tangential derivatives'.

*How to prove the inequality using classical poincare inequality.

Any help will be appreciated.

A: To have a Poincare inequality the domain (or manifold) has to be necessarily bounded. Let us assume $\varphi$ be a $C^1$ defining function for $\Gamma \, (= \partial \Omega)$ i.e., $\Gamma = \{ \varphi = 0 \}$ and furthermore we can normalize $\varphi$ to have $\left.|\nabla \varphi|\right|_\Gamma = 1$.
It suffices to see the inequality for scalar functions $f \in C^{1}(\Gamma)$. Let us consider a $C^1$ extension of $f$ to a $\epsilon$-nbd of $\Gamma$ say $\Omega_\epsilon = \{x: \operatorname{dist}(x,\Gamma) < \epsilon\}$ (which we continue to denote by $f$) which satisfies the inequality $$|\nabla f| \le A|\nabla_\tau f| \text{ on } \Gamma \tag{0}$$ i.e., the tangential gradient on $\Gamma$ controls the total gradient.
N.B.: If the hypersurface $\Gamma$ has slightly higher regularity $C^{1,1}$ (instead of just $C^1$) then signed distance to $\Gamma$ is a good candidate for $\varphi$ and we can also take advantage of a uniform Fermi (normal) coordinate. In this case we actually have $\nabla f = \nabla_{\tau} f$ (in normal coordinates) by extending $f$ by constant along normal directions to $\Gamma$.
Now, by coarea formula we have $$\int_{V_r} f \,dx = \int_{-r}^{r} \int_{\Gamma_t} \frac{f}{|\nabla \varphi|} \,d\mathcal{H}^{n-1}\llcorner \Gamma_t\,dt \tag{1}$$ where, $\Gamma_t := \{\varphi = t\}$ denotes the level sets of $\varphi$ and $r > 0$ is small enough s.t. $V_r := \{x: |\phi(x)| < r\} \subset \Omega_\epsilon$. Note that $\Gamma_0 = \Gamma$.
Since, $\varphi \in C^1$ and since $\left.|\nabla \varphi|\right|_\Gamma = 1$ then from $(1)$ we have $$\left|\frac{1}{2r}\int_{V_r} f\,dx - \int_{\Gamma} f \,d\mathcal{H}^{n-1}\llcorner \Gamma\right| \le o(1) \tag{2}$$ with $o(1) \to 0$ as $r \to 0^+$.
Now, let us assume $f$ satisfies $\displaystyle \int_\Gamma f \,d\mathcal{H}^{n-1}\llcorner \Gamma = 0$ and prove the Poincare Inequality. Let us denote the average integral $\displaystyle \overline{f}_{V_r} = \frac{1}{|V_r|}\int_{V_r} f\,dx$. Then from $(2)$ we have $$\overline{f}_{V_r}^2 \le \frac{o(r^2)}{|V_r|^2}. \tag{3}$$
Using $f^2$ (instead of $f$) in the inequality $(2)$ and rearranging the triangle inequality we have
\begin{align*} \int_\Gamma |f|^2\,d\mathcal{H}^{n-1}\llcorner \Gamma - o(1) &\le \frac{1}{2r}\int_{V_r} f^2 \,dx \\ &\le \frac{1}{r} \left(\int_{V_r} \left(f - \overline{f}_{V_r}\right)^2\,dx + |V_r|\overline{f}_{V_r}^2\right) \tag{4}\\ &\le \frac{C_1}{r}\int_{V_r} |\nabla f|^2\,dx + \frac{o(r)}{|V_r|} \tag{5}\end{align*} where, we used the Poincare inequality for $\mathbb{R}^n$ to the first term in line $(4)$ to the function $(f - \overline{f}_{V_r})$ and inequality $(3)$ to the second term. I.e., we have the inequality
\begin{align*} \int_\Gamma |f|^2\,d\mathcal{H}^{n-1}\llcorner \Gamma \le \frac{C_1}{r}\int_{V_r} |\nabla f|^2\,dx + o(1) + \frac{o(r)}{|V_r|}. \tag{6}\end{align*}
Now, $|V_r| \sim \mathcal{H}^{n-1}(\Gamma) \times r$ (since, $|\nabla \varphi||_\Gamma = 1$) and from inequality $(2)$ with $|\nabla f|^2$ instead of $f$ we see that $$\frac{1}{2r}\int_{V_r} |\nabla f|^2 \,dx \to \int_{\Gamma} |\nabla f|^2\,d\mathcal{H}^{n-1}\llcorner \Gamma, \, \text{ as } r \to 0^+. \tag{7}$$
Therefore, letting $r\to 0^+$ in $(6)$ combined with $(0)$ we see that $$\int_\Gamma |f|^2\,d\mathcal{H}^{n-1}\llcorner \Gamma \le 2AC_1 \int_\Gamma |\nabla_\tau f|^2\,d\mathcal{H}^{n-1}\llcorner \Gamma.$$


text:
Q: c++ write vector elements to split files Given I have a vector<string> lines which contain all the lines read from a file, how can i then write the contents of the vector back to a file except split it by x many lines per file. I'm more so stuck with the chunking problem rather than writing back to file. An example would be if
int offset = 10000;
std::vector<std::string> lines(27000);

...assuming lines has been initialized with lines

given the above I should have
file1 : 10000
file2 : 10000
file3: 7000

A: Simple enough, you just need a loop and an if statement.
ofstream output;
string filename = "filename";
int fileNum = 0;

for(int i = 0; i < vec.size(); ++i){
    if(i % 10000 == 0){
        if(output.is_open()) output.close();
        output.open(filename + to_string(++fileNum));
    }
    output << vec.at(i);
}

output.close();

That will save files in "filename1", "filename2",  and "filename3" for a 27000 line file.
Disclaimer: Written free hand: may contain syntax errors.


text:
Q: Can Webkit JavaScript PUT or POST an image REST-style as pure binary? When my browser downloads an image from a web site, there is no base64 encoding involved. It issues an HTTP command like GET /image.jpg and receives an HTTP response whose Content-Type is something like image/jpg, whose Content-Length is the number of bytes in the image, and whose body is the raw binary image data itself. The data is neither encoded using a character set, nor encoded using a scheme like base64.
Writing RESTful resources has trained me to expect symmetry between HTTP GET and PUT so that, for example, a URL that delivers JSON data when I do a GET will then accept JSON data when it is presented with a PUT. In neither case is form encoding involved; in both cases there is simply a Content-Length giving the number of bytes in the payload, a Content-Type header declaring that the payload is JSON in some character set, and then the character data sits alone and unadorned as the body of the GET or PUT.
I am writing a PhoneGap application that lets users take photographs and them upload them using my application. I had expected that I could design a RESTful interface for this, that supports symmetric GET and PUT — so that PUT commands involve no special encoding, nor involve any idea of a character set, but simply have a Content-Type of image/jpg and then a mass of binary JPG data as their payload. Obviously this is a more efficient use of bandwidth than trying to encode the image inside of a form. And this approach works fine when I PUT to a URL using a tool like curl.
But I am having no luck in doing a clean RESTful PUT from PhoneGap WebKit JavaScript! PhoneGap is willing to return the image to my JavaScript as either a local file: URL, or else as a data: URL that carries the image data inline courtesy of base64 encoding. But in neither case can I find a clear way to convert the image into a pure binary format (would I use one of those newfangled Blob objects for this? if so, how?) and then cause a PUT that, without festooning the request with extra layers of form or encoding cruft, will simply transmit the raw image across the wire to my web server as the HTTP request payload.
Does anyone know how to induce WebKit to PUT an AJAX request with a raw image as its body? Thanks for any pointers — or even any useful answers to the effect that I am approaching this all wrong!

A: As for the binary image processing, the Binary File Inspector demo might be helpful as an end-to-end example.
There's some tutorial information on the subject of getting Blobs from the filesystem at MDN. This blog post describes how to turn a base64 URI into an ArrayBuffer and then a Blob.
Finally, either an ArrayBuffer or a Blob can be uploaded using the XMLHttpRequest2 interface.
The XHR2 spec seems to imply that PUT is supported, along with a bunch of other HTTP methods. So combining all this you could stuff files in Blobs and send them up using XHR2.

Untested code sample using the base64 decoding method with some help from base64-binary.js:
var BASE_64_PREFIX = "base64,";
function getBase64Content(base64Uri) {
   var index = base64Uri.indexOf(BASE_64_PREFIX);
   return base64Uri.substring(index + BASE_64_PREFIX.length);
}

function put(uri, data, onComplete) {
    var xhr = new XMLHttpRequest();
    xhr.open("PUT", uri, true);
    xhr.onload = onComplete;

    xhr.send(data);
}

var base64Uri = fromPhoneGap();
var base64Content = getBase64Content(base64Uri);
var arrayBuffer = Base64Binary.decodeArrayBuffer(base64Content);

put("/some/uri", arrayBuffer, function () {
    console.log("All done");
});

That said, I doubt much of this works on even the latest desktop WebKit, much less the version you're going to be saddled with via PhoneGap. You're probably not in good shape to take advantage of these draft specifications.


text:
Q: Cython 'module' object has no attribute In my pyx file, I defined two C functions and wrapped by python functions.
It's complied successfully and output a file with name Rand_Motion.cpython-34m.so.
However, I can't access either function defined in the pyx file in my main file with import Rand_Motion. This is my Rand_Motion.pyx:
cdef extern from "math.h":
    float cosf(float theta)
    float sinf(float theta)
    float acosf(float theta)
    float sqrt(float x)

cdef object randmotion_c(int Dimension,float Diffcoe, float pos_x,float pos_y, float pos_z,float drift_l,float drift_a,float drift_b,float a,float b):
    cdef float length=sqrt(2*Dimension*Diffcoe)
    cdef float pi= 3.1415926535
    cdef float e=  2.7182818284
    cdef float a_d=a*2*pi
    cdef float b_d=acosf(1-b*2)

    pos_x+=length*sinf(b_d) *cosf(a_d)
    pos_y+=length*sinf(b_d) *sinf(a_d)
    pos_z+=length*cosf(b_d)

    if  drift_l>0:
        drift_a=(drift_a/180)*pi
        drift_b=(drift_b/180)*pi
        pos_x+=drift_l*sinf(drift_a) *cosf(drift_b)
        pos_y+=drift_l*sinf(drift_a) *sinf(drift_b)
        pos_z+=drift_l*cosf(drift_a)
    return pos_x,pos_y,pos_z

def randmotion(Dimension,Diffcoe, pos_x,pos_y,pos_z,drift_l,drift_a,drift_b,a,b):

    return randmotion_c(Dimension,Diffcoe, pos_x,pos_y,pos_z,drift_l,drift_a,drift_b,a,b)

cdef dis_cal_c(float x,float y,float z):
    return sqrt(x*x+y*y+z*z)

def dis_cal(x,y,z):
    return dis_cal_c(x,y,z)

A: I copy/pasted your code in a aaa.pyx file, then I runned :
mgc@mgc-X:~/code/test$ cythonize aaa.pyx
mgc@mgc-X:~/code/test$ gcc -shared -fPIC -fwrapv -O2 -Wall -I/usr/include/python3.4 -o aaa.so aaa.c
mgc@mgc-X:~/code/test$ python3
Python 3.4.3 (default, Mar 26 2015, 22:03:40)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from aaa import randmotion, dis_cal
>>> dis_cal(1,2,3)
3.7416573867739413

and it seems working perfectly (note that I run python in the same directory as the shared object).
Maybe you want to install your shared library ? Take a look at cython documentation about compilation or at python documentation about installing modules.


text:
Q: Basic Java application data storage I'm working on (essentially) a calendar application written in Java, and I need a way to store calendar events. This is the first "real" application I've written, as opposed to simple projects (usually for classes) that either don't store information between program sessions or store it as text or .dat files in the same directory as the program, so I have a few very basic questions about data storage.

*

*How should the event objects and other data be stored? (.dat files, database of some type, etc)

*Where should they be stored?

*I'm guessing it's not good to load all the objects into memory when the program starts and not update them on the hard drive until the program closes. So what do I do instead?

If there's some sort of tutorial (or multiple tutorials) that covers the answers to my questions, links to those would be perfectly acceptable answers.
(I know there are somewhat similar questions already asked, but none of them I could find address a complete beginner perspective.)
EDIT: Like I said in one of the comments, in general with this, I'm interested in using it as an opportunity to learn how to do things the "right" (reasonably scalable, reasonably standard) way, even if there are simpler solutions that would work in this basic case.

A: For a quick solution, if your data structures (and of course the way you access them) are sufficiently simple, reading and writing the data to files, using your own format (e.g. binary, XML, ...), or perhaps standard formats such as iCalendar might be more suited to your problem. Libraries such as iCal4J might help you with that.
Taking into account the more general aspects of your question, this is a broader topic, but you may want to read about databases (relational or not). Whether you want to use them or not will depend on the overall complexity of your application.
A number of relational databases can be used in Java using JBDC. This should allow you to connect to the relational database (SQL) of your choice. Some of them run within their own server application (e.g. MS SQL, Oracle, MySQL, PostgreSQL), but some of them can be embedded within your Java application, for example: JavaDB (a variant of Apache Derby DB), Apache Derby DB, HSQLDB, H2 or SQLite.
These embeddable SQL databases will essentially store the data on files on the same machine the application is running on (in a format specific to them), but allow you to use the data using SQL queries.
The benefits include a certain structure to your data (which you build when designing your tables and possible constraints) and (when supported by the engine) the ability to handle concurrent access via transactions. Even in a desktop application, this may be useful.
This may imply a learning curve if you have to learn SQL, but it should save you the trouble of handling the details of defining your own file format. Giving structure to your data via SQL (often known by other developers) can be better than defining your own data structures that you would have to save into and read from your own files anyway.
In addition, if you want to deal with objects directly, without knowing much about SQL, you may be interested in Object-Relational Mapping frameworks such as Hibernate. Their aim is to hide the SQL details from you by being able to store/load objects directly. Not everyone likes them and they also come with their own learning curve (which may entail learning some details of how SQL works too). Their pros and cons could be discussed at length (there are certainly questions about this on StackOverflow or even DBA.StackExchange).
There are also other forms of databases, for example XML databases or Semantic-Web/RDF databases, which may or may not suit your needs.

A:
How should the event objects and other data be stored? (.dat files,
  database of some type, etc)

It depends on the size of the data to be stored (and loaded), and if you want to be able to perform queries on your data or not.

Where should they be stored?

A file in the user directory (or in a subdirectory of the user directory) is a good choice. Use System.getProperty("user.home") to get it.

I'm guessing it's not good to load all the objects into memory when
  the program starts and not update them on the hard drive until the
  program closes. So what do I do instead?

It might be a perfectly valid thing to do, unless the amount of data is so great that it would eat far too much memory. I don't think it would be a problem for a simple calendar application. If you don't want to do that, then store the events in a database and perform queries to only load the events that must be displayed.

A: A simple sequential file should suffice. Basically, each line in your file represents a record, or in your case an event. Separate each field in your records with a field delimiter, something like the pipe (|) symbol works nice. Remember to store each record in the same format, for example:
date|description|etc

This way you can read back each line in the file as a record, extract the fields by splitting the string on your delimiter (|) symbol, and use the data.
Storing the data in the same folder as your application should be fine.
The best way I find to handle the objects (for the most part), is to determine whether or not the amount of data you are storing is going to be large enough to have consequences on the user's memory. Based on your description, it should be fine in this program.

A: The right answer depends on details, but probably you want to write your events to a database. There are several good free databases out there, like MySQL and Postgres, so you can (relatively) easily grab one and play with it.
Learning to use a database well is a big subject, bigger than I'm going to answer in a forum post. (I could recommend that you read my book, "A Sane Approach to Database Design", but making such a shameless plug on a forum would be tacky!)
Basically, though, you want to read the data from the database when you need it, and update it when it changes. Don't read everything at start up and write it all back at shut-down.
If the amount of data is small and rarely changes, keeping it all in memory and writing it to a flat file is simpler and faster. But most applications don't fit that description.


text:
Q: How to read multiple qr codes from one image using zxing library I am currently developing a scanner that reads multiple QR codes found in one image.
I manage to read the QR codes in the image but it's giving me inconsistent results. Assuming there are 4 QR codes in the image, sometimes I can read 2 and sometimes 3 or just 1. Unlike in the original scanner (ZXing Scanner) it decodes fast. While in my case, I have to make sure there is enough light and the image is not blurred to decode it.
I am using the QRCodeMultiReader to decode the image. Currently using ZXing Library to create the application.
Below is the snippet of my code:
public void onPictureTaken(byte[] data, Camera camera) {
   BitmapFactory.Options opt = new BitmapFactory.Options();
    opt.inMutable = true;
   Bitmap bitmap = BitmapFactory
            .decodeByteArray(data, 0, data.length, opt);
   Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
   hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
   LuminanceSource source = new RGBLuminanceSource(bitmap);

   QRCodeMultiReader multiReader = new QRCodeMultiReader();
   Result[] results = multiReader.decodeMultiple(new BinaryBitmap(
   new HybridBinarizer(source)), hints);
}

A: i have created one app for camera i have used intent as the default Camera app is there with every Andriod OS and generally they are better optimized for that device than writing a generic Camera app which would be optimized for your phone only...so for camera better use intent.
For Extracting multiple QR from a Single image i tried the code below.
But results are not consistent some time I get 1 or 2 or 3 out of 4 some time none....its not perfect solution
if(photo == null)
        return;
    Bitmap ScaledQr = null;
    ScaledQr = Bitmap.createScaledBitmap(photo, 640,480, false);
    BinaryBitmap Qr = BitMap2BinayBitmap(ScaledQr);
    Result [] kpResultMulti = null;
    Result kpResultSingle = null;
    Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
    hints.put(DecodeHintType.TRY_HARDER, true);
    //hints.put(DecodeHintType.PURE_BARCODE, true);

    try {
        kpResultMulti = kpReaderArr.decodeMultiple(Qr,hints);
    } catch (NotFoundException e) {
        // TODO Auto-generated catch block
        msbox("Exception","NotFoundException");
        e.printStackTrace();
    }

    if(kpResultMulti != null){
        msbox("Total Result" ,kpResultMulti.length +"");// + photo.getWidth() +     "Height=" + photo.getHeight());
        for(Result kp : kpResultMulti)
        {

            msbox("Results",kp.getText());
        }
    }

A: Hello please check in the Zxing Barcode Scanner app it has option in Settings to Scan Bulk Barcodes so u enable it and check it u can read Multiple QR codes at a time from one or more Images and also check the Source code of Zxing library to Known the detailed Information .
https://code.google.com/p/zxing/


text:
Q: What is meant by 'variational structure'? Consider
$$
u_t=D\Delta u+f(x,u,\nabla u)~~(*).
$$
In a script it is said:

We first consider the variational structure which makes $(*)$ an $L^2$-gradient flow.

I have two questions to this:
1.) What is meant with variational structure?
2.) What is an $L^2$-gradient flow and in which sense is $(*)$ an $L^2$-gradient flow?

A: Finding a variational structure here means finding a functional such that the PDE is the gradient flow of that functional.
The gradient flow of a functional $\psi :V\to \mathbb {R} $ is the differential equation
$$
u_t=-\text{grad}_u\psi.
$$
That is, at each point of time the gradient flow changes $ u $ infinitesimally to achieve a minimization of $\psi $ (remember that the gradient gives the direction of steepest ascent,  so the negative gradient gives the direction of steepest descent)
For example, when $\psi $ is linear, the solution of the gradient flow has constant velocity, because the gradient is constant.
A more useful example is $ V $ being the Sobolev space $ H^1(\mathbb{R}^n)$ and $\psi(u)=\int |\nabla u|^2$ (nonlinear! ). You can calculate using Greens theorem that the gradient flow here is the heat equation. However,  there are technicalities involved: when you say "direction of steepest descent" you imply that you are considering directions in a certain normed space. If you considered the Sobolev space here,  then you would get $ u_t=-u $. You get the heat equation only if you consider the space $ L^2$ as space of allowed directions and use formal calculations, but strictly speaking the functional is not defined for $ u+hv $ when $ u $ is a Sobolev function, $ v\in L^2$ and $ h> 0$.


text:
Q: Spring boot jpa interface - make custom query I have such a Interface:
interface ItemRepository extends JpaRepository<Item, Integer> {
    Item findItemByName(String name);
    Collection<Item> findItemByCategory(String category);
}

it does the job without implementation already, but I have to add the following statement:
select from Item where quantity < 10;

A: Spring Data JPA supports the LessThan keyword inside method names. In your case, the signature of the method would be:
Collection<Item> findItemByQuantityLessThan(int upperBound);

You can then call this method giving it 10 as parameter to have your result.

A: You can use LessThan identifier or use a custom query like this :
@Query("SELECT i FROM Item i WHERE i.quantity < :quantity")
public List<Item> findByCategory(@Param("quantity") int quantity);


text:
Q: Unable to retrieve yahoo email using lightopenid I am trying to incorporate openid authentication using LightOpenID. i modified the discovery url in example-google.php for integrating with yahoo! but i am not getting any attributes (i am at least able to fetch the email id with google.).
http://pastebin.com/08RzvsGy

A: Just for any others searching night and day for the simple answer of retrieving a email address returned from lightopenid.  THANKS FOR POSTING YOUR CODE.  IT HELPED.  In case others don't click your link.  here is the code from your page above that allows for the transfer of email addresses.
$openid->required = array('contact/email');

// optional data
$openid->optional = array('namePerson','namePerson/friendly','birthDate','person/gender');


text:
Q: Transfer Microsoft Access like statement to postgresql The original query is for an ms-access db table and contains a like statement which I can not run on the same table transfered to postgresql.
The sql statement:
SELECT Table1.property1, Table1.property2
FROM Table1, Table2
WHERE (((Table2.NAME) Like "*" & [Table1]![property2] & "*"));

property2 is the name of the column. How can I keep the same logic and transfer the sql statement so it works with postgresql?