반응형

오류메시지

갑자기 매크로 설정 된 엑셀파일을 여니까 위의 메시지가 뜬다..

해결방법.

1. 메뉴 > Excel 옵션 버튼 클릭.

메뉴클릭했을 때

2. 보안 센터 > 보안 센터 설정 클릭.

Excel 옵션창

3. 매크로 설정 > 모든 매크로 포함(위험성 있는 코드가 실행될 수 있으므로 권장하지 않음)을 선택해주시고, VBA 프로젝트 개체 모델에 안전하게 액세스할 수 있음을 체크 해주시고 확인 눌러주시면 됩니다.

보안 센터 창

이렇게 모든 창을 확인 눌러주신 다음에 엑셀을 저장 하시고 엑셀 창을 닫고 다시 여시면 정상적으로 실행 됩니다.

TIP. 요즘에 엑셀 매크로로 해킹을 하는 경우도 있다고 하니 다른 사람이 주는 매크로 엑셀 파일을 열기 전에 매크로 설정에서 다시 모든 매크로 포함은 사용하지 않는것이 좋을 수 있습니다!!!


반응형
로그 이미지

우주의빛

자료를 공유하고 좋은자료 추천 하는 곳입니다.

,
반응형

가끔 테이블의 전체 Row수를 가져와야 할 경우 어떤것이 더 좋은지를 설명하겠습니다.

제가 처음에 MS-SQL을 사용할 때 "select count(*) from table명" 이렇게 사용했습니다.

한 몇천개 데이터가 있는 곳에서는 전혀 문제가 안됬죠...

근데 데이터가 쌓이다 보니.. 문제가 발생

count(*) -> count(0)으로 하면 좋습니다.

*라고 하는 건 모든것을 의미합니다. 테이블의 모든부분을 보기 때문에 아무리 컴퓨터라도 시간이 걸릴 수밖에 없죠 0이라고 하는건 첫번째 즉 첫번째 열만 보게 되기 때문에... 모든걸 보는것보다는 빨라지죠...

근데.... 데이터가 더더더 많이 쌓이게 된다면???

요즘은 빅데이터다 보니...

테이블에 5천만건이상의 데이터를 넣어봤습니다.ㅎㅎ

select count(0) from tb_test -> 총 시간이 4분 이상 걸렸죠...

이러면... 나라도 그냥 홈페이지 끄고 다른곳으로 갈 것 같습니다...

커피 한잔을 마실 수 있는 시간이니까요..

SELECT DISTINCT MAX(A.rows)

FROM SYSINDEXES AS A

INNER JOIN SYSOBJECTS AS B ON A.id = B.id

WHERE B.type = 'U' and B.name = 'tb_test'

위와 같이 쿼리를 만들어서 실행한결과...... 0초...

5천만건 0초!!!!ㅎㅎㅎㅎㅎ

데이터는 모두 날린 상태라 스크린샷은 없지만...

정말 유용할 것 같은 쿼리입니다.

반응형
로그 이미지

우주의빛

자료를 공유하고 좋은자료 추천 하는 곳입니다.

,
반응형

정말 너무 간단....

Set rngAll = Range("A1:G12")

With rngAll.Borders

.LineStyle = 1

.ColorIndex = 1

.Weight = xlThin '// xlThin : 가는 실선, xlThick : 굵은 실선

End With

rngAll.BorderAround LineStyle:=xlContinuous, Weight:=xlThin, ColorIndex:=1

1. 일단 첫번째 줄의 Range("")는 A1~G12까지의 영역을 잡는 것을 의미합니다.

(* A1에 클릭하고 G12까지 드래그한 거랑 같은 의미이죠)

2. With에서 부터 설명 드리자면

- .Borders는 구간범위의 선(Borders) 그리기위한 부분입니다.

- .LineStyle = 1은 실선을 그리라는 이야기입니다.

- .ColorIndex = 1은 검은색이라는 거구요.

* 더 자세한 정보는 구글에서 Excel ColorIndex로 검색해주세요.^^

- .Weight = xlThin는 가는실선이라는 뜻입니다.

rngAll.BorderAround LineStyle:=xlContinuous, Weight:=xlThin, ColorIndex:=1

위의 부분이 적용시키는 거구요.

* 옵션 정보

LineStyle정보(https://docs.microsoft.com/ko-kr/dotnet/api/microsoft.office.interop.excel.xllinestyle?view=excel-pia)

Weight정보(https://docs.microsoft.com/ko-kr/dotnet/api/microsoft.office.interop.excel.xlborderweight?view=excel-pia#Microsoft_Office_Interop_Excel_XlBorderWeight_xlThin)


반응형
로그 이미지

우주의빛

자료를 공유하고 좋은자료 추천 하는 곳입니다.

,
반응형

http://apycom.com/
http://www.queness.com/tutorials
http://openex.co.kr/bbs/board.php?bo_table=jqueryPDS&sca=%EB%A9%94%EB%89%B4&page=6

반응형
로그 이미지

우주의빛

자료를 공유하고 좋은자료 추천 하는 곳입니다.

,
반응형

package org.pub.app.lunch;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class LunchSelector extends Activity {
 private final String TAG = "LunchSelector";
 private Button gpsButton = null;
 private Button addrButton = null;
// private TextView gpsText = null;
// private boolean isLoadGps = false;
 private LocationManager locationManager; 
 private Context context;
 private String provider;
 
 private GpsLocationListener listener = null;
 
// private final static int SLEEP_TIME = 3000;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.context = this.getBaseContext();
        setContentView( R.layout.lunchemain );     
      
        loadGps();
       
//      new Thread( timerThread ).start();
        gpsButton = (Button)findViewById( R.id.btn_gps_search );
        addrButton = (Button)findViewById( R.id.btn_addr_search );
       
        gpsButton.setOnClickListener(
          new View.OnClickListener(){    
     public void onClick(View v) {
      Log.w(TAG , "onStatusChanged" );
      Intent in = new Intent( context , RestaurantList.class );
      Location loc = null;
            
      loc = getLocation();
            
      if( loc == null ) {
       Log.w( TAG , "location is null" );
      
       AlertDialog.Builder adb = new AlertDialog.Builder(LunchSelector.this);
       adb.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
        }
       });
          adb.setTitle( R.string.alert_title );
          adb.setMessage(R.string.alert_message);
          adb.show();
      } else {
       in.putExtra( "MY CURRENT LOCATION", new Location(loc) );
       startActivity( in );
      }
     }

     private Location getLocation() {
          
      Location location = locationManager.getLastKnownLocation( provider );
      if ( location == null ) {
       Log.w(TAG, "get Location From GPS Fail !!!!!");
       location = locationManager.getLastKnownLocation( LocationManager.NETWORK_PROVIDER );
      }
      return location;
     }
    }
        );
       
        addrButton.setOnClickListener(
          new View.OnClickListener(){    
     public void onClick(View v) {
      //주소 입력 화면으로 옮겨주자..
      Intent in = new Intent( context , InputAddress.class );
      startActivity( in );
     }
    }
        );
    }
   
//    Handler msgHandle = new Handler( ){
//     public void handleMessage(Message message) {
//      switch( message.what ){
//      case R.id.message_timer_end:
//       alertUsingGps();
//       break;
//      }
//     }
//    };
//   
//    /**
//     *
//     */
//    Runnable timerThread = new Runnable(){
//     public void run(){
//      try{
//       Thread.sleep( SLEEP_TIME );
//       msgHandle.sendEmptyMessage( R.id.message_timer_end );
//      }catch( Exception e ){
//       Log.w( TAG , e );
//      }
//     }
//    };
//   
//    public void alertUsingGps() {
//     
//     AlertDialog.Builder adb = new AlertDialog.Builder(this);
//     adb.setPositiveButton("OK", new DialogInterface.OnClickListener() {
//   
////   @Override
//   public void onClick(DialogInterface dialog, int which) {
//    loadGps();
//   }
//  });
//     adb.setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {   
////   @Override
//   public void onClick(DialogInterface dialog, int which) {
//   }
//  });
//     adb.setTitle( R.string.alert_title );
//     adb.setMessage(R.string.alert_message);
//     adb.show();
//    }
   
    public void loadGps() {
     Log.w(TAG , "loadGps" );
     locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
//     locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 2000, 10, new GpsLocationListener());
//      isLoadGps = true;
     
     Criteria criteria = new Criteria();
     criteria.setAccuracy(Criteria.ACCURACY_FINE);  // 정확도
     criteria.setPowerRequirement(Criteria.POWER_LOW); // 전원 소비량
     criteria.setAltitudeRequired(false);    // 고도, 높이 값을 얻어 올지를 결정
     criteria.setBearingRequired(false);
     criteria.setSpeedRequired(false);     //속도
     criteria.setCostAllowed(true);      //위치 정보를 얻어 오는데 들어가는 금전적 비용
     provider = locationManager.getBestProvider(criteria, true);
     listener = new GpsLocationListener();
     locationManager.requestLocationUpdates(provider, 1000, 5, listener);
    }
   
    private class GpsLocationListener implements LocationListener {

     public void onLocationChanged(Location location) {
      Log.w(TAG , "onLocationChanged" );
  }

  public void onProviderDisabled(String provider) {
   Log.w(TAG , "onProviderDisabled" );
  }

  public void onProviderEnabled(String provider) {
   Log.w(TAG , "onProviderEnabled" );
  }

  public void onStatusChanged(String provider, int status, Bundle extras) {
   Log.w(TAG , "onStatusChanged" );
  }     
    }
   
    protected void onStart() {
     super.onStart();
     if ( listener == null ) {
      listener = new GpsLocationListener();
      locationManager.requestLocationUpdates(provider, 1000, 5, listener);
     }
    }
   
    protected void onStop() {
     super.onStop();
     locationManager.removeUpdates(listener);
     listener = null;
    }
}

반응형
로그 이미지

우주의빛

자료를 공유하고 좋은자료 추천 하는 곳입니다.

,