timezone / utc string to NSDate

ex 2017-05-15T18:49:00+0900"
dateformat은 yyyy-MM-dd'T'HH:mm:ssxxxx
xxxx가 핵심 swift와 공통


by 무위자연 2017. 5. 19. 15:50


1. itune의 백업파일 위치를 찾는다.(itunes 12.6.x 버전 기준)

나 경우는 /Users/bmwe3/Library/Application Support/MobileSync/Backup

2. itunes 을 종료한다


3. itunes의 backup 폴더 위치를 심볼릭링크(윈도우 기준)을 만들어서 저장 위치를 돌려주는 것이다

그러므로 심볼릭 링크 위치는 backup 폴더와 동일한 위치에 생겨야 한다.

블로그 포스팅을 보면 backup 폴더 하위에 만드는 것처럼 적어둔 곳이 많더라

혹시 모르니까 backup 폴더를 백업을 하고 다음과 같이 심볼릭 링크를 만든다

터미널을 띄운 다음에 다음과 같이 명령어를 입력한다.

ln -s /(새로운 백업이 저장될 폴더) /Users/bmwe3/Library/Application Support/MobileSync  >> 반드시 백업폴더가 생기는 곳에 만들어야 한다.


4. itunes를 켠 다음에 백업을 해보면 지정한 폴더에 backup 폴더 하위 구성이 생기기 시작하면 성공함.


by 무위자연 2017. 4. 15. 11:27

간단하게 아이템을 변경하고 다시 넣어주는 방식으로 처리해본다.


<ListView...


 lvObservationData.ItemsSource = null;

 lvObservationData.ItemsSource = loadeddatalist;

by 무위자연 2017. 3. 8. 10:40

프로젝트 속성 > 빌드 > 하단의 "고급"을 선택한 다음에


나오는 팝업에서 디버그 정보의 옵션을 "none"으로 설정하면 된다.


보통 debug모드에서 full / release 모드에서는 pdb-only로 설정되어 있다.



by 무위자연 2017. 3. 7. 09:16



파일에 쓸 때


HistoryData data = new HistoryData();

            data.SerialNumber = loadedserial_number;

            data.OperatorID = tbOperatorID.Text;

            data.test_dttm = loadeddatalist[loadeddatalist.Count - 1].test_dttm;

            data.value = loadeddatalist[loadeddatalist.Count - 1].value;


            

            datalist.Historydata.Add(data);


            FileStream fs3 = new FileStream(history_filename, FileMode.Create, FileAccess.Write);

            XmlSerializer xs = new XmlSerializer(datalist.GetType());

            xs.Serialize(fs3, datalist);

            fs3.Close();            


파일에서 읽을 때


  FileStream fs4 = new FileStream(history_filename, FileMode.Open, FileAccess.Read);

            XmlSerializer xs2 = new XmlSerializer(datalist.GetType());

            datalist = (HistoryDataList)xs2.Deserialize(fs4);

            fs4.Close();


이 때 데이터 클래스는 public class 이면서 [serializable]을 붙여줘야 한다.

like this


    [Serializable]

    public class HistoryDataList

    {


by 무위자연 2017. 1. 13. 15:30


1.routes.rb에 import path를 추가한다.

 resources 'wifi_each_info', controller: 'device/wifi_settings/wifi_each_info' do 

      collection { post:import} #post로 추가한다.

    end

2.view 에서 하기와 같이 추가

<%= form_tag(import_wifi_each_info_index_path, multipart:true) do %>

          <%= file_field_tag :file %>

          <%= submit_tag "Import CSV" %>

          <% end %>


이때 file_field와 file_field_tag 는 기능상의 차이가 없다!!


3. controller에서 model을 호출한다.

def import

    logger.debug "controller====#{params.inspect}"

    if params[:file].present?

      logger.debug "controller====#{params[:file].original_filename}"

      DeviceWifiInfo.import(params[:file])    

      redirect_to wifi_common_index_path, notice:  I18n.t('table.label.wifi_settings.each_info.completed_csv')

    else

      redirect_to wifi_common_index_path, alert:  I18n.t('table.label.wifi_settings.each_info.failed_csv')

    end

  end  


4. model에서 import를 구현한다.

def self.import(file)

  logger.debug "====model = #{file.inspect}"

    logger.debug "self.import"


  CSV.foreach(file.path, headers: true,  :encoding => 'ISO-8859-1') do |row|      

  logger.debug "===#{row.inspect}"

      #1 create wifi infi not considering duplicate      

      if row["DHCP"] == "1" #row안에 있는 속성은 ""으로 묶어서 읽는다. 속성은 csv 헤더에서 읽어온다

        dhcp = true       

        logger.debug "dhcp true"

      else

        dhcp = false

        logger.debug "dhcp false"

      end

      wifi_info_new = DeviceWifiInfo.new(dhcp: dhcp,static_ip: row["static_ip"], static_subnet: row["static_subnet"],

        static_gateway: row["static_gateway"], account_id: row["account_id"], account_password: row["account_password"],

        serial_id: row["serial_id"])

      wifi_info_new.save      

        end

      end

  end



by 무위자연 2016. 12. 8. 11:52

Ruby에서 주석처리할 때


각 line 별로 주석 처리할 때는 "#"을 붙이면 된다.


여러줄일때는 

=begin

ㅇㄴㅇ

ㅁㄴㅇㅁㄴㅇ

ㅁㄴㅇㅁㄴㅇ

=end

이때 begin과 end는 반드시 가장 앞줄에 붙여줘야 적용이 된다!!!

by 무위자연 2016. 11. 15. 14:36

QMessageBox messageBox;

    QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);

    messageBox.setText( msg );

    messageBox.setStandardButtons(QMessageBox::Yes);

    messageBox.addButton(QMessageBox::No);

    messageBox.setDefaultButton(QMessageBox::No);

    QGridLayout* layout = (QGridLayout*)messageBox.layout();

    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

    if( messageBox.exec() == QMessageBox::Yes)

      {

        //yes

      }

      else

      {

       //no

      }

-----------------------------------

버튼의 문구를 바꾸고 팝업 style을 주고 싶다면.

messageBox.setStyleSheet(

                " QLabel {"

                " min-width: 300em;"

                "font: bold 24px; "

                "}"

                "QPushButton {"

                "font: bold 24px; "

                "}"

                );

    //messageBox.setDefaultButton(QMessageBox::No);

    QAbstractButton *myYesButton = messageBox.addButton(tr("BUTTON_DELETE"), QMessageBox::YesRole);

    QAbstractButton *myNoButton = messageBox.addButton(tr("BUTTON_CANCEL"), QMessageBox::NoRole);

    QGridLayout* layout = (QGridLayout*)messageBox.layout();

    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

    messageBox.exec();

    //if( messageBox.exec() == QMessageBox::Yes)

    if(messageBox.clickedButton() == myYesButton)


by 무위자연 2016. 11. 11. 15:08

1. NSIS 패키지를 설치한다.a.     (https://sourceforge.net/projects/nsis/files/NSIS%202/2.46/ 다운)

 + 참고 : http://www.dongwun.com/tc/197


2.NSIS를 편집/컴파일할 수 있는 Edit를 설치한다.( http://hmne.sourceforge.net/ 다운)


trouble

1. 하기 설치시에 설치폴더 전체의 파일을 복사하는 옵션이 있음

Section -MainProgram

${INSTALL_TYPE}

SetOverwrite ifnewer

SetOutPath "$INSTDIR"

File /r "${CURRENT_PATH}\${DIRECTORY_NAME}\*"


SectionEnd


/r이 재귀적 호출을 의미하고 없으면 해당 폴더만 복사한다. 만일 /r을 쓰지 않고도 하위 폴더를 쓸려면 각각 폴더를 다 따로 지정해서 "File"이란 명령어로 복사해야 한다.

by 무위자연 2016. 11. 8. 09:25

환경 설정 파일(development/production 등)


config.logger = Logger.new('./log/production.log', 'daily')

뒤에 옵션에 daily / weekly 등을 넣어주면 된다.

by 무위자연 2016. 9. 19. 19:57