text:
Q: "Language neutral" property in file's Details tab How can I change language property of a DLL written in C#?
I tried to go into the Project Properties -> Assembly Information -> Neutral Language ComboBox and set it to English (United States).
After I build/rebuild the project/solution, when I right-click on DLL and go to the Details tab, the Language property always says Language Neutral.
EDIT:
The solution I found is to use external *.res files (simply generated by Visual Studio), and then choose it in dialog Project Propertie->Application Tab-> Resource File

A: This property sets the [AssemblyCulture] attribute in the AssemblyInfo.cs file.  The MSDN library article has this important note in the Remarks section:

The attribute is used by compilers to distinguish between a main assembly and a satellite assembly. A main assembly contains code and the neutral culture's resources. A satellite assembly contains only resources for a particular culture, as in [assembly:AssemblyCultureAttribute("de")]. Putting this attribute on an assembly and using something other than the empty string ("") for the culture name will make this assembly look like a satellite assembly, rather than a main assembly that contains executable code. Labeling a traditional code library with this attribute will break it, because no other code will be able to find the library's entry points at runtime.

Another important restriction is that the GAC can distinguish assemblies by assembly name, version, architecture and public key token but not by culture.  Satellite assemblies must always be stored locally.
Long story short, never pick anything but Neutral on a project that contains code.  Satellite assemblies are almost always auto-generated from the resources in your project and automatically get the proper [AssemblyCulture] attribute.

A: (Adding this answer as a supplement to the answer by @Hans Passant.)
In your Assembly Information (accessed via Project Properties), when you change Neutral Language to "English (United States)," that causes this line to be added to AssemblyInfo.cs:
[assembly: NeutralResourcesLanguageAttribute("en-US")]

However, note the following line in AssemblyInfo.cs remains unchanged:
[assembly: AssemblyCulture("")]

From this, it is clear that the Neutral Language setting is distinct from the Assembly Culture setting.
If you are localizing your application, you should set NeutralResourcesLanguageAttribute to the culture you are using in your neutral resource files. (See this answer for more.)


text:
Q: Docker daemon memory consumption grows over time Here's the scenario:
On a Debian GNU/Linux 9 (stretch) VM I have two containers running. The day before yesterday I got a warning from the monitoring that the memory usage is relatively high. After looking at the VM it could be determined that not the containers but Docker daemon needs them. htop
After a restart of the service I noticed a new increase of memory demand after two days. See graphic.
RAM + Swap overview
Is there a known memory leak for this version?
Docker version

Memory development (container) after 2 days:
Container 1 is unchanged
Container 2 increased from 21.02MiB to 55MiB

Memory development (VM) after 2 days:
The MEM increased on the machine from 273M (after reboot) to 501M
dockerd
- after restart 1.3% MEM%
- 2 days later 6.0% of MEM%

A: Monitor your containers to see if their memory usage changes over time:
> docker stats
CONTAINER ID        NAME                CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
623104d00e43        hq                  0.09%               81.16MiB / 15.55GiB   0.51%               6.05kB / 0B         25.5MB / 90.1kB     3

A: We saw a similar issue and it seems to have been related to the gcplogs logging driver. We saw the problem on docker 19.03.6 and 19.03.9 (the most up-to-date that we can easily use).
Switching back to using a log forwarding container (e.g. logspout) resolved the issue for us.

redpajama_set_name: RedPajamaStackExchange


text:
Q: jquery keeps animating up and doesn't stop in chrome I cant figure out why, chrome keeps animating up and up my menu tags (price tags).site here. It works every where else but in chrome it goes up and up....

A: I would avoid em here. It is a relative unit and may not give the desired results. Use an absolute unit like px. Also if you stop the animation it might change the heights of subsequent animations. Use absolute heights here at well instead of calculating them each time:
$('.main > .menu > img').hover(function() {
    $(this).stop().animate({ top: '50px' }, 150);
}, function() {
    $(this).stop().animate({ top: '60px' }, 150);
});


text:
Q: How to play dynamic sounds in XNA? Is it possible to dynanmically generate sounds with XNA C# code?
I looked into this some time ago when XNA was first released.  At that time it was only possible to playback sound resources included in the compiled code.
Have there been any changes or new features added since XNA 1.0 that would allow an XNA application to generate and playback audio on the fly?

A: Yes.
XNA 4.0 added support for dynamic audio that allows you to:

*

*Create a regular immutable sound
effect from a raw buffer using the SoundEffect.FromStream method.

*Create a
DynamicSoundEffectInstance object then modify the audio data of this new
streaming sound effect object
dynamically.

Read more in the blog entry What's "Dynamic" about this SoundEffectInstance? and in the AppHub article Dynamic Audio.

A: I think you can do this in XNA with DirectSound.  Here's a link with code that seems to do what you want:
http://forums.create.msdn.com/forums/t/40361.aspx

A: Depends how dynamic you want to get. I know that XACT will let you change pitch and such, which, when combined with using cues in a programmatic fashion, can give some nice results.
If you want to generate your own waveform, you're out of luck. There's always the option of dropping below the framework and doing it yourself.


text:
Q: ¿Cómo evitar carga de archivo .htaccess en laravel y git? Tengo mi archivo gitignore así:
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/public/.htaccess
.env
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log

Cómo ven, no quiero que se suba el archivo .htaccess que está en la carpeta public, más sin embargo al hacer
git add .
git commit -m ""
git push origin master

Vuelve a reescribir el archivo .htaccess.
¿Cómo le puedo hacer para que no se suba el archivo .htaccess?
Gracias


text:
Q: Central-potential solutions to the time-independent Schrodinger equation Am I correct in saying that the central-potential solutions to the time-independent Schrodinger equation are all of the form $R(r)\Theta(\theta)\Phi(\phi)$? If so, do $R$, $\Theta$ and $\Phi$ have any significance when not all multiplied together? For example, would $\int \Theta\Phi\sin\theta \; d\theta d\phi$ give me the probability of finding the particle within the solid angle I integrate over?

A:
Am I correct in saying that the central-potential solutions to the time-independent Schrodinger equation are all of the form $R(r)\Theta(\theta)\Phi(\phi)$?

No. There are plenty of non-separable solutions that cannot be expressed in that way. They're a useful subset of solutions (particularly because they can be used to build a basis), but they're a thin slice of the global solution space.

For example, would $\int \Theta\Phi\sin\theta \; d\theta d\phi$ give me the probability of finding the particle within the solid angle I integrate over?

Yes, that is correct.


text:
Q: Remove rails model after migration It seems strange to me, that creation of model, running migration, destroying it, and creating again same model reports SQL exception:
project|master ⇒ rails g model name name
      invoke  active_record
      create    db/migrate/20130417185814_create_names.rb
      create    app/models/name.rb
project|master⚡ ⇒ rake db:migrate
==  CreateNames: migrating ====================================================
-- create_table(:names)
   -> 0.0020s
==  CreateNames: migrated (0.0021s) ===========================================
project|master⚡ ⇒ rails d model name
      invoke  active_record
      remove    db/migrate/20130417185814_create_names.rb
      remove    app/models/name.rb
project|master⚡ ⇒ rake db:migrate
project|master⚡ ⇒ rails g model name test
      invoke  active_record
      create    db/migrate/20130417185845_create_names.rb
      create    app/models/name.rb
project|master⚡ ⇒ rake db:migrate
==  CreateNames: migrating ====================================================
-- create_table(:names)
rake aborted!
An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table "names" already exists: CREATE TABLE "names" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "test" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) /path/project/db/migrate/20130417185845_create_names.rb:3:in `change'
-- create_table("names", {:force=>true})
   -> 0.0100s
-- initialize_schema_migrations_table()
   -> 0.0025s
-- assume_migrated_upto_version(20130417185814, ["/path/project/db/migrate"])
   -> 0.0010s
You have 1 pending migrations:
  20130417185845 CreateNames
Run `rake db:migrate` to update your database then try again.

Maybe, I doing something wrong? Migration has code for deleting table - does it may be used only for rollback?
Solution
Delete model and database table and generate a new one is pretty easy:

*

*Create model: rails g model user name

*Do migrations: rake db:migrate

*Implement something, suddenly remember that you need to delete model

*Revert specific migration: rake db:migrate:down VERSION=20130417185814, where 20130417185814 is migration id (can be seen in rake db:migrate:status)

*Remove model: rails d model user

*Suddenly remember that you need this model, but with other fields

*Create model: rails g model user email group:references

*Successfully migrate database: rake db:migrate

A: rails d model name

This just deletes the model and not the migration you have run (which created the table in the database).
If you want to delete both the model and the tables, you will have to do the following
rake db:rollback
rails d model name

A: You deleted the model–that's a different operation than rolling back a migration.
Destroying a model does precisely, and only, that; it has nothing to do with migrations.

A: according to your migration error there must be something wrong with the migration files, moreover the one which referring to create names table.
please look at this file, at your change method.
the change method in a migration file is supposed to execute a DB code, that DB code can do some operations on the DB, and that same code on the change supposed to be right to do the rolling back.
if you want to separate between the two you should put the code on the up method which will perform operations on the DB, and on the down method the opposite rolling operations.
i would suggest that you delete all the files on the migration including the one that cause the problem, and write them correct.
if you need help please post your migration file.
please also take a look at the guides: http://guides.rubyonrails.org/migrations.html


text:
Q: Elastix extension for Asterisk based SIP on Magento 2? I've tried and looked everywhere for this kind of plugin where:

*

*User calls our number: xxx-xxx-xxx

*If any customer service agent is currently online in the platform a popup appears on the screen regarding the call.

*The popup will have all the information regarding the customer (if they have their information already registered via the mobile / phone number they are currently calling from)

*In most cases this is called a Dialer integration. However I'd like do do this with Magento 2 and Asterisk based SIP with either Elastix or any other software.


text:
Q: Java LibGDX Multi Touch Movement What is the problem? I am using this code to movement for two players. But it is not working. Player1 is more quick than player2. How can I fix?
for (byte i = 0; i < 20; i++) {maxDistance = 10 * Gdx.graphics.getDeltaTi

me();
                if (Gdx.input.isTouched(i) && Gdx.input.getY()<= 400) {
                    player1TouchPosition.set(Gdx.input.getX(i), Gdx.input.getY(i), 0);
                    camera.unproject(player1TouchPosition);
                }
                player1Tmp.set(player1TouchPosition.x, player1TouchPosition.y).sub(player1Rectangle.x, player1Rectangle.y);
                if (player1Tmp.len() <= maxDistance) {
                    player1Rectangle.x = player1TouchPosition.x;
                    player1Rectangle.y = player1TouchPosition.y;
                } else {
                    player1Tmp.nor().scl(maxDistance);
                    player1Rectangle.x += player1Tmp.x;
                    player1Rectangle.y += player1Tmp.y;
                }
                if (Gdx.input.isTouched(i) && Gdx.input.getY() >= 401) {
                    player2TouchPosition.set(Gdx.input.getX(i), Gdx.input.getY(i), 0);
                    camera.unproject(player2TouchPosition);
                }
                player2Tmp.set(player2TouchPosition.x, player2TouchPosition.y).sub(player2Rectangle.x, player2Rectangle.y);
                if (player2Tmp.len() <= maxDistance) {
                    player2Rectangle.x = player2TouchPosition.x;
                    player2Rectangle.y = player2TouchPosition.y;
                } else {
                    player2Tmp.nor().scl(maxDistance);
                    player2Rectangle.x += player2Tmp.x;
                    player2Rectangle.y += player2Tmp.y;
                }
            }

A: Two errors jump out at me:

*

*You used getY() instead of getY(i) in a couple of places, so the criteria are mixed up for any pointer besides the most recent one.

*You wrapped it all in a loop that runs 20 times, so you are moving each player 20 times a frame instead of one time each, at most. The movement should be applied outside the loop.
This problem is more complicated than it initially looks, because you have to deal with rejecting extra fingers on either side of the screen. Suppose pointer 1 is a finger on the top half of the screen. If pointer 2 is a finger on the top half, you want to reject it, but if it's on the bottom half, you want to use it to move player 2. If pointers 1 and 2 are both on the top, you want to accept pointer 3 only if it's on the bottom but you want to always reject it if pointers 1 and 2 are on opposite sides.
Furthermore, if only one finger is down, but it slides across the boundary to the other side, you want to be sure you don't let it start controlling the opposite player.
Here's one possible strategy. Track the first pointer down on each side and reset it whenever the tracked pointer is released. Only update target positions for the two currently tracked pointers.
private int player1Pointer = -1, player2Pointer = -1;

// render():

//stop tracking released fingers
if (player1Pointer >=0 && !Gdx.input.isTouched(player1Pointer))
    player1Pointer = -1;
if (player2Pointer >=0 && !Gdx.input.isTouched(player2Pointer))
    player2Pointer = -1;

//check for new pointers and update target positions
for (int i = 0; i<20; i++){
    if (!Gdx.input.isTouched(i))
        continue;
    if (Gdx.input.getY(i) <= 400){ //bottom, player 1
        if (player2Pointer == i)
            continue; //player 2 slid finger across boundary, ignore it
        if (player1Pointer < 0)
            player1Pointer = i; //first finger down on this side of screen, track it
        if (player1Pointer == i){ //this is the tracked finger, update target
            player1TouchPosition.set(Gdx.input.getX(i), Gdx.input.getY(i), 0);
            camera.unproject(player1TouchPosition);
        }
    } else { //top, player 2
        if (player1Pointer == i)
            continue;
        if (player2Pointer < 0)
            player2Pointer = i;
        if (player2Pointer == i){
            player2TouchPosition.set(Gdx.input.getX(i), Gdx.input.getY(i), 0);
            camera.unproject(player2TouchPosition);
        }
    }
}

//update movement toward targets
maxDistance = 10 * Gdx.graphics.getDeltaTime();
temp.set(player1TouchPosition.x, player1TouchPosition.y).sub(player1Rectangle.x, player1Rectangle.y);
if (temp.len() <= maxDistance) {
    player1Rectangle.x = player1TouchPosition.x;
    player1Rectangle.y = player1TouchPosition.y;
} else {
    temp.nor().scl(maxDistance);
    player1Rectangle.x += temp.x;
    player1Rectangle.y += temp.y;
}
temp.set(player2TouchPosition.x, player2TouchPosition.y).sub(player2Rectangle.x, player2Rectangle.y);
if (temp.len() <= maxDistance) {
    player2Rectangle.x = player2TouchPosition.x;
    player2Rectangle.y = player2TouchPosition.y;
} else {
    temp.nor().scl(maxDistance);
    player2Rectangle.x += temp.x;
    player2Rectangle.y += temp.y;
}


text:
Q: How to replace values in pandas data frame according to a function I    have a pandas data frame it looks like this
 0  1   2   3   4   5   6   7   8   9   ... 253 254 255 256 257 258 259 260 261 262
        0       30  84  126 135 137 179 242 342 426 ... 0   0   0   0   0   0   0   0   0   0
        1       24  53  75  134 158 192 194 211 213 ... 0   0   0   0   0   0   0   0   0   0
        2       51  143 173 257 446 491 504 510 559 ... 0   0   0   0   0   0   0   0   0   0
        3       1   20  22  92  124 149 211 335 387 ... 0   0   0   0   0   0   0   0   0   0
        4       34  51  56  106 110 121 163 233 266 ... 0   0   0   0   0   0   0   0   0   0

I want to divide each number in the data frame by 7 and put the result in the data frame instead of the number, I was testing with a for loop, but it
doesn't work for me
for i in x:
    y = i % 7
    if y == 0:
        x.replace(i, 7)

It should work but when I print the data frame I can't see the change, I even tried to replace a specific value, but also no change.
How should I do it and I was wondering what is the best solution memory wise since I'm trying to scale this to a bigger data frame
lets say we have a line like this
 0 8 30 28 36 40 45 0 56

the output I want should be,
 0 1 2 7 1 5 3 0 7

Thanks in advance

A: Use numpy.where with chained condition for check 0:
print (df)
   0   1    2    3    4    5    6    7    8    9  253  254  255  256  257
0  0   8   30   28   36   40   45    0   56  426    0    0    0    0    0
1  1  24   53   75  134  158  192  194  211  213    0    0    0    0    0
2  2  51  143  173  257  446  491  504  510  559    0    0    0    0    0
3  3   1   20   22   92  124  149  211  335  387    0    0    0    0    0
4  4  34   51   56  106  110  121  163  233  266    0    0    0    0    0

mdf = df % 7
df = pd.DataFrame(np.where((mdf == 0) & (df != 0), 7, mdf),
                  columns=df.columns,
                  index=df.index)
print (df)
   0  1  2  3  4  5  6  7  8  9  253  254  255  256  257
0  0  1  2  7  1  5  3  0  7  6    0    0    0    0    0
1  1  3  4  5  1  4  3  5  1  3    0    0    0    0    0
2  2  2  3  5  5  5  1  7  6  6    0    0    0    0    0
3  3  1  6  1  1  5  2  1  6  2    0    0    0    0    0
4  4  6  2  7  1  5  2  2  2  7    0    0    0    0    0

A: The DataFrame method df.apply() will apply a function to each cell. The first parameter of the function will be the cell's contents.
import pandas as pd

# Just an example df
df = pd.DataFrame(data={"Column1":[7*x for x in range(1,11)], "Column2":[7*x for x in range(11,21)]})

print(df)

   Column1  Column2
0        7       77
1       14       84
2       21       91
3       28       98
4       35      105
5       42      112
6       49      119
7       56      126
8       63      133
9       70      140

Below is a simple function and applying it.
Note that you'll need to store the results in a new variable (it'll display the results but it doesn't change the original DataFrame).
The function assumes Python 3.
If using Python 2 division works differently.
def divide_by_7(x):

    return x / 7

df2 = df.apply(divide_by_7)

print(df2)

   Column1  Column2
0      1.0     11.0
1      2.0     12.0
2      3.0     13.0
3      4.0     14.0
4      5.0     15.0
5      6.0     16.0
6      7.0     17.0
7      8.0     18.0
8      9.0     19.0
9     10.0     20.0

Using a function with a parameter of more than just the cell contents requires using the "args" parameter in the apply() method.
# A more flexible division function
def divide_by_n(x, n):

    return x / n

#If passing in arguments, pass them as a tuple to args parameter
df3 = df.apply(divide_by_n, args=(7,))

print(df3)

   Column1  Column2
0      1.0     11.0
1      2.0     12.0
2      3.0     13.0
3      4.0     14.0
4      5.0     15.0
5      6.0     16.0
6      7.0     17.0
7      8.0     18.0
8      9.0     19.0
9     10.0     20.0

There are other details of using apply(), for example to apply to create a new column. There are examples in the pandas documentation.


text:
Q: Convergent in $C([0,\pi]$ Which of following sequences $\{f_n\}$ are convergent in space $C([0,\pi])$

*

*$f_n(x)=\sin (nx)$

2.$f_n(x)=\sin ^n (x)$
3.$f_n(x)=\sin (\frac{x}{n})$
My answers:

*

*It's not convergent. For example for $f_{2n-1}(\frac{\pi}{2})=(-1)^{n+1}$.

*Couldn't find counter example. Not sure of the answer.
3.We know that $\sin(t)\le t$, so $\sin (\frac{x}{n}) \le \frac{x}{n}$, so it's convergent to $f(x)=0$.
Could you point me if my thinking is correct? Thanks in advance.


text:
Q: Error uploading ios application to itunesconnect "failed to open ssh session (16)" I am having a real repetitive issue uploading app to itunesConnect. It does not matter if I use "Application loader" or xcodes "Archive" utility, the result is the same ("failed to open ssh session (16)"). I am doing this on a Computer and network that was used for multiple uploads of applications to  itunesConnect in the past and never having this problem. I even uploaded an application the same day (without problem), but got errors for this app.
I reviewed the detail log and found nothing useful to determine why the problem would happen.
I posted the log at link bellow since it is to long to be posted here
http://pastebin.ca/2801584
I am using:
-java (1.6.0)
-xcode 5.1.1
-appLoader 2.9.1
-osx 10.9.3
what i tried already:
-checked and rechecked application meta data
-tried to upload via different network
-changed app bundle identifier (develop site, itunesconnect and application)
-tried contacting support via itunesConnect (with no response after multiple days).
I thank you for any help you can offer me.

A: According to the log, you don't have network connectivity to Apple's servers, so all of your connection attempts are timing out.
[2014-06-09 11:12:22 CEST] <main> DBG-X:   testing host/port: vgr105.apple.com/33001
[2014-06-09 11:13:38 CEST] <aspera.util.SelectThread> ERROR: The session's status is FAILED and the error description is 'failed to open ssh session. (16)'

[2014-06-09 11:23:07 CEST] <Transport Protocol Seeker> DEBUG: Transfer warning: Unable to connect to sgr403.apple.com:44001: Failed to connect
    at com.signiant.interactivetransfer.engine.TransferEngine$5.run(TransferEngine.java:3617)
Caused by: Transfer error: Failed to connect
    at com.signiant.interactivetransfer.engine.TransferInstance.newControlPort(TransferInstance.java:367)
    at com.signiant.interactivetransfer.engine.ControlStream.<init>(ControlStream.java:894)
    at com.signiant.interactivetransfer.engine.TransferEngine$Connector.run(TransferEngine.java:3185)
Caused by: java.io.IOException: java.io.IOException: connection timeout
    at com.signiant.mobilize.ddsclient.connection.Tcp.<init>(Tcp.java:47)
    at com.signiant.interactivetransfer.engine.TransferInstance.newControlPort(TransferInstance.java:361)
    ... 2 more
Caused by: java.io.IOException: connection timeout
    at com.signiant.mobilize.ddsclient.connection.Tcp.<init>(Tcp.java:42)
    ... 3 more

The simplest explanation is that you're being blocked by a firewall within your local network. If that is the case, then you need to contact your network administrators to open up the ports needed for the transporter to work.
The iTunes Connect Transporter Quick Start Guide lists the ports that have to be opened in order for the transporter to work. You can get the document from the iTunes developer site, or I found a copy online here.

A: You can also try the answer here:
itunesconnect using application loader behind a firewall
In short, change Application Loader's Advanced preferences so that it only uses the DAV transfer protocol.

A: If anyone comes across this issue again and cant find a resolution. I had to re download the application loader and after the IPA has been created open up the application loader you just downloaded.

A: Make sure that all sites are smoothly accessible from your Mac,
http://help.apple.com/itc/apploader/e3#/itc8e7ec5a60


text:
Q: I am getting errors in IntelliJ when adding MVN dependency- Selenium Java » 3.141.59. Any suggestions? I am getting below errors:
Dependency 'org.seleniumhq.selenium:selenium-java:3.141.59' not found
Dependency 'org.seleniumhq.selenium:selenium-java:3.141.59' not found
Dependency 'org.seleniumhq.selenium:selenium-java:3.141.59' not foundenter image description here

A: Once any changes are made in pom.xml you must refresh it by clicking on following button (see screenshot).
It will trigger Maven to refresh and download needed dependencies/plugins according to pom.xml file.

A: Please reload the pom.xml by mentioned in the picture.

right click -> maven -> Reload Project


text:
Q: Joint pdf of Poisson processes I recently stumbled upon this question:
Let T1 and T2 be the times for the first and second jump of a Poisson process
with rate λ > 0. Find the joint probability density function of T1 and T2
After formulating that:
$ P(T_1 <= s, T_2 <= t) = P(X(s)>=1, X(t)>=2) =  ... = (1-P(X(s) =0)) * (1 - P(X(t-s) = 0) = 1 - e^{- \lambda s }- e^{- \lambda (t-s) } + e^{- \lambda t }$
and then taking the derivative with respect to t and s to get the joint pdf I end up with
$ f(s,t) = \lambda^2 e^{-\lambda (t-s) }$
however the correct answer should be apparently be $ f(s,t) = \lambda^2 e^{-\lambda t }$
does anyone know where I do my mistake?
Thanks in advance

A: You've missed cases where $X(s) \ge 2$ while $X(t-s) = 0$.
\begin{align}
P(T_1 \le s, T_2 \le t)
&= P(X(s) \ge 1, X(t) \ge 2)
\\
&= P(X(s) = 1, X(t-s) \ge 1) + P(X(s) \ge 2)
\\
&= P(X(s) = 1) P(X(t-s) \ge 1) + P(X(s) \ge 2)
\\
&= \lambda s e^{-\lambda s} (1 - e^{-\lambda(t-s)}) + (1 - e^{-\lambda s} - \lambda s e^{-\lambda s})
\\
&= -\lambda s e^{-\lambda t} + 1 - e^{-\lambda s}.
\end{align}


text:
Q: SVELTE how to fix page flicker In the app below I am encountering the notorious page flick effect that usually is a result of AJAX request. In my situation it is not due to AJAX it is due to a conditional that results in rendering different versions of the same page.
https://workflow-magic-svelte.vercel.app/
I have included  a gif image video so you can see the problem.
Code is below.

{#if $showNav || $animateNav}

        {#if $animateNav && !$showNav}

Workflow Magic

Your app is ready!

              Add all the clients you want.
 Use the up and down arrows on
              your keyboard.

              To go to the next step, select a client!

        {/if}

        {#if !$animateNav && $showNav}

Workflow Magic

Your app is ready!

              Add all the clients you want.
 Use the up and down arrows on
              your keyboard.

              To go to the next step, select a client!

        {/if}

          <SearchAndCreateField
            arrayOfObjects={clients}
            keyToRender="name"
            buttonText="Create Client"
            onSubmit={submitToDatabase}
            {onDelete}
            onSelectionEvent={goToRoute}
            placeholder="Type the name of a company or client you work with"
          />

{:else}

Workflow Magic

            Workflow Magic is an organizer tool for work-from-home contractors
            and freelancers.

            Get Started Now!

          <SearchAndCreateField
            buttonText="Create Client"
            placeholder="Type the name of a company or client you work with"
            arrayOfObjects={clients}
            keyToRender="name"
            onSubmit={submitToDatabase}
            {onDelete}
            onSelectionEvent={goToRoute}
          />

{/if}

  [1]: https://i.stack.imgur.com/FBSym.gif

A: You pasted the code for Landing.svelte, but looking at the deployed site, I can see the bug is located in App.svelte.
In the onMount method of App.svelte, you call getAllClients(), which returns a Promise. After that Promise resolves, animateNav and showNav have new values assigned to them.
You should introduce a loading variable to hide all content until the async calls that you need to make fully resolve. See how I reproduced the issue and solved it here.
The page appears to flicker because of how quickly the Promise resolves—use setTimeout to see the flicker take longer.

A: Two options:

*

*Move the function showNav.set(true) to inside onMount() (but always show the navbar);

or

*Insert css:
.navbar {
position: absolute;
width: 100%;
}


text:
Q: Using Data.Array in a Haskell Data Type I have been developing some code that uses Data.Array to use multidimensional arrays,
now I want to put those arrays into a data type so I have something like this
data MyType = MyType { a :: Int, b :: Int, c :: Array }

Data.Array has type:
(Ix i, Num i, Num e) => Array i e

Where "e" can be of any type not just Num.
I am convinced I am missing a concept completely.
How do I accomplish this?
What is special about the Data.Array type that is different from Int, Num, String etc?
Thanks for the help!

A: You need to add the type variables i and e to your MyType:
data MyTYpe i e = MyType { a, b :: Int, c :: Array i e }

A: Array is not a type. It's a type constructor. It has kind * -> * -> * which means that you give it two types to get a type back. You can sort of think of it like a function. Types like Int are of kind *. (Num is a type class, which is an entirely different thing).
You're declaring c to be a field of a record, i.e., c is a value. Values have to have a type of kind *. (There are actually a few more kinds for unboxed values but don't worry about that for now).
So you need to provide two type arguments to make a type for c. You can choose two concrete types, or you can add type arguments to MyType to allow the choice to be made elsewhere.
data MyType1 = MyType { a, b :: Int, c :: Array Foo Bar }
data MyType2 i e = MyType { a, b :: Int, c :: Array i e }

References

*

*Kinds for C++ users.

*Kind (type theory) on Wikipedia.


text:
Q: Azure Devops API Release test results I've got a couple of questions.
I'm trying to use the Azure DevOps API to get the test results from a release, the release has multiple tests that are listed separately in the test runs i.e they have different RunID numbers. What URI do I use to get the actual test results the way it's displayed if you click on the test results from within the release pipeline. If this cannot be done, how do I get all of the test results relating to one release and output the fail and success total of them added together.
The other way I've looked at this is to get all of the RunID's from the tests and filter through them matching the release name in the Run to the release name in the release pipeline, but seeing as there are over 1248 runs I don't want to do that.
I'm having trouble getting the run query working I don't know how to set the minLastUpdatedDate={minLastUpdatedDate} or the
maxLastUpdatedDate={maxLastUpdatedDate} are set.
https://learn.microsoft.com/en-us/rest/api/azure/devops/test/runs/query?view=azure-devops-rest-5.0
The documentation doesn't specify the format apart from date-time!
Some examples would be great.

A: Is DateTime format the main problem here?
"yyyy-MM-dd" and
"MM/dd/yyyy HH:mm:ss"
both worked for me, I guess more would too.
Example:
https://[...]/_apis/test/runs?minLastUpdatedDate=2019-07-02&maxLastUpdatedDate=07/05/2019 16:16:11&releaseIds=243&releaseEnvIds=2899&api-version=5.0


text:
Q: How can i customized my list view horizental scrollbar appearence? I am using wpf listview horizontaly. When i fixed the width of listview the horizontal scrollbar is shown  automatically.
I want to change its appearence.
Like my listview shown on middle and both corners have scroll buttons left and right.
How can i achive this please let me know its urgent....

A: If I understood your request correctly:

*

*You don't actually want to cause the ListView to scroll your data to the center

*You do want to make the scroll bar on the ListView appear differently

For example, if you are using a GridView and you want the horizontal scroll bar to be converted to buttons to the left and right of your view you could style it this way:
<Style x:Key="{x:Static GridView.GridViewScrollViewerStyleKey}" TargetType="{x:Type ScrollViewer}">
  <Setter Property="Focusable" Value="false"/>
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="{x:Type ScrollViewer}">
        <DockPanel Background="{TemplateBinding Background}" SnapsToDevicePixels="true">

          <RepeatButton DockPanel.Dock="Left"
                        Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                        Command="{x:Static ScrollBar.LineLeftCommand}"
                        Content="{StaticResource ScrollLeftArrow}"/>

          <RepeatButton DockPanel.Dock="Right"
                        Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                        Command="{x:Static ScrollBar.LineRightCommand}"
                        Content="{StaticResource ScrollRightArrow}"/>

          <ScrollBar DockPanel.Dock="Right"
                     Name="PART_VerticalScrollBar"
                     Orientation="Vertical"
                     Minimum="0.0"
                     Maximum="{TemplateBinding ScrollableHeight}"
                     ViewportSize="{TemplateBinding ViewportHeight}"
                     Value="{Binding Path=VerticalOffset,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}"
                     Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                     Cursor="Arrow"/>

          <ScrollBar DockPanel.Dock="Bottom"
                     Name="PART_HorizontalScrollBar"
                     Visibility="Hidden"
                     Orientation="Horizontal" />

          <DockPanel Margin="{TemplateBinding Padding}">
            <ScrollViewer DockPanel.Dock="Top"
                          HorizontalScrollBarVisibility="Hidden"
                          VerticalScrollBarVisibility="Hidden"
                          Focusable="false">
              <GridViewHeaderRowPresenter Margin="2,0,2,0"
                                          Columns="{Binding Path=TemplatedParent.View.Columns,RelativeSource={RelativeSource TemplatedParent}}"
                                          ColumnHeaderContainerStyle="{Binding Path=TemplatedParent.View.ColumnHeaderContainerStyle,RelativeSource={RelativeSource TemplatedParent}}"
                                          ColumnHeaderTemplate="{Binding Path=TemplatedParent.View.ColumnHeaderTemplate,RelativeSource={RelativeSource TemplatedParent}}"
                                          ColumnHeaderTemplateSelector="{Binding Path=TemplatedParent.View.ColumnHeaderTemplateSelector,RelativeSource={RelativeSource TemplatedParent}}"
                                          AllowsColumnReorder="{Binding Path=TemplatedParent.View.AllowsColumnReorder,RelativeSource={RelativeSource TemplatedParent}}"
                                          ColumnHeaderContextMenu="{Binding Path=TemplatedParent.View.ColumnHeaderContextMenu,RelativeSource={RelativeSource TemplatedParent}}"
                                          ColumnHeaderToolTip="{Binding Path=TemplatedParent.View.ColumnHeaderToolTip,RelativeSource={RelativeSource TemplatedParent}}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
            </ScrollViewer>
            <ScrollContentPresenter Name="PART_ScrollContentPresenter"
                                    KeyboardNavigation.DirectionalNavigation="Local"
                                    Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    CanContentScroll="{TemplateBinding CanContentScroll}"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
          </DockPanel>

        </DockPanel>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

What this does is modify the ScrollViewer template used within GridView to consist of:

*

*Two repeat buttons, docked to the left and right sides and used to scroll left and right

*A vertical scrollbar in case vertical scrolling is required

*A hidden horizontal scrollbar to satisfy the ScrollViewer (it depends on a scrollbar actually existing), and

*The normal GridView content consisting of the header and the data

Similar techniques apply to ListBox, etc, except the ScrollViewer template is simpler because it doesn't need to deal with header rows.
If you explain the exact layout you want when the scrolling is enabled (a picture would be nice), I may be able to give youa better answer.  It might also help to see your existing XAML.


text:
Q: scopt3 sample script does not compile I'm trying to use scopt3 in my project but I get compilation errors even for the sample code on scopt3 Github page:
val parser = new scopt.OptionParser[Config]("scopt") {
  head("scopt", "3.x")
  opt[Int]('f', "foo") action { (x, c) =>
    c.copy(foo = x) } text("foo is an integer property")
  opt[File]('o', "out") required() valueName("<file>") action { (x, c) =>
    c.copy(out = x) } text("out is a required file property")
  opt[(String, Int)]("max") action { case ((k, v), c) =>
    c.copy(libName = k, maxCount = v) } validate { x =>
    if (x._2 > 0) success else failure("Value <max> must be >0")
  } keyValueName("<libname>", "<max>") text("maximum count for <libname>")
  opt[Seq[File]]('j', "jars") valueName("<jar1>,<jar2>...") action { (x,c) =>
    c.copy(jars = x) } text("jars to include")
  opt[Map[String,String]]("kwargs") valueName("k1=v1,k2=v2...") action { (x, c) =>
    c.copy(kwargs = x) } text("other arguments")
  opt[Unit]("verbose") action { (_, c) =>
    c.copy(verbose = true) } text("verbose is a flag")
  opt[Unit]("debug") hidden() action { (_, c) =>
    c.copy(debug = true) } text("this option is hidden in the usage text")
  note("some notes.\n")
  help("help") text("prints this usage text")
  arg[File]("<file>...") unbounded() optional() action { (x, c) =>
    c.copy(files = c.files :+ x) } text("optional unbounded args")
  cmd("update") action { (_, c) =>
    c.copy(mode = "update") } text("update is a command.") children(
    opt[Unit]("not-keepalive") abbr("nk") action { (_, c) =>
      c.copy(keepalive = false) } text("disable keepalive"),
    opt[Boolean]("xyz") action { (x, c) =>
      c.copy(xyz = x) } text("xyz is a boolean property"),
    checkConfig { c =>
      if (c.keepalive && c.xyz) failure("xyz cannot keep alive") else success }
  )
}

errors are:
1) not found type Config
I thougth it was com.typesafe.config.Config, but when I import I get "velue copy is not a member of com.typesafe.config.Config". Where does Config come from?
2) not found value foo
All arguments to .copy() method are marked as "not found values" (I suppose is due to the previous error on Config)
I'm on scala 2.11.6 / SBT 0.13.8
Any help?

A: scopt has nothing to do with typesafe-config at all.
If you carefully read the README, you will notice that Config is defined right before the code you paste here:
case class Config(foo: Int = -1, out: File = new File("."), xyz: Boolean = false,
  libName: String = "", maxCount: Int = -1, verbose: Boolean = false, debug: Boolean = false,
  mode: String = "", files: Seq[File] = Seq(), keepalive: Boolean = false,
  jars: Seq[File] = Seq(), kwargs: Map[String,String] = Map())

It is merely an example of an object that holds all parameters of a program.
The idea is you parametrise OptionParser with any configuration object you wish. E.g.
case class Foo(name: String)

val parser = new scopt.OptionParser[Foo]("foo") {
  opt[String]('n', "name") action { (n, foo) => foo.copy(name = n) }
}
val res = parser.parse(args, Foo("default"))


text:
Q: unfartunately app has stopped, random numbers crash but i achieved to get no errors in code but when i try to execute in emulator it says unfartunately app has stopped.
The problem have to be in this part, because it stops only when klassenNr=6
int zufallsNr1;
int zufallsNr2 = 300;
int zufallsNr3 = 300;
int zufallsNr4 = 300;
int zufallsNr5 = 300;

if (klassenNr == 6) {
    Random zufall = new Random();
    int zufallsNr1 = zufall.nextInt(name[4].length);
    while (zufallsNr1 == zufallsNr2 && zufallsNr2 == 300) {
        zufallsNr2 = zufall.nextInt(name[4].length);
    }
    while (zufallsNr3 == zufallsNr2 && zufallsNr3 == zufallsNr1 && zufallsNr3 == 300) {
        zufallsNr3 = zufall.nextInt(name[4].length);
    }
    while (zufallsNr4 == zufallsNr2 && zufallsNr4 == zufallsNr1 && zufallsNr4 == zufallsNr3
                && zufallsNr4 == 300) {
        zufallsNr4 = zufall.nextInt(name[4].length);
    }
    while (zufallsNr5 == zufallsNr2 && zufallsNr5 == zufallsNr1 && zufallsNr5 == zufallsNr3
                && zufallsNr5 == zufallsNr4 && zufallsNr5 == 300) {
        zufallsNr5 = zufall.nextInt(name[4].length);
    }

    valuelist = new String[] { name[4][zufallsNr1],
            name[4][zufallsNr2], name[4][zufallsNr3],
            name[4][zufallsNr4], name[4][zufallsNr5] };

} else {
    if (klassenNr == 5) {
        valuelist = topographienamen;
    } else {
        valuelist = name[klassenNr];
    }
}

300 is much more than name[4].length
logcat:
05-30 01:46:09.725: I/ActivityManager(297): START u0 {cmp=com.jafapp.igeo/.FuenfteActivity (has extras)} from pid 12533
05-30 01:46:09.738: W/WindowManager(297): Failure taking screenshot for (328x583) to layer 21020
05-30 01:46:10.355: D/AndroidRuntime(12533): Shutting down VM
05-30 01:46:10.406: W/dalvikvm(12533): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
05-30 01:46:10.506: E/AndroidRuntime(12533): FATAL EXCEPTION: main
05-30 01:46:10.506: E/AndroidRuntime(12533): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jafapp.igeo/com.jafapp.igeo.FuenfteActivity}: java.lang.ArrayIndexOutOfBoundsException: length=254; index=300
05-30 01:46:10.506: E/AndroidRuntime(12533):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at android.os.Looper.loop(Looper.java:137)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at android.app.ActivityThread.main(ActivityThread.java:5041)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at java.lang.reflect.Method.invokeNative(Native Method)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at java.lang.reflect.Method.invoke(Method.java:511)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at dalvik.system.NativeStart.main(Native Method)
05-30 01:46:10.506: E/AndroidRuntime(12533): Caused by: java.lang.ArrayIndexOutOfBoundsException: length=254; index=300
05-30 01:46:10.506: E/AndroidRuntime(12533):    at com.jafapp.igeo.FuenfteActivity.onCreate(FuenfteActivity.java:449)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at android.app.Activity.performCreate(Activity.java:5104)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
05-30 01:46:10.506: E/AndroidRuntime(12533):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
05-30 01:46:10.506: E/AndroidRuntime(12533):    ... 11 more
05-30 01:46:10.585: W/ActivityManager(297):   Force finishing activity com.jafapp.igeo/.FuenfteActivity
05-30 01:46:10.645: W/ActivityManager(297):   Force finishing activity com.jafapp.igeo/.KlassenlisteActivity
05-30 01:46:11.189: W/ActivityManager(297): Activity pause timeout for ActivityRecord{40fbe7f0 u0 com.jafapp.igeo/.FuenfteActivity}
05-30 01:46:11.255: E/SurfaceFlinger(37): ro.sf.lcd_density must be defined as a build property
05-30 01:46:11.775: E/SurfaceFlinger(37): ro.sf.lcd_density must be defined as a build property

A: Your code loops as long as ALL the variables are 300. But if ONE of them is not 300 which is the case after the first loop the rest will never loop at all. So in the end when your 254 long String[] array is acccessed, most of them will be 300 which causes the Exception.


text:
Q: Rails Production Pre-compile assets When I try to pre-compile assets for Production it gives the following error, please help me out with this i need to make a release..,
RAILS_ENV=production bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/home/ubuntu/.rvm/rubies/ruby-1.9.3-p327/bin/ruby /home/ubuntu/.rvm/gems/ruby-1.9.3-p327/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Command failed with status (): [/home/ubuntu/.rvm/rubies/ruby-1.9.3-p327/b...]
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/file_utils.rb:45:in `call'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/file_utils.rb:45:in `sh'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/file_utils_ext.rb:40:in `sh'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/file_utils.rb:80:in `ruby'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/file_utils_ext.rb:40:in `ruby'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.9/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.9/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.9/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/task.rb:227:in `call'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/task.rb:227:in `block in execute'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/task.rb:222:in `each'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/task.rb:222:in `execute'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/home/ubuntu/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/task.rb:152:in `invoke'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/application.rb:141:in `invoke_task'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/application.rb:99:in `block (2 levels) in top_level'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/application.rb:99:in `each'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/application.rb:99:in `block in top_level'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/application.rb:108:in `run_with_threads'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/application.rb:93:in `top_level'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/application.rb:71:in `block in run'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327@global/gems/rake-10.0.2/bin/rake:37:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327/bin/rake:19:in `load'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327/bin/rake:19:in `<main>'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `eval'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:precompile

A: Solved this issue, It was issue of my CPU, CPU was on top 100% and the pre compile process was timed out of que processes.
I have stopped all the remaining running processes and compiled, assets got compiled perfectly .,
thank you @phoet


text:
Q: How to fix 'Missing version in readMessageBegin, old client?' when connecting to Cloudera Hive 1.1.0> I have a customized Hive server that extends HiveServer2. I can launch it using the following parameters in CDH5:
  --hiveconf "hive.server2.authentication=NOSASL" \
  --hiveconf "hive.metastore.local=true" \
  --hiveconf "hive.metastore.uris=" \
  --hiveconf "hive.metastore.sasl.enabled=false" \
  --hiveconf "fs.hdfs.impl.disable.cache=true" \
  --hiveconf "fs.file.impl.disable.cache=true" \
  --hiveconf "hive.server2.authentication.kerberos.principal=$KRB_PRINCIPAL" \
  --hiveconf "hive.server2.authentication.kerberos.keytab=$KRB_KEYTAB"

However, whenever I try to connect to it using beeline, I got the following error:

17/09/04 03:04:44 ERROR TThreadPoolServer: Thrift error occurred
  during processing of message.
  org.apache.thrift.protocol.TProtocolException: Missing version in
  readMessageBegin, old client?     at
  org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:228)
    at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:27)
    at
  org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
    at
  org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
    at
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

This error is identical to the one reported in Hive - Thrift - Missing version in readMessageBegin, old client?. But the condition is different: my authentication is already set to NOSASL, and my server thrift version is already V7.
Is there any other reason that could cause it to be triggered? (e.g. JAR hell or incorrect configuration from hive-site.xml)

A: I was facing the same problem 2 days back, I believe problem here is you are starting server and client on different transport mode. Try putting these properties in hive-site.xml
  <property>
      <name>hive.server2.transport.mode</name>
      <value>http</value>
  </property>

  <property>
      <name>hive.server2.thrift.http.port</name>
      <value>10001</value>
  </property>

  <property>
      <name>hive.server2.thrift.http.path</name>
      <value>cliservice</value>
  </property>

Then start your metastore:
nohup bin/hive --service metastore &

Start your hiveserver2
hive --service hiveserver2 --hiveconf hive.server2.thrift.port=10001 --hiveconf hive.root.logger=INFO,console

Then to connect from beeline:
!connect jdbc:hive2://localhost:10001/hive;transportMode=http;httpPath=cliservice

You will be connected to: Apache Hive.


text:
Q: How to pass keywords list to pathos.multiprocessing? I am using pathos.multiprocessing to parallelize a program that requires using instance methods. Here is a minimum working example:
import time
import numpy as np
from pathos.multiprocessing import Pool, ProcessingPool, ThreadingPool

class dummy(object):
    def __init__(self, arg, key1=None, key2=-11):

        np.random.seed(arg)

        randnum = np.random.randint(0, 5)

        print 'Sleeping {} seconds'.format(randnum)
        time.sleep(randnum)

        self.value = arg
        self.more1 = key1
        self.more2 = key2

args = [0, 10, 20, 33, 82]
keys = ['key1', 'key2']
k1val = ['car', 'borg', 'syria', 'aurora', 'libera']
k2val = ['a', 'b', 'c', 'd', 'e']
allks = [dict(zip(keys, [k1val[i], k2val[i]])) for i in range(5)]

pool = ThreadingPool(4)
result = pool.map(dummy, args, k1val, k2val)

print [[r.value, r.more1, r.more2] for r in result]

The result printed is (as expected):
Sleeping 4 seconds
Sleeping 1 seconds
Sleeping 3 seconds
Sleeping 4 seconds
Sleeping 3 seconds
[[0, 'car', 'a'], [10, 'borg', 'b'], [20, 'syria', 'c'], [33, 'aurora', 'd'], [82, 'libera', 'e']]

However, in this call to map the order of the last two arguments matters, and if I do:
result2 = pool.map(dummy, args, k2val, k1val)

I obtain:
[[0, 'a', 'car'], [10, 'b', 'borg'], [20, 'c', 'syria'], [33, 'd', 'aurora'], [82, 'e', 'libera']]

whereas I would like to obtain the same as the first result. The behaviour would be the same as what apply_async kwds can do in the standard module multiprocessing, i.e. pass a list of dictionaries, where in each dictionary the keys are the keyword names and the items are the keyword arguments (see allks). Notice that the standard module multiprocessing cannot use instance methods, and therefore does not meet even the minimum requirements.
Tentatively this would be:
    result = pool.map(dummy, args, kwds=allks) # This does not work

A: I'm the pathos author.  Yeah, you hit on something that I have known needs a little work.  Currently, the map and pipe (i.e. apply) methods from ProcessPool, ThreadPool, and ParallelPool cannot take kwds -- you have to pass them as args. However, if you use _ProcessPool or _ThreadPool, then you can pass kwds to their map and apply methods.
The pools in pathos.pools that start with an underscore actually come directly from multiprocess, so they have identical APIs to those in multiprocessing (but with better serialization, so can pass class methods etc).
>>> from pathos.pools import _ProcessPool
>>> from multiprocess.pool import Pool
>>> Pool is _ProcessPool
True

So, for the edits to the original code would look something like this (from the OP's suggested edit):
>>> from pathos.pools import _ThreadPool
>>> pool = _ThreadPool(4)
>>>
[…]
>>> result = []
>>> def callback(x):
>>>    result.append(x)
>>>
>>> for a, k in zip(args, allks):
>>>     pool.apply_async(dummy, args=(a,), kwds=k, callback=callback)
>>>
>>> pool.close()
>>> pool.join()


text:
Q: Bug ao utilizar pseudo-elemento after em telas pequenas Olá, um bug curioso apareceu quando tentei fazer um texto com esse efeito:

O problema é em telas menores, o segundo efeito no texto "adipiscing elit!" simplesmente some, dependendo do tamanho os dois somem, como mostrado na imagem abaixo:

ALTERAÇÃO: Análisando eu percebi que o problema é a quebra da palavra com o efeito, Será que existe alguma maneira de contornar isto?

Abaixo vai o exemplo do código.

Para reproduzir basta diminuir a viewport do seu navegador.

.color-primary {
    color: #225cbe;
}

.featured-text {
    position: relative;
    font-weight: 900;
}

.featured-text:after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 35%;
    background-color: #fdd104;
    z-index: -10;
}

      Lorem Ipsum,
     dolor amit.

    Consectetur,

      adipiscing elit!

A: Seu problema é que quando a linha quebre o pseudo elemento perde a referência. Encontrei duas formas de resolver, porém não sei se vai ser o ideal para vc.

A primeira é clocando display:inline-block no span e a outra é uma técnica menos elegante, usando um &nbsp para "preencher" o espaço entre uma palavra e outra, e usando a classe em cada uma das palavras...
Veja como fica o comportamento:

Segue o código que usei:

.color-primary {
  color: #225cbe;
}

.featured-text {
  position: relative;
  font-weight: 900;
}

.featured-text:after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 35%;
  background-color: #fdd104;
  z-index: -10;
}

    Lorem Ipsum,
   dolor amit.

  Consectetur,

    adipiscing elit!

  Consectetur,

    adipiscing
      &nbsp elit!


text:
Q: problem with a jpa query based on the method name with condition on a super class@mappedSuperclass property I have an audit base class annotated with @MappedSuperclass that contains the createdDate property, a girl class that contains the StationReference property, how to make a request based on the method name in jpa in the repository of the daughter. i want to retrieve List of Buytrace according to the parameters createdDate and stationReference
i tried this
 public interface BuyTraceRepository extends JpaRepository<BuyTrace, Long> {
     List<BuyTrace> findBuyTraceByCreatedDateAndStationReference(Date from,String ref);
     @Query("select b from BuyTrace b where b.createdDate = :date AND b.stationReference = :ref")
     List<BuyTrace> findCreatedDateAndStationReference(@Param("date") Date date,@Param("ref") String ref);

     List<BuyTrace> findBuyTraceByCreatedDateBetween(Date from, Date to);
}

The Entity class (daughter class)enter code here
 public class BuyTrace extends AuditableEntity {

      private String stationReference;
}

The mother class
 @MappedSuperclass
 @EntityListeners(AuditingEntityListener.class)
 public abstract class AuditableEntity<U> {
     @Column(name = "created_date", nullable = false, updatable = false)
     @CreatedDate
     @Temporal(TemporalType.TIMESTAMP)
     public Date createdDate;
  }

the first two methods of the repository do not work but curiously the method between two date(the last) works perfectly. I do not understand anything please help me


text:
Q: Get correct difference between two selected dates in years, months and days in Android How can i get difference between two selected dates from calendar in Android in days, months and years ? We know all that the months sometimes have 30 days and sometimes 31 days and in February 28 days just every 4 years come 29 days. I want to get the result for example like this: 2 years and 6 months and 24 days.
I try to use LocalDate so this is my code:
public void onSelectedDayChange(@NonNull CalendarView view,
        final int year, final int month, final int dayOfMonth) {

    textView.setText(String.valueOf(dateDiff(year,month,dayOfMonth)));
}

public Period dateDiff(int year,int month,int day){
    final int Day = c.get(Calendar.DAY_OF_MONTH);
    final int Month = c.get(Calendar.MONTH);
    final int Year = c.get(Calendar.YEAR);
    LocalDate localDate1 = LocalDate.of(year,month,day);
    LocalDate localDate2 = LocalDate.of(Year,Month,Day);

    Period period = Period.between(localDate2,localDate1);

    return period;
}

I tested the code but i got wrong result. When i test it with days (02/05/2020) i got 8 days but the difference is 7 days because "April" has 30 days and for the selected day (02/07/2020) i got 2 months and 8 days or the correct answer are 2 months and 7 days.
I try to get first a correct result, if there is a function or a calculation formula to solve this wrong result, this will help me.
Finally i got in result each time something like (P2M8D) that's meaning 2 months and 8 days, or for example (P7D) that's mean 7 days, so how can i change this text to an understood one like 2 months and 8 days or 7 days like the 2 examples because i found problem in result because we have mixed between numbers and characters.

A: You're well on the right way.

*

*Follow the Java naming conventions. A variable or parameter name begins with a lower case letter. Always. It's particularly confusing that you've got parameter year and variable Year. This is bound to lead to errors at some point (though this doesn't seem to be the reason at the moment).

*Since you can use LocalDate and Period from java.time, the modern Java date and time API, don't mix in the poorly designed and outdated Calendar class too, it just complicates things. Your use of LocalDate and Period is basically correct. For getting the current date as a LocalDate use LocalDate.now(ZoneId.systemDefault()) (and we no longer need the uppercase variables, two problems solved in one shot).

*I don't know your date picker, but I suspect that it may use 0-based month numbers: 0 for January through 11 for December. If this is so, you need to add 1 to the month number when creating the LocalDate object.

For a more readable text use the methods of the Period object to get numbers and assemble your own string. A simple example is:
        String periodText = "" + period.getYears() + " years "
                    + period.getMonths() + " months " + period.getDays() + " days";

You will want to modify it to leave out the years if they are 0 and the months if they are 0. Consider what text you want to write if all the numbers are 0. You will want to write something, or the user will be confused. A further possible refinement will be to use singular of the words if there is exactly 1 (1 year rather than 1 years, etc.). You may look into using a StringJoiner and into writing an auxiliary method that returns a string with a number and the correct form of a noun, for example 1 month but 2 months.
Edit: Code for formatting the Period
Spelling out my suggestion in code, here's a way to format your Period:
    StringJoiner joiner = new StringJoiner(" ");
    joiner.setEmptyValue("No time at all");
    if (period.getYears() != 0) {
        joiner.add(singularOrPlural(period.getYears(), "year", "years"));
    }
    if (period.getMonths() != 0) {
        joiner.add(singularOrPlural(period.getMonths(), "month", "months"));
    }
    if (period.getDays() != 0) {
        joiner.add(singularOrPlural(period.getDays(), "day", "days"));
    }
    String periodText = joiner.toString();

    System.out.println(periodText);

The code is using this auxiliary method:
private static String singularOrPlural(int count, String singular, String plural) {
    if (count == -1 || count == 1) {
        return "" + count + ' ' + singular;
    } else {
        return "" + count + ' ' + plural;
    }
}

Example outputs:

No time at all
1 day
2 days
1 month
1 month 1 day
2 months
3 years 4 months 5 days
-1 year -1 month -6 days

A: I can't understand the problem you have with the "wrong result" of the returned period, clarify it better to me if you can.
By the way, you can try this to convert a format like P2M8D to 2 months and 8 days:
public static void main(String[] args) {
    int year = 2020, month = 7, day = 2;
    int yearDiff = dateDiff(year, month, day).getYears();
    int monthDiff = dateDiff(year, month, day).getMonths();
    int dayDiff = dateDiff(year, month, day).getDays();
    System.out.println("Period -> yyyy:" + yearDiff + " mm:" + monthDiff + " dd:" + dayDiff); // OUTPUT: Period -> yyyy:0 mm:3 dd:7
}

static Period dateDiff(int year, int month, int day) {
    Calendar c = Calendar.getInstance();
    final int Day = c.get(Calendar.DAY_OF_MONTH);
    final int Month = c.get(Calendar.MONTH);
    final int Year = c.get(Calendar.YEAR);
    LocalDate localDate1 = LocalDate.of(year, month, day);
    LocalDate localDate2 = LocalDate.of(Year, Month, Day);

    return Period.between(localDate2, localDate1);
}

You have to use getDays, getMonths and getYears methods.


text:
Q: Animate Grid from one position to another I have a grid of images and buttons, and I want to animate motion from one position to another (actually a few spaces to the left) automatically, but it hasn't worked. I've tried using a storyboard in xaml and programatically as in the code below, but its now working. Please help!!!
    public static void MoveTo(Grid target)
    {
        Canvas.SetLeft(target, 0);

        var top = Canvas.GetTop(target);
        var left = Canvas.GetLeft(target);
        TranslateTransform trans = new TranslateTransform();
        target.RenderTransform = trans;
        double newX = (double)(left - 300);
        double newY = (double)top;
        DoubleAnimation anim1 = new DoubleAnimation(top, -15, TimeSpan.FromSeconds(10));
        //DoubleAnimation anim1 = new DoubleAnimation(top, newY - top, TimeSpan.FromSeconds(10));

        DoubleAnimation anim2 = new DoubleAnimation(left, newX - left, TimeSpan.FromSeconds(10));
        anim1.AutoReverse = true;
        anim1.RepeatBehavior = RepeatBehavior.Forever;
        trans.BeginAnimation(TranslateTransform.XProperty, anim1);
        trans.BeginAnimation(TranslateTransform.YProperty, anim2);
    }

A: totally TranslateTransform isnt good for that you want .better to use thinkness animation
i advise you dont use canavas and change it to grid but if you use canavas use this code
 private void Animationsss(Grid grd)
        {
            //create an animation
            DoubleAnimation da = new DoubleAnimation();
            //set from animation to start position
            //dont forget set canvas.left for grid if u dont u will get error
            da.From = Canvas.GetLeft(grd);
            //set second position of grid
            da.To = -100;
            //set duration
            da.Duration = new Duration(TimeSpan.FromSeconds(2));
            //run animation if u want stop ,start etc use story board
            grd.BeginAnimation(Canvas.LeftProperty, da);

        }

if you use grid code is this :
 private void Animation(Grid grd)
        {
            ThicknessAnimation ta = new ThicknessAnimation();
            //your first place
            ta.From = grd.Margin;
            //this move your grid 1000 over from left side
            //you can use -1000 to move to left side
            ta.To = new Thickness(1000, 0, 0, 0);
            //time the animation playes
            ta.Duration = new Duration(TimeSpan.FromSeconds(10));
            //dont need to use story board but if you want pause,stop etc use story board
            grd.BeginAnimation(Grid.MarginProperty, ta);
        }

you can use opacity animation for fade your grid ... it show good if move and fade !
    private void Animationsss(Grid grd)
        {
            DoubleAnimation da = new DoubleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(2)));
            grd.BeginAnimation(Grid.OpacityProperty, da);
        }

if there isnt any reason u can change canavas to grid and also better use TranslateTransform for resize controls like code below this code resize control if mouse enter in it :
private void grid1_MouseEnter(object sender, MouseEventArgs e)
        {
            //at first its normal size
            ScaleTransform st = new ScaleTransform(1, 1);
            //animation size to 1.25 persent of real size
            DoubleAnimation da = new  DoubleAnimation(1,1.25, new Duration(TimeSpan.FromSeconds(2)));
            //set transform to control
            grid1.RenderTransform = st;
            //animation transform now From Y And X
            st.BeginAnimation(ScaleTransform.ScaleXProperty, da);
            st.BeginAnimation(ScaleTransform.ScaleYProperty, da);
        }

if you animation for width or height do same work like scale transform :)
hope i can help you ...:))
leave comment for me please

A: You can also use xaml for this:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="TestBed.MainWindow"
x:Name="Window"
Title="MainWindow"
Width="640" Height="480">
<Window.Resources>
    <Storyboard x:Key="MoveGrid">
        <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="grid">
            <EasingThicknessKeyFrame KeyTime="0:0:1" Value="-300,0,0,0"/>
        </ThicknessAnimationUsingKeyFrames>
    </Storyboard>
</Window.Resources>
<Window.Triggers>
    <EventTrigger RoutedEvent="ButtonBase.Click" SourceName="button">
        <BeginStoryboard x:Name="MoveGrid_BeginStoryboard" Storyboard="{StaticResource MoveGrid}"/>
    </EventTrigger>
</Window.Triggers>
<Canvas>
    <Grid x:Name="grid" Height="300" Width="300" Background="Black">
        <Button x:Name="button" Content="Move the gird!" Height="30" Margin="10,0" />
    </Grid>
</Canvas>
</Window>


text:
Q: PHP: Regex to match only the second line I need to regex only second line of my string. I tried pattern like this:

/^[^\n]+\n(.+)/

and it doesn't work propertly, it gives me a lot more than just second line.
String:

Front-end developer
      10,000 zł - Warsaw, Poland
Cześć!
      Szukamy: Front-end Developera do oddziału 3e Software House w Warszawie (Mokotów obok metra, preferowane), Łodzi (Centrum) lub do
  pracy zdalnej.
      Oferujemy: 5-10k za mc (FV / UOD) + benefity, UOP adekwatnie, rozwój w kierunku Node.js
      Oczekujemy: min. rocznego doświadczenia (RWD, aplikacje single-page)
      Szczegóły: https://www.3e.pl/praca/programista-front-end-web-developer.html
      Kontakt z CV: programista.frontend@praca.3e.pl
      Praca: Scrum; rozwój i wsparcie frontu w serwisach o bardzo dużej odwiedzalności, zespół jak na zdjęciu.

A: If all you are trying to do is skip the 1st line with the subsequent new line and  empty space:
Front-end developer 10,000 zł - Warsaw, Poland
so you can select everything after that:
Cześć! Szukamy: Front-end Developera do oddziału 3e Software House w Warszawie (Mokotów obok metra, preferowane), Łodzi (Centrum) lub do pracy zdalnej. Oferujemy: 5-10k za mc (FV / UOD) + benefity, UOP adekwatnie, rozwój w kierunku Node.js Oczekujemy: min. rocznego doświadczenia (RWD, aplikacje single-page) Szczegóły: https://www.3e.pl/praca/programista-front-end-web-developer.html Kontakt z CV: programista.frontend@praca.3e.pl Praca: Scrum; rozwój i wsparcie frontu w serwisach o bardzo dużej odwiedzalności, zespół jak na zdjęciu.
You may want to try:
<?php

        $string = "Front-end developer 10,000 zł - Warsaw, Poland

        Cześć! Szukamy: Front-end Developera do oddziału 3e Software House w Warszawie
        (Mokotów obok metra, preferowane), Łodzi (Centrum) lub do pracy zdalnej. Oferujemy: 5-10k za
        mc (FV / UOD) + benefity, UOP adekwatnie, rozwój w kierunku Node.js Oczekujemy: min.
        rocznego doświadczenia (RWD, aplikacje single-page) Szczegóły:
        https://www.3e.pl/praca/programista-front-end-web-developer.html Kontakt z CV:
        programista.frontend@praca.3e.pl Praca: Scrum; rozwój i wsparcie frontu w serwisach o bardzo
        dużej odwiedzalności, zespół jak na zdjęciu.";

        $rx     = '#(.*?\n{2,})(.+)#si';
        $result = preg_replace($rx, "$2", $string);

        var_dump($result);
            // PRODUCES:
            Cześć! Szukamy: Front-end Developera do oddziału 3e Software House w Warszawie
        (Mokotów obok metra, preferowane), Łodzi (Centrum) lub do pracy zdalnej. Oferujemy: 5-10k za
        mc (FV / UOD) + benefity, UOP adekwatnie, rozwój w kierunku Node.js Oczekujemy: min.
        rocznego doświadczenia (RWD, aplikacje single-page) Szczegóły:
        https://www.3e.pl/praca/programista-front-end-web-developer.html Kontakt z CV:
        programista.frontend@praca.3e.pl Praca: Scrum; rozwój i wsparcie frontu w serwisach o bardzo
        dużej odwiedzalności, zespół jak na zdjęciu.";

Otherwise, if you just wish to get only the 2nd Line in that Multiline String you may try using explode("\n", $string) as shown below but since the 2nd Line in your String is empty, we'd extract the 3rd Line (at index 2) instead:

<?php

        $string     = "Front-end developer 10,000 zł - Warsaw, Poland

        Cześć! Szukamy: Front-end Developera do oddziału 3e Software House w Warszawie
        (Mokotów obok metra, preferowane), Łodzi (Centrum) lub do pracy zdalnej. Oferujemy: 5-10k za
        mc (FV / UOD) + benefity, UOP adekwatnie, rozwój w kierunku Node.js Oczekujemy: min.
        rocznego doświadczenia (RWD, aplikacje single-page) Szczegóły:
        https://www.3e.pl/praca/programista-front-end-web-developer.html Kontakt z CV:
        programista.frontend@praca.3e.pl Praca: Scrum; rozwój i wsparcie frontu w serwisach o bardzo
        dużej odwiedzalności, zespół jak na zdjęciu.";

        $arrLines   = explode("\n", $string);
        $result     = $arrLines[2];
        var_dump($result);
        // PRODUCES:
        '           Cześć! Szukamy: Front-end Developera do oddziału 3e Software House w Warszawie' (length=84)


text:
Q: Understanding printf in C I'm trying to understand how printf works in C for a simple case. I wrote the following program:
#include "stdio.h"

int main(int argc, char const *argv[])
{
    printf("Test %s\n", argv[1]);
    return 0;
}

Running objdump on the binary I noticed the Test %s\n resides in .rodata
objdump -sj .rodata bin

bin:     file format elf64-x86-64

Contents of section .rodata:
 08e0 01000200 54657374 2025730a 00        ....Test %s..

So formatted print seems to perform additional pattern copying from rodata to somewhere else.
After compiling and running it with stare ./bin rr I noticed a brk syscall before the actual write. So running it with
gdb catch syscall brk
gdb catch syscall write

shows that in my case the current break equals to 0x555555756000, but it then sets to 0x555555777000. When the write occurs the formatted string
x/s $rsi
0x555555756260: "Test rr\n"

Resides between the "old" and "new" break. After the write occurs the programs exits.
QUESTION: Why do we allocate so many pages and why didn't the break returns to the previous one after write syscall occurs? Is there any reason to use brk instead of mmap for such formatting?

A: brk() (and it's companion sbrk()) is some kind of mmap() specialized to manipulate the heap size. It is there for historical reasons, the libc could also use mmap() or mremap() directly.
The heap is expanded as additional memory is allocated, for example with malloc(), which happens internally in the libc, for example to have enough space to create the actual string from the format string and the parameters or many other internal things (i.e. the output buffers when using buffered io with the f* function family).
If some parts of the heap are not used anymore, it is often not automatically deallocated for two main reasons: the heap may be fragmented, and/or the unused heap does not fall below a certain threshold which justifies the operation, because it might be needed again soon.
As a side note: the format string itself is certainly not copied from the ro-section to the heap, this would be completely useless. But the result string is (usually) built on the heap.

A:
Why do we allocate so many pages ?

Using a system call is costly, so the library ask for more than you would like at this moment because it is highly probable that you will want more very soon. Managing memory in user mode is less costly. It is a matter of granularity.

and why didn't the break returns to
  the previous one after write syscall occurs?

Again, why free if the probability that you will ask for more soon is high?

Is there any reason to use brk instead of mmap for such formatting?

It is a matter of choice, this depends on implementation.
Aside: Your question is more about "memory allocation policy" than "understanding printf" (that is the context of).


text:
Q: How to refresh preferredStatusBarStyle in one ViewController for two or more times My old code :
- (void)setStatusBarLight:(BOOL)value {
    if (value) {
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    } else {
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
    }
}

Now setStatusBarStyle is deprecated. Apple says, that i should use preferredStatusBarStyle. But this calls only once. But in my option status bar must change color after some user actions in this view controller.
What can I do ?

A: Here is a solution:
[self setNeedsStatusBarAppearanceUpdate];

And View controller-based status bar appearance set to YES in Info.plist

A: Here is an example for having a view controller with a dark navBar and white statusBar text and present a view controller with a light navBar and black statusBar text:
vc1 (dark navBar, white statusBar text)
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self setNeedsStatusBarAppearanceUpdate];
}
- (UIStatusBarStyle)preferredStatusBarStyle {
    return UIStatusBarStyleDefault;
}

vc2 (light navBar, black statusBar text)
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self setNeedsStatusBarAppearanceUpdate];
}
- (UIStatusBarStyle)preferredStatusBarStyle {
    return UIStatusBarStyleLightContent;
}

open/present vc2 and statusBar text will change its color
- (void)openVC2 {
    UIViewController *vc = [[UIViewController alloc]init];
    UINavigationController *nvc = [[UINavigationController alloc]initWithRootViewController:vc];
    [nvc.navigationBar setNavBarColor:COLOR_gray_light ShadowColor:[UIColor clearColor]];
    [self presentViewController:nvc animated:YES completion:nil];
}

info: setNavBarColor:ShadowColor: is a custom method within my category
Don´t forget to set View controller-based status bar appearance to YES on your info.plist.


text:
Q: Null Pointer Exception Mockito Argument(s) are different (WebTestClient Put bodyValue) @Test
    void checkPutProfileNotFound() {
        ProfileDto profileDto = new ProfileDto("abcd@gmail.com", "abcd", null, null);
        when(profileService.putProfile(profileDto)).thenReturn(Mono.error(new NotFoundException()));
        webTestClient.put().uri("/profile/put")
                .bodyValue(profileDto)
                .exchange();
        verify(profileService, times(1)).putProfile(profileDto);
    }

Null Pointer Exception is caused and below error is also shown. This error is resolved if I replace profileDto object with any() in when() and verify(). I want to understand where exactly I am making mistake in my test case.
Argument(s) are different! Wanted:
com.example.profile.service.ProfileService#0 bean.putProfile(
    ProfileDto(email=abcd@gmail.com, name=abcd, dob=null, number=null)
);
-> at com.example.profile.controller.ProfileControllerTest.checkPutProfileNotFound(ProfileControllerTest.java:115)
Actual invocations have different arguments:
com.example.profile.service.ProfileService#0 bean.putProfile(
    ProfileDto(email=abcd@gmail.com, name=abcd, dob=null, number=null)
);

A: As pointed out in the comments section adding the equals method solved the problem because it was needed for comparing the objects in when() and verify().


text:
Q: What is the best open Source API for importing financial data from google finance or any source? I am currently looking for a way to import financial data into python directly. I was looking at a few alternatives finding the yfinance API to be the best so far. I created a notebook that explains it and how it works  in a git repositiry . However, I found that one cannot get the financial data as proposed in the documentation but just the market data. Can someone direct me to a better source to get financial data directly into Python for free?
I am particularly interested in looking at equities and would like to get the data into python directly using an API rather than downloading data then importing it into Python.
Sorry if this is a silly question, I have found a lot of API's that seem not to work on my computer so it would be great to get a referral from someone whom uses a particular method often.

A: I've used pandas_datareader to get daily stock info and its pretty straight forward.
here's how to install:
!pip install pandas_datareader

here's some simple code to pull high, low, open, close, volume, and adj close for the SPY
import pandas as pd
import numpy as np
import pandas_datareader as pdr
import datetime as dt

start = dt.datetime(1993, 1, 29)
end = dt.datetime(2020, 4, 15)

spy = pdr.get_data_yahoo('SPY', start=start, end=end)

spy.head()

this is a pretty simple way to pull daily information, but I've attached a link to an article for a couple of different API's if you're looking for something a bit more intricate.
https://towardsdatascience.com/best-5-free-stock-market-apis-in-2019-ad91dddec984


text:
Q: How to extract text data between numbers and semicolon in R? My desire is to extract texts between numbers begin with either 19 or 20 and semicolons.
abc 1993 def ghi; klm
cba 2012 kff kkk; zzz
xxx 1999 ggg yyy; vvv
cgc 2015 tet mmm; bbb

Expected output:
93 def ghi
12 kff kkk
99 ggg yyy
15 tet mmm

A: We can use sub in base R to capture the characters that succeeds either 19 or 20 and the ; and replace with the backreference (\\1) of the captured group
trimws(sub(".*\\b(19|20)([^;]+);.*", "\\2", str1))
#[1] "93 def ghi" "12 kff kkk" "99 ggg yyy" "15 tet mmm"

Or using trimws and whitespace
trimws(str1, whitespace = '.*(19|20)|;.*')
#[1] "93 def ghi" "12 kff kkk" "99 ggg yyy" "15 tet mmm"

Or with str_extract
library(stringr)
trimws(str_extract(str1, "(?<=\\b(19|20))[^;]+"))
#[1] "93 def ghi" "12 kff kkk" "99 ggg yyy" "15 tet mmm"

data
str1 <- c("abc 1993 def ghi; klm", "cba 2012 kff kkk; zzz", "xxx 1999 ggg yyy; vvv",
"cgc 2015 tet mmm; bbb")

A: In base R, we can use sub with non-capturing group for 19 and 20 and extract everything after that till semi-colon is encountered.
sub('.*(?:19|20)(.*);.*', '\\1', string)
#[1] "93 def ghi" "12 kff kkk" "99 ggg yyy" "15 tet mmm"

Using the same regex in str_match :
stringr::str_match(string, '(?:19|20)(.*);')[, 2]


text:
Q: 20 Million Raw_Read_Error_Rate per minute I decided to check the SMART status of my hard drive, and I saw it had 125239624 raw read errors.  Just a minute later I checked again for comparison and it was up to 127315512 raw read errors.
Should I be concerned?  This drive may still be under warranty. Should I send it in to be repaired?
This is the full output of smartctl -data -a /dev/sda:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_
FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   118   100   006    Pre-fail  Always       -
       193153912
  3 Spin_Up_Time            0x0023   099   099   000    Pre-fail  Always       -
       0
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -
       289
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -
       0
  7 Seek_Error_Rate         0x002f   076   060   030    Pre-fail  Always       -
       42002234
  9 Power_On_Hours          0x0032   098   098   000    Old_age   Always       -
       2039
 10 Spin_Retry_Count        0x0033   100   100   097    Pre-fail  Always       -
       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -
       285
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -
       0
184 End-to-End_Error        0x0033   100   100   097    Pre-fail  Always       -
       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -
       0
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -
       0
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -
       0
190 Airflow_Temperature_Cel 0x0022   059   052   045    Old_age   Always       -
       41 (Min/Max 20/42)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -
       20
192 Power-Off_Retract_Count 0x0022   100   100   000    Old_age   Always       -
       0
193 Load_Cycle_Count        0x0032   038   038   000    Old_age   Always       -
       125873
194 Temperature_Celsius     0x0022   041   048   000    Old_age   Always       -
       41 (0 17 0 0 0)
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -
       0
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -
       0
198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -
       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -
       0
254 Free_Fall_Sensor        0x0032   100   100   000    Old_age   Always       -
       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

A: The SMART results format is kinda garbage for this reason (well, it's confusing, at least). Modern disks are so packed with data that the raw error rate is usually fairly high - after applying error correction, no problems arise with data access/reliability.
I would focus on the below:
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -0
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -0
198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -0
This is the number of sectors reallocated, waiting to be reallocated, and unable to be reallocated, respectively.
When the head hits a bad sector and reading fails, it becomes a Current_Pending_Sector. The next time you try to write to it, it either works (everything goes back to normal, and the sector is reallocated) or it fails again—If there is reallocation space available from the pool, it will be reallocated. (Reallocated_Event_Count + 1). If the pool is used up, the sector becomes Offline_Uncorrectable and no further read/writes are possible.
Since your drive is not having any issue with sectors, only the standard, modern, data-density Raw_Read Error_Rate, I think you are fine. Standard advice about having backups always applies, but not more so here than in any other case, I think.

A: The short answer is no.
The drives that report raw read error rates will also report uncorrectable errors, you should only be concerned if the uncorrectable error counter increases.
Also to add errors can be caused by factors outside of the drive itself, bad SATA cables, bad cable connection, faulty ram, faulty DMI bus and faulty controller are all possible causes.
If you see errors increase but you do not see reallocated sectors increase, first thing to do is try a different cable, ideally also on a different port as well.  Make sure you not overclocking, using out of the box voltages for the board, ram and cpu.  If the errors persist, then at that point you might consider there could be an issue with the drive (uncorrectable errors not raw read error rate).
Other values which I think are more important are.
Current pending sectors.  This increases when some data has been failed to read, the sectors will stay pending until they are written to again, if the write succeeds they will be removed and nothing else happens, if the write fails, then they will be reallocated.  They will also be removed if another read attempt is made and it succeeds.
If you see pending sectors, it is a good idea to run chkdsk /r on the drive.  Make sure you also have backups.
Reallocated sector count, this goes up when the drive has determined a sector is broken, it deactivates the sector and uses a backup sector instead, this is usually a sign of upcoming failure and at this point you are probably on borrowed time, there is only a limited amount of backup sectors so eventually there will be no backup ones left to use, in my experience once you get 1 or more of these it tends to go up until point of failure.

A: The SMART attributes 1 Raw_Read_Error_Rate and 7 Seek_Error_Rate are NOT counters, they are error rates.  Their raw values are not meaningful to us, are defined by the manufacturer.  The Raw_Read_Error_Rate raw value is not reported for any hard disk except those made by Seagate, so you have a Seagate.  The important number for it is the VALUE of 118, which you can consider as 118%, better than 100% good (it's a statistically relative value).  You have nothing at all to worry about.
The Pre-fail flag just indicates which attributes are considered critical, for determining SMART PASS/FAIL status.  If the WORST for a Pre-fail attribute reaches THRESH, then the drive is considered FAILED.
5 Reallocated_Sector_Ct is a critical attribute, 196 Reallocated_Event_Count is not.

A: When you have a datacenter with thousands of HDDs, and it's easier and cheaper to replace a bad one than deal with a catastrophic failure, some SMART stats can be used to predict failure. For domestic users it's not reliable enough and usually not worth it. Sometimes drivers die without any warning, and sometimes they survive for months or years despite critical conditions.
Right now I'm using a computer with an HDD that's more than 4 years old and has been working for months with this warning from smartctl:
...
SMART overall-health self-assessment test result: FAILED!
Drive failure expected in less than 24 hours. SAVE ALL DATA.
...
5 Reallocated_Sector_Ct   0x0033   002   002   036    Pre-fail  Always   FAILING_NOW 4015
...

Statistically, this drive is already more than 21 times more likely to fail than yours, so, don't worry too much about it. Just keep your backups up to date, as you should be doing anyway.


text:
Q: HTML5 cache manifest index.html not loading linked files I am using a manifest file to cache my files. Between these files some are the index.html and some javascript libs.
After I tested my webpage , the files are successfully cached (i validated this with the web inspector), however when I open the page again the non-cached linked resources are not receiving response.
The link URL is ok because I can use the "copy link URL" option and paste the url in another browser tab and receive the response. But in my web page i am not receiving anything.
I tried using NETWORK: *  with the same result.
Is this because the index.html shouldn't be cached if it has non-cached resources linked?
thanks in advance

A: The Fallback Header has to be on it's own line, like so:
NETWORK:
*

(new line after the colon).

A: Did you use the same template for the index.html and the uncached resources or including the  entry somehow in those?
In that case you got the master entry for every page you don't want to be cached: every page that includes the manifest entry will became cached.


text:
Q: What is the difference between git status and git diff --name-only? These two commands seem to have options which will cause them to show the same information.

A: Besides the --name-flag that displays only the file name, the git diff command (without other arguments) will display the difference between your index and your working directory (as explained in the diagaram here).
Whereas the git status command will display the whole current status of your working tree (files that are staged, modified, deleted, untracked etc.)
However, by considering the -s flag that shorten the output of the status command (which typically display only names), we can have some situations where these two commands will give you "almost" the exact same output.. It all depends of what you already did in your working directory.
For example, if you do git status -s, you will get all the differences from your working directory against your HEAD and your index including untracked files.. (But say you don't have untracked files..)
On the other hands, and regardless of what you already staged or not, if you do git diff --name-only HEAD (see the above-mentioned diagram), there is a chance that you get almost the same output.
Also, the results are almost the same (not exactly the same) because git status -s shows pretty useful additional information:

*

*a letter at the beginning of the line that summarize the status (M for modified, D for deleted, A for added, ? for untracked files)

*a color code that shows what are already staged (green for staged, red for unstaged).

So, we can consider that diff is more suited to view differences in actual file contents. That is why not displaying untracked files by diff makes sense.. Comparing differences starting from only something we have (the tracked files)..
All that said, if you want some concise output about your actual changes (after all this is the rational for using --name-only) you should really consider git status -s.

A: On one hand, the git diff --name-only returns the name of the files which are ready to be staged on the next commit. As following :
git diff --name-only
/src/main/java/com/core/First.java
/src/main/java/com/core/Second.java

On the other hand, git status provides you not only the details of the files to be staged in the current working repository, but also the comparison with the origin of your branch.
git status

On branch myBranch
Your branch is up-to-date with 'origin/myBranch'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   /src/main/java/com/core/First.java
        modified:   /src/main/java/com/core/Second.java

no changes added to commit (use "git add" and/or "git commit -a")