Coding/Java 삽질기2023. 8. 29. 22:53

Freecell solitare 카드 게임은 어떠한 개인 정보도 수집하지 않습니다.

Freecell solitare Card Game does not collect any personal information.

 

Posted by chobocho
Tip/Android2023. 8. 22. 23:34

AndroidManifest.xml에 아래와 같이 권한을 추가 한다

    <uses-feature
        android:name="android.hardware.telephony"
        android:required="false" />

    <uses-feature android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />

 MainActivity안에 아래와 같이 버튼에 이벤트를 연결한다.

    private fun init() {
        val callButton : Button = findViewById(R.id.callButton)
        callButton.setOnClickListener( View.OnClickListener { _ -> runCall() })
    }

    private fun runCall() {
        val intent = Intent(Intent.ACTION_CALL, Uri.parse("tel:01234561492"))
        val status = ActivityCompat.checkSelfPermission(this, 
            android.Manifest.permission.CALL_PHONE) == PackageManager.PERMISSION_GRANTED
        if (status) {
            startActivity(intent)
        } else {
            Log.i("TAG", "Unable to launch call");
            ActivityCompat.requestPermissions(this, 
                arrayOf<String>(android.Manifest.permission.CALL_PHONE), CALL_REQUEST)
        }
    }

아래와 같이 onRequestPermissionsReseult()를 오버라이딩 해주면, 권한 컨펌 즉시 콜이 걸리게 된다.

    override fun onRequestPermissionsResult(
        requestCode: Int,
        permissions: Array<out String>,
        grantResults: IntArray
    ) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
        when (requestCode) {
            CALL_REQUEST -> {
                if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    Toast.makeText(this, "통화가 가능 합니다", Toast.LENGTH_LONG).show()
                    runCall()
                } else {
                    Toast.makeText(this, "통화가 거절 되었습니다", Toast.LENGTH_LONG).show()
                }
            }
        }
    }
Posted by chobocho
Coding/Python 삽질기2023. 8. 18. 00:22

■  HTTP 1.0 RFC
https://datatracker.ietf.org/doc/html/rfc1945

■  HTTP 1.1 RFC
https://datatracker.ietf.org/doc/html/rfc2616

■ 메시지 포멧
□ Request
Request-Line = Method SP Request-URI SP HTTP-Version CRLF

□ 예시1
GET /user/chobocho27 HTTP/1.1

□ 예시2
GET / HTTP/1.1
Host: 127.0.0.1:5000
Connection: keep-alive
Cache-Control: max-age=0
Sec-Ch-Ua: "Not/A)Brand";v="99", "Google Chrome";v="115", "Chromium";v="115"
Sec-Ch-Ua-Mobile: ?0
Sec-Ch-Ua-Platform: "Windows"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Accept-Encoding: gzip, deflate, br
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7

□ Response
HTTP/1.1 200 OK

 

'Coding > Python 삽질기' 카테고리의 다른 글

[Python] Python 소스 코드 빌드 해보기  (1) 2023.09.06
[AI] Stable Diffusion 설치 하기  (0) 2023.06.09
[Python] PyTorch 설치  (0) 2023.04.05
Posted by chobocho
Coding/CPP 삽질기2023. 7. 3. 23:53

보기 > 도구 상자 (X) 클릭 

단축키: Ctrl +Atl +X 

Posted by chobocho
Coding/CPP 삽질기2023. 7. 1. 18:03

주말 동안 C# 을 공부 하기로 하고, 첫 프로그램을 작성해 보았다.

언어을 배우면 누구나 만들어 보는 Word Count 프로그램.

class WordCount
{
    private readonly string fileText;

    WordCount(string fileText)
    {
        this.fileText = fileText;
    }

    private void printInfo()
    {
        var wordCount = getWordCount(fileText);
        var lineCount = getLineCount(fileText);

        Console.WriteLine($"LineCount: {lineCount}");
        Console.WriteLine($"WordCount: {wordCount}");
        Console.WriteLine($"Character Count: {fileText.Length}");
    }

    private int getWordCount(string fileText)
    {
        return fileText.Split(new[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries).Length;
    }
    
    private int getLineCount(string fileText)
    {
        return fileText.Split(new[] { '\n' }).Length;
    }
    
    static void Main(string[] args)
    {
        if (args.Length == 0)
        {
            Console.WriteLine("Usage: WordCount [FileName]");    
            return;
        }

        string filePath = args[0];
        if (!File.Exists(filePath))
        {
            Console.WriteLine($"{filePath} not exist!");
            return;
        }

        string fileText = File.ReadAllText(filePath);
        WordCount wc = new WordCount(fileText);
        wc.printInfo();
    }
}

'Coding > CPP 삽질기' 카테고리의 다른 글

[C#] Visual studio 도구 상자 활성화 방법  (0) 2023.07.03
Intellij Code snippet 사용법  (0) 2023.06.13
[CPP] 펜윅 트리 (Fenwick Tree)  (0) 2023.06.09
Posted by chobocho
Coding/CPP 삽질기2023. 6. 13. 23:50
Coding/Python 삽질기2023. 6. 9. 23:28

1. Python 3.10.6 설치 

https://www.python.org/downloads/release/python-3106/

 

Python Release Python 3.10.6

The official home of the Python Programming Language

www.python.org

2.  Git 설치

https://git-scm.com/downloads

 

Git - Downloads

Downloads macOS Windows Linux/Unix Older releases are available and the Git source repository is on GitHub. GUI Clients Git comes with built-in GUI tools (git-gui, gitk), but there are several third-party tools for users looking for a platform-specific exp

git-scm.com

3. Stable diffusion webui 설치

https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

 

GitHub - AUTOMATIC1111/stable-diffusion-webui: Stable Diffusion web UI

Stable Diffusion web UI. Contribute to AUTOMATIC1111/stable-diffusion-webui development by creating an account on GitHub.

github.com

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

4. 모델 다운로드

https://civitai.com/

 

Civitai | Stable Diffusion models, embeddings, LoRAs and more

Civitai is a platform for Stable Diffusion AI Art models. Browse a collection of thousands of models from a growing number of creators. Join an engaged community in reviewing models and sharing images with prompts to get you started.

civitai.com

https://huggingface.co/WarriorMama777/OrangeMixs

 

WarriorMama777/OrangeMixs · Hugging Face

AOM3 Counterfeit2.5 Add SUM @ 1.0 0,0.6,0.6,0.6,0.6,0.6,0,0,0,0,0.6,0.1,0.6,0.6,0.6,0.6,0.6,0.5,0.1,0.1,0.6,0.6,0.2,0.6,0.6,0.6 AOM3A3

huggingface.co

 

모델을 다운 받아서, \stable-diffusion-webui\models\Stable-diffusion 에 넣어 준다.

확장자가 .safetensors 인 것을 받는 걸 추천 한다.

5. 실행

webui-user.bat 를 수행한다. (첫 실행시 이것 저것 설치한다고 시간이 걸린다.)

6. http://127.0.0.1:7860/ 로 웹 브라우저로 접속 하면 된다.

'Coding > Python 삽질기' 카테고리의 다른 글

HTTP Protocol  (0) 2023.08.18
[Python] PyTorch 설치  (0) 2023.04.05
[ChatGPT에게 묻다] python으로 Simple Stack VM 만들기 (3)  (0) 2023.03.17
Posted by chobocho
Coding/CPP 삽질기2023. 6. 9. 23:14
#include <iostream>

const int MAX_SIZE = 10;

void update(int* TREE, int idx, int value) {
    for (++idx; idx <= MAX_SIZE+1; idx += (idx & -idx))
        TREE[idx] += value;
}

int sum(int *TREE, int s) {
    int r = 0;
    for (++s; s > 0; s &= (s-1))
        r += TREE[s];
    return r;
}

int main(int argc, char **argv) {
    int TBL[MAX_SIZE] = {0};
    int TREE[MAX_SIZE+1] = {0, };

    for (auto i = 0; i < MAX_SIZE; i++) {
        TBL[i] = i+1;
        update(TREE, i, TBL[i]);
    }

    // GET SUM from 1 ~ N
    for (auto i = 0; i < MAX_SIZE; i++)
        std::cout << sum(TREE, i) << ", ";
    std::cout << std::endl;
    
    return 0;
}
Posted by chobocho
Coding/CPP 삽질기2023. 6. 7. 00:59

문득 기초 코딩(?) 실력이 떨어진것 같아서, 프로그래머스의  Level 0 문제를 C로 모두 풀어 보았다.

중간 중간 예상외로 막히는(?) 문제를 만나면서, 잊고 있었던 것들이 많았다는 걸 배웠다.

심심하신 분들에게 추천합니다.

'Coding > CPP 삽질기' 카테고리의 다른 글

[CPP] 펜윅 트리 (Fenwick Tree)  (0) 2023.06.09
[ChatGPT에게 묻다] Fast sqrt 함수  (0) 2023.02.26
별 그리기  (0) 2021.06.08
Posted by chobocho
Coding/Java 삽질기2023. 5. 10. 19:22

Classic Block Game V2 는 어떠한 개인 정보도 수집하지 않습니다.

Classic Block Game V2 does not collect any personal information.

Posted by chobocho