Search

Get Audio Device List

Programming/C# 2017. 12. 27. 11:02 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Get Audio Device List




using System.Management;


        public void getAudioDevice()
        {
            ManagementObjectSearcher objSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_SoundDevice");

            ManagementObjectCollection objCollection = objSearcher.Get();

            foreach (ManagementObject obj in objCollection)
            {
                String str = "";
                foreach (PropertyData property in obj.Properties)
                {
                    str += String.Format("{0}:{1}\n", property.Name, property.Value);
                }
                Console.Out.WriteLine(str + "\n\n");
            }
        }





참조 : https://stackoverflow.com/questions/1525320/how-to-enumerate-audio-out-devices-in-c-sharp

[Python] List 정렬 프로그램 구현

Programming/Python 2017. 2. 6. 20:30 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

[Python] List 정렬 프로그램 구현





List 에 append 로 integer 값을 하나씩 넣은 후


오름차순 정렬하여 출력하는 프로그램








import sys

numberList =[]


for j in range(10):
    i = int(input("input: "))
    numberList.append(i)
    s1= 0
    print("Ori: {0}".format(numberList))
    while s1 < j:
        if numberList[s1] > numberList[s1+1]:
            numberList[s1] ^= numberList[s1+1]
            numberList[s1+1] ^= numberList[s1]
            numberList[s1] ^= numberList[s1+1]
        s1 = s1 + 1
    while s1 > 0:
        if numberList[s1] < numberList[s1-1]:
            numberList[s1] ^= numberList[s1-1]
            numberList[s1-1] ^= numberList[s1]
            numberList[s1] ^= numberList[s1-1]
        s1 = s1 - 1
    print("Sorted: {0}".format(numberList))

print(numberList)








import sys

numberList =[]
indexList =[]


for j in range(10):
    i = int(input("input: "))
    numberList.append(i)
    indexList.append(0)
    for k in range(len(numberList)-1):
        if i < numberList[k]:
            indexList[k] = indexList[k] + 1
        else:
            indexList[j] = indexList[j] + 1
    print("Ori: {0}".format(numberList))
    print("Sorted: {0}".format(indexList))
    for k1 in range(len(numberList)):
        for k2 in range(len(numberList)):
            if k1 == indexList[k2]:
                sys.stdout.write(str(numberList[k2]))
                sys.stdout.write(" ")
                break
    sys.stdout.write("\n")

print(numberList)






 

'Programming > Python' 카테고리의 다른 글

[Python/OpenCV] Near-Duplicate Image Detection #2  (0) 2020.06.02
[Python/OpenCV] Near-Duplicate Image Detection #1  (0) 2020.06.02
[Python 3.6] * 찍기  (0) 2017.02.02

[jsoncpp] getList Names

Programming/C,CPP,CS 2017. 2. 6. 17:07 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


"List" : {

         "value1" : "10.1.1.1",

         "value2" : "0.0.0.0"

      }




위의 경우에서 "10.1.1.1" , "0,0,0,0" 을 얻을 때에는,




for (auto itr : configuration_value.get("List", ""))

{

char* buf = (char*)malloc(BUFSIZE);

try{

sprintf_s(buf, BUFSIZE, "%s", itr.asString().c_str());

}

   }




위의 경우에서 "value1" , "value2" 을 얻을 때에는,



for ( auto const& id : configuration_value.get("List", "").getMemberNames() ) {

std::cout << id << std::endl;

}

Redis Client Connect Test

Programming/Redis 2016. 10. 26. 11:52 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Redis Client Connect Test





CLIENT LIST

The CLIENT LIST command returns information and statistics about the client connections server in a mostly human readable format.

Return value

Bulk string reply: a unique string, formatted as follows:

  • One client connection per line (separated by LF)
  • Each line is composed of a succession of property=value fields separated by a space character.

Here is the meaning of the fields:

  • id: an unique 64-bit client ID (introduced in Redis 2.8.12).
  • addr: address/port of the client
  • fd: file descriptor corresponding to the socket
  • age: total duration of the connection in seconds
  • idle: idle time of the connection in seconds
  • flags: client flags (see below)
  • db: current database ID
  • sub: number of channel subscriptions
  • psub: number of pattern matching subscriptions
  • multi: number of commands in a MULTI/EXEC context
  • qbuf: query buffer length (0 means no query pending)
  • qbuf-free: free space of the query buffer (0 means the buffer is full)
  • obl: output buffer length
  • oll: output list length (replies are queued in this list when the buffer is full)
  • omem: output buffer memory usage
  • events: file descriptor events (see below)
  • cmd: last command played

The client flags can be a combination of:

O: the client is a slave in MONITOR mode
S: the client is a normal slave server
M: the client is a master
x: the client is in a MULTI/EXEC context
b: the client is waiting in a blocking operation
i: the client is waiting for a VM I/O (deprecated)
d: a watched keys has been modified - EXEC will fail
c: connection to be closed after writing entire reply
u: the client is unblocked
U: the client is connected via a Unix domain socket
r: the client is in readonly mode against a cluster node
A: connection to be closed ASAP
N: no specific flag set

The file descriptor events can be:

r: the client socket is readable (event loop)
w: the client socket is writable (event loop)


'Programming > Redis' 카테고리의 다른 글

Hiredis SMEMBERS 활용  (0) 2017.01.24
Hiredis Subscribe/Publish with CWinThread  (0) 2016.10.05
How to use Pub/sub with hiredis in C++?  (0) 2016.09.29
hiredis fatal error C1853:  (0) 2016.09.29
hiredis MFC import Visual Studio 2013  (0) 2016.09.28

C++ Standard library has many containers

Programming/C,CPP,CS 2016. 7. 19. 10:37 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

C++ Standard library has many containers. Depending on situation you have to choose one which best suits your purpose. It is not possible for me to talk about each of them. But here is the chart that helps a lot (source):






C++ 스탠다드 라이브러리에 많은 컨테이너 들이 있다.
흔히 사용하는 List, Stack, Vector 뿐만 아니라 다양한 컨테이너들이 존재하는데, 그 컨테이너들을 언제 사용해야 할지를 FlowChart 를 따라가면서 쉽게 선택할 수 있다. 
















enter image description here