2018年1月25日

各家信用卡活動登錄

台新信用卡活動登錄

台北富邦https://ebank.taipeifubon.com.tw/B2C/common/Index.faces


中信

國泰

聯邦銀行信用卡活動登錄

玉山

花旗

永豐


2017年10月16日

文章常用詞


  • 列舉:
    firstly, secondly, finally
  • 附帶其他的資訊:
    furthermore /moreover  此外
  • 重點indeed 更確切地
    undoubtedly 毫無疑問地
  • 原因與結果since, because 因為
    therefore, consequently 因此,所以
  • 舉例for instance 舉例來說
    such as 就像.....
  • 結論in conclusion, to summarize
  • 正例fortunately 幸運地
    luckily 
  • 反例unfortunately, unluckily,
    regrettably 遺憾地

不管怎樣/ 儘管如此/ 然而


  • however 不管怎樣
    If Jane likes something she'll buy it however much it costs.
  • nevertheless 儘管如此
    She was very tired, nevertheless she went to gym.
  • nonetheless 然而,仍然
    You may not believe it, but it is nonetheless true
  • whereas 儘管
    He must be about 40, whereas his wife looks about 20.
  • while 在....的時候
    I read the book while you were drying your hair.

  • although 雖然,儘管
    Kelly walked home by herself, although she knew that it was dangerous.
  • despite / in sprite of 不管
    I still enjoyed the week despite the weather.
  • yet 還沒
    He hasn't finished yet.
  • but 但是
    I didn't go, but he did.

相同/相似/好像


  • same as  和...相同
    Michelle's the same age as me.
  • similar to  和...相似
    Lemons are similar to limes.
  • similarly 同樣地,相似地
    The children were similarly dressed.
  • equally 平等的,相同的
    She looked equally nice in both dresses.
  • likewise 同樣,一樣
    Go and do likewise.
  • like 好像
    It looks like rain.
  • also 而且
    I'm cold, and I'm also tired and hungry.
  • just as 正好
    He left at three, which was just as well.
  • just like 就像是
    She's so kindly, just like an angel. 

2015年10月30日

[iOS]3D touch

參考了蘋果官方文件,和一些網路資訊,整理了3D touch的用法

3D touch整理

使用範例

實作的時候,發現preview action sheet的實作要在preview view controller的那個class才能work

2015年10月26日

[FFMPEG]把ts串接成mp4

參考了 http://albert-oma.blogspot.tw/2013/06/ffmpeg-h264-mp4.html 這篇文章

-(void)transferToMP4
{
    NSDate *startTime = [NSDate date];
    NSDate *endTime;
    NSTimeInterval interval;
    NSLog(@"-------------------------------------");
    NSLog(@"start : %@",[NSDate date]);
    NSLog(@"-------------------------------------");
    AVBitStreamFilterContext *vbsf = NULL;
    AVBitStreamFilterContext *absf = NULL;
    AVPacket pkt;
   
    av_register_all();
    avcodec_register_all();
   
    NSString *fileName = @"export.mp4";
   
    BOOL isFirstFile = YES;
    NSString *exportPath = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:fileName];
    if (avformat_alloc_output_context2(&outputCtx,
                                       NULL,
                                       "mp4",
                                       [exportPath UTF8String]) < 0)
    {
        NSLog(@"avformat_alloc_output_context2 : open file error!!!");
        return;
    }
   
    NSArray *fileList = [NSArray arrayWithObjects:@"http://shell.site/0006.ts",
                         @"http://shell.site/0012.ts",
                         @"http://shell.site/0018.ts", nil];
    int lastVideoPTS = 0,lastAudioPTS = 0, lastAudioDTS = 0;
    int currentLastVideoPTS = 0,currentLastAudioPTS = 0,currentLastAudioDTS = 0;
    
    for (NSString *fileName in fileList)
    {
        NSString *tsFile = fileName;
//        NSString *tsFile = [[NSBundle mainBundle] pathForResource:fileName ofType:@"ts"];
       
        //open input file
        AVFormatContext *inputCtx = NULL;
        avformat_open_input(&inputCtx,
                            [tsFile UTF8String],
                            NULL,
                            NULL);
        avformat_find_stream_info(inputCtx, NULL);
       
       
       
       
        av_dump_format(inputCtx, NULL, [tsFile UTF8String], 0);
       
        if (isFirstFile)
        {
            for (int streamIndex = 0; streamIndex < inputCtx->nb_streams; streamIndex++ )
            {
                NSLog(@"Channel %d of %d",streamIndex,inputCtx->nb_streams);
               
                AVStream *out_stream = NULL;
                AVStream *in_stream = NULL;
               
                in_stream = inputCtx->streams[streamIndex];
                out_stream = avformat_new_stream(outputCtx, in_stream->codec->codec);
                avcodec_copy_context(outputCtx->streams[streamIndex]->codec, inputCtx->streams[streamIndex]->codec);
               
                out_stream->codec->codec_tag = 0;
               
                if (outputCtx ->oformat->flags & AVFMT_GLOBALHEADER)
                {
                    out_stream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
                }
                out_stream->time_base = in_stream->time_base;
               
            }
        }
            absf = av_bitstream_filter_init("aac_adtstoasc");
            av_dump_format(outputCtx, NULL, [exportPath UTF8String], 1);
       
        if (isFirstFile)
        {
            if (avio_open2(&outputCtx->pb,
                           [exportPath UTF8String],
                           AVIO_FLAG_WRITE,
                           &outputCtx->interrupt_callback,
                           NULL) < 0)
            {
                NSLog(@"can not open output file!!");
                return;
            }
           
            if (avformat_write_header(outputCtx, NULL) < 0)
            {
                NSLog(@"Can not write the header");
            }
        }
       
        BOOL isFirstVideoPkt = YES;
        int firstPktPTS = 0 ;
        while (1)
        {
            AVStream *in_stream = NULL;
            AVStream *out_stream = NULL;
           
            int ret = av_read_frame(inputCtx, &pkt);
           
            if (ret < 0 )
            {
                NSLog(@"read frame : %d",ret);
                break;
            }
           
            in_stream = inputCtx->streams[pkt.stream_index];
            out_stream = outputCtx->streams[pkt.stream_index];
           
           
            if (in_stream->codec->codec_type == AVMEDIA_TYPE_VIDEO)
            {
                AVPacket fpkt = pkt;
               
                pkt.data = fpkt.data;
                pkt.size = fpkt.size;
                if (isFirstVideoPkt)
                {
                    firstPktPTS = pkt.pts;
                    isFirstVideoPkt = NO;
                }
                pkt.pts = pkt.pts - firstPktPTS + lastVideoPTS;
                pkt.dts = pkt.pts;
                currentLastVideoPTS = pkt.pts;
                pkt.pos = pkt.pts;
            }
            else if (in_stream->codec->codec_type == AVMEDIA_TYPE_AUDIO)
            {
                AVPacket fpkt = pkt;
                av_bitstream_filter_filter(absf,
                                           out_stream->codec,
                                           NULL,
                                           &fpkt.data,
                                           &fpkt.size,
                                           pkt.data,
                                           pkt.size,
                                           pkt.flags & AV_PKT_FLAG_KEY);
                pkt.data = fpkt.data;
                pkt.size = fpkt.size;
               
                pkt.pts = av_rescale_q_rnd(pkt.pts + lastAudioPTS, in_stream->codec->time_base, in_stream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
                pkt.dts = av_rescale_q_rnd(pkt.dts + lastAudioDTS, in_stream->codec->time_base, in_stream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
                pkt.duration = av_rescale_q(pkt.duration, in_stream->codec->time_base, in_stream->time_base);
                currentLastAudioPTS = pkt.pts;
                currentLastAudioDTS = pkt.dts;
            }
            pkt.pos = pkt.pts;
           
            ret = av_write_frame(outputCtx, &pkt);
            if (ret < 0)
            {
                NSLog(@"write frame error!!!");
                break;
            }
           
            av_free_packet(&pkt);
        }//end while
        lastVideoPTS = currentLastVideoPTS + 1 ;
        lastAudioPTS = currentLastAudioPTS + 1;
        lastAudioDTS = currentLastAudioDTS + 1;
       
        avformat_close_input(&inputCtx);
        av_bitstream_filter_close(vbsf);
        av_bitstream_filter_close(absf);
       
        isFirstFile = NO;
    }
  
    av_write_trailer(outputCtx);
   
    avio_close(outputCtx->pb);
    avformat_free_context(outputCtx);
   
    NSLog(@"-------------------------------------");
    endTime = [NSDate date];
    NSLog(@"end : %@",endTime);
    interval = [endTime timeIntervalSinceDate:startTime];
    NSLog(@"file number:%d ,interval : %f",fileList.count,interval);
    NSLog(@"-------------------------------------");
    return;

}