Wikipedia:Reference desk/Archives/Computing/2013 July 17

Computing desk
< July 16 << Jun | July | Aug >> July 18 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


July 17 edit

Copying iPhone voice memos to PC edit

Hi guys. The school at which I work lets students use their mobile phones to record voice memos for certain purposes in lessons. While some students have models that can just hook up to the PC and browse the storage just like you would with a USB drive. However—correct me if I'm wrong—I don't think you can do that with the iPhone (apart from photos). Is there a way we can plug in an iPhone to a computer and copy voice memos across? I'd like to avoid installing any unnecessary software if possible. A couple of requirements:

  1. I can't have the iPhone syncing to the computer, as we a) can't have the risk of losing students' phone contents, and b) syncing the students' data to the computer would be against our IT policies.
  2. I must assume that none of the phones are jailbroken so any solutions using that aren't possible.

I don't use iTunes for anything other than listening to music and occasionally syncing my iPod, so I don't know if there's a way it could be used just to drag and drop memos. Thanks in advance, matt (talk) 09:50, 17 July 2013 (UTC)[reply]

Is email an option? If the iPhones are network-connected (WiFi preferably, else that would be a massive amount of data for them to handle on cell), they could email the memos to themselves.  drewmunn  talk  09:56, 17 July 2013 (UTC)[reply]
It's a possibility, but the WiFi here is somewhat temperamental so not really a solution I can rely on. Thanks, though. matt (talk) 10:47, 17 July 2013 (UTC)[reply]
So the computers at the school have itunes on them? That could pose a problem as they might autosync when plugged in. IIRC you can just open the iphone in My Computer (assuming this is Windows - should be listed there.) Then, there should be a few different folders... clicking around there should be one full of videos/pictures (not sure if they are stored in one folder together, or one for pics and one for videos...) You should then be able to simply drag the desired video(s) to the desktop. I'm positive I've done this in the past. Hope this helps, --Yellow1996 (talk) 17:42, 17 July 2013 (UTC)[reply]
iOS does not expose its storage as a USB mass storage device - so plugging in an iPhone does not mount it as a drive, and so nothing will appear in My Computer. This didn't used to be the case (I too remember doing it on an iPod Touch) but it's been unavailable for years. Rooting an iOS device (e.g. with Cydia) restores this; there are some apps in the Apple App Store which claim to provide this functionality too (e.g. this one - I stress I've never used it and can't vouch for it). Android devices all (that I've ever seen) do this out of the box, and newer ones do USB on the go too (meaning you can plug a flash drive into the phone) - but I don't know how/if that's possible on iOS. 87.115.1.177 (talk) 23:50, 17 July 2013 (UTC)[reply]

C++: Removing spaces from a string edit

I've written the following C++ code:

#include <iostream> #include <sstream> #include <string> using namespace std; int main() { int i=0; for (i=0; i < 4; i++) { char myarray[] = {'1', '2', '3', '4'}; //char to string stringstream ss; string s; ss << myarray[i]; ss >> s; cout << s << " "; } return 0; }

This program stores the content of myarray into a string variable. However it does so including spaces between the numbers. The output is 1 2 3 4. Is there a way to remove the spaces between the numbers, so that the output becomes 1234? How could this be done? -- Toshio Yamaguchi 12:28, 17 July 2013 (UTC)[reply]

I'm not too sure of the correct syntax in C++, but a replace should do the trick. Search the string for spaces, and replace them with nothing.  drewmunn  talk  12:31, 17 July 2013 (UTC)[reply]
If you wanted just to remove spaces from a C++ string (rather than avoiding having them in the first place) you can use string::erase:
#include <iostream>
#include <string>
#include <algorithm>
using namespace	std;

static bool filterfunc(char c){
  return c==' ';
}

int main() {
  string s = "   this is a string    with s p a c e s";
  cout << s << endl;
  s.erase(remove_if(s.begin(), s.end(), filterfunc), s.end());
  cout << s << endl;
}
C++ 11 lets us use a lambda expression to avoid that explicit predicate function:
#include <iostream>
#include <string>
#include <algorithm>
using namespace	std;

int main() {
  string s = "   this is a string    with s p a c e s";
  cout << s << endl;
  s.erase(remove_if(s.begin(), s.end(), [](char c){return c==' ';}), s.end());
  cout << s << endl;
}
-- Finlay McWalterTalk 13:16, 17 July 2013 (UTC)[reply]
You can manually do it like this:
#include <iostream>
#include <string>
using namespace std;

int main() {
  string s;
  char myarray[] = {'1', '2', '3', '4'};

  for (int i=0; i < 4; i++) {
      s += myarray[i];
  }

  cout << s;

  return 0;
}
but std::string already has a constructor that takes a "c string":
#include <iostream>
#include <string>
using namespace std;

int main() {
  char myarray[] = {'1', '2', '3', '4'};
  string s(myarray,4); // we need to specify the length 4 explicitly here, as myarray doesn't have a \0 terminator

  cout << s;

  return 0;
}
-- Finlay McWalterTalk 12:57, 17 July 2013 (UTC)[reply]
Thank you. Your first example seems to be what I am looking for. I pasted it into Wascana and it worked immediately. -- Toshio Yamaguchi 16:57, 17 July 2013 (UTC)[reply]

Foscam fi8905w edit

How can it be set up? Miss Bono [zootalk] 16:59, 17 July 2013 (UTC)[reply]

The company website has all the docs you need on http://foscam.us/tools-support.html You could have found this yourself with a simple search. Astronaut (talk) 17:42, 17 July 2013 (UTC)[reply]
It's not for me, I don't even have Internet access. Thanks for the link. Miss Bono [zootalk] 18:28, 17 July 2013 (UTC)[reply]
So you live in Wikipedia's servers? --Wirbelwind(ヴィルヴェルヴィント) 19:20, 17 July 2013 (UTC)[reply]
No, Wirbelwind, I only have access to Wikipedia. Everything else is blocked in my work. Miss Bono [zootalk] 19:22, 17 July 2013 (UTC)[reply]
If your work computer is locked down to that extent, the chances are that you will not be able to set up Foscam on that computer because of restrictions set by the network manager. Are you asking about setting it up on a home computer that has no internet access? Dbfirs 07:28, 18 July 2013 (UTC)[reply]
No... Is for a person who does have Internet access. As I said before I don't have Internet access and It is not for me. Miss Bono [zootalk] 12:26, 18 July 2013 (UTC)[reply]