Choosing the size of SD card for a Canon 550D?

Question: Recently I bought a Canon EOS 550D (T2i), and I need to buy an SD card of speed class 10.
What size should I get? Is there some limit in terms of camera support?
Should I go for 8, 16, 32, 64GB, or in smaller capacity cards to be able to download one while shooting with the other?
Comment: See: [Is it better to have one large memory card or several smaller ones?](http://photo.stackexchange.com/questions/1955/is-it-better-to-have-one-large-memory-card-or-several-smaller-ones)
Answer: Your camera supports SDXC cards which have a theoretical size limit of 2 TB, so it supports any SD, SDHC or SDXC memory cards on the market.
The difference between SD, SDHC and SDXC is maximum capacity. SD cards are limited to 2 GB. If you shoot video, you will notice that limit quickly. For images, it depends on how much you shoot and how often you offload. SDHC cards go up to 32 GB which gives space for thousands of photos. Your camera manual has a table near the end to let you know how much photos and video fits in different sizes.
Pick a size you are comfortable with. Some people decide to have one huge card and never swap and others like smaller chunks so that if one fails, you still have other cards and you lose less. Even top-notch cards can fail, so I strongly recommend more than one.
The card rating is prominent on most packages except for the slowest cards :) If you need a class 10 then you need one which says 'Class 10' or at least 10 MB/s or at least 66X. Some manufacturers use different measuring systems. Today you can get cards up to 1000X or 95 MB/s which is faster than your camera can take advantage of.
Comment: All the eggs in one basket? That was a major element of my decision to purchase a d7000. I always use the two slots in parallel.
Comment: I would get the 2TB card if I were in your shoes.
Comment: Still working on filling the two 128GB SDXC cards.... never got passed halfway of one! Then again, I don't shoot video.
Comment: I also do not shoot much video, I use 8GB cards and swap them out between shooting situations so that if a single card fails it is not the end of the world. Cards do fail!
Comment: @Phil - Dual-slots are awesome for that and are the only way to ensure truly minimal loss.
Comment: @dpollitt 2TB cards do not exist yet. that is just the *theoretical* limit of SDXC cards
Comment: @damnedtruths - I know, it was a joke ;)
Comment: We're [not so far](http://www.lexar.com/about/newsroom/press-releases/lexar-announces-industry-s-first-256gb-sdxc-uhs-i-memory-card) from that theoretical limit anymore ;)
Comment: @Itai 256 GB is still only an eighth of the limit. Sure this is only 3 steps off it, but this could take some time to reach, and then become affordable.
Answer: I use a 32GB card, but I feel that was a mistake. If I could do it again I would've purchased multiple smaller cards. If I had more than one card I wouldn't suffer from a single point of failure in the SD card. If one failed I'd lose those photos (if any) and then I could still use the backup.
Also, if you do not frequently empty the card then it takes longer and longer to grab the new photos. I had thought that with 32GB I could just keep taking pictures forever (I don't shoot more than 1000-1500 per year and the card holds well over 1000 on my 60d in the largest RAW format), but it got to the point that it would download all the old pictures to get "previews" and so I started erasing all images after every transfer so I wouldn't spend more time downloading than actually taking pictures.
And also, if you go super big for your needs you'll over pay. Find what your needs are for the near future (est. 1 year) and then buy more in the future because it'll only get cheaper. And having more memory cards isn't a bad thing if you can keep them empty (no good having a bunch of extra full cards).
Comment: Great comment about granularity. For a long time I used only 4GB cards because each fits on a DVD and I burned 2 copies as soon as it fills up. I had enough of those to last a trip because I do not travel with a laptop.
Comment: Shooting RAW+JPEG and the occasional video, I find 16GB to be the sweet spot.  I have learned the hard way not to buy one big card, but to buy multiple smaller ones.
Answer: The camera has no capacity and there is no maximum size you have to worry about. The camera just writes to the SD card until it fills up. If you can afford (and want) a 64GB card, go for it. There is no speed difference between cards of different sizes.
SD cards come in SD, SDHC and SDXC versions, with progressively faster write speeds. Go for at least an SDHC as you may find that the standard SD card will be a little slow, especially if you're shooting raw.
If you envisage yourself being in a situation where you will need to keep shooting while transferring photos, then by all means get two cards, but otherwise it's not really an issue as transferring only takes a few minutes.
As with any purchase of this kind, get the biggest, fastest version you can afford and you won't go far wrong!
Comment: Question is legitimate. Camera firmware may have limit on the maximum size of SD card. There were many cases of equipment with such limits. As Itai writes this camera supports SDXC cards which may suggest that 64GB should work.
Comment: An SDHC or SDXC card is not necessarily faster than SD.


Options for checking if file exists on DB Server Filesystem

Question: I am maintaining a Classic ASP web application accessing a database(SQL Server 2012) on a seperate server.
There is alot of integration work with this legacy application. Alot of which involves import files hosted on the database server. These are processed by SSIS packages run by an SQL Server Agent job and launched by ASP COM+ objects
I would like to be able to check if an import file exists or not ON THE DATABASE SERVER(separate from the web server) prior to running the import packages. So it should  be able to fail and return an error that indicates that a file was not found.
Our database and web server used to be on the same machine. Now they have been separated.
This functionality should be generic so that I can apply it on all imports by, ideally, passing the file path as a parameter.
With that environment and Classic ASP Limitation, these are the options I have considered:
a) Adding a step to the SQL Server Agent Job that runs TSQL follows:

Step happens before the one that calls the SSIS import package/ or runs as a separate job.
It relies on the SQL Server Agent job "success" or "failure" returns indicating file found or not-found respectively

Problem: As far as I know it is not generic. It would mean a job for every import type as only one job can be processed at a time and jobs do not support parameters(is).
b) Using the undocumented xp_fileexist stored procedure as follows
CREATE PROCEDURE [dbo].[spFileExists]
@fpath varchar(255)
AS
       begin
              DECLARE @fexists int
              EXEC master.dbo.xp_fileexist @fpath, @fexists output
              SELECT cast(@fexists as bit)
       end

GO

Problem: I have tested this approach and it accesses the filesystem OF THE WEBSERVER instead of the intended filesystem of the DATABASE server. If I put the file in the web server using the expected path, it returns 1 indicating that it is there. If I delete it and place in the DB server, removing from the Web server, it returns 0.
Why would it be checking in the Web server filesystem?
c) Creating a SQL Server CLR assembly in a .NET language and trying to use .NET filesystem operations to access the database filesystem. Havent tried yet
d) Using sqlcmd  Havent tried yet
Any best practice or experiences would be most helpful.
Comment: xp_fileexist probably fails on the database server because the SQL Server service account doesn't have rights to the directory (or, maybe, the file actually doesn't exist there).
Comment: @AaronBertrand I tested it as mentioned in my post.
Answer: I ended up revising the COM+ code line by line and revisiting the environment configs. b) now works I cannot reproduce the issue I had but my best assumption is that it was application config related.
So I have resorted to using xp_fileexist though I understand it is not good practice to use undocumented SPs (they can be removed without warning in next versions).


Eigenvalues of infinite matrices

Question: I am trying to find some literature on infinite matrices because I want to know how to get the eigenvalues of infinite matrices. Seriously, it seems there are very few references available. Can someone tell me how to determine the spectrum of infinite matrices?
Comment: You say below "Please do not advise me to read the general theory of linear operator in Hilbert space, seriously I know this stuff. But I just don't know how should deal with infinite matrices." I find this attitude hard to understand. If you know "this stuff" then you should know that the operator might have non-empty residual spectrum, might have approximate eigenvalues that are mot eigenvalues, and so on. Per's answer only applies to Toeplitz matrices. You cannot just regard the spectra of infinite matrices as being limits of eigenvalues of naive truncations
Comment: So you want to learn about the spectral theory of operators on Hilbert space? The basic general principles and existence theorems will be covered in standard books such as those of JB Conway or W Rudin (or RG Douglas's book). However, finding the spectrum of non-normal operators is in general a very hard business, so I think you would be well advised to think about the particular structure of the "infinite matrices" that you are interested in.
Comment: Infinite matrices don't have eigenvalues in general. This is a subtle matter and "infinite matrix" is not the correct keyword for understanding it: see http://en.wikipedia.org/wiki/Decomposition_of_spectrum_(functional_analysis) .
Comment: Infinite matrices represent linear operators between spaces of sequences. But it should be clear that not any infinite matrice represent an linear operator, and not any linear operator has an infinite matrix representation. A nice book that addresses these and other foundational issues is Halmos-Sunder's *Bounded Integral operators on $L^2$ spaces*. http://projecteuclid.org/DPubS?service=UI&version=1.0&verb=Display&handle=euclid.bams/1183544910
Comment: Perhaps a good place to start is to check out the history of infinite matrices (including various discussions around eigenvalues): http://www.springerlink.com/content/jw45823632u8qj65/
Comment: To elaborate or riff on Qiaochu's point: what vector space do you intend your infinite matrices to act on? Only then can one talk about the spectrum, or the set of eigenvalues
Comment: (And of course in infinite dimensions, the spectrum might contain points which are not eigenvalues...)
Comment: I am talking about the infinite matrix in Hilbert space.
Comment: Thanks a lot! Benjamin, I am really like the references! It is very helpful!
Answer: One simple example with a special matrix, which has somehow "a continuum" as eigenvalue...
Consider some function $ f(x) = K + ax + bx^2 + cx^3 + ... $ having a nonzero radius of convergence. Then think of the infinite matrix of the form
$$ \small  \begin{bmatrix}
  K & . & . & . &  \cdots  \\\
  a & K & . & . &  \cdots \\\
  b & a & K & . & \cdots  \\\
  c & b & a & K & \cdots \\\
 \vdots & \vdots & \vdots& \vdots  & \ddots
\end{bmatrix} $$
From the properties of finite matrices we would expect, that K is an eigenvalue. But consider a type of an infinite vector
$$ V(x) = [1,x,x^2,x^3,x^4,\ldots ] $$ with a scalar parameter $x$ from the range of convergence, then
$$ V(x) \cdot F = f(x) \cdot V(x) $$
This means also: any vector $V(x)$ is an eigenvector of the matrix F and corresponds to the eigenvalue $f(x)$. If now $f(x)$ is entire, for instance the exponential function $ f(x)=\exp(x)$, then any value from the complex plane (except $0$ because $\exp(x)$ is never $0$) "is an eigenvalue" of F contradicting the "naive" extrapolation from the finite truncation of the matrix ...
Comment: Excellent example! This is indeed what I am worried about. Thanks a lot!
Answer: For me, infinite matrix means an operator on $\ell^2(\mathbb N)$ (or sometimes $\ell^2(\mathbb Z)$, but usually referred to bi-infinite matrix). Concerning the eigenvalues, you thus may just look at the general theory concerning operator on Hilbert spaces, as already pointed out in the comments above.
Answer: to present an example: if the considered matrix is the adjacency matrix of a graph, there are relatively involved graph theoretical criteria just to decide whether the spectral radius is an eigenvalue, let alone further spectral values. i think you should make yourself clearer what exactly you would like to know.
Answer: I have done some research on banded Toeplitz matrices,
(where we consider a sequence of finite matrices, and show where the eigenvalues accumulate).
There is also quite old literature on this subject, see references in this paper I shamelessly advertise: http://arxiv.org/abs/1208.5607
Comment: Hm, I would not dare to say that this in general is valid; I guess it depends on the application. Intuitively, if taking a kxk-truncated matrix and the eigenvalues are "close" to what you'd expect, or there is nice convergence as k grows, then it is worth studying. But you can certainly construct a series of truncated (non-Toeplitz) matrices such that the series of eigenvalues do not converge. I have not dealt with sparse matrices.
Comment: Thank you so much! So we truncate the infinite matrix and find the eigenvalues, then we take limits. If the limits exist, then we regard the limit as the eigenvalue of infinite matrices. Do you think it is a legitimate treatment of eigenvalues of infinite matrices? Please do not advise me to read the general theory of linear operator in Hilbert space, seriously I know those stuff. But I just don't know how should we deal with infinite matrices. Do you think infinite sparse matrices are easier to deal with? Thank you so much!

Eigenvalues of infinite matrices


What is the set of cards used in the Wisconsin/Berg Card Sorting task?

Question: I'm a little confused about what cards are included in the Wisconsin card sorting task. According to PEBL there are two sets of cards available for the task, one set of 64 cards and one set of 128 cards. I think I've figured out what the 64 card deck is given that there are four different number, four different colours and four different shapes. Consequently, 4*4*4=64. However, what is contained in the 128 card deck?
Answer: The 64 card version is just a shorter version, according to (Greve, 2001). Instead of running 128 total trials, there are only 64. The original test was developed and, crucially, normed for 128 trials. However, this version takes a long time to administer, and clinicians were interested in a shorter version. It was found that cutting the number of trials in half worked reasonably well.
So the short answer seems to be that the decks are the same.
Comment: This can be confirmed further [Evaluation of a Short-Form of the Berg Card Sorting Test (Fox, 2013)](http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0063885).


What is a good video resource for quantum computing?

Question: Can anyone refer me to a good video resource for quantum computing? I found this post helpful Currently, what are the best structured courses available online on quantum computing?, but Vazirani's youtube course has many videos deleted.
Answer: Artur Ekert is in the process of posting video lectures from his course in Oxford....
https://www.youtube.com/playlist?list=PLkespgaZN4gmu0nWNmfMflVRqw0VPkCGH
Answer: John Preskill posted his lectures from the first term of Quantum Computing course, Ph/CS 219A Quantum Computation, at CalTech here: https://www.youtube.com/playlist?list=PL0ojjrEqIyPy-1RRD8cTD_lF1hflo89Iu
Answer: Ryan O'Donnell recorded a semester of lectures (mostly on a chalkboard) at Carnegie Mellon.
Sevag Gharibian has an introductory course as well as an intermediate/advanced course from the Paderborn University here; these I believe were recorded on his webcam for uploading to Paderborn's students initially and then to YouTube later.
Answer: Nathan Wiebe lectures cover the more recent quantum algorithms such as QSVT and Qubitization in addition to the standard material.
Comment: Great! He quickly gets to topics just nearly outside my ken.


Newton's laws of motion tension

Question: I am very much confused about tension. I have even Googled my doubts (Also used khan academy) to clear my doubts but even there explanation couldn't satisfy me.
PLEASE SOLVE THIS QUERY:-  what happens to the force that we apply to the rope externally, doesn't it get cancelled out by newtons 3rd law. And how at atomic level the force that we apply is transferred to the other end of the string.
It would be of great help if you answer your explanation with diagram since I have my test tomorrow.
Comment: Related post by OP: https://physics.stackexchange.com/q/496356/2451
Comment: The rope can be thought of as infinite small elements of length ' $ dx $ ' apply  Newton's second law for this element and you will get some insight about it ( just a hint from my side )
Answer: It may be a bit difficult to convince you that tension works the way they say without several back and forths.  However, your specific questions can be answered, and they may help you figure out what piece of the story you're missing.
Newton's 3rd law does not generate forces that cancel out.  Newtons law says that for every force, there is an equal and opposite reactionary force.  The key to this (which is often not covered very well in physics classes), is that the reaction force happens to the other object.  What's really said by Newtons 3rd law is "if we want to make sense of motion using forces (i.e. F=ma), we must understand that forces come in complementary pairs."  I hate the phrasing "opposite" because it causes confusion.  They call it "opposite" because the reaction force occurs in the opposite direction, but I find "complementary" captures the idea that one force cannot exist without the other better.
If I push on an object with a force, there must be a complementary force -- the object pushing on me.  The more force I apply to the object, the more force is applied back at me.
In the case of your rope, if you have something that's externally applying force to a rope, the reaction force applies back on whatever thing is applying that external force.  The reaction force does not apply to the rope.  It applies to whatever the other thing is.  If we then look at any element of the system, whether it be the rope, or the thing applying the force, or perhaps a pulley that the rope might be stretched over, we can then use F=ma to determine how it is moving.
As for the atomic level forces, the key force you're looking for is electrostatic forces which hold molecules together and push molecules away from each other.  When you "pull on a rope," you actually apply electrostatic forces which try to push the rope in the direction you are pulling.  And, indeed, they succeed at moving the atoms of the rope, perhaps a few nanometers.  As the atoms move at this nanometer scale, they generate surprisingly powerful electrostatic forces to pull atoms further up the rope towards them (and, by newton's third law, those atoms further up the rope apply a force on them, restraining their motion).  This propagates mighty fast (at the speed of sound), over very tiny distances (nanometers, micrometers at most).  This happens so fast and over such small distances that, for all intents and purposes, we say the rope "moves as one object," permitting us to use F=ma where  m is the mass of the rope.
One other fun challenge of learning how tension works is that physics classes love to ignore the mass of the rope.  For realistic secnarios, such as using a rope in a tug of war or to lift up a package, this is a very effective simplification.  The mass of the rope has very little effect on the final result.  However, in theory the mass is there.  And, if you feel like it, there are physical exercises you can do which are dependent on the mass of the rope to provide you a good workout.  If tension is not making sense, try remembering that every little snippit of the rope does have a mass, and is obeying F=ma as it moves.
Comment: Thankyou for replying. But then what happens with the force that rope apply to us , because of this force aren't we not pulled towards rope with the same magnitude by which we had applied force.
Comment: @Justgoingtolovephysics What you say will be true, but what I believe you are thinking will only be true in equilibrium.  Consider a system where we have a pulley over our head, and a rope that goes over that pulley attached to a 1000kg weight.  If we hold onto the rope, the system will *not* be static.  The weight, the rope, and us, will all accelerate at a rate defined by F=ma, based on the sum of forces affecting each object.  None of the elements of that system will have a net sum of forces equal to 0

Newton's laws of motion tension


Magento 1.9 Add an optional customer attribute on registration form only for my Brasilian shop?

Question: I want to show a customer attribute on registration form and provide to edit that one on user profile, but only for my Brasilian customers?
Answer: You need to create customer attribute for this you can do follow:

Go to admin and open Customers->Attributes->Manage Attribute.
Select Store on which you want to enable that attribute ex: Brasilian Store
Fill out all the necessary filed according to your need then save it.
Run indexing and flush cache.
For showing your customer attribute on registration page go to its Phtml file and call that attribute by its Code which you gave to your attribute while creating it.
Like:

escapeHtml($this->getCustomer()->getProvince()) ?>

let me know if its work
Comment: Thanks for the reply. There is no Customers->Attributes->Manage Attribute.
Comment: @BorcheGlafche Welcome Pal let me know if above solution work or not.
Comment: It doesn't. There is no Customers->Attributes->Manage Attribute on admin page.
Comment: Can You share screenshot of your backend so that we can figure it out.
Comment: You can refer this link also [https://magento.stackexchange.com/questions/65751/add-new-field-in-magento1-9-customer-registration]
Comment: I uploaded a  screenshot
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/83264/discussion-between-borche-glafche-and-shubham-khandelwal).
Answer:
You create a customer attribute
app/design/frontend/{template}/{name}/template/customer/form/register.phtml

app/design/frontend/{template}/{name}/template/customer/form.phtml

You add a condition around your field:
<?php $storeCode = Mage::app()->getStore()->getCode(); ?>
<?php if ($storeCode == 'br') : ?>
    //your Brasilian input here
<?php endif; ?>


Opening programs very slow on Ubuntu 14.10

Question: When I open any program for first time after boot on my Ubuntu 14.10 it takes 8 second and more ! i think i have powerfull laptop with Intel® Core™ i7-3630QM CPU @ 2.40GHz & nvidia gt630M & 16GB of ram ..  and some programes like Vlc Lags alot i dono why but this problem Bothering me ,sorry for my english
Comment: What graphics and drivers are you using? (Use `lspci -v`). And does it lag later after first login?
Comment: http://i.imgur.com/TH0eX4x.png < thats what appear ,, yes vlc delay whenever i open it and take very long time ..
Answer: I have had the same experience because of my hardware. It seems Ubuntu from 13 has much 3d grahics that don't work well with onboard GPU. Since my pc was a business pc and lacked fancy high performance hardware I was advices by ubuntu to use lubuntu and I must confess lubuntu is super light fast on my system. It's very much the same as ubuntu but only better. Doing that saved me lots of time in trying to solve my hardware issues that I don't have time for since time is money. You can just install lxde in your current ubuntu and it will have a lubuntu choice at the log in screen. You'll need something like 1GB free space for that to install. As for me I cleaned installed lubuntu since I didn't have much complicated files that need advanced backup bacuse I just had documents. Good luck with wonderful and free ubuntu. Saves me alot of cash.


Is the amount of health I heal from a hacked pack related to Sombra's charge gain

Question: Does it matter if I heal 1 health, or 250 health in relation to Sombra's ultimate charge rate? Would she receive the same amount of charge in both cases ?
Answer: It would appear that her hacked health packs earn you ult charge rate the same way that Soldier 76 and Ana do. That is 1 point of ult charge for every 1 point of health healed.

"Heroes gain 1 charge for every 1 point of self-healing done.
Soldier: 76, Ana, and Sombra gain 1 charge for every 1 point of
  healing."
Comment: It's also worth mentioning that Sombra ult requires 1250 points for a full charge.
Answer: As with any other character capable of healing others, the amount of ultimate charge gained depends on the amount of health healed.
Answer: As of the patch on February 27, 2018, Sombra no longer gains any ultimate charge by having teammates collect hacked health packs.


Mattresses are too soft: how can I get a better night's sleep in a hotel?

Question: I've noticed that mattresses (and pillows) in hotels tend to be softer than I'm used to, and I don't get a good night's sleep like I do at home.  I don't have anything super-special going on (no weird medical stuff); I just have a firmer mattress and pillow at home and I notice the difference at hotels, sometimes waking up with a bit of a backache.  Is there anything I can do in a hotel room, or when making a reservation, to firm up the bed, within the constraint that when I fly I try not to check baggage?  (So if I bring something, it has to pack down.)  I don't want to sleep on the floor (that's too firm).
Comment: @JoErNanO Not at all. Too soft bed brings back ache and can bring long-term troubles. When you buy a mattrace, they should ask you how tall and how heavy are you, and choose one for you according to this.
Comment: A lot of the hotels I stay in offer two sets of pillows, one hard, one soft. Doesn't help with the mattress, but can make a difference. Otherwise, phoning the front desk can often get you other pillows (though not usually other matresses)
Comment: @JoErNanO, softer mattresses totally and always give me a backache. I sleep on my side, or my stomach. A soft mattresses ends up making my entire body crooked. Just rest on it watching TV can kill my back but sleeping on one is the worst. I don't know where you got the idea that soft mattresses should not give backaches. They do. I know from first hand experience.
Comment: @pnuts That just results in a headache, compounding the problem.
Comment: Weird thing is that softer mattresses should not give you backaches. Anyhow anything that modifies the firmness of a mattress must at least be the size of a one-person mattress (90x190). I doubt you can fit that in a carry-on.
Comment: Gabapentin or Zopiclone will do the trick
Answer: I found a helpful video for exactly this problem - and it's an easy solution: just put a pillow under your midsection and your spine will be much better supported. http://youtu.be/DQgpE3DIcXs
Answer: One thing I noticed is that more expensive hotels tend to have softer mattresses and fluffier pillows.

While probably not universal, it might be worth experimenting with selecting a slightly lower class hotel, or just a different chain.

In extreme cases, sleeping on the floor is of course an option, even at home I have to do that sometimes when I've a severe attack of back pain (and my mattress there is pretty hard indeed).

But if your back is healthy, the aches waking up in a strange bed have more to do with the bed being strange and not shaped/moulded to your body as the one you have at home is than with the specific firmness of the mattress and bottom (the stiffness, shape, and movement of the springs or wooden slats the mattress is sat on have a big influence as well on your nightly comfort).
You will notice the same thing the first several days to weeks after purchasing a new mattress for your home.
Comment: Please note that a hard mattress is not necessarily the cure for back pain. Depending on the type of pain, your sleeping position, your body shape and a bunch of other factors, you might actually be doing yourself more harm than good.
Comment: @JoErNanO of course, it's personal. But at least for me, a harder sleep is beneficial (and I've over a decade of experience with chronic back problems).
Answer: Some hotels offer a choice of mattresses, not advertised but it is worth asking.
I had an uncomfortable night at one large hotel because the mattress was too hard for me. I called the front desk to complain. The next night there was a much softer mattress on the bed.
Comment: They changed the mattress, as opposed to moving you to a different room?  Wow, that sounds like a lot of work.  Is it possible that they added a pad to the existing mattress?
Comment: @MonicaCellio It was a change of mattress - I happened to be leaving my room as they were wheeling in the new mattress, on an obviously designed for the purpose cart.
Comment: I'm impressed; that's a level of service I wouldn't have expected.  Next time this happens to me I'll try asking.  (Meanwhile, the pillow trick worked ok for me on my last squishy-mattess trip.)
Comment: @MonicaCellio It is always worth asking. The worst that can happen is the front desk people say "no".
Answer: Check for online reviews about the bedding. When I see "too hard" I think, "perfect for me." Also, you can call the front desk of hotels before you reserve a room and ask what guests typically say about the beds.
Answer: Depending on the number of nights booked, the size of the room, and the size of the bed...putting the mattress on the floor may be a suitable solution.
Comment: @Willeke The OP does say they don't want to sleep on the floor. The OP does **not** say they don't want to sleep on the mattress on the floor.
Comment: OP mentions in the question that they do not want to sleep on the floor, as that is too firm.
Comment: +1, but it would be possible for the mattress to be too soft even on the floor if the bed base has no give in it. Or indeed too hard if the bed base is heavily sprung (@Willeke)
Comment: If you knew in advance that you had to stay somewhere with very soft beds, you could carry a lightweight inflatable camping mattress to use either on the floor or the bed base
Comment: It may also be that getting up from floorlevel is not as easy as it is for some.
Comment: @Willeke All true, mattress on the floor isn't for everyone. But this tactic helped me a lot once, back in the day. But I'm 75 now, and won't be moving mattresses again.


Can I mark a Google Groups topic as unread?

Question: How can I mark a Google Groups topic that I click accidentally as unread to know that I still not read it at all?
Comment: I assume you mean from the web interface. No, you can't. Oddly enough, you can only mark messages as "read" but not the opposite.
Comment: @Krampus Thanks for your comment. Yes, I was talking from the web interface. If you reply this question I could accept it as the reply and "close" the question.
Answer: (I assume you mean from the web interface.)
Unfortunately, no, you can't. (At least at present.)
Oddly enough, you can only mark messages as "read" but not the opposite.
Comment: Still seems to be true as of Aug 2021, both in the desktop and the mobile versions of the website.


how does compiler treat for loop checks

Question: If am doing something like
for i = 0; i < len(arr); i++ {
    ...
}

Is the len() calculated at every iteration ? For gcc is there any optimization flag that can be set to change it.
Comment: There are thousands of compilers, that each could handle this differently. Be more specific!
Answer: I believe that the language definition (assuming we're taking C/C++ here) requires that it is invoked every time.
As suggested in other answers, you have to do this optimisation yourself. The compiler generally can't know whether calling the len() function will have side effects, or will return the same value on each invocation, so can't generally pull it out of the loop. Since you know what len() does, you can perform that optimisation.
Comment: wouldn't it be sufficient to have the final result be such that it is the same as if it had been invoked every time.
Answer: Yes, len() is invoked at every iteration. It it is the same if you use a simple variable instead.
for( i=0 ; i< a; i++)

While it is not recommended you can change the value of a mid-run.
Answer: if it does not change during each iteration. it is called a loop invariant.
loop invariants can be (can is the word) be hoisted above the loop body.
but it is not necessary to do that for correctness.
and in the case of a function call, it will be difficult for the compiler to determine if the value is a loop invariant or not. if it were an inline function, then it would be theoretically possible to determine the loop invariance. but i am not sure if any specific compiler actually does this.
see loop invariant code motion for more information
Answer: If you don't want len executed every time:
int length = len(arr);

for i = 0; i < length; i++ {
    ...
}

how does compiler treat for loop checks


How to enable Quotas in Professional Edition collaborative forecast

Question: I am trying to setup quotas to PE collaborative forecast. When I go to the customize - forecast - setup section, I do not see the "Show Quotas" checkbox as described in the documentation (page 14) http://na9.salesforce.com/help/pdfs/en/forecasts.pdf
Answer: Setting up quotas requires API access, so Professional Edition doesn't seem to have quotas. You wouldn't be able to set up the feature anyway.
(Yes, there is the AppExchange package, but that seems to be only for Enterprise Edition and above. https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B41EqEAJ)
Answer: If you contact support to discuss - there is a chance they can switch your forecast settings from a Collaborative Forecast to Customizable Forecast (which includes Quotas as a feature for Professional Edition).
I am currently working with support to facilitate this in my org. As a heads up, it will require them to purge Collaborative Forecasts completely from your system and reinstall a new package: the Customizable Forecast. If you have data currently loaded into your forecast, you will need to back it up before the migration and reformat & load it after the new package is installed. Hope this helps... I can repost after the migration is complete with any additional findings.
Comment: PLEASE do not go this route. Please uncheck this as the answer because it advises you to do something that goes DIRECTLY against what salesforce.com suggests. There is ZERO R&D on the Customizable Forecast product, so your forecasting will never evolve to get any new features, and any requests for help will be laughed at. Collaborative is the way to go. Oh - and how do you plan to "load" your data back in if you have Professional Edition? You can't. Period.
Comment: I agree with the above comment, it is important to research the benefits of collar f/c before suggesting to move away from it.
Answer: The solution is to upload the quota data via the data loader. You have an option to upgrade to EE. Alternatively you may be able to use a third party data loader, e.g., Jitterbit Data Loader to upload your data.
Salesforce stores the quota information on the user record when collaborative forecasting is enabled for the org, previously it used a separate Quota object related to the User object to store the information. I would therefore suggest take a listing of the users in a CSV and add the quota data in a separate column and then to upload this via the data loader (see options above). This way you will be able to see the user quota in the forecasting tab (and not on the user record).


Sleep sitting upright

Question: I hope this question is not too silly, but I have been on some long flights, and found I cannot sleep sitting upright. I can close my eyes and relax, but sleep doesn't come. It is the same thing at home as well. Can one train themselves to sleep upright on a plane? Is this a mental block? Do any other travelers have this problem, and how can I remedy this? I am going to Australia.
Comment: I have flown more than two million miles in my life, and I am yet waiting for the first time I can sleep. You are not alone. - Common recommendations are: drink some wine, or take a sleeping pill (I don't want to do that).
Comment: Or you can fly business :). These days most airlines offer fully reclining seats in the business class. Really does make a difference.
Answer: Can you train yourself to sleep upright, yes.  But is it worth it?
People all over the world adapt to sleeping in various position, on hard cement floors, V shape in hammocks, on pillow beds, in broad daylight, etc.  It is basically a matter of doing it day after day until your body adapts.  But do you really want to spend a couple of weeks without good sleep adjusting to napping in a chair for just one flight?
I, like yourself, can not sleep upright and I make numerous long haul trans-pacific flights each year.  I just accept the fact that I will tired upon arrival and plan my schedule accordingly.
Answer: The way many people solve this, or at least attempt to, is by using a neck support, and then alcohol or drugs. Ideally if you take any form of sleep inducing pill, you should take it after you take off in case the flight returns to the gate and you need to deboard. If you do choose to take this route, I'd recommend trying your chosen strategy before your first attempt on a long haul flight, in case you have a negative reaction in some way.
It's definitely not recommended getting drunk before a flight as you may be refused boarding, however 2 or 3 drinks may sufficiently relax you in order to assist with sleeping. Only you will know how that works for you.
It's also worth considering that if you fly often, there may be ways to get reasonably priced business class flights or ways to upgrade to business class in order to get a flat bed. I'm currently on a trip in business class that cost less than economy would have been without a Saturday night stay. I was willing to give up a day of my weekend in order to have a bed.

Sleep sitting upright


What was the point of Tony instructing his man to do this?

Question: In the movie Scarface (1983) Tony survives an attempt on his life which he suspects was ordered by his employer Frank Lopez. Before confronting Lopez, he instructs one of his own men to call Lopez at a certain time and say the phrase "We f***ed up, he got away." But seeing Montana come to him Lopez already knew the hit was unsuccessful- what purpose did the phone call serve?
Answer: Tony knew he would be in Frank's office when the phone rang, and he could directly confront Frank about the content of the call based on his reaction.  Because Tony already knew what would be said to Frank, the fact that Frank didn't react like, "Who is this and WTF are you talking about?" let Tony know for sure that Frank called for the hit.  Until that point, Tony wasn't 100% sure if it was Frank or not.
Comment: Yup.  If Frank had been smarter and had thought faster, he might have saved his own life.


Getting Channel Divinity through multiclassing in 4e?

Question: I thought I read something about different ways to get Channel Divinity through multiclassing in D&D 4th Edition, but I can't remember where I found it or if I found it at all.  I'm curious about whether or not there's a way for a character multiclassing into a divine class (e.g., cleric or invoker) to get the Channel Divinity class feature without paragon multiclassing.  I know there are multiclass feats like Divine Channeler that grant use of Channel Divinity powers, but I think Divine Channeler makes you treat those powers as dailies instead of encounter powers, so I'm more curious about multiclass feats that treat Channel Divinity like how it is for a full divine character.
Answer: Your analysis is correct. You cannot get per encounter use of Channel Divinity without paragon multiclassing (all of the Channel of X feats are require paragon MC).
There is no feat based multiclass that provides Channel divinity in the way that you are looking. You could hybrid with one of the divine classes and get it, but that's a similar (if not more severe) commitment as PMC.
Overall, this is as intended. Generally with MC type features you get encounter stuff daily and at-will stuff per encounter.
Answer: In 5E you get Channel Divinity as a Palladin level ability.  So if you multi-class to Palladin and work it high enough you can get it.
Comment: You are talking about a different version of the rules, and it is generally not safe with DnD in particular to make any assumptions about similarities


Stereo vision with raspberry

Question: Is there a stereo camera module that would work with raspberry?  Did anyone try to do synced video with raspberry in some way?
Answer: The RPi compute module (note: not the regular RPi) has two CSI camera ports, and implements stereoscopic capture. On a regular RPi, however, you'd need to resort to a couple of USB webcams (preferably ones that implement video compression themselves to save the CPU doing any work). Unfortunately, without some means of syncing them externally they'd gradually drift, and I'm not currently aware of any mechanism to synchronize USB webcams.
Comment: As I understand it, on the compute module if the cameras are initialised for stereoscopic use they are synchronised in hardware. I don't know how close the sync has to be for stereoscopic use, but I'd guess anything beyond a couple of frames would look very strange indeed!
Comment: Thanks, I will check it out.  Do you know what is the acceptable time diff in between the captures for the stereo to work? Do you think it is possible to achieve this in software?
Comment: Do you know if it is possible to sync the compute modules cameras in hardware?

Stereo vision with raspberry


How to hide an app from the Launchpad?

Question: Is there any way to hide an app from the Launchpad in Yosemite?
I don't want to delete it or something like that I just want to hide apps that I don't use frequently, and I have a lot of them, putting them in a folder that I ignore makes the Launchpad slow to process, any solution to get rid of them without deleting them?
Comment: You best option is to modify the launchpad database.
Comment: maybe see if http://apple.stackexchange.com/questions/18535/where-is-the-launchpad-database-stored-and-is-there-a-way-to-edit-it-directly may help.
Comment: Launchpad only contains apps in `/Applications`. Is moving them to another directory an option for you?
Comment: Does it cause no problems to move Apps from /Applications
Comment: I had problems (with Lion) which kept showing old apps (in other partitions). My solution was to Trash the Launchpad db and restart.
OS X will recreate the database.
Answer: If you feel that your Launchpad is filled with apps, you can make folders in Launchpad by moving a app over another app.
How to do this shown at wikihow, this is done in Mac OS X Lion, but will work in Yosemite.
What the content of link describes is how to make folders in Launchpad, this is easily done by moving an app (inside Launchpad) over another app. This will make a folder with both apps in it.
Comment: Please summarize the relevant content from the link, in case it is removed.
Comment: Quote from the question: "putting them in a folder that I ignore makes the Launchpad slow to process"
Comment: You're right, sorry for not reading that properly.
Answer: Prepending a dot (.) will make the folder or file became hidden. You can do it using Finder or shell. Just change the app name, prepending a dot. To unhide the app, just remove the dot. Note that Launchpad will take some time to see the changes. If it doesn't work, try to reboot.
Tip: in Finder, you can toggle to see hidden files using keyboard shortcut CMD + SHIFT + .
Using shell:
cd /Applications
sudo mv YourApp.app .YourApp.app

As you may know, mv command takes 2 parameters: from and to.
To unhide is similar:
cd /Applications
sudo mv .YourApp.app YourApp.app

Comment: That doesn't work for me. I changed an apps name Sparkle.app to .Sparkle.app and the file still showed up in Launchpad with the . (dot) as first character in name.
Comment: will the app still run if you put a . in front of its name?  Easy enough to check but I thought I would ask.
Comment: I don't know the details, but you need to wait a bit... after changing the name, the app was appearing in LaunchPad for a couple of minutes, even I could execute it. But after some time it disappeared. If I change the name removing dot, it will appear again. I am using macOS High Sierra (10.13.4)
Comment: @jmh if you press **CMD + SHIFT + .** in Finder, you will toggle seeing hidden files. Double click on hidden app will launch it without problems.
Answer: Just Move them out of the Applications Folder. Copy an app from the Applications folder and paste it in a folder like Downloads or Documents.
Screenshots (in order):

https://www.dropbox.com/s/z05ty4qnj73hjzb/Screenshot%202016-08-21%2010.30.40.png?dl=0
https://www.dropbox.com/s/2nel0hfiu9hco2w/Screenshot%202016-08-21%2010.31.10.png?dl=0
https://www.dropbox.com/s/gxnm2lg4v64x5n6/Screenshot%202016-08-21%2010.31.23.png?dl=0
Comment: Images are best linked directly [SE uses its own sub-domain at imgur for this] rather than from somewhere like dropbox, where they can vanish later. I've inlined the first two for you, using different methods, so you can see how it's possible to either directly inline via drag & drop, or use html to reduce the apparent size without altering the actual image [2nd way requires drag & drop first, then a re-edit to change to html]
Comment: This doesn't work at all for me. Moving, duplicating, Launchpad still keeps the pointer to the file in place. Are you doing some manual clearing of the launch database?
Comment: @bmike did you try to reboot?
Comment: Yes  @RubatharisanThirumathyam - tried it on several machines. 10.11 and 10.12 - launch database finds apps in user home folders as well as desktop and /Applications for me.
Comment: @bmike, I have no idea why it's not working for you - I don't really use the launchpad, spotlight is 100 times faster for me than finding the app in Launchpad :)
Comment: Yea I use Dropzone and PMenu.  Simplifies things greatly!

How to hide an app from the Launchpad?


Using standard OS dialog to browse for files and directories in Action Script 3.0

Question: I know very little about Flash so I apologize in advance for asking what is possibly a dumb question, although I did a fair bit of research before posting.
Our current Flash app, written in AS3.0, is able to display a standard OS browse dialog for the purpose of allowing a user to select files. We are using http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/FileReferenceList.html to display this dialog.
The documentation for FileReferenceList states that only files could be selected. The new requirement is to allow the user to select directories as well as files. Afterward it would be very nice, but not required, to be able to get a recursive list of all the files in the selected directory.  Is it possible to implement this in Flash running inside a browser?
The closest I've seen so far is http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/filesystem/File.html#browseForDirectory() which does what I want but it only seems to work inside Adobe AIR and is not exposed to the browser.
Any suggestions would be highly appreciated.
Thank you.
Answer: As far as I know what you're trying to do is not possible unless you are running an AIR application. It would be helpful to know what it is you intend to do with the selected file/files... good luck!


What does $C^\infty([a,b]; \mathbb{R})$ denote?

Question: What does $C^\infty([a,b]; \mathbb{R})$ denote? I know it's a set of functions $[a,b] \to \mathbb{R}$. I think the $C$ stands for continuous. What does the $^\infty$ mean here?
Comment: Infinitely differentiable-- smooth.
Answer: There are two natural definitions.

It could mean continuous functions on $[a,b]$ which are smooth in the interior $(a,b)$ and so that all derivatives have limits at the end point $a$ and $b$.
It could also mean functions on $[a,b]$ that can be extended to infinitely differentiable functions on a larger, open interval $(a-\varepsilon,b+\varepsilon)$.

Fortunately, the two are equivalent. It is rather obvious that a function which is smooth in the second sense is smooth in the first sense. The converse can be proved by appeal to the theorem that, for every sequence $(c_n)$ of real numbers, there is an infinitely differentiable function $g$ defined on a neighbourhood of $a$ so that $g^{(n)}(a)=c_n$ for all $n$. Given a function $f\in C^\infty([a,b])$ in the first sense, put $c_n=\lim_{x\to a}f^{(n)}(x)$, pick a $g$ by the theorem mentioned, and extend $f$ by using $g$ instead to the left of $a$. Do the same at $b$. The result is a smooth function on a bigger interval, so $f$ smooth on $[a,b]$ in the second sense.
Comment: The theorem you cite can be summarised as "every formal power series (no matter how divergent) is the Taylor series of a smooth function". It is also useful as an antidote against the optimistic attitude about Taylor series that is often transmitted to students.
Comment: @MarcvanLeeuwen: Indeed. I was going to say that, but my answer was getting too long. Thanks for bringing it up.
Comment: Would you have a reference to that theorem please? I think some care is necessary here in that the extension $g$ need not match $f$ on the original domain, eg, $f(x) = e^{-\frac{1}{x^2}} 1_{(0,1]}(x)$ on $[0,1]$ has $f^{k}(0) = 0$ for all $k$.
Comment: @copper.hat: No, I don't have a reference at hand. It's sort of folklore, found in various textbooks. You don't need $g$ to match $f$ in the original domain, though. You just use $f$ inside, $g$ outside. The important point is that all the derivatives are continuous across the boundary point.
Comment: Thanks! I just found it, it is called Borel's lemma. However,the construction seems a little artificial to me, in that it just defines a function $g$ whose derivatives match the limits of $f$'s derivatives. But since $f$ and $g$ need not match on the overlapping domains, one could have obtained the same result just by defining the derivative at the limit as the limit of the derivative and showing that it has the appropriate Frechet-like property there?
Answer: Smooth (ie, infinitely differentiable) functions from $[a,b]$ into $\mathbb{R}$.
Comment: What exactly are the smoothness conditions at $a$ and at $b$?
Comment: @MarcvanLeeuwen: Good question. See my answer.
Comment: Existence of one sided derivatives is sufficient here. In general, I suppose the domain should be such that it is 'sufficiently rich' around the boundary to uniquely define a derivative.


Are there religions with no concept of afterlife?

Question: Are there any accepted religions that have never developed a concept for where individuals go when they die? (i.e. Heaven/Hell, Valhalla, reincarnation, etc.)
I only ask because I believe this to be the focal point of most religions: People's belief centering around how they can gain eternal life.
Comment: Many Therevadan Buddhists have believed something close to this, though it can be hard to pin down what they're saying because they have subtle ideas about what the self is. There are also several polytheistic mythologies with a finite afterlife (Norse), an afterlife that can be thrown into jeopardy (Egyptians), or no afterlife at all. I've also read that some Jewish sects did not believe in any kind of resurrection, and finally, depending on what you consider to be religion, many Greek and Indian philosophers practiced a pre-scientific materialism.
Comment: I'd qualify this to say that most "new" religions (Christianity, Islam, Buddhism, etc.) focus on personal redemption, but this was not the focal point of earlier, pagan traditions, which were much more concerned with cycles of generation, specifically in regard to agricultural cycles.
Comment: I'd think that afterlife would be a primary category by which people would know whether or not to classify a given set of beliefs as religion or not.
Comment: Roman era pagans certainly did not make it central.  There are writers discussing what religion buys you without even mentioning the afterlife.
Answer: Buddhism has the belief that nothing lasts forever and therefore basically doesn't believe at least in an eternal after life(which is what I believe you were implying).

A passage in the Nirvana Sutra called the "Verse on Impermanence"
  tells the story of Sessen Doji, who, during his Buddhist practice, was
  willing to lose his life in order to hear the teaching he sought:
  All is changeable, nothing is constant. This is the law of birth and
  death. Extinguishing the cycle of birth and death, one enters the joy
  of nirvana. (M.W., Glossary)
  Two principles from the "Four Emblematic Theorems" are
  demonstrated in this passage, i.e., "everything changes, nothing lasts
  forever", and "nirvana is tranquillity". link


How to size neutral if only/mostly 240 being used in an outbuilding?

Question: I'm running a line to an outbuilding where the main use will be as a 48A vehicle charger.  At most 2 120v circuits, one 20A and one 15A lighting.  If I have #2 conductors, will a #2 neutral be adequate?  Seems like not much should be flowing in the neutral for the 48A 24v charging circuit?
Comment: Believe you have to go with the 48amp size to the building at minimum, but you can use larger aluminum wire which is much cheaper than copper.  It is not what is planned for right now, but what might happen in the future or an oops.
Comment: Agreed, the place to scrimp on heavy feeder is by using aluminum wire, not by shaving neutrals. 2 AWG aluminum is good for 90A which will support dual "60A" (48A) EVSEs using **Share2 power sharing** tech (a must-know if you foresee two EVs), + other loads.
Comment: Most inspectors require a feeder like this to have the same size neutral as the hots. There are cases where the neutrals are much smaller but usually on 3 phase where a transformer is pulling only a small portion of the total load or 277v lighting on a 480 panel, other than this I can only think of dryers and cooking equipment I don't remember any other exceptions.
Answer: Sorry, but the neutral must be the same size as the hots. Ground wires can be down sized, but not the neutral. You'll be installing a sub-panel for the breakers (EV charging, 120v outlets and 120v lighting)
Comment: George is correct about the only place you will see a reduced size neutral residential  is on ovens @70% if memory serves but table 259.102.c.1 can provide a size
Comment: @GaryAitken Under US NEC for *many decades now,* a ground wire (or metallic conduit serving as one) AND ground rod(s) at the outbuilding are BOTH required. So your service to the building needs to be 3 wires in metallic conduit or 4 wires, and the ground and neutral must be isolated at the subpanel in the outbuilding.
Comment: Not sure I understand the comment about downsizing ground wires.  There isn't a ground wire going to the outbuilding; there's a ground rod/connection at the outbuilding, right?
Comment: thanks all, that's why I asked!
Comment: @GaryAitken  the comment about downsizing a ground wire was just a general comment, not necessarily specific to your situation. There is tons of information here on SE on sub-panels.  Take a peek and you'll learn everything you need to know.


replace kosher pickle brine after leak

Question: I made kosher dills for a Christmas gift and they turned out great. The jar tipped in transit and leaked all the brine. Can I refill it? With what?
Comment: Are they refrugerator pickles or properly canned?
Comment: I don't think they're either. As far as I understand refrigerator and/or canned pickles that is the process of boiling them and using vinegar. These are kosher dills which were made by allowing them to sit in a salt brine for over a week. The lactic fermentation made them sour and delicious. Since it's not vinegar, but fermented, I worry that there's no replacement liquid I can put them in.
Answer: For fermented pickles, I suggest using a salty brine similar to the one you started with.
If you are really lucky, enough lactobacillae are present to recreate a pickling brine, otherwise a 5% salt solution should help keeping the cucumbers for a bit longer.
Instruct the recipients to use the pickles rather quickly, I'd guestimate a week in the refrigerator should be ok.
Comment: Ok. Thanks for the suggestion! Might also suggest we just eat them immediately.

replace kosher pickle brine after leak


Using ArcGIS 10 to find areas of overlapping use and areas with low use?

Question: I have a spatial data set that shows areas of use (several different types of use) on the landscape.  I am looking for ways to overlay these spatial use layers so that I can show where the areas of highest use (hotspot locations) as well as areas of moderate use and areas of lowest use.  How can this be best achieved?
Comment: When you say you are looking for "highest use", are you asking for regions that have the highest number of different uses? If so, you could add a "Uses" field to each layer and initialize it to 1. Then do a spatial join of the layers, setting the field-mapping parameter to add. When you're done, each region in the result will have a Uses value equal to the number of layers that overlapped the region. (Of course, you really have to do a sequence of spatial joins of layers, first two layers, then each additional layer with the result of the previous join.)
Answer: I have done something similar for possible habitats analysis.

For each shapefile in the analysis (criteria types for habitats), I created a field (integer) called weighting and assigned it the value 1.
Then I used the union tool to union all the layers.
In the newly created union shapefile, I created a tally field and tallied up all the weighting fields to get a total weighting for that row.
Based on the tally, the higher the number the more criteria for possible habitat, occupied the same area.

At the time, this was the only method I could think of but after reading Llaves comments, that's another method I will now try. Hope this is some use.
Comment: Thank you for the input. Llaves, I am pretty new to GIS so excuse my ignorance, but does this mean that I should create another field and for each use polygon and give this field a value of one for each polygon? Also, I assume that the 'field-mapping parameter' options will come when I begin using the spatial join tool? After the spatial join is completed, with only 2 layers at a time, will I then have areas of overlapping use (new polygons), that have a use value associated with them? Is this correct?
Comment: user19497/user18747 Please [merge your two accounts](http://gis.stackexchange.com/contact/user-merge) so that you can comment in this thread.


Can you omit an implied object?

Question: In English you can say "my friend is visiting" with the object me/us implicit. In German can you say "meine Freundin besucht" omitting the object? Or must you be explicit?
Answer: You can't, at least not as a literal translation.

Mein Freund besucht gerade

Wouldn't count as a complete sentence because besuchen has mandatory transitivity, thus needs an accusative object.
You could, however, formulate the same fact as

Mein Freund ist [auf/zu] Besuch

with the same meaning as in English.
Comment: ...ist *zu* Besuch?
Comment: "auf Besuch" seems regional and even there much less common: http://mediawiki.ids-mannheim.de/VarGra/index.php/Auf_/_zu_Besuch
Comment: In general it depends on the verb, with a good portion of transitive verbs having an optional accusative object, for example *essen*. Sometimes these verbs are called ambitransitive, but such a label may be misleading since there seems to be a continuum between fully transitive and fully intransitive. You can also have optional dative objects, which increases the number of possibilities.
Answer: You may get rid of the object, but you need a different verb for that to work. Idiomatic sentences are:

Meine Freundin kommt heute. (like "arrives today") or
Meine Freundin ist gerade da. (like "is currently visiting")

Can you omit an implied object?


phonegap webos 3.0+

Question: I have a phonegap iOS app that i ported to webos on the touchpad the app works great except for the one iOS plugin that i used.  it basically saved the canvas data to the photo roll.  From my understanding of webos i will need to create a node.js service and write the data to a buffer and finally to the file system, there is an example for that in the forums.  however what i can not figure out is how to call all of this from my phonegap app.  I believe i will need to have the following in my index.html file.
<code>    <script src="/opt/PalmSDK/Current/share/framework/enyo/1.0/framework/enyo.js" type="text/javascript"></script>

and something like
    enyo.create({kind: "Main"}).renderInto(document.body);
</code>
my guess i will also have to have all of the "kind" data in a js file.  but how do i do the little step from my app's js file to communicate with the service that is created.  I looked in the phonegap 1.0.js file and see that they are calling services this way.
<code>            this.service = navigator.service.Request('palm://com.palm.applicationManager', {
    method: 'launch',
    parameters: {
    id: 'com.palm.app.camera',
    params: {
            appId: 'com.palm.app.camera',
            name: 'capture',
            sublaunch: true,
            filename: filename
        }
    },
    onSuccess: successCallback,
    onFailure: errorCallback
});
</code>
but i also noticed it appears that it is all mojo and what i am doing is enyo, so yes i am pretty confused the moment...
seems it should be easy to call a service in webos, say here is a string of image data and write it to the file system from my existing phonegap app.  and not have to do everything in enyo.  anyone have a sample of a webos plugin like this or know where to point me?
thanks tim
**Update
I have created a node service now as defined below, i think that works and i am trying to make the call to the service, but it does not get to it. the test app runs on my touchpad, but when i push the button to save the image i do not get into the service.  I tried to follow what was done for the camera in the phonegap0.0.1.js file  this is a copy of my service, how i defined it and how i am calling it.  any ideas what i am doing wrong.
services.json =
<code>"id": "com.tim.pgmojo1.service",
"description": "FileIO Service",
"services": [
  {
"name": "com.tim.pgmojo1.service",
"description": "FileIO Service",
"commands": [
    {
      "name": "writefile",
      "assistant": "WriteFileAssistant",
      "public": true
    }]
  }]
}
</code>
**   service code
    var libraries = MojoLoader.require({ name: "foundations", version: "1.0" });
    var fs = IMPORTS.require("fs");
    var sys = require('sys');
<code>var WriteFileAssistant = function() {}

WriteFileAssistant.prototype.run = function(future) {
 var mypath = this.controller.args.thepath;
 var mydata = this.controller.args.thedata;
 console.log("in write file");
 console.log("path=" + thepath);
 console.log("image data=" + thedata);

 var data = content.replace(/^data:image\/\w+;base64,/, "");
 var buf = new Buffer(data, 'base64');
 fs.writeFile('/media/internal/downloads/timimage.png', buf);
}
</code>
my call to the service**
this.service = navigator.service.Request('palm://com.tim.pgmojo.service', {
        method: 'writefile',
        parameters: {
<code>            thepath: '/media/internal/downloads/timimage.png',
            thedata: canvasData
    },
    onSuccess: mySuccess,
    onFailure: myFailure
});
</code>
currently i have this in my index.html file since it is only for testing..
Answer: Mojo is still included on the TouchPad.  You can use the same service-calling functions as PhoneGap is doing.
Answer: In Enyo, access to on-device services is handled by the enyo.PalmService kind.  You can see an example of an app that has a node.js service included and how calls are made to this service at https://github.com/palm/txjs-fortunecookie

phonegap webos 3.0+


How to change name of font?

Question: I want to change the PostScript name of an OTF font. I know it's possible to do this with Font Forge, but it seems like a really big deal to install this on my computer. Is there another way of doing changing the font name?
Comment: Possible duplicate of [How do you change a TTF font name?](http://superuser.com/questions/120593/how-do-you-change-a-ttf-font-name)
Comment: This may not be legal, as some fonts are the IP of some companies. Renaming (And then distributing at least). Just throwing it out there...
Comment: @AthomSfere It's a free font I found online. I made slight changes to its ascender properties and I want to use it inside an app alongside its original version. As they both have the same name, this isn't possible.
Comment: Does the usage policy cover redistributing it, and / or modifying it? Sometimes free means you can only use it, only use it personally. Sometimes you can do whatever you wish as long as you give credit back. And sometimes you are free to do whatever however you please.
Comment: @davidcondrey, there is an answer there that mentions postscript, but that question asks about TTF fonts and the answers seem to focus on that.  Do you know if answers for TTF fonts are also good for postscript fonts?  I'm unfamiliar with this so don't want to vote to close as a duplicate without checking.  Thanks.
Answer: Its actually pretty easy to do in Font Forge.  But if installing FontForge is the issue there are other, smaller, programs to the same effect.

TTX (requires Python)
TTX is command line and probably the easiest/smallest solution to renaming a font.  There's a brief tutorial on exactly how to do that here:  http://www.fontgeek.net/blog/?p=343

Typograf

GlyphsApp (free trial version)

Fontographer (comparable to FontForge)

How to change name of font?


How can I prevent egg casserole from deflating?

Question: I have a simple egg breakfast casserole made of Bisquick, eggs, milk, a can of chilis and cheese.  It tastes great, but when in carafe single serve dishes, it puffs up beautifully as it bakes, but collapses as it cools.  Is there anything I can add so it remains puffed up after baking ? I don't think separating and whipping the whites would work as all the other ingredients are so heavy.  Thx Steve
Comment: related: https://cooking.stackexchange.com/q/1136/67 ; https://cooking.stackexchange.com/q/62934/67 ; https://cooking.stackexchange.com/q/19529/67
Answer: What you're making is basically a savory Dutch baby or popover. Not to discourage you, but it's going to be really hard to come up with any way to make them consistently stay puffed; pretty much all egg-puff baked items deflate after puffing.
One easy thing you can do is to use the same step one takes with cream puffs, and prick them with a skewer right after they come out of the oven.  This releases steam from the center; the cooling moisture is actually what causes rapid deflation. You also want the interiors of the puffs to be as dry as possible.
The other things to do are experiment with adding slightly more bisquick, and cooking them slightly longer.  The additional flour should make them "sturdier", but you don't want to add so much they don't puff properly.  Cooking them longer is aimed at drying out the interior.
Of course, if the centers of your puffs are moist and you like them that way, you're going to just have to live with them deflating.  Also, realize that, even after you achieve the best stays-puffed recipe, sometimes (due to weather or timing or oven wonkiness) they'll still collapse on you.


Replacement for One Time Passwords (OTP)

Question: OTP may known as new generation of password security techniques, but I want to know does it still safe enough after several years of appearance or it will deprecate soon? & what would be the possible replacement for that?
Answer: One-Time Passwords (not to be confused with "One-Time Pad", a theoretically perfect but practically heavyweight technique for encryption) are a sound concept which cannot, as itself, deprecate. It just means: a given password (i.e. a secret value shared between prover and verifier, used for authentication) can be used just once with the verifier; in other words, if the verifier (e.g. a server you want to log on) accepts a password but will reject any further attempt with the same password, then it is a one-time password.
One-Time Password schemes are systems which use the One-Time Password concept and establish rules and mechanisms for the two parties (prover and verifier) to actually share one-time passwords. Any given scheme can be weak or strong, broken, deprecated... but the concept is unharmed.
RSA SecurID tokens can be viewed as an incarnation of the concept of one-time passwords -- a variant with a clock, actually -- and they are very much alive.
HOTP is a free and open standard for generation of one-time passwords (with an internal counter), which can be implemented by extremely cheap hardware tokens.
(Traditional one-time password authentication schemes for Unix servers use software generation of lists of passwords, which users are supposed to print and keep in their wallet, striking out used passwords. This never got popular -- I guess it is too low-tech; users are not amazed enough to forget the inconvenience of fiddling with a tangible object).
Answer: One time passwords (as implemented by RSA SecurID or other vendors) are theoretically safe but as with all security controls have limits that must be considered when designing your security system.
The OTP implementation may have implementation or design flaws that may permit to circumvent them.
OTP can be intercepted and used by attackers through the intermediary of trojans or XSS attacks for instance at the authentication stage (often with an apparent denial of service to you as a user since another party is using your freshly inputted OTP, thus invalidating it).
Most importantly, OTP systems often limits themselves to authenticate a user instead of authenticating a transaction. Once a user is authenticated, a trojan may re-use your authenticated web session with your bank for instance to perform transactions on your behalf in a sneaky manner.
Although I think OTPs still have a bright future ahead of them, they will be augmented with further security controls and will in particular increasingly try to address the problem of transaction authentication instead of limiting themselves to authenticating the user only.
Answer: One Time Passwords are one concept of doing two factor authentication. Something the user knows (password) and something the user has (OTP Generator).
The One Time Password being the proof of the possession. In this case the "possession proof" works like this:
The One Time Password is generated by an algorithm like HOTP (RFC4226) or TOTP (RFC6238) based on a secret kryptographic key and some moving factor.
The user is only capable of presenting the correct one time password if he is in the possession of the secret key.
This is why you should take care of this secret key and be suspicious about smartphone applications for OTP like the Google Authenticator.
But the basic concept of OTP is the same like doing public key crypto with challenge response.
The possession is the possession of a secret or private key.
OTP uses a secret key and not a private key, since the user should be capable of typing in the result (OTP value). Using a private key, this would not be possible, since the result of the private key operation is too long.
A private key scenario always needs the hardware to be connected to the machine (see smartcard login). ...and this requires drivers and connectors. (Try this with the iphone 11 ;-)
So yes, I think the basic concept of OTP - a.k.a. using a secret key - will still be around for a while.


Sound boom the other way around?

Question: We know the sound boom - but is there any effect if a body decreases the speed underneath the sound barrier?
Answer: Not really, it's just sound instead of a shock.
You can actually see this happen visually. Shock waves in air cause a visible lensing effect, and in the case of bombs exploding you can see this quite easily, sometimes as a sort of distortion and others as a white shell due to the pressure changes cause the water vapour to turn into drops.
If you watch films of this you'll notice that the shell gets to a certain size and then disappears all of a sudden. This happens because the shock wave strength is a function of the difference in air pressure on either side, and once the bomb is done exploding, the pressure (much more slowly) returns to normal. So you have this sort of "step" in pressure moving outward.
As the shock spreads out from its initial location, the pressure differential is being spread out over an ever-larger surface, so the differential is getting smaller all the time. At some point it drops below the point needed to maintain the shock, and it disappears. Since the drop is a function of r^2, this happens very rapidly, which is why it seems to happen over the entire surface at the same time.
Beyond this point you still have a pressure differential, just one that's too small to create a shock. And what do you call a moving pressure differential in air? Sound!
Answer: as an object pushing a shock wave through the air slows down, the shock wave transitions from a cone shape to a flat plane at that point where the speed of the air flowing past it is equal to the speed of sound. when the speed of the object falls further and is below the speed of sound, the shock wave expands into an ordinary sound wave which continues on its own at the speed of sound. A person listening to the approach of that object will then hear it coming and not experience a huge "boom" as it passes him.

Sound boom the other way around?


Cannot share folder in 2008

Question: I'm going through the sharing process on a folder on my root drive to get it shared across my domain. After setting permissions levels, the process attempts to share the folder but eventually says "Can't share this folder" with no additional information. I checked permissions, owners, and everything seems to be correct. Can't find any information in the EventLog to view it. File server role is installed. I went through the netshare wizard and was able to get it shared, but when I attempted to access it through a client computer, it unmounted the share. Any ideas?
Comment: What type of folder are you trying to share?  Some special folders cannot be shared.
Comment: Just a folder that I brought over from another computer. I created a new folder and shared it, then imported everything from that folder into it and it worked fine. Weird, eh?
Answer: Created a new share folder and dropped the contents into it - everything works correctly.

Cannot share folder in 2008


Is there an easy way to look through a directory, preview file by file, and choose to keep or delete it?

Question: I'm mostly looking to do an initial pass of a folder of 10k images and I want to go through one by one and mark each for deletion or for keeping. Any easy way to do that on a mac or is there a photo organization program that will do this?
Answer: Open the directory then instead of opening the image, you can press space to open a preview of that image. Now you can navigate through the images using your arrow ( ←→ ) keys.
If you want to delete any one of them then just go back to finder and the same image will be selected that you were previewing.
Comment: You can actually delete the file you're currently quicklook-ing without dropping back to Finder. Best in list view.
Comment: Okay. Looks like the trick is to open in list view, press space to quick preview, and then press cmd + del.
Comment: @Tetsujin ooh. didn't know. I'll try to look up how to delete while quick-looking
Comment: Yup, quicklook is still "in the Finder" in effect, so delete works the same whether QL is open or closed.
Answer: The Finder has four 'View' styles: Icon, List, Column, and the last one, which is either called "Cover Flow" or "Gallery View", depending on what version of OS you have.
This view lets you scroll through successive QuickLook Previews of each image in the folder.
You can select Gallery View by clicking on the icon in the Toolbar that selects the view, or using the View menu, or with Command 4.
Answer: Since you are talking about images, here's three methods I use:
First:
Open the directory in Column view.
Minimize all the higher columns by grabbing the vertical divider and dragging it the the left.
Select the first image in the directory.  A preview appears to the right.  If it is not one you want to delete, use the down arrow until you get to one you want to delete.
Grab the column divider to the right of the preview.  Not the window edge, but the divider.  Drag it right as far as you can to make the preview bigger.  If you reach the window edge, keep going; the window edge will follow.
With the Command key pressed, click on the next image.  A preview of it will appear on top of the first one.  If it is not one you want to delete, with the Command key still pressed, click it again to de-select it.  Otherwise, leave it on the pile.
Keep going down the column that way, for each image, either keeping it on the pile or deselecting it.
When you get to the end, right-click (control-click) on one of the selected filenames and "Move to Trash."  You could also drag it to trash, but there's a risk of accidentally letting go along the way and having the whole pile end up somewhere you don't want it.
Second:
I have the program called GraphicConverter (GC).  If you want it, it is available from that link or from the app store.  I double-click an image, and GC opens it for editing.  If it is one I want to keep, I click the "Next" icon in the toolbar above the image. If I want to remove it, I use Cmd-A to select the entire image, and then Delete.  This changes the image to either transparent or all solid background color.  Then I click the "Save and next icon.  Repeat until it cycles around to the image I started with.
Then put the directory in icon view, select all the one-color images and delete them.
Third:
Make the window as big as possible.  Drag the slider in the lower left corner to make the images big enough to judge.  Select "Sort by (anything)" from the View menu.  (You need this because it brings back into the window the images that were moved out of sight by resizing.
Scroll down the window, deleting the ones you don't want.  If you find it unpleasant that they rearrange after each delete, you can instead use Cmd-click to have selections add to a collection and delete the whole collection later.


Combining subset sum and subset product problems

Question: The subset sum problem and subset product problem are NP-complete.
Is the following problem polynomial-time solvable: given a set of positive integers, find a subset whose sum is $S$ and whose product is $T$.
Comment: The problem is NP-complete if you allow $0$'s:

(showing  your problem> reduction).

Suppose you have a subset sum instance $$ (i.e. needs to decide whether there's a subset $S$ of $I$ whose sum is $k$).

Now ask if $$ is a part of your language (i.e. whether $I\cup\{0\}$ has a subset whose sum is $k$ and product is $0$).
Comment: @DmitriyFinozhenok The question should always contain all the important information so people don't have to read the comments to find them. I edited your question to include the assumption that we're dealing with positive integers.
Comment: @David Richerby, thank you for your help.
Comment: Thank you, I see your point. We can assume that all set members are positive integers.
Answer: It is still NP-complete. Here is a very sketchy reduction from subset sum. The goal of the whole reduction will be to make $T$ unimportant.
If the inputs for subset sum are $a_i$, then add $a_i$ and $2^Na_i$ to our inputs, where $N$ is large, but still $poly(n)$.
Set $S$ to be $2^N$ times the original subset sum plus $2^N-1$.
Set $T$ to be the product of the $a_i$'s multiplied by a sufficiently big power of $2$, to be determined later.
The idea is that if the number with index $i$ was not picked, then we can pick $a_i$, while if it was picked, we can pick $2^Na_i$.
Finally, add a lot of each small power of $2$ to our input to be able to make the desired sum and product.
Notice that this gives us enough liberty to get $S$ and $T$.
Comment: I'm trying to understand the reduction; can you give a small example: suppose that $a_1=010$ (2), $a_2=011$ (3), $a_3=100$ (4), target_sum=101 (5); we can pick for example N=4 (it should be large enough) and set S = 1010000 + 0001111 = 1011111; the new elements $a_i$ and $2^N a_i$ are 0100000,0110000,1000000,010,011,100: what are the additional small powers of 2? And what is the target product T (which should be independant from the choice of the $a_i$s)?
Comment: @Marzio: sorry but I have not worked out the details. T should be 12 times a very large 2 power and we add many-many powers of 2 to the input, but only small ones, say $<2^{2n}$ where each $a_i$ has at most $n$ digits. $N$ would be say $n^4$, so quite unreachable with these sums. Hm, maybe better make the "plus" part of $S$ only $2^{2n}$.


Is the database class in Laravel use the "Singleton Pattern"?

Question: I am new to Laravel. Does the Laravel create a database connection every time for each query of the program or use the same database object throughout the program using the "Singleton" Pattern?  Does the strategy have an impact on performance, especially for Enterprise Level Applications?
Answer: Short answer
No, it's not a singleton, but a factory pattern. However the same connection will be reused if possible and you don't manually request it to reconnect. There is no performance hit.

Long answer
At the beginning of ever request lifecycle, in app/bootstrap/start.php an instance of Illuminate\Foundation\Application gets created. This servers as IoC container.
Shortly after creating the application all service providers will be loaded. The service providers are defined in app/config/app.php
'providers' => array(
    // ...
    'Illuminate\Database\DatabaseServiceProvider',
    // ...
),

Let's have a look at the Illuminate\Database\DatabaseServiceProvider shall we? The important part is the register function
$this->app->bindShared('db', function($app)
{
    return new DatabaseManager($app, $app['db.factory']);
});

An instance of DatabaseManager gets bound to db. This instance will stay the same over the whole request and will be used for every database request.

Example from "reverse" direction
Say you call
DB::table('users')->get();

First, the DB facade will resolve to the instance of DatabaseManager that gets bound in the DatabaseServiceProvider using bindShared('db')
protected static function getFacadeAccessor() { return 'db'; }

Then the table('users') call gets forwarded because the method doesn't exist in Database Manager
public function __call($method, $parameters)
{
    return call_user_func_array(array($this->connection(), $method), $parameters);
}

It is called on the return value of $this->connection()
public function connection($name = null)
{
    list($name, $type) = $this->parseConnectionName($name);

    // If we haven't created this connection, we'll create it based on the config
    // provided in the application. Once we've created the connections we will
    // set the "fetch mode" for PDO which determines the query return types.
    if ( ! isset($this->connections[$name]))
    {
        $connection = $this->makeConnection($name);

        $this->setPdoForType($connection, $type);

        $this->connections[$name] = $this->prepare($connection);
    }

    return $this->connections[$name];
}

With if (!isset($this->connections[$name])) it will check if the connection already has been established and will only make a new connection if not.
Then it returns the connection and table('users')->get() will be executed.
Comment: to be precise, say: **Short version - no, it's not singleton, but factory pattern. However the same connection will be used by default and if it's already available and if not requested otherwise by the dev, so there's no performance hit**.
Comment: Thanks mate. I incorporated your suggestion into the answer.
Comment: Thanks it really helps me to go with Laravel.
Comment: @MohitVerma Glad I could help. Please consider [accepting](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) this answer to mark your question as solved.


How is powering an LED with a 9 volt battery possible without burning the LED?

Question: I used a 220 ohm resistor with a 9V battery and the LED works fine. However, most sources say the forward voltage in a red LED is typically only ~2 volts. Going by this logic, the LED should have burned out, as resistors only limit current not voltage. If this is a stupid question, I'm sorry. I'm relatively new at electronics.
Comment: The resistor drops the voltage, so the LED only "sees" ~2 volts, as you say. Read about voltage dividers, voltage drop, and Kirchhoff's voltage law.
Comment: do more research before posting your question ... for instance, measure the voltage across the resistor
Comment: Resistors limit current because they drop voltage across themselves (check on Ohms Law) thus leaving less voltage to produce current in the rest of the circuit.
Comment: the Vf will rise to probably 100 mV from 20 to 30 mA on Red HB. It will probably run fine at 30 but risk reduced MTBF
Answer: Here is how this works -----

simulate this circuit – Schematic created using CircuitLab
I picked a 180 ohm resistor, because at 20 ohms/volt we are guaranteed a
50 milliamp intersection at the left axis. Thus we scale 20 ohms/volt by 9 volts, finding a 180 ohm resistor provides that current.
Note other LEDs will have lower forward voltage, moving solution-intersection
to the left and raising the solution-current closer to 50mA.
Answer: Using a battery that is not brand new so its loaded voltage is 8.0V and using a 3.2V blue LED, then the current is (8V - 3.2V)/220 ohms= 21.8mA. No problem when most 5mm blue LEDs have a maximum continuous current of 30mA.


Simple way to play a sound file (.aif)

Question: I'm making an app for Mac OS X using Xcode, and I want it to play a alert sound when something happens.
What is the simplest code for playing a sound in Objective-C/Cocoa? Note that my sound file is an .aif.
Also, where do I put the sound file inside my project?
Thank you.
Answer: To play audio on the Mac, you can either use NSSound for basic activities, or the more robust CoreAudio framework for more complicated tasks.

If you were to use NSSound to achieve this goal, your code would look something like this:
NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"replace-with-file-name" ofType:@"aif"];
NSSound *sound = [[NSSound alloc] initWithContentsOfFile:resourcePath byReference:YES];
// Do something with sound, like [sound play] and release.

OR
NSSound *sound = [NSSound soundNamed:@"replace-with-file-name-without-the-extension"];
// Do something with sound, like [sound play], but don't release (it's autoreleased).

If you were to use the second snippet, you would have to ensure that the sound file's extension is aiff and not just aif, since +soundNamed: looks for very specific file extensions; I don't think aif is on that list.
Using CoreAudio is more complicated, so if you just want to play it and mess around with very simple settings, just use NSSound
Comment: Thanks, can you give me an example of how to use NSSound in the code ?
Comment: Thanks it worked, just one more question: I sound was for example 1min and I release it, does it keep playing ?
Comment: Andy, the [NSSound Class Reference](http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSSound_Class/Reference/Reference.html) states that a sound will stop playing once it has been deallocated: "Upon deallocation, a sound object stops playback of the sound (as needed) so that it can free up the corresponding audio resources." So if you create a sound, start playing it, then release it before it has finished playing, the sound will stop.
Answer: Basic playback of sound is quite easy.
You can use the NSSound class to load the file in a few different ways, for example, by name:
NSSound * myAwesomeSound = [NSSound soundNamed:@"AwesomeSound"];

This will need to be retained if you want to keep it around.
in this case the class will search certain particular directories, including your application bundle, for a sound file with that name. One important note is that the file must have the .aiff (with two f's) extension in order to be found by this method.*
You would probably store the sound file in the Resources folder of your project; that's where "media" files are commonly kept.
Then you can play it very simply, perhaps using a button press:
- (IBAction)playTheSound:(id)sender {
    NSSound * myAwesomeSound = [NSSound soundNamed:@"AwesomeSound"];
    [myAwesomeSound play];
}

It's also possible to do some basic transport control: pausing, stopping, checking whether the sound has finished, and so on.  Please see the Sound Programming Topics Guide for details.

*It's possible to use other formats, too, of course.
Answer: For example, add the AudioToolbox framework, the add the sound file to your resources / project, then add the below to your .h:
#import <AudioToolbox/AudioToolbox.h>

And then: (after @interface { blah } in your .h)
- (IBAction) playSound;

Add the following to your .m: (change 'Ping' and 'wav' to the respective file name and type)
- (IBAction) playSound
{
    SystemSoundID soundID;
    NSString *soundFile = [[NSBundle mainBundle] pathForResource:@"Ping" ofType:@"wav"];
    AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:soundFile], &soundID);
    AudioServicesPlaySystemSound(soundID);
    [soundFile release];
}

Answer: You can copy and add your .aif files to your project in Xcode as follows:

Command-click on the Classes folder (from within xCode)
Select Add > Existing Files
Navigate to the directory containing your .aif and select it(them). Click Add.
(optional: Check the "Copy items" checkbox & Click Add.)

See Apple's examples & great info: here & here.

Simple way to play a sound file (.aif)


F# WPF MVVM can I do this without making the view model variables mutable?

Question: I'm learning F#, I want to build the next module of my home project.  So far most of my F# code has been test code written with the command line.  I also did some custom drawing to a Winforms Panel.  So far, I haven't had to use one mutable variable.  but now I'm trying to write some actual code and as soon as I got to the ViewModel part it seemed that I had no choice but to make the variables that will interact with the UI mutable.  Is this true, or is there something I'm missing?
Comment: Yes it is true - but you don't need make already used objects mutable. Just create "decorator" wrapper class with mutable properties. Another approach which I found will follow "right tool for the job" approach is using C# projects for view and ViewModels and F# for your "business" logic. For immutable values you can create converters which will create new instance on every change
Comment: For making (existing) classes mutable for infrastructure only, have a look at `CLIMutableAttribute`. Make sure that your design does not get polluted though and mutability is limited as much as possible.
Comment: I did consider doing the view models in c# when I started to realize this.  I think that that may be the way to go.  I find that the syntax that comes along with mutable objects is not as natural in f#.  Thanks.
Answer: For MVVM, F# carries one very significant advantage: it does not allow circular dependencies. This makes it very difficult to break the pattern: i.e. to allow the model to directly affect the viewmodel, or the viewmodel to access the view. As Bent says, F# is multi-paradigm: it supports properties with getters and setters, and these are not things to be eschewed in the language.
It's interesting that I'm citing a lack of capability as one of the advantages of F#, but I feel it is precisely this preclusion of circular dependencies that makes the language a good choice for an enterprise architecture.
I have a toy project at https://github.com/SpiegelSoft/Astrid. You can look through that to see how I've implemented MVVM using ReactiveUI.
Answer: Yes, it is true. The inherent nature of MVVM precludes immutability.
If immutability really is that important to you, then have a look at the MVC framework created by Dmitry A. Morozov. This is the project page on GitHub:
http://fsprojects.github.io/FSharp.Desktop.UI/
I am not sure I would use it, since so few others do, but it is definitely worth studying.
As for the language;
If I remember correctly, they initially experimented with Haskell, but then decided Ocaml was more practical. So that's what F# is based on. Haskell is as pure as they come, which became a problem in the .NET world, while F# is a multi-paradigm language better suited for the real world needs in .NET.
So don't feel bad about using mutable in F# in some cases. I will go so far as to say you are meant to. It's not bad at all, and in the long run it still gets the job done more efficiently than with C#.


A collocation meaning "one has anger"

Question: In the sentence "[...] once anger prevails our consciousness we should immediately distract ourselves to avoid its subsequent effects.", I have directly translated from Turkish, but I was told that there is not such an idiom in English(I mean to prevail consciousness). I guess you can easily infer what I want to convey by that idiom, how do I correct it?
Comment: How about *becomes apparent*?
Answer: There is the metaphorical expression flood one's consciousness, not all that common but quite acceptable.
An example from Cynicism and the Evolution of the American Dream, by Wilber W. Caldwell:

The fourth way in which the American media creates and stimulates
  widespread cynicism has to do with the way the media floods our
  consciousness.

An example having a more obviously non-sentient subject, from Libuvim, is:

When the waves of the ocean of our life flood our consciousness ...

but this is getting rather gushy.
Dictionaries give different senses that point to the 'deluge' metaphor here; RHK Webster's gives perhaps the closest sense:

flood vt (9) to overwhelm with an abundance of something

If you're happy with a less word-for-word paraphrase,

Anger surged through him
He clenched his fists as the anger coursed through him

are more idiomatic (ie used more often).
Answer: The problem with your phrase is that prevail is an intransitive verb, so you need to use a preposition:

[...] once anger prevails in our consciousness, [...]

which means that anger is the prevalent, most active component of our consciousness; or maybe

[...] once anger prevails over our consciousness, [...]

which treats anger as an opposite to our consciousness, implying you can be so angry as to become unconscious.
Comment: I guess "to prevail" has more than meaning than I want. It is a bit strong. Is there any other choice?
Comment: Sure. _overtakes, takes over, gets hold of, invades, enters, possesses, occupies, is in, influences, affects, disorders, inflames, fills_ .... [one's mind]
Answer: Not knowing either Turkish or the original text, I would say anger dominates one's consciousness.

A collocation meaning "one has anger"