Clear all "pages" cache

Question: Is there a way on Drupal 8 to clear all "pages" cache or all "nodes" pages?
I was thinking about a custom drush command but I don't understand how to do this.
Comment: You might want to elaborate here on what you're referencing here. Drupal has many different caches. Are you talking about all assets in the page render pipeline (e.g. CSS, JS, node data, etc.) or just a certain type of node cache. Look at the `cache_*` tables to get an idea of what Drupal is caching.
Comment: I'm working on a "cache warmer" script, so I want to clear cache of every node/NID path. I don't know the right way is to invalidate "node:nid" cache tag. The idea was to run an entityquery to retrieve nids (or a subset of nids) and then invalidate cache.
Comment: However the answer is invalidate the node:NID cache tag for every node
Answer: If you enable the settings documented in example.settings.local.php then you can easily see the cache tags that are present on a page.
What you will see then is that each rendered node has the node_view cache tag, so you only need to invalidate that.
There's also the 'rendered' cache tag which as added to any render cached item.
I don't quite understand why your cache warmer needs to invalidate the cache first, shouldn't be a problem if it's already warm? Drupal will automatically invalidate something if it is no longer valid.
The internal page cache also has no time limit by default.

Clear all "pages" cache


Are Dell server device driver and firmware updates not cumulative?

Question: We were informed by a consultant that many past driver and firmware version updates need to be installed to bring them up to the latest version. Is that correct or are the updates supplied cumulative? We were under the impression that just the latest version update would be necessary.
Example drivers update page. See older version info at bottom
https://www.dell.com/support/home/us/en/04/drivers/driversdetails?driverid=f3kfn&oscode=w12r2&productcode=poweredge-r720
https://www.dell.com/support/home/us/en/04/drivers/driversdetails?driverid=cn7mv&oscode=w12r2&productcode=poweredge-r720
The recommendation by the consultant is to install the first and last update of each major version. This ends up being a dozen installs with reboots after each to bring drivers/firmware up to date for one device. They are also recommending BIOS and Chipset updates, bringing the total count of installs and reboots up to 20. Doesn't seem like the most efficient way to go about it but is that accurate?
Comment: Does he bill by the hour?
Comment: @MichaelHampton ha, no actually we are planning on doing the work.
Answer: I've never heard, nor have I ever done that. In most cases, you should be installing the latest version driver and firmware updates. Make sure to read the release notes and installation instructions for each to make sure that there are no prerequisites.
There may be cases where your driver or firmware version is so old that you need to install some intermediate version before installing the latest version, but needing to install every prior version sounds a bit like nonsense. Again, make sure to read the release notes and installation instructions for each to make sure that there are no prerequisites, and if in doubt, contact Dell tech support.
If you're in doubt about this, call Dell tech support and ask them this question. As I said, I've never heard what this consultant is telling you and have never done what he's telling you.
Comment: OK. I understand what you're saying. I'm still in disagreement and I would implore you to contact Dell tech support to get their input and recommendation. If you have version 1.x and you want to upgrade to version 4.x then the consultant is telling you to install version 1.xx, then 2.x and 2.xx, then 3.x and 3.xx and I'm saying that I've never heard that, have never done that, and have never been told that by Dell. At the end of the day, Dell is the resource you should use as the authoritative answer.
Comment: hi, i am sorry to inform you that the Consulting person is right up at the point of dell, dell uses not over all complete Firmware Upgrades they use diff and rewuire a minimum if firmware Version to Upgrade to a newer one, soeciall this is for the bios, ie if you have a01 and want to upgrade to a24, it csn be thst you need zo upgrade really alot of times
Comment: I made that point in my answer. If your drivers/firmware is old enough then you may have to install one or more intermediate versions before installing the latest version. The idea that you have to install EVERY previous version is patently ridiculous.
Comment: @joeqwerty I didn't mean to imply that we were told that EVERY previous update needed to be installed, just the first and last version of each major revision. The concern being that between drivers and firmware that ends up being a dozen installs and reboots for one device.
Answer: I am adding another answer to add a detail for DELL firmware.
You can simply use the update DVD supplied for your model. That will bring to the latest version directly, multiple boot may be necessary, but the media will handle that corrcetly on it's own and will warn you.
See there for PowerEdge server: Update PowerEdge Servers with Platform Specific Bootable ISO
See there for your model: Platform Specific Bootable ISO, PER720 19.07.00
Install method;

Download the ISO for the platform and run the ISO using any of the
  below methods:
iDRAC virtual media:
  1.Mount the ISO using the iDRAC virtual media.
  2.Mark the next boot option as virtual media.
  3.Reboot the system.
  4.The system will boot into the ISO and upgrades the system components.
USB drive:
  1.Run any Bootable USB drive creator software.
  2.Select the downloaded ISO and create bootable media from it.
  3.Plugin in the USB drive to the server.
  4.Boot using the USB from BIOS settings.
  5.The system will boot into the ISO and upgrades the system components.
CD-ROM:
  1.Burn the downloaded ISO into a DVD.
  2.Boot using the DVD from BIOS settings.
  3.The system will boot into the ISO and upgrades the system components.

In my experience For Driver I always used the latest driver as told by joeqwerty, but I can't tell in your specific case, but for firmware as you can see it can be simple.
Comment: @dmr83457 Its the same in the end, just bigger as the SUU target all hardware, but both do the trick, but it's only one pass that I remember when using the SUU, I don't know why your consultant told it's multiple's pass / multiple version to install, as try it in detect mode, it will tell each firmware need update to version X, and the version X would be the latest.
Comment: @dmr83457 A note, your consultant is right about firmware of like Dell Storage Array, like Equalogic SAN. You need a upgrade path for such.
Comment: I am looking at the Server Update Utility. What is the differences between that and Platform Specific Bootable?


How to identify where a particular block come from?

Question: I have to modify a block that appears on the home page of the website, that I did not make myself. The block appears in admin/build/block with the title "Block Title (nodeblock)", so I assume that this has  been created by the nodeblock module, but I can't find where I can edit this content.
Can someone help me to find the right administration menu to view and modify this nodeblock content ?
Answer: The easiest way for Drupal 6 would probably be to use the Contextual links module.

Hover over nodes, blocks, and views blocks to expose styled
  edit/configure/delete tabs.

It's a backport of the same functionality that is in D7 core, but for Drupal 6.
Just hover over the block on the front page, and hit edit to edit that particular block.
Answer: UPDATE:
It appears from a quick look at the module source that nodeblock uses the node's nid as the block delta.
So, from admin/build/block if you click on the configure link on the block in question, it should take you to something along the lines of admin/build/block/configure/nodeblock/###.  That trailing ### is the nid of the node in the block.  So then off you go to node/###/edit.
OTHERWISE:
If this is just a one-off thing, a quick look at the default node-nodeblock-default.tpl.php template for creating these blocks shows...
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?> clear-block">

...so I would just surf over to your home page, and then take a peek at the source generated in your browser, and there it should show a
 wrapping this block with an id of node-###.
Then, going to node/###/edit should take you on your way.
Comment: Great ! Both methods are OK, thanks. We could probably suggest to nodeblock module developers to add a "Edit node" menu somewhere ...
Comment: Note that looking at div IDs and classes isn't always going to work because it is possible your block templates do not print that stuff out. It is very often a good solution though.


Question about training/validation/test

Question: In the book "The Elements of Statistical Learning" at page 222, the authors describe the training/validation/test approach. I find the following passage ambiguous:

Typically our model will have a tuning  parameter or parameters
$\alpha$ and so we can write our predictions as $\hat f_{\alpha}(x)$. The tuning
parameter varies the complexity of our model, and we wish to find the
value of $\alpha$ that minimizes error, that is, produces the minimum of the
average test error curve in Figure 7.1. Having said this, for brevity
we will often suppress the dependence of $\hat f(x)$ on $\alpha$.
It is important to note that there are in fact two separate goals that
we might have in mind:
Model selection: estimating the performance of
different models in order to choose the best one.
Model assessment:
having chosen a final model, estimating its prediction error
(generalization error) on new data.
If we are in a data-rich
situation, the best approach for both problems is to randomly divide
the dataset into three parts: a training set, a validation set, and a
test set. The training set is used to fit the models; the validation
set is used to estimate prediction error for model selection; the test
set is used for assessment of the generalization error of the final
chosen model. Ideally, the test set should be kept in a "vault," and
be brought out only at the end of the data analysis. Suppose instead
that we use the test-set repeatedly, choosing the model with smallest
test-set error. Then the test set error of the final chosen model will
underestimate the true test error, sometimes substantially.

It is not clear to me which subset of the data should be used to perform parameter tuning. I think that the authors are omitting that parameter tuning should be performed on the training set. So, I'd say that one way to perform it is to split the training set into two parts (training1 and training2), fit the same model but with different tuning parameters on training1, select the best tuning parameter using training2 and finally fit the model with the optimal tuning parameter on the whole training set. Another way would be to perform crossvalidation on the training set and then fit the model with the optimal tuning parameter on the whole training set. Is my understanding correct?
Answer: As you say, parameter tuning is frequently done by selecting the apparently best model from a number of models generated by varying the parameters in question. This is the "model selection" in the cited text.
Your approach is fine as far as it goes, but it does not yet contain the assessment of the final model, which needs independent test cases as well.
And yes, you can do the whole procedure by nesting e.g. cross validation: the inner CV for selecting the best parameters, outer CV to assess the performance for the model trained using parameters selected by the inner CV selection rule.
Comment: Thank you. So the validation set is used for parameter tuning while the test set is used to assess the performance of the model, with the optimal tuning parameter, fitted on the set of data given by the union between the training and the validation set. Is it correct? Suppose that I have to select the best model between a neural network and a support vector machine for a given prediction problem. Both of them have a vector of tuning parameters. I use the validation set to find the best vector of tuning parameters for the neural network and for the SVM. (continues)
Comment: Then I fit the neural network on the training+validation set with the optimal vector of tuning parameters and I do the same for the SVM. This leads to two final models (a NN and a SVM) whose performance is assessed with the test set. Finally I choose the final model between the two with the minimum prediction error in the test set. So is it correct to say that the test set is used to choose the winning final model?

Question about training/validation/test


Problema com acentuação em .js após concat e uglify no Gulp

Question: Estou tentando otimizar o site do órgão onde trabalho e estou enfrentando problemas após concatenar e minificar os javascripts.
Nosso servidor Apache usa ISO-8859-1 e todos os meus arquivos no PHPStorm são configurados nesse mesmo charset.
Após fazer o concat e uglify no Gulp (que funcionou corretamente), tive problemas com acentuação em algumas funcionalidades do sistema, por exemplo o "DatePicker" do jQuery-ui.
Onde deveria estar escrito "Horário" está "Hor?rio".
Já tentei usar o "gulp-convert-encoding" e configurá-lo para ISO-8859-1, mas também não funcionou.
segue o trecho onde chamo os arquivos, os concateno e minifico:
<code>var js  = [
    './msg/js/jquery-1.10.1.min.js',
    './placeholder/jquery-placeholder.js',
    './msg/js/msg.js',
    './enviarArquivo/js/ajaxupload.3.5.js',
    './funcoes/funcoes.js',
    '../../../padroes/interface/scripts/shadowbox.js', // Padrão de interfaces
    './calendario/jquery-ui-1.10.3.custom.js',
    './calendario/jquery-ui-timepicker-addon.js',
    './combobox/chosen.jquery.js',
];

gulp.task('minify-js', function () {
    gulp.src(js)
        .pipe(concat('script.min.js'))
        .pipe(convertEncoding({to: 'ISO-8859-1'}))
        .pipe(uglify())
        .pipe(gulp.dest('../pages/template/js/dist/'))
        .pipe(notify('Javascript compilado e minificado!'));
});
</code>
Vi que ao terminar de compilar, o arquivo script.min.js fica como UTF-8 e todos os caracteres acentuados são substituídos por (?).
Comment: Estava a ver no SOen uma sugestão de usar `stringfinal= decodeURIComponent(escape(stringinicial));`. Dá uma olhada caso resolva: http://stackoverflow.com/a/5396742/2256325. Dá uma olhada aqui também: https://www.npmjs.com/package/gulp-utf8-convert
Comment: Cara pra mim você já identificou o problema, "_Todos os arquivos estão em ISO-8859-1_". Não pode converter os arquivos para UTF-8?
Comment: @buback Já tentou converter para UTF-8 antes de concatenar e para ISO após ter concatenado?
Comment: O padrão para qualquer projeto é UTF-8, você não precisa utilizar o formato ISO-8859-1, por causa de acentuação, isso só força você a ter que converter caracteres para formatos especiais. o UTF-8 reconhece acentuação. Sem precisar de conversão.
Comment: Olá, @Sergio. Muito Obrigado, mas não dá pra fazer dessa forma já que existem milhares de linhas de código para verificar. Outra coisa: qualquer alert que tentamos usar e que tenha acentuação também apresenta problema. Todos os arquivos estão em ISO-8859-1 e só depois de executar o Gulp o arquivo vira UTF-8.
Comment: E não podes converter o arquivo todo em string para UTF? Estás a abrir o arquivo em Node? ou a receber o conteúdo em string no node?
Comment: @Sergio, na verdade tentei converter o arquivo, mas o erro permanece. Não estou abrindo no Node. Estou visualizando direto pelo site, que está em PHP.
Comment: Tentou habilitar o [`ASCIIOnly`](https://github.com/gruntjs/grunt-contrib-uglify#asciionly)?
Comment: @KaduAmaral, obrigado pela ajuda. Tentei agora habilitar o ASCIIOnly e também não funcionou. Sobre converter os arquivos em UTF8, não dá. Esses arquivos são usados em vários sistemas (na verdade não tenho como saber em quantos) de um órgão público estadual. Qualquer problema faz com que os contribuintes, auditores fiscais e contadores, congestionam o telefone. :(
Comment: Converti um dos arquivos para UT8 para testar e realmente funcionou. Usei o .pipe(convertEncoding({to: 'ISO-8859-1'})) e salvou o min.js como ISO. Vou procurar saber o que posso converter e tentar. Obrigado por enquanto.
Answer: if you use convertEncoding with from and to, all work fine:
<code> gulp.src('tmp/js/lib/**/*.js')
     //.pipe(stripCode({}))
     .pipe(convertEncoding({from: 'ISO-8859-15', to: 'UTF-8'}))
     .pipe(uglify())
     .pipe(convertEncoding({from: 'UTF-8', to: 'ISO-8859-15'}))
     .pipe(gulp.dest('dist/js/'));
</code>
Comment: It's StackOverflow in Portuguese, you must translate your answer.
Answer: Depois de várias tentativas, a única que funcionou foi convertendo cada arquivo para UTF8 antes de fazer o concat e o minify. Todas as acentuações funcionaram corretamente.


create link for URL-based text field in content type

Question: Drupal 7 question: In my Events content type, I have a text field called RSVP URL. On the event page, it currently displays as
RSVP URL: http://example.com
However, I would like it to be a link, displaying like so:
RSVP URL: http://example.com
I'm not seeing a way to do this, except perhaps via adding the Link module?, but I'm a newbie who's never even installed a module before, and I'm wondering if there's another built-in way. Thanks.
Answer: Click on edit in front of your link field in your content type's manage field tab.

You need to change Text processing option to filtered Text.

Then while adding this content type just type the URL with HTML tag.

I hope this solves your problem without installing a module.
Answer: I feel like the simpliest way to do that will be to install the linke field module directly from the web.
To do so :

Go to admin/modules ;
Clic on Install new module ;
Open a new tab. Paste link module link and go. A page displays with the description of the module ;
At the bottom of that page, Copy the link to the file (zip or tar.gz one) which is this one (this one is the zip one) ;
Go to the drupal (Install new module) page. Paste that link on the Install from url field and hit Install. Wait 'till it finished in a few seconds ;
Clic on Enable newly added.... ;
Search for the link field module by scrolling. Clic on install. Wait untill it finished in a few time ;

And you can go back to your content type in order to create that new link field with the wright type.
Does that help ?
Comment: My apologies for never responding way back when (I was such a newbie back then, and was also afraid of inadvertently revealing how much our team at the moment lacked anybody who could fix things if I did the module installation wrong, let alone worse fragilities the site had then, haha). While I did use the other answer in my case, I appreciated the step-by-step module enabling instructions back then (fortunately these days mostly doing composer+drush in D8), and no doubt your answer was useful to others, including those who didn't want to require their content editors write HTML!


jQuery - find a element inside a another element and getting it's html content

Question: so a Ajax call will return some data as html.
I'm creating a element from this data with  var comment = $("
").html(data);
Now I want to get the html content from another element inside the comment element I just created above.
I'm using var commentbody = comment.find(".comment-body").html();
This works, but the problem is that I get the element's contents only. I want to get the element tags too.
How can I do that?
Comment: Out of curiosity, why do you need its HTML string?
Comment: @patrick dw: because I want to separate the code from the comment template. If I would get only the comment content text I would have to hardcode my own comment template in the javascript (or a part of it). Initially I wanted to replace the entire list item, but comments can have child comments so that would not work :)
Answer: You can do this:
var commentbody = comment.find(".comment-body");

var outerHTML = commentbody[0].outerHTML ||
                          commentbody.clone().appendTo('
').parent().html();

Here you first find the .comment-body element you want. Then you access the DOM element with [0] and get its outerHTML property.
If it doesn't have an outerHTML property, then make a clone()(docs) of it, appendTo()(docs) a new
, traverse up to the parent()(docs)
 and get its html()(docs) content.
This answer assumes there's only one .comment-body to be found.


Display content with Taxonomy on User and Content matching

Question: I've got a specific content type.  One field is a term reference field called "blog subject" in which a content author tags the node.
Ok.  Moving on to the end user.  I added the same term reference field to user account settings in which a user can select certain terms that they're interested in.
I would like to create a view in which the contextual filter is the user.  By going to www.whatever.com/blogs/12, I can see content that matches the users selected interests.
Thoughts?
Answer: Create a view showing users, and use a contextual filter on User:UID, and set 'Provide default value' the the 'Currently logged in user'.
You then should create two Relationships. The first on User:blog_subject will relate the user to the taxonomy terms. The second, using the first, will be on Taxonomy Term: Content using Blog Subject which will then relate the term to the content. Both relationships should be 'Required'.
Once the relationships  are in place, delete the 'User Name' field that is a default for the type of view you created, and add the Content:Title field displayed as a link to content. Add filters like Content:Published to eliminate un-published content and a sort by, for example, Content:Post Date (desc). All of these fields will be using the relationships. Make sure you delete all the User:... filters and sorts.
With multiple terms possible, this may create duplicate rows. There are two approaches you can use. The simplest is to go to Advanced > Other and configure the Query Settings to 'Distinct'. This might work. The other is to list the term and Set the view to Group By the term. That way you will get a list of pages that conform to each subject. If a page appears multiple times, it will do so under separate subject lists.
This should show a list of content matching the interests of the current user.
Comment: Thanks...was missing one of the relationships.  Perfect.  Danke!
Comment: I was getting duplicates as mentioned, 'Distinct' wasn't working for me and I didnt want to have my content grouped together in the view.

I solved this with Aggregation. Enable aggregation in Advanced > use aggregation. Select aggregation settings on a unique field (in my case title) > aggregation type "group results together" > group column "value" > apply.


When a startup should hire a sys admin?

Question: The startup is growing and you have now 5 full-time devs on your team. You have an older application which is up and running in production and a new web application almost ready to be released. You have something like 5 physical servers (some new, some outdated), and 5/10 "cloud machines". The old version of your application was running to a simple webserver and evolved overtime to something more "professional". On the other hand, your new application takes profit of the cloud environment and is designed to support "high traffic volume" by using queues, nosql and other cool stuffs... Your sales are increasing, features development and bug fixing are needed. Your devs are at 110% of their capacity (and become real "Software swiss army knife developers") by developing a new app and supporting the old one... As you run out of resources, when it comes to resolve specifics problems, you call "a guy who knows" by paying expensive bills. You have unix and windows servers and you install updates and read the log viewer when you have the time or when you get an application error. So far, an ordinary situation for a tech startup...
So, now you have the picture. Should this company hire a sys admin or let the "devs who want" time to operate the infrastructure and outsource when they have doubt about the solution ??
Comment: If your developers are wearing their sysadmin hat then they're not spending their time developing.
Comment: Are you paying the bills, @dervlap? If not, it's up to the person paying the bills. Are the jobs getting done? Your devs won't be focused. Chances are there are things they don't know they don't know, which could bite you down the road. Are you getting adequate backups? Preventative maintenance? When your servers are getting updates and fixes "when there's time", you're risking malware infections and corruption. How much is your data worth to you? Do you have plans in place in case a server dies so your business keeps going?
Comment: Yep but does it worth to hire a full time sys admin and let the devs code or hire a new dev and let some devs operate the infra ?
Comment: If you have one or more devs who *want* to take care of infrastructure as well as code, then by all means let them do that and hire some more Full-time Devs.  Offer them a raise while you're at it because the dev who can and is willing to do SysAd work even part of the time is worth keeping and kept happy.  They may make mistakes and miss things, but they will learn and grow over time.
Answer: I say, as soon as you can afford one.
Devs aren't systems guys. They have no idea about how to best optimise MySQL to get the best performance. They don't know about Keepalive on Apache when running on a VM.
Those are 2 examples I've come across of a developer setting up a startup's webserver, and buggering it up in the process.
Many developers also have the attitude "It worked on my PC, therefore it must work on the server!"  - Bad News.
Hire a systems guy if you want it done right.
Comment: Agreed.  You wouldn't hire an SA to write your product, don't let your developers administer your systems.
Answer: When the cost of the staff outweighs the risk to your business of outages and data loss that would be prevented by the staff.
It's as simple as that.
Answer: At this scale you should already be looking at recording sufficient detail about what the current employees are spending their time on to answer the question. From your description I'd be getting everybody to track which product/site/service they are spending time on, what they are doing (admin, analysis, pre-launch development, bug fixing, other). If you've got near one FTE on the admin stuff then you certainly need an admin.
Beyond taking over some of the donkey work from your developers, a good admin should also add value to the services - particularly with regard to availability, security and performance.
But bear in mind this is a painful stage in the growth of your business - don't expect one person to be able to provide all the admin work 24x7 in perpetuity - some of the work must be shared so that other people have the skills (and access to backup media, passwords, external contacts....) to cover for her when she goes on vacation or gets a job elsewhere.

When a startup should hire a sys admin?


Testing ruby script

Question: I'm creating a Ruby (not Rails) script and I have to test using standard Rails unit tests and Cucumber. I can't use RSpec.
So how do I test a ruby script with Cucumber and Rails Test::Unit? Is it possible?
Comment: Yes it's possible, for cucumber it should suffice to create a feature file and a step definition.  Make sure the step definition requires the stuff you want to test.
Comment: Can you please show me how to do it?
Comment: Unfortunately I have no example code here. The best way to start is to make a mini project using the six steps on the http://cukes.info/ page. The feautere def must have a file ending .feature, the step definition _step.rb IIRC.
Comment: @Philip, the only difficult I would have is how to make it worked without Rails? Meaning "only with pure ruby".
Comment: Alan, you need multiple files.  I strongly recommend you to create a toy project first.  It must consist of the following files: toy.rb, features/sometest.feature, features/step_definitions/sometest_step.rb.  Copy&Paste the contents from http://cukes.info (Main page).  Then execute cucumber features/sometest.feature
Answer: Here, I created a complete example including a Rakefile for convenience.  The file structure is this:
<code>./notepad.rb
./Rakefile
./test
./test/test_notepad.rb
./features
./features/add_note.feature
./features/step_definitions
./features/step_definitions/add_note_step.rb
</code>
In fact this example doesn't even use classes, so you can really test typical "Scripts" with it.  File contents are here: http://pastebin.com/sJUP7VSA
So in the end you can do this:
<code>$ rake test
Finished tests in 0.001368s, 730.9942 tests/s, 1461.9883 assertions/s.

1 tests, 2 assertions, 0 failures, 0 errors, 0 skips

$ rake cucumber
1 scenario (1 passed)
2 steps (2 passed)
0m0.002s
</code>
Cheers, Philip

Testing ruby script


How does a variable's distribution inform decisions on predicting it with regression analysis?

Question: I was reading a forum post on Kaggle here. The person is showing an example of exploratory analysis for a competition.
During the exploratory analysis one of the charts generated is a log(targetVariable) distribution. Here is what it looks like:

I generated the same chart based on not log of the data just for my interest:
ggplot(full) + geom_histogram(mapping=aes(x=loss))

And it looks like this:

So what? Now what? Why do this?
Two facts have been learned:

The target variable is skewed left (Is that correct?) (It is not correct, see comment below)
The log of the target variable is normally distributed

In the context of multiple linear regression, how does this inform my decisions on prediction? Do I have to log() all my predictor variables now? Why? Other than generating a nice shiny chart, how does exploratory analysis of the distribution of thew target variable help when it comes to predicting the target variable?
Comment: FYI the convention for "sense of skew" is towards the tail, so your distribution is *right* skewed. If I understand your post correctly, then you have not presented any information on your *predictors*, so your exploratory analysis says nothing about whether they should be log-transformed or not. (This is a separate question from whether the target variable is lognormal.)
Comment: @GeoMatt22 thanks for the info. I will not edit the question so any other learners get this tidbit too
Answer: In this case, the y variable has a noticeable positive skew. It's hard to tell from the relatively low-resolution figure of the original variable, but it's possible that there is an abrupt cutoff just to the left of the mode.
This might be an indication of a variable that has an artificial left truncation. The "true" value of an employee to a workplace, for example, might range from high positive values to even negative values. If you try to ascertain this from paid wages, though, you will encounter an artificial left cutoff in the form of a minimum wage. Taking a logarithm of this type of variable can make it more normally distributed (as in the case you show). Say you're considering the effect of number of school years and recorded felonies on wages. The true model might be one that includes values that have been artificially been truncated.
This, however, leads to the question of whether taking the logarithm will improve the regression's performance. Saying that an increase in $x$ will cause a linear increase in $y$, is very different than saying that an increase in $x$ will cause a linear increase in $log(y)$ - these are contradictions, in fact.
Linear Regression Models with Logarithmic Transformations describes the four conceptual possibilities of taking logarithms in regression (a logarithm can be taken on a dependent and/or independent variable).
I think the important point is that the decision of whether to take a logarithm of the dependent variable depends not only on it, but also on the dependent variable(s). For one, as the paper above explains, it really depends on what the true model is. Also, note that, to some extent, linear regression assumes that the residual is normally distributed, and the residual depends on transformations to all variables.
So while the graphs you show are some indication that a log transformation on the y might be beneficial (it makes it more normal), you can't fully decide that based on the y alone.
Comment: Thanks for the details, and for the linked pdf which was useful.


How can we change the create order button link on ORO Commerce?

Question: We need to change create order button link like: baseurl/sso/checkout/
Like on this screenshot

I have created the bundle extension and when we this bundle extension add-in our app then all create order link change to our custom URL.
How can we possibly need to change programmatically?
And How can we every cart order data get to our custom URL page?
Answer:
How can we possibly need to change programmatically?

You can remove the original button that comes from workflow and insert the new one with the layout update, but it's highly not recommended.
Checkout in OroCommerce uses a workflow engine, that is highly customizable. We recommend customizing the workflow instead.

How can we every cart order data get to our custom URL page?

To customize the checkout process, it is preferred to use the custom workflow based on one of the built-in checkout workflows.
As an example of customization, there is an alternative checkout workflow available out of the box.
Comment: I have tried but we facing issues so, how to change create order link or set custom workflow?


Link two HTML divs' dimensions to each other?

Question: If I have div A and div B, is there a way to say A.width = b.width = MAX(a.width, b.width) ?  That is, whichever has the largest inner content would dictate how large both are.
The actual problem I'm trying to solve is with columns - left, middle, and right.  I want the left and right to be the same fixed width (but this could vary depending on their content).
Comment: any problem in using css3 flexible boxes ?
Answer: It is not possible to use CSS to achieve this. However, if there is a way to do it with a JS-based solution. Here I am using jQuery. Let's say you have two divs, with classes a and b respectively.
$(function() {
    function equalizeSize($ele) {
        if($ele.length > 1) {
            // Let CSS automatically calculate natural width first
            $ele.css({ width: 'auto' });

            // And then we fetch the newly calculated widths
            var maxWidth = Math.max.apply(Math, $ele.map(function(){ return $(this).outerWidth(); }).get());
            $ele.css({ width: maxWidth });
        }
    }

    // Run when DOM is ready
    equalizeSize($('.a, .b'));

    // Run again when viewport has been resized, which **may** affect your div width.
    // This is optional, but good to have
    // ps: You might want to look into throttling the resize function
    $(window).resize(equalizeSize($('.a, .b')));
});

See proof-of-concept fiddle here: http://jsfiddle.net/teddyrised/N4MMg/
The advantages of this simple function:

Allows you to dictate what elements you want to equalize widths with.
Uses the .map() function to construct an array, which we then use Math.max.apply to get the maximum value in the array
Forces automatic calculation of width when the function first fires (especially when resizing the viewport)
Allows you to call to recalculate the size again, using the handler equalizeSize() when you change the content in the divs... you can call the function again, say, after an AJAX call that appends content to either element.
Comment: This is really cool, and answers a lot of questions I have.  The value returned by width() appears to be incorrect (either by units or otherwise).  I'll keep playing with it.

edit: changed to outerWidth() and the code works. Is this expected?
Comment: Yeah, it does make sense, especially when you have declared `box-sizing: border-box` for the `` and they have paddings in their styles.
Answer: It is not very clear what you want from the description. but I can rewrite your code this way.
  var properWidth = Math.max($("#a").width(), $("#b").width());
  $("#a").css("width", properWidth + "px");
  $("#b").css("width", properWidth + "px");

I am not sure if it is this kind of solution you want.
Comment: Hmm that might be the best solution.  Is there a way to do that implicitly?  Like if b changes later?
Comment: @xtravar that would be JavaScript (jQuery) so would have to be called whenever the size of one of your divs changes.
Answer: I'm not sure there is a way to do it like that. But why not make a default function to set the size:
function changeSize(w, h)
{
    A.setAttribute('style', 'width:'+w+'; height:'+h);
    b.setAttribute('style', 'width:'+w+'; height:'+h);
}

Working fiddle: http://jsfiddle.net/kychan/ER2zZ/


EFD-Reinf: Assinatura inválida - Falha ao verificar a assinatura do documento XML (usando C#)

Question: Boa tarde, alguém conseguiu realizar a assinatura do evento do EFD-Reinf usando C#?
Estou enviando o evento assinado e está retornando a seguinte ocorrência:
<code>{
<?xml version=""1.0"" encoding=""utf-8""?>
<dadosRegistroOcorrenciaEvento>
    <ocorrencias>
        <tipo>1</tipo>
        <localizacaoErroAviso/>
        <codigo>MS0017</codigo>
        <descricao>Assinatura do evento inválida. Falha ao verificar a assinatura do documento XML</descricao>
    </ocorrencias>
</dadosRegistroOcorrenciaEvento>
}
</code>
Estou utilizando o seguinte código para assinar o evento:
<code> String id = @event.Attributes.GetNamedItem("id").Value;

 SignedXml signature = new SignedXml(@event);

 Reference reference = new Reference();
 reference.Uri = "#" + id;

 XmlDsigEnvelopedSignatureTransform env = new
 XmlDsigEnvelopedSignatureTransform();
 reference.AddTransform(env);

 XmlDsigC14NTransform c14 = new XmlDsigC14NTransform();
 reference.AddTransform(c14);

 reference.DigestMethod = "http://www.w3.org/2001/04/xmlenc#sha256";

 KeyInfo keyInfo = new KeyInfo();

 keyInfo.AddClause(new KeyInfoX509Data(certificate));

 signature.SigningKey = certificate.GetRSAPrivateKey();
 signature.AddReference(reference);
 signature.KeyInfo = keyInfo;
 signature.SignedInfo.SignatureMethod = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
 signature.ComputeSignature();

 var reinfEvent = @event.GetElementsByTagName("Reinf").Item(0);
 reinfEvent.AppendChild(signature.GetXml());
</code>
Alguém já passou por essa situação?
Answer: Muriel, eu já passei por essa situação e hoje consigo assinar os eventos com sucesso. Estou trabalhando com o eSocial, mas, o código é basicamente o mesmo e eu cheguei a testar o envio de um R-1000 no EFD-Reinf, também com sucesso.
Algumas dicas básicas que devem ser seguidas para realizar a assinatura com sucesso:

Você deve usar somente o XML do evento para gerar a assinatura, e depois o XML do evento assinado é embutido no XML do lote. O XML do lote nunca deve ser assinado, somente os eventos, individualmente, são assinados.
A tag raiz do evento, Reinf, não deve conter os elementos xmlns:xsi e xmlns:xsd, que normalmente são adicionados automaticamente pelo serializador.
Depois de assinado, o XML do evento não deve sofrer nenhuma alteração, porque senão a assinatura se torna inválida. Eu já vi pessoas que alteravam coisas manualmente no XML depois de assinado, e já aconteceu comigo do XML do evento ser gravado em disco usando um encoding e a gravação do XML de lote, com o evento assinado embutido, usar outro enconding, o que também invalidava a assinatura.

Eu fiz uma página há um tempo atrás com algumas dicas sobre como assinar um XML de evento do eSocial:

http://suporte.quarta.com.br/eSocial/AssinaturaXml.htm

Mas, resumindo, o código que estou usando para o eSocial é o seguinte:
<code>  //
  // SignedXml.CheckSignature Method (X509Certificate2, Boolean) -> Examples [SHA1]
  // https://msdn.microsoft.com/en-us/library/ms148731(v=vs.110).aspx
  //
  // Using SHA256 with the SignedXml Class
  // https://blogs.msdn.microsoft.com/winsdk/2015/11/14/using-sha256-with-the-signedxml-class/
  //
  private static void SignXmlDoc(XmlDocument xmlDoc, X509Certificate2 certificate)
  {
     //
     // https://docs.microsoft.com/en-us/dotnet/framework/whats-new/#Crypto462
     //
     // SignedXml support for SHA-2 hashing The .NET Framework 4.6.2 adds support
     // to the SignedXml class for RSA-SHA256, RSA-SHA384, and RSA-SHA512 PKCS#1
     // signature methods, and SHA256, SHA384, and SHA512 reference digest algorithms.
     //
     // Any programs that have registered a custom SignatureDescription handler into CryptoConfig
     // to add support for these algorithms will continue to function as they did in the past, but
     // since there are now platform defaults, the CryptoConfig registration is no longer necessary.
     //
     //// First of all, we need to register a SignatureDescription class that defines the DigestAlgorithm as SHA256.
     //// You have to reference the System.Deployment assembly in your project.
     //CryptoConfig.AddAlgorithm(
     //   typeof(System.Deployment.Internal.CodeSigning.RSAPKCS1SHA256SignatureDescription),
     //   "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
     // RSAPKCS1SHA256SignatureDescription -> Disponível desde .NET Framework 4.5

     SignedXml signedXml = new SignedXml(xmlDoc);

     // Add the key to the SignedXml document.
     signedXml.SigningKey = certificate.GetRSAPrivateKey();   // Disponível desde .NET Framework 4.6
     //signedXml.SigningKey = GetRSAPrivateKey(certificate);

     //
     // https://docs.microsoft.com/en-us/dotnet/framework/whats-new/#Crypto462
     //
     // SignedXml support for SHA-2 hashing The .NET Framework 4.6.2 adds support
     // to the SignedXml class for RSA-SHA256, RSA-SHA384, and RSA-SHA512 PKCS#1
     // signature methods, and SHA256, SHA384, and SHA512 reference digest algorithms.
     signedXml.SignedInfo.SignatureMethod = SignedXml.XmlDsigRSASHA256Url; //"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"

     // Create a reference to be signed. Pass "" to specify that
     // all of the current XML document should be signed.
     Reference reference = new Reference(string.Empty);

     reference.AddTransform(new XmlDsigEnvelopedSignatureTransform());
     reference.AddTransform(new XmlDsigC14NTransform());
     reference.DigestMethod = SignedXml.XmlDsigSHA256Url; //""http://www.w3.org/2001/04/xmlenc#sha256"

     // Add the reference to the SignedXml object.
     signedXml.AddReference(reference);

     signedXml.KeyInfo = new KeyInfo();
     // Load the certificate into a KeyInfoX509Data object
     // and add it to the KeyInfo object.
     signedXml.KeyInfo.AddClause(new KeyInfoX509Data(certificate));

     // Compute the signature.
     signedXml.ComputeSignature();

     // Get the XML representation of the signature and save
     // it to an XmlElement object.
     XmlElement xmlDigitalSignature = signedXml.GetXml();

     // Append the element to the XML document.
     xmlDoc.DocumentElement.AppendChild(xmlDoc.ImportNode(xmlDigitalSignature, true));

     if (xmlDoc.FirstChild is XmlDeclaration)
        xmlDoc.RemoveChild(xmlDoc.FirstChild);
  }
</code>
No EFD-Reinf a única diferença é que o elemento Reference.URI deve conter o ID do evento, com o caractere # na frente (coisa que você já está fazendo), ao passo que no eSocial esse elemento deve estar vazio. Então para o EFD-Reinf a linha que cria o objeto reference, nessa função que te passei, deve ser alterada para:
<code>     Reference reference = new Reference("#" + idEvento);
</code>
Segue um exemplo de lote do Reinf que foi enviado com sucesso:

http://suporte.quarta.com.br/eSocial/arquivos/R1000_EnvioLote.xml


ViewStateException at MySite.aspx on personal site creation

Question: I have a MySite host personalized with a custom master page and a usercontrol with a listview on it.
I'm getting a "This Page has been modified since you opened it" error message when trying to create a personal site for a user. The logs show a ViewStateException.
By removing the usercontrol it works well.
I've also disabled the ViewState (EnableViewState="false") at the page and control level but I didn't have any success.
Any ideas on how to solve this issue?
Comment: Looks like you are using updating SPWeb object in the user control , which causes such exception.

Please share the code to get a correct answer to the problem
Answer: The problem was that the personal site collection had a custom master page defined that had Controls with active viewstate.
The solution was to change that master page to the default, since I didn't need a custom master page on the personal site, only on the root site.


Cannot query "": Must be "User" instance in Django 3.2

Question: I get this error from below view:
from django.shortcuts import render, redirect
from movies import models as movies_models
from django.contrib.auth import get_user_model

User = get_user_model()

def playlists_view(request):
    if (not request.user.is_authenticated) or (not request.user.is_staff):
        return redirect('Login')

    playlists = movies_models.PlayList.objects.filter(created_by=request.user).order_by('-id')

    return render(request, 'cpanel/playlists.html', {'playlists': playlists})

My playlist model is this:
from django.db import models
class PlayList(models.Model):
    type = models.PositiveSmallIntegerField(choices=type_choice, default=1, verbose_name='نوع فیلم')
    category = models.ManyToManyField(Category, related_name='Playlists', verbose_name='دسته بندی و ژانر')
    name_en = models.CharField(max_length=55, unique=True, verbose_name='نام انگلیسی')
    name_fa = models.CharField(max_length=55, unique=True, verbose_name='نام فارسی')
    summary = models.TextField(max_length=1024, verbose_name='خلاصه فیلم')
    imdb_score = models.FloatField(default=0, verbose_name='IMDB امتیاز')
    users_score = models.FloatField(default=0, verbose_name='امتیاز کاربران')
    # seen_number = models.FloatField(default=0, verbose_name='تعداد نفراتی که فیلم را مشاهده کرده اند')
    publish_status = models.CharField(max_length=55, null=True, blank=True)
    is_free = models.BooleanField(default=False, verbose_name='رایگان است')
    visit_times = models.IntegerField(default=0)
    play_times = models.IntegerField(default=0)
    year = models.CharField(max_length=4, verbose_name='سال')
    time = models.CharField(max_length=55, verbose_name='مدت زمان فیلم')
    tv_pg = models.PositiveSmallIntegerField(choices=tv_pg_choice, default=5, verbose_name='درجه بندی سنی')
    actor = models.ManyToManyField(Actor, blank=True, verbose_name='بازیگران')
    director = models.ManyToManyField(Director, blank=True, verbose_name='کارگردان')
    thumb_image = models.ImageField(null=True, blank=True, editable=True, upload_to=image_path,
                                    verbose_name='تصویر انگشتی فیلم')
    image_1920x1080 = models.ImageField(null=True, blank=True, editable=True, upload_to=image_path,
                                        verbose_name='تصویر بنر دسکتاپ فیلم')
    image_600x810 = models.ImageField(null=True, blank=True, editable=True, upload_to=image_path,
                                      verbose_name='تصویر بنر موبایل فیلم')
    country = models.ManyToManyField(Country, verbose_name='کشور')
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(null=True, blank=True)
    created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True)
    users_score_n = models.IntegerField(default=0)
    users_score_p = models.IntegerField(default=0)
    trailer_url = models.CharField(max_length=512, null=True, blank=True, verbose_name='آدرس تریلر')
    page_url = models.CharField(max_length=255, null=True, blank=True, help_text='This field is Read Only')

    def __str__(self):
        return self.name_en + ' | Type: ' + str(self.type) + ' | ID: ' + str(self.id)

    def get_absolute_url(self):
        return reverse("playlist", kwargs={"pk": self.id, "name_en": self.name_en, "name_fa": self.name_fa})

    def save(self, *args, **kwargs):
        old_image_name = self.thumb_image.name
        super().save(*args, **kwargs)

        if self.type == 1:
            self.page_url = 'movie/' + str(self.id) + '/' + name_to_url(self.name_en) + '/' \
                            + name_to_url(self.name_fa) + '/'
        else:
            self.page_url = 'series/' + str(self.id) + '/' + name_to_url(self.name_en) + '/' \
                            + name_to_url(self.name_fa) + '/'
        super().save(*args, **kwargs)
        if old_image_name != self.thumb_image.name:
            image_resize(self.thumb_image.name)

but the important part of this model is this field:
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True)

And I define User like these:
from django.contrib.auth import get_user_model

User = get_user_model()

When I run django app in my localhost it's ok but in production server I get this error :(
I tried instead of using request.user, use User.objects.get(username=request.user) but I got same error in below line:
playlists = movies_models.PlayList.objects.filter(created_by=request.user).order_by('-id')

My User is a simple user model that inheritance from AbstractUser model.
Thanks for your attention. :)
Comment: Hello! Could you show us the full error message? Also since you said that it worked locally in dev but not in prod, that may be a difference in the settings. Do you happen to have different config files in dev and in prod? If so could you show them?
Answer: It seems that you are using a custom User class. Make sure that it is the one used in your models. As documented in Referencing the User model:

If you reference User directly (for example, by referring to it in a foreign key), your code will not work in projects where the AUTH_USER_MODEL setting has been changed to a different user model.

When you define a foreign key or many-to-many relations to the user model, you should specify the custom model using the AUTH_USER_MODEL setting

First, make sure that you correctly substituted the custom user class in the settings.py and performed the necessary migration.
...
AUTH_USER_MODEL = 'myapp.MyUser'
...

Then, try changing this (assuming the User here is not yet the result of get_user_model() because it wasn't indicated in the pasted model in the question):
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True)

To:
from django.conf import settings
...
created_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, blank=True)

Or:
from django.contrib.auth import get_user_model
...
created_by = models.ForeignKey(get_user_model(), on_delete=models.SET_NULL, null=True, blank=True)

Make sure that they are migrated correctly without failures:
python manage.py makemigrations
python manage.py migrate

Comment: So if I made a ForeignKey outside a custom user (AbstractUser Model) I have to make it the auth model in my django settings?


Irreducibility using Fermat's Little Theorem

Question:
Prove that $x^4 + x^2 - 1$ is irreducible

My attempt:
I will try to prove that $x^4 + x^2 - 1$ is irreducible over $\mathbb{Z} / 3\mathbb{Z}$. Is this approach valid:
By Fermat's little theorem, $x^4 \equiv x^2 \pmod{3}$. Therefore, $x^4 + x^2 - 1 \equiv 2x^2- 1 \pmod{3}$. It can be checked that $2x^2 - 1$ has no linear factors over $\mathbb{Z} / 3\mathbb{Z}$ and hence it is irreducible.
Is this correct?
Comment: Note:  despite the comments to the contrary, you can not show irreducibility this way.  Again, $x^3$ is obviously reducible but $x$ isn't.
Comment: It is true that your polynomial is irreducible $\pmod 3$ but you can't prove it that way.  After all, $x^3$ is obviously reducible but, as you remark, it is $\equiv x \pmod 3$.
Comment: Yes I've edited it. It was a typo. Thank you.
Comment: Yes that makes sense. So what is the source of the error.
Comment: The error is that the polynomials $x^4$ and $x^2$ are not the same.  To show irreducibility you need to rule out all possible factorings.
Answer: Your proof is not entirely correct. Or rather, it's not complete. You have shown that the polynomial doesn't have any roots in $\Bbb Z_3$, (and hence no roots in $\Bbb Z$), and therefore no linear factors. But that only implies irreducibility if the degree of the original polynomial is $3$ or less. (you could've reached this result without reducing modulo $3$ by the rational root theorem: neither of $\pm 1$ is a root, and therefore there are no rational roots.)
Beware: Even though Fermat's little theorem says that the function $x\mapsto x^4$ is the same as the function $x\mapsto x^2$ for $x\in \Bbb Z_3$, the polynomials $x^4$ and $x^2$ are distinct.
You still have to show that it doesn't factor into two second-degree polynomials.
Answer: Despite the comments to the contrary, you can not show irreducibility this way.  After all, the cubic $x^3$ is manifestly reducible $\pmod 3$ but $x^3\equiv x\pmod 3$.  Keep in mind that congruences of that form only mean that they take same values in the finite field of three elements.  $x^3$ and $x$ are not the same polynomial.
It is true that $x^4+x^2-1$ is irreducible $\pmod 3$ but I don't see any way to show other than by looking for factors.
Answer: Trying to complement the other answer by explaining why
$f(x)=x^4+x^2-1$ is, indeed, irreducible over the prime field $\Bbb{Z}_3$.
With a few basic facts about finite fields in place one easy way to see this is to observe that $f(x)=g(x^2)$, where $g(x)=x^2+x-1$. The key facts that I need are

$g(x)$ is irreducible over $\Bbb{Z}_3$. This is easy. It has no zeros in $\Bbb{Z}_3$ and for a quadratic that's enough.
$g(x)$ is not a factor of $x^4-1$ in $\Bbb{Z}_3[x]$. This is also easy, for the factorization of $x^4-1$ into irreducibles is $(x^4-1)=(x^2+1)(x+1)(x-1)$.

So by the first bullet the zeros of $g(x)$ are elements of the field of nine elements $\Bbb{F}_9$. Because the non-zero elements of that field form a cyclic group of order eight, by the second bullet, the zeros of $g(x)$ are roots of unity of order eight.
Because $2\mid 8$ this is enough to conclude that any root $\alpha$ of $f(x)=g(x^2)$ (in some extension field) must be of order sixteen: the order is obviously a factor sixteen, but it cannot be a proper factor, because otherwise the order of $\alpha^2$ would be a proper factor of eight.
So $\alpha$ cannot be an element of $\Bbb{F}_9$ (the order of an element cannot exceed the order of the group). All the quadratic polynomials in $\Bbb{Z}_3[x]$ have their zeros in $\Bbb{F}_9$, so $f(x)$
has no such quadratic factors, and is thus irreducible.


Wordpress website uploads texts before images

Question: My website uploads texts some fraction of a second before the images or graphic appears.
I use elementor pro as my website builder and hello theme. Please wish to know how to tackle this issue. Thanks for helping.
Comment: html file loads faster than images. This is it nothing else.
Could also be image lazy load.
Answer: The simple answer is: your browser prioritizes smaller file sizes. Use properly optimized images and make sure to use the webm format for optimal user experience.
That's it. There's nothing more to it than that. Use smaller images. You can look through google's do's and don'ts here.


differential inequality of continuous functions

Question: Let $u:[0,+\infty)\to (0,+\infty)$ be a continuous function such that $\int_0^\infty u(x)dx<\infty$. Suppose there exist $a,b>0$ such that $\frac{du}{dx}\leq u(a+bu)$. Prove that $\lim_{x\to\infty} u(x)=0$. How to solve this problem?
Answer: By contradiction, assume there exists some $\epsilon>0$ such that $u(x_n)>\epsilon$ for some sequence $\{x_n\}$ such that $x_{n+1}-x_n>\tau$ for some $\tau>0$ we will provide later. $u$ is positive, and by the inequality we really only bound the slope from above, but it can drop with unbounded slope. We are interested then, in bounding from below the area beneath the graph of $u$ on the intervals $[x_n-\tau,x_n]$.
Due to the upper bound of the slope and the fact that $u(x_n)>\epsilon$, we have $u(x_n-\tau)>\epsilon - \tau\epsilon(a+b\epsilon)$. This is the crucial observation. This is true because on the interval $u'$ is bounded by $u(a+bu)$, and if it was less than this value, $u$ couldn't increase over the distance $\tau$ to rise to $\epsilon$ without violating the bound. You can prove this formally by using any ODE comparison theorem with the bound and $u(0)\leq\epsilon - \tau\epsilon(a+b\epsilon)$ and proving $u(\tau)<\epsilon$.
We pick $\tau$ such that $\epsilon - \tau\epsilon(a+b\epsilon)=\epsilon/2\implies \tau = 1/2(a+b\epsilon)>0$. Now we have that the graph of our function lies above $\epsilon/2$ for a distance of $\tau$ on an infinite sequence of (almost) disjoint intervals, therefore
\begin{align}
\int_0^\infty u(x)\ dx &\geq \sum_n \int_{x_n-\tau}^{x_n} u(x)\ dx \\
&> \sum_n \int_{x_n-\tau}^{x_n} \epsilon/2 \ dx \\
&= \sum_n \tau\epsilon/2 \ dx \\
&= \infty
\end{align}
which is a contradiction.


why not redirect to another page after form submit

Question: I do this in my form submit
    $form_state['redirect']='checkout/' . $order->order_id;

but it not redirect to checkout page ( I test with another urls but it not work),
I take screen shot after set redirect ,

also I get $from_state by ref in function function pre_register_node_form_submit($form, &$form_state) {  , what do you think? where is the problem?
another note is when I am use drupal_goto form not saved !!!, it redirect to my page with out anything saved.
Do you suggest me declare another submit function and add it to submit array of my content type and in it set redirect?
Update
also I test below
 if ($form_id == "pre_register_node_form") {
       $form['#submit'][] = 'mysite_submit_redirect';
}

function mysite_submit_redirect(&$form, &$form_state) {
  $form_state['redirect'] = 'home';
   // ym($form_state);

}

but not redirected :(
Comment: A later function in the submit handlers list probably sets a new location. Try adjusting their order.
Comment: @AyeshK tnx note, I will  look at it
Comment: @AyeshK I check it ,but there is nothing else
 `#submit (Array, 1 element)

    0 (String, 29 characters ) pre_register_node_form_submit | (Callback) pre_register_node_form_submit();`
Comment: Did you check `$form_state['no_redirect']` value ? If it was explicitly disallowed with a non-empty value, redirection will be skipped regardless of `$form_state['redirect']` value.
Comment: There is not 'no_redirect` in form_state array
Comment: `$form_state['redirect']` will be ignored if `?destination=[dest]` is set in the page querystring.
Comment: @DavidThomas  I try to get `ym(drupal_get_destination());
    ym($_GET['q']);` they return me  the path I have been there  (add content form ) , and there is not redirect path there
Comment: @DavidThomas also I try `$_GET['q']='checkout/' . $order->order_id;`  or `unset($_GET['q']);` but not worked :(
Answer: If that's a node form, the problem is the node submit handler sets the redirect already in node_form_submit
If you want to redirect to checkout after a node form submit, you can do it by adding a submit handler to the $form['actions']:
/**
 * Implements hook_form_alter
 */
function MODULE_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'NODE_TYPE_node_form') {
    $form['actions']['submit']['#submit'][] = 'MODULE_NODE_TYPE_submit';
  }
}

/**
 * NODE_TYPE submit handler
 */
function MODULE_NODE_TYPE_submit($form, &$form_state) {
  // You don't need order_id as /checkout will route to the correct location for user
  $form_state['redirect'] = 'checkout';
}

Note: You could also do it with Rules.
Comment: @Nikhil M `array_push` is the same as `$array[]` in this case. Both append the item to the array. See the note on: http://www.php.net/manual/en/function.array-push.php A benefit of `array_push` is that it's easier to append multiple items if necessary.
Comment: May be you could use `array_push` to make sure your redirect is the final redirect.
Comment: Yes i agree....
Comment: Yes, this is good solution, tnx
Comment: For what its worth, I found that pushing to submit array in HOOK_form_FORMID_alter also worked, for example mymodule_form_mycontenttype_node_form_alter().


Freshly formatted ext4 drive appears to have several gigabytes already used

Question: I have setup several drives in an Ubuntu 12.04 x64 machine by deleting all the partitions and formatting them as ext4 with fdisk, but when I ran df -h, it showed me that a substantial amount of the drive space had already been used up. For example, on my 1TB drive, it showed me that 14GB was already in use. I mounted the drive to a folder and went to examine it with ls -a and there are no files except for a directory lost+found that contains no files which really confuses me. Where are these 14GB "hiding"? I have tried re-partitioning it twice and un-mounting and then mounting again but no luck. Must I run dd to wipe the drive with /dev/null to regain those 14GB? If it is 100MB or so I would not complain, but 14GB is a lot of space.
Comment: It's just temporarily reserved for inodes. If you turn out not to need it, it will be reclaimed. It's inefficient to reserve space in small bits and pieces.
Answer: You could have reserved space for super-users.
This can be disabled via tune2fs -m 0 /dev/whatever - but the default for that would be 5%, and that doesn't really fit.
The partition does not only need to hold your data but also metadata (inodes!).
14GB used on a 1TB disk seems reasonable if you formated it with the default options.
If you are sure inodes are not a problem, you can try to reformat with the option mkfs.ext4 -T largefile (or largefile4) and see if it helps.
Comment: If you're not going to use the drive to store predominantly large files, using `-T largefile` will make inode allocation much less efficient as the drive gets full. You're *much* better off reserving more and then letting the system release it if doesn't need it than reserving too little and forcing the system to scrounge for fragments when the drive is full.
Comment: The `mke2fs -t ext4 -T largefile` worked and shrunk it down to 300mb. Does this mean metadata will no longer be stored on that drive such as date/time?
Comment: @user99545 no, this means that the preallocated reserve of these is shorter.


View with arguments

Question: Can I build a view with parameters for the app? for example:
articles by author and articles that WILL show only the registered user ..
Is there an example of module done or I have to build only sight and go.
Thank you very much
Answer: Thank you for pointing out the lack of documentation on Page Arguments for DrupalGap. I went ahead and added a clear example of page arguments here: http://docs.drupalgap.org/7/Pages/Page_Arguments
A combination of page_arguments and a Views Render Array will get the job done.

View with arguments


Apache home server connects to domain inside network and not out

Question: Hello i have an old windows xp pc im trying to turn into a server for hobbyist purposes. I downloaded and installed the apache xampp 1.8 distribution. Once installed and tested that the localhost worked, I connected my domain to my servers ip. So my problem is when i tried to connect to my site on my pc on the same network, they all were able to load the domain/site inside the network successfully but when i have a pc thats outside the network try it fails. Any ideas?. thanks.
Comment: Did you use a pubic IP? Did you set the firewall on the router to let incoming connections to port 80? Did you set the apache to respond to virtual host?
Comment: i think i used the ip that uniquely identifies the computer on the network. i have my firewall off but i also set the exceptions for port 80 for tcp and udp. Also i dont think i set apache to respond to the virtual host since i havent touched the vhost.config file.
Comment: On which network, local or public? If it is 192.168.x.y or 10.x.y.z it will not work.
Comment: i think its public i used a 192...etc, does that mean i cant use my private home network to host it?
Answer: You have used a private IP instead of public IP so it does not get resolved to your server. You have to use a public IP (if you have a static IP from your provider you have to setup port forwarding on your router.) If you get the IP from DHCPD server you will need to use dynamic DNS and port forwarding.
More info on private networks: http://en.wikipedia.org/wiki/Private_network
Comment: Thanks i easily found my public ip and reset the proper information. It now runs outside my network!! Many Thanks.


How do I calculate the integral $\int_{-L}^L{e^{i\frac{(m-n)\pi}{L}x}dx}$?

Question: Let $0 < L \in \mathbb{R}$ and $m,n \in \mathbb{N}$.
How can I calculate this integral?
Here it is once more, a bit larger: $$\int_{-L}^L{e^{i\frac{(m-n)\pi}{L}x}dx}$$
Comment: You have two cases: one where $m - n = 0$ and one where $m - n \ne 0$.
Comment: Is the answer $\frac{2L}{i(m-n)\pi}\sinh(i(m-n)\pi)$? where $(m-n) \neq 0$
Comment: What is the primitive of $e^{A x}$ if $A\neq 0$? What if $A=0$? You should be able to find the answer by yourself.
Answer: If $m=n$ your integral is
$$
\int_{-L}^{L}\mathbb{d}x=2L
$$
If $m\neq n$ your integral is
$$
\int_{-L}^{L}e^{\mathbb{i}\pi x(m-n)/L}\mathbb{d}x=\frac{L}{\mathbb{i}\pi(m-n)}(e^{\mathbb{i}\pi(m-n)}-e^{\mathbb{i}\pi(-m+n)})
$$
Recalling the Euler formula $e^{\mathbb{i}\theta}=\cos(\theta)+\mathbb{i}\sin(\theta)$
$$
(e^{\mathbb{i}\pi(m-n)}-e^{\mathbb{i}\pi(-m+n)})=\cos(\pi(m-n))+\mathbb{i}\sin(\pi(m-n))-\left[\cos(\pi(n-m))+\mathbb{i}\sin(\pi(n-m))\right]
$$
The $\sin$ terms are zero above because $n,m\in\mathbb{N}$ and $\cos$ is even so that $\cos(\pi(m-n))-\cos(\pi(n-m))=0$. Therefore the integral is zero when $n\neq m$. We can summarize the result nicely by using the delta-kronecker symbol.
$$
\int_{-L}^{L}e^{\mathbb{i}\pi x(m-n)/L}\mathbb{d}x=2L\delta_{m,n}
$$
$\delta_{m,n}=1$ when $m=n$ and is equal to zero otherwise.


Find the maximum value

Question: Find the maximum value $$F(y)=\int_{0}^{y}\sqrt{x^4+(y-y^2)^2}dx$$ with $y\in [0;\: 1]$
This problem here
Comment: I think you can use [Leibniz's integration rule:](https://en.wikipedia.org/wiki/Leibniz_integral_rule#General_form_with_variable_limits)
if
$$g(y)=\int^{b(y)}_{a(y)} f(x,y) dx$$
then

$$g'(y)=\int_{a(y)}^{b(y)}\frac{df}{dy}(x,y)+f(b,y)b'(y)-f(a,y)a'(y)$$ to investigate the integral
Comment: The link provided does not give this problem.
Comment: or it is too buried
Comment: The derivate is
$$\left(1-2\,y\right)\,\left(y-y^2\right)\,\int_{0}^{y}{{{1}\over{
 \sqrt{\left(y-y^2\right)^2+x^4}}}\;dx}+\sqrt{\left(y-y^2\right)^2+y^
 4}$$. I is $>0$ if $y \in (0,\frac{1}{2})$ becaus every factor is $>0$. So The integral is increasing in this interval.
One can underestimate the integral and show that it is positive in the remaining interval. But there are  much simpler solutions.
Comment: Maximum ( 'numeric' ) ${\rm F}\left(1\right) = {1 \over 3}$
Answer: The maximum value is $1/3$. First, the integral is equal to $1/3$ when $y=1$, so the maximum is at least that large. To see that the integral is never bigger than $1/3$, note that $$\sqrt{x^4+(y-y^2)^2}\leq x^2 + y-y^2\quad \text{for $y\in [0,1]$},$$
and therefore that
\begin{align*}
\int_0^y \sqrt{x^4+(y-y^2)^2}\,dx &\leq \int_0^y(x^2+y-y^2)\,dx = y^2-{2\over3}y^3.\tag{1}
\end{align*}
But $g(y) = y^2-{2\over3}y^3$ is increasing on $[0,1]$ since $g'(y) = 2(y-y^2)\geq0$ there. So $g(y)\leq g(1) = 1/3$ for all $y\in[0,1]$, and the proof is finished by $(1)$.
Answer: I'm sorry but I think that what DanielV said is false, mainly because we don't have $\int^y f(x)\text{d}x$ but $\int^y f(x,y)\text{d}x$
For example, if we take the function $f(x,y) = 1$ if $0 \leqslant y \leqslant \frac 12$ and $f(x,y) = 0$ if $\frac 12 < y \leqslant 1$. Then clearly $f(x,y) \geqslant 0$ but $$F\left(\frac 12\right) =\frac 12 > 0 = F(1)$$
(if we define $$F(y) = \int_0^y f(x,y)\text{d}x$$)
I haven't really thought about the exerice though... The main issue is that we have an occurrence of $y$ in the function to integrate and in the interval on which we integrate. Maybe try to get rid of one ?
Answer: This is not an answer for an homework problem but rather a curiosity you could be interested by.
The antiderivative has an analytical expression which involves a rather complex elliptic integral of the first kind. However, the integral simplifies and, for 0 < y <1, write
y^2 (1 - y) Hypergeometric2F1[-1/2, 1/4, 5/4, -y^2/(1 - y)^2]
Over the range 0 < y < 1, this function is continuously increasing (there are two inflexion points very close to y=0.4 and y=0.7). For y=1, the limit value of the function is 1/3.

Find the maximum value


Validate number sequence as quadkey (not just regex)

Question: I know quadkeys have the basic regex of [0-3]{6,23}.
But is it possible for a number to match that regex and not be a quadkey?
I.e. random number 2010210202020021
Given a random number, I would like to know if it is a quadkey or not and I'd like to know if there's a way to check beyond just a simple regex.
Seems like the best way may be to convert it to a long/lat and see if that's a valid location? Is it possible to convert it like that?
Answer: In terms of quadkeys, that regex would always match valid quadkeys, however, if these quadkeys are valid in your map platform would depend on the platform.

Bing Maps typically supports zoom levels 1 through 19 (additional zoom levels in select areas, usually via birdseye imagery which doesn't use quadkeys). Note that Bing Maps uses raster tiles that cover 256-pixel squares.
In Azure Maps, many of the map tile services support zoom levels 0 to 22, and the map control itself can go down to zoom level 24 if you have custom map tiles. Note that Azure Maps uses both 256-pixel raster tiles, and vector tiles that cover 512-pixel squares.

For your regex, if you want to support all zoom levels you would need to adjust the numbers in the squiggly brackets.


Which acoustic guitar string gauge to buy as a beginner ({.009-.045},{.010-.050},{.011-.052})

Question: As I started to learn to play acoustic guitar, I broke 1st string e 2 times straight in a week.
Can anybody tell me which string is best for a beginner (by best expectation from the string is to be durable, produce nice sound and pocket-friendly)?
Comment: guitar tuna is fine as long as you are tuning the correct string to the correct pitch. if you have it in standard tuning, and "auto" it should be fine. just wanted to make sure you were not tuning it ridiculously tight. 11's should not be a problem for an acoustic guitar. is there anything where the string touches the guitar that may be sharp or rough? either in the nut slot, the bridge, etc?
Comment: Visit a brick-n-mortar musical instruments store, and pick a bunch of string 1 and string 2 (the thinnest two). As a beginner, and on a guitar that doesn't hold tune well, you are going to break many of those as you are yet to develop a feel of the tension where is become apparent that strings may snap. At this stage brands are not likely to matter as much. For a beginner I'd stick to 9s and 10s (after few years of late life learning, I'm still using 10s). Unbranded strings bought from store are often inexpensive, compared to branded full-sets.
Comment: curious what gauge you had on there. if you broke it twice you must have replaced it at least once. are you sure you used the correct string for the one that you were replacing? are you sure you strung it correctly? did you use a tuner to tune it?
Comment: @b3ko Both the time i broke the string it was changed by vendor and i was told that it was ({.011-.052}), this time i am thinking to change by myself.
I am using guitarTuna to tune the guitar (please let me know if its good )
Answer: I would recommend to use 11's if you want the gauge to feel lighter. 11's are great because they are not too heavy but light enough for a begginer. I like to use 11's whenever I play, because that way I can also do lead stuff on the acoustic. Whether or not you will be doing that (which I assume not yet) 11's will obviously feel lighter then 12's and 10's on an acoustic may be too light.
Comment: I've used .008s and .009s for many years on acoustics, and found no problems for lead stuff.  Also, we don't know what guitar it is, or what strings were originally on the guitar (or should have been).
Answer: just an ask are you perhaps tuning to high ?
I managed to do that as a beginner without an electronic tuner and broke several Ist strings before i realised
I had gradually tuned the strings up over time using the manual way of tuning using the 6 string E as a referance .
check for any rough ends on the frets where your string is breaking ,could be a burr on a fret edge ,easily removed with needle file or similar
If your a new player ive also broken e strings by clumsy heavy strumming,so you may need to rail back on your strumming action,especially if u have light strings..pick should sweep in a curve away from you ,not straight away at 90 degrees across the strings,your pick hand should end up close to the top edge of the saddle after a downstroke,also the pick should meet the string at a slightly edge on angle,this will give less resistance and produce a sweeter tone
Answer: It's very unusual to break the fat E string once, let alone twice. I suspect it was the high E, the 1st string. Acoustic guitars are often supplied with .011s or .012s, and without a means of measuring the string, it's not easy for you to determine. I use a caliper gauge, which gives an exact answer.
But maybe a more apposite point is why they keep breaking. That, I can't answer. Possibly you are playing too hard, or there is a problem with the guitar itself. Get in touch with the manufacturers. and pose the question - .011 or .012 will be the answer - and the difference is slight.
Myself, I'd go for something even lighter, but that's my choice. Lighter strings are less prone to breakage, despite what some say. Price won't vary much, but lighter strings will be easier to press, less likely to break, but not sound as rich as heavier gauge.
EDIT: I'm more concerned as to why the strings are breaking. Whether you have .007s or .014s, they shouldn't be breaking. It may be that you are still hazy as to how to tune properly. Try to find someone else who plays - a teacher is best - and go through the process with them.
Answer: I agree with all other responses in relation to the likelihood of breaking that e string. Gauge wise I would suggest starting with 12s. They might hurt or feel too thick to begin with but it will pay off in the long run.
Comment: Welcome to the site! It's good here if you can elucidate on statements made in answers. 'It will pay off in the long run'. Why? How?


Pedaling in Chopin Nocturne in C# minor, measures 9-18

Question: What is the pedaling going to be for the rest of the below sheet? Is it going to be like measure 8, or it is going to be like measures 1-7? Sometimes it shows the pedal sign like in measure 16, which confuses me about what the previous measure is going to be.
Comment: You can continue with the pedal in the same style:  4 quavers = 1 Ped. (except when there's no chord change in a bar: 8 quavers = 1 Ped.) But take care in bars 16th triplets and 32nds. Maybe you better make pedal steps each quarter note.
Answer: The logic of pedaling is keeping the delay according to the harmony. In this example the chords last 2 beats, then you hold 2 beats, if the harmony lasts 4 beats you can hold the pedal 4 beats as assigned, but also 2 beats would be correct.
Answer:
measures 9-10, 12-14, 18: pedal as in measure 5.1
measures 11, 16, 17: pedal as in measure 16.2
measure 15: pedal with each beat or even with each left-hand eight-note.3

1 Each four-note grouping in the left hand represents a single harmony. In these measures, the melody also moves in two-beat segments. Thus by changing the pedal twice in each measure, both the harmony and melody remain "clean". In measure 12 the pedal change is particularly important so that the melody note on beats 1 and 2 doesn't bleed over into the rest on beat 3.
2 In these measures, the melody and harmony remain static until the final beat (or half-beat). It's better here to keep the pedal through the measure to help sustain the long melody notes. The reason the pedal in measure 16 is marked even though the surrounding measures are not is because the surrounding measures are left to the experience and interpretation of the performer, but measure 16, the editor believes, should be pedaled in the specific way indicated.
3 Because the melody is ornamental and scalar, you need frequent pedal changes to prevent blurring of the sound. I prefer half-pedal, changing at each eight-note in the left hand, but pedaling once per beat may also be sufficient.

NOTE: There is, IMO, an error in the pedal marking measure. The pedal release mark should be at the end of the second beat, not the end of the measure. The earlier release allows for the indicated rest in the right hand.


Is it permissible to run post-hoc tests after a non-significant ANOVA?

Question: We ran a 3-way ANOVA getting a non-significant result, but in doing so we saw that one condition looked like it had a strong effect.  We tried a Bonferroni-corrected t-test of just that group, and it turned out significant.  Is it valid to consider this?  Is there some other correction needed to deal with the fact that we tested that group only after we saw that it "looked" like an effect?
(And does the answer to this sort of question depend on between vs. within factors?  We have a mix.  I ask this because SPSS doesn't seem to give the option for post hoc tests under the GLM procedure except for between-factor effects.  Not the best way to learn, but it's a clue, nonetheless.)
Answer: It depends on what you plan to do with the result.
If you want to form a conclusion regarding a null hypothesis and have a specifiable rate of false positives (i.e. you want a Neyman-Pearson hypothesis test) then no, you can't do it. Spuriously 'significant' results turn up all the time and any result that looks significant will quite likely turn out to be statistically significant even when it is not real. Neyman-Pearson analysis allows you to test PREDEFINED hypotheses with PREDETERMINED analyses.
If you want to use your data to help form hypotheses to test with new experiments (i.e. use a Fisherian approach) then yes, go ahead and test! The fact that you cannot reliably test an hypothesis that is formed on the basis of seeing a dataset using that same dataset does not mean that the dataset cannot point to something worthy of a follow-up experiment.


WaitForElementClickable/ Visible - Selenium C#

Question: I need to implement & modify my current method to do both matters:

Waiting for element of being visible - (which is currently implemented but it still uses ExpectedCondition which is obsolete and might be changed)
Waiting for element of being clickable - (When my test are running, it's face a problems with "loading circles", I'm pressing the button and before window is loaded there is loader which takes for 1 to 4 seconds and then it disappears. My goal is to force Selenium to wait "XXX" time and when loading will finish then continue with process.

Current code:
public static IWebElement WaitForElementVisible(this IWebDriver driver, By by, int timeoutInSeconds = 6)
    {
        IWebElement element;
        driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(0);
        try
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds));
            element = wait.Until(ExpectedConditions.ElementIsVisible(by));
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(Configuration.ElementTimeout);
            return element;

        }
        catch (WebDriverTimeoutException e)
        {
            Console.WriteLine(e.ToString());
        }
        driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(Configuration.ElementTimeout);
        return null;
    }

Based on different topics I've started writing something but unfortunately it's just copy...
I would prefer to do one valuable method which goal would be to check both things. Could you please give me any advice's/ hints what could be added to that specific method?
//Edit
I'm adding how that loader code looks like:

               <svg viewBox="0 0 280 280" style="width: 280px; height: 280px; position: relative;">
                  <circle cx="140" cy="140" r="137.5" fill="none" stroke-width="5" stroke-miterlimit="20" style="stroke: rgb(0, 188, 212); stroke-linecap: round; transition: all 750ms ease-in-out 0ms; stroke-dasharray: 604.757, 863.938; stroke-dashoffset: -259.181;"></circle>
               </svg>

I've also transferred @sers Java advice into C#:
public static IWebElement WaitForElementClickable(this IWebDriver driver, By by, int timeoutInSeconds)
    {
        new WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds)).Until(d =>
        {
            Boolean ajaxComplete;
            Boolean jsReady;
            Boolean loaderHidden = false;

            IJavaScriptExecutor js = (IJavaScriptExecutor)d;
            jsReady = (Boolean)js.ExecuteScript("return (document.readyState == \"complete\" || document.readyState == \"interactive\")"); ;

            try
            {
                ajaxComplete = (Boolean)js.ExecuteScript("var result = true; try { result = (typeof jQuery != 'undefined') ? jQuery.active == 0 : true } catch (e) {}; return result;");
            }
            catch (Exception)
            {
                ajaxComplete = true;
            }
            try
            {
                loaderHidden = !d.FindElement(by).Displayed;
            }
            catch (Exception) { }

            return ajaxComplete && jsReady && loaderHidden;
        });
    }

Answer: The ExpectedConditions in .NET binding is obsolete, however it was moved to DotNetSeleniumExtras

'ExpectedConditions' is obsolete: 'The ExpectedConditions
  implementation in the .NET bindings is deprecated and will be removed
  in a future release. This portion of the code has been migrated to the
  DotNetSeleniumExtras repository on GitHub
  (https://github.com/DotNetSeleniumTools/DotNetSeleniumExtras)'

Use ExpectedConditions from there, it will dismiss the warning
using WaitHelpers = SeleniumExtras.WaitHelpers;

wait.Until(WaitHelpers.ExpectedConditions.ElementIsVisible(by));

You can also use ExpectedConditions to wait for the element to be clickable
IWebElement webElement = wait.Until(WaitHelpers.ExpectedConditions.ElementToBeClickable(by));
webElement.Click();

Another option is to wait for the loader to appear and then disappear and then continue
wait.Until(WaitHelpers.ExpectedConditions.ElementIsVisible(by));
wait.Until(WaitHelpers.ExpectedConditions.InvisibilityOfElementLocated(by));

Comment: Where I'm supposed to add: using WaitHelpers = SeleniumExtras.WaitHelpers? IDE is not compiling + I cannot add anything in order to detect it
Comment: @Ixi11 Its 'using', put it in the top with the rest of the 'using'.
Comment: I removed DotNetSeleniumExtras after updating to Selenium 4: https://stackoverflow.com/a/69128074/8963597 Then how?
Answer: As I understood your element is visible and clickable when loading element on the screen but overlaying you element, also maybe you need to wait javascript to complete to click successfully.
You need get "loading circles" locator. For that open chrome devtools trigger "loading circles" to appear and press F8(pause) then you can find html of loading element.
Wait until loading element is disappeared:
var wait = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(8));
wait.until(ExpectedConditions.invisibilityOfElementLocated(loadingElementLocator);

Also you can check if javascript is complete :
IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
bool jsLoaded = (bool)js.ExecuteScript("return (document.readyState == \"complete\" || document.readyState == \"interactive\")");

Here Java example:
new WebDriverWait(driver, timeoutSec).until(d ->
{
    boolean ajaxComplete;
    boolean jsReady;
    boolean loaderHidden = false;

    JavascriptExecutor js = (JavascriptExecutor) d;
    jsReady = (boolean) js.executeScript("return (document.readyState == \"complete\" || document.readyState == \"interactive\")");;

    try {
        ajaxComplete = (boolean) js.executeScript("var result = true; try { result = (typeof jQuery != 'undefined') ? jQuery.active == 0 : true } catch (e) {}; return result;");
    } catch (Exception ignored) {
        ajaxComplete = true;
    }

    try {
        loaderHidden = !d.findElement(loadElementLocator).isDisplayed();
    } catch (Exception ignored) {}

    return ajaxComplete && jsReady && loaderHidden;
});

Here your updated code:
public static void WaitForLoading(IWebDriver driver, int timeoutInSeconds)
    {
        new WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds)).Until(d =>
        {
            Boolean ajaxComplete;
            Boolean jsReady;
            Boolean loaderHidden = false;

            IJavaScriptExecutor js = (IJavaScriptExecutor)d;
            jsReady = (Boolean)js.ExecuteScript("return (document.readyState == \"complete\" || document.readyState == \"interactive\")"); ;

            try
            {
                ajaxComplete = (Boolean)js.ExecuteScript("var result = true; try { result = (typeof jQuery != 'undefined') ? jQuery.active == 0 : true } catch (e) {}; return result;");
            }
            catch (Exception)
            {
                ajaxComplete = true;
            }
            try
            {
                loaderHidden = !d.FindElement(By.ClassName("Loader__background")).Displayed;
            }
            catch (Exception) { }

            return ajaxComplete && jsReady && loaderHidden;
        });
    }

How to use:
WaitForLoading(driver, 10);
myButton.Click();

Comment: I've updated my post with both a) "circle load" DOM b) code witch was transferred from JAVA to C#. I think you may have right with that js locator however still I don't really understand what I'm doing. Where I'm supposed to set that circle loader inside the code?
Comment: Also compiler is arguing that my method does not return anything
Comment: I added locator of loader: `By.ClassName("Loader__background")`, try it
Comment: Make method void and call before you click, use it as wait loading to complete. Also if loading appears every where you can implement `WebDriverEventListener` listener and call this method inside `beforeFindBy`.


Upgrade PHP from 5.3 to 5.6, unmet dependencies

Question: I have a OVH VPS which runs php 5.3. I would like to update to php 5.6.
I've used this solution (How do I upgrade from PHP 5.3 to PHP 5.4.6 in Ubuntu?) :
sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get install php5

but I have this error :
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libapache2-mod-php5 : Depends: apache2-api-20120211
                       Depends: apache2 (>= 2.4)
                       Depends: php5-common (= 5.6.18+dfsg-1+deb.sury.org~precise+1) but 5.3.10-1ubuntu3.15 is to be installed
 libapache2-mod-wsgi-py3 : Depends: apache2-api-20120211
 php5 : Depends: php5-common (>= 5.6.18+dfsg-1+deb.sury.org~precise+1~) but 5.3.10-1ubuntu3.15 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Could you help me in the following steps ? Thank you very much.
EDIT
When I run sudo apt-get -f install I get the following error :
Get:24 http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/ precise/main pkg-php-tools all 1.21+deb.sury.org~precise+1 [38.7 kB]
Fetched 7,138 kB in 0s (13.8 MB/s)
(Reading database ... 77021 files and directories currently installed.)
Unpacking apache2-bin (from .../apache2-bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/apache2-bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb (--unpack):
 trying to overwrite '/usr/share/man/man8/apache2.8.gz', which is also in package apache2.2-common 2.2.22-1ubuntu1.7
dpkg-deb (subprocess): subprocess data was killed by signal (Broken pipe)
dpkg-deb: error: subprocess <decompress> returned error exit status 2
Processing triggers for man-db ...
Errors were encountered while processing:
 /var/cache/apt/archives/apache2-bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Answer: I think uninstalling the existing PHP first should fix the issue.
$ sudo apt-get remove php5*

Comment: Thank you for your answer, but when I run this command, at the end, I get `The following packages have unmet dependencies:
 libapache2-mod-wsgi-py3 : Depends: apache2-api-20120211
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)`. Any ideas what I should do ? Thank you !
Comment: @Reveclair libapache2-mod-wsgi-py3 is not related to PHP in any way so I'd assume removing it would fix the issue but I don't know offhand how to resolve the dependency without removing it.


Change count down to count up

Question: This script counts down from 60 to 0 and stops when it reaches 0.

Instead of counting down, I want the script to count up. I changed the - to a + in counttx=counttx-1; but then the following happend:

60
601
6011
60111
etc.
Answer: Looks like counttx is a string, and javascript is appending '1'.  Try:
counttx = +counttx + 1;

Edit: or just remove the quotes in the var statement:
var counttx = 60;

Answer: If one operand of - operator is string and another is number JS converts the string to number. Thats why count down is working even if counttx is string. But when one operand of + is string and another is number JS converts the number to string and does a string concatenation. Thus you are getting 601, 6011 etc. instead of count up. To fix this you can declare counttx as integer.
var counttx = 60;

Answer: Remove the quotes from var countxx="60";
Write it as
var countxx=60;

and then change it to
counttx=counttx+1;

When you mention the value within quotes, it considers it as string and just appends 1 to the value, that is the reason your getting 601, 6011 etc.
Answer: Do you want to count from 0 to 60? If so swap the 60 and the 0 in your script and change this line counttx = counttx + 1; to counttx = counttx - 1. Also get rid of the double quotes around 60.
Answer: You need to parse var to integer first then increment it. Use counttx = parseInt(counttx) + 1;

Change count down to count up


why couldn't 'self' recognize?

Question: I am developing iOS Application.
I would like to use recursiveDescription at one Page which has UITableView on lldb.
I move above page,then i stop Application by pause button. And I got the following error.
(lldb) po [self.workview recursiveDescription]
error: use of undeclared identifier 'self'
error: 1 errors parsing expression
(lldb) po [self.view recursiveDescription]
error: use of undeclared identifier 'self'
error: 1 errors parsing expression

self.workview is instance of UITableView.
why couldn't 'self' recognize?
Comment: Who knows what the context is when you hit pause. Set a breakpoint on the line where you want to enter the debugger
Comment: I see.I will try it.
Answer:
then i stop Application by pause button...why couldn't 'self' recognize?

If you stopped the app by clicking the pause button in Xcode, you have no way to control what code is executing when the app stops. Execution could stop pretty much anywhere, and if self is defined at all wherever you stop, there's a very solid chance that it won't be defined to be the object you want it to be.
Instead of using the pause button, set a breakpoint in the source code for the class you want to debug.
Comment: Thank you for answering.I was able to do what i expected.
Answer: In addition to Caleb's answer, you can get any object's memory address while on a breakpoint and send message to that object after pausing app with following:
po self

Its output will be something like this:
<MYViewController: 0x7ffa63871800>

And then pause app with pause button and type this on console:
po [((MYViewController*)0x7ffa63871800).workview recursiveDescription]

Comment: I see.It is intersting to debug by lldb.Tnank you.

why couldn't 'self' recognize?


Best way to register a new Drupal user via a 3rd party application

Question: We have a Java application on our server, when users provide their email and username to it I want it to send the username and email to our Drupal site to register them for an account. And I'd like them to still receive Drupal's welcome email containing their password.
What's the best way to achieve this, I was thinking possibly the services module? But wasn't sure if there'd be a better solution because the Java code and Drupal site are on the same server and therefore we could have some pretty direct integration.
Comment: Post JSON Data to drupal site like drupal_site.com/newuser and in the page callback function do a user_save
Answer: I may be biased b/c I am the Services module maintainer, but, You don't want to be directly inserting things into the database.
You could REALLY break Drupal by doing this.
If you didn't want to use services module(which why wouldn't you?) you should really use Drupal's apis to put things in the database, like, node_save, or drupal_form_submit(which is what services does).
This ensures that Drupal actually enters the data and will lead to a cleaner overall integration with less problems.
In Drupal 6.x this json actually creates a user when POSTed to SERVER/ENDPOINT/user.
<code>{"uid":"1","name":"admin","pass":"1a1dc91c907325c69271ddf0c944bc72","mail":"email@example.com","mode":"0","sort":"0","threshold":"0","theme":"","signature":"","signature_format":"0","created":"1286571725","access":"1294792121","login":"1293782855","status":"1","timezone":null,"language":"","picture":"","init":"email@example.com","data":"a:0:{}","roles":{"2":"authenticated user"}}
</code>
Comment: Hey Kyle, thanks for chiming in, I don't have much experience with services yet so wasn't sure about the integration but it looks like that's the best way to go so I'll go figure it out :) thanks.


SageMaker DataWrangler's one-hot-encoding into vector convert into suitable form using pandas

Question: Using SageMaker DataWrangler's one-hot-encoding I have a column whose datapoints are of form
<code>"(26,[2],[1.0])"
"(26,[0],[1.0])"
</code>
how can I convert into suitable form using pandas to train a model
Answer: The one-hot encoder let's you output the encoding as columns instead of a vector. When you go to one-hot encode, there should be an option called "Output style". If you select column (and not vector), you will get the data representation you are looking for.


The real numbers and the axiom of foundation

Question: I am having a bit of confusion about the real numbers and ZF set theory (I asked a question about it a few days ago). I am a bit unsure as to why the real numbers can be in any model of ZF as they seem to contradict the axiom of foundation (regularity) i.e. that for every set $X$ and $Y\subseteq X$ $\exists a\in Y:\forall b\in Y ((b\neq a)\ b<a)$
Thanks very much for any help
Comment: To my knowledge the Axiom of Foundation states that for every nonempty set $X$, there is an element $A\in X$ such that $A\cap X=\emptyset$. What does $((b\ne a)b<a)$ mean after all?
Comment: I was say that wrt the ordering each set has minimal element but I got my ordering very confused, as you can see from the answer. I think what you have stated is equivalent though
Comment: The language of ZF has only one relational symbol: $\in$. There is no $<$, certainly not in axioms.
Answer: The axiom of regularity states that $\in$ is well-founded. Namely if $A$ is a non-empty set, then $(A,\in_A)$ (the membership relation restricted to $A$) has a minimal element.
Unlike the natural numbers [read: finite ordinals], which are inherent objects to the universe of ZF, the ordering of the real numbers is not defined by $\in$. It can, however, be defined by $\subseteq$ which itself is definable.
However there is no requirement that $\subseteq$ is well-founded, and indeed it is not.
Comment: Thanks very much, just got a bit confused then
Comment: @hmmmm: No problems. It's not a bad question, so don't feel bad.
Answer: The axiom of foundation says that for each nonempty set $Y$ it holds that $\exists a\in Y:\forall b\in Y  \neg(b\in a)$. This means that every set is well-founded with respect to the $\epsilon$-relation.
If the real numbers were well-founded with respect to the the $<$-relation, we would have for each nonempty set $Y$ of real numbers that $\exists a\in Y:\forall b\in Y  \neg(b< a)$. This is indeed false as the example $Y=(0,1)$ shows.
Since the relations $\epsilon$ and $<$ do not have to agree on $\mathbb{R}$, this is in no way contradictory. Some relations are well-founded, others are not.