Can you sue a company for civil damages if fired without just cause?

Question: Can you sue a company for civil damages if fired without just cause? Let's say that a company fires me because the CEO doesn't like me. In what situation would I be able to sue a company for firing me like that? Is there any criteria for determining if I can sue the company and win?
Comment: Do you mean, anywhere in the world? Not every country or state has the same laws.
Comment: Labour laws vary massively in how much rights are given towards the employer and employee in regards to terminations, we need a specific jurisdiction to answer this with any amount of certainty
Comment: IANAL, so only a comment. In Poland that would be a clear violation of labor law, and would be judged under it, presumably including lost wages and damages. I doubt you could pursue the case further under civil law, unless there are extra circumstances.
Answer: In California, according to the UNRUH Civil Rights Act, per Civ. Code § 51 (a), et seq., inter alia, the following protected grounds apply:

"(b) All persons within the jurisdiction of this state are free and equal, and no matter what their sex, race, color, religion, ancestry, national origin, disability, medical condition, genetic information, marital status, sexual orientation, citizenship, primary language, or immigration status are entitled to the full and equal accommodations, advantages, facilities, privileges, or services in all business establishments of every kind whatsoever."
I believe if the "CEO doesn't like [you]" on any of these grounds, you would have a FEHA claim, and you would be entitled to a civil penalty of

Pursuant to Cal. Gov. Code. § 12940,

"It is an unlawful employment practice, unless based upon a bona fide occupational qualification, or, except where based upon applicable security regulations established by the United States or the State of California:
(a) For an employer, because of the race, religious creed, color, national origin, ancestry, physical disability, mental disability, medical condition, genetic information, marital status, sex, gender, gender identity, gender expression, age, sexual orientation, or veteran or military status of any person, to refuse to hire or employ the person or to refuse to select the person for a training program leading to employment, or to bar or to discharge the person from employment or from a training program leading to employment, or to discriminate against the person in compensation or in terms, conditions, or privileges of employment.

Retaliation is a major one also, but I couldn't formulate an educated guess on those matters.
This is in no way comprehensive just my first glimpse and vague recollection; I hope someone will be able to provide a more thorough and in-depth recital of law applicable in California maybe with case laws as well.
(I don't believe in unconditional love or unconditional hate; they arise from attributes of a person, and they typically don't arise from someone liking grey shirts over blue shirts.)


Normality, Ordinary Least Squares (OLS) and Geographically Weighted Regression (GWR)

Question: Most of the publications I have reviewed, conduct both OLS and GWR for comparison, and prior to analysis, ensure dependent and explanatory variables are normally distributed. Can someone explain why this is necessary for GWR? Are both OLS and GWR parametric? Is there a non-parametric version of GWR?
Answer: No, GWR is a frequentist, linear method but there is flexibility in how you define the distributional form of the model (ie., Poisson, Binomial, Gaussian). The GWR is a local regression that emphases 2nd order variation whereas OLS is a first order model. The general motivation in running both is to draw inference about first (global) and second (local) order process but, more directly GWR is specified to account for nonstationarity.
As far a normality, heteroscedasticity is impossible to evaluate in a local regression and as such is effectively ignored. However, this is important in the OLS.
Please note that GWR is a very suspect method and unless you have very strong nonstationarity in your data I would highly recommend abandoning its application. Besides, in the absence of nonstationarity, there is really no justification for the specification of a local regression. In the absence of second-order variation GWR will likely just overfit the data.
An OLS can often be robust to weak first-order spatial autocorrelation and should provide a reasonable model. If not your next step should not be GWR but a model, such as mixed effects models or spatial autoregressive model, where a spatial term can be explicitly defined.
Comment: I have data that clusters, now I want to try and explain some of the clustering using explanatory variables - hence GWR. I got stuck when reviewing publications, which comment on transforming their data to be normal before OLS and GWR application. Thus I wanted to know if a) I should bother with an OLS model, given that I have local clustering, and 2) if I need to normalize my variables for GWR.
Comment: It is unlikely that GWR will describe a clustering process. Perhaps you should explore point process models which directly incorporate the intensity (density) funciton of the data into the model.
Comment: The clusters are not based on density. Basically there is regional variation among E. coli rates in private wells in a given study area. I will see if variables such as well depth, casing type etc explain the contamination. Hence GWR for localized regression since I cannot use OLS because I know my dependent variable clusters.
Comment: And what I mean by "not based on density" is that, SatScan was used to obtain the clusters, which does not cluster based on density.


bcp sql command connection error

Question: Hello there please excuse my bad English also its the first time to ask about something over here .
i use this query to get specific table values and record them into text file
use SRO_VT_SHARD_Tito
EXEC xp_cmdshell 'bcp "SELECT * FROM SRO_VT_SHARD_Tito.._RefShopGoods " queryout "C:\Users\Administrator\Desktop\Server Files\SMC\Patch_Internal\media\server_dep\silkroad\textdata\refshopgoods.txt" -T -c -w'

but i get an error and i dont know whats wrong or i dont know how to solve it

Error = [Microsoft][SQL Server Native Client 10.0] A network-related
  or instance-specific error has occurred while establishing a
  connection to SQL Server. Server is not found or not accessible. Check
  if instance name is correct and  if SQL Server is configured to allow
  remote connections. For more information see SQL Server Books Online.

i already allowed the tcp/ip connection for sql server .
Answer: It looks like you have not specified the server instance name in the bcp command.
Should be:
bcp "SELECT * FROM SRO_VT_SHARD_Tito.._RefShopGoods "
queryout "C:\...\refshopgoods.txt" -S [SERVERNAME] -T -c -w'

Check this link for more details on bcp utility.

bcp sql command connection error


if using cbc+hmac dealing with small size of data(less than 128bit) , will it cause any problem?

Question: if use AES-cbc,HMAC-SHA256, and there is some txt needed to be enc, and I divide this txt into small packages with variable length, then enc them. some of these package can be less than 128bit. Is this still secure? will it cause any problem?
Answer: If the MAC'ing is done right (after the encryption) and if you pad the CBC data correctly there's no security risk. Howver changing to CTR or even better to GCM would be better, as both don't operate on whole blocks and GCM even provides authentication.


What's the minimum transaction with monero?

Question: What's the minimum transaction with monero. Can I send for example $0.01 in XMR to another person?
Answer: You can send someone as little as 1 piconero (0.000000000001 XMR). In this case, the tx fee you'll pay will of course be more than your recipient amount.
So,

What's the minimum transaction with monero?

The minimum output amount is 1 piconero and the minimum total tx amount is that plus the minimum tx fee (paid to miners to include the tx in a block).

Can I send for example $0.01 in XMR to another person?

Yes.
Comment: What's the minimum amount of Monero that will result in the tx fee being the same as the money being spent?


Does Linux Mint have Windows-like dead keys?

Question: I'm from the Netherlands, using Windows' Dutch US-International keyboard layout, where a fair few characters use dead keys (éèëê, times five for every vowel). On Windows, typing an apostrophe with a lowercase r puts 'r; however, typing the same sequence with the US-International keyboard with dead keys in Mint gives me ŕ. This happens for a lot of characters and it's quite annoying when you don't expect it. Is there a keyboard layout that behaves exactly like the Windows keyboard I'm used to? It could be either native or an installable package, I don't really mind.
Answer: What you're describing is known as a prefix input method.  Most Linux IME's have support for these to some degree (I use one that works the opposite way, adding the accent after the letter it applies to, on a regular basis).  I'm not sure what IME Linux Mint uses by default, but most of them provide support for an input method with a name like m17n-latin-pre or latin-pre, which will behave in a manner similar to what you're used to coming from Windows, though it recognizes a lot of accent combinations that are not used in Dutch as well.
There are also keyboard layouts which behave similarly, but at least some of them instead require the use of a 'compose' key which indicates that the characters typed while it is held should be combined.
Answer: There are myriad keyboard layout options available, some of which are dead-key-centric, and some of which use Vulcan Nerve Pinches for accented characters.  And, of course, Linux being Linux, you can also design a keyboard layout that works perfectly for your particular preference.


Uploading photos to linux server via php - what is the max number of files a folder can have?

Question: I'm creating an site which allows users to upload photos. It's a linux server.
I was wondering what would be the best directory structure to to save these images? And is there a limit of number of files a folder can have?
Would it be better to save every photo uploaded by every user to one single folder and have a reference of each in the database. Or create a folder for each user and have all of their photos in it?
Comment: You don't want to try and hit the limits, file lookup will get very slow long before that.  I'd suggest putting them in a tree of folders.  Have a look at this question, it's pretty much a duplicate: http://stackoverflow.com/questions/446358/storing-a-large-number-of-images , and this is relevant too: http://stackoverflow.com/questions/466521/how-many-files-in-a-directory-is-too-many
Answer: @OP, there a few ways that a directory can have so called "limits". One is if disk quota is set. The other depends on filesystem. For example in this article, it says ext3 has
There is a limit of 31998 sub-directories per one directory, stemming from its limit of 32000 links per inode.
You can find these information for other file systems with further searching. eg ReiserFS can handle up to 2^31 per directory and so on...
Answer: There is probably no limit on files, but depending on the filesystem, you want to limit the number of files in a directory to between 1,000 and 10,000. If you have a filesystem that doesn't index directories, even having 1,000 files is going to make file operations slow.
If your filesystem does index directories, you could easily have 100,000 files in one, but you wouldn't want to. Doing an ls -l on a directory with even 1k files is going to be slow; you would probably give up before it even started outputting on a directory with 100k files.
If there aren't going to be too many users, having a single directory per user is a good idea. If there are going to be lots of users (over 1k), I would recommend storing the files in directories of up to 1k files each before creating a new directory.
Answer: The only limit to the number of files a directory can hold in linux in the number of free inodes.  You can determine this figure by executing:
df -i

The figure reported as IFree is the upper bound on the number of files you can hold in a directory, but be aware that this figure is for the whole filesystem.  So if you put the maximum number of files in one directory, you will not be able to create any more files anywhere else in the filesystem.
A directory for each user would be the way to go


Tools for analog signal design/modeling

Question: What are some good tools which will simplify the process of designing and modeling analog signals? I am currently using Mathematica for modeling signal behavior, but that requires me to define a new model for every new piece of functionality (e.g. a low-pass filter). Are there any tools that could help me out?
Comment: [SPICE](http://en.wikipedia.org/wiki/SPICE)
Comment: SPICE is not a design tool, and to use it as such is a Bad Habit™. You use simulation to *verify* your design, not to create it. If you use SPICE for design there's the risk that you start with something that only works half, and keep tweaking until it works. It's not unlikely that you don't know *why* it works.
Comment: SPICE seems the obvious choice, but if you are looking for a more mathematically based tool, then maybe try Scilab with it's Xcos plugin.
Answer: SPICE (or any derivative of it) would be the best choice if you are doing circuit simulation as part of the process, also take a look at MATLAB with Simulink.
MATLAB might also have a few toolboxes that are helpful for your needs, e.g. Filter Design (but more aimed at digital filters) and the Signal Processing toolbox.
Answer: Does CircuitLab have the functionality you need?  You can use voltages from ground to model analog signals.  We've got arbitrary Laplace transform blocks to handle your linear filter needs, and furthermore we have arbitrary behavioral sources if you want to apply nonlinearities anywhere in your signal chain.  Piecewise-linear and step functions for inputs, plus time domain and frequency domain analysis modes.
Take a look at
this circuit for a closed-loop multi-domain simulation, including a thermal model (modeled as R and Cs) plus a controller with nonlinearities:

If not, let us know what features you'd need!

Tools for analog signal design/modeling


Laravel storage link in shared hosting

Question: im having problem with setting up storage link on shared hosting.
Because of that I can't upload any image to storage folder in shared hosting
Comment: your best option would be to use `file_put_contents()` to store image in your public directory.
Answer: Just create a route and access it once.
Route::get('generate', function (){
    \Illuminate\Support\Facades\Artisan::call('storage:link');
    echo 'ok';
});

Comment: Thanks @Adrian you're a life saver
Comment: Where do I put this? In `web.php`? I've done that but it doesn't seem to work.
Comment: yes, in routes/web.php. place it there then access the route /generate, you should see 'ok'. if it's not working there is other problem..
Answer:
Remove storage folder in public_html/public/storage if you perfomed storage:link in local

then Create a php file for example mysymlink.php in public_html folder

Add below code to mysymlink.php file

<?php
$targetFolder = $_SERVER['DOCUMENT_ROOT'].'/storage/app/public';
$linkFolder = $_SERVER['DOCUMENT_ROOT'].'/public/storage';
symlink($targetFolder,$linkFolder);
echo 'Symlink completed';

Go to web site example.com/mysymlink.php
Answer: Using Laravel in shared hosting environment probably not the best decision. Some many good options are now available for the same price and you just need to put a bit of effort to understand how to work with them, even if you have no prior experience. You can use DigitalOcean, Linode, Vultr or many more and it will save you a ton of time.
In case you for some reason still want to use shared hosting and to actually answer your question you can

Investigate  to set a right symlink (This possibility nowadays exist almost everywhere) it should be something like ln -s /home/user/laravel/storage/app/public /home/user/public_html/storage. Of course it should by your path which can be different depending of your hosting structure, you should be able to figure out it yourself.
Try to implement in some workaround way. For example you can try to put files from storage to storage/app/public folder manually (you even can latter automate it by using some script). But workarounds product new workarounds, better not do it hard and wrong way but instead use simple and right even if it seems hard for you at first glance.
Answer: Instead of using Storage facade, you can use custom method to upload file to your public directory
if($request->has('image')){
        $img = $request->file('image');
        $ext = $img->getClientOriginalExtension();
        $name = time().'.'.$ext;
        $path = public_path('\img\uploads');
        $img->move($path, $name);
        User::where('id', $user->id)->update([
            'image' => $name
        ]);
    }

Comment: **-You can solve it in another way to create a symlinkexample.php file into your public folder and run the file path into browser.**
**-Then Storage folder will be created into public folder. Folder path will be public/storage with linked to your public folder.**
----------------------------------------------------------------------------
_**Example**_

``

Laravel storage link in shared hosting


Custom panels-pane tpl based on some identifier

Question: Is it possible to create a pane template based on some kind of identifier? Just Like you can create a page--node--123.tpl.php file to render a different page for a node with nid 123, i'd like to make a panels-pane--pid--123.tpl.php to render a specific pane with pid 123 I have tried looking on google but i have found nothing about this possibility.
Answer: After a lot of working around & trial & error methods, I got this.

Copy your "panels-pane.tpl.php" in your current theme's template directory.
include dpm($pane); in a php tag. This will give u the list of all the panes on ur current panel page.
Note down the pid ($pane->pid) here.

If you are looking for a particular page the unqiue identifier for that whole page would be did ($pane->did) which is the display id.
Basically, every panel page has a unique did (display id) & different pid (pane Id) for all the panes on that particular page.

Now in your "panels-pane.tpl.php" in the div code block with class="pane-content" you could write a php code like
<code>if($pane->pid=='some id' & $pane->did=='some id') {
//modify your pane data from the variables at $pane->configuration & store in $content.
   $content = your modified data;
   print render($content); // render this pane with my modified data
else
print render($content); // (and) render other panes as normal
}
</code>
Comment: Thanks, that's quite a dirty solution but i get the idea. It'll do
Answer: when you use the dpm($pane), you can also use the $pane->type variable to get the value of pane type & use this to create a separate template file that affects all the panes of this type only.
for example: In my scenario, i had added custom-content on pane. (Pane > Add content > Add custom content)
So i had a few of such content-panes, which i wanted to be wrapped around in different html divs for structuring.
In my case, on dpm($pane) this $pane->type value was "custom". (This could be view, block, etc, as per the pane data)
So I created "panels-pane--custom.tpl.php". This will affect all the panes of this (custom) type. Further, as my above answer, for a given panel node, I know my page's display id ($pane->did).
So use an if condition on this display-id & further you can use if / else-if / switch on $pane->pid for altering a particular pane.
<code>    if($pane->did=='some-id') {
       switch($pane->pid) {
       case 'pid1' : some code stored into $content & then - print render($content); break;
       case 'pid2' : some code stored into $content & then - print render($content); break;
       default     : print render($content);
      }
    }
</code>


Is there anyway I can recover my passphrase?

Question: I have a wallet for the bitcoin qt wallet but I accidentally deleted the only copy of my encryption passphrase... I have read about something called brute force but I'm not entirely sure on how its code is used. Can anyone help me please!? I am desperate to recover my bc!
Answer: It's rather implausible unless you remember a good deal of the password already, or you are certain that it followed a particular pattern. Even on a good processor you might only be able to try 10 variations a second, which is uselessly slow for anything in the password cracking world.
It needs to be strong, the encryption is designed keep your coins safe.
How much is at stake? Recovering them might not even be worth the time expenditure.
Answer: Using brute force you won't be able to recover your passphrase within your lifetime, but you can use vanitygen to recover it (well it won't be you who recover it, it will be your grand grand grand .... sons who will finally recover it)


Altium: How to change several components at once in order to save time and effort?

Question: I am drawing a schematic in Altium Designer. Sometimes, I need to change some components from one value to onther. For example, I have 10 capacitors of 1 pF and need to change them all to 2 pF. Is it possible to do it at once instead of change each capacitor separately.
This will of course help me to save time and effort !!
Comment: http://electronics.stackexchange.com/questions/245955/altium-automatically-fill-description-and-comment-with-values-from-parameters
Comment: SHIFT+F+L click
Answer: Learn to love "Find Similar Objects". Right-click on the object, change 'Value' from 'Any' to 'Same' and it should find all the 1pF capacitors.
It will highlight them when you click apply, and if that's right (and it should be, unless there are more than one type of 1pF capacitor, in which case you should apply some distinguishing feature) then click 'okay' to bring up the SCH inspector dialog.
You can then change the value to whatever you like, as well as change many other characteristics. The changes are applied immediately, not through the usual validate and execute.
Comment: This is the correct answer. I use "Find Similar Objects" and "SCH Inspector" all the time. It makes things MUCH easier and faster to update.
Comment: What aspects of the component do you want to change? The type? The component reference? You can change these in the SCH Inspector too (select the "Library" and specify the "Symbol Reference" to change it to a different component. You'll also want to change the Design Item ID and the Current Footprint)
Comment: @DerStrom8 Thanks, always appreciate your Altium answers. I guess you don't do contract work since there's no contact info in your profile.
Comment: Thanks for the sentiment. I do not do official contract work (I'm not sure my current job allows it) but I have been known to help out family and friends with their projects. Maybe I should look up the company policy on external contract work....
Comment: Guess that answer will only help me if I want to change the value, but if I want to change the whole component, not just the value ?!


Why do different European countries have different prime lending rates if they use the same currency?

Question: Why do different European countries like France and Netherlands have different primes when they are all on the Euro?  Shouldn't this be set by a central authority for the currency?
Answer: "Prime lending rate" refers to an average of commercial lending rates available in the market, not to an interest rate set by a central bank. Banks in different countries will have different policies and appetites for risk, leading to differing rates. All eurozone countries do of course have the same central bank interest rates, since they have the same central bank.


Can Aspergillus sp. or other fungi infect other species beside grains and legumes?

Question: I plant a peanut, lettuce, mustard greens, and spinach. After 3 weeks I noticed that my peanut have symptoms like yellow and brown dots on leaves. Several days later, the other vegetables get the same symptoms. But is it possible that the infection came from the peanut plant? Do fungi infect specific species or they can infect others?
Answer: Aaspergillus is a common mold that wouldn't have caused the issues your plants are experiencing. According to this site (look down the page for the various peanut diseases), your peanuts probably have either early or late leaf spot (Cercospora). These two diseases are nearly identical in look and effects on the plants. The good news is that they're specific to peanuts, so they won't infect your other crops. The bad news is that they can remain in the soil nearly indefinitely (see the linked site for some ideas on controlling these fungi).
As to your other question - "Do fungi infect specific species or they can infect others?" The answer is complicated. Some fungi can infect different species within the same botanical family. For example, members of the Solanaceae (this family includes eggplants, peppers, potatoes, and tomatoes) are notorious for becoming infected with the same diseases. Anthracnose can infect eggplants, peppers, and tomatoes, while Late Blight can infect all members of the Family.
In contrast, a disease called Gummy Stem Blight can infect some members of the Cucurbitaceae Family (this family includes cucumbers, squash, and melons), but won't infect members of the Solanaceae.  And in contrast to the other fungi mentioned, fusarium wilt can infect all members of the Solanaceae AND it can infect members of the Cucurbitaceae, although the species of fungus that cause the disease may be different.
As you can see, there's no one Yes/No answer to your question. This is why it is always recommended that people who grow either or both Solanaceae or Cucurbitaceae rotate their crops on a two- or three-year schedule.
Now, for some really good news! In your own situation, you already are growing plants from four different Families:

Mustard = Brassicaceae
Lettuce = Asteraceae
Peanut = Fabaceae
Spinach = Amaranthaceae

This is already preventing your garden from being completely over-run with fungal diseases, as it is very unlikely that one fungus (other than downy mildew, perhaps) will be able to infect two or more of the plants in your garden. To prevent future problems with fungal disease, I strongly recommend that you not plant the same crop in the same location more than once every three years.
Comment: Thank you for your answer. This is very comprehensive. Now I'm curious if all those plants are planted in a hydroponic/aeroponic system and get similar symptoms (yellow and brown spot, rolling leaves for mustard, browning on the edge of leaves), is it caused by viral, fungal, or bacterial infections?
Comment: I've only had limited personal experience with bacterial issues on my crops, but in every case the infected plants die within at most a week of me noticing the bacterial problems. I'm not experienced in hydroponics, but leaf curl and ooff-colored leaves are often signs of nutrient deficiencies or overload. Leaf spots are usually signs of fungal issues (especially with plants in soil).


Link Local IPv6 address keeps being automatically assigned

Question: I'm looking to prevent the IPv6 link local address from being randomly assigned. I'm not looking to disable v6 but rather statically assign my own link local. I've done ifconfig vboxnet0 inet6 add fe80::/126 and it works and I can do ping6 -I vboxnet0 fe80::1 and successfully ping my VM but then eventually I end up with 2 link local addresses or it'll delete mine and assign it's own.
Comment: Should you be using a site-local address, if you set it manually? ( https://4sysops.com/archives/ipv6-tutorial-part-6-site-local-addresses-and-link-local-addresses/ ) Also I think all IPv6 interfaces need a link-local, so leave it alone. The interface will be happy to have many addresses.
Comment: Leave the LLA alone. The LLA is constructed using the interface identifier, which cannot be modified from userland. What's wrong with the kernel-provided LLA anyway?
Comment: @richard yes they do need a link local but they have one.
Comment: Link-local addresses are _not_ randomly assigned.
Comment: @MichaelHampton yes I know they're based on MAC addresses what I was saying is it kept assigning the address at random times and either deleting mine or adding it to mine...however it was always the same address.
Comment: Virtual machines often get new random MAC addresses assigned each time they are powered on, the thing is to hard code it in the VM setup.
Answer: I think what you want to solve is the problem of your manual link local address going away.  Just put it in the startup config script:
# cat /etc/sysconfig/network-scripts/ifcfg-eth | grep IPV6ADDR
IPV6ADDR=fe80::1/64

if you already have an ipv6 entry then use the following parameter instead:
IPV6ADDR_SECONDARIES=fe80::1/64

That will make it permanent.  And I agree, its nice to have a simple to remember default gateway like fe80::1 for you entire LAN.  Its widely publicized to be a common practice.
And don't worry about the other automatically assigned Link Local Address.  It won't affect you in any way.
Comment: If you forget your gateway, you can find it easily enough with `ping6 ff02::2%interface`.
Answer: ip link set dev X addrgenmode none

(requires kernel with bc91b0f07ada553 "ipv6: addrconf: implement address generation modes", aka. 3.17+)
Answer: The IPV6 link local address is assigned based on your MAC interface, which is guaranteed to be unique.  For example: here's my mac and ll address:
HWaddr: 00:50:56:c0:00:08
inet6 addr: fe80::250:56ff:fec0:8

This is how it's formed:
HWaddr:     00:    50:56  :  c0 : 00:08
inet6 addr: fe80::250:56ff:fec0 : 00 08

So, you could change your mac address to get a different link local address, if you really really want.  So basically you would want to do the following, which I haven't tested:
/etc/init.d/networking stop
ifconfig eth0 hw ether 02:01:02:03:04:08 (or whatever you want)
/etc/init.d/networking start

And there, done.
Comment: This is not at all what the question is.  "Modern" OSes now do not assign based upon MAC address, because privacy.  The poster wants to go back to the old situation.  Hardwiring the address isn't really what they asked for.


NCache query performance issues

Question: I am evaluating NCache for usage in the ongoing project as a "read-through" cache - in order to take off load from SQL server.
At client-side, the project has a polling routine that receives items filtered (at server-side) by last polling datetime.
The polling occurs at fixed interval at separate thread.
The pseudo code for client-side
1) first time fetch:

fetch all existing items
set LastHandledDate to now

2) non-first time fetch (polling thread)

fetch existing items that were created after LastHandledDate
update LastHandledDate to now

At server-side,when the polling query is received, the following pseudo-code is executed:

query NCache for all matching items with CreationDate >= LastHandledDate
IF query results are empty

query SQL database for all matching items with CreationDate >= LastHandledDate
if query is not empty then update NCache with SQL query results
return SQL query results

ELSE return NCache query result

To query NCache I am using it's linq provider, and the query is similar to SQL query:
<code>SELECT * FROM Messages WHERE Message.SessionId = 1234 AND Message.EntryDate >= '2012-10-6'
</code>
Edit: During testing,on the client-side there is a thread that adds new items at a constant rate
The server-side part is hosted in a web-service (WCF in IIS).
After load testing the above polling setup with 100 clients for about an hour, I've noticed a steady decline in requests/sec the web-service was performing.
Running the above setup with only reads from NCache, without SQL reads at all (without paragraph 2 at server-side pseudo-code) yielded the same decline pattern in requests/sec.
I have several questions:

It seems that NCache's query performance depends on total number of objects in the cache. Is this the case in similar solutions (NoSQL / Distributed Cache)
Which NoSQL/Distributed Cache solution is optimized for querying speed?
Maybe in the NCache the querying can be somehow more optimized?
Perhaps I am missing something- and my usage pattern of distributed cache is incorrect - how can I use distributed cache such as NCache efficiently in my use case?
Answer: Try using Query Indexes for your classes.
I'm using with 100k items in cache (appr. 250kb sized each) and not having any performance issues.

NCache query performance issues


How to make homemade hamster food?

Question: I have heard that many types of hamster food sold in pet stores are either not healthy/safe for hamsters or don't provide the proper diet for hamsters. I am interested in making a homemade food mix for a Syrian hamster. Are there any recipes for hamster food that actually fulfill all of the dietary needs of a hamster? Or do I need to create my own recipe?
Comment: I assume you talk about a dry food mix? Or do you like to cook something ;) ?
Comment: @Allerleirauh I would prefer to make a dry food mix.
Answer: In nature hamsters have a variety of food to choose from. They eat almost anything that they could get: seeds, grains, herbs, fruits, vegetables, insects and also small mammals. But the winter season is an exception, as that's when they eat mostly dry food - it's because it is more easily storable.
Not a good food is all with sugar, honey or molasses. First, it is too sweet (they get fat), second it probably will glue their chops and causing caries at the rear teeth.
Most dry food mixes include colorful pellets. Read here about the risk of them for the health of your pet: What risk is given if I feed my rabbit pellets?
Following recipe is from diebrain for beginners in mixing their own food (via translation software and fast check from me from german):

Recipe for a high quality dry hamster feed:
200 g cereal mixture with spelt if possible:  Millet, barley, oats, rye are well suited.  Ready-made mixtures are available in the organic department of the supermarkets or in the health food store.
100 g bird feed / small seeds: Sugar-free budgie feed with few poppy seeds and rice are suitable.  Different types of millet and herb seeds should be included.  The herb seeds must be added to most budgie foods.
100 g multi-grain flakes or multi-grain muesli: flakes are offered, since the starch is broken down by heating and squeezing and can thus be used better.  This is especially important for older animals and growing animals.  Sugar-free mueslis with multi-grain flakes are well suited.  These usually consist of oat flakes, wheat flakes, barley flakes and rye flakes.  Rice flakes may also be included.  Sugar-free corn flakes are also allowed and popular.  Raisins or other dried fruits should only be contained in small amounts.
100 g dry vegetables: broccoli, zuccini, carrot chips, parsnips, celery cubes, beetroot cubes etc. These can be purchased as a ready mix or as individual components in pet shops.
~ 80 g insects / protein feed: There are various options here.  In the terrarium department in the pet shop or at Rodipet there are for example dried mealworms, brown shrimp, crickets, Bombyx mori larvae or insect food for small animals.  Young animals get more protein feed, in older animals it is reduced a little.
100 g herbal mixture: A high-quality feed always contains different proportions of dry herbs.  These may be tailored to the taste of the hamster, some prefer dried flowers such as sunflower petals, chamomile flowers, marigolds, others like green cereals such as green oats and others prefer herbs such as dandelions, lemon balm, yarrow and ribwort.
50 g nuts / kernels: Sunflower seeds, hazelnuts and walnuts are offered as fat suppliers.
50 g mixture: As a treat and to make the feed more interesting, pea flakes, corn flakes and rice flakes are mixed into the feed.
Please note: this feed mixture is not a complete feed!  We assume that the hamsters also get vegetables, green feed, fresh protein feed, herb hay and other herbs, this was taken into account when compiling the recipes!
Regularly check the composition of the hoarded and not consumed food.  Leave out ingredients that are not eaten at all (e.g. some hamsters do not like dried herbs, but these animals regularly eat fresh food and in summer fresh grass and herbs, the dried herbs can be left out).  From one day to the next, however, if the animals no longer eat certain food components, examine the animals to see whether their teeth are still ok and if they are otherwise healthy - or if necessary, see a veterinarian.
If certain food components are completely eaten, then add more of them to the feed (exceptions, if far too many fatty components are ingested, it rarely happens, but some hamsters are fixated on fat food).  At certain times of the year, hamsters develop certain preferences for some food components, e.g.  Millet preferred and should then be given more.

One interesting thing with dry food are sprouts. You could let sprout some of the seeds and grains from the dry mix and your hamster gets useful vitamins and nutrients. For this you could use some paper towels or a sprout glass.
Comment: Dear Allerleirauh, thanks for this wonderful answer. I'm interested in learning more about healthy hamster food, are there any reference that you could recommend me?. I have no veterinary knowledge.
Comment: @RamiroHum-Sah you could start with the link in my answer above, it is in German language but you could use some translation software to have a start. I have until now not found some sources in English language.

How to make homemade hamster food?


Using an angular build inside Salesforce

Question: Can I take an Angular build and using inside Salesforce within a lightning component?
Answer: Yes you can using lightning:container.
From the docs -
lightning:container allows you to use an app developed with a third-party framework, such as AngularJS or React, in an Aura component. Upload the app as a static resource.
Your application must have a launch page, which is specified with the lightning:container src attribute. By convention, the launch page is index.html, but you can specify another launch page by adding a manifest file to your static resource.
source : https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/container_js.htm


Is it possible to encrypt an SD card?

Question: In the film "Citizen 4", it's said that we cannot encrypt an SD card. Do you know why it would not be possible?
Answer: I think you're mistakenly recalling the movie.  In Citizenfour, Snowden warns the journalist on the risks of leaving a SD card unencrypted on his laptop with sensitive documents on it.  He never says that SD cards cannot be encrypted.  In fact, as the other answers point out, you can encrypt a SD card just like any other mass storage device.
Answer: Encrypting SD cards is a little trickier than encrypting the contents of a typical (spinning) hard drive, because the SD controller typically implements wear-leveling to ensure that no on cell gets too many writes.
Practically, it means that if you read from the card, encrypt, and then write to the card, you will be likely writing the data to a different location from where you read it, meaning that the original plain text will still be on the card.
Answer: For sure you can encrypt an SD card, using appropriate software; there's no difference between encrypting an SD card, a hard drive, SSD, thumb drive and any other kind of memory card. For example, newer versions of Android have implemented such a feature.
I don't exactly remember the scene in Citizen Four, but I can only imagine it was about the practical use of encrypted SD cards. You will barely find a camera that supports saving to encrypted SD cards, as they do not implement any of the available solutions. To encrypt the SD card, you'd have to pull the data off it, create an encrypted container and thus store the encrypted data again -- which requires a computer. It would be possible to construct such a camera, though (actually, probably only requires a slightly faster processor and some software).
Comment: For sure, most photographers wouldn't want to have to retype in their passwords every time they turn on their camera to take a snap.
Comment: Using public/private key cryptography you could remove the need to enter a password every time.

Is it possible to encrypt an SD card?


Background thread vs UI thread

Question: Could any one help me to figure out background thread and UI thread in C#.I have googled it but i coudnt find article illustrate both.
Answer: A UI thread creates UI elements and waits and responds to events like mouse clicks and key presses. You can only access the UI elements from the UI thread.
There are two types of threads: background and foreground. A UI thread is an example of a foreground thread.
The difference between background and foreground threads is pretty simple. Background threads don't stop a process from terminating, but foreground threads do. When the last foreground thread stops, then all the background threads are also stopped and the process ends.
Comment: Thanks for your quick response,in deed ur comment was really helps to me
Answer: This website has a lot of information about threading as well as parallel programming: http://www.albahari.com/threading/
Good luck
Answer: There is another key issue to keep in mind. There is a single U.I. thread and you can only call methods on U.I. objects in that thread. In another thread you need to call Control.Invoke() to flip to the U.I. thread if you are doing something like update a status bar.

Background thread vs UI thread


Executing gasless transaction using etherjs and openzeppelin

Question: My objective is simple I want to send a gasless transaction from one address to another. I am providing the code below.
I am using openzeppelin Defender relayer to cover the gas prices of the transaction
<code>const { DefenderRelayProvider,DefenderRelaySigner } = require('@openzeppelin/defender-relay-     client/lib/ethers');

const { ethers } = require('ethers');

async function sendGaslessTransaction() {
// Instantiate the DefenderRelayProvider
const credentials = {
apiKey: 'Relayer Api Key',
apiSecret: 'Relayer Api secret'
};

const provider = new DefenderRelayProvider(credentials);

const senderPrivateKey = 'private key';

// Gasless transaction parameters
const transaction = {
to: 'Recipient address',
value: ethers.utils.parseEther("0.0005"),
gasLimit: 21000
};

const wallet = new ethers.Wallet(senderPrivateKey);

const signedTransaction = await wallet.signTransaction(transaction);

console.log("signed transaction",signedTransaction)

const relayerSignedTransaction = {
    to: beneficiaryAddress.toLowerCase(),
    value: ethers.utils.parseEther("0.0005").toHexString(), // Amount to transfer in wei
    gasLimit: 30000,
    data: signedTransaction
  };

// Instantiate the DefenderRelaySigner

const signer = new DefenderRelaySigner(credentials, provider, { speed: 'fast' });

// Populate the transaction with additional details
const populatedTransaction = await signer.populateTransaction(relayerSignedTransaction);

// Send the gasless transaction to the relayer for execution and gas fee payment
try {
const response = await signer.sendTransaction(populatedTransaction);
console.log('Transaction hash:', response.transactionHash);

} catch (error) {
console.error('Error sending gasless transaction:', error);
}
}

sendGaslessTransaction();
</code>
In a gasless transaction, funds are transferred from AddressA to AddressB and the relayer pays the gas fees of this transaction. The same is my objective but in the code provided the funds are transferring from the relayer account to AddressB instead it should transfer from AddressA and the relayer should only cover the gas price.
The problem I think is in the Defender Relayer Signer class it is using the relayer to sign and send the transaction and ignoring the wallet generated using the private key of address A.
Additionally, I have seen that many tutorials and resources are using smart contracts for this purpose but I want to execute the transaction without implementing any smart contract
Thanks
Answer: I think what you want is your relayer to sponsor your transaction without signing it, by signing the transaction yourself instead.
Unfortunately, I think there is no any way to do that without sending 2 transactions.

Your relayer fund your account with the estimated gas cost of the transaction.
You send the transaction from your wallet.

The order of the operations depends on the design but those are the txs you need.
For more info about sponsored transactions you can check https://www.erc4337.io/


Why would I apply a relative font-size to the body tag?

Question: I saw that some people use to set a font-size: 80% for the body tag in CSS properties.
Why would I do something like that? Why can't I simply add a relative font size to the specific properties (e.g. p { font-size: 90% })?
Answer: Setting the body font size to 62.5% sets every other element so that 1.0em == 10px. So if I want my h1 to 20px and my p to be 14, I just have to set them to 2.0em and 1.4em respectively.
Setting the font-size in ems rather than px allows for more flexible text-resizing in certain browsers (FF2 and IE6 come to mind).
Answer: Most browsers are shipped with a default font size of 16 pixels. But this is for most authors too large. So instead of setting a fixed font size and thus overriding the user's settings (additionally the IE <= 7 cannot zoom pixel font sizes), they just scale browser's default value down.
Answer: You set it for the body tag to serve as a default for all the elements that you don't set a font-size to. You can also set the common font-size for the body, and just set font-size for the elements that are different than that of the body.
Answer: Another example of this use is if you want to create a javascript function that enlarges or shrinks the text size, then you can just append a change to the body font size and it will work on everything.
Answer: Because you might not have a p tag around everything that you want the font-size to apply to.
Not everyone wraps a paragraph around every piece of text (i.e. some people work with a mixture of divs and ps...)
Answer: Another use is taking advantage of font-size inheritance.
If you use relative font-sizes that base off the body tag, then providing multiple sizes now becomes the task of changing the body tag's font size.
Answer: Setting the font-size in percents or ems on the BODY element is a trick for cross browser font-size consistence. In addition it does allow IE6 to resize fonts when you use the text size option in the menu or when you use the Alt + Mousewheel combination.
That said since the new IE and Firefox 3 have adopted the whole page zoom as default, and seeing as IE6 is slowly disappearing out of the frame, using relative font sizes on the body purely to support IE6 Text resize is probably no longer worth the trouble.x
Answer: One neat trick I've found for defining font-size as percentage in the body is for creating a pseudo-page zoom for browser that don't have one.
If you use ems for both your font size and layout dimensions in your site, everything will scale relative to the font size. So if the user chooses to set their browser's font-size to 12pt (as opposed to the usual default of 16pt), your whole page (sans images) will scale with the text.


What happens to a person after they die in the Matrix?

Question: Machines keep humans in the Matrix as they are a source of energy. Why did they make it so that when a human is hurt in the Matrix, their bodies hurt themselves in real life (in the tank)? If a human dies in the Matrix, do they die in the real world? Or just get flushed out of their tank? Isn't it kind of a waste?
Comment: Notably, there's some feedback between the body's activities in the Matrix  (running and so forth) and their body in the tank, twitching and smiling are mentioned. One assumes this is to keep the physical body healthy
Answer: The body cannot live without the mind. The machines can't get around that. But nothing is wasted. They liquefy the dead so that they can be fed intravenously to the living.

Jump to 45 seconds for Morpheus' first hand explanation.

[Morpheus] ... I saw the fields with my own eyes. Watched them liquify the dead so they could be fed intravenously to the living. And standing there facing the pure horrifying precision I came the realize the obviousness of the truth...


changing JQgrid column name dynamically

Question: I just need to rename JQgrid column dynamically as per user selection from a list of options. How can I do that?
Answer: You can use this syntax:
jQuery("#grid1").jqGrid('setLabel', 0, 'NewLabel');

This will change first column name to NewLabel in your grid with id=grid1.
Answer: The latest version of jqGrid (4.1+ - possibly earlier) no longer appears to support the column index based setLabel approach described by Galichev, a columnName based approach is provided instead:
jQuery("#grid1").jqGrid('setLabel', 'columnName', 'NewLabel');

See the jqGrid Methods wiki for more information.
I've left the previous answer unedited as this approach may be valid in versions prior to 4.1.
Answer: According to the jqGrid Documentation, colNames cannot be changed after the grid is created.
However, you might be able to simulate a column name change by using several columns. Then you can hide all of them except a single one which will be shown to the user. When the user selects another, just swap in the selected column. For example, if valid columns are [A, B, C, D] you might start by only showing A. Then if the user chooses C, hide A and show C. The main disadvantage to this approach is that you will need to copy the same data to many columns, however.
Update
Per Galichev's answer, you can use the setLabel method to rename a column header.
Answer: *setLabel : * colname the name of the column (this parameter can be a number (the index of the column) beginning from 0
However the index param does not work with version 4.1 and above.
Jqgrid uptop version 4.0
 $(tableId).jqgrid("setLabel", 0, "BBBBB");

Jqgrid version 4.1 and above
Try using these
  $(tableId).setLabel("ColumnName", "AAAAA");

or
  $(tableId).jqgrid("setLabel", "ColumnName", "BBBBB");

Answer: JQGrid1.Columns.FromDataField(ColumnName).HeaderText = ColumnName;

Answer: I gave my column name a div
'
Date
'

Then I just changed it the normal way, getElementById, change contents.

changing JQgrid column name dynamically


Can I use Type S mortar for a shower's preslope and mortar bed?

Question: I am really confused. I've read numerous posts that say that using Type-S mortar for shower bed is a no-no. I called Sakrete, and they confirmed that it's not for shower bases and more for laying brick, etc. Then I called Oatey to inquire what shower base should be made of to install their shower liner and the rep told me that I can use Type-S mortar. Who is right here?
Answer: Type S mortar is mixed really wet so it would be hard to shape it into any sloping shape and it better for thinner applications, like brick laying. If you mix it dryer that instructions say, you take the risk of it crumbling.
I'd be following the advice from the manufacturers of the mortar over the advice from the manufacturers of the products going on top of it.
Comment: The Sakrete people correctly discouraged the use of type S masonry mortar for preslope and mortar bed. The Oatey people correctly encouraged the use of type S masonry cement for mixing a suitable mortar. There is no contradiction between the two.
Comment: @popham  Not sure what your point is. The OP never mentions anything about type S cement, only type S mortar.
Comment: Type S mortar is type S cement with sand in it. Your answer is calibrated for type S _masonry_ mix, not for type S mortars generally. Just because this particular type S mortar was unsuited to shower work doesn't mean that all type S mortars are unsuited to shower work.
Answer: There's type S mortar and type S mortar cement. Type S mortar is type S mortar cement premixed with sand. When the bag says that the mortar is for masonry (like you'll typically find at the hardware store), then that means that they mixed 2.25 to 3 parts sand to 1 part type S mortar cement (see https://www.quikrete.com/pdfs/data_sheet-masonrycementtypes.pdf). I think that Oatey used to specify 4 parts to 1 for the preslope instruction with their liners. Now they leave the mix unspecified, where I suspect that they got tired of answering the phone for people advised to do something else. Lots of people swear by 5 parts to 1. Splitting the difference, let's say that the ideal ratio is 4.5 parts sand to 1 part type S mortar cement. To achieve that ratio, you'll want to add 1 part sand to 2 parts type S masonry mortar mix.
Reasoning:
Assuming a type S masonry mortar mix with (2.25 + 3)/2 = 2.625 parts sand to 1 part type S mortar cement, you'd add 1.875 parts sand to the (2.625 parts sand + 1 part cement) = 3.625 parts of type S masonry mortar mix to get 1.875 + 2.625 = 4.5 parts sand to 1 part cement. These fractions clean up with multiplication by 8, yielding 1.875 ↦ 15 parts sand to 3.625 ↦ 29 parts type S masonry mortar mix. 1 part sand to 2 parts type S masonry mortar mix therefore provides a good approximation to achieve the 4.5 parts sand to 1 part type S mortar cement.
Answer: Type S Mortar is great for shower pan and pre-slope pan only if you mix it  as dry pack. It bonds very well with small amount of water.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


Unspent transaction I need some help

Question: I had a business send me BTC to my exodus wallet.  The transaction is confirmed but about half of the transactions including mine say unspent.  It's been 4 days now.  Can I do anything to help the process?
Answer: If the transaction is confirmed, the process is done.  "Unspent" just means you haven't spent the coins yet.  But you can do so whenever you wish.

Unspent transaction I need some help


Mac mini with Core 2 Duo will be good for Xcode?

Question: If I have a Mac mini mid 2010 with 4 gb ram and Intel core 2 duo, will it be enough to run Xcode with safari or chrome?
Comment: I've cut out the CPU portion - that's a great stand alone question. Keep in mind - we might already have a dozen questions covering upgrade paths for mini. We might also have a dozen questions on how to understand Xcode requirements.
Answer: Simple answer: Mac mini mid 2010 with 4GB RAM and Intel C2D can open Xcode and Safari/Chrome side by side.
Ram replacement process can be found on iFixIt. if you decide more memory is needed for your workflow.
Answer: I write software using Xcode and a 2007 iMac with 4 GB of RAM. The processor is a 2.4 GHz Intel Core 2 Duo. The version of Xcode is 7.2.1 and the OS is Yosemite 10.10.5. My Mac is not able to run Sierra, but I do have El Capitan installed in a different partition. I have not yet installed Xcode under El Capitan. My drive is traditional spinning hard disk. (I also have Windows 10 installed with the current free version Visual Studio.)
I often have many Safari, Xcode, Finder, and Terminal windows open simultaneously.
You can not upgrade the processor on your Mac mini, but the memory can be increased to 16 GB of RAM. According to everymac.com:

"Originally, both the official and actual maximum RAM was 8 GB. However, as confirmed by site sponsor OWC, if running OS X 10.7.5 or higher, updated with the latest EFI, and equipped with proper specification memory modules, this model can support up to 16 GB of RAM."


Adding Raster Statistics to Layout View in ArcMap

Question: I have a raster on my map and I would like to display the high, low, and mean values in a text box in layout view. Is there a way to dynamically do this? I have my legend set up so only the visible layers have legends, is there a way to do something similar with the raster statistics? If not, can I use data driven text somehow to display the data instead of going into raster properties and copy/pasting the info?
Answer: I used this label expression for polygon feature:
<code>def FindLabel ( ):
  r = arcpy.Raster("DEM")
  mini = r.minimum
  mean = r.mean
  maxi = r.maximum
  return '{:.2f}\n{:.2f}\n{:.2f}'.format(maxi,mean,mini)
</code>

so just use dummy layer and labeling engine to show any info on raster.
Comment: Thank you, not as elegant as I had hoped from ArcGIS, but very useful.
Comment: You can create many dummies and associate them with data driven pages (via definition query) and individual rasters.
Answer: One way to achieve this is to display the statistics as table in the layout. Although it requires some steps and you have kinda little control over the arrangement, the cool thing about it is you can add many statistics and many raster at once. To do that:
1- Build Raster Attribute Table tool to get the raster attributes
2- Summary Statistic tool to get the desired statistics (you can enter statistic fields from many different raster at once)
3- Open the resulted table and customize it as you want it to appear (turn off the fields that you don't want like object id and rename the rest as you want. You can use Appearance from Table Options to customize the text)
4- Click on Table Options >> Add table to Layout
Comment: This won't work with floating point raster.
Comment: Sure, to make it work on floating point raster, one needs to convert to Int then to float in the table(Raster calculator * multiplies of 10 as needed, convert to int, then return the values as they were in the final table by dividing by the used multiplies of 10). Anyway, seeing @FelixIP answer below, there is no need for on spot scattered solution any more :)


What does the term regression mean?

Question: The term 'regression' means : 'deterioration', 'moving back', 'to return to an earlier or previous state'.
So when we speak about regression analysis, what does the word 'regression' mean?
Which & what sort of 'deterioration' or 'going back' are we analyzing?
Answer: The original use by Francis Galton was in a problem where children's heights were being predicted from parents' heights. Tall parents (parents taller than average) tend to have tall children, but on average shorter than themselves, whereas short parents (parents shorter than average) tend to have short children, but on average taller than themselves.
This phenomenon was called regression to the mean, where regression means falling back, rather than deterioration.
The name has stuck for all similar problems, including the great majority that have nothing to do with heredity. But a regression effect can be expected in many testing-retesting problems.
This history is well documented. For example, see
this Wikipedia article
and its references.
Answer: A regression analysis with $k$ predictors has a form like this $y= a + b_1 x_1 + \cdots + b_k x_k$. Thus the regression regresses a dependent variable on its predictors.
Here is a similar question and part of the answer is "Since $y$ is being projected on $X$, that is what I think when I hear that $y$ is "regressed on $X$" - and that is probably why we talk about "regression" analysis.
The link provided may make the question to a duplicate.
Comment: Historically this is not correct as explaining where the term comes from. It seems plausible as a way of explaining or motivating "on" as common usage, but you still need a story on where "regress" comes from, and that's what history supplies.
Comment: Thank you Nick & igoR87. It helps.

What does the term regression mean?


Rotation addition with quaternions

Question: My task is: "Describe rotation $S \circ R$ by axis and angle, where $R$ is rotation around $(0,1,1)$ by 90 degrees, and $S$ is rotation around $(1,-1,0)$ by 90 degrees." I should use quaternion multiplication to solve that. How do I do that? The way I see it now, I represent $S$ with $e^{\pi/4 (j+k)}$ and $R$ with $e^{\pi/4 (i-j)}$, and then multiply them, using the quaternion rules for that: $e^{\pi/4 (j+k)} \cdot e^{\pi/4 (i-j)} = (cos (\pi /4) + (j+k)sin(\pi /4))\cdot(cos (\pi /4) + (i-j)sin(\pi /4)) = \dots = 1 + i +1/2 j$, which should correspond to rotation by $0$ degrees around vector $(2,1,0)$, but I guess something is wrong with my answer.
Comment: Can you clarify the order  in $S \circ R$? Am i right in  assuming its $R$ followed by $S$ ?
Comment: Yes, that is what I meant.
Answer: The quaternions for rotations $R$ and $S$ are:  $$t_R=\cos \frac{\pi}{4}+\frac{j+k}{\sqrt 2}\sin \frac{\pi}{4}$$ $$t_S=\cos \frac{\pi}{4}+\frac{i-j}{\sqrt 2}\sin \frac{\pi}{4}$$ The product rotation $S \circ R$ would then be given by $t_Rt_S$, which is easily calculated by the rules of quaternion multiplication to be $$t_Rt_S=\frac{3}{4} +\frac{\sqrt 7}{4}\left[\frac{(\sqrt 2 +1)i + j + (\sqrt 2 - 1)k}{\sqrt 7}\right].$$ The rotation angle is therefore $2\arctan \frac{\sqrt 7}{3}$ and the rotation axis is in the square brackets of the above expression.
Comment: Can you explain a bit more about how you got $arctan$ here?
Comment: a quaternion of the form $\cos \theta + u \sin \theta$ operates by conjugation on $R^3$ to cause a rotation of $2\theta$ about the axis $u$ in $R^3$. Comparing one has $\cos \theta = 3/4$ and $\sin \theta = \sqrt 7 /4$.

Rotation addition with quaternions


DigitalOcean - OpenLiteSpeed WordPress Domain Name Issues

Question: I'm pointing my domain name www.patrickwall.com at ns1.digitalocean.com, ns2.digitalocean.com and ns3.digitalocean.com, and it's propagated correctly, but I'm unable to get my website to appear in a browser. When I enter my domain name in WordPress Address (URL) and Site Address (URL) in my WordPress settings and restart the server, the domain cannot be found. And the wp-admin although accessible is now unstyled. When I change the WordPress Address (URL) and Site Address (URL) to myIP address the site is still not working although the wp-admin is now styled. I've tried adding my domain in wp-config.php define( 'WP_HOME', 'http://www.patrickwall.com' );
define( 'WP_SITEURL', 'http://www.patrickwall.com' ); which is picked up by the WordPress admin settings, but still doesn't resolve the issue. I've set up wordpress previously on DigitalOcean without these issues. The only difference is that this time I 1-click installed the OpenLiteSpeed version of WordPress. Any help would be greatly appreciated.
Answer: When you use the OpenLiteSpeed + WordPress 1-click image on Digital Ocean, after the machine has been installed, you have to also add your domain to the virtual host for it to go into effect.
In the quickstart guide, you'll find how to access the Web Server Control Panel: https://docs.litespeedtech.com/Cloud/wordpress/#web-server-control-panel-access
When you've logged into the console, you have to go to "Virtual Hosts", then click on the small "Search" icon (View), go to "General", and in the "General" section you'd click the Edit button in the upper right corner, enter your domain patrickwall.com and in Domain Aliases, you'd enter www.patrickwall.com.
After this, go to "Listeners", and under "Default" and "Defaultssl", you have to modify the Virtual Host mapping to contain your domain as well: patrickwall.com,www.patrickwall.com
and then restart OpenLiteSpeed by clicking the green button in the upper right corner next to "LSWS PID".
Answer: Just an update, the OpenLiteSpeed + WordPress 1-click image on Digital Ocean has a new auto setup script for Domain and SSL supported.
SSH into the console, an interactive script that runs will first prompt you for your domain or subdomain.
You can press CTRL+C and continue to SSH. The prompt will open again the next time you log in, and will continue to do so until you finish the whole setup.
Please input a valid domain:
Please verify it is correct. [y/N]

You can also automatically apply Let's Encrypt SSL if your domain is pointed to this server already. Enter y and your email address to finish the process.
Do you wish to issue a Let's encrypt certificate for this domain? [y/N]
Please enter your E-mail:
Please verify it is correct: [y/N]

Once finished, you should see Certificate has been successfully installed...
Do you wish to force HTTPS rewrite rule for this domain? [y/N]

Once finished, force HTTPS rules will be applied
Do you wish to update the system which include the web server? [Y/n]

This script will automatically go away after your domain has been added.
More details please check here


How do I type Macrons on an Android device?

Question: How do I type Macrons on an Android device?
Answer: ā, ă, ē, ĕ, ī, ū are all easily typable on an Android device by long-pressing the corresponding vowel. So ĭ, ŏ, ō, ŭ, ȳ and y̆ are missing.
For Samsung, I'll quote a post from here, but only in part because that procedure doesn't seem to work for me:

In your browser, find and copy the letter you need from any site.
Go to Settings > Language and input > Samsung keyboard > Predictive text > Text shortcuts.
Here, you can set keyboard shortcuts for whenever you write a certain word. Add a shortcut with your copied letter, and naturally set the corresponding vowel as the needed input for the shortcut to be shown.
Answer: I use the Swype keyboard, which has macra available for all vowels except y, by long-pressing the letter. So you could use that.
Comment: Actually this seems to be true of the standard android keyboard! Thanks!
Answer: If you are using the Google Keyboard (GBoard), add the Māori language, and select it while typing by long press on the spacebar.
Then macrons are really easy: just a long press on a vowel, and it switches to the one with a macro.
Comment: Based on your recomendation, I just switched to Maori in Windows 10; however, I have to press the "tilde" key below the ESC key before pressing the vowel to get a macron.


Are there any more Elminster novels coming?

Question: Elminster is one of the best written characters in the Forgotten Realms after Drizzt (IMO). so what I would like to know is are we going to see any more works with Elminster penned by his creator Ed Greenwood or any other author currently writing for Forgotten Realms?
Comment: Agreed entirely.  Let me see if I can coax this info out of the web. You did read The Herald, right?
Comment: I need to know what your last book was.  The various wikis of the world haven't been updated in regards to Greenwood's books, and his last one was just 11 months ago.
Answer: Update (2019) - it would appear that there are no more Eliminster-focused novels forthcoming.

Q: After Death Masks, Are there any more Elminster-related stories coming?
Ed Greenwood: Book length? Don't know. I've already penned a few Mirt tales that have Elminster briefly appearing as a supporting character (they were up at DM's Guild and will be again). If any publishers out there want to do a licensing deal with Wizards for Elminster novels, I'm game!.

I asked my good friend Ed Greenwood what his plans were regarding Elminster. You'll be pleased to hear that you won't have to wait long for a new story with your fave character.

Q: Are there any more Elminster-related stories coming?
Ed Greenwood: Oh, yes. Early June: DEATH MASKS, new Realms novel in hc from Wizards of the Coast, by yours truly, has old El in it!
Comment: Being Supreme Chancellor sure gives you a lot of connections.
Comment: @armadillo  - You just have to ask nicely


How do I create a Git remote repository that omits certain files from the original repository?

Question: I have project files (including test files) all of which I want under version control using Git on my local computer. I want to create a public remote repository (on GitHub) that only contains a subset of my project files (I want some of the test files in my project to be omitted from the public remote repository.)
How do I set up the remote repository so that certain files are omitted and that there is no reference in the remote repository or its history that these files ever existed?
Answer: Try this:

Initialize your git repository:
git init

Add all your public files and make your initial commit:
git add public1 public2 ...
git commit -m 'initial commit'

Create a new private branch:
git checkout -b private

Add your test files and other things you don't want publically exposed:
git add testcase1 testcase2 ...
git commit -m 'added test cases'

Now you have a repository with two branches.  The master branch contains only those things you want to publically expose.  The private branch is based on the master branch, but has some additional files.
Add your github remote and push the master branch.
You'll want to do most of your work on the master branch, periodically merging changes into the private branch as necessary.
UPDATE: If you need to work on the files frequently, this becomes complicated because it will be hard to separate changes from your "private" files from changes to your public files. If all your private files can be confined to a specific subdirectory, the easiest thing to do is just to put your private files in a separate repository (and have the working copy checked out inside the public repository).
Even if you can't confine everything to the same subdirectory, you can pursue a similar solution through creative use of symlinks.
Comment: I tried that, but when I checkout my master branch all the private files are deleted from my working directory. I need all files present in the working directory to work on the project.


If there is zero electric field inside conductors how do spherical capacitors work?

Question: I know that if a charge q is place inside a conducting shell, a charge -q is induced on the inner surface of the shell and then we take a spherical gaussian surface with radius equal to that of the shell and say that since the net charge enclosed is zero  (+q-q) the electric field is zero.
But what if we take a gaussian surface with a radius smaller than that of the shell? The charge enclosed in this case would be equal to q giving a non zero electric field
Where am I going wrong and how exactly do spherical capacitors have a potential difference?
Answer: The core charge is +q. The inner surface charge is -q. There is a field between the outer surface of the core charge and the inner surface of the spherical conductor. The charge seperation on the conductor would, in and of itself, produce an electric field, but what it produces is the exact opposite of the field due to the core charge, and so the net field in the conductor is zero. This is the only way that the charges in the conductor can settle down, of course - any field would result in conduction. That's the definition of a (perfect) conductor.
So a surface between the core charge and the inner spherical surface would register the charge of the core. Inside the material of the spherical shell, the net zero charge, and outside the spherical shell, the net positive, from +q-q+q.


What's the definition of LDS the genre?

Question: Spotify included "LDS" among my Top 5 genres. But what exactly is "LDS"?
I googled around and it only told me something about Mormons...
Comment: @Aaron Sure, as it stands it's probably musicfans-appropriate. I'm intrigued, though, and Dr_Hope, I'd love to see this edited into a more in-depth question by asking more about the *nature* of such a genre. I too turned up only Mormon ("Latter Day Saints") results and wondered how that could possibly be a "genre", since my (outsider) perception of Mormon culture is that it's not markedly distinct from the rest of American Evangelical contemporary Christian aesthetics. But then there are [articles like this](https://en.wikipedia.org/wiki/Mormon_music), suggesting that...
Comment: ... what started as sociological reasons for drawing a distinction evolved actual musical markers. I'm curious what they might be.
Answer: The LDS genre is exactly as it seems: music and artists consistent with Mormonism or of interest to Mormons.
A couple of examples:
There is an organization called "Latter-day Saint Musicians" that has a Spotify account ...

to provide a library of good music that people can listen to and discover without being concerned about songs that have questionable lyrics. At the same time, the playlists that have been created will help introduce listeners to Mormon artists and their music. (SOURCE)

There is also a channel "The Sound of LDS" that is similarly geared toward Mormon listeners and artists.
Comment: oh dear... didn't know that I was lured by their music

What's the definition of LDS the genre?


Best UI elements for assignment section

Question: I have a list of tasks/sections that need to be assigned to multiple set of user's. I have used JqueryUI's selectable elements to display the tasks and I have used Jquery token input (Facebook like) elements to make the screen as displayed in the attached image. This works but is not the best way to work. I want to reorganise the structure to make it seamless for the user and also be self explanatory. Keeping the User's section at the bottom with the Map button next to it and the sections/task section above them is somehow not pleasing experience. I tried putting them next to each other but it creates issues of width as the task/section names are lengthy and need space to display completely. Please suggest on how this can be reorganized to make it more user friendly.
Answer: A two-column interface might help your issue:

Select users on the left, then select their tasks on the right. The bar at the bottom can be used to search for users. This is a very generic example of it, but I've seen similar designs work quite well for user-task assignment.
Answer: You can do something like this if you are mapping tasks to users. List the tasks on one side and you can drag and drop the tasks onto the users. The user can then display the tasks that are mapped to them.
Also you could do a mouse over of the user and highlight the tasks in the list that are assigned to them or a mouse over of tasks and highlight the users that are mapped to them.
So in this instance tasks would be JQuery draggables and the users JQuery droppables.

Best UI elements for assignment section


Selecting longest edge in triangle

Question: I've got traingluated mesh in which I want to select longest edge of each triangle. I have a feeling that this isn't hard via python script, but my coding skills are.... well not good.
I know that you have to iterate through triangles in an object, then compare edge lenght, add longest one to some group and at the end select this group - I just don't know how to code it :(
This is a workaround to not very good tris-to-quad tool.
Answer: Bmesh script
Simply running through and selecting the longest edge of each tri, the result can have any of 1, 2 or all edges of tri selected.
Added code try and avoid this somewhat.
Test script showing how to:

Load current edit mesh into bmesh
Find all triangles in bmesh
Find the longest edge and select it.
Update the edit mesh.

script:
import bpy
import bmesh

context = bpy.context
ob = context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)

# triangles
tris = [f for f in bm.faces if len(f.edges) == 3]
# deselect all edges
for e in bm.edges:
    e.select = False

for f in tris:
    # if an edge already selected continue
    if any(t.select for t in f.edges):
        continue
    # sort by length and selected (if not using continue)
    edges = sorted(f.edges, key=lambda t : [t.calc_length(), t.select])
    # pop the last and select
    edges.pop().select = True

bmesh.update_edit_mesh(me)

Alternativey
Each edge has a link_faces collection. If there are two link faces (not boundary) and the edge is longest of all edges in both faces, then turn into quad.

Find all edges that have two triangle link faces
For each these edges, (sorted maybe): if it is longest edge of 2 faces and no other edges selected disolve edge to make this face a quad.
otherwise go to next edge.

Selecting longest edge in triangle


How to limit the max number of characteres in the title that are displayed

Question: I am following this tutorial — "Display Your Popular Posts In WordPress Without A Plugin" and want to limit the max number of characters in the title that are displayed. Also, why is the thumbnail, at times, smaller than the number I define in the php?
Comment: **(1)** Bainternet gave a wonderful answer, and as an alternative, you can also get the same effect using `text-overflow` CSS property. **(2)** You said you've defined the thumbnail size in php. If so, did you enable "hard cropping"? Unless you do that, dimensions of the thumbnails generated aren't going to be exact.
Answer: first add this function to your functions.php file
function max_title_length($title){
     $max = 20;
    return substr( $title, 0, $max ). " …";
}

then before the loop of the code you linked add this line to hook the above function:
add_filter( 'the_title', 'max_title_length');

and after the loop remove this filter:
remove_filter( 'the_title', 'max_title_length');

and just change $max = 20; to whatever you want.
Comment: not to sth > 200 (which is the problem I'm facing with Thai URls), @Bainternet :)
Answer: You can use this bit to limit the number of characters displayed and append an ellipsis.
In this particular example I've set it to trunicate at 38 characters and only display the ellipsis if the title was trunicated.  And regardless of the length, display the full title on the single_post page.
<?php
//assign the title to a variable
$the_title = esc_attr ( the_title_attribute ( 'echo=0' ) );
//specify our desired max character count
$max_length = 38;
//strlen gets the length of the string
$title_length = strlen ( $the_title );

// check if the length of the string is greater than our assigned max length
if ( $title_length > $max_length ) {
    // if it is display a substring of the title from the
    // first character to the 38th character and append ...
    $title_excerpt = substr ( $the_title, 0, $max_length ) . '...';
} else {
    // otherwise just return the_title()
    $title_excerpt = $the_title;
} ?>

    <?php if ( is_single () ) { // If article page
        the_title ();
    } else {  // If homepage
    ?>

    <a href="<?php the_permalink (); ?>" title="<?php echo esc_attr ( the_title_attribute ( 'echo=0' ) ); ?>" rel="bookmark"><?php echo $title_excerpt; ?>
    <?php } ?>

Answer: I've improved the @Bainternet answer to only display ... when the title is longer than $max:
function max_title_length( $title ) {
        $max = 30;
    if( strlen( $title ) > $max ) {
        return substr( $title, 0, $max ). " …";
    } else {
        return $title;
    }
}

Then you can hook like this:
add_filter( 'the_title', 'max_title_length');


Protecting access to NFS shares in Docker

Question: I would like people to access NFS shares from within Docker. Problem is inside of Docker they can become root, and then they can have write access to anyone's files by becoming that user. Is there a solution for this?
Comment: Great question! I am also working with securing Docker. I don't have a thorough answer for you. Have you looked at the nosuid, root_squash & nodev mounting options in your docker container?
Comment: Are you allowing your users to run any arbitrary container-image, with any options. Or you you in control of this?
Answer: One possible solution would be to mount the NFS shares on the docker nodes instead of inside the containers.  In this way, a container would only get access to a volume inside the share that you specify in your compose file, not the entire share itself.  This is the approach im taking at my company, and it seems to work decently well for our small scale deployment.  Another benefit to us is that it was easier to secure via stunnel since the number of servers mounting the share was substantially reduced.
Answer: If the user can get root in the container and can see the other users' files, there really isn't anything you can do to prevent them altering those files.
So you must prevent that happening: either limit what the container can "see" to the files it may be allowed to write, or prevent the container obtaining root.
Jason's suggestion is nice - limiting the containers "view" into the share so it can only access files it should be allowed to write.
However, if you want the container to be able to read other people's files, well you're going to have to prevent root.
Or get really familiar with SELinux, CGroups, and maybe other such granular controls.
I don't expect this is the answer you're hoping for. If someone gives you a way to do this, I would love to hear it.
Answer: You'd like an answer "drawing from credible and official source", but the thing is that there can be several solutions, and the "best" one depends on the overall configuration in place and the amount of complexity that you're willing to undergo to obtain the desired result.
Therefore you should describe at least an overview of your current setup, upon which we can try to provide a comprehensive answer.
Insofar, the most I can say, as a general idea, is that the first step is to mount the NFS shares from the Docker machine, not from the containers, and then distribute portions of that share to the respective containers via the usual methods available in Docker. This already may be not a simple task to do if you have a cluster of Docker machines hosting your containers.
Anyway, that is also not enough to avoid free access to the files in that portion by the root user of that container, and to achieve such finer control you need to configure ACLs (Access Control Lists), whether at the NFS level or at the server's file-system level. For either of these two options you need to be the sysadmin of the NFS server, which has to have the notion (at least some notion) of the user-ids assigned to each user of each container. If not all user-ids, at least groups of them and then set up ACLs per group of users.
Look for NFS-acls (NFSv4 would be better) to learn what can be done at the NFS level (quite a lot), and POSIX-acls to learn about the file-system level. You may easily experiment this latter by using the setfacl and getfacl commands at the command prompt. To have these commands available you may need to install the relevant package of your operating system.
Answer: Have you looked at fuse mounting the NFS, in the host. When I use fuse to mount over ssh (sshfs). It is mounted as me, root does not get any special permissions on these files. (sudo is ineffective).


Cleanest Jetty Configuration for Development?

Question: EDIT: I think I should clarify my intent...
I'm trying to simplify the development iteration cycle of write-code >> build WAR >> deploy >> refresh >> repeat. I'd like to be relatively independent of IDE (i.e., I don't want Eclipse or IntelliJ plug-ins doing the work). I want to be able to edit code/static files and build as needed into my WAR source directory, and just have run/debug setup as a command line call to a centralized Jetty installation.
Later I'd like to be able to perform the actual deployment using generally the same setup but with a packaged up WAR. I don't want to have my app code specific to my IDE or Jetty.
So perhaps a better way to ask this question is What have you found is the cleanest way to use Jetty as your dev/debug app server?

Say I want to have a minimal Jetty 7 installation. I want as minimal of XML configuration as possible, I just need the raw Servlet API, no JSP, no filtering, etc. I just want to be able to have some custom servlets and have static files served up if they exist. This will be the only WAR and it will sit as the root for a given port.
Ideally, for ease of deployment I'd like to have the Jetty directory just be the standard download, and my WAR / XML config be separate from these standard Jetty files. In my invocation of Jetty I'd like to pass in this minimal XML and go.
I'm finding that the documentation is all over the place and much of it is for Jetty 6 or specific to various other packages (Spring, etc.). I figure if I have this minimal configuration down then adding additional abstractions on top will be a lot cleaner. Also it will allow me to more cleanly deal with embedded-Jetty scenarios.
This SO question is an example scenario where this XML would be useful Jetty Run War Using only command line
What would be the minimal XML needed for specifying this one WAR location and the hosts/port to serve it?
Thanks in advance for any snippets or links.
Answer: Jetty has migrated to Eclipse. There is very subtle info on this. This also led in change in package name, which is another level of nuance. They did publish a util to convert Jetty6 setting to Jetty 7 setting, but again -- not very popular. I am dissapointed from Eclipse Jetty forum. Here is where you should look for documentation on Jetty 7 onwards http://wiki.eclipse.org/Jetty/Starting
I think this is the minimal jetty.xml taken from http://wiki.eclipse.org/Jetty/Reference/jetty.xml
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">\
<Configure id="Server" class="org.eclipse.jetty.server.Server">
</Configure>

But, I would rather like to start from a copy of $JETTY_HOME/etc/jetty.xml and would modify from there.
If you are Okay with $JETTY_HOME/webapps directory, you can set up the port by modifying this part
<Configure id="Server" class="org.eclipse.jetty.server.Server">
    ...
    <Call name="addConnector">
      <Arg>
          <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
            <Set name="host"><Property name="jetty.host" /></Set>
            <Set name="port"><Property name="jetty.port" default="7777"/></Set>
            <Set name="maxIdleTime">300000</Set>
            <Set name="Acceptors">2</Set>
            <Set name="statsOn">false</Set>
            <Set name="confidentialPort">8443</Set>
        <Set name="lowResourcesConnections">20000</Set>
        <Set name="lowResourcesMaxIdleTime">5000</Set>
          </New>
      </Arg>
    </Call>
    ....
</Configure>

Else, I will modify context.xml the way explained here (for Jetty 7) How to serve webbapp A from portA and webapp B from portB
Also refer these pages:

http://wiki.eclipse.org/Jetty/Reference/jetty.xml
http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax
http://communitymapbuilder.org/display/JETTY/JNDI

....
Edit#1: sorry for wrong URL for webapp per connector. I have updated the link to How to serve webbapp A from portA and webapp B from portB to point to the doc that is meant for Jetty 7.

Update on 'how you deal with Jetty on various environments?'
Dev
We use Maven, so embeded Jetty works for us. We just run mvn clean install run:jetty and the port is configured in Maven's config file, namely pom.xml. This is not IDE dependent plus Jetty can easily be embedded using ANT, but I never tried.
Test
We have stand-alone Jetty running. I've configured port and tuned parameters, removed default apps (e.g. root.war etc) and created a context.xml with app specific ports and deployment directory. (Unfortunately, I have asked this question on Eclipse Jetty's mailing list and no one bothered to answer). This is one time setting.
For test builds/deployments, we have a build script that builds the WAR as per test env specs and then uploads it to test environment. After, that we invoke a shell script that (1)stops Jetty, (2) copies war file to myApp's webapp direactory and (3) restarts Jetty.
However, easier way to do this is by using Maven's Cargo plugin. The bad luck was that I was using Jetty 7.1.6 which was incompatible with Cargo. Later they fixed it, but I had got my job done by custom script.
Prod
Prod has almost same procedure as test, except. The tunings are done for higher security and load-balancing. But from deployment POV, there is nothing different from Test case to Prod.
Notice that I have not bothered about what XML files are and how many must be there. I have just used the ones that are my concerns -- jetty.xml and context.xml. Plus, I found it's much cleaner to use jetty.conf and jetty.sh for passing JVM params, custom XMLs and for starting and stopping.
Hope this helps.

On hot deployment:
Now, if you use Maven and use embedded Jetty. It just knows when the code is changed -- like "gunshot sniffer". In dev envt, you run Jetty, make changes, refresh page, and see your changes -- hot deployment. Find more here http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin look for scanIntervalSeconds
Comment: Under `$JETTY_HOME/etc`? You may delete all those that you wouldn't be using. It's default config files for various setting. very fine-grained. I would not recommend deleting them. Ideally, you should be just done with editing or copying concerned XML file and then passing it to `java -jar start.jar XMLFILENAME`. You should be able to consolidate in one file, which basically means passing all the filename as argument. Not recommended. Also, see into `$JETTY_HOME/etc/jetty.conf` I would suggest to use `$JETTY_HOME/bin/jetty.sh` to start and stop. You do not explicitly need to pass any XML file.
Comment: Thanks. Do you know if I *have* to have all the various XML config files? Or can I consolidate into a single jetty.xml which I specify from the command line?
Comment: @Nishant Thanks, it helps a lot to hear the high-level picture of the various environments. Sounds like Maven would simplify certain aspects. Out of curiosity, does your DEV env point to the exploded WAR sources or must it be deployed with a full build-step? I'm also trying to simplify UI tweaks to just edit >> save >> refresh.
Comment: @McKAMEY yep. Hot deployment is there with Jetty. If reloads the app if there are code changes. The default scan interval is 10 seconds, you may configure it. Updated the answer.
Comment: RE: "hot deployment" - excellent answer! This solved not only my original question but should give me a good starting point for the rest of my DEV/TEST/PROD environments.
Answer: This doesn't fully answer your question, but in case it helps, here's some pretty minimal code using embedded Jetty 7 to fire up a server with one root servlet:
    HandlerCollection handlers = new HandlerCollection();
    ServletContextHandler root = new ServletContextHandler(handlers, "/", ServletContextHandler.NO_SESSIONS|ServletContextHandler.NO_SECURITY);
    root.addServlet(new ServletHolder(new MyServlet()), "/*");

    Server server = new Server(8080);
    server.setHandler(handlers);
    server.start();

See of course http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty.
Comment: Thanks, I've actually seen similar snippets a lot, but what I'm wondering is how can I do a similar minimal setup with the XML config?
Answer: I thought I'd update with what I now do. I've written a tiny command line app / Maven archetype which works like how I thought this all should have in the first place. The bootstrap app lets you launch your servlet container of choice (Jetty, Tomcat, GlassFish) by just passing it the path to the WAR and your port.
Using Maven, you can create and package your own instance of this simple app:
mvn archetype:generate \
    -DarchetypeGroupId=org.duelengine \
    -DarchetypeArtifactId=war-bootstrap-archetype \
    -DarchetypeVersion=0.2.1

Then you launch it like this:
java -jar bootstrap.jar -war myapp.war -p 8080 --jetty

Here's the source for the utility and the archetype: https://bitbucket.org/mckamey/war-bootstrap
Comment: In the interest of a tight development cycle, you would not want to war.
Comment: I don't actually use wars during dev. I point it at the target output dir and it works fine.
Comment: McKamey, then my solution above is what you are looking for.  Just point gradle to your build directory (or don't, it already knows magically per convention) and "jettyRun" ... that's all you need to do.
Comment: I already solved this problem 2 years ago. No need for gradle.
Answer: If you are building with maven (which is IDE independent) then you should debug with the maven jetty plugin. Basically you run the app as "mvn jetty:run" on the commandline it all just works without having to do any redeployment. Most good IDEs how have maven support built in and lets you run/debug the app as a maven; meaning that maven is run which starts the jetty plugin which starts the app and you can debug it. Since everything is running out of the IDE source and bin folders you don't even need a jetty server install.
Here is a demo project which runs that way https://github.com/simbo1905/ZkToDo2/blob/master/commandline.build.and.run.txt and here is how to run it under eclipse https://github.com/simbo1905/ZkToDo2/blob/master/eclipse.indigo.build.and.debug.txt but any IDE which understands maven should work. Take a look at the pom.xml where it sets up the maven jetty plugin.
Answer: I would use Gradle and scan the build output folder every few seconds for changes in the build.
In a build.gradle file:
apply plugin: 'jetty'

...

jettyRun.doFirst {
    // set system properties, etc here for bootstrapping
}

jettyRun {
    httpPort = 8989
    reload = 'automatic'
    scanIntervalSeconds = 3
    daemon = false
}

That's it.  You can choose to have the IDE auto-build for you, and point at that directory.  But you can also choose not to.  This solution is not tied at all to an IDE.
Comment: Should be noted that there is no requirement to war/deploy here.  Jetty loads classes directly from the build output directory.


Opamp using Transistor Query?

Question: I am finding it difficult to understand how transistors which are transconductors can be used to design an Opamp which is a voltage amplifier. Silly question but has really been heavy on me. Thanks.
Comment: What research have you done so far? Full schematics are available for some of the original op-amp designs.
Comment: I just don't get it when people say they want a low output impedance when it should be a high impedance that we need as it is a transconductance amplifier. Thanks.
Comment: But you can use an output stage consisting (simplest case) of a common collector (or common drain) configuration. Both have small output resistances.
Answer: Your average op amp might look something like this:

simulate this circuit – Schematic created using CircuitLab
That's a very basic two stage op amp: the first stage is built with M1-2-3-4 and is a differential stage, while the second stage is built with M5 and is a sort of common source stage. M6-7-8 just bias the whole thing.
Looking at M3-M4 you can see they form a current mirror, M7 dictates the total current and \$V_{i1}\$, \$V_{i2}\$ produce an unbalancing in the two branches: when \$V_{i1}\$ is higher \$v_{gs1}\$ is lower, \$i_{d1}\$ is lower and it equals \$i_{d4}\$, but from M2 you have some increased drain current. So basically you have more current coming from M2, less flowing in M4, where is the difference going? Not in M5 gate for sure, it flows in the mirror output resistance, that is very high, thus producing a very high increase in the gate voltage of M5. \$i_{d5}\$ would increase but M6 is part of a mirror and he's not willing to let the current increase. Again, this extra current flows in the mirror output resistance thus producing a very high voltage swing on \$v_{out}\$. Please note that the total gain is thus something like (Very High)\$^2\$.
All true analog design engineers, please forgive me.
some notes
In the "analysis" made I've assumed all drain currents positive, that's true only using the "common sense" drain current convention, i.e. positive current flows from top to bottom. Please note that this schematic is very very basic, you'd at least need an RC series from output node to M5 gate to compensate, plus the bias part is omitted of course.
Comment: Without feedback you have near-infinite gain, remember, so the output will be close to one of the rails and the output resistance will be the Rdson of one of the output FETs. (Note that BJTs are transconductance/CCCS but FETs are voltage-controlled devices).
Comment: Thanks Vladimir. I understood the circuit. But I see the circuit as a VCCS with a high o/p resistance not a VCVS with a low o/p resistance which an opamp is normally portrayed. Where am I going wrong?
Comment: Well that's quite a different question I'd say... Normally you don't care much about the output resistance though, speed is more important.
Comment: Still a bit confused. So it is actually VCCS but we use it as VCVS?
Comment: I think your question is nice as is, what you are asking now is quite different. I suggest you to ask another question, answering in the comments is quite a pain.
Comment: @salil87 you're looking at it from an extremely theoretical point of view; are you considering the opamp on its own or in one of the normal feedback configurations?
Comment: ^this. when you close the loop the output resistance drops
Comment: @pjc50 I mean an opamp without any feedback. Just like the one shown in the diagram above.
Answer:
I am finding it difficult to understand how transistors which are
  transconductors can be used to design an Opamp which is a voltage
  amplifier.

An op-amp is a voltage amplifier when negative feedback is applied.
If you had a perfect and theoretical high gain voltage controlled current source and applied negative feedback from output to input then it would become a voltage controlled voltage source.
An op-amp's output needn't be a common collector push pull circuit. Many op-amps these days use a common emitter/source configuration and the open-loop output impedance can be quite high dynamically. It is negative feedback that dictates largely what the output impedance looks like.
Answer: This image from http://www.ibiblio.org/kuphaldt/electricCircuits/Semi/SEMI_8.html#03322.png might be better:

The central construction is a current mirror. At equilibrium, equal currents must flow in Q1/Q3 and Q2/Q4. Changing the voltage at the output will cause a current to flow in or out of it; this imbalance will be corrected by an increase or decrease in current flow through Q2. Hence low output impedance, because large variations in current draw at the output cause a small variation in voltage. If it had a large output impedance, then varying current draw would be able to force the output voltage up and down more.

Opamp using Transistor Query?