Are you expected to leave immediately if you have already been existing in the country for a few years? Do you have some time allowance for when you’re expected to make your way out? If you realize that you’ve overstayed and would like to do the right thing, what is the time frame that you’re expected to act in?

# Tag: Expected

## 20.04 – VScode installed from snap : command “code” not working as expected

I just installed Visual Studio code from snap : `sudo snap install code --classic`

When I type `code .`

in the terminal, nothing occurs it just returns to new command line without any error but won’t open vscode as I expected.

When I type `which code`

i got this output : `/snap/bin/code`

I tried these solution :

https://stackoverflow.com/questions/29971053/how-to-open-visual-studio-code-from-the-command-line-on-osx

How To Open Visual Studio Code Using Terminal

But nothing help. Because the command is found, it just doesn’t open the program.

I also tried to `sudo snap remove code`

and installed it from the `.deb`

package following those steps :

https://www.itzgeek.com/post/how-to-install-visual-studio-code-on-ubuntu-20-04/

But i got the same behavior : nothing append when typing `code .`

command.

I can open visual studio from the main menu by clicking on the vscode icon….but i used the ‘code’ command everywhere and it is very frustrating to not be able to use it.

please help !

## mysql – After changing engine from myisam to innodb tables are larger in size, is this an expected behaviour?

I updated a WordPress database from myisam to innodb on a server using apache and mysql, and I noticed that some tables, such as wp-posts grew in size after running the `ALTER TABLE wp_posts ENGINE=InnoDB;`

command, about 20MB. So, this is the first time I’ve done this, and I’m wondering if this is an expected behaviour?

Thanks,

## caching – How do I decide an initial in-memory cache size given my DB size and expected load throughput?

(Purely for learning purposes)

Say the DB contains 1 billion rows with 200 bytes per row = 200 GB of data.

The traffic at peak is 1000 requests/s, with each request asking for one DB row.

What cache size would I begin with to ease off the load on the DB? I realize that this is determined best empirically and can be tuned as time goes on.

Caches are usually not too large given memory constraint (unless you go for a distributed cache like redis), so we can’t have the in-memory cache be more than say 200 MB of space, which accounts for way less than 1% of the DB size and seems too small. The cache might just spend all its time being 100% occupied with 95% misses and evicting entries and caching new entries using a simple LRU scheme.

Perhaps there’s no point bothering to cache anything in-memory here. In that case, how would you go about coming up with an initial cache size in a redis cache?

## Proving Expected Value is Maximum of this Probability Function

Suppose we had m many dice each of which had n many sides. If we roll the m dice, then the probability that k of those dice have the same face value of, say r, where 1<= r <= n, should be

((n-1)^(m-k)(m C k))/n^m.

So I was looking for what value k maximizes this probability and through some trials it looks like it is when k=m/n, or rather the closest integer to m/n.

After looking this up (I have never formally taken stats or prob theory), I read that m/n is the expected value. This makes sense, but I was hoping someone could provide an intuitive derivation or proof that the expected value is indeed m/n and why it does maximize the probability.

Any insight on this would be greatly appreciated. Thank you!

## debug – Why Do Pages Always Work Aa Expected When Logged Into The Dashboard?

I am finding that all the changes I make and preview when logged into the dashboard are just as I would like them. Once I log out of the dashboard all hell breaks loose. Pages don’t display my latest changes, new passwords aren’t accepted etc. But all works while in the dashboard!

**What have I tried?**

- I don’t have any caching plugins
- I DO have a cache menu item in the dashboard which I have clicked ‘Purge All’
- I have entered CTRL-F5 to reload the page from the server as well as its resources
- Clearing the cache from my hosting service admin page.

I am using Chrome version 83.

My site is **NOT** using CloudFlare…

## numerical integration – Nintegrate providing results much smaller than what is expected

This is the first time I am posting something here. So, apologies if I make any mistake. I am dealing with a numerical integration in Mathematica-11.0 that has a Bessel function in it. In order to solve it I am using the Module function in Mathematica:

```
yldLst(((Alpha)_)?NumericQ, ((Beta)_)?NumericQ, (T1_)?NumericQ, (TRH_)?NumericQ,
(mx_)?NumericQ, (m(Phi)_)?NumericQ) := Module({yldX},
yldX = NIntegrate((1/(512*Pi^6))*((amp1(s, (Alpha), (Beta), mx, m(Phi))*(1/(4*s))*
(s - m(Phi)^2)*(s - mx^2)*(1/Sqrt(s))*BesselK(1, Sqrt(s)/T))/
((((2*Pi^2)/45)*100*T^3)*(1.66*Sqrt(100)*(T^2/Mpl)))),
{s, If(m(Phi)^2 > mx^2, m(Phi)^2, mx^2, 0), Infinity}, {T, T1, TRH},
PrecisionGoal -> 10); {T1, yldX})
```

Here `amp1(s, (Alpha), (Beta), mx, m(Phi))`

is the a polynomial of the following form:

```
amp(s_, (Alpha)_, (Beta)_, mx_, m(Phi)_) := (-(1/128))*
(((Alpha)^2*(3*mx^4*m(Phi)^4 - 14*mx^4*m(Phi)^2*s + 2*mx^2*m(Phi)^4*s + 19*mx^4*s^2 -
12*mx^2*m(Phi)^2*s^2 + 3*m(Phi)^4*s^2 - 6*mx^2*s^3 + 10*m(Phi)^2*s^3 - 5*s^4 +
4*(mx^2 - s)*(m(Phi)^2 - s)*((-mx^2)*(m(Phi)^2 - 3*s) - s*(m(Phi)^2 + 3*s))*
Cos((Theta)) + (mx^2 - s)^2*(m(Phi)^2 - s)^2*Cos(2*(Theta))) +
(3*mx^4*m(Phi)^4 - 30*mx^4*m(Phi)^2*s + 2*mx^2*m(Phi)^4*s + 35*mx^4*s^2 +
4*mx^2*m(Phi)^2*s^2 + 3*m(Phi)^4*s^2 - 22*mx^2*s^3 + 10*m(Phi)^2*s^3 - 5*s^4 +
4*(mx^2 - s)*(m(Phi)^2 - s)*((-mx^2)*(m(Phi)^2 - 7*s) - s*(m(Phi)^2 + 3*s))*
Cos((Theta)) + (mx^2 - s)^2*(m(Phi)^2 - s)^2*Cos(2*(Theta)))*(Alpha)^2*(Beta)^2)/
(s*((mx^2 - s)*(m(Phi)^2 - s) - (mx^2 - s)*(m(Phi)^2 - s)*Cos((Theta)))))
amp1(s_, (Alpha)_, (Beta)_, mx_, m(Phi)_) :=
If(s > mx^2 && s > m(Phi)^2,
Integrate(amp(s, (Alpha), (Beta), mx, m(Phi))*Sin((Theta))*2*Pi, {(Theta), 10^(-2), Pi}), 0)
```

For `mx=m(Phi)=0`

one can perform this integral analytically using *Integrate*, as the lower limit on `s`

becomes zero, also the expression for `amp1(s, (Alpha), (Beta), mx, m(Phi))`

becomes simpler. But if I use `mX=m(Phi)=0`

and use *NIntegrate*, the result is at least an order different from what I get by using Integrate. Also *NIntegrate* is giving the slow convergence warning for `mX=m(Phi)=0`

. So I am not sure if I can rely on NIntegrate results for non-zero values of `mx,m(Phi)`

as the result I am getting for non-zero `mX,m(Phi)`

are way smaller than what I expect. How can I ensure the consistency of the code?

Thank you so much for the help.

## python – Why doesn’t this Slice work as expected? A semantic error?

Here’s the scenario

In Python I have a string with the value of “helloworld”

Why is it that I can’t go from [0:10] with a negative step? The result comes back empty

So it would be

```
"helloworld"[0:10:-1]
```

Why doesn’t it return to the console “dlrowolleh”???

## thailand – Are taxi drivers in Bangkok expected to round up the taxi fare to the nearest multiple of 10 THB?

For example, if the taxi fare is 53 THB and I give 60 THB (for lack of coins), the taxi drivers typically will not give any change back. I wonder whether this is because I don’t look Thai or because it is the tradition here for taxi fares not to give change back if below 10 THB.