커서가 위치한 쿼리문을 단축키로 실행 시켜주는 애드인

 

 

https://stackoverflow.com/questions/1272334/how-can-i-run-just-the-statement-my-cursor-is-on-in-sql-server-management-studio

 

How can I run just the statement my cursor is on in SQL Server Management Studio?

As a long time Toad for Oracle user, I have gotten used to hitting Ctrl+Enter and having just the statement under the cursor be executed. In SQL Server Management Studio, hitting F5 runs the entire

stackoverflow.com

 

 

* [Ctrl]+[Shift]+[E]

 

from datetime import datetime
from pytz import timezone

# 시스템 시간
print(datetime.now())

# KST
print(datetime.now(timezone('Asia/Seoul')).strftime('%Y-%m-%d %H:%M:%S'))

datetime.now(timezone(...))

> pipenv install
Creating a Pipfile for this project…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (ca72e7)!
Installing dependencies from Pipfile.lock (ca72e7)…
  ================================ 0/0 - 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

 

주의 ) 상위 폴더로 올라가면서 pipfile이 있으면, 현재폴더에 pipfile이 생기지 않는다.

Local variable counter defined in an enclosing scope must be final or effectively final.


    @Test

    public void counterTest() {

    int count = 0;

   

    IntStream.range(0, 10)

    .forEach(i -> {

    count++; // Local variable count defined in an enclosing scope must be final or effectively final

    });

   

    System.out.println(count);

    }



[증상]


익명함수에서 로컬변수를 수정할 수 없는 현상.




[해결방법]


1. 로컬변수를 클래스 멤버로 변경한다.


    int count;

    

    @Test

    public void counterTest() {

    count = 0;

   

    IntStream.range(0, 10)

    .forEach(i -> {

    count++; // OK

    });

   

    System.out.println(count);

    }



2. AtomicInteger 를 사용한다.


    @Test

    public void counterTest() {

    AtomicInteger count = new AtomicInteger(0);

   

    IntStream.range(0, 10)

    .forEach(i -> {

    count.incrementAndGet();

    });

   

    System.out.println(count.get());

    }


3. array를 사용하는것도 같은 방법.


    @Test

    public void counterTest() {

    final int[] count = { 0, };

   

    IntStream.range(0, 10)

    .forEach(i -> {

    count[0]++;

    });

   

    System.out.println(count[0]);

    }


https://stackoverflow.com/a/30213098



4. Consumer... 

+ Recent posts