text:
Q: "You cannot assign value to this object." with new record I have a VERY peculiar problem. When a new record is created and I want to select a Customer_ID from ComboBox, after selection it throws me the above mentioned error. However, it actually gets assigned (ie. everything works as it should, but for the error).
Is there a way to bypass/disable this error?
P.S.: This is the error: http://imgur.com/rTQC9za
Edit: I have located the error and it seems that it comes down to: trying to assign a value into a record that is not "confirmed" yet. That means it has no (auto generated) ID yet. Basically, how would I go about confirming that I want to create the said error?
My code (to create a new record) is as follows:
'some other irrelevant code
Dim rs As Recordset
Set rs = Me.subOrders_for_main_overview.Form.Recordset
rs.AddNew
'some other irrelevant code

This creates a new blank record.

A: This error can be caused when you try to assign a value to a BOUND control.  If the control/object is supposed to be UNBOUND, go back to its property and confirm it.  You may get a surprise!  I was working with the VB behind a form and suddenly I started getting a "can't find table" and "can't assign a value" to several, but not all, of the controls on the form.  For reasons that I have not determined, the form's control source acquired a query that it was never bound to, and 5 random controls had their control.name as their control source.  Once I removed them, the form was ok


text:
Q: Warning message: "The Snagit capture hotkey is in use by another program" I've created a new Snagit capture profile and want to assign the Print screen hotkey to it.
For that, I open the Change Capture Hotkey dialog of my profile and try to change None to Print screen.

When I try that, I get the following warning message:

The Snagit capture hotkey is in use by another program. Select a
  different keyboard combination for the hotkey.

How do I need to proceed to be able to assign the Print screen hotkey to my profile?

A:
How do I need to proceed to be able to assign the Print screen
  hotkey to my profile?

The general solution is to find the other program that is currently using the Print screen hotkey and remove it there so it can be used from within Snagit.
In this particular case, it's Snagit itself that is already using this hotkey. Unfortunately, the hotkey is not visible in the "Manage Profiles" window.

*

*You have to open Snagit from the Windows notification area.

*Then select Menu: Preferences → Tab: Hotkeys.

*Under Global capture change Print screen to None.

*Now you can go back to your own profile and assign Print screen as the hotkey without getting the warning message.

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is the electric flux through the flat and curved surfaces? My question is from Physics For Scientists And Engineers 7th:

A particle with charge Q is located immediately above the center of the flat face of a hemisphere of radius R, as shown in the figure.

*

*(a) What is the electric flux through the flat surface,

*(b) through the curved surface?

What is the electric flux if $≠0$, for example $2R$? If it is the same, then how we can prove this? And how we can calculate it?

A: Since we don't answer homework-type questions, I'll try to give some hints.

*

*What would be the flux through the surface of the sphere, if it was a full and not a semi-sphere?

*Which of Maxwell's equations could we use?

*Can we deduct the flux through the semi-sphere from that?

*Can we use the same equation to answer the second part of the question?

After some clarification I think a complete answer would be instructional.
For the flux through the flat surface the most direct approach would be to simply calculate the integral of the electric field, which is known.
$$ \Phi = \iint \vec{E} d\vec{A} = \iint \vec{E} \vec{n} \, dA = \int_0^{2\pi} d\phi \int_0^R r\,dr \, E\cos{\theta} = 2\pi \int_0^R r\,dr \, E\cos{\theta}$$
The magnitude of the electric field at the surface is
$$ E = \frac{Q}{4\pi\epsilon_0 (\delta^2 + r^2)} $$ and by trigonometry
$$ \cos(\theta) = \frac{\delta}{\sqrt{r^2+\delta^2}}$$
So
$$ \Phi = 2\pi\int_0^R \frac{Q r \delta}{4\pi\epsilon_0 (r^2+\delta^2)^{3/2}} dr = \frac{Q\delta}{2\epsilon_0}\int_0^R\frac{r}{(r^2+\delta^2)^{3/2}} dr\\ = -\frac{Q\delta}{2\epsilon_0} \left.\frac{1}{\sqrt{r^2 + \delta^2}}\right|_{r=0}^R = -\frac{Q\delta}{2\epsilon_0} \left(\frac{1}{\sqrt{R^2 + \delta^2}} - \frac{1}{\delta}\right) = \frac{Q}{2\epsilon_0} - \frac{Q\delta}{2\epsilon_0\sqrt{R^2+\delta^2}}$$
Now there are some cases with which we can check if this result makes sense. If the flat surface extends infinitely, i.e. $R\rightarrow\infty$, we should get $\Phi = \frac{Q}{2\epsilon_0}$, because the total flux through a surface surrounding a charge $Q$ is $Q/\epsilon_0$ from Gauss's law. Since half the flux goes off to the top, half the flux goes down and eventually through the surface (the mantle of the cylinder at $R\rightarrow\infty$ has no contribution). And indeed that's the result we get.
Another case is $\delta \rightarrow 0$. For this case, we should also get $\Phi = \frac{Q}{2\epsilon_0}$, because half the flux will go through the upper hemisphere, and half the flux will go through the lower hemisphere. And indeed, in the limit $\delta \rightarrow 0$ the second term in the result disappears again and we get the same result.
The last case we will check is $\delta \gg R$. This should result in an almost constant field of $E\approx\frac{Q}{4\pi\epsilon_0\delta^2}$ across the whole surface, so the flux should be $\Phi \approx \frac{Q R^2\pi}{4\pi\epsilon_0\delta^2} = \frac{Q R^2}{4\epsilon_0\delta^2}$. We can re-write the second term in the result as a series in $R/\delta$
$$ \frac{Q\delta}{2\epsilon_0\sqrt{R^2+\delta^2}} = \frac{Q}{2\epsilon_0\sqrt{\left(\frac{R}{\delta}\right)^2+1}} = \frac{Q}{2\epsilon_0}\left(1-\frac{(R/\delta)^2}{2} + \mathcal{O}\left(\frac{R}{\delta}\right)^4\right)$$
With that, the flux is
$$ \Phi \approx \frac{Q}{2\epsilon_0} - \frac{Q}{2\epsilon_0} + \frac{QR^2}{4\epsilon_0\delta^2} = \frac{QR^2}{4\epsilon_0\delta^2}$$
again in agreement with our expectations.
One more note on the flux through the flat and the curved surface. If we look at the geometry of the problem, for $\delta \gt 0$, all the flux from the charge must enter the semisphere through the flat surface, and exit it through the curved surface (simply because electric field lines of an isolated point charge don't bend). From Gauss's law we know that the total flux through the surface of the semisphere must be 0, as there is no charge inside it. Therefore, the flux through the flat surface and the curved one must be equal in magnitude.


text:
Q: Error belongsTo en AppServiceProvider tengo un error en la relacion belongsTo en la vista welcome, el error esel siguiente:
"Undefined property: stdClass::$work (View: ...\views\welcome.blade.php)"

Lo datos los recupero de la consulta realizada en AppServiceProvider ya que es comun en muchas vistas, lo curioso es que en el index del CRUD para la gestion funciona correctamente.
AppServiceProvider
public function boot()
{

    Schema::defaultStringLength(191);

    // Cargo en todas las vistas el menu
    $workData = \DB::select('SELECT * FROM works');
    $eventData = \DB::select('SELECT * FROM events');

    View::share('dynamicWorks', $workData);
    View::share('dynamicEvents', $eventData);

}

Modelo Work y Event con las relaciones
public function events()
{
    return $this->hasMany('App\Event', 'work_id');
}

public function work()
{
    return $this->belongsTo('App\Work', 'work_id');
}

Vista que no funciona
@foreach($dynamicEvents as $event)

{{$event->work->title}}
    {{$event->date}} a las {{$event->time}}

@endforeach

Controlador que devuelve la vista que funciona
public function index()
{
    $events = Event::paginate(15);
    return view('events.index', compact('events'));
}

Vista que si funciona
@foreach($events as $event)

    {{$event->work->title}}

@endforeach

A: La segunda vista funciona porque estás enviando un objeto y lo tratas como tal:
$event->work->title

La primera no funciona porque no está recibiendo un objeto, sino un array, y lo estás tratando como un objeto:
$event->work->title

Para solucionarlo tienes dos vías: Cambiar la consulta en AppServiceProvider y dejarla como en el Controlador. O, cambiar la lógica en la vista y tratar $even como un array.

A: Asi funciona correctamente
public function boot()
{
    Schema::defaultStringLength(191);
    $data = Work::all();
    $data2 = Event::all();
    View::share('globalWorks', $data);
    View::share('globalEvents', $data2);
}


text:
Q: Unable to import _winreg in Python 2.7.9 virtual environment I'm running an app engine application in a virtual environment on windows 7 64bit, python 2.7.9 x64.
Here's the stacktrace:
    p_system = platform.system()
  File "C:\Python27\lib\platform.py", line 1310, in system
    return uname()[0]
  File "C:\Python27\lib\platform.py", line 1206, in uname
    release,version,csd,ptype = win32_ver()
  File "C:\Python27\lib\platform.py", line 597, in win32_ver
    import _winreg
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\python\sandbox.py", line 945, in load_module
    raise ImportError('No module named %s' % fullname)
  ImportError: No module named _winreg

However, it works just fine from cli (outside venv):
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Admin>python
Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import _winreg
>>> import platform
>>> platform.system()
'Windows'
>>>

Why does this happen? What can I do to fix this?

A: Module _winreg, as the docs say, exists to "expose the Windows registry API to Python".
App Engine does not supply a "Windows registry API" (nor any other Windows-specific API).  Therefore, its sandbox blocks attempts to import the module -- note, at the end of your stack trace, that the exception is deliberately raised in module sandbox.py of the App Engine SDK.
Python's "virtual env" plays no part here -- it's all about App Engine.
Please clarify what task you're trying to accomplish with _winreg once your GAE app is deployed -- assume it's deployed to Linux servers (although the GAE runtime doesn't supply Linux-specific APIs either:-), so there is no Windows Registry API anywhere in the neighborhood...

A: The workaround provided by Google, until a fix is implemented, is as follows:

*

*Go to: <sdk_root>\google\appengine\tools\devappserver2\python\sandbox.py

*Find the definition of _WHITE_LIST_C_MODULES = [xxx]

*Add the following two lines to the list:

'_winreg',
'_ctypes',
If this does not succeed, run python -m pip install google-cloud

A: I think that the problem is that GAE is not aware that you are in development mode, I suppose because the SERVER_SOFTWARE variable is set to something not starting with "Dev".
If you execute the following code (before calling any GAE library) it should fix the issue:
import os
os.environ['SERVER_SOFTWARE'] = 'Dev'

Note: Make sure this code is removed before going to production.

A: I had this problem a few days ago.
As said above, the GAE sandbox on Windows blocks some routines or libraries, even built-in one, because it is developed to Unix-like platform.
I opened an issue to Google Team and they passed a workaround:
https://issuetracker.google.com/issues/38290292
That workaround worked well.


text:
Q: Can I cascade vim syntax highlighting rules like in nano? I have a custom file type, which contains lots of fields like
FieldName: FieldValue

I'm trying to create syntax highlighting for this filetype, in nano and vim, such that "Fieldname" appears in blue, and anything from the colon onwards, including the colon, appears in yellow. In nano I achieve this easily due to its 'cascading' nature:
color yellow     start="^FieldName: " end="$"   # Make the whole thing yellow
color brightblue       "^FieldName"             # Then change the first part to blue

In vim, it doesn't look like rules cascade, but I can achieve the above using 'matchgroup', which allows treating 'boundary' matches differently to 'content':
syn region Yellow matchgroup=Blue start="^FieldName" end="$"

So far so good. The problem arises in the special case that some FieldValues need to be coloured differently, because they are special. In nano, I can simply add another rule onto the cascade:
color yellow         start="^FieldNAme: " end="$"     # Make the whole thing yellow
color bold,lightyellow,red "^FieldName: SpecialValue" # Then change up to the special value to red
color yellow               "^FieldName: "             # Then up to the colon to yellow again
color brightblue           "^FieldName"               # Then up to the fieldname to blue

However, when I try to do the same in vim, I am stuck. I have no idea how to match groups at multiple levels. Is there a way to enable such cascading behaviour in vim? Or, alternatively, can someone point me in the right direction to achieve the above effect?

A: In Vim if inside another syntax match/region then only some of submatches tried. These matches must appear in contains=xxx,yyy,zzz attribute of an upper level match (or, alternatively, they can have an attribute containedin=aaa, where aaa is an upper-level match). Also the sub-matches should usually have contained attribute that forbids matching them on the global level (i.e. uncontained).
As a final note, if a collision arises (i.e. two or more submatches can match at the same position) then the last one wins. So the order matters.
Upd. This example is pretty straightforward and doesn't need many rules. Yet exact regex definitions may vary, so giving it rather for illustrative purposes.
Var.1
syn match MyFileFieldWhole /^\w\+: .*/ contains=MyFileFieldName,MyFileFieldSpecial
syn match MyFileFieldName /^\w\+/ contained
syn keyword MyFileFieldSpecial SpecialValue contained

hi def MyFileFieldWhole guifg=yellow
hi def MyFileFieldName guifg=lightblue
hi def MyFileFieldSpecial guifg=red

Var.2
syn match MyFileFieldName /^\w\+: /me=e-2 nextgroup=MyFileFieldValue
syn match MyFileFieldValue /: .*/ contains=MyFileFieldSpecial contained
syn keyword MyFileFieldSpecial SpecialValue contained

hi def MyFileFieldName guifg=lightblue
hi def MyFileFieldValue guifg=yellow
hi def MyFileFieldSpecial guifg=red

A: This is how I solved the above problem, (using the same pseudofields as above, and showing only the relevant rules here). Hopefully this might prove useful to others with the same challenge.
" Vim syntax file
" Language   : myfiletype
" Filenames  : *.myfileextension
" Maintainer : Me
" Last Change: 2022-06-19

" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
  finish
endif

" SpecialValue is special, put it in red box. Fieldname in blue.
syn match Group1 "^FieldName: SpecialValue$"    contains=Group2
syn match Group2 "^FieldName: \zeSpecialValue$" contains=Group3 contained
syn match Group3 "^FieldName\ze: SpecialValue$" contained

" all other values in plain yellow, with fieldname in blue.
syn match Group2 "^FieldName: \(SpecialValue$\)\@!.*$"    contains=Group3
syn match Group3 "^FieldName\ze: \(SpecialValue$\)\@!.*$" contained

" Group-code color definitions ==
hi def Group3             ctermfg=blue
hi def Group2             ctermfg=darkyellow
hi def Group1 cterm=bold  ctermfg=yellow  ctermbg=darkred

let b:current_syntax = "myfiletype"

Some explanatory notes:

*

*I used syn-match instead of syn-region in the end, as the former guaranteed single-line matching.

*The \ze bit acts as a 'cut'; the regexp first matches fully, then gets 'cut' up until the \ze part, which is then used for the highlighting.

*The \@! causes the regexp to succeed when the previous atom (in this case the bit in parentheses) is NOT present.

*The various 'containment' levels, where the 'outer match' is the same, but at each level the 'inner match' caused by \ze is shorter and shorter, manages to emulate the 'cascading' effect I was after. However, an added case explicitly excluding the specialvalue had to be added, to account for 'default' cases where the special value is not present (By contrast, in nano, no explicit exclusion was necessary, as long as this 'default' rule was placed at the top of the 'cascade').

*The above example demonstrates rules accounting for a single specialvalue. If you have multiple specialvalues to exclude (which was the case in my actual problem), you can convert \(SpecialValue$\)\@! to \(SpecialValue1\|SpecialValue2\)\@!, etc, to account for the explicit exclusion of all special values in the 'default' rule.


text:
Q: Proving a series of functions does not converge uniformly on $\mathbb{R}$ I'm working through a question (it's a question with parts that builds on each other) that overall will show:

*

*a series of functions does not converge uniformly on $\mathbb{R}$ by
showing the sequence of its partial sums is not uniformly Cauchy on
$\mathbb{R}$

The series of functions is: $$\sum_{n=1}^{\infty}{\dfrac{1}{\sqrt{n}}\sin\left(\frac{x}n\right)} \quad
$$
Firstly, I'm asked to show the negation for uniformly Cauchy:

*

*For some $\epsilon > 0$, for all $n$ $\epsilon$ $\mathbb{N}$, there
exists an $m, n \geq N$ and there exists an $x$ $\epsilon$ I such
that $|f_m{(x)} - f_n{(x)}| \geq \epsilon$

Secondly: If $k, N$ $\epsilon$ $\mathbb{N}$ and $N + 1 \leq k \leq 4N + 3$, show that :

*

*$1 \geq \sin\left(\frac{N+1}k\right) \geq \frac{1}5$

I have done this on paper, but would take while to write out, so will omit my answer here.
Third (where I'm beginning to get stuck): Show that for all $N$ $\in$ $\mathbb{N}$
$$\sum_{k=N+1}^{k=4N+3}{\dfrac{1}{\sqrt{k}}} \geq 2\sqrt{2}$$
My idea for part 3 is to compare it to an integral, specifically the integral of $\frac1{\sqrt{x}}$, but I'm not sure how to show this relation for all $N$ (what the limits of integration should be) - any tips?
Lastly:

*

*Show that when $x = N + 1, m = 4N + 3$, and $n = N$, $$|S_m{(x)} -
   S_n{(x)}| \geq \frac{2\sqrt{2}}5$$
And then ultimately show the original sequence doesn't uniformly
converge on $\mathbb{R}$
Part C I think I'm on the right track and some tips should suffice, but for part d I'm relatively lost. Any help's greatly appreciated - thank you

A: Part 2
Let $N + 1 \le k \le 4N + 3$.
Then $\frac{N+1}{k}$ satisfies the inequalities $\frac{N+1}{4N+3}\le\frac{N+1}{k}\le1$.
Now, for $x$ in the interval $\left(\frac{N+1}{4N+3},1\right)$, $\sin x$ is monotonically increasing and we have
$$1\ge \sin(1)\ge \sin\left(\frac{N+1}{k}\right)\ge\sin\left(\frac{N+1}{4N+3}\right)$$
and thus
$$\begin{align}
\sin\left(\frac{N+1}{k}\right)&\ge\sin\left(\frac{N+1}{4N+3}\right)\\\\
&\ge\sin(1/4)\\\\
&\ge \frac14-\frac{1}{3!}(\frac14)^3\\\\
&=\frac14\left(1-\frac{1}{96}\right)\\\\
&>\frac15
\end{align}$$
which was to be shown.

Part 3
For this part, we will use the result from the following integral
$$\begin{align}
\int_{N+1}^{4N+4}\frac{dx}{\sqrt{x}}&=2\left(\sqrt{4N+4}-\sqrt{N+1}\right)\\
&=2\sqrt{N+1}(2-1)\\
&\ge 2\sqrt{2}
\end{align}$$
for $N\ge1$.
Now, we note that this integral can be represented by the following summation:
$$\begin{align}
\int_{N+1}^{4N+4}\frac{dx}{\sqrt{x}}&=\sum_{k=N+1}^{4N+3}\int_{k}^{k+1} \frac{dx}{\sqrt{x}}\\
&\le\sum_{k=N+1}^{4N+3} \frac{1}{\sqrt{k}}
&\ge 2\sqrt{2}
\end{align}$$
and we have the desired inequality!

Part 4
From the Part 2, we showed that if $N + 1 \le k \le 4N + 3$, then
$$1 \ge \sin\left(\frac{N+1}{k}\right) \ge \frac15$$
From the Part 3, we showed that for all $N$
$$\sum_{k=N+1}^{4N+3}{\frac{1}{\sqrt{k}}} \ge 2\sqrt{2}$$
Then, putting these together we have
$$\begin{align}
|S_m(x)-S_n(x)|&=\left|\sum_{k=N+1}^{4N+3} \frac{\sin((N+1)/k)}{\sqrt{k}}\right|\\
&\ge\left|\sum_{k=N+1}^{4N+3} \frac{\frac15}{\sqrt{k}}\right|\\\\
&\ge\frac15\left|\sum_{k=N+1}^{4N+3} \frac{1}{\sqrt{k}}\right|\\\\
&\ge\frac{2\sqrt{2}}{5}
\end{align}$$


text:
Q: How can I change the font color of a ListView I have used setAdapter method into insert text to the ListView. I can't find a way to change the font color in the ListView. Google search gives me results which they have used TextView with a ListView.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".viewnotesActivity"
android:orientation="vertical">

<ListView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/notes_list"
    android:divider="@color/colorPrimary"/>
/>

ArrayAdapter<String> adapter = new ArrayAdapter<>(this,layout,list);
    ListView lv = findViewById(R.id.notes_list);
    lv.setAdapter(adapter);
    lv.setBackgroundColor(getColor(R.color.colorPrimary));

    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            TextView tv = (TextView)view;
            String note = tv.getText().toString();
            String file = data.get(position);

            Intent intent = new Intent(viewnotesActivity.this,editnoteActivity.class);

            intent.putExtra("note",note);
            intent.putExtra("file",file);
            startActivity(intent);
        }
    });


text:
Q: How to validate complete html using java I want to validate HTML tags and it contents using java. Validation should make sure all the html tags are closed properly. There is no mistake in the tag creation area. For eg

or

I need to validate such kind of things. while googling I got a regular expression like this
<(\"[^\"]*\"|'[^']*'|[^'\">])*>

But it wont validate all the HTMLs are closed or not? So how can I add that also with this.
My sample code is attached below. Please help me.
package com.test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class htmlValidator {

    private static Pattern pattern;
    private static Matcher matcher;

    private static final String HTML_TAG_PATTERN = "<(\"[^\"]*\"|'[^']*'|[^'\">])*>";

    public void HTMLTagValidator(){
        pattern = Pattern.compile(HTML_TAG_PATTERN);
    }

    public static boolean validate(final String tag){
          matcher = pattern.matcher(tag);
          return matcher.matches();
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

        String htmlStr = "

This is first paragraph. This is first paragraph.
 Yes this is spab
";

        System.out.println("htmlStr :- "+htmlStr);

        validate(htmlStr);

    }

}

A: If you really do need to parse HTML using pure java, there are many open source options available.  However, I would recommend instead using W3C to validate your syntax as they by definition will be much more up to date on correct usages.  Good luck with your project.

A: <(\"[^\"]*\"|'[^']*'|[^'\">])*>

is for a single tag,
<(\"[^\"]*\"|'[^']*'|[^'\">])*>(.*<(\"[^\"]*\"|'[^']*'|[^'\">])*>)?

is for a pair of tags or a single tag.
however, complex cases can't be validated by an one liner regex.


text:
Q: Can't finalise python set-ups - Subprocesses file causing issues Firstly, I'd just like to say my level of python programming is absolute beginner so please be patient!
I've installed Python 3.7.4, along with some packages such as numpy, xlwings and (most importantly) selenium.
I've downloaded the this onto my 64-bit windows 10 laptop and followed the advice of the Python forum to address issues particular to Windows but still, when I try to run a slightly modified version of this example code which basically opens a browser (the sample opens firefox, I'm using Chrome - they both have this same issue!), navigates to facebook and logs-in.
My code is:
from selenium import webdriver
import time

username = 'fb_email@email.com'
password = 'fb_password'

url = 'https://www.facebook.com/'

driver = webdriver.Chrome(executable_path=r"C:\\Python37\\Lib\\site-packages\\selenium\\webdriver\\chrome\\webdriver.py")

driver.get(url)

driver.find_element_by_id('email').send_keys(username)
driver.find_element_by_id('pass').send_keys(password)

time.sleep(2)

driver.find_element_by_id('loginbutton').click()

When I run this code I'm getting the following error message:

Traceback (most recent call last):
  File
  "C:/Python37/Codes/Test.py", line 9, in
      driver = webdriver.Chrome(r"C:\Python37\Lib\site-packages\selenium\webdriver\chrome\webdriver.py")
  File
  "C:\Python37\lib\site-packages\selenium\webdriver\chrome\webdriver.py",
  line 73, in init
      self.service.start()   File "C:\Python37\lib\site-packages\selenium\webdriver\common\service.py",
  line 76, in start
      stdin=PIPE)   File "C:\Python37\lib\subprocess.py", line 775, in init
      restore_signals, start_new_session)   File "C:\Python37\lib\subprocess.py", line 1178, in _execute_child
      startupinfo) OSError: [WinError 193] %1 is not a valid Win32 application

You'll notice one other change I've made from the original code is I've include the full file path (explicitly referencing Webdrive.py file) to deal with the "permissions" error.
Basically, I just want to get to the stage I can run this code and I can do I know I can run selenium on python in principal and deal with the nested looping within the python code at a later date so any help/suggestions would be greatly appreciated.

A: Root Cause:
You are not providing the correct path to the executable_path in line # 9. executable_path should point to the chromedriver.exe path not the p.py path.
How to fix:
Update the line#9 with the correct path to the chromedriver.exe.
# make sure you add `.exe` file name too at the end like `chromedriver.exe`.
driver = webdriver.Chrome(executable_path=r"pathToChromedriver")


text:
Q: Prevent a cell from expanding table height I'm attempting to make an image take all the remaining width available for a table and span the entire height of a table without extending it any further, with overflow:auto to scroll if there's not enough height.
The width bit is easy, but no matter what I do the table cell containing the image will extend the height of the table. Is there a way to prevent this, short of explicitly setting the image's height?

A: Thus far the solutions I've found differ on browser, so aren't ideal. You could render different markup based on the client. (But still looking for a more universal answer.)
Updated again for the most universal solution so far:

Either works in Chrome, and the IE_CompatMode has to be added when IE has compatibility mode On.

And nothing (that I've yet tried) works in Firefox.

A: You would have to use a wrapper element around the content to restrict the height.

This is short.

This is longer.

This is really long and repeated. This is really long and repeated.

.overflow {
    max-height:40px;
    overflow:hidden;
}

var tableHeight = $('table').height();
$('.overflow').css('height',tableHeight + 'px');

A: Could always give the image a percentage e.g. height="100%" that should make it the full size of the cell that it is in but would restrict overflow.


text:
Q: Animating Floating Action Button in Flutter I'm trying to add in an animated where when the user scrolls down, the fab will animated out and disappear, and when scroll up, the fab reappear again.
Here is my code:
return Scaffold(
      floatingActionButton: AnimatedContainer(
        curve: Curves.easeIn,
        duration: const Duration(seconds: 1),
        child: Opacity(
          opacity: _fabVisible ? 1 : 0,
          child: FloatingActionButton(
            onPressed: () {},
            child: Icon(
              Icons.add,
              color: Colors.black,
            ),
            backgroundColor: Colors.white,
          ),
        ),
      ),

What the code is doing now is the fab is hiding properly, but it doesn't animate the opacity, it just pop in and out without animation, please help!
thank you

A: try to use scrollnotification for detecting scroll down (increase of pixels) and scroll up (decrease of pixels), when scroll down, setState _fabVisible = 0, vice versa:
Expanded(
            child: NotificationListener<ScrollNotification>(
              onNotification: (scrollNotification) {
                if (scrollNotification is ScrollStartNotification) {
                  _onStartScroll(scrollNotification.metrics);
                } else if (scrollNotification is ScrollUpdateNotification) {
                  _onUpdateScroll(scrollNotification.metrics);
                } else if (scrollNotification is ScrollEndNotification) {
                  _onEndScroll(scrollNotification.metrics);
                }
              },
              child: ListView.builder(
                itemCount: 30,
                itemBuilder: (context, index) {
                  return ListTile(title: Text("Index : $index"));
                },
              ),
            ),
          ),

_onStartScroll(ScrollMetrics metrics) {
      setState(() {
        message = "Scroll Start";
      });
    }
_onUpdateScroll(ScrollMetrics metrics) {
      setState(() {
        message = "Scroll Update";
      });
    }
_onEndScroll(ScrollMetrics metrics) {
      setState(() {
        message = "Scroll End";
      });
    }


text:
Q: Multiple Recursion Patterns don't seem to work I have a template class to handle templates so, this is a line taken from that class. I'll spare many of the details, as many of them have to do with loading templates.
$tmpl = <<<tem

Test Site

                Home

Search

            {if(\$is_guest)}

Register

Login

            {/if}{else}

Profile

My Account

Logout

            {/else}
            {if(\$is_admin)}

Admin

            {/if}
            {!nav}

tem;

    $tmpl = preg_replace_callback('#{\$(.+?)}#u',array(get_class($this),'varsub'),$tmpl);
    $tmpl = preg_replace_callback("#{if\(([A-Za-z0-9\$_!]+)\)}((?:(?R)|.*?)+)\{/if\}\{else\}((?:(?R)|.*?)+)\{/else\}#ismu",array(get_class($this),'boolelsesub'), $tmpl);

For some reason, this Regex results in the page never loading, instead of doing what I would expect.
I've looked at many online resources however, none of them seem to mention using two recursive patterns at once.
It doesn't seem to be reaching the callback which I have assigned to it either.
protected function boolelsesub($input)
{
    var_dump($input);
    $h = fopen('bah.txt', 'a');
    fwrite($h,'test');
    fclose($h);
    exit;
}

Edit: The contents of boolelsesub, which has been stripped down to make it easier to debug.

A: Try with this pattern:
$pattern = <<<'LOD'
~
{ if \( ([^)]+) \) }

( (?>[^{]+|(?R))* )

{ / if }
(?:
    { else }

    ( (?>[^{]+|(?R))* )

    { / else }
)?
~ix
LOD;

Online demo
Even if your pattern works with this edit, the result will be inefficient due to (?:(?R)|.*?)+. This part is inefficient in particular because .*? is lazy and can match the empty string. To solve this, I replace it with a negated character class with a greedy quantifier [^{]+


text:
Q: facebook SDK with react-native: no framework search path I was playing around with Facebook SDK with react-native generated ios app template. I was following the instructions here: https://developers.facebook.com/docs/ios/getting-started  but somehow did not see Framework Search Paths mentioned in step 4.5.  the react-native generated ios project seems to only have header search path, as shown below.
I was using latest Xcode version (9.3)

A: Try upgrading project templates - Upgrade guide
Or try to use RN wrappers available on the internet.
I personally like these two - this and this
Good luck!

A: You need to change Basic to All tab at the top of the menu

No need of upgrading anything


text:
Q: std::ofstream constructor blocking I have the following code:
std::ofstream stat("/opt/lic_status");
if ( stat.is_open() )
{
    stat << ver;
    stat.close();
}

My problem is that on the first line the execution is blocked. A coredump was generated by a watchdog during this block and it looks like this:
(gdb) bt
#0  0x00cb5430 in __kernel_vsyscall ()
#1  0x00b2833b in open () from /lib/libc.so.6
#2  0x00ac37c8 in _IO_new_file_fopen () from /lib/libc.so.6
#3  0x00ab73dd in __fopen_internal () from /lib/libc.so.6
#4  0x00ab9c4c in fopen64 () from /lib/libc.so.6
#5  0x00d6e877 in std::__basic_file<char>::open(char const*, std::_Ios_Openmode, int)     () from /usr/lib/libstdc++.so.6
#6  0x00d1d75e in std::basic_filebuf<char, std::char_traits<char> >::open(char const*,     std::_Ios_Openmode) () from /usr/lib/libstdc++.so.6
#7  0x08b625b8 in open () at /usr/lib/gcc/i686-redhat-linux/4.4.4/../../../../include    /c++/4.4.4/fstream:699
#8  basic_ofstream () at /usr/lib/gcc/i686-redhat-linux/4.4.4/../../../../include/c++/4.4.4/fstream:628

I need to mention that I don't know what was the state of the /opt/lic_status file when the problem occurred. I don't know if it was opened by other process or even if it existed at all.
Does anoyone have any suggestion on what could have caused this?
I only have the coredump, can I get any info out of it?

A:
"I need to mention that I don't know what was the state of the
  /opt/lic_status file when the problem occurred. I don't know if it was opened by other process or even if it existed at all."

Based on my understanding none of the above attribute/state of the file can lead the program to block on that particular line(.i.e. where user mode program is calling open() inside the std::ofstream constructor). Whenever user  mode program calls open() system call to open the files, system would complete the call with appropriate error code. It will not be the case that system(kernel mode) would not return back to user mode.

Does anyone have any suggestion on what could have caused this? I
  only have the coredump, can I get any info out of it?

*

*Entire system(kernel) is not in good state(due to some unknown reason).

*The program is multi threaded and some other threads has been stuck somewhere. By looking the call stack of this thread it looks OK as it is executing in the kernel mode and calling open() system call.

If we are experiencing the first case, then I believe we can not do much and core-dump file of the program would not give any extra information to identify/confirm this. Core-dump file just contains the snapshot of that particular process.
However, if we are in second case, then we should try to analyze core-dump file further. We can fire following commands in GDB command prompt once core-dump file is loaded.
$info threads
$thread apply all backtrace

The above command would give the information (if your program is multi-threaded) as well call stack of all threads. This might be helpful to understand your problem. You can ignore the above information if you have already done it.


text:
Q: Problem with truncation of floating point values in DBSlayer When I run a query through DBslayer http://code.nytimes.com/projects/dbslayer the floating point results are
truncated to a total of six digits (plus decimal point and negative
sign when needed).
{ ... "lat":52.2228,"lng":-2.19906, ... }
When I run the same query in MySQL, the results are as expected.
| 52.22280884 | -2.19906425 |
Firstly, am I correct in identifying DBSlayer as the cause of this
effect?  (Or the JSON library it uses, etc.)
Secondly, is this floating point precision configurable within DBSlayer?
Thanks,
Chris.
P.S. Ubuntu 9.10, x86_64
Path: .
URL: http://dbslayer.googlecode.com/svn/trunk
Repository Root: http://dbslayer.googlecode.com/svn
Repository UUID: 5df2be84-4748-0410-afd4-f777a056bd0c
Revision: 65
Node Kind: directory
Schedule: normal
Last Changed Author: dgottfrid
Last Changed Rev: 65
Last Changed Date: 2008-03-28 22:52:46 +0000 (Fri, 28 Mar 2008)

A: I eventually solved this problem.
There are several places where DBSlayer uses printf's %g to format doubles.  This gives only 6 significant digits.
Replacing all of these occurrences with %.15g, and recompiling, has solved the problem.


text:
Q: How to close window after PHP code is executed? I have two problems:

*

*How do I close the window once I Have executed my PHP code which is a simple save textbox values to database?

*How do I get my text boxes to align so they perfectly aligned currently one is more indented than the other DEMO?
Here's the PHP code that saves data into my database once saved I want the current window to close:
<form name="Permit" id="Permit" action="<?php echo JURI::current(); ?>" method="post">
    Permit or Deny: <input align= center  type="text" name="Permit_or_Deny" value="">

    Level <input type="text" name="Level" value="">

<input id="submit" name="submit" type="submit" value="Permit Or Deny Submit Buutton" />

</form>

<?
if ((isset($_POST['Permit_or_Deny'])) || (isset($_POST['Level']))) {
    //first name or last name set, continue-->
    $Permit_or_Deny = $_POST['Permit_or_Deny'];
    $Level          = $_POST['Level'];

    $db =& JFactory::getDBO();
    $query = "INSERT INTO tp_newedit (Permit_or_Deny, Level) VALUES ('" . $Permit_or_Deny . "','" . $Level . "');";

    $db->setQuery($query);
    $db->query();
} else {
    echo '
One Field Is Required!
';
}
?>

A: For first part -
<form name="Permit" id="Permit" action="<?php echo JURI::current(); ?>" method="post">

 Permit or Deny:
<input align= center  type="text" name="Permit_or_Deny" value=""/>

 Level
 <input type="text" name="Level" value="">

<input id="submit" name="submit" type="submit" value="Permit Or Deny Submit Buutton" />

    </form>

For second part, place this on server side code-
<?php
    /* ... SQL EXECUTION TO UPDATE DB ... */

    echo "";
?>

A: Try window.close() of JavaScript:-
<?

if ((isset($_POST['Permit_or_Deny'])) || (isset($_POST['Level']))) {
    //first name or last name set, continue-->
    $Permit_or_Deny = $_POST['Permit_or_Deny'];
    $Level          = $_POST['Level'];

    $db =& JFactory::getDBO();
    $query = "INSERT INTO tp_newedit (Permit_or_Deny, Level) VALUES ('" . $Permit_or_Deny . "','" . $Level . "');";

    $db->setQuery($query);
    $db->query();

    echo  "";
} else {
    echo '
One Field Is Required!
';
}

?>


text:
Q: How I can call setstate from another file? I have class :
class FavoritesState extends State<Favorites> {
  var configOk = isConfigLoaded;
  @override
  Widget build(BuildContext context) {
    if (configOk) {
      return Padding(
        padding: EdgeInsets.only(top: 10),
        child: ListView.builder(
          itemCount: stationList.length,
          itemBuilder: (context, position) {
            return StationCard(stationList[position]);
          },
        ),
      );
    } else {
      return LoadingScreen();
    }
  }

  void callback() {
    setState(() {
      this.configOk = true;
    });
  }
}

And I have method:
Future<http.Response> getConfig() async {
    //Load Config
    isConfigLoaded = true;
}

I need at the end this method call setstate in FavoritesState and upload information there. How I can do this? Thank you.

A: You can also use a FutureBuilder if you're only updating the state of the widget once. The FutureBuilder will force your widget to rebuild as soon as your getConfig() call has completed.
This would simplify things:
class Favorites extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return FutureBuilder(
      future: getConfig(),
      builder: (context, snapshot) {
        if (snapshot.data == null) {
          // display the loading screen as long as your getConfig() call hasn't finished
          return LoadingScreen();
        }
        return Padding(
          padding: EdgeInsets.only(top: 10),
          child: ListView.builder(
            itemCount: stationList.length,
            itemBuilder: (context, position) {
              return StationCard(stationList[position]);
            },
          ),
        );
      },
    );
  }
}

And then tweak your call to something like this:
Future<http.Response> getConfig() async {
  //Load Config

  // return your result
  return result;
}


text:
Q: How to avoid the Conflicting getter definitions for property with same attribute name with different datatype Is there any way to avoid the Conflicting getter definitions for property "memory" where it is generated in runtime where we cannot change the strucutre,
{
"memory": "not_available"
}

{
"memory": {
    "data1": 0,
    "data2": 2,
}
}

I have 1 properties with different data type and how to handle the scenario's where I am using fasterxml api
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
    "memory"
})

public class MyMemoryData{
     @JsonProperty("memory")
     private Memory memory;

     @JsonProperty("memory")
     private String memoryValue;
     }

Getting the below Exception Conflicting getter definitions for property "memory":

A: Are you sure that you really need two different fields for the "memory" field? I mean, are you able to use only private Memory memory; and set null if it is "not_available"?
If yes ("not_available" == null), you can write your custom Jackson deserializer for the memory field, which will implement logic: if the value is "not_available", returns null, else parse the object.


text:
Q: What's wrong with my R plots produced by Eclipse? I've been using the Stat/ET Eclipse R Combo for quite a while and I am happy with it. Though lately plots behave strange. If I plot something, plots open in a Quartz window (which is fine). But I can neither resize it nor close it (except if I force it to close). The task manager just labels these open quartz windows "java".
I havent had this issue before, probably I just happened after my Eclipse update to helios. Maybe I just missed some setting that I had before.
a) has anyone an idea how to fix this ?
b) how can I set the default plot to X11 plotting to circumvent the whole issue until i found a solution?
Eclipse Helios, R 2.12, Mac OS X 10.6.2

A: I found this too (Eclipse SDK Version: 3.6.1; OS X 10.6.6, x86_64). You can get round it by running X11:
X11()

or, I typically use Cairo:
library(Cairo)
Cairo(X11)


text:
Q: How do I create a multiple tab Excel workbook on a client machine? I have a tabbed series of grids on a data preview page.  I now need to import the data from each grid into its own sheet in an Excel workbook.
How could I do this?
BTW, this is on a Mac or a PC.

A: This is for .net C#
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition:", "attachment;filename=filename.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.ms-excel";
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new  System.Web.UI.HtmlTextWriter(oStringWriter);
this.ClearControls(Grid);
Grid.RenderControl(oHtmlTextWriter);

If you want to create multiple sheets in single work book then you will have to use a dll.

A: I've done this in two ways in the past:

*

*Using Excel automation, and using the Excel API on a server to create multiple sheets.
(Not recommended, but it does work.)

*Create the XML you would see when you save the equivalent spreadsheet in Excel and upload it as per Samiksha's suggestion.
Normally I create a template in Excel, save as XML, then I alter the contents of it depending on the data I want to display.


text:
Q: How to show that the error variance of the best linear predictor is inferior to the proportional predictor? Let's consider the 1D case. How do we prove that the error variance of the Best Linear Predictor (BLP) is inferior than the Proportional Predictor (i.e. the Linear Predictor without the intercept)?
For recall, the BLP of $Y$ given $X$ is:
\begin{equation}
BLP(X) = \alpha + \beta X
\end{equation}
with $\alpha = E(Y) - E(X) \beta$ and $\beta = Var(X)^{-1}Cov(X,Y)$
The Proportional Predictor of $Y$ given $X$ is:
\begin{equation}
PP(X) = \gamma X
\end{equation}
with $\gamma = \frac{E(XY)}{E(X^2)}$
I found that the error variance of the BLP is: $E(e_{BLP}^2) = Var(Y) - \frac{Cov(X,Y)^2}{Var(X)}$
and that the error variance of the Proportional Predictor is: $E(e_{PP}^2) = E(Y^2) - \frac{E(XY)^2}{E(X^2)}$.
I'm a bit stuck trying to show: $E(e_{BLP}^2) \leq E(e_{PP}^2)$, ie that
\begin{equation}
Var(Y) - \frac{Cov(X,Y)^2}{Var(X)} \leq E(Y^2) - \frac{E(XY)^2}{E(X^2)}
\end{equation}

A: Here is the proof.
Let's consider the difference $\Delta$:
     \begin{align*}
     \Delta &= E(e_{PP}^2) - E(e_{BLP}^2)
     \\&= E(Y^2) - \frac{E(XY)^2}{E(X^2)} - Var(Y) + \frac{Cov(X,Y)^2}{Var(X)}
     \\&= E(Y)^2 + \frac{Cov(X,Y)^2 E(X^2) - E(XY)^2 Var(X)}{E(X^2) Var(X)}
     \\&= E(Y)^2 + \frac{Cov(X,Y)^2 E(X^2) - E(XY)^2 E(X^2) + E(XY)^2 E(X)^2}{E(X^2) Var(X)}
     \\&= E(Y)^2
      \\&+\frac{(E(XY)^2 + E(X)^2E(Y)^2 - 2E(XY)E(X)E(Y)) E(X^2) - E(XY)^2 E(X^2) + E(XY)^2 E(X)^2}{E(X^2) Var(X)}
     \\&= E(Y)^2 + \frac{(E(X)^2E(Y)^2-2E(XY)E(X)E(Y)) E(X^2) + E(XY)^2 E(X)^2}{E(X^2) Var(X)}
     \\&= \frac{E(Y)^2E(X^2)(Var(X)+E(X)^2)-2E(XY)E(X)E(Y)E(X^2) + E(XY)^2 E(X)^2}{E(X^2) Var(X)}
     \\&= \frac{E(Y)^2E(X^2)^2-2E(XY)E(X)E(Y)E(X^2) + E(XY)^2 E(X)^2}{E(X^2) Var(X)}
     \\&= \frac{(E(Y)E(X^2)-E(XY)E(X))^2}{E(X^2)Var(X)} \geq 0
 \end{align*}
     So we have proved that $\Delta \geq 0$, i.e. $E(e^2) \geq E(e_{BLP}^2)$, the proportional predictor's MSE is greater than the linear predictor.


text:
Q: How to pass seleced raw data to another page with the Url? In my web application I am using a dynamic datatable ,
How can I pass the selected Employee Id to another page when the Delete is clicked ??
I am using C# Function:
try
{
    CommonClass CC = new CommonClass();
    DataTable dt = CC.GetAllDetails("AllEmployee");

    //Building an HTML string.
    StringBuilder html = new StringBuilder();

    //Table start.
    html.Append("
");

    //Building the Header row.
    html.Append("
");
    html.Append("
");

    foreach (DataColumn column in dt.Columns)
    {
        html.Append("");
        html.Append(column.ColumnName);
        html.Append("	");
    }

    html.Append("");
    html.Append("Delete");
    html.Append("	");
    html.Append("
");
    html.Append("
");
    html.Append("
");

    //Building the Data rows.
    foreach (DataRow row in dt.Rows)
    {
        html.Append("
");
        foreach (DataColumn column in dt.Columns)
        {
            html.Append("");
            html.Append(row[column.ColumnName]);
            html.Append("	");
        }

        html.Append("");
        html.Append("");
        html.Append("Delete");
        html.Append("");
        html.Append("	");
    }

    html.Append("
");
    //Table end.
    html.Append("
");

    //Append the HTML string to Placeholder.
    PlaceHolder1.Controls.Add(new Literal { Text = html.ToString() });
}

so far my url looks DeleteEmployee.aspx?Employee_Id , how can i get the selected employee id with this..??

A: you can try to append also the employee using using this code:
html.Append("");

or if you are using C#6+, use string interpolation.
html.Append($"");


text:
Q: Finding the correct handle of Notepad++ to use in SendMessage() I'm in my first try with WinAPI and I am trying to send some text from a Delphi program (well Lazarus) to Notepad++.
I already found a good example to use simple Notepad, that goes like this :
Procedure TForm1.Button1Click(Sender: TObject);
var Var1, Var2 : HWND;
Begin
    Var1 := FindWindow('notepad', nil);
    Var2 := FindWindowEx(Var1, FindWindow('Edit', nil), nil, nil);
    Clipboard.AsText:='This is some sample text.';
    SendMessage(Var2, WM_PASTE, 0, 0);
End;

So this works fine for Notepad.
Now I would like to adapt it to use with any other program.
Taking Notepad++ for example, how do I find it's equivalent to 'Edit' used there in the FindWindowEx() ? Or let's say the correct cell and workbook to paste in LibreOffice Calc?
Any samples or clues?
Thanks.


text:
Q: Shoot problem: How to show a bullet before shoot? I would like the 'banana' to be shown when the space bar is pressed, while it follows the character movement, and then to be fired upon the release of the same.
    import pygame
    from pygame.locals import *

    #inizializzazione
    pygame.init()
    screen=pygame.display.set_mode((400,750))
    pygame.display.set_caption('MonkeyBanana')
    FPS=60

    #load image
    img_ground = pygame.image.load('Surf/sfondo.jpg').convert_alpha()
    surf_ground=pygame.transform.scale(img_ground,(img_ground.get_width(),screen.get_height()))

    class Monkey (pygame.sprite.Sprite):
        def __init__(self):
            super().__init__()
            self.sprites = [pygame.transform.scale((pygame.image.load('Surf/Animazioni/monkey_idle_00.png').convert_alpha()),
                                                   (screen.get_width() / 5, screen.get_height() / 7)),
                            pygame.transform.scale((pygame.image.load('Surf/Animazioni/monkey_idle_01.png').convert_alpha()),
                                                   (screen.get_width() / 5, screen.get_height() / 7)),
                            pygame.transform.scale((pygame.image.load('Surf/Animazioni/monkey_idle_02.png').convert_alpha()),
                                                   (screen.get_width() / 5, screen.get_height() / 7)),
                            pygame.transform.scale((pygame.image.load('Surf/Animazioni/monkey_idle_03.png').convert_alpha()),
                                                   (screen.get_width() / 5, screen.get_height() / 7))
                            ]

            self.launch_monkey=[]
            for i in range(0, 19):
                filename = "Surf/Animazioni/monkey_{:0>3}.png".format(i)
                img = pygame.image.load(filename).convert_alpha()
                img_reduced = pygame.transform.scale(img, (screen.get_width() / 5, screen.get_height() / 7))
                self.launch_monkey.append(img_reduced)

            self.count=0
            self.count1 = 0

            self.image = self.sprites[self.count]
            self.rect = self.image.get_rect()
            self.rect.midbottom = (screen.get_width() / 2, screen.get_height())
            all_sprites.add(self)

        def update(self):
            self.count += 0.08
            if self.count >= 3:
                self.count = 0
            self.image = self.sprites[int(self.count)]
            if move_right and monkey.rect.right < screen.get_width():
                monkey.rect.x += 5
            elif move_left and monkey.rect.left > 0:
                monkey.rect.x -= 5

        def launch(self):
            global launch

            if launch:
                self.count1 += 1
                if self.count1 >= 19:
                    self.count1 = 0
                    launch = False
                self.image = self.launch_monkey[int(self.count1)]

    class Banana (pygame.sprite.Sprite):
        def __init__(self):
            super().__init__()
            self.image= pygame.transform.scale((pygame.image.load('Surf/banana.png').convert_alpha()),
                                               (screen.get_width() / 10, screen.get_height() / 15))
            self.rect=self.image.get_rect()
            self.rect.center = monkey.rect.center
            all_banana.add(self)

here is the problem. Everything works fine on the first launch. The second time I press the space bar, the banana returns to the character's hands instead of continuing the run.
        def update(self):
            global new_banana
            if keep_banana:
                self.rect.center = monkey.rect.center
                new_banana=False

            if launch_banana:
                self.rect.y -= 5

            if self.rect.top<50:
                self.kill()

    #create sprite and Group

    all_sprites = pygame.sprite.Group()
    all_banana= pygame.sprite.Group()
    monkey=Monkey()

    #other variables
    move_right=False
    move_left=False
    launch=False
    launch_banana=False
    keep_banana=False
    new_banana=False

    #principal cicle
    done=False
    while not done:

        for ev in pygame.event.get():
            if ev.type == QUIT:
                done = True
            if ev.type ==KEYDOWN:
                if ev.key== K_RIGHT:
                    move_right=True
                    idle = False
                if ev.key== K_LEFT:
                    move_left = True
                    idle = False
                if ev.key==K_SPACE:
                    keep_banana = True
                    new_banana=True

            elif ev.type ==KEYUP:
                if ev.key== K_RIGHT:
                    move_right=False
                    idle = True
                if ev.key== K_LEFT:
                    move_left=False
                    idle = True
                if ev.key==K_SPACE:
                    launch_banana=True
                    keep_banana = False
                    launch = True

        #Game logic
        if new_banana:
            banana=Banana()

        #screen update

        screen.blit(surf_ground, (0, 0))
        all_sprites.draw(screen)
        all_banana.draw(screen)
        all_banana.update()
        all_sprites.update()
        monkey.launch()
        pygame.display.flip()
        pygame.time.Clock().tick(FPS)

    #end principal cicle
    pygame.quit()

It works to me in another version without classes,by adding the banana to a new group every time it is fired, but I can't get it to work on the classes. I have tried so many times, but nothing seems to work

A: launch_banana makes the banana fly:

if launch_banana:
   self.rect.y -= 5

launch_banana is False at the beginning, but it is never set False again once it has become True. You have to set launch_banana to False when keep_banana is set True:
launch_banana=False
keep_banana=False
new_banana=False

# [...]

while not done:

    for ev in pygame.event.get():
        # [...]

        if ev.type == KEYDOWN:
            # [...]

            if ev.key == K_SPACE:
                launch_banana = False        # <---
                keep_banana = True
                new_banana = True

        elif ev.type == KEYUP:
            # [...]

            if ev.key == K_SPACE:
                launch_banana = True
                keep_banana = False
                launch = True

Anyway, instead of all these Boolean variables, I propose to add a state to the Banana class. The state can be "keep" at the beginning and can be changed to "launched" after the banana is started.
class Banana (pygame.sprite.Sprite):
    def __init__(self):
        super().__init__()
        self.image= pygame.transform.scale((pygame.image.load('Surf/banana.png').convert_alpha()),
                                               (screen.get_width() / 10, screen.get_height() / 15))
        self.rect=self.image.get_rect()
        self.rect.center = monkey.rect.center
        all_banana.add(self)

        self.state = "keep"

    def start(self):
        self.state = "launched"

    def update(self):
        if self.state == "keep":
            self.rect.center = monkey.rect.center

        elif self.state == "launched":
            self.rect.y -= 5

        if self.rect.top<50:
            self.kill()

A: Thanks for the reply
So
implement the launch_banana= False in Space Keydown don't work:
     if ev.key == K_SPACE:
            launch_banana = False        # <---
            keep_banana = True
            new_banana = True

I  implemented the banana states in this way in the game logic and work fine, by creating 2 sprite group:
        import pygame
        from pygame.locals import *

        #inizializzazione
        pygame.init()
        screen=pygame.display.set_mode((400,750))
        pygame.display.set_caption('MonkeyBanana')
        FPS=60

        #load image
        img_ground = pygame.image.load('Surf/sfondo.jpg').convert_alpha()
        surf_ground=pygame.transform.scale(img_ground,(img_ground.get_width(),screen.get_height()))

        class Monkey (pygame.sprite.Sprite):
            [...]

        class Banana(pygame.sprite.Sprite):
            def __init__(self):
                super().__init__()
                self.image = pygame.transform.scale((pygame.image.load('Surf/banana.png').convert_alpha()),
                                                    (screen.get_width() / 10, screen.get_height() / 15))
                self.rect = self.image.get_rect()
                self.rect.center = monkey.rect.center
                one_banana.add(self)   <-------------GroupSingle

                self.state = "keep"

            def start(self):
                self.state = "launched"

            def update(self):
                if self.state == "keep":
                    self.rect.center = monkey.rect.center

                elif self.state == "launched":
                    self.rect.y -= 5

                if self.rect.top < 50:
                    self.kill()

        #create sprite and Group

        all_sprites = pygame.sprite.Group()
        all_banana= pygame.sprite.Group()
        one_banana= pygame.sprite.GroupSingle() <------add this group
        monkey=Monkey()

        #other variables
        move_right=False
        move_left=False
        launch=False
        launch_banana=False
        keep_banana=False
        new_banana=False

        #principal cicle
        done=False
        while not done:

            for ev in pygame.event.get():
                if ev.type == QUIT:
                    done = True
                if ev.type ==KEYDOWN:
                    if ev.key== K_RIGHT:
                        move_right=True
                        idle = False
                    if ev.key== K_LEFT:
                        move_left = True
                        idle = False
                    if ev.key==K_SPACE:
                        keep_banana = True
                        new_banana=True

                elif ev.type ==KEYUP:
                    if ev.key== K_RIGHT:
                        move_right=False
                        idle = True
                    if ev.key== K_LEFT:
                        move_left=False
                        idle = True
                    if ev.key==K_SPACE:
                        launch_banana=True
                        keep_banana = False
                        launch = True

            #Game logic
            **if new_banana:
                banana=Banana()
                if launch_banana:
                    one_banana.empty()
                    all_banana.add(banana)   <------The new logic works
                    banana.start()
                    launch_banana=False
                    new_banana=False**

            #screen update

            screen.blit(surf_ground, (0, 0))
            all_sprites.draw(screen)
            all_banana.draw(screen)
            one_banana.draw(screen)
            one_banana.update()
            all_banana.update()
            all_sprites.update()
            monkey.launch()
            pygame.display.flip()
            pygame.time.Clock().tick(FPS)

        #end principal cicle
        pygame.quit()

There is a way much simple to do this?
Thank you in any case


text:
Q: C# FizzBuzz Switch Solution Is it possible to create the FizzBuzz solution in C# with the switch construct. I've found solutions that work for JavaScript and other languages, but these (or the syntax equivalent) don't seem to be working in C#.
For reference, I'll write the if statement version down below:
for (int x = 1; x <= 15; x++)
        {
            if (x % 5 == 0 && x % 3 == 0)
                Console.WriteLine("FizzBuzz");
            else if (x % 5 == 0)
                Console.WriteLine("Buzz");
            else if (x % 3 == 0)
                Console.WriteLine("Fizz");
            else
                Console.WriteLine(x);
        }
        Console.ReadLine();

EDIT: forgot to put my switch statement code, sorry about that:
for (x = 1; x <= 15; x++)
{
    switch (x)
    {
        case (x % 3 == 0 && x % 5 == 0):
            Console.WriteLine("FizzBuzz");
            break;
        case (x % 5 == 0):
            Console.WriteLine("Buzz");
            break;
        case (x % 3 == 0):
            Console.WriteLine("Fizz");
            break;
        default:
            Console.WriteLine(x);
            break;
    }
}

My problem is with the modulo statements. Error is "Cannot implicitly convert type bool to int. I've tried replacing switch (x) with switch (true) but that doesn't help much, just changes the error to "A constant value is expected" for each of my cases.

A: Like some of the others, I would go with a switch expression over a switch statement. However, I find using a tuple pattern cleaner:
static string FizzBuzz(int i)
{
     return (i % 3, i % 5) switch
     {
         (0, 0) => "FizzBuzz",
         (0, _) => "Fizz",
         (_, 0) => "Buzz",
         (_, _) => i.ToString()
     };
 }

A: This solution uses the switch expression as it is implemented in C# 8.0. Allows for quite concise code. It also uses the local static methods (also available since version 8.0):
public static void FizzBuzz(int n)
{
    for (var i = 0; i <= n; ++i)
    {
        var res = i switch
        {
            var x when is5(x) && is3(x) => "FizzBuzz",
            var x when is5(x) => "Fizz",
            var x when is3(x) => "Buzz",
            _ => i.ToString()
        };

        Console.WriteLine(res);
    }

    static bool is3(int x)
    {
        return x % 3 == 0;
    }
    static bool is5(int x)
    {
        return x % 5 == 0;
    }
}

A:
"Is it possible to create the FizzBuzz solution in C# with the switch construct"

Yes, it is possible, but not very practical (compared to an if statement). This is because you switch on an expression, and then your case statements must compare a constant expression to that value. So you can't do switch (0) and then case (i % 15) because i % 15 is not a constant expression.
Given this, you can switch on i % 15 to reduce the number of comparisons to the known base set, and then special-case the results that are divisible by 3, 5, and 15:
for (int x = 1; x <= 15; x++)
{
    switch (x % 15)
    {
        // Evenly divisible by 15
        case 0:
            Console.WriteLine("FizzBuzz");
            break;

        // Evenly divisible by 3
        case 3:
        case 6:
        case 9:
        case 12:
            Console.WriteLine("Fizz");
            break;

        // Evenly divisible by 5
        case 5:
        case 10:
            Console.WriteLine("Buzz");
            break;

        // Everything else
        default:
            Console.WriteLine(x);
            break;
    }
}

But the if statement is much more concise:
for (int x = 1; x <= 15; x++)
{
    if (x % 15 == 0) Console.WriteLine("FizzBuzz");
    else if (x % 3 == 0) Console.WriteLine("Fizz");
    else if (x % 5 == 0) Console.WriteLine("Buzz");
    else Console.WriteLine(x);
}

A: It is possible to write a fizzbuzz as a simple switch.
It is just about as fast as an if else. I got a bit obsessed about this and created a little benchmark which I uploaded to git: https://github.com/chrisaddams/fizzbuzz-everyway-c-sharp
The results I found for speed are as follows:
Average Speed of Switch  is             63.46 ms
Average Speed of IfElseCont is          62.03 ms
Average Speed of If Else is             60.62 ms
Average Speed of If Only is             73.35 ms
Average Speed of If Cont is             73.55 ms

Anyway, here's the code, I think it's quite a neat and readable solution.
using System.Diagnostics;
using System;
namespace fizzbuzz
{
    class fizzyCase
    {
        static void Main(string[] args)
        {
            Stopwatch timer = new Stopwatch();
            timer.Start();
            for (int i = 0; i <= 10000; i++)
            {
                switch (true)
                {
                    case var FizzBuzz when (i % 15 == 0):
                        Console.WriteLine("fizzbuzz");
                        break;
                    case var Fizz when (i % 3 == 0):
                        Console.WriteLine("fizz");
                        break;
                    case var Buzz when (i % 5 == 0):
                        Console.WriteLine("buzz");
                        break;
                    default:
                        Console.WriteLine(i);
                        break;
                }
            }
            timer.Stop();
            Console.WriteLine("Elapsed:{0}milliseconds", timer.Elapsed.TotalMilliseconds);

        }
    }
}


text:
Q: Using a Dockered Unbound DNS server as a resolver for other containers I'm using Unbound DNS server as a resolver for my home LAN. It runs as a Docker container on the default bridge network and in general it works as I'd expect it to, except when trying to use it as a resolver for the other Docker containers hosted on the same machine.
I tried setting the nameserver in the containers' /etc/resolv.conf to the Docker host's LAN address, but this is clearly not the right way to go (I confirmed that nslookup times out when trying to connect to that IP address).
What is the proper way to configure this setup? Is it necessary (and/or recommended) to connect all the containers to a shared Docker bridge network and then use the address of the DNS container's address on that bridge network? Or is there some other preferable solution?
(Disclaimer: I'm not a networking expert, so if I'm making some other blatant mistakes as well, feel free to advise.)


text:
Q: Limiting Cold Side Temperature on Peltier I'm trying to cool my computer's CPU by sticking a peltier between the CPU and the heatsink, however I don't want to deal with preparing my motherboard and for condensation. Therefore I want to keep the cold side temperature to 50/70*F. How do I regulate the cold side temperature? Is it by limiting voltage or current?

A: Answer:
To do so all that is needed is an automatic variable PWM circuit controlled by the voltage of a thermocouple, a small digital display can be used to set the desired temperature.
Explanation:
The system as a whole must have the capacity to run without overheating, i.e. - the heat output in watts of the item being cooled + the self-generated heat in watts of the Peltier module must be less than the heatsink/fan combination's capacity in watts to dissipate heat or the system will overheat. A Peltier module does not create cold, it cannot. It can only transfer heat. Its semiconductor properties allow it to transfer heat more efficiently by the addition of electrical current, adding its own heat while doing it. The heatsink draws this heat away from the module and transfers it into either a gas(i.e. - the atmosphere via heatsink air current) or liquid(i.e - a water block with circulating cool water) that can absorb the heat. The hot side of the Peltier must be in contact with an energy dissipation device that has a greater dissipating capacity(in watts) than the heat being generated(in watts) by what is being cooled that is in contact with the cold side of the Peltier module + the Resistive heat of the Peltier module itself. if the system does not meet these requirements, the system will fail.

A: First, Peltier does not cool, it just creates a temperature differential between its two sides.
Peltiers aren't that good at carrying a lot of heat transfer.
Yes Peltiers can get pretty cold, but you cannot load much heat energy onto it, hence you won't be able to cool down your CPU much once it is running.
It is even reported that simple air cooling with the traditional radiator is more effective than using a Peltier, the reason being is that the power you use to drive the Peltier is also generating heat on the system by simple laws of physics..

Would a Peltier plate be an efficient CPU/GPU cooler ?
Not really. All it would do is move heat from the cold side of the
Peltier to the hot side. You still have to remove the heat to the
environment somehow.
Further, Peltier cells are not 100% efficient, they take power to
work, which ADDS to the head on the hot side. Moving 100 watts of heat
might take 50 watts of extra input to the Peltier, giving you 150
watts of heat to remove from the hot side.
It is substantially more efficient to have a big heat sink and fan, or
a heat pipe arrangement to move the heat out to where you have space
for a big heat sink and fan.

From Here
Let's say your CPU needs to dissipate 60W of heat.
Let's say you get a 40W Peltier.
Some simple maths: 60+40 = 100W.
You just added another 40W to your system that you have to dissipate. You need a bigger cooler, bigger fan, that perhaps would have performed as well without peltier at all.

A: The amount of cooling is described by equation (1). What it means to you is the more current (\$I^2\$) you run through the peltier, the more heating you will get. If you're trying to cool things down, then don't use full current. The efficiency is also determined by how much of a temperature gradient (temperature from hot to cold side) and the temperature of the peltier.

Source: https://www.electronics-cooling.com/2008/08/a-simple-method-to-estimate-the-physical-characteristics-of-a-thermoelectric-cooler-from-vendor-datasheets/

How do I regulate the cold side temperature?

First you'll need a way to monitor the temperature, and a way to drive the peltier. Usually this is done with a control loop controlling the voltage (you could also control the power to the peltier but that doesn't work well for reasons I won't explain). Usually PID's are used to control the voltage, it can be done digitally or with analog electronics.
PWM can also be used to control the peltier, but is less efficient because it uses full current all the time and increases \$I^2R\$ losses from self heating.

A: Some useful information about peltiers:
In cooling mode the peltier behaves more or less electrically linearly, meaning that the device is more or less purely resistive and current is directly proportional to voltage.  This lets you directly regulate current by regulating voltage.
The actual performance of the peltier is non-linear because of losses.  The amount of heat pumped rises proportional to current, but there are two forms of losses to account for.  First, resistive conduction losses, where a conductor is heated by the current passing through it.  The power lost here follows the formula:
\$P=I^2R\$
The power wasted varies with the square of current while the heat pumped varies with current.  This means as current rises, efficiency drops.
The second type of losses to worry about are thermal conduction/convection losses.  While you are using the peltier, aside from the thermal transfer caused by the peltier effect, the two plates of the peltier are held at a temperature difference, but remain connected by the little blocks of bismuth.  While heat is flowing one way with the charge carriers, it is constantly also flowing back due to regular thermal conduction through the bismuth blocks and conduction/convection through the air/gas between the plates.  Heat conduction is proportional to temperature difference and area of thermal conductor, so the larger the temperature difference or the larger the peltier, the more bleedback occurs.
Peltiers respond best to constant current/voltage rather than PWM because of the \$I^2R\$ losses.  If you run the peltier at two units of current and a 50% duty cycle, you get 2x the losses as if you ran it at one unit of current all the time.  If you ran ten units of current at a 10% duty cycle, you end up with 100x the losses.  The total amount of charge that flows and therefore the heat pumped is the same in all 3 examples.  A voltage/current regulator is basically a PWM driver with a filter on the output, so you still need PWM, but the filter that makes it a switching voltage/current regulator is crucial.
You'll have to embed a temperature sensor (or use the one built into the CPU) and regulate the voltage provided to the peltier accordingly.  You won't be able to get the CPU all the way to ambient either, because if it's at ambient, whatever is cooling it is below ambient and you have to worry about condensation.
In addition to the thermal load you are cooling with the peltier, it must be sized to pump all of it's own electrical and thermal conduction losses or it will not be able to achieve the desired thermal differential.  If the device is not sized large enough for even the load plus electrical losses, it will be unable to maintain a favorable temperature difference at all.  The hot side heat sink, similarly, must be sized based on load plus losses and also thermal difference between hot side and ambient.  How cold your cold side can get is limited by the thermal difference across the peltier and the hot side temperature, so you don't necessarily have many degrees above ambient on the hot side to work with.
Peltiers as a result perform better at low load and low thermal difference, and abysmally if they are not powerful enough.  This means if you're controlling it and reducing the applied voltage/current as well as the temperature gradient in your efforts to avoid condensation, it's an all around win.  The thing you really want to avoid is an inadequately sized peltier or cooler, as that will create waste heat from overdriving the peltier, or a large temperature differential and therefore waste heat(bleedback) from an inadequate cooler.  It's important to size the peltier based on the full output power of the CPU plus the thermal conduction losses of the peltier and to size the cooler based on this plus the full waste heat created by the peltier.
If everything is sized correctly, you should be able to simply achieve constant temperature under heavy load.  Run the peltier based on cold side or cpu temp and run the fan/water pump based on hot side temperature.
You'll have to convert this to American somehow, but I have a somewhat older 140W CPU in my system running with a factory made watercooling loop, bought on sale about the price of a good air cooler, and it hovers about 35-39\$^\circ\$C.  It really is a special use case to use a peltier if you're not looking for sub ambient temps.  Not necessarily a bad idea though, hope it works for you.

A: Peltier Modules can be accurately controlled using PWM, like many semiconductors, Peltier modules resistance changes with temperature complicating trying to control them using just current or voltage. PWM is not ideal, but far safer. Another alternative is an on/off circuit with on occurring at one temperature and off at another, basically a much longer pulse width. Using voltage to modulate a Peltier module is playing with fire. My 140-watt maximum draw AMD Opteron 6386SE CPUs rarely draw more than 100 watts even with all cores (32 or 16 per CPU)at an overclocked speed of 3.9 MHz. Stock, they are made to run at up to 3.2GHz with all 16 cores and 3.5 GHz using 1/2 the cores. Before including Peltier modules in my system, I used the larger of the two available sizes of Noctua Heatpipe air to air coolers and they rarely got above 30 deg. C. and never exceeded 40 deg. C. I used both thermocouples as well as in chip and onboard sensors using AIDA64 software for chip and board temps. I have 2x AMD Opteron 6386SE CPUs on a Supermicro H8DG6-F MOBO. It is one of very few boards that can Overclock Server CPUs. I solved my condensation problem by making a Peltier dehumidifier for my case and have my case fans set to maintain a positive case pressure with all inlet air passing through the dehumidifier that is on top of the case with exhaust fans at the bottom and circulating fans in the front blowing over HDDs using case air. The dehumidifier also slightly cools the case, temp, by about 2-3 deg.C. the greater than normal in case air currents also help with any condensation that might occur with stagnate air or a negative case pressure. I use OCNG bios replacement/altering software to gain control of my CPU, and FSB clocks and voltages as well as RAM settings. I did put high temp silicone "form-a-gasket" around my CPUs. More detail is out of the scope of this thread.


text:
Q: Can I use emmeans with LME model? I am using LME model defined like:
mod4.lme <- lme(pRNFL ~  Init.Age + Status + I(Time^2), random= ~1|Patient/EyeID,data = long1, na.action = na.omit)

The output is:
> summary(mod4.lme)
Linear mixed-effects model fit by REML
 Data: long1
       AIC      BIC    logLik
  2055.295 2089.432 -1018.647

Random effects:
 Formula: ~1 | Patient
        (Intercept)
StdDev:    7.949465

 Formula: ~1 | EyeID %in% Patient
        (Intercept) Residual
StdDev:    12.10405 2.279917

Fixed effects: pRNFL ~ Init.Age + Status + I(Time^2)
                Value Std.Error  DF   t-value p-value
(Intercept)  97.27827  6.156093 212 15.801950  0.0000
Init.Age      0.02114  0.131122  57  0.161261  0.8725
StatusA     -27.32643  3.762155 212 -7.263504  0.0000
StatusF     -23.31652  3.984353 212 -5.852023  0.0000
StatusN      -0.28814  3.744980  57 -0.076940  0.9389
I(Time^2)    -0.06498  0.030223 212 -2.149921  0.0327
 Correlation:
          (Intr) Int.Ag StatsA StatsF StatsN
Init.Age  -0.921
StatusA   -0.317  0.076
StatusF   -0.314  0.088  0.834
StatusN   -0.049 -0.216  0.390  0.365
I(Time^2) -0.006 -0.004  0.001 -0.038 -0.007

Standardized Within-Group Residuals:
       Min         Q1        Med         Q3        Max
-2.3565641 -0.4765840  0.0100608  0.4670792  2.7775392

Number of Observations: 334
Number of Groups:
           Patient EyeID %in% Patient
                60                119

I wanted to get comparisons between my 'Status' factors (named A, N, F and H). So I did a emmeans model using this code:
emmeans(mod4.lme, pairwise ~ Status, adjust="bonferroni")

The output for this, is:
> emmeans(mod4.lme, pairwise ~ Status, adjust="bonferroni")
$emmeans
 Status   emmean       SE df lower.CL  upper.CL
 H      98.13515 2.402248 57 93.32473 102.94557
 A      70.80872 2.930072 57 64.94135  76.67609
 F      74.81863 3.215350 57 68.38000  81.25726
 N      97.84701 2.829706 57 92.18062 103.51340

Degrees-of-freedom method: containment
Confidence level used: 0.95

$contrasts
 contrast    estimate       SE  df t.ratio p.value
 H - A     27.3264289 3.762155 212   7.264  <.0001
 H - F     23.3165220 3.984353 212   5.852  <.0001
 H - N      0.2881375 3.744980  57   0.077  1.0000
 A - F     -4.0099069 2.242793 212  -1.788  0.4513
 A - N    -27.0382913 4.145370  57  -6.523  <.0001
 F - N    -23.0283844 4.359019  57  -5.283  <.0001

A: The answer is yes, emmeans does the calculation based on the model


text:
Q: How to properly shutdown my CentOS VM Usually, I just do a sudo /sbin/shutdown now when in my VM and wait for it to logout into the bash shell. Then after that I just go to Power > Power Off. Is this the right way to shutdown my CentOS VM?

A: Presuming VMware: if you have the vmware-tools installed in your VM, you should be able to issue the shutdown -h now command and it will power-off the VM for you.  This works for me with C4 and C5 VMs, on Server-1 and -2, Workstation 6.x, and ESX/ESXi.

A: You're close; the proper command is:
sudo /sbin/shutdown **-h** now

*

*Assuming that the sudo package is installed; otherwise, use su or similar.

*Without the asterisks, of course.

This will shutdown then halt the computer.

A: Without using VMWare Tools, On a VM CentOS machine the following command works fine.
shutdown


text: Q: Проблема при использовании библиотеки auto-py-to-exe Передо мне стояла задача из файла .py создать файл .exe, для последущего запуска на другом компьютере. Всё прошло успешно, auto-py-to-exe создал мне папку с большим количеством файлов и библиотек, и самое главное с моей экзешкой. На моём компьютере при запуске экзешке ,из папки куда он её скомпилировал, всё отлично запустилось. Я перекинул папку со всеми файлами на флешку и принёс её к другому компьютеру. Там возникла ошибка с отображением изображений(а именно, фон в программе и впринципе все картинки который там были). Как я понимаю это связано с путём к картинке когда создавалась экзэшка. Как можно это исправить, возможно ли как-нибудь собрать экзэшку чтобы все файлы в ней отображались на любом устройстве без сбоев. Спасибо!


text:
Q: redirección subdirectorio con htaccess Buenos dias tengo un wordpress instalado en https://www.miweb.com/nuevaweb.
Quiero conseguir que www.miweb.com/nuevaweb sea la base del dominio. Es decir, desde fuera se verá solo www.miweb.com.
Por ahora he hecho este htaccess que me funciona a medias:
RewriteCond %{HTTP_HOST} ^(www.)?miweb.com$
RewriteCond %{REQUEST_URI} !^/nuevaweb/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /nuevaweb/$1
RewriteCond %{HTTP_HOST} ^(www.)?miweb.com$
RewriteRule ^(/)?$ nuevaweb/index.php [L]

Con esta configuración lo hace bien siempre y cuando entre via https. Pero si se accede con http://miweb.com me està redirigiendo a http://miweb.com/nuevaweb y me salta un error de wordpress 404 ya que es como si intentara cargar http://miweb.com/nuevaweb/nuevaweb.
Que se me escapa?
Muchas gracias!


text:
Q: Excel, Way to check if spreadsheets are identical? I have 2 spreadsheets I want to get in sync. Is there a way to compare other then eye-test ? They are complex format with same formatting to cells. They are close I just want to confirm they are identical, few information in cells may be different.
Thanks

A: If you have a known good, and the 2nd sheet is identical with the possible exception of formatting. then

*

*ctrl-a on good sheet to select all cells.

*Ctrl-c to copy entire sheet

*Go to sheet 2

*paste special by using alt-e-s-t or using the paste special from the ribbon and select formats

Caveat- This may not work for active formatting.  Normal formatting and some conditional formatting will work ok. (Highlight any empty cells as yellow fill works. Highlight any number above MyGoal where MyGoal is a cell or equation may not come across correctly depending on details of how it is implemented.)


text:
Q: Handle Dom using Webpack How do I manipulate the DOM using Webpack and pure Javascript?
I'm having the following error:
Uncaught ReferenceError: register is not defined
    at HTMLButtonElement.onclick

My index.js has only:
function register() {
    alert('Hello')
}

My test scenario:

    Matri
    <input class="form-control col-12" type="text" placeholder="Enter your matri" id="matry">

   <button class="btn btn-primary" onclick="register()" type="button">Register</button>

I would like to work using a scope similar to the MVC principle.
Where I have a model and my control to manipulate DOM.
Is there such a possibility or is there a better alternative?
My organization structure is below the image:

my Webpack.config.js file
const webpack = require('webpack')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const path = require('path')

module.exports = {
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'babel-loader',

                options: {
                    presets: ['env']
                }
            },
            {
                test: /\.(scss|css)$/,

                use: [
                    {
                        loader: MiniCssExtractPlugin.loader
                    },
                    {
                        loader: 'css-loader',

                        options: {
                            sourceMap: true
                        }
                    },
                    {
                        loader: 'sass-loader',

                        options: {
                            sourceMap: true
                        }
                    }
                ]
            }
        ]
    },

    plugins: [
        new UglifyJSPlugin(),
        new MiniCssExtractPlugin({ filename: 'app.min.css', path: path.resolve(__dirname, 'dist') })
    ],

    entry: './src/index.js',

    output: {
        filename: './dist/bundle.js',
        path: path.resolve(__dirname, 'dist')
    },

    mode: 'production'
};