In Objective-C how can I display a uint8_t variable in binary? Say I start with:  uint8_t x = 0x12;   For debugging purposes I want to "print" it in binary (using NSLog) so I see: 000010010.   Is there a way to do that in Objective-C? The closest I got is using %o format, which gives 22 and then manually translate that to binary.  Also what about uint16_t y = 0x1234; or uint32_t z = 0x12345678; ?
Is there a printf converter to print in binary format? I can print with printf as a hex or octal number.  Is there a format tag to print as binary, or arbitrary base? I am running gcc. printf(&quot;%d %x %o\n&quot;, 10, 10, 10); //prints &quot;10 A 12\n&quot; print(&quot;%b\n&quot;, 10); // prints &quot;%b\n&quot;
Convert timestamps with offset to datetime obj using strptime I've just made a minor alteration to a file from a TeX package.  I copied it into my local texmf tree and made the change there.  When I tried kpsewhich &lt;filename&gt; to test that it was finding my local version, it returned the original one and not the new one.  In actual fact, the original file was from my local texmf tree already so I renamed the old one something simple.  Now kpsewhich &lt;filename&gt; returned the system version of the file.  To check that the file was there, I tried kpsewhich -all &lt;filename&gt; and got the correct two versions of the file: my modified one and the system one (in that order).  If I try this with another file that I know exists in both places, then kpsewhich &lt;filename&gt; returns my local file.  Here's the various invocations and their results:  ~% kpsewhich pgfsys-pdftex.def /usr/local/texlive/2012/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def ~% kpsewhich -all pgfsys-pdftex.def  /Users/stacey/Library/texmf/tex/latex/bzr/pgfsys-pdftex.def /usr/local/texlive/2012/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def ~% kpsewhich tqft.sty               /Users/stacey/Library/texmf/tex/latex/bzr/tqft.sty ~% kpsewhich -all tqft.sty /Users/stacey/Library/texmf/tex/latex/bzr/tqft.sty /usr/local/texlive/2012/texmf-dist/tex/latex/tqft/tqft.sty   Is it something special about the .def extension?  Is there some command that I forgot to run?  Are there some other options to kpsewhich that will help me debug this? Having just  from any of the queues, it was reviewing close votes; however, this audit was flawed in that I didn't even cast a close vote.  Often I press the Close button to preview greater detail and sentiment of the closure, spawning the Why should this question be closed dialog box:    Especially for duplicates, where functionality is solely dependent on spawning this dialog.  From Closing > Duplicate, I can search or view selected duplicates:    Although, I realize general closure reasons are summarized on the page:    This question had 6-upvotes, but seemed very localized referencing subjective query is "taking too long" and even had a sqlfiddle link.  Maybe overly broad regarding performance tuning, the OP was posting like a forum with two answer posts to his own question  and  with one of those answers asking follow-up questions.    Wanting to gauge community response, current closure totals struck my curiosity.  So, I pressed the Close button and boom - oh, the humanity!  I failed, and didn't even cast a close vote.    Votes are not cast until a reason for closure is selected and Vote to Close is pressed.  Taking any review very seriously on this site, it only seems fair that my review quality is tested through actionable steps instead of clicking for more detailed information, leveraging the functional design of the close vote user interface.  Sure, it's complex to seed fake vote totals, and then there's controversy of mindless voting in the majority or people who simply cherry pick 4-vote questions.  Still though, it seems unfair I should hesitate to review further information of vote totals and duplicates before skipping due to the implementation of this audit. How can I swap or replace multiple strings in code at the same time? How to show  tag literally in / tag? How is Cycles different from Blender Internal? Find Total number of ways out of N Number taking K numbers every M interval I have been stuck in a problem, that has thrown my brain out of the coding. This problem is at very high priority and I need the solution as early as possible. Problem is as :  There are exactly N advertising boards on the highway. Now a company want to advertise on some of these advertising boards(each advertising board costs some money) .  Company strategy is that, they want at least 'K' advertisement should be there among M consecutive advertising boards. But at the same time Company want to pay minimum for its advertisement .  Now, what is the total number of ways, different ways Company can advertise meeting its minimum cost strategy.  As for Example: N= 3, M = 2, K=1 ==> there is only one way for minimum cost, ie. 0C0 , where '0' denotes No company advertisement, and 'C' denotes company advertisement board.  Similarly, for N =4, M =2, K =1 ==> there is 3 possible ways, ie. C0C0, 0C0C, 0CC0.  Hope to get a reply from someone soon. Thanks. Radius of Convergence of a given Power series How can I mass rename files? I've got a bunch of files named with a the pattern 99 - DescriptiveName.txt and I'd like to remove the number from the front so I just have DescriptiveName.txt.  How can I do this? Can I do it from the command line or is there a utility that can do this? This is a question I've been asked several times by students and I tend to have a hard time phrasing it in terms they can understand. This is a natural question to ask and it is not usually well covered in textbooks, so I would like to know of various perspectives and explanations that I can use when teaching.  The question comes up naturally in what is usually students' second course in quantum physics / quantum mechanics. At that stage one is fairly comfortable with the concept of wavefunctions and with the Schrödinger equation, and has had some limited exposure to operators. One common case, for example, is to explain that some operators commute and that this means the corresponding observables are 'compatible' and that there exists a mutual eigenbasis; the commutation relation is usually expressed as $[A,B]=0$ but no more is said about that object.  This naturally leaves students wondering     what is, exactly, the physical significance of the object $[A,B]$ itself?   and this is not an easy question. I would like answers to address this directly, ideally at a variety of levels of abstraction and required background. Note also that I'm much more interested in the object $[A,B]$ itself than what the consequences and interpretations are when it is zero, as those are far easier and explored in much more depth in most resources.    One reason this is a hard question (and that commutators are such confusing objects for students) is that they serve a variety of purposes, with only thin connecting threads between them (at least as seen from the bottom-up perspective).   Commutation relations are usually expressed in the form $[A,B]=0$ even though, a priori, there appears to be little motivation for the introduction of such terminology. A lot of stock is placed behind the canonical commutation relation $[x,p]=i \hbar$, though it is not always clear what it means.  (In my view, the fundamental principle that this encodes is essentially de Broglie's relation $\lambda=h/p$; this is made rigorous by the  but that's quite a bit to expect a student to grasp at a first go.) From this there is a natural extension to the Heisenberg Uncertainty Principle, which in its general form includes a commutator (and an anticommutator, to make things worse). Canonically-conjugate pairs of observables are often introduced, and this is often aided by observations on commutators. (On the other hand, the energy-time and angle-angular momentum conjugacy relations cannot be expressed in terms of commutators, making things even fuzzier.) Commutators are used very frequently, for example, when studying the angular momentum algebra of quantum mechanics. It is clear they play a big role in encoding symmetries in quantum mechanics but it is hardly made clear how and why, and particularly why the combination $AB-BA$ should be important for symmetry considerations.  This becomes even more important in more rigorous treatments of quantum mechanics, where the specifics of the Hilbert space become less important and the algebra of observable operators takes centre stage. The commutator is the central operation of that algebra, but again it's not very clear why that combination should be special. An analogy is occasionally made to the Poisson brackets of hamiltonian mechanics, but this hardly helps - Poisson brackets are equally mysterious. This also ties the commutator in with time evolution, both on the classical side and via the Heisenberg equation of motion.   I can't think of any more at the moment but they are a huge number of opposing directions which can make everything very confusing, and there is rarely a uniting thread. So: what are commutators, exactly, and why are they so important? Present tense for future events Why does it sound perfectly natural to say Our flight leaves tomorrow at 6pm but weird to say It rains tomorrow at 6pm? What kind of scenario, if any, could make the rain sentence sound natural? In all shells I am aware of, rm [A-Z]* removes all files that start with an uppercase letter, but with bash this removes all files that start with a letter.  As this problem exists on Linux and Solaris with bash-3 and bash-4, it cannot be a bug caused by a buggy pattern matcher in libc or a miss-configured locale definition.  Is this strange and risky behavior intended or is this just a bug that exists unfixed since many years? I am trying to install Ubuntu 14.04 on FakeRAID along Win7.  Win 7 has been already installed, and dmraid is running.  During the installation I choose to manually partition, this is the structure:  \dev\mapper\isw_gchdghhd_Volume0 \dev\mapper\isw_gchdghhd_Volume0Op1 - NTFS Win7 loader \dev\mapper\isw_gchdghhd_Volume0Op2 - NTFS Win7 partition \dev\mapper\isw_gchdghhd_Volume0Op3 - swap \dev\mapper\isw_gchdghhd_Volume0Op5 - ext4 mounted as \ \dev\mapper\isw_gchdghhd_Volume0Op6 - ext4 mounted as \home   There is another sequence similar to above marked as "linear".  I choose \dev\mapper\isw_gchdghhd_Volume0 as boot device.  When immediately after the installation begins, an error with question marks pops up, and the installation stops. Replacing Raster Values in Ras1 with Ras2 Why are these black dots / spots appearing in my pictures? When should "no problem" replace "you're welcome" as a response to "thank you"? How to prove that this set is closed? Suppose $Y$ be an ordered set in the order topology. Let $f, g: X \to Y$ be continuous. How to show that the set $\{x| f(x) \leq g(x)\}$ is closed?  This is a excercise from munkres. Maybe trying to show that the set $f(\{x| f(x) &gt; g(x)\})$ is open is suffice. But I could not figure out the connection between this set and the continuity of the two functions.Could you give a hint?  Thanks. My sisters and I all have iPhones under the same account. I also have an iPad under the same account. I am trying to get the iMessage on my iPad compatible with my phone number, not email address.   The only phone number choice to choose from is my sister's iPhone number. How can I choose my phone number for iMessage on my iPad? Defaulting on credit cards before leaving the country I have a colleague who is going back to his country after staying for a couple of years in US. He has 3-4 credit cards plus a personal loan. His total debt would come to around $10,000. Some days ago, he told me he is going to default on the accounts. He figures, since he is not planning to come back to US, it should not matter to him.  Question is, is this a bad move on his part, and if it is, how can I convince him? When writing dates in prose in the dmy format (29 March 2014), is the correct preposition "in" or "on". I'm seeing it with "in" , but that construction is foreign to me.     It was released in 29 March 2010 on Steam for Microsoft Windows, and in 25 March 2010 on Xbox Live Indie Games for the Xbox 360.    "On" would seem to make more sense, from what I know. Verdict?