Add Caldroid library in Android Studio

Question: I have a problem when adding Caldroid library on Android Studio. I try many different ways to add but it won't work. I use Android Studio 0.8.2.

First off, I created a root folder called libraries.
I created a new folder caldroid in /libraries.
Then, I pasted the downloaded files in /libraries folder.
Then, I changed the following files.

settings.gradle
include ':app'
include 'libraries:caldroid:library'

build.gradle
dependencies {
    compile 'com.android.support:appcompat-v7:20.+'
    compile 'com.google.android.gms:play-services:4.0.30'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libraries:caldroid:library')
}

But I get this error:
Error:Configuration with name 'default' not found.

How to fix this?
Answer: I'm late but I faced a similar issue so I thought I'll share how I solved it.
To import an external library to Android Studio, I follow this convention:

Create libs folder inside the app directory. Then copy the required library files to the libs folder. For example, my folder contains actionbarsherlock and caldroid folders.
Caldroid has a library dependency that can be downloaded here, you can see this in the build.gradle file (Also, make sure the gradle files have the correct SDK versions). Download the hirondelle-date4j-1.5.1-sources.jar.
Create libs folder in app/libs/caldroid/. Copy the hirondelle-date4j-1.5.1-sources.jar to app/libs/caldroid/libs/. You may also have to copy android-support-v4.jar from -User_Home-/Android/Sdk/extras/android/support/v4/ to app/libs/caldroid/libs/.
Open app/libs/caldroid/build.gradle and replace compile 'com.darwinsys:hirondelle-date4j:1.5.1' with compile files('libs/hirondelle-date4j-1.5.1-sources.jar').
In Android Studio, open settings.gradle and add this line include ':app:libs:caldroid'. Next, open "build.gradle (Module: app)" and add this line compile project(':app:libs:caldroid') in dependencies.

And that's it, now allow the gradle to "sync" or clean and build your project.
Comment: First thanx @Ravi, I am using the gradle methods for import the Android libraries. Thus I can import with one line.
Answer: Add this line in your dependencies in build.gradle
compile 'com.roomorama:caldroid:3.0.1'

Comment: try adding the above line ("compile 'com.roomorama:caldroid:1.1.0'", that's all you need) and deleting "include 'libraries:caldroid:library'" and "compile project(':libraries:caldroid:library')"
Comment: First thanx @Bronx. When I try to add diffrent library, these methods work. But I suppose this library not fixed.

Add Caldroid library in Android Studio


Study design involving 4 variables measured every month for 5 years

Question: I want to design a study on hemodialysis patients. I know from basic science knowledge that there are four variables (suppose  a, b, c, d) which effect the rates of heart attacks/ strokes and amputation in hemodialysis patients. My objective is to prove that all these have a correlation with heart attacks/ strokes and amputation in dialysis patients. After proving I want to find out which variable has the strongest link with ANY of these events.
Now I have 88 dialysis patient in my hospital and have the variable data for a, b, c, d in excel form monthly for 5yrs. How can I use these variables a, b, c, d which will be 12 times in the year and 60 in 5yrs. How is time averaging done?
Let me explain more. I will only take one adverse event heart attack for now. Increase in variable A and B increases risk of heart attack and increase in variable C and D decrease risk of heart attack. How should I design a restrospective study over 5yrs to maximize the chance of finding a significance between the above mentioned hypothesis?
Variables a to d are not binary but rather continuous with limits ofcourse. Example variable C ranges from 1 to 4mg/dl in the blood. The optimum level is 4mg/dl, the lower the level the higher risk of heart attack. Now how should I analyse my data to maximize the chance of finding an association between heart attacks and low level of variable C. I will use the similar strategy for all variables. What test will I use and where can I get the software to do those tests?
I am sorry I dont know the meaning of time average. There is a study that I heard about with a similar idea. They used a variable measured every month for a few years. I am not sure how they time averaged? Perhaps it is the arithmetic mean? This is the study that uses time averaging- Dialysis Modality and Correction of Uremic Metabolic Acidosis: Relationship with All-Cause and Cause-Specific Mortality Tania Vashistha, Kamyar Kalantar-Zadeh. It appeared in the journel CJASN. The link is here- http://cjasn.asnjournals.org/content/early/2012/11/21/CJN.05780612.abstract
Is there a way to attach pdf then I can with this question. Thanks to all in advance
Comment: Normally one "designs" a study *before* collecting the data: it sounds like you want to *analyze* study data. What information do you have about the heart attacks and strokes? What exploratory analysis of the data have you considered? What do you mean by "time averaging"?
Comment: I interpret this to mean that a, b, c and d change over time - they ar enot intrinsic things for the patient (eg they are not like height, or ethnicity).  One of your questions to address is whether it is a change in these variables that is linked to heart attacks etc, or the base level.
Answer: The values for four variables a,b,c,d (which effect the rates of heart attacks/ strokes and amputation in hemodialysis patients ) is measured per month. So, I think that the time factor should be averaged to make the value observed in per month. For example , feature a for patient A will have 12 values for one year and 60 for 5 yrs, so, all the 60 values should be summed and divided by 60 which will give a resultant value x/month. The same procedure should be followed for other features as well. At last we will have 88 rows (patients) and 4 columns (features).
Comment: Because this proposal collapses each time series of 60 values into one mean, it seems likely it will lose a tremendous amount of potentially useful information. For instance, one would guess that *changes* or *trends* in the explanatory variables $a,b,c,$ and $d$ might be related to the endpoints, but taking the means loses all such information.
Comment: Hello, thanks everyone. Let me explain. I will only take one adverse event heart attack for now. Increase in variable A and B increases risk of heart attack and increase in variable C and D decrease risk of heart attack. How should I design a restrospective study over 5yrs to maximize the chance of finding a significance? I was thinking for that I will also need to find the general event rate of heart attack in dialysis patients. How else can I calculate the power of the study or the number needed to prove an association. I only have 88 patients
Comment: Variables a to d are not binary but rather continuous with limits ofcourse. Example variable C ranges from 1 to 4mg/dl in the blood. The optimum level is 4mg/dl, the lower the level the higher risk of heart attack. Now how should I analyse my data to maximize the chance of finding an association between heart attacks and low level of variable C. I will use the similar strategy for all variables. What test will I use and where can I get the software to do those tests?
Comment: I am sorry I dont know the meaning of time average. There is a study that I heard about with a similar idea. They used a variable measured every month for a few years. I am not sure how they time averaged? Perhaps it is the arithmetic mean? I am thinking I have 12 values/yr and 60 in 5yrs, what is the best representative value? Or should I use all these values for correlating with a heart attack. How can I use all these values? What formula/ test to use?
Comment: Sairah, most people will not see your last three comments. Please incorporate them within your question.  As far as "time averaging" goes, please provide a citatation (and preferably a link) to the study you refer to, so that we may investigate what was intended.
Comment: Hi whuber, I provided more information. Please comment, thanks


Do I need an audio interface for recording if I have a mixer with a built-in USB?

Question: I have Volca series synths and Behringer xenyx 802. I can record each Volca separately with an audio interface to my computer but If I want to play them and record them together (which is better for me), would I get a better sound quality if I plug in the mixer to the audio interface? or is it the same as if I was recording from the mixer itself (with the usb cable to the computer)?
Also, if my synthesizers had stereo signals and I recorded them in stereo with the mixer, and then connected the synthesizer with the mono input of the audio interface, the output would be mono yes? but does that mean that the stereo sound of the synthesizer would sound as if it was lacking something? I think I can't understand the difference between recording in stereo\mono and listening to the output of the work in stereo\mono (transferring it from one to another)
Comment: What brand/model is the audio interface? The conversion built into the Behringer mixer may be quite basic.
Answer: I don't know about your interface issue. Like Your Uncle Bob said in the comments, depending on the wiring/circuitry in your mixer, the interface may provide a cleaner recording. I would test both configurations and see which sounds better to you.
As for recording/listening in Stereo and Mono, think of it this way:

If you record in Stereo and listen in Stereo, you hear the panned (off-center) sounds in the individual speaker/headphone they are panned to
If you record in Stereo and listen in Mono, those panned (off-center) sounds are coming through both speakers/headphones, but are going to be quieter or sound "off" because they aren't in both source channels when the channels are overlaid
If you record in Mono and listen in Mono, you're hearing one channel back through one channel. You will get 1-to-1 duplication of the source channel because you don't lose any fidelity to panning the sound
If you record in Mono and listen in Stereo, you're hearing the same signal duplicated through both channels, this is functionally identical to listening in Mono
Answer: According to the documentation on Behringer's website, the Xenyx 802 is a simple 8-2 analogue mixer with no USB output.  So I think your only choice is to feed the mixer audio output to your audio interface.
If the mixer DID have a USB connection, allowing it to act as its own 'audio interface' it would doubtless sound the same as any other competent interface.  But as you don't tell us WHAT audio interface you own, it's impossible to comment.


SSLCertificateChainFile Deprecation Warning on Apache 2.4.8+

Question: We have an SSL Certificate for our website from Network Solutions. After upgrading Apache/OpenSSL to version 2.4.9, I now get the following warning when starting HTTPD:
AH02559: The SSLCertificateChainFile directive (/etc/httpd/conf.d/ssl.conf:105) is deprecated, SSLCertificateFile should be used instead

According to the Apache manual for mod_ssl this is indeed the case:

SSLCertificateChainFile is deprecated
SSLCertificateChainFile became obsolete with version 2.4.8, when SSLCertificateFile was extended to also load intermediate CA certificates from the server certificate file.

Looking up the documentation for SSLCertificateFile, it looked like I just needed to replace my call to SSLCertificateChainFile with SSLCertificateFile.
This change turned my ssl.conf from this:
SSLCertificateFile /etc/ssl/STAR.EXAMPLE.COM.crt
SSLCertificateKeyFile /etc/ssl/server.key
SSLCertificateChainFile /etc/ssl/Apache_Plesk_Install.txt

to this:
SSLCertificateFile /etc/ssl/STAR.EXAMPLE.COM.crt
SSLCertificateFile /etc/ssl/Apache_Plesk_Install.txt
SSLCertificateKeyFile /etc/ssl/server.key

... but this doesn't work. Apache simply refuses to start without any error message.
I'm not sure what else to try here, as I'm not that familiar with mod_ssl or SSL certificates in general. I do remember we needed to add the Apache_Plesk_Install.txt file for Internet Explorer to not have an SSL warning on our site, but other than this I have no clue.
Any help would be greatly appreciated. Thanks.
Comment: You need to concatenate all certificates, the client certificate and the intermediate certificate(s)
Answer: I had the same issue. I just replaced these lines in /etc/apache2/site-enabled/default-ssl.conf
SSLCertificateFile    /etc/ssl/certs/domain.crt
SSLCertificateKeyFile /etc/ssl/private/domain.key
#SSLCertificateChainFile /etc/apache2/ssl.crt/chain.crt

As you see, I just commented out the SSLCertificateChainFile. Then, seeing the same error as you, I concatenated the content of my chain.crt at the end of the domain.crt, like so:
root@host~: cat /etc/apache2/ssl.crt/chain.crt >> /etc/ssl/certs/domain.crt

And it worked like a charm.
Comment: perfectly valid too according to comments in apache config: "Alternatively
#   the referenced file can be the same as SSLCertificateFile
#   when the CA certificates are directly appended to the server
#   certificate for convenience."
Answer: I use the following script  to create a certificate bundle that contains the chained certificate.
#!/bin/sh
#
# Convert PEM Certificate to ca-bundle.crt format
#

test ! $1 && printf "Usage: `basename $0` certificate" && exit 1

# Friendly Name and Underline Friendly Name with equal signs
openssl x509 -in $1 -text -noout | sed -e 's/^  *Subject:.*CN=\([^,]*\).*/\1/p;t  c' -e 'd;:c' -e 's/./=/g'
# Output Fingerprint and swap = for :
openssl x509 -in $1 -noout -fingerprint | sed -e 's/=/: /'
# Output PEM Data:
echo 'PEM Data:'
# Output Certificate
openssl x509 -in $1
# Output Certificate text swapping Certificate with Certificate Ingredients
openssl x509 -in $1 -text -noout | sed -e 's/^Certificate:/Certificate Ingredients:/'

To use it, starting with the server certificate and sequentially through any intermediary certificates in the certificate chain back to the root certificate.
./bundle.sh myserver.crt >myserver.chain
./bundle.sh intermediate.crt >>myserver.chain
./bundle.sh root.crt >>myserver.chain

where the appropriate certificate names are replaced with your real certificate name.
Answer: Have the site certificate, the intermediates as well in a file specified by the SSLCertificateFile directive and the private key concatenated in a file specified by SSLCertificateKeyFile and you should be all set. Although you could have the private key in the same file as the certificates but that is discouraged. Please check the documentation for more details:
http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslcertificatefile
I would recommend that the root CA certificate is not a part of the SSLCertificateFile since the client should have the root CA certificate as trusted in order for the certificate validation to work as designed.
Also, if there is nothing in the apache error logs then one could put the error log to a finer granularity as in http://httpd.apache.org/docs/current/mod/core.html#loglevel
Comment: You are right - things have changed from what I remembered from the documentation and also what documentation exists in the httpd-ssl.conf file for these two directives. Although allowed but the practice of having the private key in the file specified by SSLCertificateFile is discouraged. Reply is now edited to cater to this fact.
Comment: Really? The private key? That seems like a bad idea. Just wondering, because, my strong assumption is that this is private.


Modulus power modulus

Question: I have to prove the following property
$$\left | z_{1}^{z_{2}} \right |=\left | z_{1} \right |^{\left | z_{2} \right |}$$
I could do it when $z_{2}\in\mathbb{R}$, but at the moment when I deal with the complexes, I have not been able to see if this property is false or not, I read several questions here and I came to the conclusion of its falsity, but I would like to know if someone can help me with a counterexample, thanks.
Answer: $\left|2^{-1}\right| \ne  |2|^{|-1|}$
Comment: "as short as can be" answers are rarely better than explanation answers.  You rarely help the asker.  Trying to be clever rarely translate into being effective for the asker.

Modulus power modulus


How to force D8 "Configuration synchronization" to send HTTPS download URL

Question: I have a Drupal 8 site hosted on an Apache Server.
There are 2 virtuals hosts :

one listening on port 80, which redirects everything to HTTPS
one listening on port 443 which serves the htdocs directory where the Drupal site is located

Everything works well, except for the "Configuration synchronization" full export. When I click the "Export" button, I'm redirected to the home page, without any message or log.
Enabling the console on my web browser, I saw these calls :
POST https://my.domain.fr/admin/config/development/configuration/full/export
[HTTP/1.1 303 See Other 86 ms]
GET http://my.domain.fr/admin/config/development/configuration/full/export-download
[HTTP/1.1 301 Moved Permanently 101 ms]
GET https://my.domain.fr/
[HTTP/1.1 200 OK 183 ms]

The download process of the config file seems to be killed by the redirection.
The second URL (GET http) is sent by Drupal in the response to the first call, in the "Location" header.
How can I force Drupal to send only HTTPS url, even in the Location header in this precise case ?
Edit: Potentially linked post
Edit2: I'm having the same trouble with the RSS link on the site : on the page returned by https://my.domain.fr, the RSS link is http://my.domain.fr/rss.xml
Edit3: Found the solution for the export problem (see answer below). Still not a solution for the RSS link, but it's not the main subject of this post.
Answer: I forgot the SSLEngine On Apache directive in the configuration of the VHost listening on port 443.
With it, the Location header sent by Drupal contains now https scheme.


What is ideal software setup for programming web applications (editing php, javascript, xhtml, css)?

Question: I've been developing web applications for 2 years now, and have been into simpler web pages for many more. I've been using Notepad, then ConText, then Crimson Editor (was my favorite for a long time) and I've been trying with Notepad++. I have NetDrive setup so I can edit and save files directly on the ftp server. On Firefox I use the Web Developer extension, Firebug and a couple more.
As my skills grow and need to do more stuff than before, I'm facing some limitations such as doing some versioning, tracking changes on the code, reverting back to an older version, these things I do them manually. Also I want to be portable so I'm trying to setup everything webdev-related in a Dropbox folder so I can sync it and have a functioning developer setup everywhere I go.
I'm wondering what software would you suggest for web app developing and how can it be setup to be portable or in the cloud?
Comment: I'm quite happy with $any\_favoured\_text\_editor (Notepad++ is fine) and plain old SVN for versioning and deployment.
Comment: @bobince I've found several SVN software which one should I use? Can you point a link?
Comment: Doesn't belong this to Superuser?
Comment: @daemonfire300 you're right, I didn't know of superuser.com thanks for pointing it out
Answer: I thinks it depends on whether you achieve a full-featured IDE or a collection of tools that do their job separately.
After using many editors on different platforms, I use Eclipse and Vi now: For small scripts that have to be changed quickly, Vi is the perfect editor, and it's available for every important platform, but it takes some time to lern the shortcuts.
But since most Web projects grow rapidly in size, I got need of a IDE which suits all my needs:

Subversion integrated
Code completion and helpful function for different languages (Python, PHP, HTML, even C++)
Availability on Mac, Windows and Linux
Open Source
Extensible via Plugins
Fully configurable

Eclipse does this all and much more. All the project stuff is placed in a workspace-directory, which you can sync via Dropbox or anything else if you want (since I would recommend storing project files in a repository rather than on a simple Webdav place).
Comment: +1 for Eclipse, can be found here http://www.eclipse.org/pdt/
Comment: Are you using vanilla Eclipse (perhaps with some plug ins)?
Comment: Actually, I use Ganymede 3.4.2, with PDT Subclipse, Pydev, CDT and Android SDK
Answer: Jetbrains' Web IDE is currently in beta and should be released before the end of the year. You can already download and use EAP releases. It will be commercial but might have a free/community version (as was recently announced for IntelliJ IDEA).
It's getting quite good with support for PHP, HTML, CSS and Javascript. It also has good version control integration (Git and Subversion are the two I've used) and has local change tracking (so you don't even need to check in to something to see old versions and revert them; it does this automatically).
That and a convenient distro like XAMPP is all you really need (well and Firebug).
Answer: I use Zend Studio (http://www.zend.com/en/products/studio/) as my IDE. It's not perfect (nor free), but I haven't found anything I like better and it has definitely sped up my development time. It really shines as a PHP editor, has a nice XML editor, decent HTML editor, and so-so JavaScript editor. But since it's built on the Eclipse platform, it should be possible to install plug-ins/mods. If you're like me and your main focus is PHP, with the other three languages taking a backseat, then I imagine this will suit you fine.
I wish I could tell you more about versioning, but I don't know much about this :/ I do know that Studio has a built in SVN manager. It also supports remote connections through FTP. I also use Dropbox, and there is no problem in using the two combined.
I've checked out NetBeans, and a few other IDEs, but there are so many small features/shortcuts that Studio has that the others don't that force me back to Studio. I will add these caveats though: Studio is memory hungry, and code hinting is much slower in the latest version than the previous (though they claim this will be resolved.) I suggest downloading the demo and seeing how you like it for yourself.
Comment: SVN Versioning in Zend Studio is... so-so. If it works, it works like a charm, and when it breaks, it breaks horribly. At the moment, I think that our three-man team has lost about as much time from this as we have gained from using ZS in the first place - here's to hoping 7.1 will be better.
Answer: Try which editor you like the best. I used Aptana and different other editors (eg.: Zendstudio) a while ago, but I always go back to Geany (but I am on Linux) and a bunch of commandline tools.
You have to figure out yourself what is the best enviroment for you.
Answer: The editor part is totally up to you, I use both PHP Eclipse and Vim. I don't think versioning integration in IDE is that important but code completion and syntax error control sure do help.
Look into SVN and TortoiseSVN - it provides comfortable version control and you can use your sources from anywhere with an svn client and it's a must when you start working on one project with other people.
Answer: For the last year I've been contentedly developing using NetBeans 6.7 with [xdebug][2], Firebug 1.4 and [Darcs][3] as version control.  The whole setup is portable, so I can use it on any windows machine and has proved very reliable; can't recommend it enough.
NetBeans covers all the bases: HTML, CSS, JavaScript and PHP with auto-complete and the xdebug integration, once you get it working, is excellent.  Darcs is console only, but its so straightforward to use that you just don't miss the GUI.  I use [Console2][4] to work with Darcs.


Trouble understanding a step in a proof, algebra with summation

Question: I have this line in a proof that I do not understand and would like some help understanding please.
$$\sum_{i=1}^{n}x_i^2-n\bar{x}^2 = \sum_{i=1}^{n}(x_i^2-2x_i\bar{x}+\bar{x}^2)$$
Can anybody enlighten me on this transformation please?
Thanks.
Comment: Is there any hypotheses on the $x_i$s?
Comment: what is $\bar{x}$?
Comment: yes, $\bar{x_i}$ is the average.
Answer: If $\bar x$ is the average $\bar x = \frac1n \sum_{i=1}^n x_i$, then
$$\sum_{i=1}^n 2x_i \bar x = 2\bar x \sum_{i=1}^n x_i = 2n \bar x ^2.
$$
Furthermore,
$$
\sum_{i=1}^n \bar x^2 = \bar x^2 \sum_{i=1}^n 1 = n\bar x ^2
$$
Comment: Oh, nice, now I get it. Thanks @Kusma


User configured VIEW fields

Question: Curious, is there a module or technique I can use to easily allow my clients (who log in with a limited role) to manage fields visible in any given view?
Actually there are two specific content types and two specific page views -- which I would love to give them the capability to customize to their liking.
Comment: Are you talking about views as in Views module or viewing a single node? And do you want them to be able to edit the fields of the content type or edit how the view displays the fields? Can you add an example?
Answer: Sounds like something you can do with Views Dynamic Fields. Unfortunately there's only a D6 release atm, but perhaps you can port the module to D7 when it seems to fit your needs.

User configured VIEW fields


WIX: Install Certificate but distribute pfx file separately from msi

Question: I want to create a MSI that installs a certificate in the local machine store on several computers.
As the certificate will be different on each machine I wanted to exclude the pfx from the MSI so that I can provide the same MSI everywhere and only have to pick the correct certificate.
How can I tell WiX that the Binary element that encapsulates the pfx included in the Setup should be a file in the Installation source Directory and not embedded in the MSI?
Answer: You'll need to stream the files out yourself. If you search the web there are things like this that show the principles involved:
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Extract-Binary-file-from-MSI-to-Temp-folder-using-C-td7588682.html
http://makemsi-manual.dennisbareis.com/extract_binary_at_install_time.htm
The trick is the SQL query stuff. In WiX you just use the Binary element to get the files in there.
If you are putting pfx files in your Binary table, you are aware that MSI files are transparent and I could, for example, open your MSI file with Orca and extract your pfx file and maybe sign things with it?
Comment: Actually I don't want to put the pfx file as a binary into the msi. I want to distribute 2 files: an "installcert.msi" accompanied by an "installcert.pfx". The msi would always be the same. The pfx would changed regarding to the current machine. In the msi I want to refer to the pfx file in the  element.


How to restrict node authors from commenting on their own nodes?

Question: On my site we have enquiries (nodes) and price quotes (comments). So node authors shouldn't be offered to quote prices to themselves.
That's why I want to disallow node authors comment their own nodes. How can I do so?
Updated: The 'user-compare' option in panels visibility rules could easily allow to achieve what i want. I've used this functionality for other panes i.e. profile fields etc. But  i didn't find 'user-compare' entry in Panels visibility rules for comment form in node template. Why?
I chose the way offered by Pierre.Vriens using Rules because I couldn't  make the code snippet by oksana-c work with Panels. Unpublishing comments with The Rules is not best user experience. Comment Permissions module also didn't help. Any suggestion for unsetting whole comment form for node authors programmatically in Panels environment would be much appreciated.
Comment: are you using D7 or D8?
Comment: what about replies to comments? author of the node should be disallowed to comment AND reply?
Comment: how are you using Panels? are you overriding node/%node path with Panels? or maybe you're displaying multiple nodes on one Panel page w/ comments under each node? Are you adding comment block separately from the node? Unfortunately, Rules are not the solution here. Unpublishing comment after it has been posted is not an ideal user experience. Look into extending Comment Permissions module. That is your best bet.
Comment: Of course, Comment Permissions will be useless for your implementation if you take it and use it as it comes out of the box. That is why I suggested "extending" it, which is not difficult, especially with your requirements.
Comment: Thnx oksana, I am using D7. Neither authors nor other users will reply to comments in their own or other's nodes.  Users only can comment in other's nodes and no replies are needed on these comments.
Comment: @oksana-c I didn'r override path in Panels.  In my Panels comments is separate block. There's one node on my Panels page. Seems that Rules isn't a good way to to this task. I had to get back to this issue again because I started using Onecomment module for allowing only one comment per user oer node. So with Rules i'm getting messy results - there's message from Rules that i can't comment own nodes and a message from Onecomment telling me that i've already commented on my own node.  Unsetting the whole comment form would be the sulution.  Pls revert.
Comment: @oksana-c Comment Permissions was useless. unchecking commenting on own content gave me nothing. As far as i see the module just sets whether user can comment with no approval on all nodes or just the ones he authored. It doesn't have such thing as 'others' as opposed to 'own'.
Comment: @oksana-c  I think I'm not that good in php coding to perform such changes. It would be great if somebody offered a kind of patch.
Answer: You'd want to use hook_node_view_alter() in your theme to unset the comment form if the logged in user is same as node author.
function yourtheme_node_view_alter(&$build) {
    global $user;
    // get the uid of logged in user
    $logged_in_uid = $user->uid;

    // if content type is 'your_content_type'
    if ($build['#bundle'] == 'your_content_type') {

        //get node author's uid
        $node_author = $build['#node']->uid;

        // if logged in user is the node author - unset comment form and remove the 'Add comment' links from node display
        if ($node_author == $logged_in_uid) {
            unset($build['comments']['comment_form']);
            unset($build['links']['comment']['#links']['comment-add']);
        }
    }
}

Also, you can check out Comment Permissions module. It does not offer the functionality that you need, but it provides more granular permissions than core comment module.

The Comment Permissions module enables control of commenting by user role and by node type. Additional user permissions for selected node types are added to the user access system so you can configure commenting with more control than Drupal core provides.
Comment: Nice, the  hook_node_view_alter() worked just fine
Comment: I added a message to yr code to check if function works. The message is displayed  on front page, not on node/view page.
Comment: @TimurKutuev hook_node_view_alter() will run on every page where function node_view() runs. This means the message that you added will be displayed on every page where you display any nodes in any view mode. Information that you provided is not enough to troubleshoot.
Answer: You can use the Rules module for this, by creating a rule that looks like so:

Rules Event: After saving a new comment.
Rules Condition: Data comparison like comment:author is equal to comment:node:author.
Rules Action: Set a data value for comment:status, and set it to unplublished (which you should be able to do if using the Rules event "After saving a new comment").

Here is the actual Rule I created for it (in Rules export format, which you should be able to import in your own site aso, using the Rules UI):
{ "rules_unpublish_selected_comments" : {
    "LABEL" : "Unpublish selected comments",
    "PLUGIN" : "reaction rule",
    "ACTIVE" : false,
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "comment" ],
    "ON" : { "comment_insert" : [] },
    "IF" : [
      { "data_is" : { "data" : [ "comment:node:author" ], "value" : [ "comment:author" ] } }
    ],
    "DO" : [ { "data_set" : { "data" : [ "comment:status" ], "value" : "0" } } ]
  }
}

After you imported this rule, you must first "enable" it before it actually becomes active i your own site (alternative: exclude the line with "ACTIVE" : false, before importing this rule.
Consider the above as a "template Rule", which with some minor tuning you can also use for all sorts of variations of processing comments via the Rules module ... (eg by using some other Rules Condition).
If you're not familiar with the Rules module, have a look at the video about Rules(Sending Emails) - Comment reply notification which demonstrates how to use the Rule UI to build a rule that is about a variation of this question.
Happy Rules-ing!
PS: No need for custom PHP coding ...
Answer:
Log into the Drupal Dashboard
Click on Structure from the upper menu bar and then select the Content types category.
Click Edit next to the name of the content type you wish to edit
drupal_global_comment_1
Scroll down and click on Comment settings
drupal_global_comment_2
Select Closed from the drop down menu under Default comment setting for new contentdrupal_global_comment_3
Click the Save content type button at the bottom of the page.
Comment: Thnx Raj, but if I do so, i would completely kill commenting in the nodes. I only need to disallow node author to comment on their own nodes but let other users be able to comment. I saw  several issues of disallowng authors to rate their own nodes and this is the way it should be done with the comments in my case.


Question about Lagrange multipliers and constraints that are disks and circles

Question: There are two cases that I need to clarify:
If I have a question that gives me a function $f(x,y)$ and asks me to find the absolute maximum and minimum on $x^2+y^2=1$ will my maximum and minimum value always be on the boundary of the circle (or even if this wasn't a circle but any boundary, will my absolute max and min always occur on the boundary)?
In a second case where I have the same function $f(x,y)$ but this time the constraint is a disk $x^2+y^2\le1$, the absolute maximum and minimum could be on the boundary or within the boundary of the disk, is this conceptually correct or wrong?
Thank you!
Answer: If you consider $f(x,y)$ over all of $\mathbb{R}^2$, then it might be the case that it attains its maximum and minimum values on some point  not on the boundary of the circle specified by $x^2 + y^2 = 1$.
It seems that the question is asking you to specifically find the maximum and minimum values of $f(x,y)$ "over" the circle. In other words, you have a circle on the xy-plane, and your function values $f(x,y)$ represent a surface over the xy-plane, but you ignore all the points on the surface that aren't directly over the boundary of your circle.
For the second part, you ignore all the points on the surface that aren't directly over the interior + boundary of your circle.
After ignoring all the points that aren't over the boundary (in the first case) or the interior + boundary (in the second case), then you find the z coordinate of the highest point and lowest points of the surface (which is the same as the maximum and minimum values of $f(x,y)$ subject to the given constraints).
Hopefully you can picture what you are doing when you are finding the maximums and minimums of a function subject to some constraints now.
Comment: Just to clarify on the point you made in the fourth paragraph "After ignoring all the points that aren't over the boundary (in the first case) or the interior + boundary (in the second case)..." I assume from this then, as in the first case I am ignoring everything that is not over the boundary, my max and min will only be found over the boundary. And in the second case, I'm ignoring everything that isn't over the boundary and interior, so my max and min found will strictly be points over the boundary or interior? Is this correct?
Comment: It is definitely possible that the max and min of $f(x,y)$ are attained at points not in your constraint regions, but you should only consider points in your constraint regions (i.e. you need (x,y) to satisfy your constraints). So yes, your max and min for this problem will be strictly over the boundary or interior.
Comment: Lovely! I get it now thank you :)


Feature selection: nested cross validation

Question: I'd like to select features, and evaluate model performance using nested cross validation.
My question is that I have to split data in order to select features or not.
Additionally, is the following method appropriate?
( In the following method, feature selection was conducted without data split.)

feature selection using correlation coefficient and Boruta algorithm
Split the data into train and test at outer loop by 5-fold cross validation ( train-outer and test-outer)
Split train-outer into train and valid at inner loop by 5-fold cross validation ( train-inner and valid-inner)
Tune parameters of machine learning model (eg. support vector machine) by grid search using train-inner and valid-inner
Train machine learning model using train-outer and evaluate model performance using test-outer
Comment: The question is already answered below but this article may clarify some details: https://jcheminf.biomedcentral.com/articles/10.1186/1758-2946-6-10
Answer: Feature selection should be performed after train-test split, so it should be part of your inner cv loop, treated like hyper-parameters of the model.
Comment: I mean that you answered my question.
Comment: Thank you for your comment. In that case, different features would be selected at each outer loop. How should I decide which features are needed?
Comment: if you apply cv for performance measurement, instead of a separate test set, this is always the problem. You won't have a final feature set or final hyper-parameter set
Comment: Thank you for your comment. My question was answered.
Comment: Do you mean it's answered here or somewhere else?
Comment: I'm sorry for late. I accepted your answer today. I appreciate it.
Answer: I have released a package that can help implementing nested cross validation in Python (for the moment, it only works for binary classifiers). If you want to check it out, it's here:
https://github.com/JaimeArboleda/nestedcvtraining
It's my first Python package, so any comments, suggestions or critics will be more than welcome!!
I post it as an answer because nested cross validation is performed inside the main function and you don't have to take care of how to implement it.
Also, in the inner loop where the parameter and hyperparameter optimization takes place, you can add parameters of both model an post-processing pipeline (see the readme). This way, you can optimize the feature selection criteria -you could make it dependent of a parameter, like the number of features to select- in a safe way.
After the function is called, you get a model (that in fact will be a pipeline if there is a post-process to perform) and a complete report of what happened inside, so that you can assess the estimates of the different scoring functions. It comes with many options thay may be enough for a lot of common settings, I hope.


Using SSL\TLS for free in a public program

Question: I really need to use SSL in my Socket Server\Client Communication but paying for a certification is too over priced for me :( i can't afford payed Certification
[Note] : my program will be publicly released so i wanna to secure my program communication with my server
The Question Is : Is it possible to use SSL\TLS for free in an effective [Without Security Riscs] way because i can't afford payed certificates... ?
Comment: A domain validated certificate is only $35. Surely you have that right?
Comment: what i want is a certification to encrypt my Socket Server and client communication
Comment: Doesn't answer the comment. You will spend far more than $35 getting it working, and supporting it, and fielding user problems, without a CA certificate than with one. Spend the thirty-five bucks.
Comment: Can you tell me what you mean ? A self-signed certificate did not differ from the CA one except with the trusted for all browsers.
Also can you tell me which website i could get this 35 cert ?
Comment: I've already told you what I mean. What part of it didn't you understand?
Comment: Doesn't answer the comment. You will spend far more than $35 getting it working, and supporting it, and fielding user problems, without a CA certificate than with one. Spend the thirty-five bucks.
Comment: this one what you mean by that i will spend far more that 35$ to get my Self-signed certificate working ? also fielding user problem, which probs ???
Comment: Welcome to Stack Overflow!  Please be aware that tags stand alone.  That is, selecting `client`, `server` and `communication` does not mean that you're actually talking about client-server communication.  Please select tags with care.
Comment: Just repeating my own words back to me just wastes time and space. If you have a specific question, ask it. But if you haven't priced a proper SSL certificate you haven't done enough research to be asking this question yet.
Answer:
Is it possible to use SSL\TLS for free in an effective way because i
  can't afford payed certificates... ?

Yes it is. Buying certificates from a trusted CA, makes your server be trusted by all browsers without any manual action (e.g. Verisign).
If you own both the client and server and you are using SSL you can create your own certificates (or get free ones) and install them to all clients as trusted (in an off-line process).
The only part that relates to security now is the key size. Should be at least 2048 bits.
But there is one catch. If you create your own certificates you need to be careful what extensions you set so that you don't have any issues during deployment. The CAs know how to create X509v3 compliant certificates to be accepted by all browser (libraries) without any issues
Comment: So your comment make me want to ask some more questions.
1- What do you mean by offline process ? must all clients disconnect their internet connection to install my program.

2- What do you mean by the extensions part ? what i do is creating a .pfx file then install it to my pc and export it again to be used in program
Comment: 1)I mean you will have to go manually to install the truststore.2)I mean `X509v3` extensions
Comment: I am creating a 2048 bits certification using C# and saved as .pfx then i install it to my certification store then export it as a .cer to use it to my application...
Comment: Also is there a risk if Enable exportable private key ? is enabled ?
Comment: Also if i created my self-signed certificate in a good way, is there a security risk in having a self signed certificate [if well created 2048++ bits]?
Comment: @TorlanOther:The security risk here, is the part where **you** install the certificate to your clients.Also issue it to **your** domain (not localhost or some fake name).If you have a domain name...
Comment: @TorlanOther:Also the key assumption here is that **you** control the clients
Comment: you mean the cn=localhost right ? i will make it my domain name when i get one www.mydomain.com and the clients will have to remain connected to my server in order for the program to work correctly
Answer: Short answer: yes.
Long answer: What you're buying from a CA (certificate authority) is typically NOT a certificate. Typically, you create your own certificate, and ask the CA for a "signature", which you present to the client (browser, etc) in order to show that your certificate is trusted by that CA.
Browsers (and other software) typically have a internal list of CAs they trust. This is why one generally buys a signature - to have one's certificate recognized as valid by currently deployed software.
However, you are not required to get such a signature. You can just as well create your certificate (typically referred to as a "self signed" certificate) and either ask the end-user to introduce it to the software as trusted, or distribute it included in the software itself.
There are lots of instructions on how to create a self-signed certificate on the web, typicaly using the openSSL CLI, but also IIS, or Java.
As to how you deploy such a certificate on your software, you're better of asking another question.
Comment: i am creating my self-signed certificates using c# Pluralsight's certification manager but there is a bug in this program that Enable exportable private key is always ENABLED so is there a risk in that ?
Comment: Also if i created my self-signed certificate in a good way, is there any difference between it and the CA one other that it is trusted by all browsers ? is there a security risk in having a self signed certificate ?
Comment: @TorlanOther you definitely DO NOT want to export your private key along with the certificates you distribute to the public. It TOTALLY destroys any kind of security your system could possibly have. If the operation is done correctly, there's absolutely no difference between a self-signed certificate and a CA-signed one, other than convenience. I strongly advise you to use OpenSSL instead of other (possibly shady) implementation to create the certificates.
Comment: @TorlanOther Also, from your questions, you'd benefit from reading the [public key cryptography](https://en.wikipedia.org/wiki/Public_key_cryptography) and [PKI](https://en.wikipedia.org/wiki/Public_key_infrastructure) articles on wikipedia.
Comment: What made me think of SSL is the worry of MITM attack so with alot of reading on the internet i have found that maybe SSL is the less vulnerable to MITM attack and it is best security to be used in a client server communication so is this true ?
Comment: @TorlanOther Indeed. Using SSL, the MITM threat is eliminated (if you keep your certificates private and there's no breakthrough on number factoring). Also, you cease being vulnerable to passive sniffing (of passwords, for example)


Why doesn't Traktor update the key and BPM fields after I analyze the track?

Question: This video shows the issue. After restarting the computer and Traktor everything worked fine, but I wonder what could have caused the issue. The track in question was not being used/opened by other programs.
Comment: ask the developers who wrote the software...
Comment: Ok, that's strange. No BPM and no BeatGrid. If you set the BeatGrid manually does it work then? Another thing comes into mind is the file write protected?
Answer: I'm quite sure that's a bug, and one that NI fixed a while ago. I haven't had that issue in years
Your version of Traktor is 6 years old. Traktor 3, a major version upgrade, was released in 2018. I would recommend upgrading--3 is a huge improvement
I wouldn't even want to file a bug report on it because that's just less developer time that can be spent on making cool new stuff, if they even support that anymore
And if you must stay on 2, do a minor version update. I was on 2.6.8 for a long time, not sure if that's the latest minor release of 2 but I can vouch for it being solid


Entity Framework Foreign Key Mapped to Same Table

Question: This is not a duplicate of this post although the title is very similar. I am using EF4 with MSSQL Express 2008 R2 on VS2010.
A simplified version of my schema is as follows:
<code>Table [Team]:
 Id (PK)
 Member1
 Member2

Table [Person]:
 Id (PK)
 FirstName
</code>
[Team].Member1 and [Team].Member2 are foreign keys pointing to [Person].Id.
When generating the .edmx via VS2010, the navigation properties under [Team] become "Person" and "Person1" despite giving distinct names to the FKs inside SQLServer.
Is it possible to force the .edmx generator to recognize my FK names in SQL Server? I'd like these names to be Member1Person and Member2Person, for example, so I don't have to manually rename them by hand. If not, what is the preferred way to redesign the tables/FKs to bypass this altogether? Thank you.
Answer: I have had a similar issue but I believe the answer to the question is you simply have to rename the Navagation property to what you want.  The Entity Framwork designer will always keep you changes to the property names on the Conceptual side of things.
Comment: No it will not be undone when you rebuild from DB or update from DB.  Remember changes you manually make to the Conceptual side of the Model are saved in the EDMX.
Comment: Thanks for the answer. I'm trying to set up a 'one-click' build/update; will this be undone every time I regenerate the .edmx?


Should we require software questions to be applied to economic problems?

Question: Our current help center states that:

Software questions: Questions related to software used in economics and econometrics, are on-topic here.

I wonder if it should be changed to:

Software questions: Questions related to software used in economics and econometrics applied to economic & econometric problems, are on-topic here.

The reason for that are software questions like this or this, that technically under our current help center are on topic but users seems to be puzzled about why they are here or they are voted to be closed as off topic anyway.
There was already past meta question about this which went even further than this modest proposal, I do not necessary think we should go as far as suggested there but arguably questions that are just about functioning of a software without any application to economics at all seem a bit misplaced here and should likely be relegated to stack overflow.
Comment: Regarding the overlap problem, here's some context from an older discussion: https://economics.meta.stackexchange.com/a/1845/59 "If the question seems plausibly on-topic on both sites, let it live in both cultures, as the answers will be different. Let the users of each community benefit from the information."
Comment: I would change "applied to economic problems" to "applied to economic and econometric problems." This points to another "demarcation problem:" What kind of statistics questions are allowed here?
Comment: @MichaelGreinecker yes good point, I edited that. If you ask me we should definitely allow econometric questions
Comment: Though, to be clear, I believe that the two questions you link are very low quality, regardless of whether they are on- or off-topic. They could/should be closed for other reasons (as well).
Comment: @jmbejara I agree that overlaps should be allowed like for example cross-validated and economics.se both have great overlaps due to statistics, although here I wonder if it makes sense to just allow any question about software
Answer: How about:

Software questions: Questions on how to use software to address economics and econometrics problems are on-topic here.

Remarks:

Nowadays all sorts of software are used in economics so there's not much need to put a qualifier on it.
This is a little less repetitive.
Comment: thanks, this is much better wording, lets see what others think otherwise I would be happy to accept this answer


Can you define a function f: N->N that is one-to-one and not onto?

Question: The book 'Discrete Math and its Application' has the following problem:
20. Give an example of a function from N to N that is
a) one-to-one but not onto.

Is it possible to define a function f:N->N, that is one-to-one but not onto?
For the function to be one-to-one every element in the domain has to be assigned exactly one unique element in the codomain. This also means that then there exists no element in the codomain that hasn't been assigned a value from the domain, thus it's onto since the range of the function equals the codomain. So it looks to me like it's impossible for the function to be both one-to-one and not onto.
The definition of a function that i'm working with is the following:
Let A and B be nonempty sets. A function f from A to B is an assignment of exactly one
element of B to each element of A. We write f (a) = b if b is the unique element of B
assigned by the function f to the element a of A. If f is a function from A to B, we write
f : A → B.

Comment: $n\mapsto n+1$.
Comment: $n \mapsto 2n$.
Comment: @Carefullcars Why do you think *This also means that then there exists no element in the codomain that hasn't been assigned a value from the domain*?
Comment: Thanks @Bernard thought about your asnwer and it makes sense now. If the function is f(n) = n + 1, then when n = 0, n is assigned to 1, so the element 0 in the codomain wont be assigned by any element of the domain, so it's not onto but one to one.
Comment: This is one way to characterise infinite sets: a set $X$ is infinite if and only if there exists a function from $X$ to $X$ that is one-to-one but not onto.
Answer: You are wrong when you say :

This also means that then there exists no element in the codomain that
  hasn't been assigned a value from the domain...

A function is injective (one to one) iff every element of its codomain is the image of at most one element of its domain, but this does not means that every element of the codomain is the image of some element of the domain.
There are many examples of such functions $f:\mathbb{N}\to \mathbb{N}$ e.g $f(x)=2x$ or $f(x)=x^3$, and also $f(x)=x^2$ that is not injective as a function $f: \mathbb{Z} \to \mathbb{Z}$.


Git push from post-receive

Question: I have two servers, let's call them first and second. First one is where the real development is done, and second one should be the replica. What I would like to do is put "git push" in post-receive, but there is one problem. Post-receive is executed as the user doing git push to first server, so I can't chmod 600 ssh key with no pass. What is the best practice for this? Thanx!
Answer: I would suggest keeping it simply and just using rsync to copy the bare repository at a certain interval. There might be issues with concurrency when doing that (syncing at the same time as a push comes in). But then again doing multiple simultaneous pushes from the repository (such as if several developers push to the primary server at almost the same time) might have it's problems as well.

Git push from post-receive


Aws - Ubuntu - Cron job not running

Question: I have a aws ec2 server with ubuntu on it.
I did the following to set my cron
sudo crontab -e
15,45 * * * * ubuntu /usr/bin/wget -O /dev/null https://mywebsite.com/cron/
But its not running.
Comment: what are you expecting to be running with what results?
Comment: I want to run a website link `https://mywebsite.com/cron/` at every 15, 45 of the clock like `1:15, 1:45, 2:15, 2:45` This link does multiple job regarding mailing and mysql data
Answer: Remove the username from the cron line and it should start working.

Aws - Ubuntu - Cron job not running


SOAP-ERROR: Parsing WSDL: Couldn't load from - XAMPP

Question: I am getting an error:

SOAP-ERROR: Parsing WSDL: Couldn't load from
  'https://apphom.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente?wsdl'
  : failed to load external entity
  "https://apphom.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente?wsdl

I'm using:

XAMPP for Windows 5.6.15
5.6.15
Windows 8.1
PHP Version 5.6.15

And in my php.ini I enabled the options:
extension=php_openssl.dll
extension=php_curl.dll
extension=php_xmlrpc.dll

But I can not resolve the error, already researched several solutions.
The source code I'm trying to run is here
Answer: I solved the problem by rewriting my method
before
public static function getSoapClient()
{
    if (!self::$_soapClient) {
        $wsdl = Bootstrap::getConfig()->getWsdlAtendeCliente();

        self::$_soapClient = new \SoapClient($wsdl, array(
            "trace"              => Bootstrap::getConfig()->getEnv() != Config::ENV_PRODUCTION,
            "exceptions"         => Bootstrap::getConfig()->getEnv() != Config::ENV_PRODUCTION,
            'encoding'           => self::WEB_SERVICE_CHARSET,
            'connection_timeout' => 60,
            'cache_wsdl'         => WSDL_CACHE_MEMORY,
        ));
    }

    return self::$_soapClient;
}

after
public static function getSoapClient()
{
    if (!self::$_soapClient) {
        $wsdl = Bootstrap::getConfig()->getWsdlAtendeCliente();

        $opts = array(
            'ssl' => array(
                'ciphers'           =>'RC4-SHA',
                'verify_peer'       =>false,
                'verify_peer_name'  =>false
            )
        );
        // SOAP 1.1 client
        $params = array (
            'encoding'              => self::WEB_SERVICE_CHARSET,
            'verifypeer'            => false,
            'verifyhost'            => false,
            'soap_version'          => SOAP_1_1,
            'trace'                 => Bootstrap::getConfig()->getEnv() != Config::ENV_PRODUCTION,
            'exceptions'            => Bootstrap::getConfig()->getEnv() != Config::ENV_PRODUCTION,
            "connection_timeout"    => 180,
            'stream_context'        => stream_context_create($opts)
        );

        self::$_soapClient = new \SoapClient($wsdl, $params);
    }

    return self::$_soapClient;
}


Dell SAS 5/E vs Dell PERC 5/E

Question: Purchased a MD1000 from craiglist, came with two SAS 5/E cards and cables. I dug out an old 2950, put server 2003 (32bit) on it, put in one of the cards, installed / updated firmware, etc.  When I boot, I see:
Dell SAS 5 Host Bus Adapter BIOS
then later, CTRL-C to run SAS Configuration Utility
then later, I can press CTRL-R to config the PERC 6/i
I found post where Dell doesn't support the MD1000 connected to a SAS 5/E.. When I go looking on ebay for a PERC 5/E card, they look very similar to what I have now...
Looking for direction on how to get the 2950 and MD1000 connected... should I get a card off ebay, even if it looks very close to what I have now?  Is there a way to tell a difference
Comment: I have a Customer running three fully-populated MD1000's attached to SAS 5/E adapters (in PE1950's) using the disks as JBOD with no problems. They're running Windows Server 2008 R2 and using them in an application that doesn't need RAID. Having said that, I suspect Windows software RAID and/or Storage Spaces would probably work fine with them.
Answer: The MD1000 is a "JBOD" enclosure. The device that it connects to gets presented with access to all of the hard drives. If the device is a PERC 5/e controller, the card can manage the drives for you in RAID sets, and present Virtual Disks to the OS.
With a SAS 5/e card though, you would end up seeing every single hard drive separately in the OS (if it even worked - as you said, it is actually an unsupported config).
If you want a setup that is validated to function properly, go for the PERC 5/e card.
The MD1200 + SAS 6/E cards is supported now with Server 2012 and Storage Spaces to manage the drives... I would be curious whether or not you could get this to work on the hardware you have now, as the PE2950 does support Server 2012 (non-R2). Might be worth a try!
Comment: Thanks for the help, exactly what I was seeing... the disk in the OS.  I'll start looking for a PERC 5/E card (do you know the part number??), I got the MD1000 to do some testing, and the old 2950 will work fine... plans are to get a MD1220 to work with two R610's down the road. I'm self-taught in all of this, so didn't want to drop the cash on the MD1220 until I "played" with the technology a bit.  Thanks again for the help.
Comment: Sure thing! Dell part numbers, from newest to oldest revisions: GP297, DM479, XM768. Any of the 3 should do the job. If you're planning on sharing access to the MD1220 (such as for a cluster of any kind), that will likely have to be done with HBAs and Storage Spaces. PERC cards in different servers can't share access to the same disks and play nicely (though you can use "split-bus" mode so that each can use half of the enclsure).

Dell SAS 5/E vs Dell PERC 5/E


Assumption of homoscedasticity/equal variance violated in a 2-way ANOVA

Question: I'm analyzing results from an experiment where 56 samples were tested for a specific response to electrical stimulation. Electrical stimulation was done at 2 different stimulation frequencies, and at 3 different time points. 9, 10, and 9 samples were stimulated on day 7, 10, and 14 respectively at frequency 1, and the same was done at frequency 2. Each of the 56 measurements was done on an independent sample.
2-way ANOVA analysis indicated that both frequency and time point had a significant effect on the response variable. However, Levene's test indicated the assumption of homoscedasticity was violated. Additionally the data seem non-normal. Here is the output:
Based on the standard deviations, Levene's test, and the residuals vs predicted plot, it seems as though the data are quite heteroscedastic.
My question is what should I do to analyze these data in the 2-way ANOVA?
My first thought was to transform them to make the variances equal, but this answer seems to suggest when sample sizes are equal, heteroscedasticity can be ignored? I've read there are other problems with transforming data as well. Also, I only have SPSS and Graphpad Prism at my disposal, so please no suggestions that require using R, Stata, Python, etc.
Comment: You might do even better by predicting the reciprocal of the response.
Comment: Welcome to our site. Your plot is almost tantamount to a spread-vs-level plot.  The near-linear increase of the SD with the predicted value strongly indicates performing an ANOVA of the log responses.  Would that be meaningful for your study and have you tried it?
Comment: @whuber Thanks for the welcome. I did try a natural logarithm transformation, and the residuals vs predicted look like this: https://i.imgur.com/yQ1BV2D.png. Whether it is meaningful is a good question. I believe so? The response variable is change in fluorescence, so a greater/lesser ln(Y) would still mean a greater/lesser change in fluorescence.
Comment: This transformation worked quite well. Levene's test is no longer significant, and more importantly the residual plot looks much more homogeneous https://i.imgur.com/pPgMJvx.png. I'll explore this and the answer I accepted and see which one works best for my purposes. Thanks.
Comment: For an account of the technique, see https://stats.stackexchange.com/a/74594/919.
Answer: Thanks for showing key output. For several reasons, I think the
conclusions from your ANOVA are valid, even though some assumptions
are not met.
Frequency effect: First, just from the information you gave, I can see that at Time 7
Frequencies 1 & 2 differ. Because this is just a two-sample t test,
I can choose the Welch version which does not assume equal variances.
This can be done by hand from formulas, but I did it in Minitab.
You can see that this is the Welch (separate-variances) test because
DF = 8 (instead of 16). [Welch has DF between 8 and 16, lower to the extent that sample SDs differ.] Even with this "loss" of DF, the P-value is very small.
Two-Sample T-Test and CI

Sample  N    Mean   StDev  SE Mean
1       9  1.0000  0.0840    0.028
2       9   1.730   0.342     0.11

Difference = μ (1) - μ (2)
Estimate for difference:  -0.730
95% CI for difference:  (-1.001, -0.459)
T-Test of difference = 0 (vs ≠):
    T-Value = -6.22  P-Value = 0.000  DF = 8

Similarly frequencies differ very significantly at Time 10:
Two-Sample T-Test and CI

Sample  N   Mean  StDev  SE Mean
1       9  1.420  0.198    0.066
2       9  2.030  0.407     0.14

Difference = μ (1) - μ (2)
Estimate for difference:  -0.610
95% CI for difference:  (-0.942, -0.278)
T-Test of difference = 0 (vs ≠):
    T-Value = -4.04  P-Value = 0.002  DF = 11

Again at Time 14, frequencies differ very significantly. P-value < 0.0005.
Summarizing the Frequency-effect, there is no problem declaring results for Frequencies 1 and 2
to differ across time points (consistently smaller for Frequency 1) because all three P-values are so small.
If you want to compare results for several different treatment combinations,
you could look at 99% confidence intervals for pairs of the six cell means. They would
be of the form $\bar X_{ij} \pm 2.306 S_{ij}/\sqrt{9}$ or $\bar X \pm 0.77\,S_{ij}.$
For example the 99% CI for the population mean in the cell for Frequency 1 at Time 7
is $1.0 \pm 0.06.$
You could make several Bonferroni comparisons at levels around 95%.
qt(.975, 8)
[1] 2.306004
2.3/3
[1] 0.7666667

Time effect: Now for the time effect, you can do a two one-way ANOVAs with all of your data: first 27 observations for Frequency 1, then second 27 for Frequency 2. Preferably, you would use the version
that allows for unequal variances. I hope that version is available in SPSS.
However, because this is an balanced design, the standard ANOVA is easy to do based on information you provide.
For Frequency 1: MS(Factor) is the variance of the three sample means multiplied by 9. Also, MS(Error) is the mean of the three sample variances. Using R mainly as
a calculator, I got the following results. MS(Factor) = 0.6517 with DF = 2
and MS(Error) = 0.0231 with DF = 24, and F = 36.29, which greatly exceeds
the critical value 5.61 for a test at the 1% level; the P-value is less
than 0.0005.
msf = 9*var(c(1.1, 1.42, 1.71)); msf
[1] 0.8379
mse = mean(c(.084, .193, .158)^2); mse
[1] 0.02308967
f = msf/mse;
[1] 36.28896
1 - pf(f, 2, 24)
[1] 5.546266e-08
qf(.99, 2, 24)
[1] 5.613591

You can do the same for Frequency 2.
Comments on assumptions: Heteroscasticity. From your residual plot we can see that variance
differ considerably for among the $2 \times  3 = 6$ treatment combinations.
Thus it is a good idea to look at procedures that do not assume equal variances.
However, because this is a balanced design (9 replications in each cell)
and effects seem convincingly large, it seems reasonable to assume significance, if not to rely on specific difference in post-hoc tests.
As you say, you might seek a transformation to make cell variances more nearly equal, but that can make post hoc comparisons awkward.
Normality. I am not sure how SPSS does the Shapiro-Wilk test for ANOVA
designs. It would be incorrect to expect the 45 original data values to be collectively normally
distributed because, even if individually normal, they would have a mixture distribution
of normals with six potentially vary different means. (A mixture distribution of normals with different means is need not be even nearly normal.)
The correct way to
assess normality is by looking at residuals. Looking at your residual plot
I don't see departures from normality serious enough to ruin your ANOVA. You might want to test the residuals formally,
but with nine observations per cell and differences in cell mean as large
as yours I don't think the significant results of your ANOVA are in question.

Addendum: Curious to see what results for a Welch-type one-way ANOVA of various Times for Frequency 1 would give, I did a nonparametric bootstrap with data for the
three times modeled after sample means and SDs in your printout. (In R,
the procedure for a one-way ANOVA that does not assume equal variances is
oneway.test.) Sampling 100,000 datasets roughly like yours for Frequency 1,
I got an average P-value of $4.1 \times 10^{-7}$ and all P-values < 0.0005.
m = 10^5;  pv = numeric(m);  gp = as.factor(rep(c(7,10,14), each=9))
for(i in 1:m) {
  t.7 = rnorm(9, 1, .014); t.10 = rnorm(9, 1.4, .198);  t.14 = rnorm(9, 1.7, .158)
  all = c(t.7,t.10,t.14); pv[i] = oneway.test(all~gp)$p.val }
mean(pv);  mean(pv < .0005)
[1] 4.122535e-07
[1] 1

Note: I know you asked for no recommendations to use R, but this gives a
promising indication that an ANOVA you do in SPSS will give a significant result.
I would just point out that R is very good software, available without cost
at r-project.org. Some people hesitate to use R because they see so many
complicated things done with it. But there is no obligation to learn more
about R than you need for the task at hand (probably much like you're doing with SPSS), and there are numerous help sessions on line.
Comment: Good questions.  Actually, broke 2-way ANOVA into 3 t-tests and two one-way ANOVAs to handle possibly different variances. // I would do separate Bonferroni "families" for Frequency (3) and time (2). // Congratulations on getting feet wet with Python. Wishing you success with that and other statistical adventures.
Comment: Thanks for your response. Interesting, so you broke up the single 2-way ANOVA into 3 t-tests and a one-way ANOVA with unequal variances. I hadn't thought of this approach but it does the job quite well. Should the t-tests also be Bonferroni corrected? (although this will make little difference to significance). Re: your addendum, I have been feeling my lack of proper statistical software acutely, and I am planning to complete a Python data analysis tutorial this weekend. I've hesitantly settled on Python instead of R as I already have a fair amount of experience with Python.
Comment: If you want to try transformations, perhaps see this section of the [NIST handbook](https://www.itl.nist.gov/div898/handbook/pmd/section6/pmd624.htm). Note that the vertical scale of the 'Plot of Predicted Values' should be marked as log scale.
Comment: Thanks for the resource. The reciprocal transformation was successful, so I'll explore transforming the data and your method and see which one I end up preferring. Your method has the advantage that I don't have to graph the reciprocal of my response variable and confuse readers.
Comment: _Maybe_ it's OK to graph the original data and explain that the reciprocal transformation was a technical device to facilitate data analysis. Your differences are large enough that no one is going to doubt they're real. // Might show residual plots of orig'l and transf data side-by-side to show why transf was useful. // One major drawback of transformations is difficulty of explaining transformed scale to general audiences.


How to run drush make on remote using relative path?

Question: I'm writing a script where I'd like to run .make file, but it fails with the following error:
$ drush @remote.test make --no-core profiles/foo/contrib.make --yes
Calling proc_open(ssh drush@remote 'COLUMNS=278 drush  --verbose --yes --root=/var/www  make profiles/foo/contrib.make   --no-core 2>&1' 2>&1);
file_get_contents(profiles/foo/contrib.make): failed to open stream: No such file or directory make.utilities.inc:487

despite the file exists. I don't want to hardcode absolute path, as I'd like to use the same command for other remotes.
The command fails, because current directory of drush is set to HOME folder, instead of webroot (which is correctly passed internally via --root). This example could be related to issue where drush shell alias is downloading the project into wrong directory.
So the question is: How I can use drush make to execute .make file on remote host using relative path? As it seems to work fine on local.
I'm using drush 7.0-dev on local and remote.
Answer: For workaround, the following command should work:
$ drush @remote.test make --no-core $(drush @remote.test dd)/profiles/foo/contrib.make

Command drush dd will return the webroot path and pass it to outer command.
Answer: I had a slightly different problem of running drush from behat and needing to switch to a relative path (docroot) on different environments:
drush --root=$(pwd)/docroot [DRUSH COMMAND HERE]

where $(pwd) prints the working directory


Imprimir mais deu uma pagina PrintPageEventArgs C#

Question: Estou com uma dificuldade para adicionar uma segunda página em diante.... Eu recebo os dados de um DataGrid e na hora de imprimir os dados estão sobrepondo em uma única página...
Imagem com erro
<code> private void layout_validade(object sender, PrintPageEventArgs Relatorio)
        {
             int LinhaAtual = 0;

          for (int cont = 1; cont <= (dtgrid.NewRowIndex); cont++)
          {

            string Qtde = dtgrid.Rows[LinhaAtual].Cells[0].Value.ToString().ToUpper();
            string Lote = dtgrid.Rows[LinhaAtual].Cells[1].Value.ToString().ToUpper();
            string ean_cx = dtgrid.Rows[LinhaAtual].Cells[2].Value.ToString().ToUpper();
            string ean = dtgrid.Rows[LinhaAtual].Cells[3].Value.ToString().ToUpper();
            string Conferente = dtgrid.Rows[LinhaAtual].Cells[4].Value.ToString().ToUpper();
            string Receb = dtgrid.Rows[LinhaAtual].Cells[5].Value.ToString().ToUpper();
            string registro = dtgrid.Rows[LinhaAtual].Cells[6].Value.ToString().ToUpper();
            string Codigo = dtgrid.Rows[LinhaAtual].Cells[7].Value.ToString().ToUpper();
            string Descricao = dtgrid.Rows[LinhaAtual].Cells[8].Value.ToString().ToUpper();
            string validade = dtgrid.Rows[LinhaAtual].Cells[9].Value.ToString().ToUpper();
            string Sequencia = dtgrid.Rows[LinhaAtual].Cells[10].Value.ToString().ToUpper();

            float esquerda = (float)Relatorio.MarginBounds.Left;
            float topo = (float)Relatorio.MarginBounds.Top;
            float direita = (float)Relatorio.MarginBounds.Right;
            float inferior = (float)Relatorio.MarginBounds.Bottom;
            float altura = (float)Relatorio.MarginBounds.Height;
            float linesPerPage = 0;
            String line = null;

            Font font_Times_Codigo = new Font("Arial black", 95);
            Font font_Times_Descricao = new Font("Times New Roman", 30f);
            Font font3_Verdana = new Font("Verdana", 22f, FontStyle.Bold);
            Font font4_verdana = new Font("Verdana", 200f, FontStyle.Bold);
            Font font5_timeNewRoman = new Font("Times New Roman", 20f);
            Pen Linha_principal = new Pen(Color.FromArgb(128, 128, 128), 3f);
            Pen Linha_secundaria = new Pen(Color.FromArgb(128, 128, 128), 1f);

            linesPerPage = altura /
            font_Times_Codigo.GetHeight(Relatorio.Graphics);

          Rectangle caixa_codigo = new Rectangle(340, 10, 800, 350);// ESQ , TOP , LARG , COMP
          Rectangle caixa_imagem = new Rectangle(10, 10, 350, 170);// ESQ , TOP , LARG , COMP
          Relatorio.Graphics.DrawString(Codigo, font_Times_Codigo, Brushes.Black, caixa_codigo, new StringFormat());//Código
          Relatorio.Graphics.DrawString(Descricao, font_Times_Descricao, Brushes.Black, esquerda + 10, topo + 185f, new StringFormat());//Descrição

            if (comboBox_embresa.Text == "GIMBA")
            {
                Relatorio.Graphics.DrawImage(Properties.Resources.GIMBA, caixa_imagem);

            }
            else
            {
              Relatorio.Graphics.DrawImage(Properties.Resources.IDEIALOG, caixa_imagem);
            }

            Relatorio.Graphics.DrawLine(Linha_principal, esquerda, 185, direita, 185);//linha acima da descrição
            Relatorio.Graphics.DrawLine(Linha_principal, esquerda, 190, direita, 190); //linha acima da descrição
            Relatorio.Graphics.DrawLine(Linha_secundaria, esquerda, 244, direita, 244);//linha abaixo da descrição

            Relatorio.Graphics.DrawLine(Linha_principal, esquerda, topo, direita, topo);
            Relatorio.Graphics.DrawLine(Linha_principal, esquerda, topo, esquerda, inferior);
            Relatorio.Graphics.DrawLine(Linha_principal, esquerda, inferior, direita, inferior);
            Relatorio.Graphics.DrawLine(Linha_principal, direita, topo, direita, inferior);
            Relatorio.Graphics.DrawRectangle(Linha_secundaria, esquerda + 0f, 244, 235f, 305);
            Relatorio.Graphics.DrawRectangle(Linha_secundaria, esquerda + 0f, 244, 980, 305);
            Relatorio.Graphics.DrawRectangle(Linha_secundaria, esquerda + 0f, 244, 500, 50);
            Relatorio.Graphics.DrawRectangle(Linha_secundaria, esquerda + 0f, 244, 500, 110);
            Relatorio.Graphics.DrawRectangle(Linha_secundaria, esquerda + 0f, 354, 600, 60);
            Relatorio.Graphics.DrawRectangle(Linha_secundaria, esquerda + 0f, 244, 980, 110);
            Relatorio.Graphics.DrawRectangle(Linha_secundaria, esquerda + 0f, 244, 980, 170);
            Relatorio.Graphics.DrawRectangle(Linha_secundaria, esquerda + 0f, 244, 980, 240);

            Relatorio.Graphics.DrawLine(new Pen(Color.FromArgb(60, 60, 60), 60f), esquerda, topo + 590f, direita, topo + 590f);
            Relatorio.Graphics.DrawString("Validade", new Font("Arial black", 45f), Brushes.White, esquerda + 400, topo + 546f, new StringFormat());
            Relatorio.Graphics.DrawLine(Linha_principal, esquerda, 565, direita, 565);//linha validade
            Relatorio.Graphics.DrawLine(Linha_principal, esquerda, 570, direita, 570);//linha validade

            float dim_65 = 65f;
            float dim_240 = 240f;
            float TOP_1 = 355f;
            float ESQ_1 = 0f;
           // int lista = 0;
            int contador = 1;

            for ( int lista = 0; lista <= contador; lista++)
            {
                for (int index_lista = 0; index_lista <= contador; index_lista++)
                {
                            if (lista == 0)
                            {
                             Relatorio.Graphics.DrawString(this.tab_lote[index_lista], font3_Verdana, Brushes.Black, esquerda + ESQ_1, TOP_1 - 110, new StringFormat());

                            }
                            else
                            {

                                switch (index_lista)
                                {
                                    case 0:
                                        Relatorio.Graphics.DrawString(Qtde, font3_Verdana, Brushes.Black, esquerda + ESQ_1, TOP_1 - 110, new StringFormat());// qtde // lote // re // caixa
                                        break;
                                    case 1:
                                        Relatorio.Graphics.DrawString(Lote, font3_Verdana, Brushes.Black, esquerda + ESQ_1, TOP_1 - 110, new StringFormat());// qtde // lote // re // caixa
                                        break;
                                    case 2:
                                        Relatorio.Graphics.DrawString(ean_cx, font3_Verdana, Brushes.Black, esquerda + ESQ_1, TOP_1 - 110, new StringFormat());// qtde // lote // re // caixa
                                        break;
                                    case 3:
                                        Relatorio.Graphics.DrawString(ean, font3_Verdana, Brushes.Black, esquerda + ESQ_1, TOP_1 - 110, new StringFormat());//UNIDADE
                                        break;
                                    case 4:
                                        Relatorio.Graphics.DrawString(Conferente, font3_Verdana, Brushes.Black, esquerda + ESQ_1, TOP_1 - 105, new StringFormat());
                                        Relatorio.Graphics.DrawString(string.Format("Data{0}Recebimento: ", "\r\n"), font3_Verdana, Brushes.Black, 505, 255, new StringFormat());
                                        Relatorio.Graphics.DrawString(Convert.ToDateTime(Receb).ToString("dd/MM/yyyy"), font3_Verdana, Brushes.Black, 745, 294, new StringFormat());
                                        Relatorio.Graphics.DrawString(string.Format("RE: ") + registro, font3_Verdana, Brushes.Black, 610, 370, new StringFormat());
                                        Relatorio.Graphics.DrawString(Convert.ToDateTime(validade).ToString("dd/MM/yyyy"), new Font("Arial black", 126), Brushes.Black, -0, topo + 565f, new StringFormat());
                                        Relatorio.Graphics.DrawString(string.Format(" - ") + Sequencia, font3_Verdana, Brushes.Black, 410, 310, new StringFormat());
                                        break;
                                }
                              }

                            TOP_1 += dim_65;
                            contador = 4;
                          }

                            ESQ_1 += dim_240;
                            dim_240 = 290f;
                            TOP_1 = 355f;
                            contador = 1;
              }
                 LinhaAtual++;

                 if (LinhaAtual <= dtgrid.NewRowIndex)
                     Relatorio.HasMorePages = true;
                 else
                     Relatorio.HasMorePages = false;
          }
        }

</code>
Answer: Consegui o resultado que queria: depois de alguns dias...
Troquei o primeiro For por uma While e fim do do segundo For, adicionei um if:
<code>                 if (cont <= pags)
                  {
                    LinhaAtual++;
                    cont++;
                    Relatorio.HasMorePages = true;
                    break;
                   }
</code>
e fora do While finalizei com um outro if
<code>        if (cont > pags)
          {
              Relatorio.HasMorePages = false;
              cont = 1;
              LinhaAtual = 0;
            }
</code>


Math Contest Question with Polynomials

Question:
Prove that there does not exist a polynomial f(x) with integer coefficients for which f(2008) = 0 and f(2010) = 1867.

This is a question from CMOQR (Qualifier for Canadian Math Olympiad , not the national Olympiad itself). This contest is from 2009 but they do not have solutions posted to it.
I had an idea to solve this problem but wasn't sure if it was logically correct.
I said to start with f(x) in the form: $f(x) = (a_0 + a_1x^1 + a_2x^2 + ... + a_{n-1}x^{n-1} + a_nx^n)$ then convert it to $f(x) = a(x-2008)(b_0 + b_1x^1 + b_2x^2 + ... + b_{n-1}x^{n-1})$ since x = 2008 was a root of f(x). If I plug in x = 2010 into f(x), f(2010) would contain the linear term (x - 2008) = (2010 - 2008) = 2, which would in the product form of f(x) would lead to f(x) being even. Thus, f(2010) $\not=$ 1867 since 1867 is odd, not even.
Can anyone confirm if this is right? Thank you very much.
Comment: Your approach to the problem looks like a good one!
Comment: You do not need the $a$ in $f(x) = a(x-2008)(b_0 + \cdots)$, though it does no harm
Comment: Note that the function has the same parity at both points. This is much easier to show than in your approach.  And we don't even need to do it in general. Since our test points is even, the parity is the parity of the constant term.
Answer: For any polynomial with integer coefficients and any integer $x$, $f(x+2) \equiv f(x) \mod 2$.
Answer: Since $f(2008)=0$, the constant term is even. But then $f(2010)$ is even.
Remark: Yours is also a parity argument, and it is correct. It uses a little more machinery than necessary, and would require some modification if we had say $f(2008)=444$.
Comment: Thank you for the answer. However, how would I prove the parity of polynomials?
Comment: It might be unnecessary to prove, it is so obvious. Or else $f(x)=a_0+xg(x)$ for some $g$ with integer coefficients. If $x$ is even, so is $xg(x)$, and therefore $f(x)$ has the same parity as $a_0$. Or else you can use congruence notation.
Comment: Was it the COMC or the Repechage?
Comment: It was the Repechage. I couldn't find the solutions for 2009 contest. Thank you for your help!
Comment: You are welcome, and may things go well in any contest you take part in.
Answer: It's a generally useful fact that $(m-n) \mid f(m)-f(n)$ for any polynomial in $\mathbb{Z}[x]$. We can apply this here:
Suppose that $f(2008)=0$ and $f(2010)=1867$. But then $2 \mid 1867$, which is false.

Math Contest Question with Polynomials


Defasagem do Visual Studio 2010

Question: Sou iniciante em programação e consegui um material de estudo muito bom para o Visual Studio 2010. A minha dúvida é se essa versão do pacote está muito desatualizada em relação a versão 2013. Por hora, estou apenas interessado em aprender a linguagem C# para o desenvolvimento de sistemas ERP.
Comment: Na verdade, o ideal seria nem se preocupar com o Visual Studio. Não é ele que faz programas funcionarem. Ele é apenas uma ferramenta que ajuda ser produtivo. Se você tentar aprender o VS, seu conhecimento será capenga. A linguagem é o mais importante, depois o .Net. E aí a diferença é mínima. Aprender a IDE como componente mais importante é o caminho para aprender tudo errado.
Comment: A lista de diferenças é extensa, portanto o recomendável é tentar adaptar as lições do VS2010 para a versão mais recente e caso algo não seja possível de fazer, ai sim, você deve criar uma questão mais específica. Se está defasado: SIM... mas não é tanto assim, que não possa ser usado como material de aprendizado.
Comment: Obrigado pela resposta. Isso que você disse também se aplica aos comandos da linguagem C# ou eles permanecem os mesmos na versão 2013?
Answer: Você pretende usar o material do VS 2010 e instalar e usar o VS 2013?
Usando o 2013
Se for isso, não é para ser tão problemático. Claro que eles são diferentes, mas essencialmente eles fazem a mesma coisa. Você vai ter que se adaptar. Algumas coisas terão aparência um pouco diferente. Mas você consegue se adaptar, certo? Se não conseguir, se a única forma de aprender for seguir a receita de bolo do seu material, então a diferença entre versões será o menor dos seus problemas.
Neste caso existe a vantagem de poder usar o Visual Studio 2013 Community que é o antigo Professional que a Microsoft providenciou gratuitamente.
Hoje já é para se pensar no VS 2015 ou 2017.
Usando o 2010
Se for instalar e usar o VS 2010 para seguir o material de estudo fielmente, então não há problema. Claro que você não terá algumas ferramentas mais novas no 2013, mas e daí? Você está aprendendo, vai levar anos para aprender tudo o que precisa. Pode aprender as novidades das versões mais recentes depois.
O que é importante para aprender
Mas vou ressaltar que o Visual Studio é apenas uma ferramenta. Ele ajuda a ter produtividade, mas ele sequer é necessário para se programar em C# e utilizar o .NET.
Se você acha que a melhor forma de estudar programação em C# é estudar como o Visual Studio funciona, você terá problemas.
O mais importante é aprender a linguagem e em seguida a biblioteca básica da linguagem contida no .NET. Entender o funcionamento de toda plataforma do .NET (não toda biblioteca) que tem especificidades importantes é mais importante que aprender qualquer ferramenta que ajude programar.
Mas antes disso, aprender a programar, entender os conceitos adotados no desenvolvimento de software como um todo, é a fundação para tudo. Não sei o quanto já tem experiência na área, mas se ainda está começando, esqueça tecnologias por enquanto.
C#
O compilador de C# que normalmente é usado com o Visual Studio 2010 está na versão 4. Em tese é possível usar um compilador mais novo, mas nunca tentei e não sei o quanto é difícil fazer isto. De qualquer forma o Visual Studio não teria todas as facilidades que podem ajudar as versões mais modernas. Mas nada muito importante.
Já o Visual Studio 2013 conta com o compilador do C# 5. Você pode usar outras versões mais antigas se desejar, sem nenhum prejuízo.
A diferença básica do C# 4 para o C# 5 é o uso de blocos assíncronos através das palavras chave await e async. Na maior parte da sua aprendizagem não vai precisar disso. Só quando estiver bem avançado é que terá condições de entender e criar códigos úteis com este conceito.
Também existe o recurso de atributos de informação de métodos chamadores, que é algo de utilidade muito específica e também só terá necessidade quando estiver dominando todo o resto.
Há uma mudança um pouco maior no C# 6 que vem com o Visual Studio 2015. Mas não se preocupe com isso. O que importa é que sempre vai ter uma versão nova, sempre terá algo novo para você aprender.
Outro ponto importante é que existe o Visual Studio 2013 Community que é bem completo para a maior parte das necessidades e é totalmente gratuito.
.NET
O normal do VS 2010 é usar o .Net 4.0, embora você possa escolher um perfil para outras versões. Isso é algo que você vai aprender com a plataforma.
Por padrão o .Net usado no VS 2013 é o 4.5.1, mas nada impede de usar o 4.0 ou outra versão. Simultaneamente.
Algumas das principais novidades na biblioteca na versão 4.5.1:

Permite criar aplicação apara Windows Store usando a API WinRT.
Tem recursos que suportam o uso dos recursos extras da linguagem (assincronicidade e caller info attribute).
Possui o Managed Extensibility Framework.
Novas versões de vários frameworks como no ASP.Net por exemplo (seria muito extenso falar em detalhes sobre cada um).
Melhorias diversas em nas bibliotecas que lidam com redes.
Melhorias em classes específicas como RegEx, AppDomain, Console, Zip compression, etc.

Como dá para perceber, nada muito expressivo. Ninguém sabe tudo de todo o .NET, então não importa. Decorar biblioteca é contraprodutivo, então é até melhor ir deixando os detalhes para depois.
De qualquer forma nenhum material de estudo, por melhor que seja, vai ensinar tudo o que tem para aprender.
Diferenças do Visual Studio
O VS 2010 (versão 10.0) e o VS 2013 (versão 12.0) possui de cara uma interface gráfica bem diferente, baseada mais no visual do Windows 8. Mesmo quando não está rodando nele. Há inclusive muita polêmica se ficou melhor ou pior.
A quantidade de ferramentas novas e melhoradas, principalmente se considerar os recursos de ciclo de vida de produto e não só no desenvolvimento mais direto do software, são tão grandes que a resposta precisaria de um capítulo de um livro.
Mas isso não é importante. Como eu disse antes, ele é apenas uma ferramenta, que ajuda muito, mas é a parte menos importante do que você tem que aprender. E novamente digo que tem tanta coisa para aprender nele, vai levar tanto tempo para aprender tudo, que não faz diferença qual versão está usando. Só não vá usar uma versão muito antiga.
Todas essas ferramentas novas e melhoradas são ótimas se você souber muito bem como programar em C#, ter o domínio do .NET e outras tecnologias relacionadas. Sem isso, as ferramentas (ou mesmo as antigas, mas principalmente as novas) não servem para nada.
Eu particularmente usaria a versão mais nova mesmo tendo um material mais velho, embora eu também procuraria um material mais novo. Mas note que eu sei me virar bem com qualquer coisa que eu tenha em mãos. Nem todo mundo consegue fazer a adaptação necessária quando encontra um ícone ou um nome diferente do que está no material de estudo, quando a posição ou cor de elementos é diferente. Claro que este tipo de adaptação será necessário para qualquer desenvolvedor profissional.
Nem vou recomendar nada porque este não é o objetivo do SOpt. Eu lhe dei subsídios para decidir por conta própria.
Finalmente
Não importa o que você vai fazer com o C#, ERP, aplicação científica, jogo, etc. O caminho inicial é o mesmo.
Não sei qual o material de estudo que você tem, mas um livro muito bem estruturado, conceituado, que realmente seja didático é o caminho. Se o material que você tem é apostila, tutorial, vídeos, coisas soltas, provavelmente vai começar errado.
Comment: Esses videos curtos normalmente não ensinam ninguém programar. Então não faz diferença se você está usando uma versão nova ou uma antiga. É só uma introdução do básico do básico. Se você achar que dezenas de horas de vídeos vão te ensinar mais que 1% (que já é muito) do que precisa para desenvolver sistemas, vai ficar com uma formação extremamente deficiente.
Comment: Livros completos. Você consegue ler razoavelmente em inglês? è o ideal. Tem algumas traduções de livros bons mas que em português eles ficam bem piores. Longe de dizer que é uma formação completa, mas livros com entre 1000 e 2000 páginas já ajudam bem. Eu não os segui porque não sou iniciante há muito tempo, mas o pessoal costuma indicar o C# How to Program do Deitel e o Head First (bem focado na didática) que no Brasil se chama Use a Cabeça. Depois disso precisará ir atrás de livros mais avançados, e sobre outros assuntos. Tem que ler todos os clássicos da computação.
Comment: Bigown, obrigado pela dedicação ao me responder.

Depois dessas explanações, acho que seguirei sua sugestão de fazer uso do VS2013. Somente se o estudo complicar com essa versão eu recorro ao VS2010 – o que eu torço que não aconteça.

O material de estudo que eu tenho são as videoaulas de C# básico (WA1) e C# avançado (WA2) do site Treinamentos TI – o qual eu espero que me capacite atuar na área de desenvolvimento ou, pelo menos, me deixe bem próximo dessa meta.
Comment: Bom, eu só opinarei sobre isso que você disse depois que tiver terminado o estudo. Outros programadores elogiaram essas videoaulas. De qualquer forma, qual a sua dica para uma formação não deficiente?
Comment: Eu já passei em dois exames Microsoft em inglês, então, acho que posso dizer que consigo ler razoavelmente textos nessa língua.

Eu imaginava que você fosse dizer livros. Esses dois que você indicou, eu me deparei com eles nas minhas pesquisas. Depois que terminar com as videoaulas, definitivamente, vou partir para eles. Obrigado pelas dicas.

Defasagem do Visual Studio 2010


How to configure asp to render attributes in defined order

Question: In asp if we set
<button class="classA" id="myId"/>

it will render
<button id="ctl00_myId" class="classA"/>

Some times id can be bery long like ctl_00_placeholder1_ctl01_placeholder2....myId
and when we look on node tree in devtools in browsers it is more convenient to have class first.

Is there any way to configure asp to render server control's attributes in order that we define?
Answer: I'm not sure how to force the attributes to render in order but if you set your client id mode to static the id won't append all the add values to the id.
<%@ Page ClientIDMode="Static" %>

This will make it easier to read in browser dev tools.
Comment: yeah I know about this, but this will make id static and if we have many partials on page and all have static id, they may conflict.


Average of Most Recent 100 SQL Database Entries

Question: SELECT     DC_GRP.dc_grp, DC_GRPX.reqt_id,
           AVG(RESULTS.[var]) AS Average, STDEV(RESULTS.[var]) AS StdDev
FROM RESULTS INNER JOIN...

Currently I am pulling all of the var fields out of RESULTS, but I only need to get the most recent 100. How can I only call the most recent 100 within that AVG( ) call?
Comment: Could you give a more complete example? You want all rows, but only the average of the last 100? Or do you also want to limit the number of rows fetched to 100? Also, please define "most recent", I can't see an obvious time order.
Answer: Assuming you have a column to define the most recent, you can do this with a subquery:
SELECT     DC_GRP.dc_grp, DC_GRPX.reqt_id,
           AVG(r.[var]) AS Average, STDEV(r.[var]) AS StdDev
FROM (select top 100 * from RESULTS order by CreatedAt desc) r INNER JOIN...

This example assumes the name of the column is CreatedAt.


Principal argument of $-2i$

Question:
How to write the principal argument of $-2i$ ?

I cannot just write $-\pi/2$, altough it is obvious, I have to justify it somehow. Can I say that $\lim\limits_{x\to 0}\arctan\left({\frac {-2}x}\right)$ ?
Comment: If it is obvious why cannot you "just write that"? It **indeed** is obvious, in particular if you already defined the principal argument as an angle in $\;[0,2\pi)\;$ .
Comment: I agree with @Timbuc.  I would simply write "obviously $\operatorname{Arg}(-2i) = -\pi/2$", perhaps noting that it lies on the negative imaginary axis.
Comment: @Timbuc the interval is $(-\pi, \pi]$
Comment: @OBDA That's fine just as well: exactly the same.
Comment: @Timbuc OK, I agree, shall I delete the question ?
Comment: @OBDA Not at all. These things can help others as well with little doubts. In fact, I forgot to upvote your question, so now I do it.
Comment: @OBDA It depends on how you calculate the principal argument, but usually it is done by [atan$2$](http://en.wikipedia.org/wiki/Atan2#Definition_and_computation), from which it, of course, is obvious.
Answer: By definition, for any branch of the logarithm function determines a branch of the complex logarithm and vice versa, via
$$\arg z = \Im \log z$$
Now, if we take the branch of $\arg$ that takes values in $(-\pi, \pi]$, then for complex numbers $w$ with imaginary part in that range, we have $\log \exp w = w$. In particular, if we can find such a $w$ such that $\exp w = -2i$, then we will have
$$\arg (-2i) = \Im \log (-2i) = \Im \log \exp w = \Im w.$$
Now, certainly $$w = \log 2 - \frac{\pi}{2} i$$ satisfies these conditions, so $$\arg (-2i) = -\frac{\pi}{2}$$ as desired.
NB that the argument doesn't depend on the real part of $w$, so it is enough to determine the imaginary part of a $w$ that meets the criteria.

Principal argument of $-2i$


What is the difference between Qt event handler and boost ASIO's io_service?

Question: Both are asynchronous event handlers with an event loop. That's the head line.
In Qt an event loop starts with QApplication::exec(), and with io_service starts with io_service::run(). My question is after this point. What are the things that I can achieve in Qt and not in io_service and vice-versa? What are the limitations? When is either preferable (ignoring Qt's GUI)?
More unimportant info: What triggered this question in my mind is that I was testing some C++ Qt-based program, where I have the logic of my GUI in a class derived from a QObject. For my testing purposes I was looking for ways to post functions (like in io_service) to the Qt event handler (so, bypassing the QObject::connect() thing for simplicity), but then realized that the only posting function QApplication::postEvent();, takes only Qt events as parameters; not functions, functors or lambdas! I didn't ask about that because that's an obvious XY problem, and I'm still working on it.
Answer: I don't think there's any major difference between QObject and io_service. As for your XY problem question, QMetaObject::invokeMethod(obj, []{}) accepts a lambda.