Currently, I can save the file in the same directory of the project. I'd like to save some data in a text file and save this file in an SD card if any is inserted to my board (BeagleBone Black). Otherwise, if no card is inserted, the file should be saved to the current location.  I know that the following sequence is required to do this task directly in terminal:  # Check if some card is inserted under the usual name fdisk -l | grep mmcblk0p1 # if something returned, then a card is inserted sudo mkdir /media/sdcard/ sudo mount /dev/mmcblk0p1 /media/sdcard/ cd /media/sdcard/ touch data.txt umount /dev/mmcblk0p1   I thought about calling these commands in my C program using system function. But I don't know how to check if the first command has returned something or NULL.  I have two questions:  1- Is using the above commands is the best way to check if an SD card is inserted?  2- How to check the output of a command run by system?
I've got a utility that outputs a list of files required by a game.  How can I run that utility within a C program and grab its output so I can act on it within the same program? UPDATE: Good call on the lack of information.  The utility spits out a series of strings, and this is supposed to be portable across Mac/Windows/Linux.  Please note, I'm looking for a programmatic way to execute the utility and retain its output (which goes to stdout).
Do 'learn by heart' & 'learn by rote' mean the same? Here in India, both the phrases learning by heart and learning by rote are taken to have the same meaning, i.e., blind memorisation without true understanding.    However, some sources say that to learn something by heart implies that one knows something so well that it has been thoroughly internalised and imbibed.    So is it wrong to conflate the two? Cursor hitting "border" between differently sized monitors Can I pickle a python dictionary into a sqlite3 text field? Any gotchas I should be aware of?  Can I store it in a text field, or do I need to use a blob? (I'm not overly familiar with either pickle or sqlite, so I wanted to make sure I'm barking up the right tree with some of my high-level design ideas.) Sandbox modifies subject on email sent from trigger I am writing a trigger in a sandbox, and am sending an email through the sandbox. I've added a the Account Name to the Subject in my trigger.   When the email is sent from the trigger, Salesforce appends "Sandbox:" before the subject I wrote in apex.   Is there a way to remove the "Sandbox:" subject from emails send out of a sandbox? My exterior door deadbolt has gotten stuck - it'll open with the lever but not the key. By spraying WD-40 inside the lock, I've been able to get it to work but it's very stiff. I'd like to remove the lock and inspect the inside, either to clean/lube it or replace it. But I can't figure out how to remove the lock; there's no obvious way to do this. (I'm used to seeing two screws on the inside of the deadbolt, usually under the lever arms when it's horizontal.)    How do I remove this? I can loosen the cover plate on the inside but it doesn't do anything other than rotate a few degrees. Question: If $c\neq 1$ is an $n^{th}$ root of unity then, $1+c+...+c^{n-1} = 0$  Attempt: So I have established that I need to show that $$\sum^{n-1}_{k=0} e^{\frac{i2k\pi}{n}}=\frac{1-e^{\frac{ik2\pi}{n}}}{1-e^{\frac{i2\pi}{n}}} =0$$ by use of the sum of geometric series'. My issue is proceeding further to show that this is indeed true. In Windows 7, How to query times, when the computer was locked? Is there a way to get a list of the following times:  whenever windows is locked (using windows+l combo)  whenever windows is unlocked in the past week?   I've tried poking in the event log, to no avail. Many thanks! How to extend WIFI from ethernet How to include custom non-system folder under This PC in Windows 8.1? I've recently upgraded from Windows 8 to 8.1 and noticed the restructured This PC folder, formerly Computer.   What I want to achieve is to include custom folder under "This PC".    What I've found after googling is that what is displayed under "This PC" is stored in registries under   HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace  However those folders (such as Desktop, Documents, etc) are referenced via CLSID and the folder I want to include in the list does not have CLSID. bash aliases equivalent for powershell? By default my Windows PowerShell starts in C:\Users\Santosh, my XAMPP installation is in D:\ so the htdocs folder is located at D:\xampp\htdocs. If I have to edit something in htdocs folder then I have to type full cd D:\xampp\htdocs\ (autocompletion is not so kind) then edit that file.  If this PowerShell were a Bash I would do this in .bash_aliases file:  alias htdocs='cd D:\xampp\htdocs'  Is it possible to maintain Bash aliases like file and alias any command in PowerShell? Right so seeing as the new Deadpool movie shows the origins of Deadpool: specifically, he got cancer... blah blah had to get him the healing factor from Wolverine.  But that makes no sense — they used the same actor, so I'm assuming there must be some connection, right... right? I wonder if there is any difference between mapping and a function. Somebody told me that the only difference is that mapping can be from any set to any set, but function must be from $\mathbb R$ to $\mathbb R$. But I am not ok with this answer. I need a simple way to explain the differences between mapping and function to a lay man together with some illustration (if possible).  Thanks for any help. How to prove there are no more positive integers that are products of 2 and 3 consecutive numbers? The most efficient way to implement an integer based power function pow(int, int) What is the most efficient way given to raise an integer to the power of another integer in C?  // 2^3 pow(2,3) == 8  // 5^5 pow(5,5) == 3125 I often find  syntax very helpful, e.g. process substitution like in diff &lt;(sort file1) &lt;(sort file2).  Is it possible to use such Bash commands in a Makefile? I'm thinking of something like this:  file-differences:     diff &lt;(sort file1) &lt;(sort file2) &gt; $@   In my GNU Make 3.80 this will give an error since it uses the shell instead of bash to execute the commands. How can I clear the water out of this area? I've sectioned of this area in the sea near my base, and I need to get rid of all the water from it.  From what I've tried the only way I can see to clear it is fully cover one layer, delete the blocks, then go down to the next layer. Is that the only way I can clear the area or is there a better approach?  Ideally I'd like a survival method (if there is a better one), but any commands what could be used I'd like to hear just so I can learn more commands :) How can I get CSS comments with jQuery? I am wondering how I can read CSS comments out of a linked stylesheet.  I have this sample CSS loaded via:  &lt;link rel="stylesheet" type="text/css" media="all" href="test.css" /&gt;   &nbsp;  #test1{ border:1px solid #000; } #test2{ border:1px solid #000; } #test3{/* sample comment text I'm trying to read */}   I'm testing this in FF3. The following javascript reads the rules but doesn't read the comments in#test3.  window.onload = function(){     s=document.styleSheets;     for(i=0;i &lt; s[0].cssRules.length;i++){         alert(s[0].cssRules[i].cssText);     } } Determine if $.ajax error is a timeout Implementing a sort of "tightened frenchspacing" By default, (La)TeX adds extra space between sentences. The exact rules are in the TeXbook, a summary by TH. can be found . What follows is is my "executive summary":   After any period (or quotation/exclamation mark) that doesn't follow a capital letter, TeX adds a font's "extra space" to the "normal (interword) space". For Computer Modern 10pt, the normal space is 3.33pt and the extra space 1.11pt, resulting in an intersentence space of 4.44pt (+33% compared to the nomal space, assuming no stretch and shrink). A sentence end after a capital letter is indicated by the \@ command: Ann is learning the ABC\@. To denote that a period after a lowercase letter doesn't end a sentence, one may use \@ as well as an explicit space: Prof.\@ Higgins or Prof.\ Higgins.   Intersentence spacing may be brought in line with normal spacing by issuing the \frenchspacing command. (This is the standard setting for certain languages, e.g. the  (n)german option of the babel package.) With \frenchspacing enabled, there's no need to use the \@ command. One may revert to (La)TeX's default behavour by issuing \nonfrenchspacing.  So, there's the choice between extra intersentence spacing and uniform spacing. What is missing in my opinion is a third option I'll call "tightened frenchspacing": normal (interword) spacing between sentences and decreased spacing after non-sentence ending periods. To be somewhat more precise (while still ignoring stretch and shrink), I envision the following:   Adhering to a font's ratio between "normal space" and "normal space plus extra space" (3:4 for Computer Modern), the intersentence space is set to the normal space. The space after non-sentence ending periods equals the normal space multiplied by the above ratio (resulting in a space of 2.5pt for Computer Modern). As with \nonfrenchspacing in effect, the \@ command is used to denote cases of special punctuation.   How should such a "tightened frenchspacing" option be implemented?  EDIT: Thanks to Mico for providing what may well be a stepping stone to a solution. Here's another attempt at clarification:   Simply reducing the spacing after any period is not what I had in mind. There should be a (tangible) difference between end-of sentence spaces and spaces after non-sentence-ending periods (only that the latter should be reduced instead the former augmented). If adhering to a font's normal space/extra space ratio is not possible, a solution that adds a fixed (reduced) space (say, a thin space) after non-sentence-ending periods will be accepted. For compatibility reasons, I'd prefer a solution that works with the traditional use of \@ (i.e allows "tightened frenchspacing" for existing documents without the need to change the document body). Should it turn out that a different set of "special punctuation" macros is needed, I'll accept this as a solution. Background  Would like to center all tables within floats, without having to add \centering to each table.  Ideas  Tried the following:  \let\originaltabular\tabular \renewcommand\tabular{\centering\originaltabular}   It compiles, but the tables remain left-justified.  Question  How would you edit the Preamble of a LyX document to make all the floating tables be centred?