text:
Q: multidimensional array using $array[] When reading the php manual on array push i found that it suggest using $array[]=$push to enter new entries.
so my question is how would I go about using this with multidimensional arrays in the most efficient way ie speed.
Examlple 1:
 $client[] = (0);
 $client[] = (1);
 $client[] = (2);
 $client[] = (3);
 $array[$i++]=$client;
 unset($client);

Example 2:
$array[$i++]= array(0,1,2,3);

Example 3: Note: I dont currently know of a good way to set the array key on this one
$entry = array(0,1,2,3);
array_push($array,$entry);

The 4 values nested in the array will be updated very frequently. To do this I would assume using the following method would be my best choice regarding speed and efficiency.
 $array[0][0]= $array[1][0]+1;

Spelling it out: I have individual clients with unique identifiers. I need to keep track of 4 integers for each client. I'm looking to the fastest/uses the lowest resources method.
All in all ill take any suggestion but im curious if example 1 is any better in terms of speed and resources then example 2.
Thanks,
JT
ACTUAL CODE To TEST:
<?php
$array = array();

$i=0;
$t1 = microtime(true);
while ($i<10000){
$array[$i++]= array(0,1,2,3);
}
$time1 = microtime(true) - $t1;
$mem1 = memory_get_peak_usage(true);

//print_r($array);
$array = array();
//echo '

';

$i=0;
$t2 = microtime(true);
while ($i<10000){
$client[] = (0);
$client[] = (1);
$client[] = (2);
$client[] = (3);
$array[$i++]=$client;
unset($client);
}
$time2 = microtime(true) - $t2;
$mem2 = memory_get_peak_usage(true);

//print_r($array);
$array = array();
//echo '

';

$i=0;
$t3 = microtime(true);
while ($i++<10000){
$entry = array(0,1,2,3);
array_push($array,$entry);
}
$time3 = microtime(true) - $t3;
$mem3 = memory_get_peak_usage(true);

//print_r($array);
//echo '

';

print 'example 1 - ' . $time1 . ' - ' . $mem1 . '
';
print 'example 2 - ' . $time2 . ' - ' . $mem2 . '
';
print 'example 3 - ' . $time3 . ' - ' . $mem3 . '
';
?>

RESULTS:
example 2 - 0.212869294 S
example 1 - 0.251849988 S
example 3 - 0.748561144 S
So the array push is a NO GO!
This was the average of about 15 runs with each loop counting to 100*1000 :)

A: here is a quick dirty test for this
<?php
$t1 = microtime(true);

$array = array();

for ($i = 0; $i < 100000; $i++) {
  $client[] = (0);
  $client[] = (1);
  $client[] = (2);
  $client[] = (3);
  $array[]=$client;
  unset($client);
}

$time1 = microtime(true) - $t1;
$mem1 = memory_get_peak_usage(true);

$array = array();
$t2 = microtime(true);

for ($i = 0; $i < 100000; $i++) {
  $array[] = array(0=>array(0,1,2,3));
}

$time2 = microtime(true) - $t2;
$mem2 = memory_get_peak_usage(true);

$array = array();
$t3 = microtime(true);

for ($i = 0; $i < 100000; $i++) {
  $array[] = [0=>array(0,1,2,3)];
}

$time3 = microtime(true) - $t3;
$mem3 = memory_get_peak_usage(true);

print 'example 1 - ' . $time1 . ' - ' . $mem1 . '
';
print 'example 2 - ' . $time2 . ' - ' . $mem2 . '
';
print 'example 3 - ' . $time3 . ' - ' . $mem3 . '
';

for me i found that the first example was the least time efficient but the most memory efficient and that example 3 slightly out performed 2 in time but was equal in memory


text:
Q: swiper button style with styled-components I want to replace button style with a style-component
What is the way?
<SC.CarouselBox
        loop={true}
        cssMode={true}
        navigation={true}
        mousewheel={true}
        keyboard={true}
        slidesPerView={1}
        pagination={{
          "clickable": true
        }}
        className="mySwiper"
      >
        <SC.CarouselBlur></SC.CarouselBlur>
        {sliderItems.map((item, i) =>  (
          <SwiperSlide
           <img src={item.img}/>
          </SwiperSlide>
        ))}
      </SC.CarouselBox>

i am add swiper components in styled-components, because i want change swiper style
but I can not add a button because the button is not given as a component
const CarouselBox = styled(Swiper)`
  width: 100%;
  height: 100%;
  display: inline-grid;
`;

const Btn = styled('button')`
  bottom: 10px;
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(50px);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  cursor: pointer;
  z-index: 2;
  outline: none;
  border: none;
`;

A: I used a separate button:
navigation={{
   nextEl: ".swiper-next",
   prevEl: ".swiper-prev",
}}

<SC.Btn className="swiper-next">
   next
</SC.Btn>
<SC.Btn className="swiper-prev">
   back
</SC.Btn>

A: The correct syntax is slightly different. You don't need to wrap your button in brackets like a string. Instead you should write your code like this:
const Btn = styled.button`
  bottom: 10px;
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(50px);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  cursor: pointer;
  z-index: 2;
  outline: none;
  border: none;
`;

redpajama_set_name: RedPajamaStackExchange


text:
Q: Jeffreys' Prior for Log Odds If you have a binomial likelihood, $y|n,p\sim\textsf{Bin}(n,p)$, the Jeffreys' prior for the proportion $p$ is $\textsf{Beta}(1/2,1/2)$. If we instead reparameterize the proportion as the log odds $\phi=\log(p/1-p)$, through a change of variables we arrive at the pdf for $\phi$: $p(\phi)=\frac{1}{\pi}\sqrt{\frac{e^{\phi}}{(1+e^{\phi})^2}}$ (assuming I didn't do the math wrong). My question is does this distribution have a name? It looks related to the logistic distribution but I'm not sure how.
It's weird because most introductory sources on Jeffreys' priors use a binomial likelihood with uniform priors on $p$ and $\phi$ to motivate the desire for invariance under 1-1 transformations, find the Jefrreys' prior for $p$, but then don't actually look at what this corresponds to in the log odds parametrization.

A: If $p \sim \text{Beta}(a,b)$, then $T = p/(1-p)$ has a Pearson Type VI distribution, also known as a beta-prime, inverted beta, or beta distribution of the second kind, so I suppose you could call the distribution of $\log T$ a log beta-prime distribution.
N. L. Johnson in "Systems of frequency curves generated by methods of translation", Biometrika, 36, in 1949 (online access required, but registration is free), looked at the distribution of $\log p/(1-p)$ briefly (p. 166) in the context of transforming Pearson Type I distributions, which are a generalization of the Beta distribution, and derived several properties which, I am sorry to say, are mainly of historical interest.  In the context of his work, it would be referred to as an application of the $S_B$ transform to a Pearson Type I variate with (original parameterization) $\xi = 0, \lambda = 1$, so "log beta-prime distribution" seems better.
I don't know whether $a = b = 1/2$ results in a special distribution with its own name, though!

A: Answering my own question over 2 years later, but it turns out that this distribution lies in the family of z-distributions, see the bottom of page 150 of Barndorff-Nielsen et al. 1982: https://www.jstor.org/stable/1402598?seq=1. If anyone else is interested in how I found this out, this family of distributions arises in the study of global-local shrinkage priors in the Bayesian analysis of regression problems, see e.g. https://arxiv.org/abs/1707.00763.


text:
Q: How to switch from root to user in Ubuntu running in Termux? I recently installed Ubuntu via Termux on my android phone.
This version is specified when I enter the username and password.
Welcome to Ubuntu 20.04.2
I once went from root to user mode by adduser
root@localhost:~# <USER>@localhost:~#
But now I do not know how to switch to this mode again.
How to switch from root@localhost:~# to <USER>@localhost:~#

A: To switch to an user with username john, enter the command
su john

And the prompt would change from # to $ (root to ordinary user).
To get back to root, type exit.


text:
Q: Bottle upload xlsx and process with xls2db I am looking to grab a xlsx file from a bottle upload and send the file to the xls2db module to populate a sqlite db but I don't seem to be passing the file properly.
#
     @route('/',method="GET")   # Select the xls sheet from this route
def testRoute():
    return ('''

 Select the spreadsheet

           <form action="/upload" method="post" enctype="multipart/form-data">
            <input type="text" name="name" />
            <input type="file" name="data" />

            <input type="submit"/>
       </form>  ''')

@route('/upload', method='POST')
def do_upload():
    name = request.forms.name
    data = request.files.data
    if name and data and data.file:
        raw = data.file.read() # This is dangerous for big files
        filename = data.filename
        #return "Hello %s! You uploaded %s (%d bytes)." % (name,   filename, len(raw))
        upload_xls(raw, filename)

connect to database drop the tables if they exist and convert xls sheet to sqlite database
def upload_xls(raw, filename):
    conn = sqlite.connect("test_db.sqlite")
    cur = conn.cursor()
    f = filename
    data = raw
    cur.execute("DROP TABLE IF EXISTS Requests;")
    cur.execute("DROP TABLE IF EXISTS Complaints;")
    xls2db(data , "test_db.db")
    redirect("/work")

UPDATE - I am now getting this error.
    2016-02-16 22:16:55 ERROR:root:Traceback (most recent call last):
    2016-02-16 22:16:55 ERROR:root:  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 764, in _handle
    2016-02-16 22:16:55 ERROR:root:    return route.call(**args)
    2016-02-16 22:16:55 ERROR:root:  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 1575, in wrapper
   2016-02-16 22:16:55 ERROR:root:    rv = callback(*a, **ka)
   2016-02-16 22:16:55 ERROR:root:  File "/home/mcsl/mysite/bottle_app.py", line 91, in do_upload
   2016-02-16 22:16:55 ERROR:root:    upload_xls(file_path)
   2016-02-16 22:16:55 ERROR:root:  File "/home/mcsl/mysite/bottle_app.py", line 22, in upload_xls
   2016-02-16 22:16:55 ERROR:root:    xls2db(file_name, "test_db.db")
   2016-02-16 22:16:55 ERROR:root:  File "/home/mcsl/.local/lib/python2.7/site-packages/xls2db/__init__.py", line 29, in xls2db
  2016-02-16 22:16:55 ERROR:root:    wb = xlrd.open_workbook(infile)
  2016-02-16 22:16:55 ERROR:root:  File "/usr/local/lib/python2.7/dist-packages/xlrd/__init__.py", line 435, in open_workbook
  2016-02-16 22:16:55 ERROR:root:    ragged_rows=ragged_rows,
  2016-02-16 22:16:55 ERROR:root:  File "/usr/local/lib/python2.7/dist-packages/xlrd/book.py", line 87, in open_workbook_xls
  2016-02-16 22:16:55 ERROR:root:    ragged_rows=ragged_rows,
  2016-02-16 22:16:55 ERROR:root:  File "/usr/local/lib/python2.7/dist-packages/xlrd/book.py", line 594, in biff2_8_load
  2016-02-16 22:16:55 ERROR:root:    raise XLRDError("File size is 0 bytes")
 2016-02-16 22:16:55 ERROR:root:XLRDError: File size is 0 bytes

I can upload the file and I can now see it on the server but when I pass it to the function it is reporting that its empty.
    @route('/upload', method='POST')
    def do_upload():
        data = request.files.upload
        upload = request.files.get('upload')
        name, ext = os.path.splitext(data.filename)
        #check the file is an excel file
        if ext not in ( '.xls', '.xlsx'):
            return "File extension not allowed."

            save_path = "/home/mcslo/mysite".encode("utf-8")
            file_path= "{path}/{file}".format(path=save_path,        file=data.filename)
            raw = data.file.read() # This is dangerous for big file

           open_file = open(file_path, 'w')
           open_file.write(raw)
           open_file.close
           upload_xls(file_path)

    def upload_xls(file_name):
file_name = file_name
conn = sqlite.connect("test_db.sqlite")
cur = conn.cursor()
cur.execute("DROP TABLE IF EXISTS Requests;")
cur.execute("DROP TABLE IF EXISTS Complaints;")
xls2db(file_name, "test_db.db")
redirect("/work")


text:
Q: No updating collection in mongodb I use 0.6.4.  Don't work Collection.update(t.data._id, { $set: { name: e.currentTarget.value}}); Session.set("edit-" + t.data._id, false);.

A: I'd recommend using jQuery to extract the value: $(e.currentTarget).val(). Also, assuming the person template is rendered from an {{#each people}}, you could probably just do this._id, but it's hard to tell without seeing the templates.
People.update(this._id, { $set: { name: $(e.currentTarget).val()}});

I'd also suggest logging these values to the console before the update to make sure the callback is getting executed and that you are reading the right values.


text:
Q: JavaFx App on 64 bit Win 7 platform I wrote a JavaFx app (JavaFx windows based form) on my desktop running

*

*Win 7 32 Bit

*Netbeans 7.3 Beta

*jdk-7u9-windows-i586

and it runs successfully.
I recently got a laptop running

*

*Win 7 64 Bit

*Netbeans 7.3 Beta

*jdk-7u9-windows-x64

I just copied the code over and switch the Java Platform.... currently its set to the default "Default JavaFx Platform".
If i run the app I get the following error dialog
JavaFx launcher error - Exception while running Application
Anyone know what I need to change here...
Full stack trace when running application
ant -f "C:\\DEV\\Projects\\Java Apps\\BaseAppPlatform" jfxsa-run
init:
Deleting: C:\DEV\Projects\Java Apps\BaseAppPlatform\build\built-jar.properties
deps-jar:
Updating property file: C:\DEV\Projects\Java Apps\BaseAppPlatform\build\built-jar.properties
compile:
Detected JavaFX Ant API version 1.2
Launching <fx:jar> task from C:\Program Files\Java\jdk1.7.0_09\lib\ant-javafx.jar
Signing JAR: C:\DEV\Projects\Java Apps\BaseAppPlatform\dist\BaseAppPlatform.jar to C:\DEV\Projects\Java Apps\BaseAppPlatform\dist\BaseAppPlatform.jar as nb-jfx

Warning:
The signer certificate will expire within six months.
Enter Passphrase for keystore: Enter key password for nb-jfx:
Launching <fx:deploy> task from C:\Program Files\Java\jdk1.7.0_09\lib\ant-javafx.jar
jfx-deployment-script:
jfx-deployment:
jar:
Copying 12 files to C:\DEV\Projects\Java Apps\BaseAppPlatform\dist\run858846669
jfx-project-run:
Executing com.javafx.main.Main from C:\DEV\Projects\Java Apps\BaseAppPlatform\dist\run858846669\BaseAppPlatform.jar using platform C:\Program Files\Java\jdk1.7.0_09/bin/java
java.lang.ClassNotFoundException: co.za.chrispie.LoginController
file:/C:/DEV/Projects/Java%20Apps/BaseAppPlatform/dist/run858846669/BaseAppPlatform.jar!/BaseAppPlatform/Login.fxml:9
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:728)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:777)
at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:182)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:565)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2314)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2131)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2742)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2721)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2707)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2694)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2683)
at BaseAppPlatform.BaseAppPlatform.start(BaseAppPlatform.java:21)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
at java.lang.Thread.run(Thread.java:722)

Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.javafx.main.Main.launchApp(Main.java:642)
at com.javafx.main.Main.main(Main.java:805)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:403)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Thread.java:722)
Caused by: javafx.fxml.LoadException: java.lang.ClassNotFoundException: co.za.chrispie.LoginController
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:728)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:777)
at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:182)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:565)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2314)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2131)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2742)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2721)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2707)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2694)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2683)
at BaseAppPlatform.BaseAppPlatform.start(BaseAppPlatform.java:21)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
... 1 more
Caused by: java.lang.ClassNotFoundException: co.za.chrispie.LoginController
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:726)
... 19 more

A: Judging by java.lang.ClassNotFoundException: co.za.chrispie.LoginController you missed few code or dependent library while copying.
Find java or jar file responsible for class co.za.chrispie.LoginController and make sure:

*

*it exists on your laptop

*it's in the correct location package-wise

*it's included into your new project (sources folder)


text:
Q: change laravel 5 login link I want to change all the link of auth/login to my-login/login (associated with the login, register, reset password), how to do it?
I already changed the auth to my-login from Route::controllers array in the routes.php and
return redirect()->guest('auth/login');

to
return redirect()->guest('my-login/login');

in the Middleware/Authenticate.php and also action="{{ url('/auth/login') }}" to action="{{ url('/my-login/login') }}" but sadly when I press the login button in the login form, I got this error
Sorry, the page you are looking for could not be found. 1/1 NotFoundHttpException in compiled.php line 7693:

and the link changed to /auth/login (expecting /my-login/login).
Any help, suggestions, recommendations would be greatly appreciated. Thank you!
PS: this is the default login, register, reset thing that is already default when installing laravel 5, I just kinda modified it a little.

A: In this situation the only thing you have to do is change the auth controller route in app/Http/routes.php file like this:
Route::controllers([
    'my-login' => 'Auth\AuthController',
    'password' => 'Auth\PasswordController',
]);

If you would like it to be just "domain.tld/login" just change 'my-login' to '/'
Hope it helps.

A: I believe this address is hard-coded in the view, at resources/views/auth/login.blade.php. You'll want to update the <form> action.


text:
Q: eliminar titulos filtrando resultados tengo un filtro de resultados pero necesito que al escribir en el recuadro de búsqueda los títulos desaparezcan; justo como lo que hace el código a continuación:

$(document).ready(function () {
    (function ($) {
        $('#buscar').keyup(function () {
            var rex = new RegExp($(this).val(), 'i');
            $('#aBuscar p').hide();
            $('#aBuscar p').filter(function () {
    return rex.test($(this).text());
   }).show();
  })
 }(jQuery));
});

<input id="buscar" placeholder="Buscar">

Titulo0

buscar

encontrar

Titulo1

correr

detenerse

La función la utilice de la respuesta de otro usuario pero solo falta que me oculte los títulos al comenzar a escribir en el recuadro de búsqueda y luego que los muestre cuando se borre todo el contenido del recuadro de búsqueda.
Agradeciendo de antemano su ayuda.

A: Sólo tenía que verificar si el campo de búsqueda estaba vacío o no; de no estarlo simplemente oculto los títulos.

$(document).ready(function () {
    (function ($) {
        $('#buscar').keyup(function () {
            var rex = new RegExp($(this).val(), 'i');
            $('#aBuscar p').hide();
            $('#aBuscar p').filter(function () {
    return rex.test($(this).text());
   }).show();
   if ($('#buscar').val() == "") {
    $('#aBuscar h1').show();
    return false;
   } else {
    $('#aBuscar h1').hide();
   }
  })
 }(jQuery));
});

<input id="buscar" placeholder="Buscar">

Titulo0

buscar

encontrar

Titulo1

correr

detenerse

Realmente sencillo, sólo necesitaba un poco de iluminación.


text:
Q: Find the two largest numbers passed on the stack and multiply them, return DX:AX pair I have an assignment where we are passed 4 values on the stack (v1, v2, v3, v4), are to find the two largest values out of the four, and then multiply them together to return the DX:AX pair.
This is the code that I have come up with so far, comparing all the values to one another and storing the highest value in AX and the second highest value in BX. The problem is that the code hangs when tested in DOSbox, and I'm not sure what is causing it.
EDIT: Finished and working!
;---------------------------------------
;
; Code Segment
;
;---------------------------------------
_linkhll:

    push bp     ; saves the caller's bp
    mov bp,sp   ; loads bp from sp

      MOV AX,[bp+4] ;Load v1 to AX
      MOV BX,[bp+6] ;Load v2 to BX
;---------------------------------------
; Find the first largest number
;---------------------------------------

   CMP AX,BX        ;compare value 1 and 2
      JE doubles
      CMP AX,BX
      JA  L2        ;AX > BX, goto L2
      MOV AX,BX     ;make v2 the largest number

   L2:MOV BX,[bp+8] ;Load v3 to BX
      CMP AX,BX     ;compare value AX and v3
      JE doubles
      CMP AX,BX
      JA  L3        ;AX > BX, goto L3
      MOV AX,BX     ;make v3 the largest number

   L3:MOV BX,[bp+10]    ;Load v3 to BX
      CMP AX,BX     ;compare value AX and v4
      JE doubles
      JA  S1        ;AX > BX, goto L3
      MOV AX,BX     ;make v4 the largest number
      JMP s1

doubles:
      MOV CX,[bp+8] ;mov v3 to cx
      CMP AX,CX     ; BX > CX
      JA  v4bigger  ; yes, skip to v4 test
      MOV AX,CX     ;if no, make CX the new AX
v4bigger:
      MOV CX,[bp+10]    ;v4 to CX
      CMP BX,CX     ;Compare to current highest
      JA mult
      MOV BX,CX
      JMP mult

;---------------------------------------
; Find the second largest number
;---------------------------------------

   S1:MOV BX,[bp+4] ;Load v1 to BX
      MOV CX,[bp+6] ;load v2 to CX
      CMP AX,BX     ;compare value AX and v1
      JE  v2mov     ;AX = BX, multiply them
      CMP AX,CX     ;compare value AX and v2
      JE  s2        ;AX = CX, mov cx to bx and multiply
      CMP BX,CX     ;Compare v1 and v2
      JA  S2        ;BX > CX goto S2
v2mov:
      MOV BX,CX     ; make v2 the current second highest

   S2:MOV CX,[bp+8] ;load v3 to CX
      CMP AX,CX     ;compare value AX and v3
      JE  s3        ;AX = CX, goto S3
      CMP BX,CX     ;Compare AX and v3
      JA  S3        ;BX > CX goto S3
v3mov:
      MOV BX,CX     ;mov v3  to 2nd highest number spot

   S3:MOV CX,[bp+10]    ;load v4 to CX
      CMP AX,CX     ;compare value AX and v4
      JE  mult      ;AX = CX, goto S3 // mult????
      CMP BX,CX     ;Compare AX and v3
      JA  mult      ;BX > CX goto S3
v4mov:
      MOV BX,CX     ;Make v4 second highest number

mult:
      MUL BX        ;multiply ax by bx

      POP BP

                               ;
                                       ;
                                       ;
         ret                           ;
                                       ;
         end                           ;
;---------------------------------------

A: You're pushing bp on the stack at the start of your function. But you don't pop it off the stack before returning. Hence, when the ret instruction executes and tries to get the return address off the stack it gets the old value of bp instead.


text:
Q: OpenMP Uninitialized values and Valgrind I'm having some problems using Valgrind to check for memory leaks (and also to understand a segfault I'm getting in fprintf), but it seems that somehow there are a couple o uninitialized values used that does not come from my code.
I'm new to debugging with debuggers so I may be missing something.
I know Valgrind is not confortable with my default GCC OpenMP (http://valgrind.org/docs/manual/drd-manual.html#drd-manual.openmp), but I'm using it and compilimg my code with -pedantic -Wall -static -O0 -g -fopenmp I get no errors.
However, when running Valgrind with
valgrind --leak-check=full --track-origins=yes --error-limit=no --log-file=./logfile ~/developing/trunk/gop.exe

I get in my logfile a lot of  warnings starting with
==5944== Memcheck, a memory error detector
==5944== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==5944== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==5944== Command: /home/henrique/developing/trunk/gop.exe
==5944== Parent PID: 11534
==5944==
==5944== Syscall param set_robust_list(head) points to uninitialised byte(s)
==5944==    at 0x4983DF: __pthread_initialize_minimal (nptl-init.c:369)
==5944==    by 0x498920: (below main) (libc-start.c:146)
==5944==  Address 0x4000bf0 is not stack'd, malloc'd or (recently) free'd
==5944==  Uninitialised value was created
==5944==    at 0x513A6A: brk (brk.c:32)
==5944==    by 0x4ED4EB: sbrk (sbrk.c:54)
==5944==    by 0x498C13: __libc_setup_tls (libc-tls.c:150)
==5944==    by 0x498366: __pthread_initialize_minimal (nptl-init.c:296)
==5944==    by 0x498920: (below main) (libc-start.c:146)

And then getting a lot of warnings (thousands!) similar to the one below
==5944== Conditional jump or move depends on uninitialised value(s)
==5944==    at 0x4EF546: __linkin_atfork (register-atfork.c:119)
==5944==    by 0x4BA5D3: ptmalloc_init (arena.c:388)
==5944==    by 0x4BB283: malloc_hook_ini (hooks.c:32)
==5944==    by 0x51842B: _dl_init_paths (dl-load.c:732)
==5944==    by 0x4F097A: _dl_non_dynamic_init (dl-support.c:268)
==5944==    by 0x4F1352: __libc_init_first (init-first.c:83)
==5944==    by 0x49895B: (below main) (libc-start.c:165)
==5944==  Uninitialised value was created
==5944==    at 0x513A6A: brk (brk.c:32)
==5944==    by 0x4ED4EB: sbrk (sbrk.c:54)
==5944==    by 0x498C13: __libc_setup_tls (libc-tls.c:150)
==5944==    by 0x498366: __pthread_initialize_minimal (nptl-init.c:296)
==5944==    by 0x498920: (below main) (libc-start.c:146)

Am I missing something when compiling or running Valgrind? Or my code really have all these errors?
Thank you very much!

A: Some libraries do have a lot of little warnings like the ones you are showing.
I don't think they come from your code here seeing the names of the files where they occur.
You'll have to look somewhere else for your segfault. Try running it with gdb, look where it stops and print values around the error to see what's up.
Hope it helps :)


text:
Q: Deactivate hover state on table rows in Bootstrap Table Is there a way to deactivate the hover state on table rows in Bootstrap Table?
It automatically set's it there...

A: The default CSS class of the table is 'table table-hover'. Simply remove the table-hover class to remove the effect.
You can remove the hover effect globally for all tables: http://jsfiddle.net/e3nk137y/1437/
$.extend($.fn.bootstrapTable.defaults, {classes:'table'});

For a single table, you can set data-classes="table": http://jsfiddle.net/e3nk137y/1436/
<table id="table" data-classes="table">


text:
Q: Cytoscape Graph is not showing I am trying to show a cytoscape graph in an ext window.
Everything is working well, until i add the ext-all.css, the graph is no longer displayed.
This is the panel were the graph is supposed to be shown ( the #cy div)
 var formPanel2 = new Ext.form.FormPanel({
            id : 'graph_model',
            bodyStyle : 'padding:10px',
            width :400,
            height : 400,
            overflow:'auto',
            items : [ {
                    html: "

",
                    xtype: "panel"} ]
  });

where is the problem ?


text:
Q: Verification of a deep mock via mockContstructor fails In a test I want to verify that a model would call a client when a method of this model is called.
The class under test - the model class - is an object singleton. (KubernetesResourceModel.kt)
object KubernetesResourceModel {
…
    private fun createClient(): NamespacedKubernetesClient {
        return DefaultKubernetesClient(ConfigBuilder().build())
    }

The actual call to the client - DefaultKubernetesClient - happens in an instance variable within KubernetesResourceModel (Cluster.kt)
class Cluster(val client: NamespacedKubernetesClient) {
...
    private fun loadAllNameSpaces(): Sequence<Namespace> {
        return  client.namespaces().list().items.asSequence()
    }

In my test I stub the client and then verify that a call to the client library is executed when KubernetesResourceModel.getAllNamespaces is called,  (KubernetesResourceModelTest.kt):
    @Test
    fun `should call list namespaces on client`() {
        // given
        mockClient(emptyList())
        // when
        KubernetesResourceModel.getAllNamespaces()
        // then
        verify { anyConstructed<DefaultKubernetesClient>().namespaces().list().items }
    }
...
    private fun mockClient(namespaces: List<Namespace>) {
        // client.namespaces().list().items.asSequence()
        mockkConstructor(DefaultKubernetesClient::class)
        every { anyConstructed<DefaultKubernetesClient>().namespaces() } returns
                spyk {
                    every { list() } returns
                            spyk {
                                every { items } returns
                                        namespaces
                            }
                    every { watch(any()) } returns
                            mockk()
                }

The mocking works and I see KubernetesResourceModel.getAllNamespaces() returning the empty list that I passed along when mocking (mockClient(emptyList())).
Unfortunately the verification
verify { anyConstructed<DefaultKubernetesClient>().namespaces().list().items } (KubernetesResourceModelTest.kt)
fails telling me that no call on client.namespaces().list() happened:
Verification failed: call 2 of 3: NonNamespaceOperation(child of mockkConstructor<DefaultKubernetesClient>()#1).list()) was not called
java.lang.AssertionError: Verification failed: call 2 of 3: NonNamespaceOperation(child of mockkConstructor<DefaultKubernetesClient>()#1).list()) was not called
    at io.mockk.impl.recording.states.VerifyingState.failIfNotPassed(VerifyingState.kt:66)
    at io.mockk.impl.recording.states.VerifyingState.recordingDone(VerifyingState.kt:42)
    at io.mockk.impl.recording.CommonCallRecorder.done(CommonCallRecorder.kt:47)
    at io.mockk.impl.eval.RecordedBlockEvaluator.record(RecordedBlockEvaluator.kt:60)
    at io.mockk.impl.eval.VerifyBlockEvaluator.verify(VerifyBlockEvaluator.kt:30)
    at io.mockk.MockKDsl.internalVerify(API.kt:118)
    at io.mockk.MockKKt.verify(MockK.kt:139)
    at io.mockk.MockKKt.verify$default(MockK.kt:136)
    at org.jboss.tools.intellij.kubernetes.model.KubernetesResourceModelTest.should call list namespaces on client(KubernetesResourceModelTest.kt:32)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
    at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
    at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch

Any idea what I am missing?


text:
Q: I can't set the color of the leaflet easybutton I would like to set the background color of the R leaflet easybutton color to different colors (red, blue, green).  I am stuck with the default "white" color.  So, in my minimal example below, I would like one button box with a star to have a RED background, and the other one BLUE.
I am looking for an R-solution.
Thank you!
library("leaflet")
leaf <- leaflet() %>%
  addTiles() %>%
  addEasyButton(easyButton( icon = htmltools::span(class = "star", htmltools::HTML("★")), onClick = JS("function(btn, map){ map.setZoom(1);}"))) %>%
  addEasyButton(easyButton( icon = htmltools::span(class = "star", htmltools::HTML("★")), onClick = JS("function(btn, map){ map.setZoom(1);}")))

leaf

I was unable to find any R-references to changing the background colors.


text:
Q: Recommended server specification for laravel + mssql application What is the recommended server specification for laravel + mssql application? because I have never try on a windows server. And is there a recommendation for vps that is used for the laravel + mssql application?

A: I'm using SQLserver with Laravel, but there is no problem if the SQLserver driver can be installed
SQLserver
However, since there is almost no root authority to use it with the hosting service, it is recommended to use the VPS that contains the driver from the beginning.

A: In my opinion, you could try to use the newest windows server 2019. It is the newest windows server and contains the newest IIS 10.
Windows server could install the PHP and MySQL and working well.
More details about how to install the Laravel in the windows, you could refer to below article.
https://jimfrenette.com/2016/09/laravel-iis-windows-install/


text:
Q: How to get WHERE clause to stop multiplying values in the SELECT statement? We are trying to see which work orders are within 15% of budget or over. Currently, I have this:
fnd.sort_code,
phs.shop,
SUM ( fnd.amount ) AS 'Spent',
CAST(phs.budget AS Decimal(9,2)) AS 'Budget'
FROM dbo.ae_p_phs_e phs
LEFT OUTER JOIN dbo.ae_s_fnd_a fnd ON (phs.proposal=fnd.proposal AND phs.sort_code=fnd.sort_code)
LEFT OUTER JOIN dbo.ae_p_pro_e pro ON (phs.proposal=pro.proposal)
WHERE
ROUND(CAST(fnd.amount / phs.budget AS Decimal(9,3)), 3) >= 0.85
AND
pro.status_code = 'OPEN'
AND
phs.budget > 0
GROUP BY fnd.proposal, fnd.sort_code, phs.shop, phs.budget
ORDER BY fnd.proposal ASC

It seems to return work orders, but when I validate them against the database, the "fnd.amount" column seems to be multiplied by 2, 3, 4 and sometimes 5x. I noticed that if I remove the ROUND/CAST statement from the WHERE clause, it will return the work orders with their proper values.
Any idea why my filtering is multiplying only one of my SELECT statements?
UPDATE:
By request,

Basically if a query returns the example set above, I would like the query in question to return only those that meet the 0.85 or above threshold (those highlighted in yellow).

A: This is tricky without knowing what your table names actually mean but assuming that phs is the "Work order" then you probably want to apply that 85% to the total Spent with the budget instead of the individual components of that total
So try replacing the where condition (That's applied before the aggregation)
WHERE
ROUND(CAST(fnd.amount / phs.budget AS Decimal(9,3)), 3) >= 0.85

with a a having clause (Applied after the aggregation)
HAVING
ROUND(CAST(SUM( fnd.amount ) / phs.budget AS Decimal(9,3)), 3) >= 0.85

Personally I'd write that more like this
HAVING SUM(fnd.amount) >= (phs.budget * 0.85)

But that's a style choice, either will work
Also there's no point in having left joins to tables that you're going to apply filters on
So that all leaves your final query looking something like this
select
fnd.sort_code,
phs.shop,
SUM ( fnd.amount ) AS 'Spent',
CAST(phs.budget AS Decimal(9,2)) AS 'Budget'
FROM dbo.ae_p_phs_e phs
JOIN dbo.ae_s_fnd_a fnd ON (phs.proposal=fnd.proposal AND phs.sort_code=fnd.sort_code)
JOIN dbo.ae_p_pro_e pro ON (phs.proposal=pro.proposal)
WHERE pro.status_code = 'OPEN'
AND phs.budget > 0
GROUP BY fnd.proposal, fnd.sort_code, phs.shop, phs.budget
HAVING SUM(fnd.amount) >= (phs.budget * 0.85)
ORDER BY fnd.proposal ASC


text:
Q: Marqueeing large bodies of text without blank space For an art exhibition, I'm trying to utilize a locally hosted web page to infinitely scroll information about the pieces near it.
So far I've come up with the idea of using a vertical marquee set to a slow speed so people can read it.  On mouse-over, it stops, then starts when the mouse leaves the space.
(IDEALLY it would allow the user to scroll up and down, and then at input timeout it resumes marqueeing.  That's prob #2 though)
Prob #1 is the Marquee waits until the last line clears the top before starting the loop again at the bottom.  For a page on slow marquee repeat, that means the page is entirely clear of text for a long time until it begins to loop again.
Prob#1
How do I get a Marquee to loop immediately after the last line?
Prob#2
How do I get the text to be momentarily scrollable until an interaction timeout?
Right now I'm more concerned about #1
RESOURCES:
I've been using the basic marqueeing tool with code found here
http://www.quackit.com/html/codes/stop_marquee.cfm
and I've been looking into better code available here, but it still has the same blank stretch of space before loop problem
http://remysharp.com/2008/09/10/the-silky-smooth-marquee/comment-page-3/

A: Marquee cant loop, until the whole sentence or text, goes out of view. The best option is jquery scroller. You can check in this site. http://perekhid.te.ua
Look here:
http://jscroller2.markusbordihn.de/example/endless/


text:
Q: (Inequality) $p \cdot (z-x) \leq \frac{a}{R} | z- x| \Leftrightarrow |p|\leq \frac{a}{R}$ I need to solve this inequality:
Let $z \in \mathbb{R}^N$ and $a,R > 0$, prove that
$$(\forall x\in B_R(z)) \quad p \cdot (z-x) \leq \frac{a}{R} | z- x|  \ \Longleftrightarrow  \ |p|\leq \frac{a}{R} $$
Its seem to be very elementary inequality but I can't solve it :(.
Any help will be appreciated.

A: I suppose we have $p\in\mathbb{R}^n$.
Now, in that case, if $|p|\leq \frac{a}{R}$, we have the so-called Cauchy-inequality. Take a look at it, put your vectors into it and you're almost done.
If, however $|p|>\frac{a}{R}$, we can then choose $x$ such that $z-x=c\cdot p$ for $c\in\mathbb{R}^+$ (why?). In that case, our inequality certainly will not hold, thus we are done.

A: By the dot product rule
$$p\cdot (z-x)=|p||z-x|\cos\theta$$
where $\theta$ is the angle between the vector $p$ and $z-x$. Now let
$$|p|\leq\frac{a}{R}\Rightarrow |p||z-x|\leq\frac{a}{R}|z-x|$$
But $$p\cdot (z-x)=|p||z-x|\cos\theta\leq|p||z-x|$$
So $$p\cdot(z-x)\leq\frac{a}{R}|z-x|$$
This is about this direction, but I cant see the other direction. Because lets say
$$p\cdot(z-x)\leq\frac{a}{R}|z-x|\Rightarrow |p||z-x|\cos\theta\leq\frac{a}{R}|z-x|\Rightarrow |p|\cos\theta\leq\frac{a}{R}$$
But this does not ensure $|p|\leq\frac{a}{R}$ because you could have $\cos\theta=1/2$ and $|p|=\frac{2a}{R}$.


text:
Q: Creating .h file with definitions using powershell and cmd I'm newb in powerShell and in cmd, sorry.
I'm trying write script that can generate define like this
#define VERSION "a89aa153a054b865c0ef0a6eddf3dfd578eee9d2"

in VERSION i want to set the parameter from next source
.git\refs\heads\project

I'm tried next cmd script, but i have problems with " character, i can't escape it
echo #define VERSION \" > ver.h
type .git\refs\heads\project >> ver.h
echo \" >> ver.h

Also i'm tried use script from that post http://blogs.technet.com/b/heyscriptingguy/archive/2008/04/29/how-can-i-read-a-text-file-and-extract-all-the-text-enclosed-in-double-quote-marks.aspx
but i have a problems when i'm trying to run it.
i'm created file writeDefine.ps1
Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("D:\Scripts\DefineTemplate.txt", ForReading)

Do Until objFile.AtEndOfStream
    strText = ""
    strCharacter = objFile.Read(1)
    If strCharacter = Chr(34) Then
        Do Until objFile.AtEndOfStream
           strNewCharacter = objFile.Read(1)
           If strNewCharacter = Chr(34) Then
               Exit Do
           End If
           If strNewCharacter <> "" Then
               strText = strText & strNewCharacter
           End If
        Loop
        Wscript.Echo strText
    End If
Loop

objFile.Close

i want to read template and insert VERSION between " characters and write that text to the "ver.h", but
i have got an error
D:\writeHeader.ps1:4 symbol:67
+ Set objFile = objFSO.OpenTextFile("D:\Scripts\DefineTemplate.txt", <<<<  ForReading)
    + CategoryInfo          : ParserError: (,:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingExpressionAfterToken

DefineTemplate.txt
#define VERSION ""

Please, help me. Thanks!

A: The script sample is VBScript, not Powershell. Thus, you cannot execute it on Powershell. You can, however, execute it via invoking cscript. There is also wscript that executes VBScript, but it is used for graphics: popup windows and such. Rename the file as .vbs  and run it. Like so,
cscript d:\writeHeader.vbs

Cmd.exe uses the hat char as escape. Like so,
C:\temp>echo #define VERSION ^" > ver.h
C:\temp>type ver.h
#define VERSION "

Edit: As per how to create the header on a single line, some trickery must be invoked. This would be much more simple in Powershell, but here goes.
:: Assume git data is in git.dat and it doesn't contain a newline
echo ^"> quote.txt
<nul set /p d=#define VERSION ^"> ver.h
copy /y ver.h+git.dat+quote.txt ver2.h
type ver2.h
#define VERSION "0x000..."

... But I'd still do this in Powershell. Like so,
$git = cat .git\refs\heads\project # Read the git project file
$str = $("#define VERSION `"{0}`"" -f $git) # Build a formatted string
set-content -LiteralPath ver.h -value $str # Write the string to a file


text:
Q: What does 'b' mean in the logcat?
I don't know what does "menu.b" mean in Logcat.
If I put null value in that parameter, it says null, not 'b'.

A: That means it's an obfuscated function. Tools like ProGuard and R8 will obfuscate your code to deter reverse engineering.
For example, something like myObject.doSomething() would look like something similar to a.b() after obfuscation


text:
Q: Pass filename from bash to automator action How I can pass variable (on the image its rawtiff.tiff) from bash to further automator action?

A: Looking at the linked image in the OP and looking at the Description for the Compress Images in PDF Documents action in Automator, it says:

This action will compress the images within the passed PDF documents.

Therefore, you need to pass it the fully qualified pathname of the PDF document to be processed. So, as the last line in the Run Shell Script action, you can use the echo command, e.g.:
echo "/path/to/document.pdf"


text:
Q: Ext JS - Display file name in filefield I have form with file field (upload field). After submit I want to show the file name and extension in that field.
I tried something like this, but it is not working:
{
    xtype: 'filefield',
    name: 'Announcement' + i,
    msgTarget: 'side',
    allowBlank: false,
    anchor: '100%',
    buttonText: 'Browse...',
    listeners:
    {
        render: function()
        {
            if (this.up('app-main-view').response.Questions[i - 1])
            {
                this.setValue(this.up('app-main-view').response.SoundFileName);
            }
        }
    }

}

For other fields (textfields, combobox etc.) this.setValue(this.up('app-main-view').response.SOMETHING); works though.


text:
Q: Using more than one WMS layer in QGIS? I have a problem when using WMS layers in QGIS.
I am loading a WMS layer containing some aerial images, and then on top of it another WMS layer that contains information of the city, boundaries etc with labels. When I load the WMS layer with the labels, the background goes blank and I can't visualise the aerial images.
I have tried the same thing in ArcMap and it works fine but I have to use QGIS.

A: This happens to me when I started using QGIS 2.x. I then realize that the default parameter for the image format was set on JPEG and thus not allowing transparency (and I couldn't see the layers below).
When you click on the Add WMS layer icon and open the window with the parameter for the WMS layers, you have a parameter called " image encoding" below the list of layers: just check the PNG option (PNG allows for transparency) and it should solve the problem of the background going blank (or rather being covered, as I suspect).
This will work if you don't have any other issues of course, especially related to projection systems .


text:
Q: Computing $m-n$
When $P(x+4)$ is divided by $P(x)$, the remainder is $3x+m$. When
  $P(x)$ is divided by $P(x+4)$, the remainder is $nx-6$. Compute $m-n$

Here I wrote down the equations as follows
$$P(x+4) = P(x)Q_1(x)+3x+m$$
$$P(x) = P(x+4)Q_2(x) + nx-6$$
However, these will not give me anything useful. Could you assist me with what I'm missing?
Regards

A: Since $P(x+4)$ and $P(x)$ are of the same degree, the quotients $Q_{1,2}(x)$ must be constant. In fact, from the identical leading terms, we see that $Q_{1,2}(x)=1$.
So
$$3x+m=P(x)-P(x+4) $$
$$nx-6=P(x+4)-P(x) $$
and we conclude $m=6$ and $n=-3$.

A: firstly, we write :
$m=P(x+4)-P(x)Q_1(x)-3x,$
$n=[P(x)-P(x+4)Q_2(x)+6]/x=(-3)[P(x)-P(x+4)Q_2(x)+6]/[m-P(x+4)+P(x)Q_1(x)]$
pick $n=\pm{3}$ by irreducible and improve above formula to :
$P(x)(Q_1(x)-1)+P(x+4)(Q_2(x)-1)=6-m,$$P(x)(Q_1(x)+1)-P(x+4)(Q_2(x)+1)=-6-m$
also note that:
$P(x)Q_1(x)-P(x)=P(x+4)-3x-m-P(x+4)Q_2(x)-nx+6,$$P(x)Q_1(x)+P(x)=P(x+4)-3x-m+P(x+4)Q_2(x)+nx-6$
then we can get:
$P(x+4)-3x-m-P(x+4)Q_2(x)-nx+6+P(x+4)(Q_2(x)-1)=6-m$
$P(x+4)-3x-m+P(x+4)Q_2(x)+nx-6-P(x+4)(Q_2(x)+1)=-6-m$
therefore, $m=\pm{6},n=\mp{3}$


text:
Q: ASP.NET C# client-side & server-side validation with regular expressions I have a pretty straightforward aspx form that collects name, address, email etc and I'm trying to do server-side validation using asp controls. It's working (I think?) and I know I need to do it server-side, but I'm not sure exactly where to put the regex for the actual requirements for each field.
Here's one of my fields as an example:

     <asp:Label runat="server" AssociatedControlID="FirstName" CssClass="col-md-2 control-label">* First Name</asp:Label>

          <asp:TextBox runat="server" ID="FirstName" CssClass="form-control" />
          <asp:RequiredFieldValidator runat="server" ControlToValidate="FirstName"
               CssClass="text-danger" ErrorMessage="First Name field is required." Display="Dynamic" />

I've been using an asp:RequiredFieldValidator and the client-side validation part is working perfectly. The form knows when the user has or hasn't entered something into my required fields and notifies them accordingly before sending anything to the server. I've tested it by putting a label on my page called "valid" and then putting this into my submit button click event:
if(Page.IsValid)
{
     valid.Text = "it's working";
}

And when I fill out the required fields my label does indeed appear and say it's working. However, the asp:RequiredFieldValidator, by definition, only indicates whether my required fields have a value of some kind. It does nothing to check the formatting of what the user entered.
I do need to make certain fields required and I like how the client-side validation part is working. But I also need to do server-side validation and use regex somewhere in the mix to make sure they actually entered an e-mail address in the e-mail field and actually put numbers in the zip code field etc.
I'm fairly new to ASP.NET and it's starting to feel like I'm fighting it. I don't want to fight it. I want to use the available tools to do pretty standard server-side validation, I'm just not exactly sure where to put the regex.
Can anyone help?
Thanks

A: Web Forms validators add client and server side code automatically to cover both bases.  In the case of your RequiredFieldValidator, it simply checks the value is present on the client and if you also call "Page.IsValid" when Page_Load is fired it will do so on the server end.
What you are after is the "RegularExpressionValidator".  You can use one or both on the page depending on what you are trying to achieve.
Here's a good example: https://msdn.microsoft.com/en-us/library/ff650303.aspx

A: You can write your own validator, client and server side. Check out
CustomValidator
Example:
<asp:CustomValidator runat="server" id="CustomValidator" ValidateEmptyText="false" OnServerValidate="customValidation_event"  ClientValidationFunction="customValidation_client" />

And add javascript function and validation method in your code-behind.


text:
Q: Expect command does not see stdout when executing with nodejs? I wrote a bash file with expect command, expecting some output and do actions based on that it works when I execute it in the terminal but when I execute it using exec in nodejs it does not work. I think the output of commands I run in bash file cannot be seen by expect

A: I usually use, shelljs Package, for executing commands or shell scripts via nodejs.
 const shell = require('shelljs')

 shell.exec('./path_to_your_file')


text:
Q: Is Sales Cloud add-on needed to activate person accounts with Service Cloud licence? It is not clear from Salesforce documentation if service cloud licenses are entitled for Personal Account activation by default or whether Sales Cloud add-on is required.
Can anyone help please? Thanks.

A: It's available on Service Cloud and doesn't require an additional Sales Cloud add on.
Here's some links to get you started :
https://help.salesforce.com/articleView?id=account_person_enable.htm&type=5
and
https://resources.docs.salesforce.com/226/latest/en-us/sfdc/pdf/salesforce_B2C_implementation_guide.pdf


text:
Q: Change Div Class depending on value in select option I have a select dropdown with options and I want to display a certain div depending on the selection in the dropdown.
Technically, I believe the easiest way would be to set divs that shouldnt be visible just to display: none by applying the right css class.
However, I don't know how to create the respective JS/jQuery code. I have looked at other solutions here for the last half and hour but they were more unique to their problem, while I belive my solution could be very simple.
Could someone please help me?
Thank you very much!!
Best,
David

$(document).ready(function () {
    $("#LooseTea").hide();
    $('#PyramidBags').show();
    $('#ProductSelect-product-template-option-0').change(function () {
        if($("#ProductSelect-product-template-option-0").val()=="Loose Tea")
        {
          $("#LooseTea").show();
          $("#PyramidBags").hide();
        }
        else
        {
          $("#PyramidBags").show();
          $("#LooseTea").hide();
        }
    })
});
<select id="ProductSelect-product-template-option-0">
  <option value="Pyramid Bags">Praymid Bags</option>
  <option value="Loose Tea">Loose Tea</option>
</select>

This text is about the first product

This textis about the second product

A: Here ya go!

var product1 = document.getElementById("product1");
var product2 = document.getElementById("product2");
var productselection = document.getElementById("productselection");

productselection.addEventListener("change", function(){
  if(productselection.value === 'PyramidBags'){
    product1.classList.add('CLASS');
    if(product2.classList.contains('CLASS')){
      product2.classList.remove('CLASS');
    }
  }
  if(productselection.value === 'LooseTea'){
    product2.classList.add('CLASS');
    if(product1.classList.contains('CLASS')){
      product1.classList.remove('CLASS');
    }
  }
});
.CLASS{
  color:red
}
<select id="productselection">
  <option value="PyramidBags">Praymid Bags</option>
  <option value="LooseTea">Loose Tea</option>
</select>

This text is about the first product

This text is about the second product

Also, this might help How to change an element's class with JavaScript?
Response to OP's comment.

var product1 = document.getElementById("product1");
var product2 = document.getElementById("product2");
var productselection = document.getElementById("productselection");

productselection.addEventListener("change", function(){
    if(productselection.value == 'PyramidBags'){
        if(product1.style.display !== 'block'){
            product1.style.display = 'block';
            product2.style.display = 'none';
        }
    }
    if(productselection.value == 'LooseTea'){
        if(product2.style.display !== 'block'){
            product2.style.display = 'block';
            product1.style.display = 'none';
        }
    }
});
<select id="productselection">
  <option value="PyramidBags">Praymid Bags</option>
  <option value="LooseTea">Loose Tea</option>
</select>

This text is about the first product

This text is about the second product

Also, using jQuery makes everything easier.

A: I believe it's better if you use a single div to display the texts according to the selected option. Store all your product messages in an array in the order the product is placed in the select element, and use the selectedIndex() method to get the index of the selected option, which in turn will be used to get the corresponding text in the array. In this way, if you have hundred products, you won't need hundred DOM elements just to display product information.

const selectElement = document.getElementById('productselection');
const divElement = document.getElementById('product');
const aboutProducts = ['This text is about product one', 'This text is about product two'];
function changeText() {
  let text = aboutProducts[selectElement.selectedIndex];
  divElement.innerHTML = text;
}
<select id="productselection" onchange="changeText()">
  <option value="PyramidBags">Praymid Bags</option>
  <option value="LooseTea">Loose Tea</option>
</select>

This text is about product one

A: Add ids to the Div's for better understanding
<select id="productselection">
  <option value="Pyramid Bags">Praymid Bags</option>
  <option value="Loose Tea">Loose Tea</option>
</select>

This text is about the first product

This text is about the second product

Instead of doing that much code you can easily do like this
 $(document).ready(function () {
   $("#product2").hide();
  });

 $("#productselection").change(function() {
    if($('#PyramidBags').val()=='Pyramid Bags')
  {

     $("#product1 p").css('color', 'red');
  }
   else
  {
    $("#product2").show();
    $("#product2 p").css('color', 'green');
  }

});

A:

document.getElementById("productselection").onchange = (e) => {
    let dataId = e.target.options[e.target.selectedIndex].dataset.id

    document.querySelectorAll(".txt").forEach(el => {
        el.style.display = el.dataset.id === dataId ? "block" : "none"
    })
}
.txt{display: none}
<select id="productselection" name="a">
  <option value="PyramidBags" data-id="pr-1">Pyramid Bags</option>
  <option value="LooseTea" data-id="pr-2">Loose Tea</option>
</select>

This text is about the first product

This textis about the second product


text:
Q: Apache Spark :org.apache.spark.sql.Dataset.drop(String... colNames) method for Java I have two tables, with two common columns.
I am doing join using those columns.
Now I want to drop common columns from one of the table.
I checked API and found that here are many overloaded methods in Spark.
One of them is : org.apache.spark.sql.Dataset.drop(String... colNames)
However my question is how to specify table name from which we want to drop a column. Is there any way?
I searched and found that there is some concept of aliases but I am not sure how to apply same for this method.

A: I have found that there are few ways :
1) To rename columns before joining.
2) dropping one column at a type
ex. `df1.drop(df2.col("ACCT_NBR"));`

by above expression we get DF as return type and we can again call drop function on same for number of times.
This resolves my issue.

A: You need to create a Dataframe/Dataset of the table and then use .drop()
Dataset<Row> sa = spark.read().option("multiLine", true).option("mode", "PERMISSIVE").json("file-path");
sa.drop("col-name");


text:
Q: Introducing a hyperbolic speed limit to a parameterized system I have function $S$ representing a trend-fitted vector for five variables parameterized by time, $S(x(t),y(t),z(t),f(t),g(t))$ where $x,y,z,f,g \in C^2(\mathbb{R})$ (making $S \in C^2(\mathbb{R}^5)$) which represents a physical model of quantities changing.
Now, suppose to make the model more accurate, we wanted to introduce a maximum speed limit that the overall velocity could only asymptotically approach, like say, 500 units of length per unit of time, analogous to the hyperbolic geometry around the speed of light.
How do we implement and model a "speed limit" on the magnitude of the velocity of along each dimension?


text:
Q: failed to upgrade to 12.04, stuck at 11.10 So my Problem occurs as i already mentioned in my title after i tried to upgrad my old version. For no reason the upgrade broke of after the installation. Now i am not able to upgrade anything the upgrade manager is always closing when i am trying to open it.
Hope you guys can help,
with kind regards

A: You might be able to fix it but it will be slower and crash more often. The best thing is just to make a solid backup of all your files and start over with a fresh 12.04.
I had the same issue when upgrading to 11.10, I fixed it but it wasn't as good as a fresh 11.10
Linked question:

*

*How do I install Ubuntu?

A: Open up a Terminal
write
sudo apt-get update

and
sudo apt-get upgrade
sudo apt-get dist-upgrade

if that fails try
sudo dpkg --configure -a

Also check if your sources.list is set to precise instead of oneiric at the end of each deb and deb-src line.
sudo gedit /etc/apt/sources.list


text:
Q: Actions to use when flushing cache (when posts are added / deleted / modified) I'm looking for a list of action tags that are relevant when you:

*

*create a post, with any method, so basically using wp_insert_post

*modify a post, like changing status, title, content, terms, meta, anything related to it;

*remove a post

Are save_post and deleted_post enough for this kind of thing?

A: Yes, 'save_post' and 'delete_post' cover everything, except modifying meta and terms associated to a post. Those hooks can be found in wp-includes: meta.php and taxonomy.php, respectively.


text:
Q: Visual Studio: Как изменить пробел на Tab в Visual Studio 2017? Как можно сделать так чтобы при нажатии Tab появилась табуляция а не 4 пробелы (в Visual Studio 2017)?

A: На английской версии будет Tools → Options → Text Editor → [язык] → Tabs → Keep tabs (Ответ дал Alexander Petrov).
А на русской версии будет Средства → Параметры → Текстовый редактор → [Язык] → Табуляция → Сохранять знаки табуляции.


text:
Q: How to Add/remove 'prev' and 'next' classes to carousel slides in Bootstrap? I'm trying to position the prev and next slides in a Bootstrap Carousel with CSS but the Bootstrap.js (version 3.1.1) seems to be only very briefly adding prev or next classes to adjacent slides before stripping them and adding the active class (depending on which way you swipe). In order to position the prev and next slides (and not the other slides in the sequence) I want to add the next class to the following slide and the 'prev' class to the prev slide relative to the current slide and keep them there until the slides change:
Here is the example I'm basing it off, and here is the javascript that is used:

The correct behavior would be the following (note the movement of the prev, active and next classes:

   Slide 1

   Slide 2

   Slide 3

   Slide 4

Should become:

   Slide 1

   Slide 2

   Slide 3

   Slide 4

Any thoughts?

A: Here's a simple jquery script to add the corresponding classes after each transition:
var $carousel = $('#myCarousel'),
    $carouselItems = $('.item', $carousel);

//This event is fired when the carousel has completed its slide transition.
$carousel.on('slid.bs.carousel', function (e) {
    //Reset classes
    $carouselItems.removeClass('prev next');
    //Find current slide
    var $active = $(e.relatedTarget);
    //Add corresponding classes to next and prev elements
    $active.next().addClass('next');
    $active.prev().addClass('prev');
});

Demo fiddle


text:
Q: Magento 2.4 - Search by SKU I'm trying to figure out why Magento 2 Search is working that way. My products have SKUS like 111-222-333.
When i'm trying to search by SKU, magento 2.4 returns a product collection of ther product sku i've search ( at first position ) , and after that a lot of other similar products ( i suppose ).
Is there a way to override the search functionality or some setting in order for the search query to return only one result, if the given term matches an sku?
I've already investigated the search modules with no luck at all
PS Magento 2.4 uses only Elasticsearch

A: did you manage to solve this problem?
I wrote a small module addresses your issue - if you search for a string that matches the SKU of a product, then you get redirected to the product details page of that product. I did it this way so that no query gets to the search engine since you would get only one result when searching for an SKU. You can check the code on my github repo.
And in order to shed some light into why is Elasticsearch 'working this way' (you get a bunch of results even if you searched for one item), it's like that because you are not limiting the search engine to show only exact matches. In a generic e-commerce scenario you normally don't want that; you want at least some results to be shown, the most relevant to the searched query, even if no exact match was found.
Your search query will provide a set of results that are sorted by relevance, from the most relevant to the least relevant, measured as a score between 0 and 1 (closest to 1 means higher the match). The relevance is influenced by many factors and if you are interested on the topic I recommend reading about how scoring works in Elasticsearch.

A: Catalog search relevance and search results in native Magento2 Open Source are notoriously bad - a simple SKU search is a great example of Magento2 returning very poor search results.
There are ways to fine tune Elastisearch and improve relevance but by far the best solution is to use
https://github.com/Smile-SA/elasticsuite

Simply put, installing the Smile ElasticSuite modules and changing
catalog search to ElasticSuite will immediately give you almost
perfect search results. ElasticSuite is very simple to install and
works out of the box improving search results and search relevance.

I wrote a blog post about this that describes in detail the problems with SKU search and the options I looked at to try and improve default search myself.
https://blog.gaiterjones.com/how-to-improve-magento-2-elasticsearch-catalog-search-results-and-relevance/


text:
Q: Error When Uploading Pandas Dataframe to Azure SQL Server Database With Active Directory Interactive/2MFA Using Pyodbc Hi wonderful StackOverflow community!
I am in need of your divine help, as I am unable to find an answer elsewhere.
When using Python (version 3.10.2 64-bit), I try to upload a Pandas Dataframe 'hr_personaldata' to an Azure SQL Server Database 'hr-data' on the SQL Server 'test-sql-azure-01.database.windows.net'.
I am able to use pyodbc package with the ActiveDirectoryInteractive authentication method to create the connection after entering my password and approving the connection on my Authenticator app. The code to get this connection going is stated below and works to establish the connection:
# Create a connection to the database
import pyodbc
server = 'test-sql-azure-01.database.windows.net'
database = 'hr-data'
username ='test-user@company.com'
Authentication='ActiveDirectoryInteractive'
driver= '{ODBC Driver 17 for SQL Server}'
conn = pyodbc.connect('DRIVER='+driver+
                      ';SERVER='+server+
                      ';PORT=1433;DATABASE='+database+
                      ';UID='+username+
                      ';AUTHENTICATION='+Authentication
                      )

When trying to read data from the database, this works fine. However, when sending data to the database, an error occurs. I am using the following code to send the data to the database, where 'hr_personaldata' is of the type 'pandas.core.frame.DataFrame' and filled with personal HR data:
hr_personaldata.to_sql('HR_PersonalData', conn, if_exists='replace')

The full error which is returned by this statement is the following:
---------------------------------------------------------------------------
OperationalError                          Traceback (most recent call last)
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py:2017, in SQLiteDatabase.execute(self, *args, **kwargs)
   2016 try:
-> 2017     cur.execute(*args, **kwargs)
   2018     return cur

OperationalError: ('08S01', '[08S01] [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: An existing connection was forcibly closed by the remote host.\r\n (10054) (SQLExecDirectW); [08S01] [Microsoft][ODBC Driver 17 for SQL Server]Communication link failure (10054)')

During handling of the above exception, another exception occurred:

OperationalError                          Traceback (most recent call last)
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py:2021, in SQLiteDatabase.execute(self, *args, **kwargs)
   2020 try:
-> 2021     self.con.rollback()
   2022 except Exception as inner_exc:  # pragma: no cover

OperationalError: ('08S01', '[08S01] [Microsoft][ODBC Driver 17 for SQL Server]Communication link failure (-2147467259) (SQLEndTran)')

The above exception was the direct cause of the following exception:

DatabaseError                             Traceback (most recent call last)
c:\Users\r.vdaa\Documents\Scripts HR-Data Processing\main.py in <module>
----> 108 hr_personaldata.to_sql('HR_PersonalData', conn, if_exists='replace')

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\generic.py:2963, in NDFrame.to_sql(self, name, con, schema, if_exists, index, index_label, chunksize, dtype, method)
   2806 """
   2807 Write records stored in a DataFrame to a SQL database.
   2808
   (...)
   2959 [(1,), (None,), (2,)]
   2960 """  # noqa:E501
   2961 from pandas.io import sql
-> 2963 return sql.to_sql(
   2964     self,
   2965     name,
   2966     con,
   2967     schema=schema,
   2968     if_exists=if_exists,
   2969     index=index,
   2970     index_label=index_label,
   2971     chunksize=chunksize,
   2972     dtype=dtype,
   2973     method=method,
   2974 )

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py:697, in to_sql(frame, name, con, schema, if_exists, index, index_label, chunksize, dtype, method, engine, **engine_kwargs)
    692 elif not isinstance(frame, DataFrame):
    693     raise NotImplementedError(
    694         "'frame' argument should be either a Series or a DataFrame"
    695     )
--> 697 return pandas_sql.to_sql(
    698     frame,
    699     name,
    700     if_exists=if_exists,
    701     index=index,
    702     index_label=index_label,
    703     schema=schema,
    704     chunksize=chunksize,
    705     dtype=dtype,
    706     method=method,
    707     engine=engine,
    708     **engine_kwargs,
    709 )

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py:2186, in SQLiteDatabase.to_sql(self, frame, name, if_exists, index, index_label, schema, chunksize, dtype, method, **kwargs)
   2175             raise ValueError(f"{col} ({my_type}) not a string")
   2177 table = SQLiteTable(
   2178     name,
   2179     self,
   (...)
   2184     dtype=dtype,
   2185 )
-> 2186 table.create()
   2187 return table.insert(chunksize, method)

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py:828, in SQLTable.create(self)
    827 def create(self):
--> 828     if self.exists():
    829         if self.if_exists == "fail":
    830             raise ValueError(f"Table '{self.name}' already exists.")

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py:812, in SQLTable.exists(self)
    811 def exists(self):
--> 812     return self.pd_sql.has_table(self.name, self.schema)

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py:2194, in SQLiteDatabase.has_table(self, name, schema)
   2191 wld = "?"
   2192 query = f"SELECT name FROM sqlite_master WHERE type='table' AND name={wld};"
-> 2194 return len(self.execute(query, [name]).fetchall()) > 0

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py:2026, in SQLiteDatabase.execute(self, *args, **kwargs)
   2022 except Exception as inner_exc:  # pragma: no cover
   2023     ex = DatabaseError(
   2024         f"Execution failed on sql: {args[0]}\n{exc}\nunable to rollback"
   2025     )
-> 2026     raise ex from inner_exc
   2028 ex = DatabaseError(f"Execution failed on sql '{args[0]}': {exc}")
   2029 raise ex from exc

DatabaseError: Execution failed on sql: SELECT name FROM sqlite_master WHERE type='table' AND name=?;
('08S01', '[08S01] [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: An existing connection was forcibly closed by the remote host.\r\n (10054) (SQLExecDirectW); [08S01] [Microsoft][ODBC Driver 17 for SQL Server]Communication link failure (10054)')
unable to rollback

The following warning was also given:
C:\Users\r.vdaa\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py:758: UserWarning: pandas only support SQLAlchemy connectable(engine/connection) ordatabase string URI or sqlite3 DBAPI2 connectionother DBAPI2 objects are not tested, please consider using SQLAlchemy
  warnings.warn(

Is anyone able to help me out here, as I am stuck on this project for a customer and can't seem to find an answer.
Thanks a lot, lot of love to the StackOverflow community, and keep up the good work!!
Greeting,
Ricardo


text:
Q: Div mask Textarea contents when it drag down I have a Textarea box inside of div. however when I drag the textarea and push it down. Div start to mask all the contents. Is any way to expand div's heigh when user try to drag textarea down. Can I do it in css or do I need javascript or jquery?

    <textarea style="widht:150; height:200px;"></textarea>

http://jsfiddle.net/y9hy9/

A: http://jsfiddle.net/DEgEw/1/

    <textarea style="widht:150; height:200px;"></textarea>

I would suggest using min-height and min-width instead of fixed height and width. Also display: inline-block will adjust width to fit the textarea and you can always add a br tag to prevent other divs to go beside your wrapper div


text:
Q: Auto Authenticate user on Azure Platform I have a situation wherein, we're listing third party content on our website, now what they want only authentic user from our userbase would be able to consume it's content, however for that, the only way they have is to authentic via Azure, they do not want to take the authorization token from us, they want we auto login user on Azure and then when they communicate with Azure, they will get the Authorization token and then they will authenticate the user and allow them to consume their content.
So we're planning to have the users information (Username and password) on Azure SQL, and once the user logs in on our website, we will auto authenticate them on Azure using the same user information on Azure SQL, once authenticated, Azure will generate the authentication token which this Third party company will use and authenticate our users.
So just want to know is the above scenario possible, or how can we achieve the same?


text:
Q: How to use Mysql SUM with JOIN I have the following tables:
purchase_tbl
id | productId | purchaseQuantity
---+-----------+-----------------
1  | 1         | 30
2  | 2         | 30
3  | 1         | 10
4  | 2         | 10

sale_tbl
id | productId | saleQuantity
---+-----------+-------------
1  | 1         | 10
2  | 2         | 10
3  | 1         | 10
4  | 2         | 10
5  | 1         | 10
6  | 2         | 10

I need to get the output as this one:
productId | totalPurchasedQuantity| totalSaleQuantity
----------+-----------------------+------------------
1         | 40                    | 30
2         | 40                    | 30

I'm using this query and how to get the desired result?
SELECT purchase_tbl.productId
    , SUM(purchase_tbl.purchaseQuantity) AS totalPurchaseQuantity
    , SUM(sale_tbl.saleQuantity) AS totalSaleQuantity
FROM purchase_tbl
JOIN sale_tbl
    ON purchase_tbl.productId = sale_tbl.productId
GROUP BY purchase_tbl.productId

Current output
productId | totalPurchaseQuantity | totalSaleQuantity
----------+-----------------------+------------------
1         | 120                   | 60
2         | 120                   | 60

A: You better group then in separate query, as table have multiple records for each product, which getting cross product.
SELECT purchase.productId, totalPurchaseQuantity, totalSaleQuantity
FROM
(SELECT purchase_tbl.productId
    , SUM(purchase_tbl.purchaseQuantity) AS totalPurchaseQuantity
FROM purchase_tbl
GROUP BY purchase_tbl.productId) purchase
INNER JOIN
(SELECT sale_tbl.productId
    , SUM(sale_tbl.saleQuantity) AS totalSaleQuantity
FROM sale_tbl
GROUP BY sale_tbl.productId
) sale ON sale.productId= purchase.productId;

A: To obtain your expected result you have to do the aggregation on the individual table before joining them. Your query with be like:
SELECT A.productId, A.totalpurchaseQuantity, B.totalsaleQuantity
FROM
(SELECT productId, SUM(purchaseQuantity)
   totalpurchaseQuantity FROM purchase_tbl
    GROUP BY productId) A JOIN
(SELECT productId, SUM(saleQuantity)
   totalsaleQuantity FROM sale_tbl
    GROUP BY productId) B ON
A.productId=B.productId;


text:
Q: Du tells me it can't find the current directory? I'm on AIX, and in some directories I can't use the du command.  I get the follow error message:

du: 0653-175 Cannot find the current directory.

Obviously the current directory exists, and I have permissions to it.  I can list the directory and create  files in it, both before and after I ran du.  What could possibly be wrong here?
The du command works just fine in my home directory.
A quick google search turns up a bunch of forum posts of the same problem, but no clear answers.

A: What are the permissions of the directory under the filesystem mount?  Unmount the filesystem and check the permissions of the directory underneath, it's probably not root:system and 755.  Your user ID probably doesn't have access to that directory and some AIX commands fail as a result.

A: it is probably because of ACL implemented on that directory. You may want to change to that filesyste,/directory owner and then try du.

A: It is a matter of privilege. Run your command as super user then it will show results.
oracle@dbprod:/grid/base/tfa/repository/suptools/vt1prod/oswbb/oracle/archive:> du -sm .
du: 0653-175 Cannot find the current directory.

oracle@dbprod:/grid/base/tfa/repository/suptools/vt1prod/oswbb/oracle/archive:> sudo du -sm .
821.88  .


text:
Q: Cannot get the .js file route Unable to get the .js file with Minium Developer. I have the route like in the example proyect but it doesn't work. What am i doing wrong?
Helper.js
var helperFuntions = {

findExistingDataOnTable : function(cssSelector,query){

    var encontrado = $(cssSelector).matchingText(query);

    if (encontrado) {

        console.log("Superado");
    }else{

      console.log("No superado");
    }

  }

};

ProyectoPrueba.js (not working, wrong import)
var helperFuntions = require("modules/Helper/Helper.js");

When(/^Compruebo la existencia de "(.*?)"$/, function (query) {
   var cssTable = "\".ym-cbox\"";

helperFuntions.findExistingDataOnTable(cssTable, query);

});

ProyectoPrueba.js (working, no import)
When(/^Compruebo la existencia de "(.*?)"$/, function (query) {

    var found= $(".ym-cbox").matchingText(query);
  if (found) {
    console.log("Superado");

  }else{
    console.log("No superado");
  }

});

Proyect hierarchy

A: You must exclude the "modules" folder from the require path:

require("Helper/Helper");

Also, the extension ".js" is not required.

A: Your imports need to be absolute paths unless you're importing modules from a node_modules folder.
Let's say the modules folder is a sibling of the current folder you're importing it from.
In that case require("modules/Helper/Helper.js"); should be require("../modules/Helper/Helper.js");


text:
Q: Not finding source directory following a package installation with PPA in Ubuntu 16.04 Recently I set up Ubuntu 16.04, and one of the first things I wanted to do was install the software Subsurface. I used the following commands:
$ sudo add-apt-repository ppa:subsurface/subsurface
$ sudo apt-get update
$ sudo apt-get install subsurface

This installed the program, and I'm able to use it.
However, I now need to go to the source tree directory to build a related piece of software, and I gather this is usually called something like /src/subsurface somewhere on the system. However, I'm not finding it -- it's not under /usr/src or /usr/local/src, and the find command doesn't turn up anything promising.
I've emailed the Subsurface developers, but in the meantime: Is there a usual place where source files live following a package installation? Is there anything that usually needs to be toggled to preserve the source files? I'm pretty much a newbie to working with packages.

A: From man apt-add-repository, to enable a PPA's source packages you can add the -s option to your command:
-s,  --enable-source  Allow downloading of the source packages from the repository

so it would become
sudo add-apt-repository -s ppa:subsurface/subsurface

You should then be able to download the source into the current directory in the usual way, i.e. using
sudo apt-get update
apt-get source subsurface

(or just `apt source subsurface) on newer systems).
Alternatively, find the PPA source.list file (usually in /etc/apt/sources.list.d) and add corresponding the deb-src line manually.


text:
Q: Only get the version number from set of lines How to get only the version from set of lines?
These are the lines inn flat file:
./org.jamon/jamon-runtime/jars/jamon-runtime-2.3.1.jar
./org.apache.ftpserver/ftplet-api/bundles/ftplet-api-1.0.0.jar
./org.clojars.jasonjckn/kafka_2.9.2/jars/kafka_2.9.2-0.7.2-test1.jar
./org.apache.ftpserver/ftpserver-deprecated/jars/ftpserver-deprecated-1.0.0-M2.jar
./org.codehaus.jettison/jettison/bundles/jettison-1.1.jar
./stax/stax-api/jars/stax-api-1.0.1.jar

Output:
 2.3.1
 1.0.0
 0.7.2-test1
 1.0.0-M2
 1.1

A: For a sed solution:
sed 's/.*-\([0-9][0-9.]*[^\/]*\)\.jar$/\1/'

Explanation:

*

*Replace: anything + hyphen + revision + ".jar" with just the revision, where:

*The the revision is identified as: starts with number, followed by numbers or dots, followed by any text except slash /, and is preceded by a hyphen -.

*".jar" must be at the end-of-line.

A: Using GNU grep with -P option (PCRE regex for look ahead and behind):
grep -oP '(?<=-)[0-9.]+[-[:alnum:]]*(?=\.jar)' file
2.3.1
1.0.0
0.7.2-test1
1.0.0-M2
1.1
1.0.1

As suggested cbuckley in the comments more generic way of saying it would be (will work if you files have extensions other than .jar:
grep -oP '(?<=-)[\d.]+[-\w]*(?=\.\w+)' file

A: Here you go:
awk -F/ '{n=split($NF,a,"-");if (a[n-1]~/[0-9.]+/) a[n]=a[n-1]"-"a[n];sub(/\.jar$/,"",a[n]);print a[n]}' file
2.3.1
1.0.0
0.7.2-test1
1.0.0-M2
1.1
1.0.1

If you have gnu grep use the Jaypal's solution :), this awk should work on most system.

A: Simple solution is
grep -Po "(?<=-)\d[^/]*(?=\.jar$)"


text:
Q: Updating a database with keeping relationships I've got a database which has some tables I want to keep up-to-date. I've got to write a SQL script that checks if there are certain rows in target tables and if there are not, insert them. I tried MERGE, but i have 8 tables related to the 9th one so there are 8 foreign keys and I don't know how to update them all. I don't want to delete all and insert again, because i want to save my main table rows' IDs.

A: You can use trigger that automatically add inserted rows to destination tables


text:
Q: VHDL: Constraining Record with another record Let's assume I have a type of record containing unconstrained elements:
  type Axi4s_M2S is record
    Tvalid : std_logic;
    Tdata  : std_logic_vector;
    Tstrb  : std_logic_vector;
    Tkeep  : std_logic_vector;
    Tlast  : std_logic;
    Tid    : std_logic_vector;
    Tdest  : std_logic_vector;
    Tuser  : std_logic_vector;
  end record Axi4s_M2S;

Now I implement two signals. "A" is completely constrained. The other one should be constrained using the first one.
signal A: Axi4s_M2S(Tdata(7 downto 0)......);
signal B: Axi4s_M2S(--constrain me likewise A);

Is there a way to do so?

A: With code that analyzes:
library ieee;
use ieee.std_logic_1164.all;

entity rec_constraint is
end entity;

architecture foo of rec_constraint is
    type Axi4s_M2S is record
      Tvalid : std_logic;
      Tdata  : std_logic_vector;
      Tstrb  : std_logic_vector;
      Tkeep  : std_logic_vector;
      Tlast  : std_logic;
      Tid    : std_logic_vector;
      Tdest  : std_logic_vector;
      Tuser  : std_logic_vector;
    end record Axi4s_M2S;

    signal A: Axi4s_M2S(Tdata(7 downto 0), Tstrb(3 downto 0), Tkeep(3 downto 0),
              Tid(31 downto 0), Tdest(7 downto 0), Tuser(3 downto 0));
    signal B: A'subtype;
begin
end architecture;

VHDL -2008 supports record constraints in object declarations as well as a predefined attribute that returns the subtype of an object. With those the subtype of A can be used in the declaration of B.
Note that the record type declaration didn't match the type of signals A and B in the question nor was the record constraint complete.


text:
Q: Error when trying to 'mvn clean install' Gerrit's replication plugin This is probably a newbie question, but I'm new to Maven.
I'm trying to build Gerrit's replication plugin, "since the master branch (and thus Gerrit 2.5) no longer supports replication out of the box."
So I did clone https://gerrit.googlesource.com/plugins/replication and executed mvn clean install inside the new directory. The error message is:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building replication 1.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.google.gerrit:gerrit-plugin-api:jar:2.6-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.840s
[INFO] Finished at: Thu Apr 25 17:30:10 BRT 2013
[INFO] Final Memory: 6M/105M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project replication: Could not resolve dependencies for project com.googlesource.gerrit.plugins.replication:replication:jar:1.1-SNAPSHOT: Failure to find com.google.gerrit:gerrit-plugin-api:jar:2.6-SNAPSHOT in https://gerrit-api.commondatastorage.googleapis.com/release/ was cached in the local repository, resolution will not be
reattempted until the update interval of gerrit-api-repository has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

It looks like this URL isn't valid: https://gerrit-api.commondatastorage.googleapis.com/release/ -- but like I said, I'm new to Maven so I'm not sure how to proceed. I did some research, but I don't know what I'm looking for.
Any pointer would be highly appreciated. Thanks in advance.

A: A couple of things -

*

*You are missing the gerrit-plugin-api.jar.  This currently isn't provided upstream, so you must build it yourself.  I believe running mvn install from a Gerrit repository will package and add this jar to your system.

*You don't want to run install, you just want to run package on the plugin.  mvn package will put the .jar in the target/ folder, which you then copy to your plugins folder inside your Gerrit installation.
Good luck!

A: Like Brad mentioned, I am missing the gerrit-plugin-api.jar. Unfortunately, I was not able to build it, since the Gerrit repos seem to be facing issues lately, as mentioned in other threads (this one, for instance - from two days ago).
Anyway, below are my additional steps based on Brad's answer (hopefully this may help others):
git clone https://gerrit.googlesource.com/gerrit
cd gerrit/gerrit-plugin-api/
mvn clean install

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Gerrit Code Review - Plugin API 2.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.google.gerrit:gerrit-sshd:jar:2.7-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.google.gerrit:gerrit-httpd:jar:2.7-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.google.gerrit:gerrit-pgm:jar:2.7-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.342s
[INFO] Finished at: Fri Apr 26 10:52:54 BRT 2013
[INFO] Final Memory: 5M/105M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project gerrit-plugin-api: Could not resolve dependencies for project com.google.gerrit:gerrit-plugin-api:jar:2.7-SNAPSHOT: The following artifacts could not be resolved: com.google.gerrit:gerrit-sshd:jar:2.7-SNAPSHOT, com.google.gerrit:gerrit-httpd:jar:2.7-SNAPSHOT, com.google.gerrit:gerrit-pgm:jar:2.7-SNAPSHOT: Failure to find com.google.gerrit:gerrit-sshd:jar:2.7-SNAPSHOT in https://gerrit-maven.commondatastorage.googleapis.com was cached in the local repository, resolution will not be reattempted until the update interval of gerrit-maven has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

EDIT

These are the steps that worked for me, in case someone else faces the same issue.
git clone https://gerrit.googlesource.com/gerrit

Check available 'versions'
git branch -r
git checkout -b 2.5 origin/stable-2.5

The steps didn't work on the master branch in my environment, and I'm using 2.5...
So yeah, 2.5.
cd gerrit
mvn clean install

This will rebuild the entire universe, go grab a cup of coffee. :)
.. when done
cd gerrit-plugin-api/
mvn package

This also takes some time...
If everything goes fine, you can copy the jar at the target folder, like:
cp target/<large-name>.jar ~/replication.jar

Finally install it (from ~):
ssh -p 29418 localhost gerrit plugin install -n name \ - <replication.jar

Details on how to install Gerrit plugins are here.
The thing is, now I'm getting another error, something like:

"A binding to (something) was already configured at (something)."

But that's another story / thread / post...
Thanks and good luck!

A: Do a mvn -P all clean install on the toplevel, not inside gerrit-plugin-api.

A: The fastest way to fix is is to change the pom.xml and use a version that is not a snapshot. I was trying to build the delete-project for the stable-2.6 branch and was facing the same issue. All that needs to be done is to change the Gerrit-ApiVersion:
     <Gerrit-ApiType>plugin</Gerrit-ApiType>
-    <Gerrit-ApiVersion>2.6-SNAPSHOT</Gerrit-ApiVersion>
+    <Gerrit-ApiVersion>2.6-rc2</Gerrit-ApiVersion>
   </properties>
   <name>Delete Project Gerrit Plugin</name>

A: Building off of @Conaaando's answer, I performed these exact steps and successfully am using the plugin. Steps courtesy of http://asheepapart.blogspot.com/2013/12/how-to-build-gerrit-replication-plugin.html
git clone --recursive https://gerrit.googlesource.com/gerrit

You need the --recursive here because the plugins are actually git submodules and won't otherwise be cloned along with your repo.
If you've already cloned, you can run git submodule init; git submodule update
cd gerrit
git checkout -b stable-2.7 origin/stable-2.7
mvn install -DskipTests=true -Dmaven.javadoc.skip=true

It's not necessary to skip the tests or generating Java Doc, but it will greatly improve your compile time and decrease the amount of memory maven uses
cd gerrit-plugin-api
mvn package -Dmaven.javadoc.skip=true

This creates the jar that will be necessary for the replication plugin to get built
cd plugins/replication
mvn package -Dmaven.javadoc.skip=true

At this point, you have compiled and packaged the replication jar! All you need to do now is register it with your Gerrit server. For simplicity, I'll pretend your gerrit server is running at gerrit.example.com. These steps copy the replication jar to your review server and then instruct the review server to install the plugin from that copied location.
scp target/replication-2.7.jar gerrit.example.com:/tmp/
ssh -p 29418 gerrit.example.com gerrit plugin install -n replication /tmp/replication-2.7.jar


text:
Q: Assign 2D list as values to dictionary I would like to assign a 2D list as value to a dictionary, here is what I have tried
tags = ['a', 'b', 'c']
data = [['-' for i in range(0, 2)] for j in range(0, 2)]
table = {}
for tag in tags:
  table[tag] = data
print(table)

Here is what I got
{'a': [['-', '-'], ['-', '-']], 'b': [['-', '-'], ['-', '-']], 'c': [['-', '-'], ['-', '-']]}

However, when I assign new value to specific one key
table['a'][0][1] = 'hi'

All keys of [0][1] get changed as well
{'a': [['-', 'hi'], ['-', '-']], 'b': [['-', 'hi'], ['-', '-']], 'c': [['-', 'hi'], ['-', '-']]}

Anyone can point out what's wrong with my code?

A: You are adding the same reference to the same list in each value. These are just references to one list, so updating one updates everything. You need to allocate a new list in each iteration. A simple way to do this is to move the list comprehension into the loop:
tags = ['a', 'b', 'c']
table = {}

for tag in tags:
    # make a new list each time:
    table[tag] = [['-' for i in range(0, 2)] for j in range(0, 2)]

table['a'][0][1] = 'hi'
print(table)

Prints:
{'a': [['-', 'hi'], ['-', '-']], 'b': [['-', '-'], ['-', '-']], 'c': [['-', '-'], ['-', '-']]}


text:
Q: How to find the size of a deep learning model? I am working with different quantized implementations of the same model, the main difference being the precision of the weights, biases, and activations. So I'd like to know how I can find the difference between the size of a model in MBs that's in say 32-bit floating point, and one that's in int8. I have the models saved in .PTH format.

A: You are able to calculate the number of parameters and buffers.
Then try to multiply them with the element size and you will have the size of all parameters.
model = models.resnet18()
param_size = 0
buffer_size = 0
for param in model.parameters():
    param_size += param.nelement() * param.element_size()

for buffer in model.buffers():
    buffer_size += buffer.nelement() * buffer.element_size()

size_all_mb = (param_size + buffer_size) / 1024**2
print('Size: {:.3f} MB'.format(size_all_mb))

And it will print:

Size: 361.209 MB


text:
Q: node.js yield page view to other page view stack i want to yield other page in side the node.js page like php yeild

  // i whant  @yield('main')  here like php

A: To do it you can use jQuery .load() method. Below is the example:
//HTML Code

//jQuery Code
$(".row").load("main.html"); //Path of you html file


text:
Q: Equating distributional derivatives I'm trying to get unstuck from some problems I encountered while studying the Fourier transform on tempered distributions. I'll discuss them using the exercise that originated them.
Let $\Lambda=\text{p.v.}(1/x)$ be the tempered distribution defined by $<\Lambda,\phi>=\int_{|x|<R}\frac{\phi(x)-\phi(0)}{x}+\int_{|x|>R}\frac{\phi(x)}{x}$, $\forall \phi \in S(\mathbb{R})$. One can show the definition doesn't depend on $R>0$.
I'm trying to understand the steps to compute $\Lambda '$,  the derivative in the sense of tempered distributions of $\Lambda$.
I will write some notation provided by my book:

*

*let $P$ be a polynomial, then for $\Lambda \in S'(\mathbb{R}^n)$ one can define the $P(\Lambda)$ to be the distribution such that $<P(\Lambda),\phi>:=<\Lambda,P(\phi)>$ $\forall \phi \in S(\mathbb{R})$.

*let $f \in S(\mathbb{R}^n)$, then $f \Lambda $ is the distribution such that $<f\Lambda,\phi>:=<\Lambda,f\phi>$ $\forall \phi \in S(\mathbb{R})$
Now, one can show that $x \Lambda =1$, where $1$ stands for the tempered distribution such that $<1,\phi>=\int_{\mathbb{R}} \phi(x)$.
Applying the theorem for the (distributional) derivative of a Fourier transformed tempered function and because $\hat{1}=2 \pi \delta_0$ ($\hat{} $ denotes the transformed function, $\delta_0$ is the Dirac delta centered at $0$):
$\widehat{\Lambda}'=-i\widehat{x\Lambda}=-i\widehat{1}=-2 \pi i\delta_0$.
Let $H$ be the tempered distribution associated to the Heaviside function. Then:
$\widehat{\Lambda}'=-2 \pi i H'=(-2 \pi i H)'$
From this my book concludes $\widehat{\Lambda}=-2 \pi i H +c$ for some constant $c$ (*).
Now, according to the provided notation: $<(-2 \pi i H +c)',\phi>=<-2 \pi i H ,\phi'>=<H,-2 \pi i \phi' +c >$, which is not well defined. Is the problem in the definition of notation or is it in my understanding of the topic? Furthermore how can (*) be justified? My intution is that it is because $<c',\phi>=<c,\phi'>=\lim_{x\rightarrow +\infty} \phi(x) - \lim_{x\rightarrow -\infty} \phi(x) =0$ by definition of $S(\mathbb{R})$.
Thanks in advance!

A: There is a much easier characterization: since $x\Lambda=1$, $(x\Lambda)'=0$ thus $x\Lambda'=-\Lambda$.
Regardless, the first thing you want to prove is that if $T$ is a distribution such that $T'=0$, then $T$ is constant. Indeed, some Schwartz function is the derivative of a Schwartz function iff it has integral $0$ (the direct sense is basically what you wrote at the end of your post), $T$ is a linear form that vanishes where $1$ vanishes, so $T$ is a multiple of $1$ (this is general linear algebra).
On the other hand, $\langle (-2i\pi H+c)',\,\phi\rangle=\langle -2i\pi H +c,\, \phi'\rangle \neq \langle -2i\pi H,\phi'+c\rangle$, among others because $\langle H,\,1\rangle$ is not defined.