The Color Purple

Question: Is 'the color purple' a syntactically sound sentence? Or would 'the purple color' be a more standard version. I'm basing this on the fact that adjective-noun order seems a more acceptable syntax.
Comment: It is not a *sentence* because a sentence has at least a subject and a verb.  I think you mean is it a syntactically sound *phrase*.
Comment: @MvLog I agree with your point. But barring more context, in which *the color purple* could be considered an elliptical sentence along the lines of *yes (that's what I think)*, it can't really be considered a sentence. We don't have any basis for it to be meaningful on its own. (Aside from its meaning as a book and movie title, which is different.)
Comment: The idea that a sentence is "a group of words expressing a complete thought" has been widely discredited—even though it contains a good deal of truth. But it is true that many single words can be sentences, as C.T. Onions observed: "Many single words or self-contained groups of words, of any size, may perform the work of a sentence. "Yes" and "no" are long-established sentence-words; they are equivalent to sentences. The grammarian James Sledd wrote aptly that "no useful definition can be framed to include all and only the things [that] are often called sentences."
Comment: https://en.wikipedia.org/wiki/The_Color_Purple
Comment: @MvLog - OK, then; "the color purple" is not a *full-formed* sentence.  Yes, a lot of things people say as "sentences" are not necessarily subject-verb sentences, but if therefore you say "A sentence can be anything at all", I don't think that's useful for a learner, because it doesn't give us any way to distinguish between, say, "Train running" (which could certainly be something somebody says) and "The train is running" (which is a classically well-formed sentence).
Answer: It depends on what you want to say. Both are perfectly acceptable.
Saying "the color purple" you refer to purple which in this case is a noun. Purple is a color.
On the other hand, "the purple color", you're referring to the color which is purple and in this case purple plays the role of the adjective.
Comment: To add an example: "My favorite color is the color purple.  That's why I like the purple color of this painting."

The Color Purple


Make part of a writable book read only

Question: I want to make an input system tool for some data packs, and add buttons to press when you are done inputting.  The problem is the person inputting text, can delete the buttons, and then the input won't get processed.  Is there a way to make part of a writable book read only?  I thought of continually modifying the book to keep in the buttons, but I'm pretty sure it will kick you out of the book.  Any help?
Comment: @Topcode any idea how I would do that?
Comment: an alternative would be to use chat. as the input system
Comment: It turns out that editable books do not use JSON text. Signed books do, but books that are still editable use plain text.
Answer: If you want the text to be locked in when they submit, a alternative would to tell the player to sign the book when they're done, and test for a written_book in the inventory.
/say Enter your text, and sign the book when you're done!
/execute if entity @p[nbt={Inventory:[{id:"minecraft:written_book"}]}] run say Thanks for writing your text!

Also, it appears that the Book and Quill uses plain text in NBT for its pages, not JSON text. Signed books use JSON text, but editable books do not.

Make part of a writable book read only


Entity Interpolation (Lost Packets?)

Question: I'm working on a networked game for a while. I'm aware of client-side prediction and lag compensation (shooting) but I'm not sure about entity interpolation client-side. I'm sending update/sync packets at 10fps from server and client interpolates from current position to newly received position. Interpolation takes 100ms (because of 10fps) to reach target position but what if new position arrives late or 2-3 packets drop? There will be no target position and sync'd (client-side) entity will be idle until new position packet but entity continuously moving forward server-side. Basically, I don't know what to do in this situation.
Answer: The point of interpolation is to take the last received position from the server and predict where the object should be now based on how long ago the last packet was received.
This is called "linear interpolation" as we assume that the object moves at a constant, fixed velocity based on the motion vector last received from the server.  There are problems with this when a true disconnect occurs (if you've played Second Life for any period of time, watching yourself suddenly go flying through walls and off into the void is the result of client-side linear interpolation with no resync from the server).
This is a decent article on how to go about setting up interpolation and resync in unity.  It's a little above my head to try and provide a summary, but it has to do with storing input, acting on it immediately on the client, then when the data is sent to the server and validated, some computation is performed on the reply back to the client to keep things in synchonization.
Comment: I'm already re-applying inputs on the client when server sent sync for itself. For entities (other players, projectiles etc.), you suggest to keep moving with currenty velocity (predict) until new server sync arrives, right?
Comment: @M.Fatih Yes.  The prediction will keep objects moving until you get another sync.

Entity Interpolation (Lost Packets?)


disk defragmentation using powershell in 32bit

Question: I am getting one error while performing below command
Optimize-Volume -DriveLetter C -Defrag -Verbose .I'm getting error like This command is not supported on x86 running in x64 environment while i'm performing this operation on another computer. This command is working fine in both client side and server side but when I have to run it from server to perform in client side it shows this error. I want to know the problem and solution.
Answer: The problem occurs because you are trying to execute a command that requires 32 bit computing in a 64 bit shell.
When you search for PowerShell on the system you wish to execute the command on you should see both a 32 bit and a 64 bit version of Powershell:

Since you are running a 64 bit system, you most likely default to running the command in the 64 bit shell.
You need to select the Windows PowerShell (x86) to run it from the 32 bit shell, and thus be compliant with the command you are trying to execute.
If you call PowerShell from a scheduel task or in your case Python, you need to call it from the 32 bit PowerShell location:
%SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe

In order to use this in python to call a PowerShell script you could do something like this:
psxmlgen = subprocess.Popen([r'C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe',
                             '-ExecutionPolicy',
                             'Unrestricted',
                             './buildxml.ps1',
                             arg1, arg2, arg3], cwd=os.getcwd())
result = psxmlgen.wait()

You may not need the Execution Policy nor the arguments depending on the script you want to call.


How java ensures only one instance of an enum per JVM

Question: How does Java ensure internally that only one instance of an ENUM would exist per JVM? Is it created when application boots up and from that point on when multiple threads access it, it will just return the object created at startup?
Or does it implement some kind of double synchronization similar to the singleton pattern so that even if multiple threads access it, only one istance will be created?
Comment: It ensures one instance per class loader. If you have multiple class loaders, each one can have their own instances.  They are created on demand. (Lazy-loaded)  The JVM has its own mutex lock for this.
Answer: as you can read in this answer enum instances are static class fields and so are initialized as part of class loading when you 1st access the class.
classloading is synchronized internally so that ensures enum instances are singletons (singletons within the same classloader, that is. if you have the same enum loaded by multiple loaders you will get multiple instances)
Comment: @Victor - yes. you wont see it im plain old java programs, but its a common issue with more complex systems like j2ee where you have multiple classloaders
Comment: Thanks. Are the same true for normal static variables ? i.e a static variable is in danger of being initilaized multiple times by multiple classloaders?
Comment: @Victor Static initializations are performed within the context of a classloader. In the case of having multiple classloaders (isolated, for example in J2EE), they'll be loaded multiple times as long as those very classloaders are isolated and do not converge in any level of their hiearachy where the class could have been loaded (since requesting a load would mean returning something in the cache of a common parent classloader).
Comment: @Gamb - or fi the class in question is found in multiple jars along the classloader tree - common when someone includes a library in a deployment-specific /lib and in some higher-up global /lib. the classloaders dont have to be completely separate for this to happen
Comment: @radai I was addressing the normal behaviour, if the developer choses to deploy fat WARs it is a discussion for another question :). Still, you're right about it, but it wouldn't be a cause related to classloading per se but to a human error.
Answer: Enum instances are created at class loading time.  If the same enum gets loaded by more than one classloader (when classloading games are being played by, for example, a web app container), you will have multiple incompatible instances in memory.
Comment: what do you mean by 'incompatible instances' ?
Comment: @apersiankite It means that the instances look the same, but test: `enum1.getClass() == enum2.getClass()` return false. They are in fact different classes for JVM.


Show PSD Preview in PictureBox

Question: Is there a way to show the preview of a PSD file in a PictureBox or ListView?
Can it be done without the help of a library?
Answer: There is no explicit native solution for this, but there are various libraries and projects that you can use.
Your best option may be to start with these CodeProject articles:
Yet Another PSD Parser
Reading Adobe Photoshop Images
Answer: I've tried competent_tech's links and they don't work with most of psd files.
This one: http://www.codeproject.com/Articles/10398/Import-Adobe-Photoshop-psd-images is a little better, but still doesn't work with newer psd files.
This one: http://www.imagemagick.org/script/index.php works fine (I checked the compiled convert.exe from the installation folder), and there is a .NET wrapper:
http://imagemagick.codeplex.com/, which I failed to use. Anyway you could run an external process of convert.exe to save the file as a common format and load it to the PictureBox.
If you have time to read code, the library is open source.

Show PSD Preview in PictureBox


Adding an App does not shown up to users in SharePoint 2013

Question: We have SharePoint 2013 farm, and a developed created a webpart which was added to the App Catalog. I have a full permission to all site collections via user policy and the developer has a site collection administrator (SCA). For some reason, I am the only one who can search and see the app when I go to the site collection and other users do not.
I have checked the settings for the App in the app catalog as shown below:
Answer: I just added "all users" active directory group to the app catalog site collection with "Read" permission and now users are able to view and add App uploaded to the App Catalog site.


Why does my dynamically allocated array get initialized to 0?

Question: I have some code that creates a dynamically allocated array with
int *Array = new int[size];

From what I understand, Array should be a pointer to the first item of Array in memory. When using gdb, I can call x Array to examine the value at the first memory location, x Array+1 to examine the second, etc. I expect to have junk values left over from whatever application was using those spots in memory prior to mine. However, using x Array returns 0x00000000 for all those spots. What am I doing wrong? Is my code initializing all of the values of the Array to zero?
EDIT: For the record, I ask because my program is an attempt to implement this: http://eli.thegreenplace.net/2008/08/23/initializing-an-array-in-constant-time/. I want to make sure that my algorithm isn't incrementing through the array to initialize every element to 0.
Comment: You can't rely on this behavior, it's UB!
Comment: You can write `int *Array = new int[size]();` (note the empty trailing parenthesis) if you ever want those zeros guaranteed.
Answer: In most modern OSes, the OS gives zeroed pages to applications, as opposed to letting information seep between unrelated processes.  That's important for security reasons, for example.  Back in the old DOS days, things were a bit more casual.  Today, with memory protected OSes, the OS generally gives you zeros to start with.
So, if this new happens early in your program, you're likely to get zeros.  You'd be crazy to rely on that though; it's undefined behavior if you do.
If you keep allocating, filling, and freeing memory, eventually new will return memory that isn't zeroed.  Rather, it'll contain remnants of your process' own earlier scribblings.
And there's no guarantee that any particular call to new, even at the beginning of your program, will return memory filled with zeros.  You're just likely to see that for calls to new early in your program.  Don't let that mislead you.
Answer:
I expect to have junk values left over from whatever application was using those spots

It's certainly possible but by no means guaranteed. Particularly in debug builds, you're just as likely to have the runtime zero out that memory (or fill it with some recognisable bit pattern) instead, to help you debug things if you use the memory incorrectly.
And, really, "those spots" is a rather loose term, given virtual addressing.
The important thing is that, no, your code is not setting all those values to zero.
Comment: In a modern VM OS, I'd be rather disappointed if it let me see other tasks' discarded memory willy nilly, unless I did something far less pedestrian than a simple `new`.
Comment: @g-makulik : I expect junk from within the same application; I was just pointing out with virtual memory in a modern VM OS, you shouldn't expect to see junk from _arbitrary other_ applications.  (The "those spots" commentary.)
Comment: @JoeZ Yes, it's kinda odd question. Usually it's asked vice versa. But UB hmm, simply stays UB ...


Any ways to combine Android APK with Expansion pack file?

Question: I want to have only one APK that contains all files and resources without having to download expansion pack every time.
Is there any way to combine Android APK with Expansion pack file?
My expansion pack format is main.build-version.package-name
The reason I want to do this is because decompiler fails to find some resource files and the apk has expansion pack which adds some files after its installation so I need to have all resources and files in one place.
Answer: OBB is what you are looking for:
https://developer.android.com/google/play/expansion-files


Before I change position I want to check if the gameobjects are collinding

Question: For starters I'm new to Unity3d. So my question is when I click on an object I want to change its position but without collinding with the other objects and I need a function to check that. I already added a box collider 2d and checked is trigger.
Answer: Unfortunately in Unity there is no way to see if an object is currently colliding. What you need to do is record the last "Good" location & try to move the object. Then override OnCollision and of it is colliding with an object it shouldn't be, move it back to the good location. If you do this you will also want to set a flag (bool moving) saying that you are moving it, and once it is at that location (and hasn't collided) remove that flag.
All that being said, if you are trying to manually move an object & using the collision system you are probably doing it wrong. It would be better to set the velocity of the object such that it move the object in the correct direction & then stop it from moving once it has collided.
More details on what you are doing would also help other craft a better answer.
Answer: You can enable and disable the collider on the player to get the desired effect. For example my player is climbing a ladder and I would like him to move through the grounds box collider while he is on the ladder so I create a bool isClimbing and when he connects to the ladder and is climbing is true I would
player.GetComponentInChildren<BoxCollider2D>().enabled = false;

and when he leaves the ladder than re-enable it.
edit- note that if your player does not have a parent then you would use
player.GetComponent<BoxCollider2D>().enabled = false;


What is the significance of Derry opening the gate panting despite it being "always open"?

Question: In On the Face of It by Susan Hill, Lamb says that the gate is always open and he does not like closing things [Dialogues of scene 1]. But then, why does Derry open the gate panting (Scene 3)? What is the significance of this?
Answer: There in no need to suppose that there is a particular significance. Open does not only mean 'not closed' but also 'not locked'
Oxford English Dictionary

Of a door, gate, window, etc.: having the movable part put aside so that there is access or passage through a wall, fence, etc.; not closed or blocked up; (also) unlocked. Of a doorway, gateway, passage, etc.: allowing access or view, free from obstruction; (also) not locked.

This leaves the options that the gate was 'shut' but unlocked, or that it was only open slightly such that Derry had to open it wider to enter.
Derry was panting because he had run back to Mr Lamb's house due to the argument with his mother and his desire to assure Mr Lamb that he was good to his word and was returning.


I'd like Alexa to announce a monthly reminder

Question: I'd like Alexa to announce a monthly reminder on the same day each month, but it seems she only knows "weekly", "daily", etc.  Is there another way?
Comment: Do you specifically need it on the same day each month? [This page](https://www.trifexis.com/blog/authors/admin/2017/how-to-create-monthly-dosing-reminders-using-alexa) has an example of asking for a reminder 'in one month' but I haven't been able to test if it works or whether it fits your needs.
Answer: It looks like it's a non-existent future, at least as of the start of this year: check out this thread on the amazon forum.  Charlie444 writes,

Weekly and daily reminders are great but please add the ability to set monthly and every other week reminders!!

...and Kristen C from the Amazon Staff wrote back,

Great suggestion Charlie444! If you haven't already, I also recommend sending feedback through the Alexa app by selecting the ? icon next to your name in the menu.

So it looks like for the moment, it's not an implemented feature.  I'd recommend doing as Kristen suggested as well: send feedback through the Alexa app.  The more people feedbacking about this, the more likely it is that they'll do something about it.


How to know and remove unused custom modules / extensions in Magento 1.x and Magento 2.x?

Question: I have two different stores of Magento 1.9 and Magento 2.3. I need to know details of unused custom extensions and third party modules of my stores which are enable but not used for long time, so that I can disable/remove it. Is there any method or way to do that in Magento ...?
Comment: It's okay brother @PartabSaifuddinZakir , No problem... I am digging Magento to get the solution for it. Once I will get a proper solution for it, then will let you know. Thanks for spending your time...
Comment: Please elaborate cuuz you caz know the status of disabled extension by `php bin/magento module:status`
Comment: Hii @PartabSaifuddinZakir, Thanks for your reply. Yes we can know the status of the module in both Magento 1.x and 2.x. But I need to know the extensions which are enabled and were used previously, but they are not used now for a long time ...
Comment: As far as I know you have to check the code of your custom or third party modules to see what task they're performing...
Comment: Yes, I know the use of each custom extensions and third party modules, but how could I know that the particular task which is done by that extension/module; is not performed since long time?
Comment: I'm sorry I didn't know that...
Answer: This is only half the answer, but your question is pretty broad, so I'm doing my best...
The short answer is that there really isn't a universal way to do this because it will depend on your extension.
The long answer is that you could either disable the extension to see if it causes problems or find ways of tracking usage.  You could try to log an entry every time an extension is loaded, but that will depend on the extension and what it is used for.
I would recommend looking for a _construct() or __construct (Note the additional '_') function in one of the Block, Model or controllers folders, then use Mage::log() to see when it is loaded.  For example:
In a file like <magento-root>/app/code/<community-OR-local>/Custom/Extension/Block/Custom.php, add the beginning of the file would look something like this:
<?php
class Custom_Extension_Block_Custom extends Mage_Core_Block_Template {

  protected function _construct() {

    // THIS IS THE LINE YOU WOULD ADD
    Mage::log('Custom_Extension_Block_Custom->_construct() called from the following url:   '.Mage::helper('core/url')->getCurrentUrl());

    parent::_construct();

    $this->setSomeBlockData('some block data');
  }

    //  ... more code before file ends
}

This will tell you when and where it the block is being created, which would work similarly for Models and controllers.
It is worth noting that some extensions will automatically be used when certain pages are loaded, just because the extension is enabled and it automatically overrides default template/model/other files.  Also, this is for Magento 1, but I am sure you could find similar ways to track Magento 2 extensions.


Can an SD card (or microsd card) emulate an HID device?

Question: In a similar manner to a usb rubber ducky, can one use an SD card to emulate an HID device (such as a mouse or keyboard)? If so, how could this be implemented, and how can it be protected against?
Answer: No. An SD card does not interact over a bus that can support HID devices.
SD cards operate with two interfaces: a low speed Serial Peripheral Interface (SPI), and a high speed SD interface.
The low speed SPI interface is a general-purpose protocol for talking to electronic devices, but in the context of an SD card the only thing it can talk to is an SD card interface IC - the SPI bus doesn't go directly to the CPU or PCH. SPI is used for talking to things like temperature sensors and power management ICs on circuit boards. It's general purpose in that it's a simple physical and logical specification for talking to devices, but it's not general purpose in the same way that something like USB is. You have to specifically know what device you're talking to in order to make it work, so you can't really just put something unexpected on the bus and turn it into a HID device.
The high speed SD interface is a specific protocol for SD cards. It is specifically designed to talk to SD cards and access data on them. It isn't general purpose and it cannot support HID devices.
An SD card reader that plugged in via USB could operate as a HID device, but the reader itself would have to be malicious rather than the card.
Comment: Indeed, it may technically be possible for a maliciously crafted SD card (custom hardware) to target a vulnerability in the firmware of the SD controller and gain code execution on it, and then re-register itself as a USB HID or other device. In the case of the IC you linked, though, it looks like it'd be quite a complex task to pull off. The 8051 does have access to the XDATA & SFR, which appears to be mapped into USB endpoint TX/RX registers, so the MCU _can_ send arbitrary descriptors. But the device would have to have an external program EEPROM attached and `ROMEN` asserted.
Comment: The largest exploitation barrier would be that the 8051 is a Harvard architecture processor, meaning that instruction and data buses are separate and you _cannot_ execute data. That means you're pretty much stuck with ROP chains. On top of that, the SD hardware goes through a hardware FMC and the only window into the 8051's execution state you have from there is through EPnTX/EPnRX buffers mapped in the SFR - the bus latch phases make it physically impossible for the FMC to talk to the 8051 directly. Doable, but a lot of work for a very specific targeted attack.
Comment: Interestingly, choosing a USB to SD chip at random, the USB2228 https://ww1.microchip.com/downloads/en/DeviceDoc/00002256A.pdf  actually has a programmable microcontroller and memory built-in. One could imagine a (admittedly far-fetched) vulnerability in the controller chip that would allow a nefarious SD card to reprogram it.  https://ww1.microchip.com/downloads/en/Appnotes/en562801.pdf
Comment: Not uninformed at all - you were indeed correct that it's a _possible_ attack vector, and that is a relevant point!
Comment: neat, looks like you have a lot of experience with this! Sorry for the uninformed comment :P
Answer:
In a similar manner to a usb rubber ducky, can one use an SD card to emulate an HID device (such as a mouse or keyboard)?

tl;dr: Yes, but it is highly unlikely. (But there is a different possible attack vector as well.)
There are a confusing number of standards around SD cards, but most of them are not interesting in the context of this question: miniSD and microSD refer to the physical form factor, SDSC, SDHC, SDXC, and SDUC refer to the capacity (and also specify the usage of FAT32, as well as exFAT for capacity >= 32 Gio), High Speed, Ultra High Speed (UHS-I, UHS-II, UHS-III), SD Express, microSD Express refer to the bus protocol, C2, C4, C6, C10, U1, U3, V6, V10, V30, V60, V90 refer to the Speed Class.
All of these specify only storage features. An SD, miniSD, or microSD host or card using any of these can only be used for storage, not for I/O.
However, there is one standard that is relevant to this question: SDIO. SDIO specifies I/O capabilities for hosts and cards. This can be used for GPS receivers, sensors, cameras, audio, and yes, also for keyboards and/or mice.
The danger is very small, though, for two reasons:

The host must explicitly implement the SDIO specification. And most of them don't. (The use cases that SDIO was created for have now all been taken over by USB and Bluetooth, so if a device has USB, there is no point in also supporting SDIO.) Unless you have a 10–15 year old handheld device which has only an SD slot and no USB or Bluetooth, it is practically guaranteed that you do not have an SDIO capable host.

SDIO does not have an equivalent to USB Device Classes. USB Device Classes are a standardized way for certain devices to interact with drivers, e.g. there are standard Device Classes for audio interfaces, cameras, and yes, there is the HID (Human Interface Device) class. Any class-compliant device can be used with a standardized class driver shipped with most modern OSs without needing a device-specific driver. This is how plugging any random mouse in your computer works, and it is also how a Rubber Ducky can pretend to be a keyboard without needing to install any drivers. SDIO devices, however, always need a device-specific driver, there are no standardized device classes.

If so, how could this be implemented, and how can it be protected against?

If the target of an attack has a computer with an SDIO slot (which is unlikely) and has a driver for an SDIO keyboard installed (I haven't checked whether e.g. Windows comes with such a driver, but I sincerely doubt it), then the attack would be more or less identical to the USB one.
It can be protected against by not having an SDIO slot, which is likely already the case. While "don't use USB" is practically impossible in this day and age, "don't use SDIO" is the norm anyway, which makes it more or less trivial to eliminate SDIO as an attack vector.
However, as I mentioned in the beginning, there is a different attack vector, which however has nothing to do with emulating an input device. In the list of bus protocols I mentioned above, you might have spotted the SD Express and microSD Express specifications, and the word "Express" might have piqued your curiosity. And indeed, this is exactly what you would expect: the latest generation of SD bus protocols which use PCIe lanes and NVMe protocols … including a perennial "favorite" of security professionals: Direct Memory Access (DMA) to the host memory from untrusted plug-in devices, starting with version 7.0 of the SD specification.


Is there a way to see valid tiles for settlement?

Question: In the game, there are suggested sites for settlement with the golden icon, but is there a way to see which titles are valid or invalid for establishing a new city? The restriction of neighboring cities is not always clear.
Answer: From the wiki:

Cities have to be at least 4 tiles apart of each other. That includes your cities, as well as other civilizations' cities, and it prevents littering the map with cities. Other than that, cities may be found on any tile where a Settler unit may move to (including a 1-tile island).

Basically, using this rule manually gives you a general idea of where to settle in proximity to other cities, but there is no interface built into the game that I am aware of to warn you of your city's proximity to different city's, other than having a settler at the spot you wish to settle. This information should be enough though for your purposes.
More information can be found here: http://civilization.wikia.com/wiki/Settling_a_city_%28Civ5%29
Comment: That "4 tiles apart" is actually a bit misleading, or at least ambiguous. It actually means there must be at least _three_ tiles between the city tiles. Technically, if you count from the tile centre, the distance between the cities is four tiles. But I think most of the people would count that as three tiles, not four. (Of course, the original writer of that sentence could just have written incorrectly.)
Comment: I believe you are correct in saying that. This is from a fan made wiki, so all information may not be explicit.
Comment: I now checked a bit more. Actually the game itself gives an error "Cannot found a City within 4 Tiles of another city". But still, as anyone can go and try themselves, two cities must only have three tiles between them. The error message is quite confusing and perhaps just wrong in itself as well.

Also, if you found a city on another continent (i.e. any land mass completely separated by water, even one tile island), the cities must have only _two_ tiles between, which is even more confusing. Perhaps the original restriction actually was four tiles, but was changed later.
Comment: @synchronos Interesting. In my own game play, I just use 4 apart as a rule of thumb, but there are certainly exceptions to the rule. As a casual player, I don't really try to exploit the rules of the game, and it fits my play style well, but I can see places when glitches could come in handy.
Comment: @synchronos I'd be interested to see a screenshot of that, my assumption was that the rule was basically that no city could have another city in its workable tiles range.
Comment: No problem. I played a test game before posting the comment, and here you go: http://steamcommunity.com/sharedfiles/filedetails/?id=375143422
Comment: Also what is notable that the city placement rule doesn't completely clear, if the settler is on a different island. They still require to have those two tiles - one is not enough - as can be seen from here: http://steamcommunity.com/sharedfiles/filedetails/?id=375146332
Answer: In addition to Rick_Roll's answer, You may accomplish this via Mods.
For example, I currently use this mod that does the exact thing you want: Civ5 - City Limits
It highlights tiles that are invalid for settlement when a city or settler is selected.


Call A Smart Contracr

Question: I'm wondering if it's possible to call the smart contract, only knowing its address? For instance, if we take the contract, how to call it, if I have a completed transaction as an example. Can i repeat it with another wallet?
Answer: Of course you can do that. There are different ways to do. If the contract has implemented ERC20 standard then you can just compile an IERC20 interface in remix and import your contract so that you can interact with the contract with functions like transfer, transferFrom, name, symbol, totalSupply, decimals etc.
If you do not know anything, you can see the function signatures in every transaction and call the contract using web3js using some code.
Eg.
<code>let data = await provider.call({
    // address of the contract to interact with
    to: address,

    // `function name() view returns (string)` that gives you name of contract
    data: "0x313ce567",
});
console.log("data", data)
</code>

Call A Smart Contracr


Raid5 mdadm array change size

Question: I have created a raid5 array with 4 disks. Initially i had 3x 3tb and 1x 4tb (because 3tb was unavailable at the time). After some years i have replaced most of these disks and have come to the point where all array disks are now 4tb in size. Still my mdadm array is 3TB.
Is there any way to change the mdadm array size to match the 4tb disk size w/o loosing my data?
Thanks for your help!
Answer: If you have a write-intent bitmap, remove it
<code>mdadm --grow /dev/mdX --bitmap none
</code>
Then grow the array
<code> mdadm --grow /dev/mdX --size max
</code>
Finally, restore the bitmap if you were using one
<code> mdadm --wait /dev/mdX
 mdadm --grow /dev/mdX --bitmap internal
</code>
This is all from the RAID Wiki
Things are different if your RAID is on partitions rather than full disks, as you'll have to remove, resize, and then re-add each disk in turn. Wait for a full resync after each disk partition has been extended
Finally you'll need to grow the filesystem or PV that site on top of your RAID. (You can do this any time after the second step.)

Raid5 mdadm array change size


How to FindGameObjectsWithTag then cast the array of GameObjects to an Array of Interfaces

Question: I have a few GameObjects that implement a common Interface: IsTree.
I need to call the function doTreeThing() on each of those IsTrees after getting a reference to each of them via FindGameObjectsWithTag("tree").
This line complains that it cannot implicitly convert from GameObject[] to IsTree[]
IsTree[] trees = GameObject.FindGameObjectsWithTag("tree");

So then I tried to leave the GameObject[] an iterate over it to convert each individual object inside to an IsTree.
GameObject[] trees = GameObject.FindGameObjectsWithTag("tree");
        foreach (GameObject tree in trees) {
            IsTree isTree = (IsTree)tree;
            isTree.doTreeThing();
        }

But this complains that it also cannot convert GameObject to IsTree.
Then I got a little desperate and tried to make my IsTree into a GameObject.
public class IsTree : GameObject {
    public System.DateTime getAge(){
        return null;
    }
}

GameObject is a sealed type. (I don't really know what that means besides that this does not work)
So how do I get this array of GameObjects into an array of SomeInterface?
Comment: Did you consider FindObjectsOfType instead?
Answer: GameObjects are not their components. They are containers for their components. So once you have the GameObject, you have to get the component from it, rather than just assume it is it.
GameObject[] trees = GameObject.FindGameObjectsWithTag("tree");
foreach (GameObject tree in trees) {
    IsTree isTree = tree.GetComponent<IsTree>();
    isTree.doTreeThing();
}

DMGregory's suggestion should also work:
IsTree[] trees = GameObject.FindGameObjectsOfType<IsTree>();


How do I separate unit testing from integration testing?

Question: I am new to testing and mocking. I'm trying to test a business logic class which performs calculations, calls into the DAL and updates the database, and manages transactions. I'm using mocks to do unit testing, but how does full integration testing fit into all of this. Do I basically have the exact same tests, but use the real DAL or do I do something completely different?
Answer: Pretty much. The important thing to know is that unit testing (in TDD) is not much about testing as it's about design. You create unit test to incorporate design decisions of every single component of code in an automated validation system; so that each part of your system conforms to its design. This way, you can rely on each component is not relying on unspecified features of other components.
Answer: You can pretty much think of it the way that you are thinking of it.  You could add and additional step if you wanted to however and do a process test.  In testing you have unit tests, CSC tests, and CSCI tests.  You are doing unit tests and CSCI tests.  The CSC test is essentially a process test where you would test out the functionality of a process before you put it into the overall application.  For example, you have a working application and write a new piece of functionality for that application.  You unit test the code first.  If everything works then you test the new functionality standalone.  If that all works then you put it together with the application and test everything all together.
These can all be the same tests if they cover the functionality.  You may need to expand the tests the further you go in the testing though.


No picture with Sony pcg 252L

Question: I just got this computer from a friend and I get nothing but a black screen. Do I need a specific keyboard? Is there a secret to getting the monitor to come on?
Comment: Keyboard should not matter, have you tried asking your friend how to set it up?
Answer: I would make sure it is connected fully / all the wires are firmly in, and if the monitor has more than one input (say VGA and DVI), you have selected the correct one (If it doesn't have an auto select feature).
Failing this, it is possible it was damaged in transit, or even the graphics card inside the computer has become damaged.
I think the first part is more likely to of happened, but you can't rule out the second - but without seeing the machine or having a lot more information, it is impossible to say for sure.
Comment: Along the same lines, if there is more than one video output on the back of the PC, be sure to try both of them.
Comment: @Flimzy - +1 very good point.

No picture with Sony pcg 252L


Open ت and tied ة does both ت indicates at the end of the word that the word is feminine in arabic linguistics?

Question: If a word ends with open ت or tied ة does both ت indicates at the end of the word that the word is feminine in arabic linguistics like ٱللَّتَ feminine form of word Allah in Quran 53:19?
Comment: "Indicate" is vague. Do you mean "absolutely prove", or "suggests the likelihood"?
Comment: Your question might be well received on Islam.SE
Comment: absolutely prove :)
Comment: I don't think you can "absolutely prove" anything ت
Answer: A /t/ suffix makes a noun feminine in many Afro-Asiatic languages. However, in many of these languages (including Arabic), it's gotten lenited over time, and is now pronounced as [h] or silent: زَوْجَة /zawɟat/ [zawɟah] "wife". When a suffix is added, the pronunciation is still [t]: زَوْجَتيِ /zawɟatiː/ [zawɟatiː] "my wife"—the lenition only happens word-finally. So in Arabic, only when it's word-final, this /t/ is written with the glyph for /h/ plus the dots of /t/, showing both the underlying phoneme and its pronunciation.
However, in Arabic, this lenition happened only after /a/: if there wasn't an /a/, like in أُخْت /ʔukt/ [ʔukt] "sister", the /t/ remained [t], and is written with the normal glyph for /t/. So one hypothesis about 'Allat is that it was previously pronounced /ʔalilaːt/ (based on a transcription in Herodotus), with a long /aː/, which blocked the lenition, and that this archaic pronunciation persisted until after the lenition stopped being productive.
Alternately, the word may have fossilized before the lenition happened, or the [t] pronunciation might have been kept specifically to keep it from becoming homophonous with 'Allah. Or it may have come from an unrelated root L-T-T "knead". I'm not sure if there's a scholarly consensus on which of these is right. But there are definitely feminine nouns with a normal ta at the end, and I believe 'Allat is definitely grammatically feminine (based on agreement), so I wouldn't read too much into it.
Comment: Thank you so very much brother for this info now i understand that if a word ends at ت or ة both indicates that the word is feminine! right brother? :)
Comment: @BilalKhan Often yes, but not always. Unrelated words can also end in `/t/` for unrelated reasons.
Answer: ت and ة can appear at the end of a word for a number of reasons in Arabic (presumably classical Arabic is the real scope of the question). An example of a non-feminine is كتبت "I wrote". Hence you need to also include the provision that the text is fully vocalized: كَتَبْتُ. But you also have to exclude the imperative of any root ending in /t/, or modern nouns like البزموت. As far as I know, بُعُولَة "husbands" is a masculine (plural) noun and خَلِيفَة "caliph" is masculine singular. This article discusses criteria for gender assignment in Quranic Arabic, which is not trivial.


Rstudio Git bash pop-up every time

Question: I have integrated the git version control to an existing project in Rstudio(Windows). After that for every change I make in the Rmd file, a pop up is coming. I could see that it is a git bash executing on every command I have added in the file. I do not have more details on this.
Comment: having the same error, help is welcome... git is working fine outside of Rstudio, but when in Rstudio Git bash is popping up everytime
Comment: @jebsel sorry, I couldn't help you at this point. I have been provided with a Mac system in which I'm using Rstudio+git without any issues. Still I face the same issue when I work in the windows machine.
Answer: Actually solved it myself just now with the help of this info:
https://stat545-ubc.github.io/git03_rstudio-meet-git.html
WARNING: On Windows, do NOT use C:/Program Files (x86)/Git/cmd/git.exe. The difference between the good and bad paths is bin vs. cmd.
My Rstudio-version was setting the cmd/git.exe as default.
If you change that to bin/git.exe my problem was solved...

Rstudio Git bash pop-up every time


numeric column/field received through API call always gets saved as 0 to designer workflow variable

Question: When I retrieve an O365 site's list's items in the designer workflow (2013) using rest api call, the Number type columns always get set to local integer variables as zeros. I have inspected the returned JSON using the Postman and Advance REST Client tools and there are non-zero values being returned, but when I copy the values to local integer variables and try to log those local variables then all I see are zeros in the workflow history list. Has anyone else experienced this?
Comment: try to change the local variable type from Number to string and then check. May be some format issue.
Comment: I did that and it fails validation when checking for errors. It wont accept "Number" type even. Only "Integer" works.
Comment: U sure its a Number column which you are returning . Can you add other number columns and check if all returning same 0 value in local variable
Answer: not sure what happened, but I had to delete the "Get an item from a dictionary" action items and re-insert new ones and that fixed the problem.
Buggy SP Designer wasted my two days :(
This is what the path for the dictionary item looked like in that action item:
([%Variable:index%])/MyNumricListColumn
All this time I made sure that the local variable [%Variable:index%] was in fact a correct field data (judging from the way it responded to mouse clicks) and not just any plain text.
I hope this will be a lesson for others too. When in doubt, remove the action item and add it back in, no matter how correct it looks.


How to quickly restart a game after a crash/freeze on Wine(Linux)?

Question: Some games takes a long time merely to reach the Main menu.
After a crash, in the middle of a fight, what you least want is to wait a huge reload time.
So, after the crash, we would have to wait for the game initialization + the savegame loading times...
How to overcome this boredom?
Answer: First prepare a new wineprefix properly:
# lets say WINEPREFIX="$HOME/CoolGame"
# Inside the WINEPREFIX for some specific game, I created a new folder like:
mkdir "$HOME/CoolGame/_NewInstance_"
ln -s "$HOME/CoolGame/drive_c" "$HOME/CoolGame/_NewInstance_/drive_c"
cp "$HOME/CoolGame/"*.reg "$HOME/CoolGame/_NewInstance_/"

Now, run it like (btw, each must be on the right path for the executable, so use cd first):
1st:
WINEPREFIX="$HOME/CoolGame/" wine64 CoolGame.exe #1st store its pid on nGamePID1st
2nd:
(sleep 120;pkill -SIGSTOP -fen CoolGame.exe)&WINEPREFIX="$HOME/CoolGame/_NewInstance_/" wine64 CoolGame.exe #2nd store pid on nGamePID2nd
You must know how long it takes to reach the main menu, that is what sleep 120 is for.
Now, the 2nd instance will load til about it is on the main menu, and it will be Stopped (being stopped will let it be moved also to the swap file if needed).
The 1st instance will let you play it normally.
As soon the 1st crashes or freezes/bugs(SIGTERM;sleep 10;SIGKILL), run this:
(sleep 120;pkill -SIGSTOP -fen CoolGame.exe)&WINEPREFIX="$HOME/CoolGame/" wine64 CoolGame.exe #1st
It will prepare the 1st again, for when/if the 2nd crashes. You can put it in an endless loop too.
Now, you can promptly continue the 2nd instance with kill -SIGCONT $nGamePID2nd, it will already be almost on the main menu, and you just have to load your last savegame.
This works with offline games. No idea about online ones tho, neither if this can be done on windows/mac.


Should I create should my own user with less privileges on a server (Digit. Ocean)?

Question: I'm trying to deploy a website at Digital Ocean. I have the user root as the default. However, since it's root I believe I should create my own, normal user, shouldn't I? Nonetheless, in the documentation they don't say anything about it. Could you guys tell me whether or not I really should create my own user with less privileges?
Answer: If you are neither God nor the Pope, you're not infallible, so prone to make mistakes.  ;-) Therefore I would create 2 users:

A user that can read everything but not change anything:
adduser NormalUserName

An "Admin" user that needs the sudo command to change anything.
adduser AdminUserName
adduser AdminUserName adm
adduser AdminUserName cdrom
adduser AdminUserName sudo
adduser AdminUserName dip
adduser AdminUserName plugdev
adduser AdminUserName lpadmin
adduser AdminUserName sambashare

(If any of the above gives an error like group not found, don't worry: I'm trying to be thorough)

Then:

Always log on as the "normal" user
do an su - admin if you know you're going to make just a few changes

Only use root when you know that you're going to:

do extensive changes
run an long script needing root privileges and that has been thoroughly tested.
be needing I/O redirection,...

Additionally, I have a different prompt for the admin and root user (both those show a red prompt whereas the default prompt is a green one) to warn me I'm using the "dangerous" user...
Comment: As you've never accepted an answer on this site before: If this answer helped you, don't forget to click the grey **☑** at the left of this text, which means [Yes, this answer is valid](http://unix.stackexchange.com/help/accepted-answer)!  **;-)**
Comment: how about downvoting?
Comment: @OskarK.: that's for users who have already accepted answers and reads: `Please don't thank me!  **;-)** If this answer did help, just click the little grey **☑** at the left of this text right now turning it into beautiful green.  If you do not like the answer, click on the little grey down-arrow below the number, and if you *really* like the answer, click on the little grey ☑ *and* the little up-arrow...  If you have any further questions, just [ask another one](http://unix.stackexchange.com/questions/ask)!  **;-)**`  **>:-)**
Answer: Yes, it's always a very good idea to have an unprivileged account on the system to use when you do not need admin privileges.
On systems with X Window (e.g. KDE, GNOME) this is practically mandatory.
If you have console-only access it is recommended anyway to have it -- even if you're working all the time as admin. In fact, you should block remote ssh login as root for security reasons; ssh instead as this unprivileged user, then run su - to do your admin work.
Comment: how can I create an unprivileged user?
Comment: With the `useradd` or `adduser` commands.  Do `man useradd` or `man adduser` to read the manual pages.


What does wink and nod mean? In which context is it used?

Question: Yesterday I read the word "wink and nod" in a newspaper. I didn't understand the meaning. Can anyone explain?
Comment: *wink and nod* is **not** a "word." However, *newspaper* is. Use capital letter for the fpp.
Answer: a nod and a wink| a nod is as good as a wink:

used to say that a suggestion or a hint will be understood, without anything more being said.
  Everything could be done by a nod and a wink.
it generally implies quiet agreement and consent.

A nod is as good as a wink:

is a way of saying you have understood something that someone has said, even though it was not said directly.  The full phrase (sometimes used in the UK ) is 'a nod's as good as a wink to a blind horse'.

Source:http://www.oxfordlearnersdictionaries.com/definition/english/nod_2
Answer: It means to signal that you agree to something, without leaving any record that you ever agreed to it.  It would be used when the thing being agreed to is controversial, or even illegal.
A saying by Martin Lomasney is related: "Never write if you can speak; never speak if you can nod; never nod if you can wink."
Answer: Depends on the context in which it was used i guess.
For example here,
So no litmus test on abortion -- except the protection of "women's rights," which everyone in the room understood as a reference to abortion. Obama's pose of neutrality came with a theatrical wink and nod. Everyone got the joke
It means that the speaker was saying one thing in public, but he actually intended something rather different. The gesture of making "a nod and a wink" is a secret sign to your own supporters that tells them you're not being entirely straightforward, or you really mean something different. It's a way to reassure them using coded language that they will understand, but the general public won't.
A "theatrical" nod and wink would be one that's really obvious, so just about everybody will know what he really means - but since he doesn't actually say it outright, he can still deny saying it later if he has to.
Link: http://forum.wordreference.com/showthread.php?t=2273655
Answer: I was surprised, reading the previous comments, to see "a nod and a wink", and I'd never heard "a nod is as good as a wink" either, but the phrase "a wink and a nod" was very familiar to me. When someone does something "under the table" -- like taking a bribe -- with the understanding of the other participant, they might do so "with a wink and a nod", meaning everybody understands without saying.
I guessed that "a nod and a wink" might be British usage, and "a wink and a nod" American. Sure enough, when I checked using Google's ngram viewer, in British English "a nod and a wink" is more common; in American English, it's the other way around.
Answer: To wink: close and open one eye quickly, typically to indicate that something is a joke or a secret or as a signal of affection or greeting
To nod: lower and raise one's head slightly and briefly, especially in greeting, assent, or understanding, or to give someone a signal.
Comment: I know the meaning the individual words.But i need meaning for combination of both the words and usage.
Comment: Could you supply the sentence you read it in? For context sake.
Comment: With no context it stands out as simply a greeting or an acknowledgement to an unspoken understanding of something.


Variational Autoencoder TIme Series

Question: Can anyone suggest a blog where Variational Autoencoder has been used for time series forecasting?
Comment: You may find this helpful: https://openreview.net/pdf?id=r1cLblgCZ
Answer: Maybe look at this paper and references therein
Variational Encoding of Complex Dynamics
Answer: Variational-LSTM autoencoder to forecast the spread of coronavirus across the globe
A novel variational-LSTM Autoencoder model to predict the spread of coronavirus for each country across the globe. This deep Spatio-temporal model does not only rely on historical data of the virus spread but also includes factors related to urban characteristics represented in locational and demographic data (such as population density, urban population, and fertility rate), an index that represents the governmental measures and response amid toward mitigating the outbreak.

variational LSTM autoencoder model

Variational Autoencoder TIme Series


How long "Annexed subject" diplomatic penalty stays?

Question: How long "Annexed subject" diplomatic penalty stays after annexing vassal?
Answer: According to wiki the penalty lasts 10 years.
Comment: There's also an icon present in the list of country modifiers whenever this modifier applies. If you hover the cursor over it, the popup will tell you how long until this modifier is cancelled.
Comment: I've tried to find, but could not. Do you have the reference handy? thanks.
Comment: @Budda First negative effect of annexation mentioned in the Annexation section
Answer: As long as I can remember (I started out in 1.7 I think), the following has been true:

Annexing a vassal will result in a 10 year penalty of -3 diplomatic reputation [DR] to the overlord. The penalty does not stack if multiple vassals are annexed. All other vassals of the overlord will have their opinion reduced by -30 as well, which will stack. If the annexed vassal was a member of the HRE, then the opinion penalty will also be extended to all members of the HRE. source

Most important is that the effect will

delay or freeze other annexations (if DR gets less than 1, even during an annexation)
potentially prevent starting another annexation (if attitude of the other subjects gets below 190 due to the malus)

The latter stacks, so by annexing 3 subjects, the others will all gain -90 rep, which is very considerable.
A good strategy is to keep you DR positive (i.e. +4 before the first annexation), if possible, and annex them in increasing order of attitude (the most negative to you subjects first, so the penalty only affects those subjects which are still at, or close to, 190+). Note that this requires some careful planning.
Important: If you cannot keep positive DR, annex only one of them at a time, and wait 10 years inbetween. If you don't, a diplomat will be stuck for 10 years.
If you stay at positive DR, you can also try to simply annex all subjects simultanously, so the -30 penalty won't affect them (it does not matter once annexation started).
Also note that the -30 malus is applied to exactly those subjects you have when an annexation finishes (not starts). So you should wait to create new vassals until after all or most annexations have finished.


Get the amplitude at a given time within a sound file?

Question: I'm working on a project where I need to know the amplitude of sound coming in from a microphone on a computer.
I'm currently using Python with the Snack Sound Toolkit and I can record audio coming in from the microphone, but I need to know how loud that audio is. I could save the recording to a file and use another toolkit to read in the amplitude at given points in time from the audio file, or try and get the amplitude while the audio is coming in (which could be more error prone).
Are there any libraries or sample code that can help me out with this? I've been looking and so far the Snack Sound Toolkit seems to be my best hope, yet there doesn't seem to be a way to get direct access to amplitude.
Answer: Looking at the Snack Sound Toolkit examples, there seems to be a dbPowerSpectrum function.
From the reference:

dBPowerSpectrum ( )
Computes the log FFT power spectrum of the sound (at the sample number given in the start option) and returns a list of dB values. See the section item for a description of the rest of the options. Optionally an ending point can be given, using the end option. In this case the result is the average of consecutive FFTs in the specified range. Their default spacing is taken from the fftlength but this can be changed using the skip option, which tells how many points to move the FFT window each step. Options:

EDIT: I am assuming when you say amplitude, you mean how "loud" the sound appears to a human, and not the time domain voltage(Which would probably be 0 throughout the entire length since the integral of sine waves is going to be 0. eg: 10 * sin(t) is louder than 5 * sin(t), but their average value over time is 0. (You do not want to send non-AC voltages to a speaker anyways)).
To get how loud the sound is, you will need to determine the amplitudes of each frequency component. This is done with a Fourier Transform (FFT), which breaks down the sound into it's frequency components. The dbPowerSpectrum function seems to give you a list of the magnitudes (forgive me if this differs from the exact definition of a power spectrum) of each frequency. To get the total volume, you can just sum the entire list (Which will be close, xept it still might be different from percieved loudness since the human ear has a frequency response itself).
Answer: I disagree completely with this "answer" from CookieOfFortune.
granted, the question is poorly phrased... but this answer is making things much more complex than necessary.  I am assuming that by 'amplitude' you mean perceived loudness. as technically each sample in the (PCM) audio stream represents an amplitude of the signal at a given time-slice. to get a loudness representation try a simple RMS calculation:
RMS
|K<
Comment: you are not wrong. but doing an FFT to get the power of a discrete signal is like shooting a housefly with a shotgun: it works, but is rather wasteful.
Comment: The library did not provide a RMS function. I believe the integral of the power spectrum over all frequencies should be mathematically proportional (If not directly equivalent) to the RMS. (Power spectrum is in W/hz, RMS is in W. Integrate over all hz and you are left with W).
Answer: I'm not sure if this will help, but
skimpygimpy
provides facilities for parsing WAVE files into python
sequences and back -- you could potentially use this
to examine the wave form samples directly and do
what you like.  You will have to read some source,
these subcomponents are not documented.


Initial connection to WI-FI

Question: My question is what is happening during the initial connection to a wireless network  , is there an Ethernet connection first and then DHCP or something else is happening before the device receive an IP address .
I`m asking this because when i run iwlist command in linux there is : ADDRESS : XX:XX:XX:XX:XX:XX .
Answer: The basic flow starts with 802.11 packet exchange to determine data rates and other capabilites.  After this exchange completes, any WPA/WPA2 or 802.11x authentication happens afterwards before traffic is accepted.
Here is a good explanation from Meraki
802.11 Association Process
Once the client is associated completely, then it will send out a DHCP broadcast to get an IP address, DNS etc.
Comment: The link gave  good explanation , and answered my question  , thank you  .

Initial connection to WI-FI


How to implement smart parts Prism

Question: I am unable to find a way to implement Smart Parts like SCSF, in wpf prism, can any one suggest a way how to do it, links, articles, appriciated.
Thank you in advance, :)
Answer: SmartParts in SCSF was just an abstraction over the simple concept of putting a control on a surface (another control essentially) in dynamic, runtime fashion. You can write that sort of abstraction layer yourself, but it doesn't really buy you anything except added complexity.
I think the important piece to that whole thing was dynamic composition; you could compose your view at runtime using that abstraction.
But you can still do the same thing in WPF. All you need is an IoC container (like StructureMap) and a sensible way to compose UserControls into views. WPF provides you with some nice layout containers (grids, dockpanels, stackpanels) so there really isn't a need to write Workspaces anymore. You just need to not hard-code your views and instead, compose them at runtime (which is easy with the IoC container).
Answer: Prism installation does come with a .chm help file you can get it form the codeplex site. The views/usercontrols (which is equivalent to the SCSF smartparts) you create in each module can be displayed on the Shell. You show the view in a region defined in your shell. As you know PRISM as such doesnt come with any guidance package, you need to write all the code needed to set up the application. The help file (.chm) is of much help, you can refer to the Sample hello world source code which comes along with PRISM.

How to implement smart parts Prism


unlocking bootloader moto g xt1033

Question: I'm trying to root my MOTO G XT1033 DUAL SIM but in the videos I've seen till date it says that you need unlock the boot loader .I saw solution videos to unlock boot loader but all of them says that by unlocking boot loader you will lose all your data.
So I was wondering that is there any way to unlock the MOTO G's boot loader without losing the data?
If it's not possible then please tell me how to unlock the boot loader without PC (my PC is damaged)
Answer: You cannot unlock your bootloader without also wiping your data. Backup your data, either manually or using an app. You also need a computer to perform the unlock process because it is performed while your device is in fastboot mode; before the Android OS is even started.

unlocking bootloader moto g xt1033


In what file does SQL Server Store the configuration data?

Question: Where does SQL Server 2014 store the configuration data? Such as the certificate references for SSL and the size limits and allocations?
Answer: Basically there is not a single place where ever configuration can be found.
The more generally used configurations can be found here Server Configuration Options. But they do not necessarily cover everything that you might want to configure.
For example:  Enable SSL Encryption for SQL Server using Microsoft Management Console
Also you can find some information on size limits and allocations at: Features Supported by the Editions of SQL Server 2014
Perhaps these examples will get you started.


How to run same Selenium/testNG project in a different environment with different credentials?

Question: Currently, I'm running a selenium script in one environment (on-premise) with separate login credentials. There are 5 different users and they have separate login credentials. Suppose there are 50 testcases and login screen will be displaying 50 times while running the script. for an example, first log in to the page and create account and then log out, and again log into the page, edit an existing account then logout.
I need to run the same project in a different environment with different URL and login credentials (cloud environment).
will I have to update all 50  testcases to run same script in two different environment since login page is displaying before running each and every test cases? what will be the easiest way to handle this situation?
Answer: If you already have a script with hardcoded credentials you will have to rework it in any way. Will it be either changing one hardcoded logins to another hardcoded logins or refactoring in order to support some kind of parameterization.
I would create some CredentialsProvider class that would have static method providing the credentials to each of your test (probably an array of credentials so that you would be able to take new piece of creds several times in a test).
What logic would be incorporated in that provider depends on the specific of your test project and your business actions.
Comment: @Anu please edit this question instead, if you have further information to give.
Comment: Credentials are not hardcoded. There is a csv test data file created already for the existing script. will I have to create a separate  test data file for new credentials? and then how can I read both data files in the same script ?
Comment: @Anu I'm not getting you then. If you have creds in file already then what is the issue? Could you add code snippets from your project showing your current appraoch?
Comment: @Alexy: Test data file is already available for on-premise environment. I have to run the same script in a different environment (cloud) with a different URL and login credentials. My question is when I run the script in a different environment should I create a separate test data file for new login credentials (cloud env.) or I can add new credentials to the existing (on-premise) test data file. I'm sorry that I'm not able add code snippet since it's in a real time project with a huge framework.
Comment: Separate login credentials file per environment is a valid approach.  so is adding a column to your csv that you check in the credentials manager.  What's your question exactly?
Comment: @NatBowman; how to read multiple test data files in same script ?
Comment: let me create another question with code snippet... Thanks everybody
Answer: A hopefully generic enough approach:

If you have credentials stored as string literals/anonymous strings, set up a handler class and make functions to return the correct user based on type and environment. - I find it helpful to store the data in a file and read it from there at runtime, but there are a lot of ways to do this.
Call the handler class with the user type (or whatever it is that makes your 5 users different) and the environment under test.

Setting your environment and base URL at runtime should now use the correct environment and users.


What's the difference between mRNA and inactive virus vaccine?

Question: If the techniques used in both vaccines are similar and if both use the spike protein approach, then how is the mRNA vaccine more effective than the other ones and more importantly how come it is also effective towards the new variations of the virus such as the Delta variant whereas the others are not? The same protein should be built with the same mRNA, right? I am a little confused here.
Comment: The techniques used in mRNA vaccines and inactivated virus vaccines are *not* similar. Here's some info on inactivated virus vaccines at ScienceDirect: https://www.sciencedirect.com/topics/medicine-and-dentistry/inactivated-virus-vaccine and here is info on the Covid mRNA vaccines at the CDC: https://www.cdc.gov/coronavirus/2019-ncov/vaccines/different-vaccines/mrna.html
Comment: Re: "more importantly how come ..." is a different question and your premise is not quite correct. Here's a paper from a decade ago about SARS that discusses why the spike protein makes a good vaccine target in these viruses: Du, L., He, Y., Zhou, Y. et al. The spike protein of SARS-CoV — a target for vaccine and therapeutic development. Nat Rev Microbiol 7, 226–236 (2009). https://doi.org/10.1038/nrmicro2090
Comment: I will definitely look more into those. Thank you!
Answer: In molecular biology, a ribonucleic acid vaccine or messenger RNA vaccine is a type of vaccine that uses a copy of a natural molecule called messenger RNA to produce an immune response. The vaccine transfects molecules of synthetic RNA into immunity cells.
An inactivated vaccine is a vaccine consisting of virus particles, bacteria, or other pathogens that have been grown in culture and then lose disease-producing capacity. In contrast, live vaccines use pathogens that are still alive. Pathogens for inactivated vaccines are grown under controlled conditions and are killed as a means to reduce infectivity and thus prevent infection from the vaccine. The virus is killed using a method such as heat or formaldehyde.
mRNA vaccines are a new type of vaccine to protect against infectious diseases. COVID-19 mRNA vaccines are given in the upper arm muscle.  the cell displays the protein piece on its surface. Our immune systems recognize that the protein doesn't belong there and begin building an immune response and making antibodies, like what happens in natural infection against COVID-19.
They do not affect or interact with our DNA in any way.
mRNA never enters the nucleus of the cell, which is where our DNA (genetic material) is kept.
For more info - mRNA and Inactivated (Killed Vaccine)
Comment: The mRNA vaccine doesn't transfect (much) into the immune cells directly, most is apparently into the muscle and vascular and lymphatic cells at the site of injection, then some transported around the body, ending up in the liver largely. Your later description is closer. You also have the links for mRNA and inactivated swapped.
Comment: Your description of inactivated vaccines is partially confused with a description of live attenuated vaccines. Both of the vaccine type descriptions are missing key elements such as how they generate an immune response, and advantages and disadvantages of each.


"Who does go…" vs "Who goes…"

Question:
Who does go there now-a-days?

Who goes there now-a-days?

My book said sentence 1 is incorrect while sentence 2 is correct, can anyone please explain this?
Answer:
Who does go there now-a-days?
Who goes there now-a-days?

Both are grammatically correct. The important thing to know is where the emphasis occurs.
When "does" is used in this way it is invariably strongly emphasised. This doesn't always show in print but it very often does.
My version for explanation: Who DOES go there nowadays? (This is intended to show the strength of the emphasis).
How you may see it in print: Who does go there nowadays? (again this indicates emphasis)

This i known as a rhetorical question, that is to say one to which an answer is not expected.
Examples
1.
Q: Who goes to the youth club nowadays?  (a request for information)
A: Well, I go and so do John and Mary. There are usually about ten people on most nights.
2.
A: I went to the club last night. There was hardly anyone there.
B: Who does go to the club nowadays - it's so boring!  (rhetorical question that also indicates sarcasm)
Answer: (I think the term for this is an intransive verb, but I am not an academic English learner, so don't take my word for that—I'm sure others' comments will confirm.)
From a speaker's (as opposed to a learner's) perspective, you wouldn't say "I do going to the cinema"[1], to describe an activity that you do regularly; you say "I go to the cinema".  In that same way, in normal speech, you wouldn't say "Who does go there?".
Note that I say in normal speech.  Confusingly, there are occasions where it is appropriate to say "Who does go there?"—particularly in casual speech, but these are usually when the speaker is emphasising/reinforcing something that is obvious/commonplace to the them, that should also be obvious/commonplace to the person they are speaking to.
Consider a conversation between Alice and Bob:

Alice: I don't go to the cinema, any more.
Bob: Who does go there now-a-days?

Alice is simply telling Bob that she no longer goes to the cinema.  Bob is agreeing with Alice and reinforcing this by suggesting that no-one goes to the cinema any more (at least, in Bob's mind).  Note that Bob is not saying this literally, he is just stating his opinion that it is no longer seems to be a common activity.

[1] In far more casual conversation, someone might say "I do going to the cinema" but, for that person, going to the cinema is probably their favourite hobby, and they are deliberately subverting the common convention to imply how seriously they take it (i.e. very).
Comment: You don't say "I do going", but you can say "I do go" when you want to emphasise it or to contradict someone.  That is analogous to the use of "who does go?".
Comment: Here "does" is an intensifier; "intransitive" is something entirely different.

"Who does go…" vs "Who goes…"


Is there any book for practically teaching one to interpret market situations?

Question: For example, if swap rates go higher, what exactly the market participants are doing or expecting? Is there a book which can teach us about these practical knowledge / experience? Thanks.
Answer: "Market situations" is a very broad topic and you will find an enormous amount of literature but I do not personally know of any single book that would cover most of those in a satisfying way. One common way to look at it is either by asset class (e.g. equities, credits, fx, fixed income, commodities, etc.) or instrument types (stocks, derivatives, bonds, repos, structured products, etc).
Depending on the level of depth you want to achieve, this may not even suffice as a healthy dose of micro and macro-economics are helpful to understand most "market situations". For example, an increase in swap rates may be due to an expectation that rates will rise due to inflation and again, the expectation of higher inflation may be due to various other factors.
Answer: I have limited experience, but you need a proper context to interpret what is happening in the market. To that end reading the newspapers and blogs might be better than a book. I of course assume that you understand the mechanics of the products that you are looking at. For example, how does interest rates change option prices.


Direction of gravity

Question: General Relativity explains the path a falling body makes (ex. An apple falling toward the center of the Earth) as a geodesic in curved spacetime. What explains the direction the apple falls? In other words: why doesn't the apple follow the same geodesic away from the Earth? What provides the kinetic energy in the "downward" direction?
Answer:
For a given timelike geodesic that would be the direction that points into the future light-cone in spacetime.
The geodesic itself depends (besides on the geodesic equation) on conditions, such as e.g., initial conditions or boundary conditions.
Comment: This answer seems incomplete, since when I toss an apple upward it also follows a timelike geodesic into the forward light-cone, but one that for awhile heads away from the Earth. Am I missing something?
Comment: I updated the answer.
Comment: Could the direction of travel along the geodesic be determined by Entropy (i.e. The Second Law of thermodynamics)? Or do we need a theory of quantum gravity to provide gravitrons to explain why gravity is attractive and not repulsive?

Direction of gravity


How do you capture programs/scripts that run and quickly disappear in Windows 10?

Question: I have noticed that a CMD script seems to randomly run while doing things but cannot seem to capture what or where it's coming from. Is there a way to use some sort of logging app to see what comes and goes in terms of apps and scripts?
Comment: While reverse engineering "back in the day" I replaced cmd.exe with my own cmd.exe I wrote.  after logging whatever I wanted, I then called the REAL cmd.exe with the same arguments.  This should work for just about anything to include powershell.  Windows will complain about the file and you might need to change some permissions but it should still work.. if you can program or know someone who does this is easy-peasy.
Answer: You could start a screen capture with a program like Open Broadcaster Studio, or many other alternatives. In OBS, add a new scene, and add a DisplayCapture source, and start recording. The screen capture video file will be saved to your user videos folder by default. If you see the popup, stop recording and review your footage. The running program should be in the title bar of the CMD window.
You could review your Resource Manager and look for disk usage by applications, which can help you see which apps are currently changing files.
There could possibly be something logged in Event Viewer.
Answer: I'd look closely at task scheduler & services. I used to like looking at msconfig, services tab, & checking 'hide system services' so you only see services that were installed from programs or drivers that aren't part of windows. Not sure if you can with Win10 now since i know it points you to services. Try to narrow down when it's happening: every 10min, every time you open a new chrome tab, etc.


Views pager labels translation per context

Question: Now that I finally have managed to have Views pagers appear, I'm wondering how I could change the strings collection (prev, next, first, last...) per View. That's because in a View that displays items in chronological manner, I would rather see labels like older/newer rather than previous/next. Can this be done somewhere in views template or in template.php? (No jquery here, please :))
Answer: Use hook_pager() in your theme template.
function YOUR_THEME_pager($tags) {
  echo "
";
  var_dump($tags);
  echo "
";
}


Use of subject again after "and" is more natural or not?

Question: Example:
"I like reading books and love to swim"
or
"I like reading books and I love to swim"
Comment: The sentence is lacking *paralellism*. Since you use *gerund* at the first clause, you must use gerund for the second clause too. *love swimming*. Idk much about a sentence idiomaticality, but I would omit *I* after *and*
Comment: Omitting the subject "I" in the second coordinate is okay, but I'd be inclined to retain it..
Answer: Short answer: Both are natural.
Long answer: Repeating the subject usually means there is something you want to emphasize.
For example, "I like reading and I love to swim,"

...lets the listener feel like you are a person of many interests and hobbies,

...whereas "I like reading and I love to swim,"

...lets the listener know that you have these two hobbies, but you care for the latter more passionately.

Does this help?
Comment: you wrote the same sentences
Answer: Both forms are grammatical and idiomatic. In short clauses, omitting repetitions of the subject leads to a clause that is both concise and easily understood. However, in lengthy clauses, where verbs are separated by one or more phrases or subordinate clauses, omitting repetitions of the subject may lead to a clause that is very hard to interpret. So, as general rule of style that undoubtedly has exceptions, I'd tend to omit repeatitions of the subject for verbs that are close together, but repeat the subject for verbs that are separated by multiple phrases or any subordinate clause.


What's the best way to explain what the options in a drop down menu mean?

Question: Please see image below. The drop down I'm struggling with is the "permission level" drop down. Users won't be immediately familiar with what the different permission levels mean. In the screenshot, I've included the description of the level within the drop-down menu, but am wondering if there's a better way? I played with radio buttons but that made it more difficult to read horizontally - it made it harder to immediately see what permission level is associated to each school. Another thing to note is that the options within "permission level" can vary based on the school that's selected (3 options are the maximum).
Any help would me much appreciated!
Comment: Your solution is reasonable: having descriptions users will pick correct level easily. Still pay attention of how the descriptions are formulated. It's better to use terms and concepts which are used by school, as they are familiar to users. Also +Add Permissions button looks confusing. Did you mean Add School?
Comment: For just three levels, I'd probably use radio button (or nicer equivalent), with heading and short descriptive text below. Lowest level pre-selected. No need to make it complex and a drop-down seems overkill. As always, IMHO, YMMV, etc.
Answer: Your approach seems fine to me. I'd just be a little more detailed and make sure what each level can and cannot do is amply clear. Something like this:

These could be visual indicators of each level, too (probably an icon?). Sorry about the typos in that mockup! :)


Interaction between side chain and main ethereum

Question: To reduce gas fee and improve scalability, I want to have a side chain. But I still want to leverage main chain for buying/exchange tokens. Any suggestions? Are there any similar projects which have done this?
Answer: Check out Plasma.
With Plasma, you can run a child chain (which is a set of smart contracts), and commit the root hash of the child chain to the main chain. The child chain behaves like a state channel (sort of like keeping a tab open at the bar) and only the final state transition hash is committed.
The interactions between two parties via the child chain are instantaneous since all they're doing is transferring signatures of state transitions.
If any participant suspects that another participant has acted maliciously then they can submit a fraud proof to the main chain, which is acting like a court system, and the malicious actor can be penalized while also reversing faulty state transitions.
Plasma chains may also have any number of other plasma child chains, creating trees which can be reduced to a single hash.
Answer: To achieve your goal of reducing cost you need to look the direction of state channels you should checkout http://www.raiden.network.
Answer: You should check out Plasma which is similar to side chains. I know OmiseGo are experimenting with implementing a Plasma chain. See their Roadmap here. Also Bankex have a basic implementation and description here.


LISP Programming - function that calculates the nodes of a tree

Question: I have recently started learning lisp and completed some simple exercises that are available to me, unfortunately I have got stuck & after spending hours it seems I don't seem to be getting any closer to a decent solution.
I am trying to produce a function which takes the expression 'tree' as its argument and returns the tree with the relevant calculated values in place of the operators.
An example of what a tree could look like is: (* (+ 10 (* 4 9)) (- 6 10))
And the function should return: (-184 (46 10 (36 4 9)) (-4 6 10))
I have tried all sorts but nothing works as it should. I have created something which works but is really bad in terms of coding style, I really am lost here.
(defun evalTree (node &optional n)
  (when node
    (rplaca node (eval node))
    (setq n (first (rest node)))
    (rplaca n (eval n))
    (setq n (first (rest (rest node))))
    (rplaca n (eval n))
    (setq n (first (rest (rest (first (rest node))))))
    (rplaca n (eval n)))
  (format t "node=~a n=~a~%" node n)
  node)

I think my solution should be using the apply function or the eval function but im just not sure of how to use them on trees properly.
Answer: (defun eval-tree (tree)
  (flet ((arg (a)
           (if (atom a) a (first a))))
    (if (atom tree)
        tree
      (destructuring-bind (op a b)
          tree
        (let ((a1 (eval-tree a))
              (b1 (eval-tree b)))
          (list (funcall op (arg a1) (arg b1)) a1 b1))))))

Comment: Thanks for the solution, im not quite sure how exactly it works but I will read up on the functions you used and hopefully I will learn from it. Thanks again.


Strichartz estimates for the heat equation

Question: Consider the heat flow $e^{t\Delta}$, $t>0$, on an Euclidean domain (say $\mathbb{R}^3$). I expect, in analogy with the Strichartz estimates for the Schrodinger equation, that the following estimates hold:
$$\Vert e^{t\Delta}f\Vert_{L^s(\mathbb{R}^+,L^p(\mathbb{R}^3))}\lesssim \Vert f\Vert_{L^2(\mathbb{R}^3)},$$
where $(s,p)$ is a Strichartz pair. Is this fact actually true? In such a case, there exists a reference where it is stated explicitly?
Answer: Sure. Actually you have in addition the maximum principle (i.e. an $L^\infty$--$L^\infty$ estimate) which combined with the others gives a full triangle of indices for the Strichartz type estimates in your question. Even more, the strong decay of the symbol $e^{-t|\xi|^2}$ can be exploited for some gains in regularity. A short account is in the book by Wang, Huo, Hao, Guo "Harmonic analysis method for nonlinear evolution equations" (around p.35) link
Comment: Thank you very much Piero! I have another doubt: is it also true that $e^{t\Delta}$ maps continuosly $L^{\infty}((0,T),L^2(\mathbb{R}^3))$ into $L^{s}((0,T),L^p(\mathbb{R}^3))$? For the Schrodinger flow it should not be true, but maybe it works in the heat case.
Comment: You mean the non homogeneous equation $u_t-\Delta u=F$? you certainly can apply non homogeneous Strichartz estimates, so $u$ in $L^pL^q$ is estimated by $F$ in $L^1L^2$. For bounded intervals this is controlled by $L^\infty L^2$.
Comment: I understand the non homogeneous case, thank you. However i'm wonder if also the bound $\Vert e^{t\Delta}F(t,\cdot)\Vert_{L^sL^p}\lesssim \Vert F \Vert_{L^{\infty}L^2}$ is true, at least for finite time intervals and for $F\in\mathcal{C}(\mathbb{R}^+,L^2)$.
Comment: That's what I said. Inhomogeneous Strichartz takes you to $L^1L^2$ which is estimated by $L^\infty L^2$. But of course the constant in this inequality is unbounded as $T\to \infty$ (it is exactly $T$)


How does the Casascius project make money?

Question: How does the Casascius business model work? Can someone explain it to me?
Answer: If you're asking about the Casascius Physical Bitcoins business operated by Mike Caldwell, the simple answer: it doesn't, as it has been defunct since 2013. See the bitcoin wiki page.
The coins he produced were sold at a markup over the included BTC amount.
Comment: @RedGrittyBrick defunct because gov said stop, not because of bad business, afaiu
Comment: It's also just a bad business in general, there's 100% absolute trust that whoever is making the "coins" doesn't retain the private key for themselves. It sort of worked when the community was tiny, but it definitely shouldn't today. Nobody should be buying and trading those coins believing that they have any value other than the metal they are made from.
Comment: do you know how much?
Comment: @Tiago: an amount that was simultaneously too much for many buyers and too little to run a business on?
Comment: @chytrik, I'd forgotten that. I guess Mike Caldwell didn't want the hassle of registering as a money services business and getting state licences. He felt he was selling collectibles rather than transmitting money. So his collectibles business was profitable. Apparently he was also concerned that at around $1000 per coin (inc 1 BTC) his cost of inventory and theft risk was getting too high.


If I buy Call of Duty: World at War, does it come with custom Zombies?

Question: I got $20 for Easter and I was wondering if Call of Duty: World at War automatically came with custom zombies, or do I have to buy the custom Zombies?
Comment: What do you mean by "custom" zombies?
Comment: likes maps that other people make and you can download them and put it into the game.
Answer: You do not get any custom zombie maps no, however you CAN download them and put them into your game. If I recall correctly as well there are 2 zombie skins that were available in the game itself if you had a certain purchase.
However if you want the entire zombie experience*and you have the money) you will have to buy the Zombie package which costs about 170$ it includes all the zombie stuff from all the CoD games that had zombie modes black ops, World at war etc...
If you want to get the custom zombie maps here https://steamcommunity.com/groups/Imlikingmyzombies
This should give you a head start. Hope that helps :)
Comment: You have access to the zombie mode yes... However you're starting to confuse me with your "custom zombies" according to the response you gave the comment on your question, by "custom zombies" you most likey mean custom zombie maps. And like I said in my post you don't get them included no. Some may be downloadable in game however I can't confirm that as the game is quite old now. However you can downloaded outside sources and get those custom maps if you want more. (Link posted in my answer?)
Comment: But if I just buy the game on steam for 20$ can I still play custom zombies?


NM wire melted in attic

Question: Installed 2 years ago, 12/2 NM on a 9 pack bank of high bay t5's at 216 watts each. Started tripping breaker (after it melted) and found wire melted in attic under 2 ft of insulation. (This was new construction) Between rafters, 2 ft from any other wire etc, it was three way switch and this wire was the switch leg. After looking around also found that traveler was burned but not shorted yet. Replaced all of this and turned on, my meter reads 18 amps which is a little higher then it should be but well in the realm of safety factor. This is the only thing on this circuit, 20 amp breaker. Can't believe it happened and also can't believe it didn't burn the place down. Any theories? Thanks.
Comment: Uh oh.  Was this a continuous stretch of wire that had this meltdown?  Can you provide photos of the damaged cable?  Also, can you get a thermocouple or three on the cable while pulling full load through it, or an IR shot of the ceiling from below even?  (Trying to get an idea of the temps the cable's hitting here.)
Comment: Was the cable buried in insulation?
Comment: He didn't say gfi.  He said AFCI.  Totally different thing.
Comment: If I were you I'd buy an AFCI breaker for this circuit pronto. If it happens again, the AFCI can hopefully prevent a fire.
Comment: cable was buried in 2 ft of blown fiberglass insulation, gfi is a great idea, not sure how I'd do thermocouples or ir shot. Don't have that kind of equipment
Answer: They sell  "850 watt" power supplies for gaming PCs.  When you look at the power supply sticker (we're talking the responsibly built, UL listed ones), they indicate 10A / 1200VA.  How much power do you need to provision to such a machine? 1200VA, not 850VA.  The difference is conversion losses inside the power supply (which is why power supplies have fans), including power factor.
So I'm a little skeptical of where this "216 watt" figure came from.  It is precisely a multiple of both 6 and 4, and "36 watt" and "54 watt" are standard ratings for fluorescent tubes.  However, extrapolating from nominal tube spec totally disregards:

over-unity ballast factor (meaning the ballast drives the lamp harder than its nominal spec)
internal ballast inefficiencies and conversion losses
power factor of the ballast (VA vs watts; you must provision VA).

I also don't put a lot of weight on your 18A (2A per fixture?  Exactly?) number.  I would be happier if you obtained a Kill-a-Watt meter and plugged one of the fixtures into it, and see how it actually performs at operating temperature.  Look at amps, and VA.  (Watts is useless).
I think you will find you have significantly oversubscribed this circuit.
The cable being under a carpet of insulation isn't helping either, but I'm not an expert on Romex installation rules, so I leave that to others.
Continuous loads must be derated to 125%
Lighting is a continuous load.  So it must be derated: you must provision 125% of the VA that the lighting actually requires: NEC 215.2a1.
Another way of looking at this is, if all the loads on a circuit are continuous loads, a circuit can only support 80% of breaker rating.  So a 20A circuit is good for 16A only.  (16A * 125% = 20A).
Even with your perfect 216W number, your 9 lights would draw 16.2 amps (they don't) and that's a tick over limits.  In actuality I think you will find your lights are even more than 2.00 amps each, so over 18A requiring you provision over 22.5 amps of power to the circuit.   Upsizing to 10AWG wire would reduce your wire overheat, but you would not be allowed to upsize the breaker to 30A, because you are not allowed to put NEMA 5-15 or 5-20 receptacles on a 30A circuit (table 210.21B3).
Break it into 2 circuits
The most straightforward solution here is peel off 3-4 of these lights onto a separate circuit.  And, you know, if you want to be able to switch some of the lights separately from the others, this is a great time to do that.
Or... switch to 240V
Pull down a light and read the labeling carefully.  Given these T5 lights are super popular in Europe, and given trends in the lighting industry to make multi-voltage ballasts that work on 100, 120, 208, 240 and 277 volts, chances are these luminaires are already capable of running at 240V.
So convert the circuit to 240V. The switches won't care. The lamps won't care.

The plugs and sockets must be changed from NEMA 5-15 to NEMA 6-15 or 6-20.  (they look practically the same and use the same cover plates).
The lighting circuit must be punched down onto a 240V breaker
White wires in conduit must be replaced with colored wires.
White wires in cables must be taped black or any color at both ends.

What will this do to wire heating?  It will cut current in half, which will cut voltage drop in half, which will reduce wire heating by 3/4.   it's a very good deal that should solve your overheat problem.  As long as you don't add even more lighting or other loads.
Comment: While the suggestion to move the circuit to 240V is technically sound provided the OP's ballasts are multi-voltage -- how would you address the AHJ invoking 210.6(A) to put the kibosh on it? (Not that the rule makes a lick of sense for fluorescent luminaires anyway -- the actual luminaire terminals are buried in the wiring housing where you have to take the fixture apart to get to them, and the quasi-pokable bits on the tombstones are going to be at well over 120VAC RMS between them no matter what voltage is going into the luminaire, no?)
Comment: @ThreePhaseEel My argument is OP is not in a dwelling unit or hotel room.   210.6(C)(1) applies (fluorescent=discharge).  I do not see any conceivable use for 194,400 lumens in a dwelling unit, except for cases where 210.6A would not be high on your list of problems if the gub'mint came round :)
Answer: This sounds like a very close call!
Did you inspect and test the insulation of the other wiring in the attic?  The wires up to the switch loop were under the same load in the same attic...  I'd probably be replacing it all.
Converting to LEDs would reduce the load on the circuit, reducing the heating of the wire, and also may reduce the heat from below raising the ambient temperature.  This would get you down to a 15A breaker.
You probably have to derate very carefully here.  Let's say the ambient temperature around the cable gets as high as 80*C / 176*F.  The derating multiplier is .41 for 90*C wire.  You'd actually need 10AWG NM for a 15A breaker.  But after this incident I'd be wary and might run MC just in case.
(To really know how you have to derate, you'd have to meausre the ambient temperature carefully on a worst case hot day, but realistically it's probably better to just aim high to be safe.)
However if the temperatures are not that high, maybe there was some other cause for the problem.
Did you know there are heat detectors you can buy for attics?  They go off at 200*F or something like that.
A thermostatically controlled attic fan might be a good idea if the temperatures up there are that high, not just for the wiring.  Run oversized MC for it :)
(edited as I reconsidered a few points...)
Comment: Changing to LED won't be that helpful. Those T5s are highly efficient already.

NM wire melted in attic