What are world coordinates and pixel coordinates in LibGDX

Question: I searched the Internet for these two terms, but there is no reference to them. I just started learning LibGDX, so please explain in the simplest way possible
Comment: Here comes documentation to understand all about coordinate systems used in OpenGL-based libraries, this particularly from libGDX repo: https://github.com/libgdx/libgdx/wiki/Coordinate-systems
Answer: These terms are not specific to libgdx, really.
"Pixel coordinates" are positions that correspond directly to pixels on a screen or in an image. They tend to be a natural fit for working and thinking in 2D: an object at (0,0) might be at the bottom-left of the screen. An object at (15, 0) would be 15 pixels to the right of that first object.
"World coordinates" have a less fixed reference. In 3D graphics, geometry (stuff you draw) tends to flow through a series of coordinate systems. Things start in model (or object) space, where they are defined, usually in such a way as to center the geometry around the origin of this coordinate space.
Geometry is then transformed from model space to world space, which is a coordinate system where the origin is at some defined central or logical location for the map/world/level/et cetera. This transformation into world space occurs for each model based on where that model should exist in the world.
There are further coordinate systems after this, but you didn't ask about them specifically and they don't have an additional bearing on the definitions. What remains that is important is that model and world space don't have fixed metrics. Pixel coordinates do: moving from (0,0) to (10, 0) moves you ten pixels.
But model and world space don't have fixed metrics, it's up to you and your program to assign values and meaning to the numbers. Moving from (0,0,0) to (10,0,0) in world space could mean moving ten feet, ten miles, ten meters, or ten pixels, depending on how you are choosing to interpret the values of the coordinates.
Comment: Finished up mine at like the same time dang. But I think in yours it is worth mentioning the matrices that the 'geometry' goes through to change systems.
Comment: Good answer, no need to write another one. In addition, I'd mention the abstraction of world coordinates, used as a metric system independent from the device the game is running on, as you said.
Answer: I will assume that it refers to coordinates in the same style as most other systems.
World Coordinates: Coordinates in respect to the larger world. These coordinates are relative to a global origin of the world, together with many other objects also placed relative to the world's origin.
Pixel (Local) Coordinates: Coordinates of your object relative to its local origin; they're the coordinates your object begins in.
World Space: If you import all your objects directly into the application they would all be stacked on each other around the world's origin of (0,0,0). The coordinates in world space are exactly what they sound like: the coordinates of all your vertices relative to a (game) world. This is the coordinate space where you want your objects transformed to in such a way that they're all scattered around the place (preferably in a realistic fashion). The coordinates of your object are transformed from local to world space; this is accomplished with the model matrix.
The model matrix is a transformation matrix that translates, scales and/or rotates your object to place it in the world at a location/orientation they belong to. Think of it as transforming a house by scaling it down (it was a bit too large in local space), translating it to a suburbia town and rotating it a bit to the left on the y-axis so that it neatly fits with the neighboring houses.
Local Space: Local space is the coordinate space that is local to your object, i.e. where your object begins in. Imagine that you've created your cube in a modeling software package (like Blender). The origin of your cube is probably at (0,0,0) even though your cube might end up at a different location in your final application. Probably all the models you've created all have (0,0,0) as their initial position. All the vertices of your model are therefore in local space: they are all local to your object.


Resampling Modis and Sentinel 2 rasters

Question: I am resampling Modis and Sentinel 2 rasters in QGIS. I am working with surface reflectance values and I am having trouble obtaining the results that I am looking for. I have isolated my rasters down to their red band surface reflectance values. I am trying to threshold these reflectance values to >0.45, while at the same time retaining the pixel value. Every method of thresholding I have attempted results in all pixels having a value of either 0.0 or 1.0. How do I retain my original reflectance values while still thresholding?
Comment: Welcome to GIS SE. * the results that I am looking for*... Be more specific, please. *Every method of thresholding I have attempted results in all pixels having a value of either 0.0 or 1.0*... Add what have you tried as an edit. Are you using raster calculator? Could be the algorithm used
Comment: I have used the raster calculator for all processing and thresholding. Basically, my final calculation is the band isolated .tif file> 0.45, but this results in the loss of all pixel reflectance values. I am looking for my pixels to be either black or white, no grey-scale, but to have values with a range of  0.0-1.0, not 0.0 or 1.0. I want the pixels to have a binary type value, either yes or no in the form of black or white, but to retain their surface reflectance value.
Comment: Welcome to gis.stackexchange! Please edit the title of your question to include enough information for future visitors to be able to find this thread when looking for the same problem.
Answer: If you use:
<code>"raster@1" > 0.45
</code>
The output will be 0 or 1. 0 for a false result in condition evaluation and 1 for true.
If you want to keep values for true evaluation, use:
<code>("raster@1" > 0.45)*"raster@1"
</code>
If you have a pixel value of 0.56, the evaluation will be:
<code>("raster@1" > 0.45)*"raster@1"
     0.55   > 0.45)* 0.55
            1      * 0.55
                 0.55
</code>

Resampling Modis and Sentinel 2 rasters


Laptop keyboard doesn't work after suspension/hibernation

Question: On my Ubuntu 20.04 (problem persists since 16.04) Sony VAIO laptop if I close the lid, wait till the yellow led to blink and then turn the laptop on again, awakes everything but keyboard, which turns on it's backlight after first keypress but doesn't react to anything, so does the touchpad. So I get almost fully working system, but completely unusuable.
My problem is that I don't even know where to search for problem origin. I don't know how the laptop power and keyboard management works in Ubuntu, not on systemd or SysV level, nor on kernel level. So, no logs for you, my friends, until you ask for any. =)
How can I solve this very annoying issue please?
Comment: maybe helps https://askubuntu.com/questions/916465/ubuntu-17-04-keyboard-not-responding-after-suspend
Answer: Re-install "xserver-xorg-input-kbd" from package manager -- and possibly other xorg-input-devices that got messed up from your latest kernel update!
Answer: Maybe your problem is related to Bug 195471.
It's a bug that has been present in the Linux kernel since a few years ago.
I have a VAIO laptop too, and it's affected with that bug.
I have found two workarounds:

After resume to not press any key but Caps Lock, wait a couple of seconds until the Caps Lock LED turns on, and then the keyboard works normally.

If you're willing to compile the module yourself, take a look to this patched kernel module, it even includes a systemd service unit that automatically restarts the driver after resume, so this is more like a fix than a workaround, but I doubt it would be merged to upstream kernels as it seems that the models affected are not that many.

Hope this helps!


Is there any authenticity to the book 'The Deathbed Sutra of the Buddha: Or Siddhartha's Regrets'?

Question: I found this book in a local bookstore and went online to research it. I could not find much reference to it.  The author, George C. Adams Jr., purports to have been given a lost sutra of the Buddha, given on his deathbed, to Ananda. It looks like a work of complete fiction to me but was wondering if anyone has more information on it.
Answer: Deathbed Sutra of the Buddha
From the customers' reviews of the book, I get the impression that it is a fictional work to provoke a reassessment of one's thinking in light of controversies.
A few reviews from customers:

This book a very clever merging of philosophy and fiction, which examines and challenges some fundamental Buddhist beliefs in a manner that manages to be both deeply insightful but also delightfully entertaining. It's a short work, but packed full of dense analysis of Buddhist thought, using the clever device of a fictional conversation between Buddha and his attendant, Ananda. Readers are likely to love it or hate it, but in either case it's definitely a great read.
While it's not a "DaVinci Code for Buddhists" as stated on the back cover, it does offer a fast moving narrative conversation that moves along through the final night of the Buddha's life. It left me wondering what will happen next, and what will the Buddha say next? Thought-provoking and fun at the same time.

MVFWIW is if you are new to Buddhism then it is advisable to learn about the authentic teachings first and when you have cultivated wisdom and faith then to challenge that faith and wisdom with controversies.
As it is Theravada, Mahayana and Vajrayana have provided enough divergent materials for your wisdom and faith to work on.
Comment: "The Da Vinci Code" is fiction (so if its publishers compare this book to *The Da Vinci Code* that's evidence for its being fiction i.e. [Historical fiction](http://en.wikipedia.org/wiki/Historical_fiction))
Answer: I'm the author of the Deathbed Sutra, so I can assure you that it's fiction.  It was intended as a work of philosophical fiction which examines some problematic aspects of the Buddha's teachings in the Pali sutras.
Answer: Based on one of the reviews of the book:

The conversation recorded in this Sutra, between Lord Buddha and his
  closest disciple Ananda, largely unravels the core teachings of
  Buddhism, and portrays the Buddha as condemning himself to hellfire on
  his own deathbed for the errors in his teachings which he suddenly
  confesses to. In these, his final teachings, Buddha is in fact veering
  in a completely new direction, away from the austerities, sensory
  deprivation and renunciation which are the hallmarks of his teachings
  in the Pali Cannon, which form the traditional basis of Buddhism. He
  practically does a u-turn, and goes full speed towards a more
  humanistic teaching, one that discourages renunciation and accepts
  romantic love, one that honors the sacred value inherent in sensory
  contact with the objects of the world, and even affirms the existence
  of a Self – an entity consisting of the noblest essence of the
  personal identity. Having spent much time around several Enlightened
  Masters of the modern age, I personally cannot imagine any of them
  having such a deathbed renunciation of their core teachings. Such a
  strange turn of events would, I think, be reserved for deluded
  teachers such as Rev. Jim Jones, or perhaps Andrew Cohen, who after
  three decades of claiming himself Enlightened suddenly admitted that
  he wasn't Enlightened after all. I certainly never imagined the Buddha
  to be in that category.

Sounds to me like the author is trying to create some controversy to sell his book by promoting his own ignorant understanding of Buddhist teachings. Wrong View, Wrong Intention, Wrong Speech, Wrong Action and Wrong Livelihood being displayed here. Bad karma all around.


How to use Disqus for some categories, and FB comments for others?

Question: I didn't find anything related to what i'm trying to do.
My WP blog have several categories.
For one specific category, in which I publish short news and viral content, I'd like to use Facebook comments as the default commenting system.
For any other categories, i'd like to keep using Disqus as usual.
My problem : since Disqus is taking over with a hook (I guess), how can I have Facebook comments take over instead of Disqus if in_category(x) ? Where would that happen, and how would you do ?
(Ideally, i'd like to deal with it in functions.php instead of having to edit core Disqus plugin files)
Answer: Do you need to use the Disqus plugin? ie are you synchronising with Wordpress comments (own your own comments etc). If not, it's easier and quicker to remove the plugin and just edit the comments.php file (the actual file depends on your theme but this is the most likely one).
This answer has the Disqus javascript code and you can get the Facebook code from Facebook's Developer Site, and then simply do an if-else with in_category(..) as the condition.


Any way to load/execute scripts (game-logic) included in a post-release DLC (Unity3D AssetBundles) on iOS since it seems its not allowed?

Question: We are making a game where players will be granted access to new levels every week and these new levels will probably be downloaded from our server as Unity Asset Bundles
The only issue is, as mentioned here , ios and other app stores dont allow loading/executing of scripts this way even if they allow you to load these newer asset bundles without doing the full update cycle. So really we need to know how game-logic scripts, etc can be executed for the new levels that are going to be released via Asset Bundles and downloaded from our server. Our server will be authoritative btw. I am sure there is a way since big game publishers are able to do post-release DLC and really, thats what we are after too - Just more regularly, whilst being in-line with app store regulations.
Our usual workflow until now was just publish and then release a big update months down the line. Not every week.
Comment: From what I've seen all your script code gets built into a DLL on build. Replace this DLL with an updated version and your asset bundles should be able to access these new scripts. I've tested this ( replacing the DLL in a build ) and it did work. However, I'm not sure if this will work in every situation.
Comment: I wanted to comment in the other question but I can't. You say "big game publishers are able to do post-release DLC" but are you sure they are loading scripts? It's really a need in your game to load new scripts with new levels? Again, I'm answering as android developer.
Answer: Many games are data driven, and apple is fine with you downloading data from your servers which changes the behavior of the game, adds content, etc.  If you can't do with data what you need to do, you have to put out a new exe that exposes new features to data, that will let you do more without executable patching. Rinse and repeat.
Answer: It's actually not that uncommon to release new "downloadable" content with a mandatory patch which is rolled out to all users through the normal app updating system and then just unlock it when the user paid for it.


How to archive cell changes in new tab?

Question: I have a Google sheet that I'm collecting some statistics in.  There is a particular cell that I'd like to track changes in a separate tab. I'm looking for a function to copy cell if the cell data changes to a new cell in a different tab.
Comment: Welcome. Please add a brief description of you search/research efforts as is suggested on [ask]. By the way that can't be done by using a spreadsheet function but Google Apps Script on edit trigger could be used for that.
Answer: Probably not the answer you are looking for, but a new feature was added to Google Sheets that tracks down all changes of any given cell:

Note: Some changes might not show up in the edit history. Some examples are:

Added or deleted rows and columns
Changes to the cell's format
Changes made by formulas
Answer:
you will need something like this:
function onEdit() {
    var reference = 'Sheet1!A2';
    var rng = SpreadsheetApp.getActiveSpreadsheet().getRange(reference);
    rng.setValue(rng.getValue()+1);
    var ss = SpreadsheetApp.getActiveSpreadsheet ();
    var ss = SpreadsheetApp.getActiveSpreadsheet ();
    var source = ss.getRange ("Sheet1!A2");
    var destSheet = ss.getSheetByName("Sheet2");
    var values = source.getValues().filter(function(e) {return e.some(function(f) {return f})});
destSheet.getRange(destSheet.getLastRow() + 1, 1, values.length, values[0].length).setValues(values);
}
anytime cell Sheet1!A2 changes the range Sheet1!A2 gets archived in Sheet2

How to archive cell changes in new tab?


Where to learn Athabascan grammar?

Question: I want to try and understand Athabascan grammar, but I don't know very much about it, and, because of this I also don't know what kind of Athabasca language I want to learn. I have looked on Wikipedia and I have found it fairly helpful, but where/how might I get a fairly complete understanding of the languages?
Answer: Suggestion 1 is to pick one language as your "wedge" into Athabaskan, either Navaho (very many resources) or Slave (one very good one). Alternatively, for snippets across Athabaskan, you could try Fernald & Platero 2000 The Athabaskan languages.

Where to learn Athabascan grammar?


Could an 150 pound human have flown on the back of some species of pterodactyl (assuming they still existed)?

Question: I'm curious if any type of flying animal that ever existed would have been able to carry your average 150 pound man.
Answer: Assuming that the heaviest pterosaurs (Quetzalcoatlus, Hategopteryx) probably weighed around 200 kilograms... No. This extra load would have required a huge amount of extra muscles and the forces acting on the wing bones (which are the distal phalanges of the 4th finger) would be too high.
The biggest bird was Teratornis incredibilis with an estimated weight of around 25 kilograms... This should answer your question.
Comment: I assume you mean biggest *flight capable* bird, given modern ostriches typically reach weights of [over 150kg](https://en.wikipedia.org/wiki/List_of_largest_birds) (adult males). In any case, the extinct flighted bird [*Argentavis*](https://en.wikipedia.org/wiki/Argentavis) is estimated to have weighed in excess of 70kg.
Comment: Thanks for adding this! I'm no native speaker... So sorry for my confusing English. You are totally right with Argentavis but even this bird wouldn't carry a human


Cookie::forget not working laravel 5.1

Question: I'm trying to get Laravel 5.1 to delete my cookie, however it will not delete even though i'm returning it with my redirect.
return redirect('/voucher')->withCookie(Cookie::forget($cookie));

Have I done something wrong?
Comment: What is the value of $cookie ?
Answer: Maybe I am wrong, but you are probably using cookie object in place of cookie name when calling Cookie::forget($cookie). Unless $cookie is a string containing cookie name, you should try something like this:
return redirect('/voucher')->withCookie(Cookie::forget('cookie_name'));

Answer: I know this is already an old and answered question but I got here recently and if I'm correct, the cookie needs to be 'queued' for the next response.
You can do that by adding the cookie manually to the response as @Jan.J already described in his answer. But if you need to do it inline, this might also work for you:
Cookie::queue(
    Cookie::forget('cookieName')
);

The CookieJar will pass all queued cookies to the next response.
Comment: You saved my day. This is quite unusual syntax for me =\
Answer: In my case there was an array stored in the cookie, so none of provided methods has worked. Array should be deleted providing exactly pair of array:
Cookie::queue(Cookie::forget('array_name[provide_key]'));

Answer: First, make sure you've imported Cookie class with use keyword, like below :
use Cookie;

Next, create a function and delete a cookie by name
Cookie::queue(
  Cookie::forget('cookie_name_first')
);

Cookie::queue(
  Cookie::forget('cookie_name_second')
);

Answer: public function funname(CookieJar $cookie)
    session()->flush();

$cookie->queue(cookie()->forget('user_email'));
$cookie->queue(cookie()->forget('user_password'));
return redirect('/');

Answer: You can also do it this way:
redirect('/')->cookie(cookie()->forget('my_super_cookie_name'));

Answer: Unfortunately none of the above worked for me, I'm not sure if it's a specific issue with this version of Laravel (5.1).
I did manage to get it working using raw PHP instead, by overwriting the existing cookie with an already expired one, I also had to specify a path to get this working. It's not as elegant as using a facade however.
setcookie('COOKIE_NAME', time() - 3600, '/');

Answer: Recently I faced this issue while still on localhost but the issue was that I have written some code which weren't normal in my process of trying to overwrite the session config file.
Therefore
The default laravel
Cookie::queue(
   Cookie::forget('name')
      ) ;

Should work perfectly fine if you have not done any changes on your
    session.php config file.
 Check it out and you should be good to go.
If you have made some changes try to ensure that your code conforms to standard and everything should work fine.
Answer: Your code is perfect, so there's some other issue.
Cookies are tricky little ^##$$ and to make things worse are dependent on the client's implementation; various browsers may well handle cookie edge cases differently, or may even have had long-standing bugs relating to their cookie handling.
The "removal" of a cookie actually involves sending an update to the cookie but with an expiration date in the past. From RFC 6265:

Finally, to remove a cookie, the server returns a Set-Cookie header
with an expiration date in the past.  The server will be successful
in removing the cookie only if the Path and the Domain attribute in
the Set-Cookie header match the values used when the cookie was
created.

If your Laravel code looks fine, as in the original question, I would suggest inspecting your cookies in your browser's dev tools. For example, Chrome's "Network" tab has a "Cookies" tab which shows you the Request Cookies and the Response Cookies. You may find there is a subtle difference between the original cookie and the cookie being sent to unset it. As per the RFC above, a difference in the domain (even just a leading dot) will break the cookie removal.

Cookie::forget not working laravel 5.1


Difference between "banner" and "flag"

Question: What's the difference between the meaning of "banner" and the meaning of "flag"?
Answer: While the two terms are sometimes interchangeable, I would say that the usage would differ depending on the shape and purpose of the item in question.
A flag would typically be square or slightly oblong, as with the national flags of most countries. A banner tends to be more elongated, for example as you might see hung across a street during a parade. Flags tend to be attached by one side to a pole, whereas banners are typically attached at both ends, either fixed or on two poles. Furthermore, flags usually carry representative symbols or colours (e.g., chequered flag), whereas banners generally carry written messages (e.g., Happy Birthday Joe!)
On this basis few English speakers would refer to, say, the Union Jack as a banner. Likewise, Happy Birthday Joe! would not be called a flag.
Answer: Banner is used much more broadly, representing things from heraldic symbols to newspaper headlines.  In general it's a thing that announces someone/something.  A flag is a specific type of banner, used for things like national symbols or decorations.
Answer: A banner can mean a flag in the sense that it's a symbolic representation of an entity, such as a military unit or a country.
A banner can also refer to a sign, in any shape or material, used to show a message or an advertisement either in a tangible form (such as an advertising banner for a café) or in an intangible form (such as an advertising banner for an online cosmetic shop embedded in a webpage).
A banner can also be employed figuratively to refer to a cause or purpose such as He gunned down the drug dealers under the banner of justice and law enforcement.
A flag also has specialized usage in computing that represents a binary true/false value.
Another common synonym of banner/flag is standard.
Comment: Or like in la Marseillaise - ... L'étendard sanglant est levé... (the bloody flag is raised)...
Comment: I wish I could accept all answers... Thank you!
As a computer programmer, I knew about the meaning of "standard" (as in ISO or ANSI) as a common accepted specification of something (in spanish: "estándar"), but I did not know about it being a kind of flag (now I realize it's just like -again in spanish- "estandarte", wich is usually a huge badge-like flag mounted on a cross).

Difference between "banner" and "flag"


Recognize the celestial object in UMa

Question: I'm new to Astronomy observations. I took a picture from my phone of a object near beta Ursa Major and m97 which I couldn't find (I was on low magnification), I couldn't find out what it was. Any ideas of what it was (or is it due to my telescope being set up incorrectly)?
Answer: It depends on how long you exposed the image.
However the image looks like a shot of maybe a second or so through the eye piece. Then most likely explanation is you see the somewhat blurred image of $\beta$ UMa, and nothing else due to the too short exposure time.
Galaxies don't need high resolution to be detected (they are MUCH bigger than stars. The galaxies in the Messier catalogue typically are comparable to the size of the full moon), but it needs high sensitivity and / or long exposure times.

Recognize the celestial object in UMa


I have XBOX Live but on MW3 my guest can't play?

Question: I've played Modern Warfare 3 before with a guest and I redeemed my code just an hour before. It just keeps on saying "Can't sign in" and it's really annoying - can anyone help?
Comment: Can you sign on without a guest?
Comment: Yes that's the weird thing
Answer: You can't sign in while a guest is also logged in. To get this to work you need to

Make sure every profile except for your Xbox Live Gold account is logged out
Go to Multiplayer >> Xbox Live and get signed in
Hit the A button on another controller

Xbox Live won't let you sign in to Call of Duty Multiplayer with any profiles that aren't gold logged in. The "Guest" account technically isn't gold, so you're getting rejected for that. Adding a guest player is done on the Call of Duty server, not your Xbox.
Comment: Should note that in MW2, you couldn't do 2 player on the same console on XBox live at the same time. Every player had to be on his own game and console.


proper wiring of a relay,

Question: Regarding the wiring of a relay, it seems to me it is customary to wire the hot side (L1, +) of power to the COM terminal, and not NO/NC terminals (which would be the outputs).  Is there a reason for this?  Is there any reference? Or does it just support logical sequential flow when reading a schematic wiring diagram?
Comment: Could you make it a bit clearer? With schematics to illustrate your points.
Comment: In a Form C contact (one with a COM / NO & NC) there are two states, energized and not energized, in these state there are two possibilities, COM is connected to NC and COM is connected to NO. In no state is NO connected to NC.
Comment: if you are routing power to two places then use the COM terminal.  ... if you are using the relay as SPST switch, then it makes no difference ... NOTE: accessibility to measuring probes could be a factor to consider
Answer: There are two schools of thought on this...
Option 1: Line to common..

simulate this circuit – Schematic created using CircuitLab
This is the classic way to connect it, and gives you the option to pick off the normally closed connection later if you need to.
Option 2: Line to normally open..

simulate this circuit
This method stops you from later connecting in the normally closed line, however it also means you do not have unconnected live terminals in the relay which may provide a safety benefit.

For most relays, electrically, and mechanically, it does not make much any difference. If your relay has special features, it may list a preferred connection method in the specification data sheet.
Failing any manufacturer instructions, which method you chose is really arbitrary.

ADD: If you are using multiple relays within the same system, or even multiple products, it is however prudent to follow the same wiring on them all. Set a company standard as it were.
Do not have some connected live on common and others live on normally open.
If your do you will just confuse, and potentially harm, whomever is working on it, and probably even yourself.
Answer: Personally, I usually prefer to wire the line to the COM terminal because it's typically closely coupled to the coil, especially with the cheaper types of relay- there is often a metal part that runs right beside the coil. Fancier types sometimes have pusher construction that better isolates all of the contact metal- and often sport high coil-contact breakdowns of many kV.
The N.O. terminal goes to the load, where there is a often lot of noise and high voltage transients at switching, especially with an inductive load. The photo below is of an automotive type relay, but the internal construction is similar to inexpensive common types such as JS1 from Matsushita (but turned on its side).

All the metal with red arrows is connected to the com terminal, only the metal with the green arrow is connected to the N.O. terminal.

proper wiring of a relay,


How do I add a tagname on a entity in Minecraft?

Question: I'm making a mc map and I want a zombiefied piglin walking over some blocks. I found out how to make him move, but I need a tagname for him, so it would only affect him and not the other piglins. How can I summon a entity with a NBT? I have searched almost every site and just can't find it. I tried CustomName but then the entity was not regonised. (Sorry for bad Englisch, I'm from Netherlands). Hope someone could help me...
Comment: Is there anything that you've already tried?  Can you show us what commands you're using?  You'll find that others will be more receptive of your question if you've shown some effort in solving it yourself.  Please edit your question with the extra details.
Comment: You could just name the piglin with a nametag, I think.
Answer: The Minecraft Wiki is definitely the first place you should look for command help. If you haven't heard of it, trust me, it is a lifesaver in commands.
The command you'll want to use is the /tag commmand. This lets you tag your mob with a recognizable text string and reference it again afterwards using the same string. Like this:
/tag @e[name="THE_PIGLIN",type=piglin] add movingPiglin

To reference the tagged entity at the end, you can learn how target selectors work, specifically the tag = argument.
@e[tag=movingPiglin]

Comment: Thxx, it helped


Django DRF use same URL pattern for different views

Question: In Django Rest Framework, I have two separate views for the same model. I would like to use the same url pattern to access both views, and differentiate between the two based on the method that is used. So I have something like:
class MyObjectListAPIView(generics.ListAPIView):
    pass

class MyObjectCreateAPIView(generics.CreateAPIView):
    pass

Both views obviously would have different logic. The url pattern for both would be 'myObjects\', and depending on the method that is used (GET  or POST), it would need to refer to the appropriate view (MyObjectListAPIView or MyObjectCreateAPIView respectively). Is there a way to achieve this (without reverting to plain Django and losing the functionality of DRF)?
Comment: That is typically done in a `ViewSet`.
Comment: @willeM_VanOnsem thanks for the pointer but could you please elaborate just a little bit?
Answer: Short Answer:
The out-of-the-box way to achieve this is with ViewSets, specifically the ModelViewSet, in conjunction with the default ModelSerializer and DRF's built-in DefaultRouter. It would look like the below:
## views.py ##
from rest_framework import viewsets

from myapp.models import MyModel
from myapp.serializers import MyModelSerializer

class MyObjectViewSet(viewsets.ModelViewSet):
    queryset = MyModel.objects.all()
    serializer_class = MyModelSerializer

## urls.py ##
from django.urls import path, include
from rest_framework.routers import DefaultRouter

from .views import MyObjectViewSet

router = DefaultRouter()
router.register(r'myObjects', MyObjectViewSet)

urlpatterns = [
    path('', include(router.urls)),
]

Note, this will achieve what you want, i.e. same endpoint 'myObjects/' with different logic based on HTTP Method (GET -> List, POST -> Create) -- BUT note that it will also do more than just this, as you will also get the associated Retrieve/Update/Delete functionality at the endpoint 'myObjects/<pk>/'.

Longer Answer:
If you want to avoid ViewSets for any particular reason, you would just use the GenericAPIView with the ListModelMixin and CreateModelMixin as well. This could look something like the below:
## views.py ##
from rest_framework import generics, mixins
from myapp.models import MyModel
from myapp.serializers import MyModelSerializer

class MyObjectListCreateAPIView(mixins.ListModelMixin,
                                mixins.CreateModelMixin,
                                generics.GenericAPIView):
    queryset = MyModel.objects.all()
    serializer_class = MyModelSerializer

    def get(self, request, *args, **kwargs):
        return self.list(request, *args, **kwargs)

    def post(self, request, *args, **kwargs):
        return self.create(request, *args, **kwargs)

Then simply register it to your URLs file as you normally would for any Class-Based View, with no need for the Router here; e.g. like the below:
## urls.py ##
from django.urls import path

from .views import MyObjectListCreateAPIView

urlpatterns = [
    # ..any other url patterns.. #
    path('myObjects/', MyObjectListCreateAPIView.as_view())
]

This should satisfy your constraints exactly, without the additional features the ViewSet offers.
The official DRF docs do a very good step-by-step tutorial on how to move from 'APIView' to 'GenericViews' plus 'Mixins', all the way through to 'ViewSets with Routers', and the docs are pretty comprehensive. I recommend taking a look at it here if you haven't already.


Will my lost cat remember me after 4 years

Question: I lost my Maine Coon four years ago. I believe I have found him but he's not trusting to come to me. Is that normal for a cat not to remember me.
Comment: Either remembering you or not remembering you could be  "normal". How long you had the cat might make a difference.
Comment: How long have you had him? I would think that a cat you've had for 12 years will remember you better than a cat you've had for 1 month. In general, a cat's behavior derives from its past experiences, so you need to consider how much of its life (as a % of its current lifetime) it has spent with you. E.g. our cats (born in the wild and lived wild for 6 months) have acted notably better once they had been pets for longer than they'd been wild cats, because their memories are no longer dominated by having lived in the wild.
Comment: Cats are more likely to remember places than people. Have you moved house since you lost him?
Comment: If you are sure it's yours cat invest your time and patience to build trust to you again. It may take significant timespan like months or a year even.
Comment: you can also invest the time and effort if you are not sure, anyway ;)
Answer: A kitten the age of 1-6 months will probably not remember you after 4 years. They are a little like human babies before the brain is fully developed. The memories might get lost or not stored the right way.
A cat at the age of two years+ will remember you, the owner, if the cat has bonded to you. Tests on the long term memory of cats show cats to have a long term memory span of 16 hours, but as a cat owner, I can definitely say cats remember for way longer than this.
If an adult cat gets lost, it will remember you for several years given it has bonded with you before it got lost.
There are examples where cats have been found after many years, and they have jumped straight into the owner's lap.
Cat's memory do not function like the human memory. The cat remembers places and dangerous or safe areas. So if you take a cat to a place it has been before and it gets scared, it might run to the tree you removed last year because it was a safe spot the last time it was there.
Link #1 https://en.wikipedia.org/wiki/Cat_intelligence
Link #2 https://www.cuteness.com/article/cats-remember-owners-after-years
Answer: It is hard to give a conclusive answer, because memory, remembrance or even bonding might work differently for a cat.
Your smell or voice might feel familiar to the cat, even after years. This familiarity, if forged by affection, might make your cat feel at ease in your presence. This does not necessarily mean that the cat remembered you, but he/she recalls that your smell or voice is associated with nice things in the past.
The familiarity vanes with time and after four years, especially if he/she had dealings with other people with smell or voice similar to yours.
Another way to think of this is comparing cat intelligence with that of a child. Usually, cats are assumed to be as intelligent as a 1-4 year old child. Even though children have a great memory, they don't necessarily have the organisational skills we do to manage this memory. I have read tales of war orphans adopted by the military officers who raised them as their own, disregarding their native identity. The ones adopted around the age of 1-2 years usually remember nothing of their past lives and even if they remember something, the brain corrects the gaps and contradictions in a way it feels logical. As the age of adoption goes up, they first realise there are hard to solve gaps and contradictions in their memory, some familiarities that they can't explain. Children above the age of 6 usually remembers their native identity and the fact that they are adopted. Do not use these information on their face value, some parts of it might be wrong or misleading. Instead, extrapolate them to guess about the memory of a cat.
I had several personal experiences with my cats that might help. I visit my hometown once or twice a year, but the cats there always seemed at ease with me. I believe this is because they trust my parents who are at ease with me, whom the cats trust unquestioningly, rather than them remembering me. This is better for me because I like some rough play that they sometimes complain.
I was away from my cat for three weeks and after which he ran straight to me and refused to stay away from me. He is a wandering cat so he had other houses that took care of him, but other than staying with the he followed me 1.5 km to my temporary accommodation and spent the night with me. The same cat however wasn't that affectionate after we were two months away.
The bottom line is that the cat might feel comfortable/indifferent or cautious in your presence. These all depend on the reinforcements he/she had after you were estranged. I would suggest trying to establish a relation from scratch and hope that the cat's prior experience with you speeds the process.
I hope this helps.


Can I use a Shimano BL-MT200 lever on a Shimano BR-M446 brake caliper?

Question: I have a leakage on my lever, and can't find any Shimano BR-M446s for sale. Was wondering if Shimano BL-MT200s were compatible.
Comment: I want to do the same thing. How did it go?
Comment: @SimãoFerreira The user is greyed out which means deleted, so I'm afraid there won't be an answer because he or she will never get notified. Based on the only answer, it probably worked and the only concern would be fitting a lower-tier groupset, so looks and feel might be a little different. However, not even their lowest tier _Tourney_ is terrible based on my experience, so it's probably not a big deal to go "one down" on an entry level bike. As you wouldn't really notice between 105 and Ultegra just by feel...
Answer: The corresponding lever for the ALIVIO BR-M446 caliper appears to be either the BL-T445 or the BL-M425 (depending on the size; 3 finger vs. 2).  You might have more luck searching for those product numbers instead.
The ACERA BL-MT200 seems to have very similar specs to the ALIVIO BL-T445, though based on the angle to the clamp it may stand off the bars a bit further.  Specifically they use the same hose kit, SM-BH59-JK-SS, so the hydraulics should be compatible.  My major concern, however, would be that the Shimano site explicitly notes that the ACERA part has "braking power tuned for entry level riders."
A leak might just be down to the hose - or fittings - though, so you might want to find out if your LBS can service it for cheaper than getting in new levers.
Comment: Went to the LBS already, and the leak is happening at the oil reservoir cover, so i know its not the hose or fittings. As for the lever, the the BL-T445 is not available at my country. I have to go with a MT200 or a more expensive Deore lever. My concern is the incompatibility of the hoses.
Comment: Ah, your question wasn't clear.  If you check out the spec pages for the 2 levers (the one that's part of your component group, and the one you're considering) they have the same hose kit (SM-BH59-JK-SS).
Comment: Very well then, i'll let you know how it goes!


How do you tip brahmin?

Question: Now that we've established that you can tip brahmin in New Vegas (as well as Fallout 3), how does one actually go about tipping a brahmin?
Comment: The answer to this question belongs in the other question; this should be considered a duplicate.
Answer: See here.

For Fallout 3 (and New Vegas)
By crouching near a brahmin and pressing the activate button you will push the brahmin over, causing it to go into a ragdoll state and getting back on its feet in a couple of seconds. You will not lose any Karma for doing this, nor will anyone or anything become hostile. Be warned that repeating this action may cause the brahmin to die. Even after it dies, no one becomes hostile and you do not lose Karma. You may also loot the body for brahmin steak.
Comment: I actually looked it up yesterday to try to understand your other question (and I guess it works the same as F3 because it runs on the same engine)

How do you tip brahmin?


Are ARP attacks possible on OpenVPN and Wireguard connections?

Question: I am curious if it is possible for users connected to a VPN to perform ARP spoofing / poisoning attacks against other users on the same subnet of an OpenVPN or Wireguard server. Does OpenVPN & Wireguard provide inbuilt mitigation's against ARP attacks by default & if so can this protection be disabled by malicious or compromised servers?
Answer: ARP is a link layer 2 ethernet protocol, it does not exist at IP layer 3.
So no.
EDIT
Normally VPNs use TUN, which is layer 3. There is a TAP layer 2 which will carry ARP, but outside of businesses BRIDGING two remote networks together this is seldom used. In a TAP bridge, you probably could ARP spoof.
Comment: There is some more information here that seems to suggest arp spoofing will work: https://serverfault.com/questions/488423/man-in-the-middle-with-a-vpn
Comment: Using Xarp I inadvertently discovered while connected to an OpenVPN server, Xarp sent out arp requests and the VPN server and or clients responded listing all clients on the OpenVPN server subnet; granted, if this was not randomly generated and spoofed information sent by the server itself. It does not make sense that ARP would not exist here, given the arp responses came back positive.
Comment: ARP requests would have gone out on whatever network you were connected to (house, school, business), not transmitted to the VPN. The responses would be from the same direct connect network, not the VPN.
Comment: Here you go: https://i.ibb.co/djbmmcN/ARP-Open-VPN.png this is on XP, openvpn tap connected using just the basic sweep on XArp; 513 addresses; locally there are maybe 5-10 not 513
Comment: Given that, perhaps ARP spoofing protection would be wise on a TAP adapter. However on such a vast network such as this one, targeted attacks would be difficult and time consuming... everyone has the same mac and host name alike, and nothing further is revealed;. but doesn't mean it isn't possible to be randomly hacked; It may depend upon the security measures of the server. I'm curious if the vpn provider is not spoofing the subnet already for added security,


Do the biopic-ized people get paid for being represented in their respective biopic movies?

Question: Biopic movies are based on the true stories of people, like Johnny Depp in Ed Wood.
Did the family of Ed Wood get paid for this movie? (because, technically, the story is that of Edward Wood)
Answer: It depends on whether it is authorized or not. Often the movie is unauthorized because it's not favorable to the celebrity, and in those cases the person is rarely paid for it. However, there are many advantages to an authorized biopic (having the subject promoting the movie, for one), and they will typically get paid as a consultant.
Comment: If that is the case, then why won't the subject of movie sue the producers? It is ***his/her*** life *story*, after all
Comment: A person doesn't have any rights to the facts of their own life, or wikipedia would be in a deep hole right now (as would TMZ).

To be clear, though, there are times when you would get in trouble. Using a famous person to exploit their fame (like using a lookalike or soundalike, in radio, in an advertisement), or lying about a person (that's where you run into slander/libel issues).

Edit: Also, you can run into trouble for making public what was otherwise private (a tell all book about someone's sex life could do it, though it's typically enforced against exes who publish sexy photos).
Answer: The rights issue is still fairly murky.
If a program or film is deemed 'newsworthy' (ie documentary) then less rights need to be secured (although privacy copyrights are still in effect and do need to cleared before presentation).
Biopics like Ed Wood, despite being based on a real person, are considered 'fictional entertainment' and thus do not require clearance from the family unless real photos/sounds are used.
In some cases, biopics can be halted - for example, the Amy Winehouse project that has been stalled because her father has refused to release the rights to her music.
Comment: I find this hard to believe that any "public" figure would need to be paid to do a bio pic on them.  The estate of Amy Winehouse is not obligated in any way to license her music, but that does not mean that you can't do a bio pic (obviously won't be as good without that).


Left crank has become loose and no longer stays on the bike

Question: The left crank kept falling off and I've kept on managing to put it back on but finally it wouldn't go. Think the threading is just absolutely kackered. So I ended up taking it to a shop to have a look at and a possible replacement crank. The only one advised to purchase was the Shimano FC-M622 175mm but it is near enough impossible to find and alot of places has discontinued the product. Does anyone know of any other cranks i could purchase instead of this one? Thanks, Tom.
Answer: Do you need a 10 speed triple? Any more recent replacement of M622 shoud work (Hollowtech II bottom bracket). FC-M6000 should be absolutely fine. You just need to choose a double or a triple, just choose the appropriate variant (M6000-2 vs. M6000-3).
Answer: If your rings are still in good condition, it's likely that you can replace just the left crank.
https://www.sjscycles.co.uk/cranks-left/
Lists some that are available now.
If you have (as your model number implies) a Hollowtech II crankset, any mountain crank using the same system will fit. As the main spindle is quite a hard steel, it doesn't usually get damaged from this type of problem.
Remember, you can't look at both sides of the bike at the same time! (unless you use a mirror).
Comment: Thankyou for the advice! Appreciated!
Answer: In addition, make sure you are installing the cranks correctly. Hollowtech 2 cranks are very robust and shouldn't just spontaneously fall off.

Loosen and tighten the two pinch bolts in very small increments, 1/4 turn max at a time. Make sure to alternate sides.
It is imperative to use a torque wrench on these two bolts. If the tension is uneven, the crank won't clamp on properly and is very liable to fall off. If you  can't access a torque wrench, tighten the bolts pretty much as hard as you can go with a regular length Allen key. If the threads strip out, your suspicion was correct: the threads were damaged.
Use threadlocker on the bolts.
Comment: I don't feel this is good advice. 'As hard as you can' could easily be 25Nm where the bolts are marked 14. I don't feel threadlock is a good idea either. If it's required, the crank must already be suspect. Using a torque wrench is good practice and avoids problems such as the original question.
Comment: @JoeK I'm assuming OP knows enough about wrenching to not be employing gorilla strength while doing it, and they were most likely not doing it tight enough previously. A little over tightening probably isn't a big issue when the alternative is a new crank anyways. The threadlock just serves as a bit of peace of mind; medium strength won't permanently freeze the bolt in place or anything.
Comment: Thankyou for the advice!
Comment: Would the FC-M610 fit to the hollowtech II?
Comment: You are very welcome. I don't know enough about the different models to be able to guarantee compatibility, unfortunately. The splined interface is the same on all MTB cranks, but the outwards splay of the crankarms might be different.


pages/forms/allitems.aspx missing from my sub site

Question: I have a subsite in sharepoint and I want to go to pages/forms/allitems.aspx. It is not there? Why would it be missing? I want to see what layout a page is using.
Answer: One possible reason why you will not have it is because that your subsite might be. Non-publishing template, like team site,blank site etc.only publishing site will have pages based on layout.
Answer: To see what page layout is being used by a page
http:///_layouts/sitemanager.aspx?Source=%2Fdefault%2Easpx
navigate to the page you want to view the properties of
the page layout should be listed on the right hand column
I think its only sites with publishing enabled on them that have this though.
alternatively you could query the properties bag for the "PageLayout" property of each page to get the page layout programmatically


How can I roll the database back to the backup

Question: I have a problem with a module the site functions but  I need to roll the database back to the backup I took before deploying the module. How can I do that?I am using D8
Comment: How did you take the backup?
Comment: At cpanel-Back up-Download a MySQL Database Backup. I saved it locally on my computer.
Comment: Cpanel generally links to PHPMyAdmin - if you go to that and select your database, there should be an 'import' tab. Go there and upload your backup.
Comment: I also have a folder on my computer with a zipped file containing all the site files i backed up Should I also delete the site files I have now in the root directory and upload the backuped ones, or just proceed with the database?
Comment: You want the code on the server to match the code as it was when you took the backup. So if any files have been changed or removed since you took the backup, you need to make sure those files are the same state they were in when you took the backup. However, if you only added files after taking the backup (not changing or removing any files), then you shouldn't need to replace the files on the server.
Comment: Thank you so much, all is clear now. You explain very well. All the best.
Answer: You can use Drush.
All you need to do is to run, inside a Drupal instalation, the following command:
drush sqlc < path/to/backup.sql
*You may want to drop your current database before that. The command is:
drush sql-drop -y


Number of bit strings of length $n$ with no $k_1+1$ consecutive 0s and no $k_2+1$ consecutive 1s.

Question: Just as the question asks. I am trying to calculate the number of bit strings of length $n$ with a maximum of $k_1$ consecutive $0s$ and $k_2$ consecutive 1s. Of course we assume $k_1+k_2\leq n$. I am trying to set up a recurrence but I am completely puzzled. I know that to not get two consecutive 0s, we have the recurrence $a_n=a_{n-1}+a_{n-2}$ with $a_1=2$ and $a_2=3$. However I can't seem to generalize this to no more than $k_1$ $0s$ especially that you have the second condition of no more than $k_2$ 1s.
Answer: This answer is based upon the Goulden-Jackson Cluster Method.

We consider the words of length $n\geq 0$ built from an alphabet $$\mathcal{V}=\{0,1\}$$ and the set $B=\{0^{k_1+1},1^{k_2+1}\}$ of bad words, $k_1,k_2\geq 0$, which are not allowed to be part of the words we are looking for.
We derive a generating function $f(s)$ with the coefficient of $s^n$ being  the number of searched words of length $n$.

According to the paper (p.7) the generating function $f(s)$  is

\begin{align*}
f(s)=\frac{1}{1-ds-\text{weight}(\mathcal{C})}\tag{1}
\end{align*}
with $d=|\mathcal{V}|=2$, the size of the alphabet and $\mathcal{C}$ the weight-numerator with
\begin{align*}
\text{weight}(\mathcal{C})=\text{weight}(\mathcal{C}[0^{k_1+1}])+\text{weight}(\mathcal{C}[1^{k_2+1}])
\end{align*}

We calculate according to the paper
\begin{align*}
\text{weight}(\mathcal{C}[0^{k_1+1}])&=-s^{k_1+1}-\text{weight}(\mathcal{C}[0^{k_1+1}])(s+s^2+\cdots+s^{k_1})\\
\text{weight}(\mathcal{C}[0^{k_2+1}])&=-s^{k_2+1}-\text{weight}(\mathcal{C}[0^{k_2+1}])(s+s^2+\cdots+s^{k_2})\\
\end{align*}
and get
\begin{align*}
\text{weight}(\mathcal{C}[0^{k_1+1}])&=-\frac{s^{k_1+1}}{1+s+\cdots+s^{k_1}}=-\frac{s^{k_1+1}(1-s)}{1-s^{k_1+1}}\\
\text{weight}(\mathcal{C}[1^{k_2+1}])&=-\frac{s^{k_2+1}}{1+s+\cdots+s^{k_2}}=-\frac{s^{k_2+1}(1-s)}{1-s^{k_2+1}}\\
\end{align*}
It follows
\begin{align*}
\text{weight}(\mathcal{C})&=\text{weight}(\mathcal{C}[0^{k_1+1}])+\text{weight}(\mathcal{C}[1^{k_2+1}])\\
&=-(1-s)\left(\frac{s^{k_1+1}}{1-s^{k_1+1}}+\frac{s^{k_2+1}}{1-s^{k_2+1}}\right)
\end{align*}
$$ $$

We obtain the generating function
\begin{align*}
f(s)&=\frac{1}{1-ds-\text{weight}(\mathcal{C})}\\
&=\left(1-2s+\frac{s^{k_1+1}(1-s)}{1-s^{k_1+1}}+\frac{s^{k_2+1}(1-s)}{1-s^{k_2+1}}\right)^{-1}\tag{1}\\
\end{align*}

$$ $$

Example: $k_1=2,k_2=3$.
We consider the special case with the bad words $$B=\{0^{k_1+1},1^{k_2+1}\}=\{000,1111\}$$
We obtain from (1) with some help of Wolfram Alpha
\begin{align*}
f(s)&=\left(1-2s+\frac{s^{3}(1-s)}{1-s^{3}}+\frac{s^{4}(1-s)}{1-s^{4}}\right)^{-1}\\
&=\frac{(1+s)(1+s^2)(1+s+s^2)}{1-s^2-2s^3-2s^4-s^5}\\
&=1+2s+4s^2+7s^3+12s^4+\color{blue}{21}s^5\\
&\qquad+36s^6+63s^7+109s^8+189s^9+328s^{10}+\cdots
\end{align*}

We see the coefficient of $s^5$ is $21$.
So, out of $2^5=32$ binary words of length $5$ there are $11$ invalid words containing subwords $\{000,1111\}$ which are marked blue in the table below.
\begin{array}{cccc}
\color{blue}{00000}&\color{blue}{01000}&\color{blue}{10000}&\color{blue}{11000}\\
\color{blue}{00001}&01001&\color{blue}{10001}&11001\\
\color{blue}{00010}&01010&10010&11010\\
\color{blue}{00011}&01011&10011&11011\\
00100&01100&10100&11100\\
00101&01101&10101&11101\\
00110&01110&10110&\color{blue}{11110}\\
00111&\color{blue}{01111}&10111&\color{blue}{11111}\\
\end{array}
Comment: This is truly beautiful! Thank you for sharing this answer!! Really amazing!
Comment: @AspiringMat: Many thanks for your nice comment! Good to see the answer us useful! :-)Btw. If you search for patterns of this kind in a word with given chars there is another *[cool technique](http://math.stackexchange.com/questions/1944807/arrangements-of-a-a-a-b-b-b-c-c-c-in-which-no-three-consecutive-letters-are-the/1946523#1946523)*.
Answer: Any string fulfilling the wanted constraints has one of the following structures:
$$ 0^{a_1}1^{b_1}0^{a_2}1^{b_2}\ldots \qquad 1^{b_1}0^{a_1}1^{b_2}0^{a_2}\ldots $$
with $a_i\leq k_1, b_j\leq k_2$ and $\sum a_i+\sum b_j = n$. Assume that we want to compute how many strings are there of the $0^{a_1}1^{b_1}0^{a_2}1^{b_2}0^{a_3}$ kind. They are given by the coefficient of $x^n$ in the product
$$ \left(1+x+x^2+\ldots+x^{k_1}\right)^3\cdot\left(1+x+x^2+\ldots+x^{k_2}\right)^2 = p_{k_1}(x)^3 p_{k_2}(x)^2$$
hence by accounting for all possible kinds, the answer is given by the coefficient of $x^n$ in
$$ \sum_{r\geq 0}\left(p_{k_1}(x)^r p_{k_2}(x)^{r+1}+p_{k_1}(x)^{r+1}p_{k_2}(x)^r\right) =\color{red}{\frac{p_{k_1}(x)+p_{k_2}(x)}{1-p_{k_1}(x)\,p_{k_2}(x)}}.$$
Answer: Here is a comment showing how to compute the generating functions from
first  principles.  We   may  then  continue  as  in   the  answer  by
@MarkusScheuer.
Using $z$ for zero and $w$ for one we have the generating function
$$(1+z+z^2+\cdots+z^{k_1})
\sum_{q\ge 0} (w+w^2+\cdots+w^{k_2})^q (z+z^2+\cdots+z^{k_1})^q
\\ \times (1+w+w^2+\cdots+w^{k_2}).$$
As we are only interested in the count we may write this as
$$(1+z+z^2+\cdots+z^{k_1})
\sum_{q\ge 0} (z+z^2+\cdots+z^{k_2})^q (z+z^2+\cdots+z^{k_1})^q
\\ \times (1+z+z^2+\cdots+z^{k_2}).$$
This is
$$\frac{1-z^{k_1+1}}{1-z}
\left(\sum_{q\ge 0} z^q \frac{(1-z^{k_2})^q}{(1-z)^q}
z^q \frac{(1-z^{k_1})^q}{(1-z)^q}\right)
\frac{1-z^{k_2+1}}{1-z}
\\ = \frac{1-z^{k_1+1}}{1-z} \frac{1-z^{k_2+1}}{1-z}
\frac{1}{1-z^2(1-z^{k_1})(1-z^{k_2})/(1-z)/(1-z)}
\\ = \frac{(1-z^{k_1+1})(1-z^{k_2+1})}
{1-2z+z^2-z^2(1-z^{k_1})(1-z^{k_2})}
\\ = \frac{1-z^{k_1+1}-z^{k_2+1}+z^{k_1+k_2+2}}
{1-2z+z^{k_1+2}+z^{k_2+2}-z^{2+k_1+k_2}}.$$
Some Maple code to verify these follows.

RL :=
proc(n, k1, k2)
    option remember;
    local ind, d, pos, cur, run, runs, res,
    zmax, wmax;

    res := 0;

    for ind from 2^n to 2*2^n-1 do
        d := convert(ind, base, 2);

        cur := -1; pos := 1;
        run := []; runs := [];

        while pos <= n do
            if d[pos] <> cur then
                if nops(run) > 0 then
                    runs :=
                    [op(runs), [run[1], nops(run)]];
                fi;

                cur := d[pos];
                run := [cur];
            else
                run := [op(run), cur];
            fi;

            pos := pos + 1;
        od;

        runs := [op(runs), [run[1], nops(run)]];

        zmax := max(seq(`if`(r[1] = 0, r[2], 0), r in runs));
        wmax := max(seq(`if`(r[1] = 1, r[2], 0), r in runs));

        if zmax <= k1 and wmax <= k2 then
            res := res + 1;
        fi;
    od;

    res;
end;

X :=
proc(n, k1, k2)
option remember;
local gf;

    gf :=
    (1-z^(k1+1)-z^(k2+1)+z^(k1+k2+2))
    /(1-2*z+z^(k1+2)+z^(k2+2)-z^(k1+k2+2));

    coeftayl(gf, z=0, n);
end;
Answer: You can set up a set of coupled recurrences.  Let $A(k,n)$ be the number of acceptable $n$ bit strings that end with $k\ 0$'s and $B(k,n)$ be the number of acceptable $n$ bit strings ending with $k\ 1$'s.  Then $A(k+1,n+1)=A(k,n)$ and $A(1,n+1)=\sum_{i=0}^{k_2}B(i,n)$ and similarly for $B(k,n+1)$  Put the $A$'s and $B$'s into a column vector and you have a matrix that you multiply by the vector to increase the length of the string.  You can diagonalize the matrix and find eigenvalues to find the asymptotic rate of growth.
Comment: Thanks for the answer. How would I cope if there was even further constrictions on the number of 1s and 0s we can use. For example $n_1$ 0s with max $k_1$ consecutive 0s and $n_2$ 1s with max $k_2$ consecutive 1s. Can we employ the same method? Just out of curiosity.
Comment: As asked, you have now required a fixed length of the string at $n_1+n_2$.  This is more easily handled by picking the places for the $1$'s and making sure you satisfy the restrictions, using inclusion/exclusion.  If you want to require a certain string of $1$'s but forbid some longer string, yes, but the number of states can get unwieldy.  Each $A(-,k)$ and $B(-,k)$ represents a state in a Markov chain.  You need a new variable for each state, so will need $C(-,k)$ to be unacceptable strings ending in $k\ 1$'s
Comment: @RossMillikan:  Anyway, the ordinary generating function associated to this problem is easy to write down, so instead of considering a huge Markov chain and diagonalize it, it is faster to look at the zeroes of $1-p_{k_1}(x)p_{k_2}(x)$ - i.e. we already know the characteristic polynomial, despite "hugeness".
Answer: Let me to begin with changing the $k$s to $k_0$ and $k_1$, so to help and remember their association with the values.
First step is to fix the total number of ones  at , let say $0 \leqslant q \leqslant n$ (and the number of zeros is consequently fixed).
We know the total number of ways to obtain strings of length $n$ with $q$ ones, so we will at end accomodate for that.
Then your scheme is equivalent to many other combinatorial ones, e.g.
number of lattice paths from $(0,0)$ to $(n-q,q)$ with steps from $\left\{ {\left( {1 \ldots k_0 ,0} \right),\left( {0,1 \ldots k_1 } \right)} \right\}$.
After fixing the total number of $1$s, let now fix the number of $1$-blocks at $m$.
The number of $0$-blocks will be either $m$ (if the string starts and ends with different values), or $m-1$ (starts and ends with $1$) or $m+1$ (starts and ends with $0$).
The number of ways to arrange $q$ ones into $m$ blocks with no more than $k_1$ in each, is the number of compositions of $q$ in $m$ parts of max size $k_1$.
An expression for that can be derived from the answers to Rolling dice problem (re. to there for details), where we have:
$$
N_{\,b} (s,r,m) = \text{No}\text{. of solutions to}\;\left\{ \begin{gathered}
  0 \leqslant \text{integer  }x_{\,j}  \leqslant r \hfill \\
  x_{\,1}  + x_{\,2}  +  \cdots  + x_{\,m}  = s \hfill \\
\end{gathered}  \right.
$$
which can be expressed as
$$
N_{\,b} (s,r,m)\quad \left| {\;0 \le {\rm integers}\;s,r,m} \right.\quad  = \sum\limits_{\left( {0\, \le } \right)\,k\,\left( { \le \,{s \over r}\, \le \,m} \right)} {\left( { - 1} \right)^{\,k} \left( \matrix{
  m \cr
  k \cr}  \right)\left( \matrix{
  s + m - 1 - k\left( {r + 1} \right) \cr
  s - k\left( {r + 1} \right) \cr}  \right)}
$$
In our case, since the number of $1$s goes from $1$ to $k_1$, we shall replace $r$ with $k_1-1$ and $s$ with $q-m$.
Now we shall intersperse the $1$-blocks into the $0$-blocks "comb-to-comb".
The number of ways to make up the $0$-blocks follows the same formula, with the appropriate parameters.
Considering that the "starting-block($0$/$1$)-end-block($0$/$1$)" represents a partition of the considered strings,
it is not difficult to make up the four parts and conclude:
$$
\begin{gathered}
  N(k_{\,0} ,k_{\,1} ,n,q,m) =  \hfill \\
   = N_b (q - m,k_{\,1}  - 1,m)\left( {N_b (n - q - m + 1,k_{\,0}  - 1,m - 1) + 2N_b (n - q - m,k_{\,0}  - 1,m) + N_b (n - q - m - 1,k_{\,0}  - 1,m + 1)} \right) \hfill \\
\end{gathered}
$$
In summing through $m$ and then $p$ (after multiplying by C(n,q)), note that in the $N_{\,b} (s,r,m)$ formula, the bounds in the summation and in the parameters may be omitted (practically: stretched  from $0$ to a suitable max),
because the binomials (as defined and as written), or the sum itself, are null for $m<k$ and $mr<s$, etc., being enough to ensure that $0 \leqslant r$.
Answer:
We consider the binary alphabet $V=\{0,1\}$ and look for the number $g_n(k_1,k_2)$  of binary words of length $n$ which contain runs of $0$ with length at most $k_1$ and runs of $1$ with length at most $k_2$.

Words with no consecutive equal characters at all are called Smirnov or Carlitz words. See example III.24 Smirnov words from Analytic Combinatorics by Philippe Flajolet and Robert Sedgewick for more information.
A generating function for the number of Smirnov words over a binary alphabet is given by
\begin{align*}
\left(1-\frac{2z}{1+z}\right)^{-1}\tag{1}
\end{align*}

We replace occurrences of $0$ in a Smirnov word by one up to $k_1$ zeros to  generate strings having runs of $0$ with length at most $k_1$
\begin{align*}\
z\longrightarrow z+z^2+\cdots+z^{k_1}=\frac{z\left(1-z^{k_1}\right)}{1-z}\tag{2}
\end{align*}
We replace occurrences of $1$ in a Smirnov word by one up to $k_2$ ones to  generate strings having runs of $1$ with length at most $k_2$
\begin{align*}
z\longrightarrow z+z^2+\cdots+z^{k_2}=\frac{z\left(1-z^{k_2}\right)}{1-z}\tag{3}
\end{align*}
We substitute (2) and (3) in (1) and obtain
\begin{align*}
&\left(1- \frac{\frac{z\left(1-z^{k_1}\right)}{1-z}}{1+\frac{z\left(1-z^{k_1}\right)}{1-z}}
- \frac{\frac{z\left(1-z^{k_2}\right)}{1-z}}{1+\frac{z\left(1-z^{k_2}\right)}{1-z}}\right)^{-1}\\
&\qquad=\frac{(1+z)\left(1-z^{k_1}\right)\left(1-z^{k_2}\right)}{1-z+2z^2-\left(z^{k_1+1}+z^{k_2+1}\right)(1+z)-z^{k_1+k_2+2}(1+3z)}\tag{4}
\end{align*}
Denoting with $[z^n]$ the coefficient of $z^n$ in a series we obtain from (4)  the number of wanted words  as
  \begin{align*}
\color{blue}{g_n(k_1,k_2)
=[z^n]\frac{(1+z)\left(1-z^{k_1}\right)\left(1-z^{k_2}\right)}{1-z+2z^2-\left(z^{k_1+1}+z^{k_2+1}\right)(1+z)-z^{k_1+k_2+2}(1+3z)}}\tag{5}
\end{align*}

Example: $n=5,k_1=2,k_2=3$.
We consider the special case with  words of length $5$ containing runs of $0$ with length at most $2$ and runs of $1$ with length at most $3$
We obtain from (5) with some help of Wolfram Alpha
\begin{align*}
\sum_{n=0}^\infty g_n(k_1,k_2)z^n&=\frac{(1+z)(1-z^3)(1-z^4)}{1-z+2z^2-(z^3+z^4)(1+z)-z^7(1+3z)}\\
&=\frac{(1+z)(1+z^2)(1+z+z^2)}{1-z^2-2z^3-2z^4-z^5}\\
&=1+2z+4z^2+7z^3+12z^4+\color{blue}{21}z^5+36z^6+63z^7+\cdots
\end{align*}
We see the coefficient of $z^5$ is $21$.
The $21$ valid words are
$$
\begin{array}{cccc}
00100&01001&10010&11001\\
00101&01010&10011&11010\\
00110&01011&10100&11011\\
00111&01100&10101&11100\\
&01101&10110&11101\\
&01110&10111&
\end{array}
$$


Wygwam fields (in Matrix) not initialized when switching fields with Entry Type

Question: I'm using Entry Type to hide/show fields. If the field is a Matrix with Wygwam columns, the Wygwam fields don't initialize when the Matrix field is revealed by Entry Type. However, if I reload the Edit page, Wygwam intializes and all is well. Will be irritating to client to have to reload page for Wygwam's buttons.
Answer: You should try the "Defer CKEditor initialization?" feature in the Wygwam celltype settings. This will prevent Wygwam from initializing until the client clicks on the field.
Comment: This doesn't work. If you use 'defer initialisation', the field doesn't initialise when you click on it either. This same problem also applies to Assets, Date fields, basically any field type that uses javascript...


Is there a difference between "select of your own choosing [something]" and "select [something] of your own choosing"?

Question: What is the semantic difference between "select of your own choosing a partner" and "select a partner of your own choosing"? Slightly awkward grammar aside, the first seems to suggest that the choice is whether or not to participate in the selection process, while the second seems to suggest that the choice is of the partner, but is there any real difference between these two wordings?
Comment: The title of your question seems to be asking about which of two different phrases to use, yet the body is concerned about the *location* of only the first phrase and doesn't mention the second (which should actually be "of your *own* choice". Can you clarify what your exact intentions are?
Comment: Tried to be a little more clear.
Answer: The first form sounds decidedly odd to me, but I can't see it meaning anything different to the second.
They both seem tautological anyway. Select means choose; I don't see the point in saying Choose a partner of your own choosing. I think just Choose a partner is simpler and better.
To convey that even making a choice is optional, say You may choose a partner [if you wish]


Oscillations of a vertical spring with non negligible mass

Question: My physics professor recently covered the concept of simple harmonic motion and touched on vertical springs. However he mentioned that the spring (with a mass attached to its end) only undergoes simple harmonic motion if it is massless. However I am unsure why making the spring have non-negligible mass would affect its simple harmonic motion hence I am seeking clarification. Thank you!
Comment: [Effective mass (spring–mass system)](https://en.wikipedia.org/wiki/Effective_mass_(spring%E2%80%93mass_system))
Comment: It's a little unusual to ask questions in the answer, but in this case the answerer is waiting for some feedback from you, and they appear to be pretty flexible and willing to help.
Answer: Do you know about lumped systems? (Discrete ropes etc)
Do you know the equation $$ \omega  = 2\sqrt{\frac{k'}{m}}sin(\frac{ka}{2}) $$ ?
If no, we can derive with your, i will postpone until your answer the derivation.
If you know:
$$ \omega  = 2\sqrt{\frac{k'}{m}}sin(\frac{ka}{2}) $$
$$ a \rightarrow 0 $$
$$ \omega  = 2\sqrt{\frac{k'}{m}}(\frac{ka}{2}) $$
but
$$ k'a = KL $$
$$ \omega ^2 = K\frac{L}{\rho }k^2 $$
We can go on and derive a equation for oscillations which will show to us that the system actually acts like the mass on the spring was a fixed end. We will end up with oscillation of the spring than with that of the system itself.


How to link a pdf file in ePub 3?

Question: i'm developing an ePub using Sigil.
I have addedd some PDF file in my Misc Folder.
Now i've created a link to that file, and everything is working fine with iBooks on my Mac.
But on iBooks for iOS7 when i tap the link it load (in overlay) a gray page, is this a bug?
Should i use another way for link the PDF?
Thanks.
Comment: I'm trying to do the same. I'll be interested by your epub. I'm not on mac and it looks like all my readers don't like linking a pdf. So if you succeeded I'd like to compare your solution with mine to see what's different.
Answer: This is probably an issue with iBooks for mac not really requiring strict ePub code. Many times things that "work" in iBooks for mac aren't actually compliant at all. I can't speak for Sigil directly, but can help with the ePub itself: I am guessing you need to change some things in your .opf file: you need to include the pdf as an item in your manifest AND as a nonlinear page in your spine: , .
You should use ePubcheck (https://github.com/IDPF/epubcheck) to make sure you are exporting a valid ePub.
If you need a tool to zip/unzip your ePub I would use this: http://www.mobileread.com/forums/showthread.php?t=55681
Good luck!

How to link a pdf file in ePub 3?


Maximized window bigger than display on CentOS 7.5 with vncserver

Question: im running into a problem on a CentOS 7.5 machine with the default vncserver (TigerVNC). Everything is working fine, except one visual flaw:
the maximized size of the display is unequal to the actual size of the display (it is bigger). The result is that maximized windows are cropped on the right and bottom edges.
The specialty with this problem is, that it only occurs when not starting a window manager in xstartup. Which is what I want. To give you some background: the idea is to provide an application (fullscreen) via NoVNC in a webpage. Only the application should be accessible, so no window manager is needed. I've done that on CentOS 6 a few years ago and it worked really well.
I've played around with xrandr and can set different resolutions without any problems. The windows of the VNC client also uses the new resolutions when reconnecting. But the applications keep thinking there is more space available.
To give you a numeric example of how the sizes are unequal:
If I set the resolution to 1024x768, the window of the VNC client opens with a 1024x768 sized window. The resolution of the desktop though seems to be roughly 10% bigger. As if the maximized application thinks it should have an absolute size of ~1124x820.
Essentially the problem is comparable to the Zoom function of Mac OS where the content is scaled up and you can pan around by moving the mouse to the edges of the screen. Only that in my case the content is not scaled, and I also can't pan to see what is hidden behind the edge of the VNC client.
I have verified that this problem is independent of the client (same behaviour with the HTML-client and a native one).
The command I use in my systemd file seems good to me: /usr/bin/vncserver %i -desktop myapp -geometry 1024x768 -depth 24.
My xstartup file:
#!/bin/sh

unset SESSION_MANAGER

[ -r /.Xresources ] && xrdb /.Xresources
/bin/xsetroot -solid grey -cursor_name arrow
/bin/vncconfig -nowin &
/bin/xrandr -s 1024x768
/usr/bin/xterm -maximized

I found a comparable question from 2002 here (Ars Technica Forum), but without a solution.
EDIT:
I did some further testing, and if I set -geometry 1124x846 all clients work properly. This seems the be the resolution that the application thinks is the full screen resolution. So the question would be where this resolution comes from and how I can change it. Raising the resolution via -geometry does not make the application grow with it.
Answer: Turns out this is nothing new and I just didn't use the correct keywords to find an answer. Here are two related Questions that provide an answer:
Maximize Window without Window Manager?
https://stackoverflow.com/questions/1515752/x11-unable-to-maximize-applications-when-no-window-manager-is-used


Can a resident of Belgium trade US stocks with Interactive Brokers?

Question: I live in Belgium and I would like to trade US stocks. I would like to sign up with Interactive Brokers.  Would it then be possible to trade US stocks?
Comment: IB offers trading in over 200 countries.  Contact them and see what they have to offer you.
Answer: Yes, Interactive Brokers supports Belgium. And, yes, they trade U.S. stocks.
You can find out from Stockbrokers.com which brokers support Belgium.
You have a choice between:

Interactive Brokers
Charles Shwab
TradeStation
Firsttrade
SogoTrade
Lightspeed
ChoiceTrade

I recommend that you read reviews of all of them before choosing. E.g. Interactive Brokers has a $30 inactivity fee each month, but it has a very low fee per share. Choose one that is suitable for your trading needs.


clock signals in computers and machines

Question: Why do computers have clock signals and clock rate, while ordinary machines do not have them?
And why is clock so fundamental in CPU and mainboard?
Comment: Frankly you can find the answer in wikipedia.. the answer is to long, to wide.. Please ask a specific question. Also.. it has nothing to do with design. Sorry
Answer:
"Time is what keeps things from happening all at once." - John Wheeler (1911-2008)

You don't want to run things unorganized. Everything in a microcontroller happens consecutively, in discrete steps. Getting a byte from RAM to a register: put address on address bus. Tick. Assert RD line. Tick. Latch data from databus into register. Tick.
If you would do this all at the same time, you would latch the data before the RAM had time to put it on the bus. This kind of limitations occur all the time, and they are the limiting factor for a controller's performance.
Note that some mechanical systems use a mechanism with a similar function:

A watch's escapement also ensures that things happen timely, and even in an analog clock, in discrete steps. (Personally I count the escapement, along with the zipper and the wood screw, to some of the Truly Great Inventions.)
Comment: ... so we can all blame Wheeler when our project schedules are not met ;)
Comment: @Mike - You should have thought of that earlier, he's dead now.
Comment: +1 for an example of a mechanical device which uses some kind of cycled action.
Answer: Very Short and Inadequate Answer: The clock signal is fundamental because it allows for both signal coordination between circuits and for synchronized machine state changes.
Read up on Digital Circuits.
Answer: Most machines require that some types of operations happen in some particular sequence.  A gear train, for example, requires that each gear move in such a fashion as to make room for an approaching tooth, before that approaching tooth arrives.  In many cases, such as with the gears, the part of a machine which requires certain events to happen in a particular sequence will be very tightly coupled to the part which enforces that sequence (e.g. the proper interleaving of one gear's tooth with another gear's groove will be enforced by the adjacent teeth, which are of course rigidly attached).
What makes computers different from other machines are the facts that (1) there are a lot more parts that have to be synchronized than is typical of most machines, (2) the maximum speed at which parts of a computer can be driven is faster than the maximum speed at which they will function reliably, and (3) it is often desirable to run computers at the maximum speed where they will function reliably.
The easiest way to satisfy all of the above requirements is to design parts so that they will function reliably if run at some particular speed, and then run them at that speed.  It's helpful to think of a computer as an assembly line.  The number of products produced per hour will be set by the rate at which they conveyor moves products from one station to the next.  Using a conveyor whose speed is the same throughout a factory will ensure that no workstation will have product arrive before there is space available.  Increasing the speed of the conveyor will increase the rate at which products are produced, provided that each worker is able to complete his part of the production in time.  If the conveyor is sped up too much, however, workers may sometimes fail to complete their tasks properly, thus creating product defects.  Note that if one particular step in the process takes longer than two other adjacent steps elsewhere in the production, it may be helpful to either split the longer step into two steps (which would require more workers, but allow increased production), or join the shorter adjacent steps into one (which would not increase production, but would reduce the number of workers required to achieve it).

clock signals in computers and machines


Quotes to prove similarity between Vedic Samhita and Upanishaic Vedantic Philosophy?

Question: Is Vedanta the conclusion of Vedic Samhitas? Can we proove Vedantic Philosophy from Vedic Samhitas, Brahmanas and Araynakas??
Comment: Your question is a fallacy known as begging the question. The Vedanta philosophy is part of the vedic samhitas, brahmanas, and aranyakas.
Comment: You can have a general look at [this answer](https://hinduism.stackexchange.com/a/14035/20129)
Comment: @SwamiVishwananda Please proove that Samhitas and Brahmanas speak of Vedanta philosophy
Answer: Ishopanishad is in the samhita portion of its shakha (it is the 40th adhyaya of Vajasaneyi Samhita of Shuklayajurveda).
The Maitrayani Upanishad belongs to Maitrayani Samhita of the Krishna Yajurveda. It talks exclusively on the superiority of the Brahman.
Thus some upanishads are itself part of the Samhita.
Further, please see the following link. The link also provides a detailed comparison of the sentences in the samhitas and upanishads indicating that the philosophy behind both of them are exactly are the same.

Hindu tradition considers the Veda Samhitās and Upaniṣads as forming
integral parts of a single canon of orthodox scripture, the Veda.
There must have been a really good reason for this. The reason is that
the Veda is thoroughly consistent in its subject matter and
fundamental metaphysics and philosophy, beginning with the Samhitās
all the way through to the Upaniṣads.
Comment: BTW that blog is HSE user [Ram Abloh's](https://hinduism.stackexchange.com/users/20829/ramabloh)
Comment: I have read his blog sir. I wanted more. Please present yours-Not others blog
Comment: Sorry I was unaware. I can delete my reply or include my own quotes on how certain samhitas/aranyakas are similar to upanishads in content. I just quoted the blog because it was very impressive and exhaustive.
Comment: @GIRIBLR I have already read it sir! Please do quote yours. No problem sir!


Interesing, hard limit with sum, involving $\pi$

Question: Yesterday I was boring so I decided to derive formula for area of circle with integrals. Very good exercise, I think, because I forgot many, many things about integrals. So I started with:
$$\int_{-r}^{r} \sqrt{r^2-x^2}dx$$ but I didn't have any clue how to count indefinite integral $\int\sqrt{r^2-x^2}dx$ (is it even possible? today I only found method for counting definite integral above with trigonometric substitution, but this does not apply in general), so I decided to use Riemann's theorem, since I only need to count definite integral. And everything was going well, till something extremely interesting happend. The last step I need to do is to find this limit:
$$\lim_{n \to +\infty}\frac{1}{n}\sum_{k=1}^{n}\sqrt{\frac{k}{n}\cdot\frac{n-k}{n}}$$
Surprisingly it is equal to $\frac{\pi}{8}$, and it is mindblowing ;-) but I only know that because I know formula for area of circle which I'm trying to derive. But without knowing it, is it possible to calculate this limit with relatively simple methods? I really, really want to to this in order to award my attempts. Can anybody help?
Comment: the riemann sum of that integration should be $\int_0^1 \sqrt{x(1-x}dx$ for integral of area of circle the Riemann sum should be $\lim_{n\to\infty} \frac 1 n \sum_{k=1}^n \sqrt{1 - k^2/n^2}$
Comment: Yes, it is possible to find the indefinite integral $\int\sqrt{r^2-x^2}\,dx$, and it is done by starting with the substitution $x=r\sin u$, $dx=r\cos u$.
Comment: Thank you Gerry, I can see now. @experimentX, I'm pretty sure I didn't make a mistake. Moreover approximation with wolframalpha seems to confirm 'my' limit is equal to $\frac{\pi}{8}$, so I am hoping it can be calculated in some way, so the question is really about this limit ;-)
Comment: Interesting, +1. Can you put the steps you took to get to that limit though? Maybe there's another way even using that method.
Comment: @xan: I can only arrive at $\;\lim_{n \to \infty}\frac{1}{n}\sum_{k=1}^{n}\sqrt{\frac{n+k}{n}\cdot\frac{n-k}{n}}\;$ and that limit must be $\pi/4$ . Please tell us what other steps you have taken.
Comment: Since $\pi$ is basically defined as the ratio of the circumference of a circle divided by its diameter, I would find it quite surprising if there were a simple method to evaluate the limit of that sum without reference to measuring parts of a circle.
Answer: As pointed in the comments, your limit, regared as a Riemann sum, is just (by only using simple changes of variable):
$$L=\int_{0}^{1}\sqrt{x(1-x)}\,dx=\int_{0}^{1}\sqrt{\frac{1}{4}-\left(\frac{1}{2}-x\right)^2}\,dx=\int_{-1/2}^{1/2}\sqrt{\frac{1}{4}-x^2}\,dx=\frac{1}{4}\int_{-1}^{1}\sqrt{1-x^2}dx = \frac{1}{4}\cdot\frac{\pi}{2}=\frac{\pi}{8}.$$
$\int_{-1}^{1}\sqrt{1-x^2}dx$ is clearly half the area of the unit circle. In another fashion, by putting $x=\sin\theta$:
$$\int_{-1}^{1}\sqrt{1-x^2}\,dx = 2\int_{0}^{1}\sqrt{1-x^2}\,dx=2\int_{0}^{\pi/2}\cos^2\theta\,d\theta=\int_{0}^{\pi/2}\left(\cos(2\theta)+1\right)d\theta = \int_{0}^{\pi/2}1\,d\theta = \frac{\pi}{2}.$$
Comment: It's not mine, but my guess would be because the OP was at pains to ask for a solution that does not use previous knowledge of the area of a circle, and also mentioned that he/she was aware of a solution using a trigonometric substitution, so the answer here does not appear to add anything for the OP. Just guessing?
Comment: Why the downvote, if I am allowed to ask?
Comment: @JackD'Aurizio: I had not revisited this question since I deleted my answer because there was a comment along the same lines: "I think the OP's question is whether you can find the limit without doing the integral." This is the same sentiment that Ben Blum-Smith expressed. Perhaps someone of like mind downvoted.
Answer: Your last step is wrong. Let
$$A=2\int_{-r}^r\sqrt{r^2-x^2}dx$$
be the area of circle with radius $r$. Then
$$\begin{align}\\
A&=2\int_{\style{color:red}{0}}^\style{color:red}{2r}\sqrt{r^2-(\style{color:red}{x-r})^2}\style{color:red}{dx}\\
&=2\int_{0}^{2r}\sqrt{x(2r-x)}dx\\
&=2\int_\style{color:red}{0}^\style{color:red}{1}\sqrt{\style{color:red}{2rx}(2r-\style{color:red}{2rx})}\style{color:red}{2rdx}\\
&=8r^2\int_0^1\sqrt{x(1-x)}dx\\
\end{align}$$
So, the correct limit will be
$$\lim_{n\to\infty}8r^2\sum_{k=1}^n\frac1n\sqrt{\frac{k}{n}\cdot\frac{n-k}{n}}$$
This limit converges to $r^2\pi$ which is the real area of circle. If you want to compute this limit algebraically, I think there is no other way than converting it back to definite integral which means that you must use trigonometric substitution.


French "everyday" philosopher book with exercises

Question: I forgot the name, hence this. There is a French philosopher who has written kind of "taking philosophy back to everyday life" book(s). I cannot remember his name or the name of the book(s). Can you?
Answer: The philosophy everyday exercises book could well be this one:
Astonish Yourself: 101 Experiments in the Philosophy of Everyday Life
by Roger-Pol Droit


Gottesman-Knill theorem -- last measurement step

Question: In the Gottesman-Knill theorem, the stabilizer set is updated after each Clifford gate. These steps are quite simple. At the end, the measurement is simulated. In some on-line explanations, I have seen seen that the stabilizers could be diagonalized to obtain a set of stabilizers of the form $I_1 \otimes \cdots I_{i-1} \otimes X_i / Z_i \otimes I_{i+1} \otimes \cdots I_n$, for $1 \leq i \leq n$. I do not see how to achieve this last step for a stabilizer set such as $\{ I \otimes I \otimes X \otimes X, I \otimes I \otimes Z \otimes Z, X \otimes X \otimes I \otimes I, Z \otimes Z \otimes I \otimes I \}$?
Comment: Please link to the "on-line explanations" you're referring to.
Answer: Let's assume that you're making a $Z$ measurement on qubit $i$ (if you're doing more than one measurement, you can just go through this process one measurement at a time). Let the set of stabilizer generators be $\{g_j\}$. Then, after the measurement, you know that you get an answer $\pm 1$. This means that your system is in a $+1$ eigenstate of the stabilizer $K_i=\pm I\otimes I\otimes\ldots \otimes I\otimes Z\otimes I\otimes\ldots \otimes I$. So, you know that that stabilizer must be in your list of stabilizers. The question is how to insert it. There are three different cases:

there exists at least one $g_j$ such that $\{g_j,K\}=0$ (i.e.\ they anti-commute). Note that if there's more than one that anti-commutes, we can rewrite the set of generators so that exactly one anti-commutes (if you have $g_1,g_2,g_3$, replace them with $g_1,g_1g_2,g_1g_3$). In the act of the measurement the anti-commuting term $g$ will be replaced by $K$ (with the $\pm$ options occurring with 50:50 probability).

if all the stabilizer generators commute with $K$, then there might exist a product of generators that is equal to $K$. If so, then when you find this, it directly tells you which $\pm$ version you have, and you are guaranteed to get that measurement outcome. Nothing in the state changes. To find this out, it's a simple linear calculation: can you find an $x\in\{0,1\}^{k}$ such that
$$
S^Tx=e \text{ mod }2
$$
where $S$ is the $k\times 2n$ binary matrix describing the generators, and $e\in\{0,1\}^{2n}$ is the binary vector describing $K$.

if all the stabilizer generators commute with $K$, but there's no product of generators that creates $K$, then we know that the number of generators, $k<n$. At that point, you can just insert $K$ into your set of generators.

Let's take the example you gave. I'll write the stabilizers as $X_1X_2,X_3X_4,Z_1Z_2,Z_3Z_4$. I'll measure qubit 1 in the $Z$ basis. $Z_1$ anti-commutes with exactly 1 term, $X_1X_2$, so my outcome will be the stabilizers $\pm Z_1,X_3X_4,Z_1Z_2,Z_3Z_4$. Note that I can also rewrite this as $\pm Z_1,X_3X_4,\pm Z_2,Z_3Z_4$, so that if I measure the second qubit in $Z$, I see that I'll get the same answer as the first measurement (that's an example of case 2).
Comment: One detail, in Point 2, $S$ is a n x 2n binary matrix, x is a 2n x 1 binary vector, the result is a n x 1 binary vector. Not a 2n x 1 vector representing the solution. By I see the point, find the subset of generators which product gives the operator $K$. Do we have to do the measurements one after the other? Or is it possible to do three measurements at the same time? In this case, if the global phase is +1, there are four possible outcomes to verify-less efficient. My goal is to understand this last step using the Gaussian elimination and not to use the more efficient Aaronson-Gottesman sln.
Comment: I'm sure you could do the measurements all in one go, but the one-at-a-time approach manages things quite nicely. One option to do it more efficiently is to think about the observables you're measuring, $Z_i$. Can you rewrite, via linear combinations, some of them to be equal to existing stabilizers? Roughly speaking, what you're trying to do is take the matrix $S$ and, via row reduction, convert the $X$-type and $Z$-type operators into identity blocks for the qubits you're measuring. That shows you which are (anti)commuting.
Comment: To conclude this entry, see [https://quantumcomputing.stackexchange.com/questions/28292/check-if-a-pauli-string-belongs-to-a-stabilizer-tableau]


looked to them for help

Question: a. He looked at them to help him.
b. He looked to them to help him.
c. He looked at them for help.
d. He looked to them for help.
Which of the above sentences are grammatically correct?
Which are natural?
Many thanks.
Answer: What is the meaning of your sentences?
The verb look can function as a phrasal verb so the meaning is changed depending on the preposition.
look at someone/something means to direct your eyes towards someone or something so that you can see them.
People looked at her in astonishment.
look to sb to do sth (phrasal verb)
to hope that someone will do something for you:
We're looking to you to advise us on how to proceed.
look to sb for sth (phrasal verb)
to hope that someone will provide something for you:
They looked to the government for additional support.
Answer: They are all grammatical, and vary in naturalness, but there are two different meanings.
To look at somebody or something means literally to turn your eyes so that you are seeing that person or thing.
To look to somebody or something means to expect or ask for help or some other kind of contribution. To me it seems a rather literary expression, but it may be more natural for speakers of other varieties of English.
So look to them for help is more likely than look at them for help; but the latter is certainly possible, if the people are present together and something about the situation makes it clear that just a look is asking for help.
There is hardly any difference between for help and to help him in this context (though the latter is more specific that the help is to come to him: this is probably implicit in the former as well, though).
In other contexts (depending on the word that governs it) only one of these two might be grammatical, or they might have different meanings. For example I want to help him is grammatical (and means I want to give help, not receive it!) but I want for help is not. They are looking for help means they are looking for somebody to help them (they want to receive help), but They are looking to help him means that they intend or want to give help to him. These are properties of want and looking.

looked to them for help


The only subspaces of R over R are zero space and R itself.

Question: Let W be a subspace of R. If W is finite then W has to be Zero space since otherwise it won't be closed under scalar multiplication.
If W is infinite, we want W=R.
Claim: W' is empty
Pf: if W' is non-empty then  there exists some x in W'. Therefore, we can choose a scalar C for a given y in W such that C.y=x.
Which means x is in W. Therefore W' is empty hence W=R
Is this proof correct?
Comment: if $R$ is $\mathbb{R}$ and $W'$ means the complementary of $W$, yes your proof is correct. However I would suggest to say the following if $W=\{0\}$ then we are good, if it is not, it must contain some $y\in W$ with $y\neq 0$. Now any $x\in \mathbb{R}$ is $\frac{x}{y}y\in W$ since $W$ is closed by scalar multiplication so $W$ is the set of real numbers... The alternative is not between finite/infinite, but either it contains only the $0$ element either it contains one that is not zero.
Comment: Oh yes. I basically just gave a sketch of what I wanted to do. I will fill the details
Answer: If $W \subset \mathbb{R}$ is finite ($W \neq \emptyset $). Then exist elements $x,y \in W$ (and $x,y \in \mathbb{R}$) such that
$$ cx + y \in W $$
But, if $x \neq y \Longrightarrow x \leq cx + y$ and $y\leq cx+y$

The idea is:
$W=\{1,2,3\} \subset \mathbb{R}^+$, then $2c+3$ is bigger than any element of $W$. So $2c+3$ is a new element in $W$

Following this process we have that $W = \mathbb{R}$ because $W$ have some element in $\mathbb{R}$ but $\mathbb{R}$ is closed. So the new element ($cx+y$) has to be in $W$ (because is subspace).
If $W$ have just one element, we would like that $cx+y \in W$, but the only element in $\mathbb{R}$ who makes this is 0. So $x=y=0 \Longrightarrow W=\{0\} $
Sorry for my english, I hope can help with this.


db query for retrieving comments without any reply

Question: what is a query for selecting a list of comment id's that have not had a reply yet so I can use it to iterate though each comment id and echo out the post it is on and the excerpt of the comment along with the author name, url and how many comments?
Answer: this should work...
<code><?php
global $wpdb;
$sql = "SELECT comment_ID FROM ". $wpdb->prefix ."comments WHERE comment_parent = 0 AND comment_ID NOT IN(SELECT comment_parent FROM ". $wpdb->prefix ."comments);";
$results = $wpdb->get_results($sql);
?>
</code>
Comment: actually I spoke too soon! it works but it brings back every comment that hasn't had a reply.
what is a query for bringing back top level comments that haven't had a reply?


Is my drone battery too large?

Question: I'm new to the drone game.  I'm building an Arducopter S500,(2015) with 2212 KV920 max 1200 gram, brushless motors, 10/45 blades, SimonK ESC's, Lipo 5200  11.1V battery, and GPS 2.8. My controller is a FLYSKY FS-16X  6 channel.  As of this question, the total weight is 1294 grams. My question:  My battery weighs in at 394 grams.  Is that too heavy? Thanks.
Answer: All of the provided information points to a 'standard' DIY setup. A 11.1v battery (3S) is recommended for this setup. The 5200 is the capacity in milliamp hours (mAh) which more or less tells you how long it can fly between recharges.
There are 4 motors, so if each can lift 1200 grams the total weight of drone, battery and other equipment needs to be less than 4800 grams.

Is my drone battery too large?