webmatrix and ASP.NET Web Helpers Library 1.1

Question: Can someone explain what happens when you install this package
Is it just a dll that is added somewhere?
Also is it possible to view the source for the helpers contained in this package.
Have searched the web but cant see any reference to source
thanks
Answer: Yes, the assembly is added to your WebMatrix project. You must install the helper library from the feed into each project that needs the helper library functionality (details below). The ASP.NET Web Helpers Library 1.1 includes several helpers, most of these helpers are explained in the WebMatrix online book at www.asp.net/webmatrix. The ASP.NET Web Helpers Library 1.1 also installs the Twitter helper and the Facebook helper. If you wish, you can install the Twitter helper and the Facebook helper independantly. You can view the assembly using Reflector, or if you have Visual Studio you can use the Visual Studio Object Browser, see the post Understanding WebMatrix Helpers using Visual Studio's Object Browser for more details. There's also the managed reference content on MSDN that will help you navigate the helper library code, see the Microsoft.Web.Helpers Namespace for details. The descriptions will be updated soon, however the syntax is all available now.
The following procedure shows how to use the Administration tool to install the ASP.NET Web Helpers Library. You will use some of these helpers in this tutorial and other tutorials in this series.
1.In WebMatrix, click the Site workspace.
2.In the content pane, click ASP.NET Web Pages Administration. This loads an administration page into your browser. Because this is the first time you're logging into the administration page, it prompts you to create a password.
3.Create a password.
After you click Create Password, a security-check page that looks like the following screen shot prompts you to rename the password file for security reasons. If this is your first time to see this page, do not try to rename the file yet. Proceed to the next step and follow the directions there.
4.Leave the browser open on the security-check page, return to WebMatrix, and click the Files workspace.
5.Right-click main project folder for your site and then click Refresh. The list of files and folders now displays an App_Data folder. Open that and you see an Admin folder. The newly created password file (_Password.config) is displayed in the ./App_Data/Admin/ folder.
6.Rename the file to Password.config by removing the leading underscore (_) character.
7.Return to the security-check page in the browser, and click the Click Here link near the end of the message about renaming the password file.
8.Log into the Administration page using the password you created. The page displays the Package Manager, which contains a list of add-on packages.
9.Find the ASP.NET Web Helpers Library 1.1 package, click the Install button, and then install the package as directed. When you install the ASP.NET Web Helpers library, the Package Manager also installs the FaceBook.Helper 1.0 library.
Answer: A bin folder is created and a DLL is added to it. You can use Reflector to look at the decompiled source code, although Reflector will not last long so you had better hurry. the docs for a number of the helpers can be found here


What is redstone for?

Question: Every time I mine I either find redstone, coal or iron. I understand coal and iron but what is the purpose of redstone?
Comment: minecraft is very open ended, you may or not may not need things that need redstone however that doesn't mean to say it has no purpose and a lot of people to use redstone because it's needed for compasses which in turn is needed for maps, also watches help people mine deep underground and know when it's now daytime for them to come up and keep surfice materials, you may want to read up on the Wiki people keep adding in their answers
Answer: Redstone is used for several items such as compasses (surround a redstone with iron) and watches (surround a redstone with gold) and an ingredient in extending the length in potions.
More importantly, it is used to make redstone wire when placed on the ground. This can transfer the energy produced by, for example, a lever to a door several metres away. This is only the simplest use for it- more complex uses include traps, automatic reed farms, locks and even a simple calculator.
For more information, check the wiki: https://minecraft.wiki/w/Redstone

What is redstone for?


Last words before death

Question: Hello I have been trying to find thr answer to this question on islam stack exchange google everyrhingof this question a lot and havent found an answer.
question:Should i say la il a ha illalahu before i pass away or ashhadu an la ila ha
Answer: The hadith does not mentioned "Ash-hadu An." It only mentions "Laa Ilaaha Illa Allah."

Exhort to recite "لاَ إِلَهَ إِلاَّ اللَّهُ (There is no god but Allah)" to those of you who are dying. (Sahih Muslim)

However, I don't think adding "Ash-hadu An" makes much of a difference. It simply means "I testify that." It places emphasis on the statement.
Even when you add it, your last words are still "Laa Ilaaha Illa Allah."
Answer: It doesn't matter what you say: If your heart is loving Allah HE will receive you with joy. Because Allah knows our hearts. May Allah bless you
p.s. I wonder who voted down my answer. I have seen many persons close to death. Most of them were no more able to utter a word at the end. Yes, of course, you can say words according to sharia if you are fully present. But if it happens and your last words were different, this is nothing important. That is what I say.
Comment: Yes you right... Passing the life with Iman till the last period is the root thing... Allah is the most merciful...
Answer: Saying La Ilaha illallah is a good sign that we know from a hadith of "Abu Daud" amongst the Sihah Sittah. But that is only the luckiest peoples. But people not saying this may be included this luckiest part... People who are deaf, paralyzed with a side of forebrain are not able to speak. Again we know muslim people who die in accident, thunder or in a pandemic gain the value of "Shahada".
In general it is only a few lucky people who can recite people at the time during death. Muslims who are righteous but can't recite Shahada at the time of his death is not a bad sign and we have nothing to worry about him if he is truly righteous during his lifetime.
In the hadith which says people who declare Shahada before their death are only a few people of Divine people of the Akhirat...

Last words before death


Let $X, Y \subseteq \mathbb{R}$. Prove $\sup (X \cup Y ) = \sup\{\sup X, \sup Y \}$

Question: My teacher has not gone over the monotonicity theorem, but I suspect that this would be of great help. Could someone please help me understand if I can apply this to the question or correct me if I am mistaken? Thank you.
Comment: Is the left hand side supposed to be the supremum of $X \cup Y$?
Answer: You can just do this by the definitions. Let $\alpha = \sup\Big({\sup{X},\sup{Y}}\Big)$ and let $\beta = \sup(X\cup Y)$.
First, we show $\alpha \leq \beta$. There's a sequence in $X\cup Y$ converging to $\beta$. This sequence has infinitely many elements in either $X$ or $Y$. Without loss, assume it's $X$. Then $\sup X \leq \beta$. And $\alpha \leq \sup X $. So $\alpha \leq \beta$.
To show $\beta \leq \alpha$, any sequence in $X$ converging to $\sup X$ also a sequence in $X\cup Y$. So $\beta \leq \sup X$. Similarly, $\beta \leq \sup Y$. So $\beta \leq \alpha$.


Web interface for BIND DNS and DHCPD servers

Question: Currently we are using the BIND DNS and the standard DHCP server that comes with Linux (Scientific 6.4) as networking services on a private networking. Is there any some kind of a web interface that reads existing configuration files (/etc/dhcp/dhcpd.conf and /var/local/zone-name.zone) instead of manually writing to these files?
Answer: Use Webmin; it is a web interface with several modules that enables you to administer visually a lot of Linux services. It is very simple to use.
If you have multiple users, you can also create users with modules views, and some modules let you make further user restrictions.
At the DNS module level, you can even restrict them to specific DNS zones. For instance, user1 can only edit the zone xpto.com and restart the DNS server.
To install it in a RH flavoured distro:
yum install webmin

or in Debian:
apt-get install webmin


What is the proper way to include a PHP framework into my theme?

Question: I am using a Twitter Timeline PHP framework to display a list of tweets with favorite/retweet interactions. I have it all configured and working as a standalone solution currently and I am wondering what the best way to incorporate it into my custom Wordpress theme would be. Is it as simple as creating an inc folder, placing all the files in there and then adding <?php include_once('inc/twitter.php'); ?> into my template file where I want the tweets to display? Or is there a better practice?
Answer: It is that simple.  Code away!
if it's in a plugin I do this:
$plugin_url = plugin_dir_url( __FILE__ );
include_once($plugin_url . 'inc/twitter.php');

if it's in a theme file
include_once(get_stylesheet_directory_uri().'inc/twitter.php');

Comment: Great, thank you very much for the explanation of both methods!
Comment: FYI, using `get_stylesheet_directory_uri()` is incorrect because it will return the URL path to the file, not the path suitable for including the file. Also, it will return the path to the child theme if you have one, which you probably don't want happening either. Use `get_template_directory()` instead.
Comment: why on earth would you not want to use a child theme if you're custom coding?
Comment: If you're, you know, developing a theme? Where do you think parent themes come from?
Comment: Also, these days there's more useful functions: `get_theme_file_path( 'inc/twitter.php' )` and `get_parent_theme_file_path( 'inc/twitter.php' )`. Because the path to the file is an argument you can have a parent theme fallback for non template files.


How to make Raspberry Pi use an external USB sound card as a default

Question: Does anyone know how to change the sound card boot priority?
All tutorials are telling me to edit /etc/modprobe.d/alsa-base.conf, but the file is missing in Raspbian Jesse.
Comment: Upvote for coming right up in Google - June 2018
Answer: If you don't need the onboard audio chip (i.e. analog output or HDMI audio), disable it and then the USB audio device will become the primary audio device. These steps worked on Raspbian Jessie.

Disable onboard audio.

Open /etc/modprobe.d/raspi-blacklist.conf and add blacklist snd_bcm2835.

Allow the USB audio device to be the default device.

Open /lib/modprobe.d/aliases.conf and comment out the line options snd-usb-audio index=-2

Reboot

sudo reboot

Test it out.

$ aplay /usr/share/sounds/alsa/Front_Center.wav
Comment: The first step is crucial but I hadn't found it anywhere else.  Upvote.    The rest is outdated.  June 2018:  Already knew to go into `/usr/share/alsa/alsa.conf` and change it to say both `default.ctl.card 1` and `default.pcm.card 1` - then after all this, reboot and try `alsa -l` to see only the USB showing and that it is card #1.  I installed `mplayer` for the test and it is great.  They have locked this question to answers so here it is.
Comment: I updated the answer to use a different strategy for disabling onboard audio. This way is better because it doesn't break the desktop audio applet.
Comment: @SDsolar Glad to help. Though I don't think Step 2 is outdated? You have an alternate way to set the device as default. Good to know.
Comment: It could be a version issue.  For instance, my 16.04 LTS systems were both immediately upgraded from the 14.04 install CD.  So there are vestiges of both ways of doing things, particularly things involved with the boot process that changed under v15.  In my case, the modprobe.d files exist but they are all blank.  So in the end it is good that this answer shows both ways if you include my comment.  --> You definitely solved my biggest issue with `alsamixer` by blacklisting bcm2835.  I searched high and low and only your answer had that last piece of the puzzle.  TNX MCH
Comment: This solved my strandtest.py problem on my WS2812B LED Strip. This site led me to your working solution: https://tutorials-raspberrypi.com/connect-control-raspberry-pi-ws2812-rgb-led-strips/
Answer: The file you're looking for is located in /usr/share/alsa/alsa.conf.
It's not called alsa-base.conf, just alsa.conf.
All the relevant text is in that file. Just run sudo nano /usr/share/alsa/alsa.conf, change the default sound card to 1 or whatever you prefer (obviously, 0 is default so not that one). I also deleted the # from the line that says... load card-specific configuration files (on request) and now I have the sound coming from my cirrus audio card running Debian 8 Jessie on ras pi2.
Comment: Isn't "load card-specific configuration files (on request)" a comment?
Comment: I've done a few quick formatting fixes. Perhaps a copy of the relevant part of the alsa config file would make your answer even better.
Comment: It is indeed just a comment to explain the code block below it
Comment: Yep.  Partial answer.  Not enough authoritative info here for me to decide on upvoting.   ...and that line is a comment that is not executable.
 And the block itself is not commented out.
Answer: I had problems with this on recent versions of Raspbian (Jessie).
There is a file called aliases.conf in /lib/modprobe.d which contains the line options snd-usb-audio index=-2. That line overrides the /etc/modprobe.d/ files, so you need to change that one. Comment out with a # the line options snd-usb-audio index=-2
In /usr/share/alsa/alsa.conf I un-commented "load card-specific configuration files (on request)" and I also replaced the content of .asoundrc which is a hidden file in your home folder with:
pcm.!default plughw:Device
ctl.!default plughw:Device

The downside of this solution is the desktop sound applet won't appear. So to control volume use the alsamixer application or physical sound level buttons on the USB sound dongle.
References for this:

https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=124016&p=857433&hilit=usb+audio#p857433
http://alsa.opensrc.org/Asoundrc#Default_PCM_device.
Answer: I wasn't satisfied with the previous answers giving a bit ambiguous instructions, so I figured I would document a more clear solution.
A good post here shows how to test which device and card you are seeking to use.
Find your hardware device number and card number using aplay -l before and after pluggin your usb device in.
For my system, the usb device is listed as card 1: CODEC [USB Audio CODEC], device 0 ...
You can confirm the device is working with
aplay -D hw:1,0 InsertYourWavFileHere.wav
Make sure to copy a valid wav audio file into your current directory and rename appropriately. If this works, then you can hardcode these values such that they will become defaults for aplay among all other audio handled by alsa (most cases)
To edit your default values you alsa config file as others have stated:
sudo nano /usr/share/alsa/alsa.conf
The specific lines you will want to change are a few pages down. You can search with Cntl+W or just scroll down.
Change:
defaults.pcm.card 0
defaults.pcm.device 0
To:
defaults.pcm.card 1
defaults.pcm.device 0
Save the config file by pressing control+x, then nano will ask you to confirm your edits and you press Y and Enter.
Comment: Can you explain what you're talking about when you say, "copy a valid wav audio file into your current directory and rename appropriately"? Is this referring to the `aplay` command to "confirm the device is working"? Isn't it good enough to specify a valid wav audio file by its current name and full path?
Comment: @G-man Yes, specifying any wav audio file by its full or valid path should be fine.

In my particular example I had used `InsertYourWavFileHere.wav` but this could just as easily be replaced with `./audio/test.wav` if you had a wav file in the audio subdirectory named test.wav for example. If that were the case, then

`aplay -D hw:1,0 ./audio/test.wav`

should work just as well.
Answer: The method described here at the Raspberry Pi StackExchange worked for me. I am running Raspian Jessie.
The new piece of information was that I had to create a new .conf file and not edit /usr/share/alsa/alsa.conf:

To reorder my cards, I first create a file named /etc/modprobe.d/alsa base.conf.
  It can be named anything you want as long as it ends with .conf. I then added the following:

# This sets the index value of the cards but doesn't reorder.
options snd_usb_audio index=0
options snd_bcm2835 index=1

# Does the reordering.
options snd slots=snd_usb_audio,snd_bcm2835

Answer: I've given a full writeup here that covers all of the above and much more. Including clearing up some misconceptions and pitfalls in the ALSA config files.
The relevant essential is to disable the Broadcom audio module called snd_bcm2835 and make sure that snd_usb_audio is loaded fist and only.
This can be done in either of 2 ways.

In the /boot/config.txt file
In the module blacklist file.

Then set you ALSA config to point to the snd_usb_audio index.
Comment: Thanks for all this great info. This writeup brings all the other solutions together.
Answer: After change alsa.conf (defaults.ctl.card 1
defaults.pcm.card 1) and (load card-specific configuration files (on request)) you have to modify your asoundrc file and put in:
pcm.!default { type hw card 0 }
pcm.default.card 1.

It will be ok
Answer: I have tried lots of people's suggestions for config changes. Kodi continued to put audio out to hdmi. I finally found that Kodi has a setting in System | Audio which allows you to choose which audio card to output to! So obvious once you see it.


Number of ways to partition a set into three subsets with given sum.

Question: Given a set S, with n elements out of which if any element is repeating then it is repeated at maximum 2 times. How to count the number of ways in which S can be partitioned into 3 subsets such that the sum of elements in each subset is required to be A, B, C respectively which are given. Can there be a polynomial time algorithm for it ?
Comment: The simpler problem, given a set of $n$ integers, to partition it into 2 sets with equal sum, is already NP-complete.
Answer: Nevermind the number of solutions - even the existence of a solution is a difficult problem!
We see this by noting that the problem is at least as hard as the subset-sum problem. Specifically, letting $A=0$ means that we need some subset of the original set to sum to $0$, which is exactly the subset-sum problem.
The subset-sum problem is NP-Complete, so if there existed a polynomial time algorithm to solve your question then $P=NP$.
Comment: See also http://en.wikipedia.org/wiki/Partition_problem
Comment: @user155768: an exponential time solution is easy.  There are only about $3^n/6$ ways to partition the subsets, then sum each and see if it works.
Comment: Now i see it can't be solved in polynomial time. For smaller values of n, say <= 20, can we even have an exponential time solution to it ?


Need a Tcl library to read/write configuration files

Question: My Tcl application should read and store a lot of configurations parameters. I'd like to use regular disk file as a storage rather than registry or something else.
It would be great to store parameters hierarchically. All my parameters are strings, numbers, and lists of them. Configuration file(s) may be placed in directory (not only user's home). Normally application expects configuration file in the current directory.
Do you know any ready-to-use Tcl library?
More general question: what is the "Tcl-way" to read/write application configuration?
Thanks.
Answer: If the configuration does not necessarily need to be human-readable, I suggest you consider Sqlite -- it began as a Tcl extension, and therefore Tcl's Sqlite bindings are more mature than any other language's.
See: http://www.sqlite.org/tclsqlite.html
Answer: If you don't need random access (that is, configuration files are not huge and each can be slurped completely at once) and don't require processing by external tools, you could just use flat text files containing, say, Tcl lists.  The "trick" is that in Tcl each value must have a valid string representation (when asked) and can be reconstructed from its string representation.  You get that for free, that is, no special package is required and all you have to provide is some sort of structure to bind serialized values to their names.
To demonstrate:
set a "a string"
set b 536
set c {this is a list {with sublist}}

proc cf_write {fname args} {
  set fd [open $fname w]
  chan config $fd -encoding utf-8
  set data [list]
  foreach varName $args {
    upvar 1 $varName var
    lappend data [list $varName $var]
  }
  puts $fd $data
  close $fd
}

proc cf_read fname {
  set fd [open $fname]
  chan config $fd -encoding utf-8
  set data [read $fd]
  close $fd
  set data
}

set cfile [file join [file dir [info script]] conf.txt]
cf_write $cfile a b c
foreach entry [cf_read $cfile] {
  lassign $entry name value
  puts "$name: $value"
}

You'll get this output:
a: a string
b: 536
c: this is a list {with sublist}

Now if you feel like having something more fancy or "interoperable", look at YAML or JSON (you'll need to write a serializer for this one though) or INI formats--all available from Tcllib and hence are plain Tcl.
Even more fancier could be using XML via TDOM (an expat-based C extension). SQLite, which has been already proposed, is even more capable than that (provides random access to the data, is able to operate on huge data arrays). But it seems that for your task these tools appear to be too heavy-weight.
Note that my example deliberately opts to show how to store/restore an arbitrary ad-hoc list of variables so the cf_write procedure builds the Tcl list to be stored by itself. Of course, no one prevents you from building one yourself, providing for creation of hierarchical structures of arbitrary complexity. One caveat is that in this case you might (or might not) face a problem of deconstructing the restored list. But if you'll stick to a general rule of each element being a name/value pair as in my example, the deconstruction shouldn't be hard.
Comment: Another option for a hierarchical format would be tcllib [struct::tree](http://tcllib.sourceforge.net/doc/struct_tree.html) package, combined with the [treeql](http://tcllib.sourceforge.net/doc/treeql.html) package.
Comment: I wrote a JSON serializer, but it does some really nasty tricks that require 8.6.
Answer: tcllib contains a package inifile for handling windows .ini file format configuration files. As it's part of tcllib it should be avaialble on all platforms (I've just checked and it loads ok on my Solaris 8 box).  It allows you to both read and write .ini files and access the configuration by section and key.


How late in the day can my 2 year old nap?

Question: My 2 year old son is having a difficult time falling asleep for his daily nap, which was previously not an issue. He had been napping from about 11:45-1:45, but now he fights it desperately and won't fall asleep. I was thinking that it might help if we tried to nap later in the afternoon, but I'm worried that this will make going to bed at night (which is currently not a problem) an issue. Any suggestions?
Comment: I can't offer any specific information other than anecdotes, but my 2 year old can nap as late as 2pm to 4pm, with no adverse effects on bedtime at 7:30pm. Every child is different, though.
Comment: Try letting him sleep when it suits him and see how you get on? You will likely find he stops napping entirely soon, there's far too much interesting stuff going on in the day!
Answer: There is no hard and fast rule on this - all babies are different. With all three of mine, they would have a mid to late afternoon nap at that age and still went down at their usual bedtime, which was around 7pm for the girls (my son wanted and needed far less sleep than them, so had a bed time closer to midnight)
I'd suggest in your case that if he is currently too awake to nap at 11:45 try moving his nap time to half an hour or an hour later and see if he goes down more easily.
Answer: It depends on each kid also how far they slept well last night. Sometimes my toddler(21months) sleep bit late at night and wakes up around 7am and he wants a nap at 11am. If he is able to nap for 2-3hours at stretch, he doesn't need second nap. If he slept well last night, he takes one nap from 1PM to 3/4PM. The only thing I make sure he doesn't get fussy in day time especially during meals(he rejects meal if he feels tired). So I adjust it accordingly. I am sure his routine will change again in 3months because he is growing and he may have different demands.
Answer: A two year old needs between 11-14 hours of sleep. They have an average wake time of 5-6 hrs.
Hypothetical:
wake 7am,
nap 12-2
sleep 8pm
The most important aspect is that their nap is at least 5hrs before bedtime.


Ember.js Data Conflict Resolution / Failing on Conflict

Question: If using Ember.js with the ember-data REST adapter, is there some sort of conflict resolution strategy for handling persisting data to the server?
At the very least, for my case, failing and rolling back would be sufficient in the case of conflicts, if the user can be informed of this. So, would sort of data/structure would be required for this? Some sort of "version" id on the models, where the server can check the submitted versions, and make sure that the client had the most recent data. Is there anything in Ember.js to make this a bit less manual? And if so, what?
Edit: Also, is there anything that helps with conflicts of bulk commits of models? Say we have a parent model with a "hasMany" relationship to several child models, and all of them are to be persisted to the database at the same time. If just dealing with server-side code, I feel I could wrap this up on a transaction in whatever database I'm using, and fail if something is out of date. How does this translate to Ember.js transactions?
I see a flag bulkCommit in the Adapter class. This seems to be able to bulk commit objects of the same type, in one request. However, if I'm persisting records of more than one type, then this would result in multiple requests to the server. Is there a way to either a) make this happen in one request to the server, or b) match up ember-data's transactions with transactions on the server, so if the transaction on the server fails, and needs to be rolled back, the ember-data transaction fails as well?
[I'm evaluating Ember.js for an upcoming project, and testing a few features and what it's like to develop in. I'm actually considering more real-time updates using socket.io or similar. I see derby.js has made some movements towards automatic conflict resolution]
Answer: As you can see in the Ember Data source code here, you can return 422 HTTP status code with errors as dictionary. Errors will be added to the model by Ember Data library by key as model's property and the model itself will be considered invalid. Model will automatically leave this state once each property with errors on them changed.
You could watch for errors on version property and reloadRecord once concurrency error appears.


Which key usages are required by each key exchange method?

Question: I'm only really concerned with RSA keys, so the exchange methods are RSA (generate a key, encrypt it, and send it over) and [EC]DHE_RSA (generate an ephemeral [EC]DH key, sign it, and use it for key agreement).
The actual operation in RSA is "Key Encipherment", and in <code>[EC]DHE_RSA</code> it's digital signature, but they're both forms of key agreement. So, which of "Key Encipherment", "Digital Signature", and "Key Agreement" are needed in the key usage extension for each method? I haven't been able to find this specified anywhere and it probably varies by implementation, so the answer might be a table per-implementation.
Answer: The Key Usage extension is described in section 126.96.36.199 of X.509, with the following possible flags:
<code>  KeyUsage ::= BIT STRING {
       digitalSignature        (0),
       nonRepudiation          (1), -- recent editions of X.509 have
                            -- renamed this bit to contentCommitment
       keyEncipherment         (2),
       dataEncipherment        (3),
       keyAgreement            (4),
       keyCertSign             (5),
       cRLSign                 (6),
       encipherOnly            (7),
       decipherOnly            (8) }
</code>
In SSL/TLS, when the server certificate contains a RSA key, then:

either a DHE or ECDHE cipher suite is used, in which case the RSA key is used for a signature (see section 7.4.3 of RFC 5246: the "Server Key Exchange" message); this exercises the digitalSignature key usage;

or "plain RSA" is used, with a random value (the 48-byte pre-master secret) being encrypted by the client with the server's public key (see section 184.108.40.206 of RFC 5246); this is right in the definition of the keyEncipherment key usage flag.

dataEncipherment does not apply, because what is encrypted is not directly meaningful data, but a value which is mostly generated randomly and used to derive symmetric keys. keyAgreement does not apply either, because that one is for key agreement algorithms which are not a case of asymmetric encryption (e.g. Diffie-Hellman). The keyAgreement usage flag would appear in a certificate which contains a DH key, not a RSA key. nonRepudiation is not used, because whatever is signed as part of a SSL/TLS key exchange cannot be used as proof for a third party (there is nothing in a SSL/TLS tunnel that the client could record and then use to convince a judge when tring to sue the server itself; the data which is exchanged within the tunnel is not signed by the server).
To sum up: digitalSignature for (EC)DHE cipher suites, keyEncipherment for plain RSA cipher suites. However, some implementations will also accept keyAgreement in lieu of keyEncipherment, or nonRepudiation even if digitalSignature is not set; and some will just totally ignore the Key Usage extension (even if marked critical). For maximum interoperability, specify all four flags in the Key Usage extension.
Comment: I guess you could say you're a self signed authority (⌐■_■)
Comment: Since I have written several SSL/TLS implementations and X.509 validation engines, which are deployed in the field, I can claim to be my own reference: at least my code works as I explain.
Comment: With Openssl tls v1.2 if you don't use keyAgreement in KeyUsage field you are not allowed to establish ECDH but only ECDHE. I think the OP would to know things like that.
Comment: This is a very detailed answer, and seems plausible, but it doesn't really tell me anything I didn't know already. The question was about ambiguity in the standard, and you just cite those very same ambiguous portions of the standard. Do you have any references to documentation or code that this interpretation is correct?
Comment: Just to expand, when a ECDSA key is used then "keyAgreement" flag is needed for beeing ECDH "capable" (as opposed to ephemeral ECDHE)
Comment: What if the certificate contains an ECDSA key?
Comment: A word of warning, the following recommendation on always including the `keyAgreement` KU bit enables the KCI-based MitM attack (https://kcitls.org) when ECDSA certificates are used: _For maximum interoperability, specify all four flags in the Key Usage extension_.


how to make a collider high luminosity?

Question: Exactly what procedures are followed to increase the luminosity of a particle collider? Say when LHC increases its luminosity, does it increase the number of protons per bunch? If yes, then how?
Answer: Luminosity is literally the number of particles, so yes, putting in more of them increases the luminosity.
I think you are perhaps confusing the luminosity of a particular experiment with the maximum luminosity the accelerator can handle. The former is just how much stuff they put in, the later is a function of the design itself.

how to make a collider high luminosity?


.xlsx to xml conversion in Perl

Question: I am trying to convert a .xlsx file into .xml file. The first row(heading) of .xlsx file would become tags of xml file.
I have written below code which is working fine-
 open(XML, ">temp.csv") or die "not able to open $!";

 use Spreadsheet::XLSX;
 my $excel = Spreadsheet::XLSX -> new ('test.xlsx');

 foreach my $sheet (@{$excel -> {Worksheet}}) {
         $sheet -> {MaxRow} ||= $sheet -> {MinRow};
         foreach my $row ($sheet -> {MinRow} .. $sheet -> {MaxRow}) {
                $sheet -> {MaxCol} ||= $sheet -> {MinCol};
                foreach my $col ($sheet -> {MinCol} ..  $sheet -> {MaxCol}) {
                        my $cell = $sheet -> {Cells} [$row] [$col];
                        if ($cell) {
                           print XML $cell -> {Val};
                        }
                        unless($col == $sheet -> {MaxCol}) {print XML ",";}
                }
                unless( $row == $sheet -> {MaxRow}){print XML "\n";}
         }
  }
 close(XML);
 use XML::CSV;
 my $csv_obj = XML::CSV->new();
    $csv_obj->parse_doc("temp.csv", {headings => 1});
    $csv_obj->print_xml("out.xml");

Can anyone suggest a better code(Module) as I have to handle the large .xlsx files.
Thanks in advance.
Man
Answer: If your code is working then why do you need something better? If its only for speed, you need to find a way to avoid writing the temporary .csv file. File IO is slow and you are writing and then rereading and reparsing. Can you not read the data into a hash then dump it to the XML file using something like XML::Simple or any of the other XML modules on CPAN? Again writing a CSV, rereading, reparsing and writing XML will be slow!
Answer: Do you have access to a Windows box with excel 2007 or higher on it?  Then you could do something like:
my $excel = Win32::OLE->new( 'Excel.Application' )
  or die "Could Not Start Excel.\n";
$excel->{ 'Visible' }           = 0;
$excel->{ DisplayAlerts }       = 0;

my $workbook = $excel->Workbooks->Open( 'test.xlsx' );

#save as Spreadsheet XML (46)
# 51 = xlsx, more mappings here: http://www.datapigtechnologies.com/downloads/Excel_Enumerations.txt
$workbook->SaveAs( $output_file, 46 );
$workbook->Close();
$excel->Quit();

Answer: There is a project on githup to develop a lightweight XLSX reader. It's currently in a sort of alpha state, but it does work. You can try it if you like.

.xlsx to xml conversion in Perl


how to make RTSP request in html5 or in javascript?

Question: How to make request "rtsp://localhost:554/sample_100kbit.mp4"? (in HTML5 or Javascript)
I want to access video streaming data which source is present on Darwin server
Answer: I don't believe it's possible without an additional browser plugin.
The <video> tag in HTML5 requires the content to be served over HTTP.
Flash supports streaming using their own protocol (RTMP) and there are products available that will proxy between RTSP and RTMP.  However that would require you to run your own server and provision the bandwidth between user -> proxy -> content.
Answer: HTML5 don't support rtsp URL, and maybe MSE or WebRTC can help
refer RTSP solution for JavaScript/HTML5


What is the upper limit of size for diffracting an object?

Question: All items in the universe can be said to have a De Broglie wavelength which is significant if that wavelength is comparable to the object's size (I don't have to worry about my wavelength diffracting me when I walk through a doorway). What is the general upper limit of size for appreciable diffraction/interference in physics today, and why is it the upper limit (is it technological or physical)?
Answer: As far as I know the largest object that has been successfully diffracted is a oligoporphyrin molecule with a molecular weight of about $25000$. This was done on 2019 and is reported in Quantum superposition of molecules beyond 25 kDa
by Fein at al in Nature Physics volume 15, pages 1242–1245.
Quantum behaviour has been demonstrated in larger objects but the behaviour being observed was superposition not diffraction.
To observe diffraction we need the system to remain coherent, but the decoherence time decreases rapidly with increasing size. In principle there is no limit to how how large an object can be and still show quantum behaviour, but in practice the coherence lasts for too short a time to be observed for macroscopic objects.
Answer: Electrons are a relatively light particle, and therefore have a relatively long De Broglie wavelength. Electrons have been diffracted through the spaces between atoms in a crystal.
A proton is about $1800$ times heavier, and has a correspondingly smaller wavelength. It would be hard to find a similar diffraction grating.
Comment: Diffractive scattering is a whole thing: https://cds.cern.ch/record/540841/files/0203074.pdf


Implementing foreign key type relationships in XSD schema

Question: I'm trying to wrap my head around xml schemas and one thing I'm trying to figure out is how to do relational type schemas where on element refers to another, possibly in another schema altogether. I've looked at the xsd:key and xsd:keyref and it seems like the sort of thing I'm interested in, but I'm not sure. Initially I just set attributes with the type xs:ID abd xs:IDREF, which obviously doesn't necessarily refer to a specific element as far as I could tell.
Basically, I have several different xml files where elements refer to other elements either in the same file or other files. It looks a lot like a relation database and I would love to use one, but the requirement is to only use XML files and so I'm at least trying to establish some sanity instead of just seemingly random strings relying on xml comments to define the relationships. It works for smaller projects, but it's certainly not scalable.
Any thoughts?
Answer: I'm not aware of anything within XML Schema that will allow you to validate multiple XML documents against one another.  In the xs:id and xs:key (etc) constraints, you use xpath to apply the constraints.  You can go to XML Schema Part 1: Structures and scroll down a little bit for the example to see these constraints in action.
If you have the ability to define a meta-XML file that includes your others (perhaps by entity references if by no other way) and then use a schema for that meta file, then you should be able to use XML Schema to apply your constraints.  If you define a schema for each of your XML file types, you should be able to trivially (by xs:import or xs:include) define a meta-schema for an XML file that includes all of your XML content in one XML file.  This meta-schema could successfully apply the constraints you want.
Let's say you have to validate a Wiki that has many posts, where each post has an author and maybe many comments where each comment also has an author, and that you have one XML file for all posts, one for all comments, one for all authors, and you want to validate constraints between these files, that each post uses authors and comments that exist, that each comment uses authors that exist, and so on.   Let's say you have the following three files:
The file /home/username/posts.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<posts>
  <post>
    <author name="author1"/>
    <comment id="12345" pos="1"/>
    <comment id="12346" pos="2"/>
    I really like my camera...
  </post>
   ...
</posts>

The file /home/username/comments.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<comments>
  <comment id="12345" author="kindguy">
    That was a very good post
  </comment>
   ...
</comments>

The file /home/username/authors.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<authors>
  <author name="kindguy" id="1"/>
  <author name="author1" id="2"/>
   ...
</authors>

What I am suggesting is that you make a meta-XML file by using Entity References.  For example, you could create the following XML file:
<?xml version="1.0" encoding="UTF-8" ?>
<!ENTITY postfile    SYSTEM "file:///home/username/posts.xml">
<!ENTITY commentfile SYSTEM "file:///home/username/comments.xml">
<!ENTITY authorfile  SYSTEM "file:///home/username/authors.xml">
<root>
  &postfile1;
  &commentfile;
  &authorfile;
</root>

This meta-XML file (actually, a plain old XML file ... the "meta" is only from the perspective of your three defined XML files, and not in any XML sense) is the exact equivalent of the following file, and XML parsers will act as if you truly had the following file:
<?xml version="1.0" encoding="UTF-8" ?>
<root>
  <posts>
    <post>
      <author name="author1"/>
      <comment id="12345" pos="1"/>
      <comment id="12346" pos="2"/>
      I really like my camera...
    </post>
     ...
  </posts>
  <comments>
    <comment id="12345" author="kindguy">
      That was a very good post
    </comment>
     ...
  </comments>
  <authors>
    <author name="kindguy" id="1"/>
    <author name="author1" id="2"/>
     ...
  </authors>
</root>

From this file, you can define an XML schema that will apply the desired constraints, even though with the individual files there is no way to apply constraints.  Since using XML entity notation you have "included" all the XML into one file, you can use xpath in the contraint references.
Comment: I think I understand what you mean in an abstract sense, but I think I'd need a concrete example to fully grok it. Will the site you linked to explain this kind of relationship?
Comment: I'll edit my post later today to add a small example.  The XML schema standard will unfortunately not explain this.
Comment: Unfortunately, using several xml documents is a requirement. There is a publishing system in place that overwrites any local changes. There is no way to merge and therefore it is necessary to minimize the damage done by breaking data up in several documents. It's unfortunate, but reality =/
Thanks!
Comment: But for validation purposes, can't you created an *additional* XML file that uses entity references to include the canonical XML files that you cannot modify?  You could apply the constraints within this "temporary" XML file that does nothing but include the other XML files.
Comment: Thanks Eddie, I really appreciate this! Excellent mini-tutorial!
Comment: Your example will work perfectly for my needs, thanks again Eddie, you're a hero!
Comment: I wish I could upvote this answer again, perfect reference material!
Answer: This issue is discussed in http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/structures.html note section 3.11.
Answer: If I remember correctly, xs:ID has to be globally unique within whole document, while xs:key only has to be unique for the element for which it was defined. So the key/keyref is actually more like PK/FK. PK only have to be unique within one table.
Comment: Well that sounds like what I want then. Is it possible to create several schemas that work together to validate several xml-files as a whole. Ie, if I have a number of elements in one document that have keys, can I reference them from another document and still have it validate?
Comment: I think this answer your question: "refer=QName;
Required. Specifies the name of a key or unique element defined in this _or another schema_".


How do I pick a suitable SMD mosfet to control a 24V pneumatic valve with PIC32?

Question: I need to control a valve (https://datasheet.octopart.com/VXZ242FGA-SMC-datasheet-110849414.pdf) of which I do not know its power consumption and drawn current. I don't have the part yet and usually it is controlled by a PLC, but for my application, I need to control it myself using a PIC32 microcontroller. It operates on 24 Volts and the entire PCB is made with SMD components, so I prefer to use one of those.
Answer: If you're looking for the power required you missed it.

Solenoid coil specifications from page 2 of the datasheet. (Click for high-resolution.)
The worst case is 15 W on the DC versions so allow for \$ I = \frac P V = \frac {24}{15} \ \text A \$.
Go for a MOSFET that is rated at > 1 A and can be turned fully on by a logic-level output from your PIC32 - 3.3 V or 5 V, as required.
Comment: If you're choosing a little 1A one, check the power dissipation in the FET itself using the ON resistance at your choice of drive voltage. Then compute its temperature rise from its thermal resistance. You may find a 3A or 5A one has a lower ON resistance and a bigger package (lowet thermal resistance).


Does the jprofiler "Hot Spot" view correctly account for CPU consumed by native code called through JNI?

Question: I have been using JProfiler to analyze a piece of Java code which calls native C code via JNI, and I am getting strange results from the "CPU Views" window.  In particular, the information on the "Call Tree" tab is telling me that the Java method which calls the native code consumes the highest fraction of the run time, but the "Hot Spots" tab does not even list that method at all.  I also noticed a similar story for the org.joda.time classes, which are reported to have a fairly large fraction of CPU but are not reported as hot spots, and I'm wonder if this is because they spend a lot of time calling native date conversion code.
Any insight into this problem would be appreciated.
EDIT: I just discovered a very disturbing academic paper entitled "Evaluating the Accuracy of Java Profilers" (I would supply a link, but seems like the University of Colorado server referenced by the Google result for this file is very unhappy right now, so I had to pull a copy down from Google's "Quick View" link).  I suspect that the problem with the native methods is that they are being over-counted because there are many calls to them, they are short and the call is likely to result in a yield point; however, I'm not sure if the same would apply to the time conversion routines.  Note that I get significantly different results when using instrumented profiling and sampled profiling for the same test run, and the instrumented results agree better with my intuition.  I recommend the paper to anyone who has ever found themselves scratching their heads over the results of a profiling run.  Still hoping for someone to have more information on this though; "the profiler is wrong" is not a very comforting result.
EDIT 2: Looks like colorado.edu has sorted itself out, here's the link: http://www-plan.cs.colorado.edu/klipto/mytkowicz-pldi10.pdf
Answer: The hot spots view shows methods with large inherent time. In the call tree view you see methods with large total time at the top of the call tree. Those methods are usually not hot spots.
What is considered as "inherent time" depends on how your filters are configured.
Please see this help topic for a thorough explanation.


What is the status of the Zangezur corridor after Artsakh capitulation?

Question: According to Azerbaijan and Turkey, in the ceasefire agreements of the 2020 war of Azerbaijan against Artsakh, Armenia had allow a land corridor to Nakhichevan, a so called Zangezur corridor. What is the status of the corridor now after a new war and a complete capitulation of Artsakh without any involvment of Armenia itself? Does Azerbaijan still demands this corridor even after taking over Artsakh? On which grounds?
Comment: You can't retaliate on Zangezur if you never set up the transit in the first place. I would not be surprised if Armenians decided (or were made to) abandon Artsakh in order to avoid opening Zangezur corridor indefinitely.
Comment: Don't see why it would be impacted since it's not passing through Artsakh (unlike the Lachin Corridor). Of course Armenia could say Az reneged on the deal and the like, but I'm guessing they'd be weary of the fate of the Armenians in  Artsakh to be too revisionist on this issue.
Comment: @Fizz Well, even the ante bellum (the current one) status is not very clear. If the hope was to exchange some autonomy for the Artsakh for the Zangezur corridor, then it is completely void now. The demands from Turkey and Azerbaijan are now without any reciprocity. Also, the Armenian population is now very angry and there are fears of a coup. It also brings some associations with the Polish corridor issues of 1939 and an international reaction after attacking Armenia proper to gain land could be very different from those after just retaking its recognized territory.
Comment: Unless and until there's a mass departure of Armenians from Nagorno-Karabakh I think they'll hold their horses on retaliating on Zangezur, but that's just my opinion. The Armenian gov't really isn't saying much at the moment, other than blaming Russia, according to int'l news reports.
Answer: I think it's a unclear at this point. The government of Armenia isn't saying much and appears rather paralyzed for the moment. In a repeat of what happened after past Azerbaijani battlefield successes, there have been mass demonstrations in Yerevan demanding the government's departure. The only thing rather concrete that PM Pashinian has said is that he blamed Russian peacekeepers for [allegedly] not doing their job in preventing the Azerbaijani offensive. (IDK what the deals/treaties entailed in this instance, but if they were like UN peacekeepers' mandates, it was probably not even their job to stop any Azerbaijani offensive.)

Does Azerbaijan still demands this corridor even after taking over Artsakh? On which grounds?

Almost certainly. Not only do they demand it because it would link their lands, but Türkiye's government demands it due to their wider geopolitical projects.

As for "grounds", they e.g. say the area was given to Armenia by USSR only in the 1920s and that it's historically Azerbaijani land, etc.

And in case you think I'm inferring too much, here's Erodgan saying it is a "strategic issue" for both Azerbaijan and Türkiye:

OTOH, since Armenia is still opposed, both Turkish and Azerbaijani goverments seem to have de-emphasized that angle in recent statements and say instead it will go through Iran:

"If Armenia does not pave the way for [the corridor], where will it pass through? It will pass through Iran," he said. "Iran currently considers this positively. So, it would be possible to pass from Iran to Azerbaijan." At a cabinet meeting later in the day, Erdogan reiterated the statement.
Erdogan's argument has not been confirmed by Azerbaijani officials, but the idea was presaged in a September 17 article on Haqqin.az, a website associated with Azerbaijan's security services. It differentiated between a "Western Zangezur Corridor" through Armenia and an "Eastern Zangezur Corridor" through Iran. It concluded: "If Yerevan continues to delay the opening of the Western Zangezur Corridor, then Azerbaijan will open the Eastern Zangezur Corridor with Iran, which means that Armenia will remain outside of yet another strategic project and will once again be a loser."

As for what they are dangling in front of Armenia in exchange is a normalization of relations and opening of trade.

OTOH, according to some analysts (quoted in that RFERL piece), not insisting/threatening for now may simply be because they don't want Pashinian's government to fall right now, due to piled up internal political pressures. After all, he did give up Karabakh without a fight, so he's seen from Baku as a more reasonable person in charge than alternatives might be. But as far as the corridor goes, their position appears unchanged:

"Armenia has never agreed and will never agree to any sort of extraterritorial or corridor logic," Armenian Territorial Administration and Infrastructure Minister Gnel Sanosian said on September 25.
Comment: Interestingly, it appears that Turkey previous signed up on those borders in the https://en.wikipedia.org/wiki/Treaty_of_Kars#Azerbaijan_and_Nakhchivan


Size of HTML and CSS page size

Question: What are the various possible ways to find out the size in kbs of the HTML and CSS of a particular website?
Answer: I prefer to use the Net panel in Firebug for Firefox (below), but the dev tools in Chhrome are just as nice.
Another great option is YSlow by Yahoo Developer Network, which will also offer comprehensive linked recommendations for improving page results.
Pingdom's Full Page Test offers a visual without installing anything.
All of these tools will show a 'cascade', usually including info on whether a loaded resource is loading in parallel or in series (blocking the loading of subsequent resources). The various types of files loaded can generally be filtered in the display by clocking 'html' or 'css', etc above the graph.
The page load in the Net tab of Firebug:

The YSlow page test results page:
Answer: I use the Network tab of the Web Developer tools in Chrome (Ctrl-Shift-I, then select Network).
Answer: I would use Firebug. Go to the webpage, open firebug (F12) and go to the Net tab. You got all requests made by site listed there. On the bottom of the list You got sum of all requests. You should clear browser cache before it btw, because some requests may be missing during browser cache hit.
Answer: Opera has an "info" panel, but it only gives you the size of the HTML document requested and the total size of all inline elements (images, CSS, JavaScript, etc.).
Answer: you find webpage file size and downloading speed also at below site tool.
http://www.websiteoptimization.com/services/analyze/

Size of HTML and CSS page size


How does the grain size effect on permeability and resistivity of a material?

Question: If the grain size of a material varies, what does happen? Are the permeability and resistivity of the material changed with the variation of that grain size? If they do, how they do?
Comment: If you mean grain  material as small spherical balls  then finer the grain lower the resistance. You basically fill more space with the conductive stuff. Opposite for permeability to things much smaller than the grain size. In this permeability case capillaries might interfere with my pictorial reasoning.  Moreover if the things passing through have a not spherical geometry, they could go through faster as bigger they are. Unless they cannot go through at all.
Answer: Resistivity increases as grain size drops because you have more grains crossed per unit length which gives more grain boundary scattering events.  This effect is nonlinear because there are other factors affecting resistivity (thermal motion, point defects, or dopants for a degenerately doped semiconductor--a sort of metal).  Once the grains get big enough, these other factors may dominate the resistivity.
I disagree with the comment above that smaller grains fill space better.  All else equal (same microstructure and grain shape), space filling will be the same fraction regardless of particle size.  Consider bowling balls, marbles, ball bearings.


Add a group of attributes to all products

Question: I created a new folder of attributes to a product category, and its working fine. There is a way to add this folder of attributes to all products categories automatically? Or should i add one by one?
Comment: what u mean by `new folder of attributes`
Comment: like this: http://imgur.com/tMs0xka
Answer: You cannot add the new attributes set to existing products, only to new ones.
The only way would be do change them directly in the database. I would recommand you to find an experienced developer for that.


transactions for future use

Question: If bitcoins can be stolen via hacking, what's there to stop these already occurring events and bitcoins from falling right back into the hands of power. I mean bitcoins are capable of being untraceable. So who's to say that its NOT already being utilized as the new, maybe even world, currency for control?
Comment: I'm voting to close this question as off-topic because it's too philosophical, and seems to be getting at some sort of conspiracy theory.
Comment: Please ask more concrete question.
Comment: @Jestin agreed. Too speculative and is remotely related to the technicalities of Bitcoin itself.
Answer: Think about it this way: Bitcoins can get stolen by people with poor private key control being "hacked". But when those people have their Bitcoins stolen, what do they do? They complain about it online, and so other people hear about it.
Then those people who hear about it say to themselves: "well my private key control is pretty bad too, I can easily get hacked!" Then some of them will at least learn to protect themselves, maybe by using a hardware wallet such as Trezor or Ledger.
Those that don't improve their practices will either eventually have their funds stolen, or they will see more examples and their behavior will self-correct.
Also if there was a sudden increase in thefts there would be a LOT of media coverage about it, and even more people would learn about how to protect themselves through these good private key practices.
Because of this, the amount of Bitcoin that is stolen annually will tend towards some small percentage. Of course, if Bitcoin did look like it was going to be the global currency you can imagine that the already-rich-capitalists would just buy a whole lot of Bitcoin, so it wouldn't make that much of a difference to their lives and position.

transactions for future use


Is there any sans-calculus proof of irrationality of $\pi$?

Question: Is there a proof that will convince someone who doesn't understand calculus, of $\pi$'s irrationality .
Comment: I don't believe anyone has discovered any such proof yet.
Comment: $\pi$ is irrational iff the orbit of $(1,0)$ under rotations of angle $1$ is dense in the circle; so maybe you can convince someone that $\pi$ is irrational by drawing approximations of this orbit (of course, it is not a proof).
Comment: @Seirios Sorry, I'm not getting you. A figure maybe?
Answer: As far as I know, there aren't any simpler proofs. And because pi is transcendental, it doesn't seem like the proof would lend itself well to anything easier than calculus.
Comment: My first thought was that you could prove that $\pi$ is transcendental, which would be sufficient, but that explanation would take much longer and would probably be less satisfying for those who don't have the necessary abstract algebra background.

[Lambert's proof](http://en.wikipedia.org/wiki/Proof_that_%CF%80_is_irrational#Lambert.27s_proof) uses continued fractions and essentially concludes that if $\tan(x)$ is rational, then x is irrational. Since $\tan \left( \frac{\pi}{4} \right) = 1$, then $\frac{\pi}{4}$ is irrational. I haven't really looked into it, but it might be more accessible.
Comment: In a similar vein, no one seems to know a proof that $\pi$ is not constructible without proving that it is transcendental. See http://math.stackexchange.com/questions/103786/direct-proof-that-pi-is-not-constructible
Comment: Ok. May be not easier than calculus, but how about something *different* than calculus?
Comment: Cool, thanks for the pointers. Sorry, can't vote up w/o rep.
Comment: $e$ is transcendental, but if you accept $e=\sum^{\infty}(n!)^{-1}$, you can prove it irrational without Calculus. Also $.1101001000100001000001\dots$ is transcendental, but its irrationality is trivial and no Calculus is needed.
Comment: @GerryMyerson isn't that representation of $e$ built on calculus? infinite (specifically taylor) series seems to be directly from calculus...unless of course the OP meant modulo integral/differential calculus...
Comment: @Coffee, I don't think I was responding directly to the original question, but to some comment, possibly to some comment that has since been deleted. Taylor series certainly presupposes Calculus, but one can do a lot with infinite series without any Calculus (though you do need limits). As for $e$, it is possible to take that infinite series as the definition of $e$, and if you take that approach then no Calculus is needed to prove irrationality.
Comment: @GerryMyerson I hear that. I guess I just always associate certain studies of the "infinite"-i.e., series and limits-with calculus, but I guess there's no reason for that to be set in stone, and it is my own bias. Also, I just saw the date on your comment! It just happens to be that I recently became interested in this very question and my googling led me directly here...
Comment: @GerryMyerson You can define $e$ without calculus, if you want: _The unique number $e$ such that $e^x\ge x+1$ for all $x$._ (This definition is surprisingly powerful. It lets you prove that $x^x$ has a minimum at $e^{-1}$, for example, and it lets you prove that $1-\frac12+\frac13-\dotsb=\ln2$. This is all without using calculus. EDIT: Well, technically, you just get to prove that $\ln2-\frac1n<1-\frac12+\dotsb\frac1n<\ln2+\frac1n$, but the Squeeze Theorem implies the infinite version immediately. I suppose that the Squeeze Theorem is _kinda_ calculus-y, but not too calculus-y.)
Comment: @colum, OK, though somehow you have to prove that there exists a unique number such that $\forall x\, e^x\ge x+1$.
Comment: @GerryMyerson Yeah, yeah, but playing with [desmos.com](http://www.desmos.com) (graphing calculator) shows that it's pretty likely. (Graph `x+1` and `a^x`, and then adjust the value of `a`.)
Answer: I developp my comment: Take the point $x_0=(1,0)$ on the unit circle $S^1$; if $R$ is the rotation of one radian around $(0,0)$, let $x_1=Rx_0$, $x_2=Rx_1$, $x_3=Rx_2$ and so on.
In complex notation, you have $x_n=e^{in}$. If $\pi$ is rational, there exist $p,q>0$ such that $\pi=p/q$ and so $x_{2p}=e^{i2p}=e^{i2q\pi}=x_0$; thus, $\{x_n, n \geq 0\}$ is discrete in $S^1$. Otherwise, $\{x_n,n \geq 0\}$ is dense in $S^1$, ie. it seems to cover the circle.
Consequently, you can convince someone without calculus that $\pi$ is irrational by showing that $\{x_n, \geq 0\}$ seems to cover the circle; of course, it is not a proof.
Here are some iterations:


How to gain additional points on the CoS (Tier 2 UK)

Question: I am an Australian speech pathologist who has been offered a permanent full time position with the NHS. I am currently sitting on 40 points for my application for CoS although have been rejected several times due to the visa allocation requiring >46 points. Does anyone have any ideas of how to obtain additional points? Unfortunately my role was previously on the job shortage list although this is not the case at present.
Answer: I am pretty sure the only thing that affects a CoS application is the labor market tests and the salary (e.g., https://www.admin.ox.ac.uk/personnel/permits/tier2/overseas/formalcosrequests/), but I cannot find the official website. You are presumably getting 20 points for the passing the resident labor market test and another 20 points for a salary between £40,000 - £40,999.99. to get to over 46 points you would need the salary to be £50,000 - £54,999.99 to get 30 points.


Control two fans with a simple fan controller

Question: I want to control the two upper fans in my N300 case with a Zalman Fan Mate 2 and I'm wondering if it is reliable to connect two fans (in my case two Sickleflow fans) in parallel.  If it is, connect the Fan Mate 2 to the PSU and then connect a generic Y-splitter to have two regulated power outputs. If not possible, is there any alternative to control two fans with the same controller (I want it to work at the same speed approximately).
Comment: @FrankThomas because he is connecting them in parallel and not serial, they will *draw* twice as much current. It's an important distinction as the idea that the power controller pushes out current is not correct. It changes the voltage and not the current.

If he connected 10 fans in parallel they would almost certainly draw more then 6 watts and fry the controller.
Comment: most fan control is all about power to the fan, so there is no logic to it; just send more power when you want faster and less when you want slower. completely analogue.  as such, you either need a device that can control two channels in parallel, or something inline to distribute the power evenly. wiring the fans in parallel will help a  lot, but there is no guarantee that the fanspeeds will match.
Comment: Well, my problem is with the noise. These fans are very noisy when working at maximum speed and I don't need them to work at maximum speed every day, so I would like to have a mechanism to stop the noise and "make noise" only when it is needed (i.e. a hot summer day playing to some CPU/GPU intensive game)
Comment: Personally, I;d check your motherboard for power management on your cooling systems. My workstation box has rather sophisticated controls that turn the fans up or down based on different (configurable) sensor readings. thats about the best you can hope for. Otherwise the controller will probably work, but you will have to give the fans twice as much current as you would normally, so that may prevent them from going up as high as you'd like when you need them.
Answer: as long as the total power of the fans that you are trying to control is less then 6 watts, You will be fine.
You have two fans of the exact same model, so chances are that they will be running at (roughly) the same speed.
The only thing that won't work is the RPM reporting on the fan. the yellow cable is designed to be connected to one fan only.


OCR using pi and pi cam

Question: I am working on an OCR project. I use raspberry pi 3(model b) for OCR.
Can pi cam be used to detect texts?... Does pi cam provide sufficient clarity to detect texts clearly in an image? If so how could clarity be increased to detect texts precisely?
Answer: Yes, actually you can do that. The Raspberry Pi Cams (especially the new ones) offer good enough quality in my opinion. However, the performance will depend on the whole product: So you should have a fixed position from the cam to the object you want to scan, good lighting, both cam and object should not move too much for best results - and in the end you'll have to translate the images to text via ocr applications. A good starting point is here: https://stackoverflow.com/a/7553156/5730361
However, I would recommend using a normal flat-bed scanner, as the performance and price of the final product as well as the usablity will be much higher. But for the sake of learning something new and not building a product - go for it :)!

OCR using pi and pi cam


Cut hole in raster with shapefile and sample at closest edges

Question: I have a raster in which I'd like to cut a "hole" with a shapefile. I have points close to the boundary, but inside the hole, and I would like to find the closest point on the edge. To give a concrete example, I have a global dataset (1' resolution) and a shapefile of the coast of Africa. My data points are locations of cities near the coast, but some of these points are not exactly on the coast, so I'd like to find the closest point outside the shapefile, i.e. closest point over water.
Normally, I'd use: gdalwarp -of -GTiff -cutline Coast.shp -crop_to_cutline -dstnodata 0.0 Data.tif Clipped_Data.tif but this obviously only gives me what's inside the shapefile; I can't find an inverse clipping for this command.
I did some digging and found this, which allowed me to set everything inside the shapefile to 0, but when I sample using gmt grdtrack it just sets the values to 0 (which makes sense). Also, when I tried crop=True, invert=True I got: ValueError: crop and invert cannot both be True. So I reverted to using crop=False, invert=True.
So, how can I sample this raster at the closest point outside the shapefile? I think if I can get the hole to be set to NaN, I can use the -T flag in gmt grdtrack.
Comment: Perhaps this helps https://gis.stackexchange.com/questions/163371/reverse-gdal-rasterize-i-option-does-not-work?
Answer: Take a look at mapproject -L option. I think it does what you want and no need to use a grid.


Correct PWM frequency for motor

Question: I am using 4500 RPM motor.To be specific,this is the motor I am using https://www.robomart.com/4500-rpm-high-torque-dc-motor. I am using Cytron MD10C motor driver to drive it.The PWM source is Raspberry pi.What is the range of frequency for PWM that I can use for this setup? Both the motor driver and the motor gets heated when a little amount of load is given.I have tried 50 to 300 Hz.
Comment: Actually *think* about it.  Your motor is spinning at 75 Hz.
Comment: Those things have very long time constants. I would go as long as you can like 20 to 200hz.
Comment: It must be a much higher f , 10 to 20kHz to avoid core saturation and DCR surge currents at 12V/DCR
Answer: For highest efficiency and lowest vibration the motor wants a high PWM frequency. However for lowest switching losses the controller wants a low frequency. Therefore the 'best' PWM frequency is often a compromise.
The motor has inductance which opposes current variations. At very low frequencies it has little effect so the motor current follows the PWM voltage. This causes extra heating in the motor because the rms (heating) current is higher than the average (torque) current. As PWM frequency is increased the current has less time to increase and decrease, so rms current approaches average current and the motor runs cooler.
Below are some oscilloscope traces of a small brushed DC motor at different PWM frequencies (upper trace in each image is voltage, lower trace is current). At 50Hz the PWM current follows the voltage, so the peak current is twice the average current and loss in the motor's internal resistance is doubled compared to constant DC. At 500Hz the current rise and fall is exponential, but still peaks at twice the average current and drops to zero between PWM pulses. At 1KHz it is continuous but with large variations.
At 3KHz the ripple is finally flattening out enough to get the rms current close to the average current. Motor efficiency is now not much worse than it would be on pure DC. However, switching spikes (which increase controller heating) are starting to become apparent.

You have an iron-cored motor with relatively high inductance. Most iron-cored motors need at least 2-3KHz to get reasonably smooth PWM current (coreless motors have much less inductance, so they need 20-30Khz or higher). The motor may also produce audible noise at the PWM frequency which can be annoying, so a frequency which is outside human hearing range is often desirable. The MD10C is rated for up to 20Khz so I would start at that frequency, and only consider reducing it if the controller runs too hot.

Correct PWM frequency for motor


Best signature fonts

Question: Are there any good realistic looking signature fonts you guys know of?
Answer: A quick Google search for "signature fonts" turns up quite a few results.
Some that looked good:

Alako
Denistina

There's a bunch of good ones here.
Answer: One of my favorite handwriting fonts is League Script #1 - which is also conveniently open source.
It's a very flowing font, so it might not be suitable for masculine styles.

Best signature fonts


Views Bulk Operation alternative?

Question: As VBO for Drupal 6 is outdated due to a security issue, is there an alternative to this module?
Answer: Trying to find an alternative / replacement for VBO is similar to trying to do so for a module like Views, or other (popular) modules.
To my knowledge there is no other "contributed" module that can do the same as VBO to replace it. Your only alternatives to consider, I think, is either of these options:

Carefully review the D6 security issue and check if you can find a way to prevent that issue from happening in your site (do not allow it to be used in any way that might cause the security issue to arise).
Spend time to create a fix to actually resolve the D6 security issue in VBO, and optionally consider contributing that back to the VBO module (so that others may help to continue to "maintain" that fix).
Similar to "2.", but "hire somebody" to do it for you.

PS: Writing your own "custom" module to replace VBO entirely is another option, but of course "the toughest one" also ...

Views Bulk Operation alternative?


What does "no data" in search appearance of google webmaster tool/search console mean?

Question: Search appearance section has no data to show. It has been months since some of the pages and posts of my website got indexed to google. But I see no data in search appearance. Does this mean that none of my pages or posts appear in SERP. If yes what can be done?
Additional information: Around 70 pages which are all deleted were crawled and passed indexing earlier which still appears in pages report.
Answer: The search console display no detailed information on pages and keywords when it has been created and instanciated too recently.
If it's not your case, it only seems that google doesn't have enough individual data to display. 116 impressions is not significative enough.
Also the search appearance tab, google will only count the custom displays like AMP, FAQ and so on, not the standard SERP features.
So if you didn't implement any rich display feature, you won't be able to see anything here.

What does “no data” in search appearance of google webmaster tool/search console mean?


What should VM writeback timeout be set to for a laptop?

Question: I am using powertop to check that my machine is setup in a way that will give me good battery life.  After installing laptop-mode-tools all of the "Tunables" section shows "Good" except VM writeback timeout.  On the powertop page, it seems to suggest that 1500 (i.e. 15 seconds) is a good value.  Checking cat /proc/sys/vm/dirty_writeback_centisecs shows that my current value is 60000 (i.e. 600 seconds or 10 minutes).  I believe a larger value means to wait longer between writes (which means spinning up the drive less frequently).  Do I really need to set the timeout longer than ten minutes?
Comment: Just a note: you can configure those values in `/etc/laptop-mode/laptop-mode.conf` (`LM_BATT_MAX_LOST_WORK_SECONDS`). Personally i think 10 minutes is too much (i use 20 seconds).
Comment: You should also be able to put `vm.dirty_writeback_centisecs=1500` in `/etc/sysctl.d/99-vm-writeback.conf` and reboot or do `sudo service procps start`
Answer: The larger the dirty writeback setting the longer dirty pages sit in memory before being flushed out to disk.  The downside is that this increases the window of opportunity for losing data if you lose power since there will be probably more dirty pages sitting in memory and not flushed out.
Answer: Actually you don't need to set dirty_writeback timeout to more than 6000 centisec, but rather to less. At least for Powertop to smile: It seems Powertop checks for vm.dirty_writeback = an *exact* value of 1500 csec (15 sec). You can check by setting it to this value and look back at the powertop screen.
Other than that, @Colin Ian King said it clear on the data loss widening window with higher timeouts.
Comment: Thank you @Catskul for being more specific than I had it. It's appreciated :)
Answer: I just want to add something to this in case anyone happens upon it. Even though this is a bit older we should never really have to touch this setting regardless of what powertop says. The kernel automatically makes adjustments for best performance on this since kernel version 3.5 with a feature called Dynamic Writeback Throttling. It allows the kernel to automatically adjust the vm.dirty_writeback_centisecs setting based on the system's available memory and the type of storage device in use. With this feature enabled, the kernel will try to maintain a balance between minimizing the amount of dirty data in memory and minimizing the number of writes to the storage device.
Answer:
I believe a larger value means to wait longer between writes (which means spinning up the drive less frequently)

No, you're just delaying write operations to the disk by 10 minutes. This doesn't buy you anything in terms of battery life or reducing SSD writes.
The way to think about this value is: "What's the longest ever possible time (times 2, even) that I would ever want a batch of disk operations to last."
If you have an application that actually takes 10 minutes (an absurdly high value for normal users) of disk writes that would benefit of being delayed in I/O, eg. multiple writes to the same file get made into one write, then you would set the timeout to a very high value.
tldr; For 99.9% of users, the powertop suggested default is more than enough.
If you actually want to reduce writes to SSD, think about putting parts of your filesystem on tmpfs. But that's a whole other subject.


Wiring for mini split sysytem

Question: My mini split system call for a 12/3 wire on a 30amp circuit. I thought i had to use 10/3 wire on a 30amp circuit. Is it safe to use the 12/3 wire?
Comment: Make/model of system?
Comment: Usually manufacturers installation instructions are what you must use, but no harm checking if there is a mistake.
Comment: Details matter such as make/model, run length, etc. Update your question with more details.
Answer: Motors are weird
240.4(D) lays down a hard limit of 20A for #12 wire.   However it exempts a list of exceptions.
Two of them are motors, for which you follow the rules in NEC article 430 instead... and Heat pumps, where you follow Article 440 instead (which turns around and pulls in Article 430 again).
What's going on? Breakers are there to provide three protections: overload (provided by their delayed/thermal trip mode), short-circuit, and bolted hot-ground fault (both provided by their magnetic instant-trip mode).  Many motors have overload protection built right into the motor, which works well because it can sense motor temperature.
Thus, the breaker is not needed for overload protection, and the breaker size can go up a bit to reduce nuisance trips from normal motor startup.  That's what the Article 430 rules are saying.  However, the "nuisance trip" issue should be a non-issue on an inverter drive motor.
The motor or equipment will state the minimum and maximum breaker size. Use any breaker in that range.
Note that as of Jan 1 2023, NEC 2020 states will need GFCI breakers on their hardwired outdoor mini-splits (because they're outdoors) unless your state deleted that #$?§& requirement.  Which many did.
Answer: The NEC allows 30 A through an AWG12 copper wire if the cable is rated for 90°C.
Note that this is for 30°C ambient; if you live in a very hot climate you may actually exceed this if you have an outdoor run to your mini-split on a hot day (when, presumably, you'd be running the mini-split a lot). I'd personally run 10/3 anyway, even if it's not strictly necessary.
Comment: I was thinking of just using 10/3 anyway, but i will need to look at the terminal block to make sure it will handle 10 gauge wire. Thank you!!!
Comment: 240.4(D) limits 12 AWG to 20A, but for a list of exceptions covered elsewhere in Code. The 90C thermal value is in practical terms, useless except for computing thermal derates.
Comment: I suspect there is something else going on here. Cable - and "/3" typically is shorthand for a cable, not (though allowed) for "3 individual wires" - is normally at 60 C or possibly 75 C, not 90 C rated. To blindly say "12/3" would encourage people to use cable that really is not valid for 30A *under normal usage*. My hunch is that it has to do with motor ratings, which are different. *Possibly* the mini-split really only needs a 25A breaker but they say 30A anyway (my electrician actually put in a 25A breaker for the A/C to replace 30A fuse when replacing my panel) as 30A is more common.
Comment: That would at least fit in terms of 75 C rating rather than 90 C rating. But still wouldn't work with standard cables.
Comment: From an engineering perspective I agree the breaker spec is most likely 30A to handle inrush current.  From a code perspective though a 30A breaker *must* be connected to a 30A-rated cable. This unit likely pulls about 50% or less while in operation and will never be stressing even a 12/3 90°C cable near its limits. HOWEVER, when this unit fails, or something else goes on this circuit? It's much easier to run 10/3 for every 30A circuit at install time, rather than replace it later.

Wiring for mini split sysytem


How can I fix a computer that blue screens before Windows starts?

Question: I have a Dell Inspiron running Windows 7 that keeps getting blue screens of death. At first, the computer slowed down so much it was unusable. After some time, it wouldn't even load Windows anymore; the machine just started going straight to a BSOD after the starting Windows logo. I have tried loading the reset disc, but it just takes me to a loading lobby and never advances. I don't need the files on the computer, but I do need the machine for school. What can I do?
Comment: Edit your post to include the specific Model of your notebook please.
Answer: Run a diagnostic on the memory and hard drive.
Start at the Second post in this thread.
.
I can give better Dell diagnostic software links and instructions as soon as I know your specific model number.
Answer: If your computer blue screens than windows has already started. Not succesfully, but you are already starting it when it fails. This can have two reasons:

A problem with the windows installation, or
A hardware problem.

If it is a problem with the windows installation then you can boot from other media. I am guessing that you already tried this since you mentioned a reset disc.
That leaves a hardware problem. An unidentified one. At this stage and with data you want on disk it is prudent to remove that disk from the computer. Try it in a different desktop or via ESATA or external FireWire or USB case. Copy your data. if possible.  Also check the disks SMART attributes.
If it is the disk which is failing then buy a new one. Reinstall windows and copy data back from your backups.  If it is something else which is failing then do the usualu diagnostics for that (e.g. fan working, not overheating, thermal paste replaced, DIMM reseated, memory test runs succesful, ...)


What is the difference between LC(CL) and CLC antenna tuning unit as power loss is concerned?

Question: What is the difference between  LC(CL) and CLC  antenna tuning unit as power loss is concerned ?
Answer: LC or its counterpart CL ensures that at match, Q is as low as possible. Low Q means low loss.
CLC allows Q to be higher than necessary, and still match source to load. The higher Q means more power is lost heating the tuner element(s). If you tune it for minimum Q and impedance match, one of the "C's" tends toward redundancy, and the network looks like LC or CL.
It is possible to cascade two LC stages (or CL stages) when source impedance differs from load impedance by a large factor.
The intermediate impedance between LC stages would be $ \sqrt{Z_S \times Z_L} $. Each LC stage has low Q; lower than Q of a single LC stage. So even though this network has four components, losses are low.
Answer: When I read Glenn Geek's answer I was confused by his use of the term "Q" .  My only knowledge of it was as a figure of merit, in a tuned circuit a high Q is usually desirable.   In that usage it is power stored in the reactance/power dissipated in the resistance. Terman called the difference between input power and output power in a matching circuit "delta".  When this is viewed as  input power over output power the result is a pure number, a value that can be called Q, a figure of merit. The lower the Q, the lower Terman's delta, and the more efficient the matching network.  When an LC circuit is used as a matching device it is tuned slightly off from the resonate point, lowering the maximum Q of the LC circuit ( This usage of Q is the power stored/power dissipated one) meaning the LC circuit is more lossy, but viewed from the point of Terman's delta, or matching unit Q, (the input power/output power)  the unit performs better.  Here is a better explanation of Q, as Glenn used it in his reply.  It may also answer some parts of the question. http://www.antentop.org/w4rnl.001/gup14.html


Docker Error cannot allocate vector of size 1.5gb R script

Question: I am running Docker on windows 10 and created a container which does the training using r-masked ngrams to detect clean or malware domains. It runs perfectly on a dataset with 32k x2 (clean and malware both 64k rows) rows but on another with 370k rows i get "Unable to allocate vector of size 1.5Gb". Is there any way to increase docker limit, im using a computer with 8gb of ram.
Comment: Does this answer your question? [Increasing (or decreasing) the memory available to R processes](https://stackoverflow.com/questions/1395229/increasing-or-decreasing-the-memory-available-to-r-processes)
Comment: It could be a number of things, including: docker (not R) limits on memory/resources; or inefficient R code. The first is likely better-suited for superuser.com or similar. The second would require an audit of your code. You might get away with it here on SO if the code is not egregious, but once the code block starts paging, it becomes a visual deterrence and flies in the face of ***minimal** reproducible example*, in which case perhaps [codereview.se] would be a better place.
Answer: Although the fact that the information provided for you is limited to make a diagnosis, could be a good idea to try to increase "memory.limit"
"memory.limit() reports or increases the limit in force on the total allocation"
Even with limitations in your RAM of your Windows PC, it is possible to physically extend the RAM without buy more ram.
Please see how to use: "Physical extension of RAM"
https://learn.microsoft.com/en-us/windows/client-management/introduction-page-file
Then, try, for example:

memory.limit(size = 32768)

(it could be a good idea to start your CMD/Rstudio as admin):
Also see: the help for this function

?memory.limit
Comment: i tried this but on docker wasn't working. I run it on a computer with 32gb of ram using that function that you mentioned.


Can I run one bash shell script on many machines simultaneously?

Question: I would like to run one bash shell script on two or more machines simultaneously.Can I run one bash shell script on many machines simultaneously? I place this shell script on centos 5.5 and other machines run this simultaneously.
Comment: How often does this run? And is it important that they run 'simultaneously', or can they be started a few seconds apart on each machine?
Answer: My best bet would be using ssh. For this you probably need to exchange keys between your master machine (the one hosting the original script) and your slaves (the ones supposed to run the script). I.e. you need to do ssh-keygen on the master and append the contents of ~/.ssh/id_rsa.pub (or id_dsa.pub) on the master to ~/.ssh/authorized_keys on each slave. Then you can run a script sitting on the master on each slave like so:
ssh remote_user@slave_machine 'bash -s' < local_script.sh

(which is stolen from this answer).
If you have a list of slave machines you can repeat this on each like so:
slaves = slaveA slaveB ...
for slave in slaves; do
    ssh remote_user@${slave} 'bash -s' < local_script.sh
done

Hope that helps.


Files inside styles gives a 403 error

Question: I accidentally changed the permissions of sites/default/files folder to 777, but later I changed back to 755. From that moment images in the articles are not showing. It's giving 403 forbidden error. Please guide me.
Answer: Well, the question and description of the situation leaves some questions open but from a first glimpse I would assume, that you maybe missed to change also the nested folder and file permissions correctly recursively. Therefore read this Drupal guide and make sure that you also have a working temporary path set up in Drupal configuration to make Drupal able to rebuild its file system. Also make sure that you have cleared all the Drupal caches and Image style caches to force Drupal to rebuild the image styles and implementations.
BTW: theming is the wrong tag here. This is not a theming specific question.

Files inside styles gives a 403 error


Right of Conquest and Patrilineage

Question: If I had a king who sits the throne by right of conquest. He has no natural born sons, but he does have a living father and a living younger brother. This is obviously throwing a wrench in my story because the father is important. My king is going to meet an untimely end. Who would be his proper heir in a patrilineal system? His brother or father?
Comment: There are different patrilineal rules of inheritance when it comes to resolving edge cases like this. Have you considered having the plot dictate who has the better claim, and writing the rules to suit that?
Comment: The word [patrilineal](https://en.wiktionary.org/wiki/patrilineal) does not mean what you think it means. It has nothing to do with inheritance, and everything to do with how people reckon descent. In particular, the rules of inheritance in England, the rules in France, and the rules in Russia would have been *very* different, although the English, the French, and the Russian societies are all patrilineal. For example, you may have heard of Queen Mary and Queen Elizabeth I, daughters of King Henry VIII of England. (Not to mention that the king could, you know, leave a last will and testament.)
Comment: The father was never the sovereign, so neither has any claim. It depends on which of them took the biggest role in the establishment of the monarchy in the first place. it just makes it clear that the monarchy wasn't effectively established in the first place.
Comment: @sphennings: I agree wholeheartedly with your comment. But, please, there is no such thing as a patrilineal rule of inheritance. Patrilinearity refers strictly and only to how people reckon descent. For example, the Russian society has always been *very* patrilineal, to the point that the names people always include the name of the father, hence those funny three-part Russian names of the characters in Russian novels, e.g. Anna Arkadyevna Karenina and Joseph Vissarionovich Stalin. And yet, Russia has had several empresses who ruled in their own right; and those were not short reigns.
Comment: VTC because you're asking the wrong kind of Q for our Stack. Per the [help/on-topic], we help you build worlds (we'll help you design the legal structure of your civilization), we do not help you write stories (you choose who inherits based on the needs of your story, that's too subjective to meet Stack Exchange's expectations). See also [narrative necessity](https://worldbuilding.meta.stackexchange.com/q/7281/40609). BTW, if your inheritance were truly patrilineal, the Q wouldn't exist. The father would be the monarch the whole time. If a law exists that prohibits that, it answers your Q.
Answer: Depends on the laws
There are legal systems in which inheritance can not go to the older generation, but not many.  Typically inheritance would go to the father, then to the brother.
Because your character is king, he can probably decree who will be king after him in events of his death without heirs.
Given that he seized the throne himself, the laws may not matter.  It may matter whether the father or the brother has the most support among the warriors.
Answer: From here:
https://inquisitionspostmortem.ac.uk/contexts/the-law-of-inheritance/
"Precedence went initially to a dead person's issue descendants, in preference to collaterals such as siblings or aunts. Within the same generation of descendants, men were favoured over women, but only the eldest male inherited."
So it seems the Order is:
Descendents > Brothers/Sisters > Father/Mother > Uncles/Aunts > Grandfather/Grandmother
However - in a right of conquest system, the Father would be well within his rights to challenge his son to Combat to determine the winner.
Comment: That may be, or at least may have been, the case in England. But the question does not say that the story takes place in England. France had different rules, Russia even more different rules, and don't even think of Arabia.
Comment: To be fair though, we are on an English speaking forum - and the author didn't specify.
Comment: Yes, we are on an English speaking site. So what? We cannot apply the modern rules, because they differ greatly among the English-speaking states. And anyway, the past is a foreign country. Moreover, the rules which applied in feudal post-conquest England were introduced by the conquerors, who were Frenchified French-speaking Northmen; the original pre-conquest Anglo-Saxons had very different rules.
Comment: That's why the source I included went back to the 1200s. Post Norman Conquest and definitely Medieval.

Right of Conquest and Patrilineage


Why is the verb not in the second position in "Lass uns am Sonntagabend einen Spaziergang um den See machen."?

Question: Why is the verb not in the second position in "Lass uns am Sonntagabend einen Spaziergang um den See machen."? I don't understand the word order in this sentence. Could someone please explain? Thanks.
Answer: The verb is no more in second position than in the simpler "Mach(e) einen Spaziergang um den See". Both are imperatives, and the verb order rule you cite applies to indicative sentences only.
Answer: It's an imperative, so the verb is in first position.
Answer: Lass is the root form of the Verb lassen (infinitive) and it's used as the imperative here. That's why you just drop out the ending en. And because it is imperative, the verb is at the beginning. The verb machen is at the end and in its infinitive form, because it is the 2nd verb in the sentence.


Who founded the Argentine mate herb enterprise Cruz de Malta?

Question: Who founded the Argentinian herb mate enterprise Cruz de Malta? This company sold herb mate for more than a century. Nowadays, the brand belongs to Molinos.
Comment: downvote for not showing prior research.
Comment: [This unsourced blog post](http://www.yerbamateblog.com/yerbamate_review/cruz-de-malta-yerba-mate/?_sm_nck=1) states that that Cruz de Malta brand was originally Chilean and only purchased by Molinos de la Plata in 2006.
Answer: Cruz de Malta, a yerba mate tea (herbal tea), was originally a brand of Sociedade Comercial Francisco Mendes e Companhía (aka Francisco Mendes & Cia), a company founded by Francisco Mendes Gonçalves in 1874 in Argentina and "dedicated to the industrialization and sale of the herb received from Brazil and Paraguay." (via google translate).

Francisco Mendes Gonçalves. Source: Memoria Rondonense
Francisco Mendes Goncalves (b. 1847, d.1930) was Portuguese-born and emigrated to Rio de Janiero sometime before or during the Paraguayan War (1864 - 70). Both he and future partner Thomaz Larangeira were traders who benefitted from the war.
A few years after the war ended, Gonçalves  went to Buenos Aires (Argentina) where he married and set up his company in 1874 to manufacture Cruz de Malta (and at least one other brand) using the leaves sent from Brazil and Paraguay by Larangeira.
In 1882 or 1883, they merged their companies to form Empresa Matte Larangeira, with Francisco Murtinho also a partner. By the early 1890s, according records in the company archives, Cruz de Malta was a high-priced, successful brand sold in Brazil, Argentina and Paraguay.
The Cruz de Malta farm was located in Guayrá (which straddles the border between Brazil and Paraguay) and remained for a while in the hands Goncalves family after Francisco's death in 1930. Francisco was also a respected banker in the 1900s.

Main sources:
Paulo Roberto Cimó Queiroz, 'A empresa Laranjeira, Mendes & Cia. e sua presença
nos ervais sul-mato-grossenses (1903-1917)' (Universidad de Buenos Aires, 2018) (link automatically downloads PDF)
Paulo Roberto Cimó Queiroz, 'A Companhia Mate Laranjeira e seus fluxos mercantis (1891-1902)' (III Congreso Latinoamericano de Historia Económica y XXIII Jornadas de Historia Económica
Simposio 5: Transportes y Servicios en los Mercados Regionales y Nacionales en América Latina
(Siglos XIX y XX))
Sócios da Cosan têm 50 mil hectares no Paraguai; no MS, fazenda em território Kaiowá
История одной монополии (The history of one monopoly)
Comment: Ah, I see. Maybe I should edit that bit.
Comment: Somehow your links currently load very slow and sketchy. However wasn't the foundation 1884, for a bank "aparece el Banco de Comercio, fundado en 1884,"? That is: your link appears confusing towards the date given, NB: The Brazilian page giving 1874 has a very curious starting date! As the dictionary entry for erva & erva mate!
Comment: @LаngLаngС Concerning the bank, I'm not sure I follow you - he had no involvement in banking that I can see until the 1900s. It's not really relevant, just extra info about FMG. Your NB: yes, curious indeed (and it's a government site)!
Comment: Your number 1874 stands un-underlined, so I assumed *first link* is ref, but it only presents the banking date for 1884. So out of this similarity I inferred "mixup on your part". Then I read the second link after it finally finished loading and found that my already started comment was just *my* confusion. A matter of formatting?
Answer: Sorry but my english is very poor.

La yerba mate Cruz de Malta se elabora desde 1874, siendo una de las marcas con más trayectoria en el mercado de la yerba mate, uno de los máximos placeres de los argentinos. Es una yerba que cree en la autenticidad del sabor y en la calidad asegurada desde el origen. Elaborada con un cuidadoso proceso de cosecha, selección y estacionamiento de la hoja extraída de las plantaciones del Noreste de nuestro país

From Google Translate:

The yerba mate Cruz de Malta has been made since 1874, being one of
  the most experienced brands in the yerba mate market, one of the
  greatest pleasures of Argentines. It is a herb that believes in the
  authenticity of taste and quality assured from the beginning. Made
  with a careful process of harvesting, selection and parking of the
  leaf extracted from the plantations of the Northeast of our country

Fuente: https://www.molinos.com.ar/nuestras-marcas/cruz-de-malta.aspx
Comment: You could add the google translation yourself...
Comment: Looking at the translation, this does not answer the question.
Answer: One of the members who founded this company was Francisco Mendez Gonzalves.
Comment: This answer would be improved by sources.