Virtualization Pitfalls/Lessons Learned

Question: What are some pitfalls or lessons learned after converting existing hardware to a virtualized environment? Is there anything you tried to virtualize but will never do again?
Comment: Perhaps this should be a community wiki.
Answer: ALWAYS eject any virtual media (CD/DVD/Floppy) once you've finished as failure to do so will often stop a vMotion in its tracks.
Get your NTP and DNS setup correctly, this will save you from contemplating suicide :)
You can never have enough memory, or storage.
Make sure you have remote, OS-less, access to your machines such as HP's iLO system.
Keep a repository of OS/App .ISO files.
Not a direct answer to your question but in the hope that someone saves themselves from tearing their hair out in the future by finding this response - HP blade servers don't ship with their 'VT'-bit enabled by default, you have to enable it in the BIOS (F9). Without this ESX 3.5U4 doesn't throw a useful error, no it just hangs prior to the code install :(
Comment: For HP's iLO, get the big license. The basic license will not give you console access after you bootloader starts. With the basic license you can just powercycle (and connect to serial port), and not much else. A getty on a serial port has nothing on a real console port. (with sparc you get real console on serial though, and Sun's equivalent of iLO has console without extra license).
Comment: It's not just you, I think most processors have their VT enabled by default.  At least the initial panic saves you from needing that cup of coffee!
Comment: +1 for more memory. It seems we're always spinning up new VMs and we have *plenty* of CPU to go around (even with relatively slow 2.3GHz CPUs) but precious little RAM!
Answer: To answer the question as asked - pitfalls related to P2V migrations.
First off - P2V migrations work very well for the most part. The cleaner and newer the systems the better but even with migrating old (NT4 systems) my success rate after more than a hundred migrations in a range of environments has been around 90%. That's systems that have migrated and been handed over to production on the day (well mostly on the night) planned. I've only ever had one system that we had to reverse out of after an apparently successful migration - a SQL box that needed more CPU horsepower than the platform could ever deliver. VMware Converter is good and free (for the non enterprise version), Platespin is very good (but costly).
That said - there are things to avoid.
MSCS Clusters. You can make them work but it's never a great idea and Microsoft will almost certainly not help you in any way if you have problems later. Build new stand alone systems instead.
Large SQL servers - emphasis on large. These should have been red flagged from a CPU requirements POV in advance but don't be tempted to move one if you aren't certain that the target VM will have ample CPU headroom.
If you are planning to change system names or ip-addresses (or both) during the migration then first consider don't doing that and if you absolutely have no choice then make sure you have people on hand who understand how those changes might affect the systems in question. My worst migration ever was an RSA ACE server used for authenticating a DMZ located VPN where the client refused to listen to my objections and insisted on changing both name and ip-address during the migration.
Related to the above - if you have anything other than a completely flat network then build some test VM's and make 100% sure that your VM networks perfectly replicate the physical ones you are migrating from.
In Windows AD environments always make sure you have a local admin account on the box being migrated. And test it before you migrate.
Make sure you have a good idea of how long things will take. P2V copy times will vary depending on available network bandwidth (obviously) but also can be dramatically affected by the number of files in each volume being migrated. This is particularly a problem with Platespin migrating NT4* systems but will affect any P2V software copying at the file level (which generally applies if you opt to resize volumes). Copy rates of 70-80Megabyte a second are possible with GigE networks, relatively fast source and a good target setup but 20-30Megabyte/sec is more typical and for the aforementioned NT systems with 100Meg networks and lots of files I've seen copy rates drop down into the 50kilobyte/sec range.

Ideally you would get rid of these but some people don't have that luxury and getting such an OS of the completely unrepairable hardware its probably running on is almost always a good idea.
Answer:
Have a solid backup strategy in place beforehand. Decide if you are going
to back up the VM as if it were on bare metal, or if you are going to
back up the virtual hard disks on the data stores (or both). Generally
speaking, I found that my required backup footprint increased
significantly at first, so be prepared for an initial spike
where you might be backing up both an old physical machine and a new VM
before you get all of the kinks worked out.
VM sprawl is also something to watch out for. Once virtualization starts  taking off, the urge to move everything to VM becomes great. While this can work, you probably didn't order exactly enough hardware right off the bat.
I think there are machines that can't be converted, and other machines that
probably shouldn't be converted. While it is nice to be able to take a
10 year old physical machine and clone it to a VM, with warts and all,
there are certainly scenarios where you would be better off building a
clean OS and migrating objects from the physical machine over. Sometimes
you are better off not converting over the cobwebs.
Be prepared to use a lot of network ports. If you have systems that run on different VLANS, while single ports could be trunked, you probably want to have individual ports for your VLANs feeding into your vSwitch. If you want redundancy, and you are using iSCSI, you could be looking at a lot of NICs.
Answer: From my experience, be VERY careful about your storage medium. We went with an iSCSI SAN that turned out to only support 100Mbit connections. Running one VM on the system wasn't bad, two was less the adequate... and by the time we reached our target of 8 VMs they were horrible.
My personal lesson learned: Check the rated IOPS and read more reviews about a product that relate to the way you intend to use the storage device
Another handy thing I've learned... Making a 'backup' disk image after a base install and hardening will quicken the build of any other system and is a very handy thing to keep around.
Answer: Try not to run production database servers in a Virtual Environment. The overheads for I/O is unacceptable. We had huuuge problems when our DBA allowed our primary MSSQL server to become virtualised. Queries were taking thousands of milliseconds to run. When we convinced them to move it back to a dedicated box, there was a 10,000% increase in throughput and speed.
Answer: Use redunant network for vmotion/vmkernel traffic. You don't want virtual machines shutting down just because a switch rebooted.
Oh, and leave one DC/DNS/DHCP-server out of the virtualization. Your users will hate you less if you get a major SAN crash.
Comment: +1 for non-virtualized basic network services -- I'd include NIS on that list.  I also like having the central syslog server as unvirtualized, so that if everything dies you have a better chance of figuring out what went wrong.
Comment: Good point, management servers (like Vmware's vCenter) should not be virtualized (yes, it's possible but don't do it).
Answer: VMWare Converter creates virtual machines that boot from scsi.  MS virtual machines cannot boot from scsi.  [edit - apparently version 4 of the converter now lets you specify SCSI or IDE, I love those guys]
If you're going to virtualize a non-ACPI physical machine, buy some software for the purpose.  (unless you have a couple of weeks for an exciting journey in discovery!)
Also, VMWare Converter will tackle jobs at which MS SCVMM will throw up its hands in dispair.
Bring a lot of RAM.
Don't do anything until the virtualization tools (whether VMWare or MS) have installed.
If you're going to move it to another platform/version, uninstall the aforementioned tools.
Mind your CPU limits.  P2V of a 2 CPU windows 2000 taught me that only 1 is supported.

2000 - 1 core
2003 - 2 cores
2008 - 4 cores
Comment: +1 for uninstalling the tools before moving to another platform.
Answer: In case you don't have one already - Have a complete backup of the physical machine prior to the migration. An image is probably best or and an ASR/system restore or whatever that gives you a complete system snapshot, instead of the usual content backup that most machines have.
P2V tools can backfire on you unexpectedly, ruining the physical machine (i had VMWare converter kill a machine i was trying to P2V once, luckily it was just a test migration). Be prepared to have to restore the system from scratch. Yes, this is maybe a 1000 to one chance, but do YOU want to be that one?
Answer: If you're going to use SAN to store your VM images, make sure that you label your devices and hosts VERY CLEARLY.  Removing host-to-disk mappings on the SAN does terrible things if they are still in use by VMs.
Answer: Microsoft won't support Exchange 2003 running in VMware (at least that was the officially response).  With a lot of arm twisting we were able to get some unofficial support from them, but it caused extra headaches in an already stressful crisis.
Answer: A lot of these are VMware specific:

If it performs poorly as a physical machine, it will perform poorly as a virtual machine.
The Cold Clone ISO is your friend
Garbage in, Garbage out. If you're P2Ving older systems they can leave an unnecessary footprint.  See Viewing Ghost Hardware after P2V, Steps Required after P2V, and p2v-scripts.pdf
Make sure your guest operating systems are supported by your P2V software.
Windows 2000 can be a pain regarding SCSI drivers
Answer: Stupid annoyance with VMware: different versions of VMware use different SCSI drivers for their virtual disk devices. It's entirely possible to waste 2 hours before considering that option.
Answer: Well, so far I haven't got any horror stories about myself doing the virtualization.  However, a few notes though.

Planing carefully in details ahead. Especially do some homework what can't be virtualized.
If vendor of the application running on your server doesn't support virtual environment, wait until they support.
Implement w/ a SAN as the storage storing all VM images.
Run ESX or ESX(i), or Hyper-V, to gain most performance.

Maybe more but that's all for now. :)
[update] here is another one. Apply the latest firmware to the host server. I had one that I didn't do, which gave me purple screen once a few days and crashed the server completely.
Answer: Virtualization impact is around 5% of performance of overhead.
Measure resources consumption on existing environnement to determine if your virtualization environnement can take this load.
Before going live with your virtualization solution:

Check that you know how to backup AND restore VM. Using snapshot may not be supported, as on Windows DC
Ask your editor if its solution is supported inside VM. Microsoft maintain list of their supported software inside VM: KB 897613
As it's very easy to create VM, people tends to generate a new VM for every request. Then you have more VM than your solution is planned to support.
Answer:
Is there anything you tried to virtualize but will never do again?

I wouldn't say I'd not try it again, but layered virtualisation is not pleasant to deal with.
By layered I mean running xen or esx on virtualised hardware such as Egenera, HP Virtual Connect or Cisco UCS. It sounds like a good idea, but can be very time consuming to debug.
Answer: In VMWare, know where the snapshots endup.  We had ours configured to end up in the LUN on the SAN with the VM files themselves.  A tech was practicing the Snapshot process on a LUN that was almost full.  Later he rebooted the VM for some reason, and the log files caused the VM to not start.  It was a bit of luck that lead us to the LUN being full as the cause.
Answer: If you go with a dynamically expanding VHD then ensure you go big enough. If you go with 100GB and you end up only using 20... no biggie. However, if you went with 25 then you have some work ahead of you.

Virtualization Pitfalls/Lessons Learned


How can I give players custom names?

Question: How can I give someone on my Minecraft server a custom name that replaces their own username in that game?
Comment: oh nvm my comment I understand now
Comment: for future reference please don't add `(Minecraft)` or `in Minecraft` in the title, that's what tags are for
Comment: @Penguin Ok, thanks for the tip.
Answer: This depends on whether you want to change the name entirely or not.
If so, then no you cannot. However if you only want to add a prefix or suffix, then yes this is possible.
In order to do so, you can create a team using /team create <name> and then modify the team using /team modify <name> <prefix/suffix> <text>. Then add the person to that team using /team join <name> <player>. Doing this you can also make the name coloured.
Comment: we dont have teams

How can I give players custom names?


PDF reader with split screen for Linux

Question: I would like a PDF reader that lets me split the screen so I can see two different parts of the same document. I do not want a split view that only lets me see two consecutive pages.
Comment: "split the screen"?  you mean "display 2 pages at once" or "display 2 pages at once **from different documents**"?
Comment: Updated the question
Answer: evince 2.30 can at least open two separare windows for the same PDF document. Open a PDF file, then choose File->Open a Copy. Now you have the same document in two windows.
Comment: This answer avoids using `K` libraries, since the author asks for an Ubuntu solution (not Kubuntu)
Comment: That is a good hint, I first made a copy of my PDF to open it in a second window :-D
Comment: Same thing with `atril`
Answer: This is a bit of a strange answer, but Konqueror (the default everything-browser for KDE) can do what you want. You see, Konqueror is not just a web browser or just a file browser -- it is a browser for any type of data that there exists a KPart for (where a KPart is some type of component that KDE can understand and embed places -- things like Konsoles, Kate windows, and -- of interest on this occasion -- KPDF viewers).
Thus, because Konqueror has a split view, you automatically get a split-viewable PDF reader for free. Just open up a Konqueror window, split its view, and open up the PDF in each pane. Each can scroll independently of each other, etc.
You'll have some of the basic PDF-browsing features but not some others -- KParts are not meant to be full applications. Thus, you won't (for example) be able to annotate the PDF in Konqueror as you would be able to in Okular, for instance. But as long as you just want basic viewing, this will be enough :)
KParts and all the modularity of the KDE framework allows for some pretty neat stuff, in my opinion.
Comment: +1: Thats a nice solution, but I really don't want to have to install the KDE components just to get a split view of a PDF!
Comment: I can't get it to load using Konqueror. Konqueror just opens the PDF file in acroread. How do I get Konqueror to open this file within itself?
Answer: Emacs 23 (and earlier versions with the separately obtained doc-view.el package) can seamlessly open and view PDF files.  And using the usual split window support (C-x 2) you can display two different parts of the same document in the same window.
I doubt that this is going to be as easy to use as just opening a normal PDF twice, but it definitely does exactly what you ask for.
Answer: If you want to split the pdf in half and see each half in a screen, you can try dspdfviewer.
Answer: This is a kind of hack, but you could run LibreOffice Calc and use Insert>Image... to insert the document. Then use the Calc's splitting feature by dragging the small dark rectangle at the right top or right bottom area of the sheet.
In case your PDF looks like a sheet, you probably cold convert it to get better results. You could use online converter such as ALTO or a Java application called Tabula, for example.
Answer: If you use Google Chrome or Chromium web browser to view your PDF, you could open the document in two tabs and then use an extension such as Split Tabs or Tab Resize to show them at once. Probably there are similar extensions for other web browsers.
Answer: Go to "Window" and select "Split" in order to have twice the same document with the ability to navigate separatly between them ! That simple !
Comment: In what menu are you selecting these options?

PDF reader with split screen for Linux


Clarification about "sons of God" who caused flood?

Question: In Genesis 6:2, it says, "the sons of God saw that the daughters of humans were beautiful, and they married any of them they chose." I thought that the only Son of God was Jesus. Does this mean that Jesus has brothers, or that it  was Jesus, or did it have anything to do with the Trinity being three personalities? Also, why is sons not capitalized? And if they weren't human, why did God decide to wipe out the humans because of them?
Comment: To other potential close-voters: I believe the second question should be closed as a duplicate of the first, for reasons I explain in the comments there.
Answer: I've read two basic answers.

The sons of God were fallen angels (demons) that impregnated women, creating a race of giants. These nephilim are what caused God to finally decide to wipe out an already wicked race* and start over with Noah** and his family.
The sons of God were merely the righteous sons of Seth who intermarried with the (presumably pagan by this time) daughters of Cain. Why this union should produce such noteworthy men (v. 4), and should evidently anger God so, is not clear.

There are no doubt other possible answers but these are the primary ones I'm familiar with.
*v. 7 suggests that ALL flesh the world over - human and animal alike - may have somehow been corrupted, but this is speculative.
**Interestingly, Noah is distinguished as having been "pure in his generations" (v. 9).


Reference for retaining 90% of total variance in PCA

Question: Does anyone have a reference that can be cited where it is stated to retain the number of principal components needed to explain 90% of total variance?
Answer: Even if you find such a publication I think it is a bad rule of thumb. It is better to look at the eigenvalues and look for this characteristic "drop" in eigenvalues. If your first three dimensions explain 35%, 32% and 22% of the variation it is not relevant to include a fourth that explains only 1% to get to the magical boundary of 90%.


Why Atlas does not show all exit nodes Tor connect to simultaneously?

Question: At times Tor connect to several circuits (and different exit nodes) to support multiple protocol simultaneously, In these cases, why Atlas does not show all exit nodes Tor connect to simultaneously? Atlas only shows one exit node regardless of how many exit nodes is being used by Tor simultaneously.
Answer: If you mean the Atlas link on check.torproject.org or on some other page, then the answer is: It links to the details for the exit node that you used to get to the page that the link is on.
This question is related: How can I get a relay's fingerprint?
Comment: 1) You're changing the question.  2) Vidalia is not a web page but a local process that interrogates your Tor client through the control port, using the control protocol.  3) What mapping? You can get a list of circuits, but can you get a list of 'actions' to map?  4) What would it look like? Would each page, frame, image in your browser display an IP or Atlas link in the corner? Then what about requests to 'non displayed' content, like style sheets, scripts, json, etc..?  5) The only real way to know from where you connect to a server is if the server tells you from where it sees you connect.
Comment: Dear jobiwan, How may one observe the circuit used and exit node used for each individual action taken in Tor in the context of using TBB?
Comment: In the related question I linked to, you can find how to see all your circuits. (getinfo circuit-status) I don't think there is a way to see *in the browser* which circuit / exit was used for each individual request.
Comment: Also, it would be very creepy if a web site would know anything more about your circuits than which exit you used to connect to it.
Comment: Dear Jobiwan, Vidalia shows some circuits and exit nodes, but What one needs to know is how to relate each action with each circuit and exit node in a one to one mapping?


What are all the different passwords and passcodes needed to fully setup iOS?

Question: The other day I was surprised to have to remember my restrictions passcode when reseting my iPhone. What are all the difference passwords and passcode needed to fully setup an iOS device? And which ones can be different with different IDs?
Answer: Passcode usually refers to the 4-digit lock code (unless you are using a more complex 6-digits passcode) and password typically refers to your Apple ID password.
Moreover, the password is associated with your Apple ID and is what is used to access Apple services such as iTunes and App Store purchases. It is also used when turning off find my iPhone and iCloud as well as to erase your device and restore to factory condition. The passcode is associated with your device and is used to secure it from unauthorized use.
Answer: These are the ones I know of

iOS Passcode (used for lock screen, approving changes to security settings, Apple Pay, and resetting a device)
Restrictions passcode (Used for locking out apps and features)
Guided Access passcode (I think this is different from the restrictions passcode but I'm not sure)
iCloud account and password (Used for syncing data, iMessage, Find my iPhone)
iTunes/AppStore/iBooks account and password (Can be different than iCloud)
Apple Music account and password
Encrypted iTunes backup (I guess this follows the device around from one computer to another)
Password protected notes in the Notes app.
Comment: As a side note. All of these are currently completely optional to use!


Deriving Graphene energy dispersion in tight binding model

Question: I'm trying to get into graphene, in detail, I try to derive the elec. energy dispersion.
Sadly, I am not that familiar with condensed matter QM by now, so I got some basic questions and I hope to find some answers here.
I considered the two different sublattices A and B. Now i defined some position states $|A_{j}\rangle$ $\in$ $H_{A}$ and $|B_{j}\rangle$ $\in$ $H_{B}$
I'd like them to be orthonormal, so  $\langle A_{i}|A_{j}\rangle=\delta_{i,j}$ and
$\langle B_{i}|B_{j}\rangle=\delta_{i,j}$ .
Completeness: $\sum_{j} | A_{j}\rangle\langle A_{j}|=1$ and  $\sum_{j} | B_{j}\rangle\langle B_{j}|=1$
Siml. for the corresponding k-states $|k_{A_{j}}\rangle$ and $|k_{B_{j}}\rangle$ except some constants mainly set by discrete Fourier transformation, they shall be orthogonal and complete.
Now before going to create a Hamiltonian, I'd like to calc $\langle A_{j} |k_{A_{i}}\rangle$ . In case of a continous |x> this would simply be proportional to $e^{ip_{i}*x}$ . But in this case, my position states are discrete as well aren't they? I am unsure how to solve this, since the known proof for this proportionality depends on contnious x. In fact the whole p-operator is not working in its canonical definition anymore. How do I solve this problem and calculate my scalar product? Thank you very much!
Going on, I created some tight binding hamiltonian for next neighbour jumping:
$H=t*\sum_{j}( \sum_{i=1 to 3} |A_{j}\rangle \langle A_{j}+e_i| +h.c.)$ with $e_i$ being the three translations from an A lattice atom to a net neighbour in B. So   $\langle A_{j}+e_i|$ coressponds to a state from B.
I guess it would be a good idea to express the x-states in k-states and replace them in the hamiltonian and throw them at my k states to calculate expectation values.
But I really don't get how to do it exactly, especially since I got this problem with the scalar product and the continuity described above and since I am not sure how to express this translation getting from an A state to a b state mathematically, so I can calculate a scalar product with a coresponding k state.
I would be very thankful to anyone helping me to understand this topic,
Best Regards
Stefan
Answer:
** As a result, you can find the dispersion by diagonalizing Hamiltonian matrix using the trial solution derived from the equations derived. **
Comment: You can improve the formatting of your post by [edit]ing it to use MathJax; see [this link](https://math.meta.stackexchange.com/q/5020/228959) for a tutorial.


How do you create seed oil in Minecraft Forestry 1.6?

Question: I cannot figure how to extract oil from seeds in order to put it into a can.
Answer: Put seeds or nuts in a squeezer
Comment: The trick is that it needs a lots of seed to extract oil and the adequate container (wax in my case)
Comment: Yes, 50 seeds per bucketsworth.
Comment: Additionaly, if there was another liquid than seed oil in the squeezer you need to empty it in order to squeeze seed oil (by removing/ replacing the squeezer)


how to run a winform from console application?

Question: How do I create, execute and control a winform from within a console application?
Answer: The easiest option is to start a windows forms project, then change the output-type to Console Application. Alternatively, just add a reference to System.Windows.Forms.dll, and start coding:
using System.Windows.Forms;

[STAThread]
static void Main() {
    Application.EnableVisualStyles();
    Application.Run(new Form()); // or whatever
}

The important bit is the [STAThread] on your Main() method, required for full COM support.
Comment: @Kenny according to msdn it always has been
Comment: i use vsCode (not visual studio), so i had to add to my csproj file the following xml: `

Exe
netcoreapp3.1
true
true

`  notice the **Microsoft.NET.Sdk.WindowsDesktop** and the **UseWPF>true** and the **UseWindowsForms>true**
Answer: I recently wanted to do this and found that I was not happy with any of the answers here.
If you follow Marc's advice and set the output-type to Console Application there are two problems:
1) If you launch the application from Explorer, you get an annoying console window behind your Form which doesn't go away until your program exits. We can mitigate this problem by calling FreeConsole prior to showing the GUI (Application.Run). The annoyance here is that the console window still appears. It immediately goes away, but is there for a moment none-the-less.
2) If you launch it from a console, and display a GUI, the console is blocked until the GUI exits. This is because the console (cmd.exe) thinks it should launch Console apps synchronously and Windows apps asynchronously (the unix equivalent of "myprocess &").

If you leave the output-type as Windows Application, but correctly call AttachConsole, you don't get a second console window when invoked from a console and you don't get the unnecessary console when invoked from Explorer. The correct way to call AttachConsole is to pass -1 to it. This causes our process to attach to the console of our parent process (the console window that launched us).
However, this has two different problems:
1) Because the console launches Windows apps in the background, it immediately displays the prompt and allows further input. On the one hand this is good news, the console is not blocked on your GUI app, but in the case where you want to dump output to the console and never show the GUI, your program's output comes after the prompt and no new prompt is displayed when you're done. This looks a bit confusing, not to mention that your "console app" is running in the background and the user is free to execute other commands while it's running.
2) Stream redirection gets messed up as well, e.g. "myapp some parameters > somefile" fails to redirect. The stream redirection problem requires a significant amount of p/Invoke to fixup the standard handles, but it is solvable.

After many hours of hunting and experimenting, I've come to the conclusion that there is no way to do this perfectly. You simply cannot get all the benefits of both console and window without any side effects. It's a matter of picking which side effects are least annoying for your application's purposes.
Comment: I'd also add that to get the terminal output in mono of GNU/Linux an usual window application is enough. I.e. `Console.WriteLine` works always by default.
Answer: Here is the best method that I've found:
First, set your projects output type to "Windows Application", then P/Invoke AllocConsole to create a console window.
internal static class NativeMethods
{
    [DllImport("kernel32.dll")]
    internal static extern Boolean AllocConsole();
}

static class Program
{

    static void Main(string[] args) {
        if (args.Length == 0) {
            // run as windows app
            Application.EnableVisualStyles();
            Application.Run(new Form1());
        } else {
            // run as console app
            NativeMethods.AllocConsole();
            Console.WriteLine("Hello World");
            Console.ReadLine();
        }
    }

}

Comment: actually it does `not` create a second console, because you set the project's output to `Windows Application` first, which is admittedly not what the OP asked for, but much likely what he wanted, because that way you dont have the console window when you don't need it
Comment: -1, creates a second console window and runs the command there. Not what the OP wanted.
Comment: Plus1 to revert that guy's -1 on 2011. Good workaround
Comment: works as advertised, although i'm not getting the application icon and i don't think the "current working directory" is the same -- any ideas?
Comment: "current working directory" is separate issue because I dropped a file onto the exe which apparently changes the cwd.  also found a couple more resources for this approach: [possible issue with debug output](https://stackoverflow.com/questions/15604014/no-console-output-when-using-allocconsole-and-target-architecture-x86) and [a way to attach to existing console or create](http://www.pinvoke.net/default.aspx/kernel32.AttachConsole,)
Answer: It´s very simple to do:
Just add following attribute and code to your Main-method:
[STAThread]
void Main(string[] args])
{
   Application.EnableVisualStyles();
   //Do some stuff...
   while(!Exit)
   {
       Application.DoEvents(); //Now if you call "form.Show()" your form won´t be frozen
       //Do your stuff
   }
}

Now you´re fully able to show WinForms :)
Comment: Works fine! If you need to check for keystrokes, you'll have to check for key availability using Console.KeyAvailable before calling Console.ReadKey, otherwise you'll be blocking the event loop (and thus your forms)
Answer: You can create a winform project in VS2005/ VS2008 and then change its properties to be a command line application. It can then be started from the command line, but will still open a winform.
Answer: All the above answers are great help, but I thought to add some more tips for the absolute beginner.
So, you want to do something with Windows Forms, in a Console Application:
Add a reference to System.Windows.Forms.dll in your Console application project in Solution Explorer. (Right Click on Solution-name->add->Reference...)
Specify the name space in code: using System.Windows.Forms;
Declare the needed properties in your class for the controls you wish to add to the form.
e.g. int Left { get; set; }  // need to specify the LEFT position of the button on the Form
And then add the following code snippet in Main():
static void Main(string[] args)
{
Application.EnableVisualStyles();
        Form frm = new Form();  // create aForm object

        Button btn = new Button()
        {
            Left = 120,
            Width = 130,
            Height = 30,
            Top = 150,
            Text = "Biju Joseph, Redmond, WA"
        };
       //… more code
       frm.Controls.Add(btn);  // add button to the Form
       //  …. add more code here as needed

       frm.ShowDialog(); // a modal dialog
}

Answer: This worked for my needs...
Task mytask = Task.Run(() =>
{
    MyForm form = new MyForm();
    form.ShowDialog();
});

This starts the from in a new thread and does not release the thread until the form is closed. Task is in .Net 4 and later.
Answer: You should be able to use the Application class in the same way as Winform apps do. Probably the easiest way to start a new project is to do what Marc suggested: create a new Winform project, and then change it in the options to a console application
Answer: Its totally depends upon your choice, that how you are implementing.
a. Attached process , ex: input on form and print on console
b. Independent process, ex: start a timer, don't close even if console exit.
for a,
Application.Run(new Form1());
//or -------------
Form1 f = new Form1();
f.ShowDialog();

for b,
Use thread, or task anything,
How to open win form independently?
Answer: If you want to escape from Form Freeze and use editing (like text for a button) use this code
Form form = new Form();
Form.Button.Text = "randomText";
System.Windows.Forms.Application.EnableVisualStyles();
System.Windows.Forms.Application.Run(form);


What does buttermilk do to fried shrimp batter?

Question: I have been using ice water in my shrimp batter and it seems to make the batter too hard after frying them.  Would replacing the ice water with buttermilk make the batter less hard but still crispy?
Answer: Yes, the fat in the buttermilk should result in a slightly softer, less brittle, batter. The exact crispiness will depend on frying temperature and duration of course.


media_handle_upload for local files?

Question: I am creating an image on the server and storing it in a tmp folder. I would like to run a php file that takes this image, stores it in the default media directory structure and attaches it to a post while creating appropriate thumbnails. media_handle_upload seems to require an upload POST request to work with. Is it possible to make it work on a local image in a non-POST context? Thanks.
Answer: You want media_handle_sideload()

Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload().

// Array similar to a $_FILES upload array.
$file_array = array(
    'name'     => 'filename.jpg',
    'tmp_name' => 'path/to/filename.jpg',
);

// Post ID to attach upload to, 0 for none.
$post_id = 0;

$attachment_id = media_handle_sideload( $file_array, $post_id );

Comment: Important to note that your file might get moved from `path/to/filename.jpg` to your uploads folder.
Comment: the file is moved which is a meh but as the function is expected to handle imgase from the tmp dir it is not surprising. On the bright side there is a 'pre_move_uploaded_file' filter that seems to control that

media_handle_upload for local files?


What can go wrong if we let sigma algebra to admit the union of uncountable union of elements?

Question: By definition we only allow the union of countable infinite of elements to be also include the $\sigma$ field, why not uncountable many? Is there a historical view behind this?
Answer: If we require sigma algebras to be closed under arbitrary unions, then any sigma algebra on $\mathbb{R}$ that contained the open intervals would necessarily contain every subset of $\mathbb{R}$.
In particular, things like Vitali sets would have to be measurable.
As a consequence, any translation-invariant measure on $\mathbb{R}$ would have to either (a) be the zero measure or (b) assign infinite measure to finite intervals.
This would make measure theory kind of useless.
Comment: @KennethChen Well, the Borel sigma-algebra on the unit interval is not closed under uncountable union, as has been stressed several times on the page already.
Comment: Thanks! I see your point. Could you please elaborate your definition for "closed under uncountable union?" What would be an example that is not closed under uncountable union?
Comment: A sigma algebra on a set $X$ is, by definition, a subset $\Sigma \subseteq \mathcal{P}(X)$ which is closed under countable unions and intersections.  The question is about changing that definition to "closed under *arbitrary* unions and countable intersections."  So essentially every sigma algebra commonly used would be an example of a sigma-algebra that's not closed under uncountable unions.
Comment: @Did Yes, I got it!
Comment: @DanielMcLaury I got it! Thanks a lot for your kind help and time!
Comment: I'm not sure why that implies the measure is identically zero. You can have measures defined on all of $2^{\mathbb{R}}$ which aren't identically zero.
Comment: @AlohaSine: Fixed, thanks.
Answer: The borel sigma algebra, which is used in many cases, contains every single point of the underlying space as an element. If you'd allow uncountable unions, the borel sigma algebra would have to contain any subset of the space.
However lots of measures cannot be constructed in a way that every set is measurable, a very important example of this is the measure on $\mathbb{R}$ that maps each interval to its length. There is a proof that it cannot be constructed such that every set is measurable.
Comment: To be a little bit more explicit: he means the Lebesgue measure.
Answer: You can show, that it's not possible to construct a measure $\lambda$ defined on all the subsets of $\mathbb{R}$ such that the following natural assumptions hold:

For intervals $[a,b]$, you have $\lambda([a,b])=b-a$.
Translation Invariance: $\forall X\subset\mathbb{R}$ and $\forall t\in\mathbb{R}$ you have $$\lambda(X+t)=\lambda(\{x+t | x\in X\})=\lambda(X)$$
Additivity: For any sequence $(X_i)_{i\in I}$ of disjoint sets in $\mathbb{R}$ you have $$\lambda\Bigl(\bigcup_{i\in I} X_i \Bigr)=\sum_{i \in I}\lambda(X_i)$$

And therefore you need to have some restrictions on your sets (at least if you want to keep the assumptions about your measure, which seems like a good idea)
Counter example (vitali sets):
Define the following equivalence relation on $\mathbb{R}$:
$$x \sim y \quad \text{iff} \quad x-y \in \mathbb{Q}$$
Then, by the axiom of choice, there is a map $f\colon \mathbb{R} / \sim \to \mathbb{R}$ which assigns a representant to each equivalence class. You can assume that $X=f(\mathbb{R} / \sim)\subset [0,1]$ (you can just "add integers").
Now look at $\lambda(X)$:

If $\lambda(X)$ would be equal to $0$, you would have $$\lambda(\mathbb{R})=\lambda \Bigl(\bigcup_{\mathbb{Q}}(t+X) \Bigr)=\sum_{\mathbb{Q}}\lambda(X)=0$$ by the translation invariance and the countability of $\mathbb{Q}$.
If $\lambda(X)=c>0$, you get $$\lambda \Bigl(\bigcup_{\mathbb{Q}\cap  [0,1]}(t+X) \Bigr)=\sum_{\mathbb{Q}\cap  [0,1]} c = +\infty$$ But you also have $$\lambda \Bigl(\bigcup_{\mathbb{Q}\cap  [0,1]}(t+X) \Bigr)\leq \lambda([0,2])=2$$ and therefore another contradiction.


Simulink Floating-Point and Fixed-Point Modeling

Question: I have not used Simulink extensively. I would like to know how to determine if a model is fixed-point or floating-point. Also, how to convert from fixed-point [back] to floating-point. The posts on the internet mostly discuss floating-point to fixed-point conversion. I need fixed-point to floating-point to learn and be able to use both floating-point and fixed-point models.
Answer: The model is fixed point if it contains a single block with the data type setting "fixdt()". If you want to override the fixed-point settings you should go in your Simulink model to Analysis then open "Fixed-point Tool". There you should change "Data Type Override" from "Use local settings" to something else.


Connect External Memory through SPI protocol

Question: My idea is to connect a Chip which doesn't explicitly support external memory but has SPI protocol and I2C. So far I understand I have only 3 pins for SPI. Wasn't able to find an approach (schematics) to connect a flash memory with the 3 pins and should and what other practical problems should I solve to achieve that ?
Comment: Finding a fourth pin for the chip select.
Comment: Depending on your requirements, virtually all SD cards support an SPI interface and are a relatively cheap way to add GB's of Flash memory to a project.
Answer: Generally the explicit external memory support is for accessing external parallel flash and RAM from within the address space of the executing code.  With a chip that supports this, you can run code directly from external memory, create and access pointers in external memory, etc.  There is never anything preventing you from using an external memory, you just won't have as clean of a method of accessing it.  For SPI/I2C memories, you'll have to call functions to access the memory.
It should be relatively straightforward to connect an SPI flash chip.  Just take a look at the flash chip datasheet to see what pins need to be connected where.  Generally you'll have MOSI, MISO, clock, and chip select, possibly with some extra control lines such as write protect.  The extra lines can usually just be tied high or low.  MOSI, MISO, and clock will need to be connected to the chip's SPI controller for maximum performance.  Chip select can generally be driven by any I/O pin, though some SPI controllers can also coordinate the chip select line with dedicated pins and possibly an external decoder chip.


How to make two different frequency square waves stay in sync with each other at all times?

Question:
Is there circuit to make two square waveforms of different frequency be in sync with each other at all times as shown and not drift over time?
Comment: feed the blue signal into a divider to generate the green signal
Comment: In general, no, unless they multiples of the same frequency (which your image is).
Comment: EIther compute the GCD of the two frequencies and provide that GCD value as a base frequency and apply two different DCO multipliers to get the frequencies you want or else compute the LCM of the two frequencies and provide that LCM value as a base frequency and apply two different digital divide-by-N to get the frequencies you want. [This paper from TI](https://www.ti.com/lit/an/snaa294/snaa294.pdf?ts=1656641271525) may also be of some small interest, though I am not sure.
Comment: Sounds like you want something like a phase-locked loop (PLL).
Answer: In the general case, it's called frequency synthesis.
You make a second frequency as a rational fraction of the first.
$$F_{out}=\frac{num}{den}F_{in}$$
In your particular case, if you take the blue waveform as Fin, you could create the green waveform by clocking a divide-by-2 latch on the falling edge of Fin. If you wanted to use the green waveform as Fin, you might use a frequency doubler by closing a Phase Locked Loop around a divide-by-2 circuit, or you could double the frequency directly with logic or RF components.
The subject is vast, and this answer barely scratches the surface. There's a lot of technology (aka knowhow) about the hardware used to make multipliers and dividers, their noise performance, the permissible sizes of num and den and whether they can adjusted in real time. Most FPGAs now contain several dedicated frequency synthesis blocks to manipulate their clock signals, and you can buy complete Direct Digital Synthesis ICs for a few dollars from several manufacturers.
Answer: Short:
Yes, you can. What you want is called phase locking. You need to make the two frequencies based on the same source, otherwise you will never completely get rid of some drift even with the best frequency sources.
Longer answer:
There are different ways to get what you want. In your case where one frequency is an integer multiple of the other one, it's as simple as feeding one frequency into a frequency divider circuit (can be some flip-flops or counters) to get the second frequency.
If the frequencies are a rationale number apart you have several possibilities again:

You can take a higher frequency as your source (in lab equipment you have a 10MHz input somewhere for exactly that) and feed two frequency divider circuits to generate your desired frequencies.
You can use a PLL (phase locked loop) that you feed one frequency and set the multiplier and divider so that you get your desired other frequency.
You can take a common source frequency and use two PLLs to create your desired frequencies. Since you're using a common source, the phases of your two frequencies will be locked automatically.


Default value of PreferredBackBufferWidth and PreferredBackBufferHeight (XNA 4.0)?

Question: If I don't set values into PreferredBackBufferWidth and PreferredBackBufferHeight, window game also display. So what are these default values ?
Answer: Launching various sample apps from XNA 4.0 and VS Express 2010 for Windows Phone, they tend to be 854 for the default width and 480 for the default height. This is probably because the XNA team really wants to focus more on Windows Phone 7 development and an ideal resolution to test WP7 programs is 854x480.


How accurate is bomb calorimeter for measuring nutritional calories of food?

Question: Burning food seems not be accurate for estimating calories in fiber or alochol, but I'm wondering how well it works for other carbs/proteins/fats. Any pointers to literature are appreciated.
Comment: I think you'd probably get better answers asking this in biology.
Comment: lol, I asked that in biology first, and got downvotes, so I moved it here
Comment: Chemistry or Physics perhaps? ;-)
Answer: It seems deceptively simple to just assume a bomb calorimeter  is still used. Manufacturers of these things seem convinced of their utility, naturally.

The original method used to determine the number of kcals in a given food directly measured the energy it produced.The food was placed in a sealed container surrounded by water--an apparatus known as a bomb calorimeter. The food was completely burned and the resulting rise in water temperature was measured. This method is not frequently used today.
  According to the National Data Lab (NDL), most of the calorie values in the USDA and industry food tables are based on an indirect calorie estimation made using the so-called Atwater system. In this system, calories are not determined directly by burning the foods. Instead, the total caloric value is calculated by adding up the calories provided by the energy-containing nutrients: protein, carbohydrate, fat and alcohol. Because carbohydrates contain some fiber that is not digested and utilized by the body, the fiber component is usually subtracted from the total carbohydrate before calculating the calories.
  The Atwater system uses the average values of 4 Kcal/g for protein, 4 Kcal/g for carbohydrate, and 9 Kcal/g for fat. Alcohol is calculated at 7 Kcal/g. (These numbers were originally determined by burning and then averaging.) Thus the label on an energy bar that contains 10 g of protein, 20 g of carbohydrate and 9 g of fat would read 201 kcals or Calories. A complete discussion of this subject and the calories contained in more than 6,000 foods may be found on the National Data Lab web site at http://www.nal.usda.gov/fnic/foodcomp/. At this site you can also download the food database to a handheld computer. Another online tool that allows the user to total the calorie content of several foods is the Nutrition Analysis Tool at http://www.nat.uiuc.edu.
How Do Food Manufacturers Calculate the Calorie Count of Packaged Foods?, Scientific American,  2003.

But it is not prudent to again assume this it. It varies

Calorie Calculation by Country
Calorie Calculations in the United States
In the U.S., there are six accepted methods. The two most frequently used are the 4-4-9 formula and the Atwater method.
4-4-9. In the U.S., most manufacturers use the 4-4-9 method, which assumes that each gram of protein contributes 4 Calories to the caloric total, each gram of carbohydrates contributes 4 Calories, and each gram of fat contributes 9 Calories.
  Atwater. The USDA SR database, in contrast, commonly uses the Atwater method. The Atwater method uses more precise figures based on food type when assigning Calories values per gram to protein, carbohydrate, and fat. Find the Atwater table here.
  4-4-9 adjusted for non-digestible carbohydrates and sugar alcohols.  (Total carbohydrates less non-digestible carbs and sugar alcohols.) For soluble non-digestible carbohydrates, a factor of 2 Calories per gram (rather than 4) is used, and sugar alcohols use specific factors listed in No. 6 below.
  Specific food factors approved by the FDA.
  Bomb calorimetry. This process involves burning a food item to see how much heat it releases, which is directly convertible to Calories since, as we know, one Calorie equals the amount of energy required to heat one kilogram of water by one degree Celsius. Note the adjustment for Calories from protein in the CFR.
  General factors for caloric value of sugar alcohols: Isomalt = 2.0 Calories per gram, lactitol = 2.0 Calories per gram, xylitol = 2.4 Calories per gram, maltitol = 2.1 Calories per gram, sorbitol = 2.6 Calories per gram, hydrogenated starch hydrolysates = 3.0 Calories per gram, mannitol = 1.6 Calories per gram, and erythritol = 0 Calories per gram.
For more information, see the U.S. food labeling regulations here.
Calorie Calculations in the European Union
The declared values in the nutrition table are average values and must be based on:
Total value. A calculation from the known or actual average values of the ingredients used.
  Known data. A calculation from generally established and accepted data.
  Estimates. (The same concept as 4-4-9 and 4-4-9-7) The energy value to be declared shall be calculated using the following conversion factors:
<code>carbohydrate (except polyols): 17 kJ/g (4 Cal/g)
polyols: 10 kJ/g (2,4 Cal/g)
protein: 17 kJ/g (4 Cal/g)
fat: 37 kJ/g (9 Cal/g)
salatrims: 25 kJ/g (6 Cal/g)
alcohol (ethanol), 29 kJ/g (7 Cal/g)
organic acid: 13 kJ/g (3 Cal/g)
fibre: 8 kJ/g (2 Cal/g)
erythritol: 0 kJ/g (0 Cal/g)
</code>
For more information, see the EU food labeling regulations here.

The overall accuracies of such measruemnts with a bomb calorimeter  is actually a frequent question:

The  calorific content is measured with a device known as the bomb calorimeter. A sample of food is placed in an airtight chamber - the 'bomb' - which is filled with pure oxygen and then placed in a tank of water. The food is ignited by an electric spark so it completely burns up. The temperature increase in the water is measured and the actual energy content of the food can then be calculated, either in old-fashioned calories or more modern joules. This method is not completely accurate, as it is rather crude when compared to the way the human body uses food. For example, proteins are completely burned up in the bomb calorimeter, whereas in the human body some of them would be used not for energy but for the production of things like skin, hair, mucus and muscle tissue. Incidentally, the subject is well covered in most biology textbooks for A-level and above, as well as in the occasional Open University programme on television.
The four sources of food energy - protein, fat, carbohydrate and alcohol - yield 4, 9, 3.75 and 7 calories per gram respectively. The calorie value of a food is usually estimated by multiplying the protein, fat, carbohydrate and alcohol content by the appropriate factors. Many food manufacturers do not carry out chemical analyses but instead estimate the calorie content using values for ingredients derived from tables published by HMSO. Such calculations are normally within 10 per cent of the actual value.
How do food companies work out the number of calories in their products?

More detail can be found in this Food energy – methods of analysis and conversion factors, FAO FOOD AND NUTRITION PAPER, 77, Report of a technical workshop Rome, 3–6 December 2002.
In summary, bomb calorimetry gives very precise values for caloric content. But we need for nutritional analysis calorific content.


Preventing booting from unwanted/upgraded partition in Android

Question: As I understand in Nougat and greater the system has two full partitions, one currently used and the second one that is used for upgrading. So during an upgrade the new bits are laid down on the secondary partition which will be made the primary to boot from the upgraded partition. My question is how does it prevent from booting from the original partition? Where is the information that determines which partition to boot from written/stored? How does it prevent an attacker from modifying it?
Answer:
From AOSP A/B (Seamless) System Updates

Call update_engine with the HTTPS URL for your update package....
... If the update is applied successfully, update_engine will tell the bootloader to boot into the new OS on the next reboot....

(Emphasis Supplied)
So, you are looking at action being taken at boot loader level. And if you mess at that level dm-verity will kick in which is a kernel level protection that can't be tampered with once device leaves factory

If verification fails, the device generates an I/O error indicating the block cannot be read. It will appear as if the filesystem has been corrupted, as is expected.

With a custom recovery dm.verity can be disabled but then OTA will fail because it detects recovery change and frankly, if an attacker  can gain root access, the device is pretty much their's
Edit: See this for more details
A/B (Seamless) update device questions


Mutual fund wants to get 1% upfront fee (US). Is that within acceptable ranges for a managed bonds fund?

Question: Mutual fund wants to get 1% upfront fee (US) plus an annual fixed fee. Is that within acceptable ranges for a managed bonds fund?
Comment: "Acceptable" is pretty subjective.  I'd personally be really hard-pressed to justify paying any front end fees.  If it's a long-term investment and the front-end fee buys you a sufficiently lower expense ratio, though, it might be worth it.  Most funds that have a Class A option (a fund with a front-end fee) have other classes that don't have that fee (though they'd generally have higher fees elsewhere).  https://www.investopedia.com/articles/mutualfund/05/shareclass.asp#targetText=Although%20mutual%20fund%20companies%20can,has%20various%20benefits%20and%20consequences.
Comment: What could you gain from this mutual fund that you couldn't from the myriad of funds with no upfront fee as well as low annual fees?
Answer: "Front loaded" (and the inverse "back loaded") Mutual funds used to be very common.  They were mostly replaced in the 1980s by no-load mutual funds from places like Vanguard.
I've got a managed no-load bond fund through Vanguard, and it's management fee is 0.09%.  According to its web site, the average management fee for similar funds is 0.74%.


Pi 4 B SD boot interrupted when ethernet is disconnected

Question: My goal is to use a Raspberry Pi headless and control it with VNC over wifi. It's a model 4 B with 8 GB RAM, running 64-bit bullseye. It's configured as a routed wireless access point using hostapd and and dnsmasq. It's also configure as a Stratum 1 time server using gpsd and ntp.  With ethernet connected, all works as desired, although the only way to get my desired screen resolution of 1920x1080 in VNC is to use an HDMI dummy plug (screen resolution is not the issue I'm attempting to deal with in this question). If ethernet is connected, it will boot fully. If ethernet is disconnected it stops at "NET_BOOT  wait for link TFTP: 0.0.0.0". This seems to me to indicate that it has failed to boot from SD. SD boot is first, USB boot is second and network boot is third in the boot order. If I connect ethernet while the NET_BOOT line is displayed, it will resume boot to successful completion from SD.  If I allow it to retry network boot before connecting ethernet, it will progress to USB boot. Then, when I manually exit USB boot (I don't recall the button I clicked) it boots to successful completion from SD.  If I wait for about 20 minutes without intervening, it boots to successful completion from SD. The line immediately preceding the NET_BOOT line says "HID error 1"; this error shows each time it boots, whether successfully or unsuccessfully. I find no questions here discussing failure to boot when ethernet is disconnected.
Comment: Does this answer your question? [Screen resultion when using VNC / headless](https://raspberrypi.stackexchange.com/questions/133764/screen-resultion-when-using-vnc-headless)
Comment: @Milliways that does not help.  The final comment in that thread (as of 3/29/23) describes my experience--the only way to get 1920x1080 is to use an HDMI dummy dongle.  I discovered that it hangs at the NET_BOOT line whenever ethernet is disconnected, even when an HDMI monitor is attached.  I'll modify my question to reflect this.
Comment: Have you ACTUALLY tried setting VNC resolution? It works fine for the rest of us. Your question is lacking any evidence and seems to be conflating 2 issues.
Comment: @Milliways, please see my comment above.  The issue is that it will not boot if ethernet is disconnected.  Period.  VNC is now disabled.  I need to modify my question.  No evidence?  I've described my problem as best I can,
Comment: @Milliways, I'd like to add that I made it clear in my original post that my concern was that the system wouldn't boot, which is clearly different from any other post regarding VNC screen resolution.  All other information I provided was to give as complete a picture of my system as possible.  You chose to zero in on one bit of information and disqualify my question on that basis.  This is disappointing.
Answer: A suggestion found here seems to have fixed the problem. I edited the EEPROM config using this command:
sudo -E rpi-eeprom-config --edit

and added the following two lines:
NET_INSTALL_ENABLED=0
NET_INSTALL_KEYBOARD_WAIT=0

The system now boots to completion faster than it has to date. The second line added to the EEPROM config has resolved the HID error I mentioned in my original post.


Tensor product operator

Question: Let $T: E_1\longrightarrow E_2$ be a bounded linear operator and  $T\otimes I:E_1\otimes \mathbb{K}\longrightarrow E_2\otimes \mathbb{K}$ be a tensor product operator
,  where $E_1, E_2$ be Banach spaces and $I$ is the identity map on $\mathbb{K}$ and $\mathbb{K}$ be scalar field. Does $T\otimes I=\:T$?
Answer: It is not properly an equality, because they are different objects. But they are "equal" in the same sense that $E_1$ and $E_1\otimes\mathbb K$ are equal: for any $x\in E_1$, $k\in\mathbb K$, you have
$$
x\otimes k=kx\otimes 1.
$$
Similarly,
$$
\sum x_j\otimes k_j=\sum k_j\,x_j\otimes 1=\left(\sum k_jx_j\right)\otimes 1.
$$
So there is a very natural identification of $E_1$ with $E_1\otimes\mathbb K$. Under this identification, $T$ is mapped to $T\otimes \text{id}$.

Tensor product operator


Google chart API vs analytical report chart

Question: I have created bar charts in salesforce using google chart api and they work fine. I have also created charts using reports and dash boards in salesforce. Displaying the charts in visualforce by using 'analytics:reportChart' is taking too long to load the chart. So I am using apex:iframe and dash board image url to display it in the visualforce page. So my question is, between google api charts and analytics:reportChart which is better ? and why analytics:reportChart takes so long to disaply ?. Is there a way to make it load fast ?
Comment: FYI, there is also the option of using an apex:chart. That avoids the cost of calling out to Google but is otherwise similar, so I'd argue it is better. (It requires you to have calculated the values just like Google charts does.).
Answer: Not to discourage you but I gave up on VF charts after I couldn't get Visualforce pie chart to start at "12 o'clock" to work.
I guess you could experiment with caching of whole VF page? http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_page.htm, cache and expires attributes.
Other than that - generic tips & hints for improving performance of Visualforce? Check the viewstate, fire up developer console, check browser's console for JS error messages, stop using Internet Explorer... ;)


Shouldn't first posts / late answers already offer the low quality post auto-comments?

Question: If a first post or late answer is deemed bad, I feel flagging it as low quality is the correct step. But the post then ends up in the low quality posts queue, and only there the deletion-comment can be selection. Wouldn't it be better if one could select this comment already when flagging for low quality in order to simplify the reviewing process for the low-quality reviewers?
Answer: It would complicate Stack's software. You need far less reputation to review first posts and late answers than you need to cast low quality close votes. Making it possible in one place for higher reputation users would be nice, but is it really worth the effort? I like your idea, I just don't see it.
Comment: Ah, I didn't think about the different rep requirements for those queues. Nonetheless, it _might_ be helpful to those reviewers to see a more specific reason proposed by the flagger as to _why_ the post is low quality, and not having to manually type one of the standard-comments would (slightly, if we're honest) increase the chance that the OP would actually realize their mistake even before the low quality flag were reviewed.
Comment: I see your point there, though the question whether actually implementing this is feasible is up to the SE team. If they actually notice this question...
Comment: @TobiasKienzler well, that's why I upvoted your question, right? Anyway, as an user I don't like bugs that follows changes, and as a developer I tend to expect them, especially when recent changes are fresh.
Comment: @TobiasKienzler I agree from UX point of view, but when I think about code complications and possibly needed refactoring, well, I guess you know how problematic it may be, especially right after huge closing system changes, when it might be not yet be fully debugged as is.


How do I send long PUT data in libcurl without using file pointers?

Question: I'm trying to interface with the Google Contact API, and in order to update a contact on the remote side, I need to use a PUT request instead of POST.
Since the data I want to PUT is already in memory, I really don't want to deal with file pointers, which seems to be the default behavior of CURLOPT_READDATA. Thus, I understand I need to use CURLOPT_READFUNCTION in addition to that but I'm failing to understand the logic.
Here is the relevant doc: http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTREADFUNCTION
Printing the variables passed in, I see nmemb=16372 and size=1. If my data is going to be of size 100K, for example, what is the logic that I need to implement?
Thank you.
Answer: You will still want to use CURLOPT_READDATA, however if you use CURLOPT_READFUNCTION, it can be any user-specified pointer.  You can create a simple structure like:
struct put_data
{
  char *data;
  size_t len;
};

where data is the PUT data and len is the length (remaining).
Then, set CURLOPT_READDATA to a pointer to an initialized instance of that structure.  You will be passed it in CURLOPT_READFUNCTION as userdata.  In that function, do something like:
size_t curl_size = nmemb * size;
size_t to_copy = (userdata->len < curl_size) ? userdata->len : curl_size;
memcpy(ptr, userdata->data, to_copy);
userdata->len -= to_copy;
userdata->data += to_copy;
return to_copy;

This basically figures out the amount to copy, copies it, then updates the length and pointer.  On the to_copy line, we calculate the minimum because were are bounded by both the amount remaining and the size of curl's buffer.  Finally, we return the number of bytes copied, as required by curl.  When you're at the end of content user_data->len (and thus to_copy) will be 0.  Nothing will be copied and returning 0 ends the transfer.
Comment: Exactly what I was looking for. Things make sense again. Thank you for saving my sanity.
Answer: THIS is the right way to do it.
One more thing to keep in mind is that you MUST set the FILE SIZE:
curl_easy_setopt(curlHandle, CURLOPT_INFILESIZE,(curl_off_t)putData.size);

Otherwise your server might throw an error stating that the request length wasn't specified.
putData is an instance of the put_data structure.


Is there a name for the meetings between kings and peasants?

Question: In the middle ages, or in fiction, when the king holds a ceremony of sorts to meet with commoners and disscuss their issues one by one, is there a word for that, or a common name that could be assosiated with this "meeting". Or can anyone think of anything that would sound good?
Comment: Look up definitions and synonyms of council, assembly and symposium.
Comment: Also look up "petition"--they have petitioned the king, as I recall, and he is seeing those he has agreed to see.
Answer: Audience (MWD)

a formal hearing or interview an audience with the pope
Answer:
In the middle ages, or in fiction, when the king holds a ceremony of sorts to meet with commoners...

I stand to be corrected, but I can't think of a time when this happened. Why would a king do such a thing when the peasants were his possessions? He wasn't looking for votes or popularity. As a consequence, there is probably no word for it.
That said, there was a thing called a moot:
OED

1.a. A meeting, an assembly of people, esp. one for judicial or legislative purposes. Also: a place where a meeting is held. [Chiefly associated with organs of national and local administration from the Anglo-Saxon to the early modern period (cf. gemot n., witenagemot n.).]
c1175  (▸OE)    Ælfric Homily (Bodl. 343) in S. Irvine Old Eng. Homilies (1993) 37   Heofene rice is ilic ane kynge, he ðe hæfde mot wið his men.

but the lower orders would certainly not be there.
Comment: @equin0x80 The problem is that as this never happened in real life in England, there is no English word for it. In fiction, the situation is always described in a clause or two - there is no word.
Comment: Perhaps it's only in fairy-tales (or certainly the "Arabian Nights") but I've read numerous stories where the hard-done-by peasant was able to approach the monarch and request justice (presumably because there wasn't any meaningful judicial system at the time). Not an "assembly" but rather one-on-one.
Answer: An address. The king addresses his subjects?

address noun [C] (SPEECH)   a formal speech
address verb [T] (SPEAK TO)   C2 formal to speak or write to someone
Comment: Nice answer! Could you maybe add a definition and link the dictionary you got it from, and also explain _why_ that's a good word for this?


How do city walls get repaired?

Question: Let's say I lay siege to an enemy city and bombard it, reducing the defences to 20%. Then for some reason I go off to do something else. If I later come back to that city, will its defences still be 20%? Will they ever go back to their full amount? If it's my city, is there anything I can do to get that defence back up?
Comment: @DJClayworth, Raven's correct.  I've linked a source in my answer.  The percentage you're seeing there is determined by the city's culture, and I believe it also takes buildings (ie, city walls) into consideration.  It does not include tile defense or unit promotions, if I remember correctly.
Comment: Are you sure you're not referring to a city's culture defense? Slightly different from the Walls building. Walls can't be bombarded, as they're buildings.
Comment: I'm not sure about that. In fact, although I've been playing Civ 4 for years, I wasn't aware of the culture defense bonus.
Comment: I'd really appreciate a detailed analysis of how it works. It seems to me that if the city defense includes factors for walls, then it depends on what unit is attacking (gunpowder or not).
Comment: @DJClayworth, ran some tests and edited my answer.
Answer: Yes, city defenses heal over time.  If you bombard a city and lower its defense, and then leave it alone for a while, the damage will be repaired as turns pass.
Base city defense is a factor of the city's culture.  (see "How do I increase my city's defense" in this Civ4 FAQ) If you increase the base city defense with things like City Walls, then the maximum amount of city defense increases.  If you bombard the city enough, the defensive bonus from city buildings/wonders will be lost, but the building/wonder will not be destroyed.  Eventually, the city will heal its defenses back to the maximum.
The defensive bonus for the city is calculated as follows:

For each culture level the city has, gain 20% up to a max of 100%
If walls/castle are present, and the normal maximum defense is less than the amount this improvement specifies, replace it with the defensive bonus for the improvement, so long as a pre-gunpowder unit is selected.
If Chichen Itza is in effect, add 25% to the city defense percentage

I tested this by rushing gunpowder and building walls in a city that normally would have 40% city defense (ie, culture level 2), then gifting the city to an enemy player and declaring war.  I could toggle between highlighting my longbowmen and my musketmen, and the defensive bonus would be 50% when the longbowmen were selected, and 40% when the musketmen were selected.
I believe the applied defensive bonus for units in a city is the combination of the current city defense rating, plus the defensive rating from the tile, plus any modifiers that the unit has (ie, a defensive unit with the City Garrison ability).  Even if you take the city defenses out of the equation, you'll still have to contend with those other bonuses.
I believe Spies can influence this as well, although it's been a while and I can't recall what was in the base game versus what was added in the expansions.

How do city walls get repaired?


How do I take payments via Ubercart and distribute them to vendors?

Question: I'm working on a site that needs to take custom payment and remit a part of it to one or more vendors that are determined by the products purchased (the vendors essentially create the products themselves in the shop). I have seen Ubercart Marketplace as a possibility for this, but it's rather old. However, it's the closest to what I need. Should I go with it or is there a better, more fully-integrated solution in Drupal (that uses Ubercart) that I should investigate?
Comment: Why was this question downvoted?
Answer: This is outside Ubercart, but it's definitely possible with Drupal!
For this demonstration, I will use a point system. Let's say 100 points = $1.00.
Drupal 7 method:

Create a content type, called Products.
Install a Drupal module, called Entity Reference and add an Entity Reference field to the Products content type, select users. This will allow you to reference the product to vendors.
Create another content type, called Points. Also add an Entity Reference field to it, and select type as users, to reference users. In addition, add a decimal field (amount).
Install another Drupal module, called Rules
Create a rule that would, after a certain time (30 days, etc...) from the sale date, create a Point node with that User referenced and add the commission earned.
Create a rule, that would unpublish the Point node anytime the payment is withdrawn.

Another option is to use the Relation module. It's more work and still in early stages.
By creating a Point node for each commission, you're leaving all records of transactions. I would never overwrite the old commission value with new commission, i.e. $user->payment = $user->payment + 10. It will mess things up.
You can still use Ubercart with this, as it uses Drupal's entity/field structure. Simply skip #1 and use Ubercart's product content type.
Comment: I am using Drupal 6, and I already know how to associate the product with a vendor. It is the actual mechanism of the site acting as intermediary for payment between the customers and the vendors that has me stumped.
Answer: I would recommend that you go with Ubercart Marketplace for Drupal 6.x, especially if you need vendors to create their own products and have their own set of permissions to edit products, publish products, ship to vendors and/or get sales reports. I've used Ubercart Marketplace with some of my own customizations and patching (especially in the payment and reports area) but overall it does the job and in my opinion it will take a lot more if you build this functionality from scratch or try to bundle several other modules.
If you need to automatically split the payment as you get orders then take a look at Amazon Flexible Payments which lets you splits payments and has a very flexible API to do whatever you need.
Comment: So I actually did wind up taking this approach, although Ubercart Marketplace wasn't nearly enough. http://drupal.org/project/amazon_fps, http://drupal.org/project/uc_amazonpayments, http://drupal.org/project/mp_amazon_fps were born from this...so I guess thanks indirectly for making me contribute a bunch of stuff! (sponsored, fortunately)


Remove music from my iPhone

Question: My daughter's music appears in my iTunes on my Iphone only...not any other devices. If I remove these from my phone will she still be able to access the music on her device?
Comment: Do you share an Apple ID?
Answer: So it sounds like the music is on your iPhone and no other devices?  How does your daughter access music if it is not on her device?
If you have the music saved to your daughters device, then it should not matter if you delete it off of your phone.
For example, most of my music is on my MacBook Pro - I can add or delete music from my phone at will but that does not mean I lost my music because it is still on my MacBook.  I can listen to anything that is on my phone, or, with Internet connection, I can listen to anything I may have on the cloud as well.
This is my understanding, anyway.

Remove music from my iPhone


How does a 4-Acceleration (gravity, for example) get turned into 3-acceleration (falling)?

Question: I understand that spacetime is curved in the presence of a stress-energy tensor. I also understand that, for the example of Earth, most of that curvature is in the time-time direction. At the surface of Earth, the 4-acceleration, in coordinates of $\{t,r,\theta,\phi\}$, can be represented as:$$\boldsymbol{A}=\{\frac{9.8}{c},0,0,0\}\space m\space s^{-2}$$What is less clear to me is how the acceleration in the $t$ dimension is turned into an acceleration in the $r$ dimension. That is, how does an acceleration in time get translated into falling towards the center of gravity? I've seen videos on time-dragging, but I've not seen any mathematical formalism.
Comment: Not sure if I understand the question because we are staying on the surface of earth and don't fall towards the center of gravity. If we did there would be a small three acceleration that would exactly offset the term $9.8/c$. In free fall the four acceleration has zero Lorentz length.
Comment: I never said we are 'staying' on the surface, I said 'at the surface'. Imagine you're Wiley Coyote and you just stepped off a ledge. What happens to your velocity in the $r$ dimension? Why does it increase when the component of $r$ in the 4-acceleration is zero?
Comment: Does this answer your question? [Why would spacetime curvature cause gravity?](https://physics.stackexchange.com/q/102910/)
Answer: On the surface of the earth the four-acceleration is in the radial direction, not in the time direction. So in SI units it would be $(0,9.8,0,0)$ or in units of light years and years it is about $(0,1,0,0)$. For an object with constant invariant mass the proper acceleration is always spacelike (or 0).
To see this, recall the definition of the four acceleration: $$A^\mu = \frac{d}{d\tau}U^\mu + \Gamma^{\mu}{}_{\nu \lambda} U^\nu U^\lambda$$ so for an object at rest on the surface we have $U=(1,0,0,0)$ and thus only the $\Gamma^{\mu}{}_{tt}$ Christoffel symbols are relevant.
In Schwarzschild coordinates the only tt Christoffel symbol (p. 18) is $$\Gamma^r {}_{tt}=\frac{c^2 R(r-R)}{2 r^3}$$ so the four acceleration is purely in the r direction
Answer: Acceleration is not a property of points in spacetime, it is a property of trajectories in space time.
The 4-acceleration you wrote is that of an observer in a trajectory that is staying at the same point on the surface of the earth. On the other hand, you are asking about the acceleration of an object that is free falling - namely, following a geodesic line. However the 4-acceleration of a geodesic line is by definition zero - this is a manifestation of the famous equivalence principle.
The quantity you are asking about  - the coordinate acceleration in the $r$ direction of a free falling observer, namely $d^2 r/dt^2$  - is a different thing,  that you can find by solving the geodesic equation. For a radially free falling observer in the Schwarzschild metric this turns out to be just $\ddot r = -M/r^2 = -g$ (just like in the Newtonian case, except here $\dot r = dr/d\tau$)


Can I safely install a bare bone Unity Shell in elementaryOS 0.4?

Question: I will be removing Ubuntu from my system but I would like to keep Unity shell in my system. As the other distro I use is a Arch distro so Unity can't be installed there. So can I install a bare bones Unity 7 shell in my elementary OS 0.4 ????
Comment: If you want to use Unity you might want to reconsider removing elementary OS and keeping Ubuntu instead.
Answer: Installing another desktop environment on elementary OS will probably break things. The elementary apps are designed for GTK+ and Granite, and they may not work properly under Unity. Additionally, I don't believe that Pantheon Greeter provides a way to choose your desktop environment at login. [Edit] I may be wrong about that last part - see the comment below!
See also: this comment on installing the Budgie DE.
If you'd still like to proceed, I'd recommend setting up elementary on a virtual machine and trying to set up Unity there before trying this on your primary OS.
Comment: I would like to make a argument that LightDM allows choosing of session during login and Pantheon Greeter also does. I can say it because the Ubuntu 16.10 installation that I will be removing has Unity, Cinnamon and Pantheon installed with Pantheon Greeter being the default for LightDM.
Comment: Interesting, thanks for the heads-up! How does one choose a DE from Pantheon Greeter?
Answer: Do you mean the terminal emulator? if so ubuntu use's gnome-terminal? or do you mean install a just ubuntu system with no xserver? "Unity" is the desktop flavor along with the display manager that it comes with im not sure what a unity shell is.


How to store a bike outside and still avoid rapid decay?

Question: I've got insufficient space to store my bike inside. I fear however that it will rust away within a few years if I store the bike outside. My question is twofold:

Will storing a bike outside be a problem?
What can I do to prevent rust and possibly other types of decay?
Comment: Where do you live - what kind of weather is the bike exposed to ?
Comment: what space do you have outside?
Comment: @Kevin: My bike will stand in the rainy Belgian climate.
Comment: @Ian: I'd like to put it in the garden alongside the house.
Answer: A small shed seems like the best option if you have space–some insulation inside the shed would help stop condensation.

A bike kept outside will rust given enough time, its gears, etc. will also not like being wet all the time.  Just as importantly, it is more likely to get stolen if it is just left outside, and I would always rather get on a dry bike than a wet/cold bike.
Comment: Depending on the budget (at least $400 to $500), a bike shed seems like a great option. If you have a lower budget and redneck tendencies, you could alternatively try to find a run-down van for a few hundred dollars on Craigslist. :)
Comment: If you have some basic carpentry skills and some tools, it might not be difficult to build a small shed out of plywood/MDF  for a lot less than they charge for the prebuilt ones.
Answer: A tarp that fully covers a bike can provide some insulation and keep out precipitation. Don't buy a "bike cover"; they're overpriced, thin, and non-customizable.  For an average-sized bike, an 8' by 10' (2.4 m by 3 m) tarp is enough to just reach to the ground. A weight of around 6 oz per square yard (0.2 kg/m²), or a thickness of around 8 mils (0.2 mm), seems to be ideal (standard tarps are around 3 oz per square yard (0.1 kg/m²) and 5 mils (0.13 mm) thick). In theory, silver colored tarps reflect more infrared than other colors and are better for insulation, but I'm not sure how much of a difference this makes in practice.
One of the most important things to look out for in a tarp is that the grommets are spaced no more than 18 inches (46 cm) apart. You can bunch up all of the grommets along each short end of the tarp and use cable ties to semi-permanently join these grommets. This gives the tarp a fitted shape and makes it fit nicely around the wheels. A good starting point is joining all of the grommets along each short end to a single point. Once you've tried this, you can experiment with tying grommets together in various configurations with cable ties to see if you get a better fit for your bike. You can also tie grommets to a bike rack, which can make it easier to get the bike in and out if you're riding it daily.
The following picture shows a fitted tarp on a bike. On the near side, the four middle grommets are tied together at a point, and the remaining two grommets (at the corners) are tied at a point just below. On the far side, all six grommets are tied together at a point and tied to the bike rack. The long sides of the tarp in the picture are folded in a bit; without folding, they just reach to the ground. With grommets spaced 18 inches (46 cm) apart, you have flexibility to customize the fitting.

In summary, if you get a tarp, get one with the following specs:

8 by 10 feet (2.4 m × 3 m)
at least 6 oz per square yard (0.2 kg/m²) or 8 mils (0.2 mm) thick
grommets spaced no more than 18 inches (46 cm)
silver color (?)

and then tie grommets together with cable ties to give it a fitted shape.
EDIT:
As I've been using this for a while, I've noticed that air flow doesn't seem to be much of a problem in practice, so I usually let the sides of the tarp reach to the ground. The tarp is stiff enough that there are always a few small openings where air can get in and out but water can't.
Comment: It's important that the tarp NOT be tightly sealed, but be relatively open at the bottom to allow air circulation.  The tarp is only to prevent rain/sun damage, and air needs to circulate to allow the condensation that will inevitably occur to escape.
Comment: post a picture or link to picture, pls
Comment: I use these on my bikes as they're stored on a balcony. On either end there's a velcro strap so I can lower the tarp down over my bike and secure it with velcro through the spokes or frame so it doesn't blow away.
Comment: @BrianNickel, that seems about right, though you'll want to leave in a bit of slack. Since tarps only come in so many sizes anyway, you can just try one, and if it doesn't work, go one size bigger or smaller.
Comment: @DanielRHicks: That's a good point. It's hard to ensure that the drive chain is protected from the elements but that air circulation is maximized. It's important, though.
Comment: @memnoch_proxy: Done. Thanks for the suggestion.
Comment: Yeah, you want to minimize splashing from the ground up onto the drive train.  Ideally hang the bike, and, if not, place it on slats and/or use gravel or wood chips below to prevent splashing.
Comment: I like it. Ground splashing is a good point. That might be aliviated by placing the tires of the bike on the tarp as you start to cinch it up, then at least you could cover the drive side for the bike.
Comment: @memnoch_proxy: that's true, but wouldn't that also limit air flow? Any ideas of how to help address both splashing and air flow?
Comment: @amcnabb cinch it loosely, leave at least a few inches open at the front and back. If you want a form to cinch the tarp around, use the top half of a milk jug. At some point, the bike needs to get maintained, and also, it's likely going to be left out in the elements when parked street-side during a shopping trip. I don't see airflow under a tarp as real problem.
Comment: ynnekkram, adding velcro straps is a cool idea. Thanks for mentioning this.
Comment: I added SI units but I had never heard the unit *mil* before.  Did you indeed mean a "milli-inch" as Google and Wikipedia suggest?
Comment: @gerrit cheers for adding SI units.
Comment: Can you go a bit more into how you decided dimensions for the tarp?  I'm looking to cover an Xtracycle which is both longer than a typical bike but also considerably wider in the framed back section.  Is length simply a matter of bike length + front height + rear height, and width a function of maximum(2 * height + width) ?
Comment: Awesome, thanks!
Answer: Lube and wax.  I know there are bike polishes that probably have wax, but I'd get the paste car wax that comes in a can.  Really clean the bike, then use the wax on your frame, seat post, fenders (especially inside where they take a beating from road grime while riding), exposed metal, but NOT your rim braking surfaces.  Put good lube on your chain.  One guy I know who does a lot of randonneur riding in bad weather (brace yourself, this is a bit extreme) strips his chain of grease and grime, then dips it in melted paraffin.  After it cools there are excess chunks of wax, but they drop off quickly.  The point is he gets wax inside the pin bushings, which keeps his chain fairly water-resistant.  Really lube your cables, or even better get teflon-coated cables.  Your might want to put a cover on your saddle and handlebars, just watch out for condensation forming inside the covers which would defeat the purpose.
Answer: If the bike has a steel frame, make certain to be extra-vigilant about sealing any nicks or scratches in the paint. Steel will rust when exposed, given long enough.
Comment: A Quality Steel frame will out last the aluminium components in damp environments.
Comment: And the cables, shifters, and bearings are far more susceptible to weather damage than is a steel frame.
Answer: I use the yardstash bike storage tent. Held up well for a year so far and ventilates to keep my mountain bike dry and rust free,
Comment: Looks like a good solution, but I wonder how you would secure the bike when it's in the tent.  Since it fully encloses the bike, you couldn't lock it to anything, and the tent is only secured by a zipper. I guess if you have an enclosed yard with a high enough fence it would work.
Comment: I don't use it but there's a flap in the back so you can run a chain into the tent and lock your bike to an external object. I keep my bike on my balcony so no need to secure.
Answer: Tarp sounds a good idea as the ready made covers seem to not have waterproof seams. Critical thing I wanted to mention is this: make sure your bike and cover are both bone dry before putting the cover on. If the bike is wet, a cover will CAUSE corrosion. A bit of moisure on the outside of the cover is ok.
Answer: If the bike has an aluminum frame, then the things to worry about are the steel parts: gears, chain, cables, and fasteners (bolts and such).  All of these things will readily rust if exposed to constant moisture from being outside.  Leaving the bike under an awning will help, but not protect it completely—a shed or other enclosure in the best bet.
Comment: You are correct about the components - however a quality steel frame will outlast aluminium on damp environments.
Comment: You failed to mention the cables.  The cables go before anything else.
Answer: I'd go the other way, and suggest that you do store the bike inside.  If that means removing something else to make space, so be it.
Other options include a ceiling hoist, where you sway your bike up into otherwise underutilised space below the ceiling.  Watch out for air hotspots, and you have to wipe down a wet bike first because of drips.  I have also seen these used to store a bike safely over a car's bonnet (hood)
Think three-dimensionally!
Comment: Ceiling hoists are great, something like the [stowaway](http://www.yourstowaway.com) would be perfect. My hesitance to installing them is we've a young child so it's not something I'd risk having hanging from the ceiling.
Answer: I have a similar bike storage issue: I want to keep my bike at the front of my flat (=appartment), so that I can get on it when I go out on to the street, without having to carry it up stairs, or down a muddy lane from the back yard. Weather, rust and theft are concerns, but so is speed and convenience in getting going every morning.
We have a Cycle Hoop bike hanger in our street, which is great for security and weather protection, but it has a rental cost, and takes time to walk to and open and close.
Similar to amcnabb's answer, I tried commercial bike covers, but found them flimsy and hard to store when not in use. I've similarly found a decent solution using tarpaulin.
I have a solid iron fence in front of my flat, and so lock my bicycle to this, and then cover it with a rectangular section of heavy truck tarpaulin (free from a car scrap yard). This works well for weather-proofing, especially if air vents are left,  but it is still a hassle to get off the bike in the morning.
By adding 20mm galvanized pipe horizontally, and a handle, lifting this cover becomes much quicker, and run-off water can be directed away from one's clothing. The ends are left open this way: in practice this allows air-flow, thereby reducing condesation, and rain doesn't get much past the tyres: important areas like handlebars, transmission and saddle stay dry. The pipe helps to keep the tarp weighted down. A pocket can be added in the tarp to accommodate the handlebars, jointed using eyelets and stainless bolts or otherwise.
The result provides a decent combination of weather protection and therefore protection from rust and decay; and also convenience. Security comes from hiding the bike from immediate sight, but primarily from a very solid lock (motorcycle chain) left permanently under the cover, but small chain-and-padlock locks can be added at the front and back to lock the wheels - and keep the cover down in case of storms. The cover is easy to leave in place when you use the bike. It depends though on having a fence or similar permanent fixture to mount on or over; and there is still clearly some risk of targeted theft when a bike is regularly left in same place outdoors. I'm happy to store my town (commuting) bike like this, but a more valuable (and less often used) one stays indoors.

The idea and its use is somewhat documented at bikehide.org. Disclaimer: I designed this myself and have produced a few for friends: it isn't commercialized (yet, at least!).
Answer: Tidy Tent is a zipped tent which can be secured to floor or wall - I've ordered mine just a couple of days ago... If you search for Tidy Tent you'll get more info.
Hope that helps.
Comment: At first glance the Tidy Tent doesn't appear to allow sufficient ventilation to allow condensation to evaporate quickly.
Comment: While this theoretically answers the OP's question, it would be better if you were to give an explanation of why Tidy Tents are a better solution than a simple tarp and perhaps provide a picture. Also, if you are in any way affiliated with Tidy Tents, you must declare it within your answer. Just fyi. http://bicycles.stackexchange.com/help/behavior
Answer: I like the idea above about small shed. If you don't have a lot of horizontal space, perhaps a vertical version, hanging the bike inside, could be the solution. An important feature of any shed, is to have a floor, with the entire shed on supports, preventing direct contact with the ground. This will help prevent excessive dampness. If you have the space, and can allow for it in your budget, a small, regular storage shed would be great. This would give you space for other bike stuff, as well as a place for any tools & supplies, or stuffed bunnies[:-)


How can I know where does an app locate its configuration files?

Question: How can I know where does an app locate its configuration files such as in ~, /Library, ~/Library etc, other than browsing and guessing?
I mean is there some command like findfiles this.app that prints them out or something?
Answer: There are a few programs which can give you insight into file system usage while programs are running.
There are a few good terminal ones like lsof, but I really like fseventer for its simple graphical interface and play/pause button.
All you would do is run your program, run fseventer, and if you make a change to your preferences or configuration and it is stored in a file, it will show you the process touching the file.
If it is something like Entourage which stores its rules in files but then keeps them in memory until quit/start, you may want to close other programs and launch your program of choice to see what it loads, then quit it to see the reverse process.
Answer: Applications in Mac have their own application identifier. They use this identifier for naming their preference files and other files such as caches. To find this identifier, view the application's package content (right click and select) and go into the contents folder and open Info.plist in TextEdit.
An example of an application identifier is:
com.CompanyName.ApplicationName (for companies)

or
org.OrgName.ApplicationName (for organizations)

So the application identifier for Google Chrome, for example is:
com.google.Chrome

To actually find the identifier, open TextEdit, and press Cmd+F to open the Find dialog, and type CFBundleIdentifier. The line after this is the application identifier.
After finding the application identifier you can find the files easily in the usual folders. However, spotlight does not search such items, and you would have to use a terminal command:
find ~ -iname "com.company.application"

to search the whole hard drive:
sudo find /  -iname "com.company.application"

For other files, you can use fseventer, as hobs pointed out, to search in real time for what the application accesses, writes and reads on the hard drive.
Comment: One can abuse the `defaults` command to get the bundle identifier: e.g. `defaults read /Applications/Safari.app/Contents/Info CFBundleIdentifier` (all on one line, in Terminal) will return `com.apple.Safari`.
Answer: Found a good tutorial which scans for files modified after a defined timestamp.
http://www.westwind.com/reference/OS-X/finding-settings.html


Material Design and punctuation

Question: Material design says to skip periods for messages in dialogs which are only one sentence. Yet in their dialog examples they use a period in that circumstance. So, which is it?
Comment: It says "Any sentence followed by a link (links themselves should not be full sentences)" The example has links following it. Is that what you're talking about? Miss it?
Comment: No, it's in the "Skip unnecessary punctuation" section.
Comment: Yeah, that's from the Skip Unnecessary Punctuation section:

"Use periods on:

Multiple sentences
Any sentence followed by a link (links themselves should not be full sentences)"
Answer: You are right that most of the examples on that dialog page ignore the punctuation rule. It could be outdated examples. That page however doesn't address punctuation so I would follow the rules described on the page about writing. There is stated:

Avoid using periods on solitary sentences within these UI elements:

...
Dialog body text

A funny fact is that "Dialog" in that text is a link that refers to the top of the dialog page where the first example is the only right example.

Later the page about writing refers to a different section of the dialog page. (the one referred to by the OP). From there you only see the "wrong" (lets assume outdated) examples.

The following components have specific writing guidance:

Dialogs
...
Answer: If you mean this, here are two sentences: Reset settings? and This will reset...

I assume that the rule is exclusive to single sentences:
Comment: "Reset settings" is a header. I really don't think they mean to include headings when talking about single vs multiple sentences.

Material Design and punctuation


After upgrading (!?) to Ubuntu 20.04.3 Workspaces effects only one (of two) monitors

Question: I'm a happy user of Workspaces.
I upgraded to Ubuntu 20.04.3 and appear to have broken Workspaces.
I have 2 monitors.
When I click "Activities" or , I enter the Workspaces switcher. I have (only ever) seen one of the screens thumbnailed but I have always (until the upgrade) been able to switch between Workspaces that comprise Windows that span both (2) virtual screens, i.e. when I switch between Workspaces, even though only one screen is thumbnailed, I moved between Workspaces that comprise windows across 2 screens.
Since the upgrade (!?), when I switch Workspaces, one of the windows|screens remains unchanged while the other continues to let me switch between Workspaces.
It as if Workspaces (now understandably) accepts that, because I have 2 actual screens that I may wish to switch Workspaces between each independently.
However, I now (appear to) have no way to switch Workspaces on one of the physical screens.
Ideally I'd like to (return to what I had previously and) have Workspaces treat my 2 physical screens as a single Workspace that comprises 2 virtual screens. Alternatively, I'd like to be able to switch Workspaces on either screen independently.
Answer: Solved!
I installed gnome-tweaks
Then, form "Workspaces", I selected "Worksapces span displays".