반응형
반응형

<input type="file"> 요소에 accept="image/*;capture=camera" 속성을 추가하면, Android 장치에서 기본적으로 카메라 앱을 호출하여 이미지를 캡처할 수 있습니다. 다음은 이를 구현하는 방법과 주의사항입니다:

 

 

<input type="file" accept="image/*;capture=camera">

 

 

작동 방식

  1. Android 브라우저 또는 WebView에서 이 코드를 실행하면 파일 선택 대화 상자가 열립니다.
  2. 카메라 앱이 기본 선택 옵션으로 제공됩니다.
  3. 이미지를 찍은 후 업로드할 수 있도록 선택됩니다.

추가 고려사항

  1. 브라우저 호환성:
    • 최신 Android 기기 및 브라우저에서 정상적으로 작동합니다.
    • iOS에서도 유사하게 작동하지만, 일부 브라우저는 capture 속성을 무시할 수 있습니다.
  2. WebView 환경:
    • Android WebView에서는 file 입력의 카메라 호출이 정상적으로 작동하려면 추가 설정이 필요할 수 있습니다.
    • WebView에서 파일 업로드를 활성화하려면 setWebChromeClient 메서드와 함께 onShowFileChooser 콜백을 구현해야 합니다.
  3. 보안 권한:
    • 웹사이트가 HTTPS 프로토콜을 사용하지 않으면 카메라 접근이 차단될 수 있습니다.
    • Android 앱에서 WebView를 사용하는 경우, CAMERA 및 READ_EXTERNAL_STORAGE 권한을 매니페스트에 명시해야 합니다.
반응형
반응형

[python] Merry christmas Tree

import numpy as np
x = np.arange(7,16);
y = np.arange(1,18,2);
z = np.column_stack((x[:: -1],y))
for i,j in z:
    print(' '*i+'*'*j)
for r in range(3):
    print(' '*13, ' || ')
print(' '*12, end = '\======/')    
print('')

               *
              ***
             *****
            *******
           *********
          ***********
         *************
        ***************
       *****************
               ||
               ||
               ||
         \======/

 

반응형
반응형

 

 

python pair plot 

 

데이터 세트의 숫자 변수 간의 쌍 관계를 보여주는 산점도 그리드입니다. 일반적으로 데이터 분포와 변수 간의 관계를 이해하는 데 사용됩니다.

 

import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd

import sklearn
print(sklearn.__version__)

# Sample dataset (Iris dataset)
from sklearn.datasets import load_iris


iris = load_iris()
df = pd.DataFrame(iris.data, columns=iris.feature_names)
df['species'] = [iris.target_names[i] for i in iris.target]

# Create a pair plot
sns.set(style="ticks")
pairplot = sns.pairplot(df, hue="species", diag_kind="kde")

# Save the pair plot as an image
output_file = "pair_plot.png"
pairplot.savefig(output_file)
print(f"Pair plot saved as {output_file}")

# Show the pair plot
plt.show()

 

반응형
반응형

[VSCODE] 14 VS Code Extensions Every Data Engineer Should Swear By for Maximum Productivity

 

 

1. Jupyter (85M+ downloads)

For Interactive Notebooks and Data Exploration

If you’re working with Python and data science, chances are you’ve used Jupyter notebooks. Well, this extension brings Jupyter functionality directly into VS Code. Whether you’re exploring datasets, running Python scripts, or testing ETL pipelines, this extension allows you to work in an interactive, notebook-style environment without leaving your code editor. It’s perfect for ad-hoc analysis, experimenting with new ideas, and visualizing your data right within your development setup.

Download extension here

 

8. Pylance (118M+ downloads)

For Python IntelliSense and Type Checking

Python is the lingua franca of data engineering, and Pylance supercharges your coding experience with advanced IntelliSense features. It provides type-checking, better autocompletion, and more accurate suggestions, all of which help you write cleaner, more efficient Python code. As a data engineer, you’re likely juggling multiple libraries, so having robust type information can prevent bugs and improve your productivity.

Get extension here

반응형
반응형

 [javascript] input 정규식 사용시 모바일 천지인 키보드 입력(여예요) 안될 경우

 

 const regex = /[^가-힣ㆍᆞᆢㄱ-ㅎㅏ-ㅣ]/g;



// 천지인 키보드 한글 입력 필터링
$(document).on("keyup", "#inputField", function () {
  // 현재 입력된 값
  let currentVal = $(this).val();

  // 한글 초성, 중성, 완성된 한글만 허용
  let filteredVal = currentVal.replace(/[^가-힣ㆍᆞᆢㄱ-ㅎㅏ-ㅣ]/g, "");

  // 필터링된 값 다시 입력
  $(this).val(filteredVal);
});

반응형
반응형

[MSSQL] update 구문 여러개를 실행하고 그 결과 row의 총 개수를 구하라

DECLARE @TotalAffectedRows INT = 0; -- 총 영향을 받은 행을 저장할 변수

-- 첫 번째 UPDATE 구문
UPDATE your_table
SET column1 = 'value1'
WHERE condition1;

SET @TotalAffectedRows = @TotalAffectedRows + @@ROWCOUNT; -- 영향을 받은 행 수 누적

-- 두 번째 UPDATE 구문
UPDATE your_table
SET column2 = 'value2'
WHERE condition2;

SET @TotalAffectedRows = @TotalAffectedRows + @@ROWCOUNT; -- 영향을 받은 행 수 누적

-- 세 번째 UPDATE 구문
UPDATE your_table
SET column3 = 'value3'
WHERE condition3;

SET @TotalAffectedRows = @TotalAffectedRows + @@ROWCOUNT; -- 영향을 받은 행 수 누적

-- 최종 결과 출력
SELECT @TotalAffectedRows AS TotalAffectedRows;
반응형

+ Recent posts