my 幻想 docker flow

  • just write your code first, without docker
  • git push your application when you can first deploy
  • create a docker image, in dockerFile or init of your image, git clone the lastest code
  • pack it into image
  • for old machine, update the container with new image

  • one application one docker
  • mysql no need include in docker, and it should not go into a separate docker. just find a machine or one of a machine to run it.

[ios] convert mpmediaitem to m4a

-(NSString*)convertToM4A : (MPMediaItem * ) mediaItem {
    NSURL *url = [mediaItem valueForProperty: MPMediaItemPropertyAssetURL];

    AVURLAsset *songAsset = [AVURLAsset URLAssetWithURL: url options:nil];

    AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset: songAsset
                                                                      presetName:AVAssetExportPresetAppleM4A];

    exporter.outputFileType = @"com.apple.m4a-audio";

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString * myDocumentsDirectory = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;

    /* Using date to be file name so no conflict
    [[NSDate date] timeIntervalSince1970];
    NSTimeInterval seconds = [[NSDate date] timeIntervalSince1970];
    NSString *intervalSeconds = [NSString stringWithFormat:@"%0.0f",seconds];*/

    NSString* mediaTitle = [mediaItem valueForProperty:MPMediaItemPropertyTitle];
    NSString* songTitle = [[NSString alloc]initWithFormat:@"%@",(mediaTitle.length>0 ? mediaTitle : @"Unknown")];

    NSString * fileName = [NSString stringWithFormat:@"%@.m4a", songTitle];

    NSString *exportFile = [myDocumentsDirectory stringByAppendingPathComponent:fileName];

    NSURL *exportURL = [NSURL fileURLWithPath:exportFile];
    exporter.outputURL = exportURL;

    // do the export
    // (completion handler block omitted)
    [exporter exportAsynchronouslyWithCompletionHandler:
     ^{
         int exportStatus = exporter.status;

         switch (exportStatus)
         {
             case AVAssetExportSessionStatusFailed:
             {
                 NSError *exportError = exporter.error;
                 NSLog (@"AVAssetExportSessionStatusFailed: %@", exportError);
                 break;
             }
             case AVAssetExportSessionStatusCompleted:
             {
                 NSLog (@"AVAssetExportSessionStatusCompleted");
                 /*
                  NSData *data = [NSData dataWithContentsOfFile: [myDocumentsDirectory
                  stringByAppendingPathComponent:fileName]];

                  NSLog(@"Data %@",data);
                  data = nil;
                  */
                 break;
             }
             case AVAssetExportSessionStatusUnknown:
             {
                 NSLog (@"AVAssetExportSessionStatusUnknown"); break;
             }
             case AVAssetExportSessionStatusExporting:
             {
                 NSLog (@"AVAssetExportSessionStatusExporting"); break;
             }
             case AVAssetExportSessionStatusCancelled:
             {
                 NSLog (@"AVAssetExportSessionStatusCancelled"); break;
             }
             case AVAssetExportSessionStatusWaiting:
             {
                 NSLog (@"AVAssetExportSessionStatusWaiting"); break;
             }
             default:
             {
                 NSLog (@"didn't get export status"); break;
             }
         }
     }];
    return [exportURL absoluteString];
}

[ios aubio]ld: symbol(s) not found for architecture arm64

Undefined symbols for architecture arm64:
  "_vDSP_ctoz", referenced from:
      _aubio_fft_do_complex in aubio(fft.c.1.o)
  "_vDSP_fft_zrip", referenced from:
      _aubio_fft_do_complex in aubio(fft.c.1.o)
  "_vDSP_minv", referenced from:
      _fvec_min in aubio(mathutils.c.1.o)
  "_vDSP_create_fftsetup", referenced from:
      _new_aubio_fft in aubio(fft.c.1.o)
  "_vDSP_maxvi", referenced from:
      _fvec_max_elem in aubio(mathutils.c.1.o)
  "_vDSP_vsmul", referenced from:
      _aubio_fft_do_complex in aubio(fft.c.1.o)
  "_vDSP_maxv", referenced from:
      _fvec_max in aubio(mathutils.c.1.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Don’t cry.
Try to import Accelerate.framework which is default in frameworks of xcode.