row_id
int64
0
48.4k
init_message
stringlengths
1
342k
conversation_hash
stringlengths
32
32
scores
dict
2,808
this is my python code import requests url = 'https://steamcommunity.com/market/priceoverview/' params = { 'country': 'NZ', 'currency': 1, 'appid': 730, 'market_hash_name': 'Revolution Case' } response = requests.get(url, params=params) print(response.text) and you create a loop that increases the currency value eg 1,2,3,4,5 etc until the currency is equal to nzd
eb2f924b185ab0334e2ad8c57bdea57f
{ "intermediate": 0.28324222564697266, "beginner": 0.5107914805412292, "expert": 0.2059662938117981 }
2,809
import requests url = 'https://steamcommunity.com/market/priceoverview/' params = { 'country': 'NZ', 'currency': 1, 'appid': 730, 'market_hash_name': 'Revolution Case' } """ params['currency'] = 22 response = requests.get(url, params=params) print(response) print(f"Currency {22}: {response.text}") print('end') """ for i in range(1, 26): params['currency'] = i response = requests.get(url, params=params) print(response) print(f"Currency {i}: {response.text}") this is my python code how can i make it when the response <Response [429]> then it uses a proxy network to keep going through the requests
35af7e27c964ffa1cf35925fe7108278
{ "intermediate": 0.44357407093048096, "beginner": 0.34399232268333435, "expert": 0.2124336063861847 }
2,810
hello can you help me by telling me where are the pip packages installed usually?
b2ad1cf3ee20a9e8a56a99e4762acd67
{ "intermediate": 0.6160361170768738, "beginner": 0.10912203043699265, "expert": 0.274841845035553 }
2,811
is jquery a lib that we use in java script
c209aabc2a2101a455d8dfc980b89047
{ "intermediate": 0.7812793254852295, "beginner": 0.1532757580280304, "expert": 0.0654449313879013 }
2,812
Can you explain how I should implement this project in C++ For this project, you will be implementing a rudimentary market for cryptocurrencies. A class, name "Exchange", has public member functions that allow for the deposit and withdrawl of various assets (e.g. Bitcoin, Etherum and US Dollars). Orders to buy and sell assets at a specified price can also be made and the exchange will perform trades as possible to fulfill orders. Lastly, the exchange has a member function dedicated to printing out the current status of the exchange (i.e. what is in each user’s portfolio, what orders have been opened and filled, what trades have taken place, and what the current prices are for the assets being traded. The starter code has three header files and 4 implementation files. Some of these files have content in them already, but you are welcome to add, remove or change any part of the code given. Each test case will compile the implementation files and include the exchange.hpp and/or utility.hpp if it makes use of a class declared within. The useraccount files are not directly tested in the test cases, but they can be optionally used to store and manipulate information associated with a user’s account (as helper class(es) for the exchange). The provided main file is never used by any test cases, but it provides an example use of the exchange for your own testing purposes. Exchange Member Functions: MakeDeposit: this function should take a username (e.g. “Nahum”), an asset (e.g. “BTC”), and an amount (e.g. 100). The function does not return anything, but should store the information that the deposit occurred to a user’s portfolio. A portfolio is a record of the assets a user possesses on the exchange that are not involved in any open orders. In the example, Nahum is depositing 100 BTC (Bitcoins) into the exchange. PrintUserPortfolios: this function takes a reference to a std::ostream and should print out each user’s portfolio (ordered alphabetically by user’s name, and then by asset). Remember that assets that are involved in an open order should not be part of a user’s portfolio. Please see the test cases for exact formatting. Most test cases involving printing will print to std::cout (for easier output reading), as well as, to a std::ostringstream (for test case validation). MakeWithdrawl: this function has the same parameters as MakeDeposit, but instead of depositing funds in the exchange, the user is removing previously deposited funds. The function returns true if and only if the withdrawal was successful. A withdrawal can only be unsuccessful if there are insufficient assets in a user’s portfolio. AddOrder: This is the most involved member function here. All of the code needed to implement this functionality should not be in this single function but allocated to many helper functions and classes. This function takes an Order (declared in utility.hpp) and returns true if the order was successfully placed. The only reason an order could not be placed is if there were insufficient assets to cover the trade. For instance, if you want to sell 10 bitcoins you must have at least 10 bitcoins in your portfolio. Additionally, if you want to buy 10 bitcoins for 100 USD (US Dollars), you need to have at least 1000 dollars in your portfolio to pay for such an order. All orders (buy or sell) are priced in USD. When an order is made, the funds needed to cover the order are removed from the portfolio (to prevent double spending). The order is then considered open and may participate market taker trades and then market maker trades (details on trading provided below). PrintUserOrders: For each user (ordered alphabetically), this function prints the open and filled trades (ordered chronologically as each trade was opened/filled) to the referenced std::ostream. See test cases for exact formatting. PrintTradeHistory: Prints a record of each trade (chronologically) that occurred to the provided reference to std::ostream. See test cases for exact formatting. PrintBidAskSpread: For each asset (ordered alphabetically), prints the bid ask spread dictated by the open orders to the reference to std::ostream. See test cases for exact formatting. How trading works: First, please read https://academy.binance.com/en/articles/what-are-makers-and-takers And read https://academy.binance.com/en/glossary/bid-ask-spread When an order is placed (for example, I want to buy 10 BTC for 100 USD), this is a taker order. This means that the exchange will try to immediately fulfill my order by using existing open orders for the asset (BTC) on the other side of the trade (Sells). If the lowest priced sell is (sell 5 BTC for 200 USD), then no trade can take place because I only want to spend 100 USD per BTC, and no one is willing to sell for that low a price. If no trades can take place, my order becomes a market maker, meaning it is recorded by the exchange and waits until someone makes a sell order for 100 USD or less. However, lets imagine that Dolson had a preexisting sell market maker order to sell 5 BTC for 50 USD. In this circumstance, my buy taker order would be partially fulfilled by a trade. And the price is determined by the taker order. So 5 BTC from Dolson would be transfered to me and I would give Dolson 500 USD (5 * 100 USD). If no other sell market order existed with a price less than or equal to $100, then the rest of my order (buy 5 BTC for 100 USD) would be added as an open market maker. There many be 0, one, or many taker trades that occur when an order is placed. And a taker order can be a buy or a sell order. If the taker is a buy order, the sell with the lowest price (and under the taker’s buy price) will be the order that participates in a trade. If the taker is a sell, then the highest buy (and must be higher than the taker’s sell price) is the best order and will participate in the trade. After a trade takes place, the relevant assets are deposited in the appropriate user’s portfolio. Additionally, by examining the open market maker orders you can determine the bid-ask spread for an asset. This is effectively the highest price people are willing to buy the asset for and the lowest price people are willing to sell the asset for. These two values must always be different (else a mutually agreeable trade should have already occurred.
353465552c8ccad951f44c0d262b7f3a
{ "intermediate": 0.45579156279563904, "beginner": 0.36903470754623413, "expert": 0.17517371475696564 }
2,813
Give me this code using babypandas. 3. Game On! 🎮 Here, we'll be working with a dataset taken from Kaggle that contains sales information for thousands of video games, including some released this year. In the cell below, we load the dataset in as a DataFrame named video_games. Take some time to understand what each column of video_games represents, as we haven't provided you with a description of each column. # Run this cell to load the dataset. video_games = bpd.read_csv('data/video_game_ratings.csv') video_games title year genre rating votes directors plot 0 The Last of Us: Part I 2022 Action, Adventure, Drama 9.8 601 Matthew Gallant, Bruce Straley Experience the emotional storytelling and unfo... 1 Red Dead Redemption II 2018 Action, Adventure, Crime 9.7 36,441 Missing Amidst the decline of the Wild West at the tur... 2 The Witcher 3: Wild Hunt - Blood and Wine 2016 Action, Adventure, Drama 9.7 7,610 Konrad Tomaszkiewicz Geralt is in the southern province of Toussain... 3 The Witcher 3: Wild Hunt 2015 Action, Adventure, Drama 9.7 26,328 Konrad Tomaszkiewicz A monster hunter for hire embarks on an epic j... 4 The Last of Us 2013 Action, Adventure, Drama 9.7 61,103 Neil Druckmann, Bruce Straley In a hostile, post-pandemic world, Joel and El... ... ... ... ... ... ... ... ... 12630 Superman 1999 Action, Adventure, Family 1.4 646 Missing The first 3D Superman game. Your friends Lois ... 12631 Action 52 1991 Action, Family, Fantasy 1.3 135 Raul Gomila, Vince Perri Play the action at your fingertips with 52 gam... 12632 Plumbers Don't Wear Ties 1994 Comedy, Romance 1.3 338 Michael Anderson John, an unattached plumber, meets and falls i... 12633 Animal Soccer World 2005 Animation, Sport 1.2 125 Roswitha Haas Everybody is busy with the preparations for th... 12634 CrazyBus 2004 Adventure, Family 1.0 126 Tom Maneiro You get to select your bus and drive it across... 12635 rows × 7 columns Question 3.1. If you look at the 'votes' column in the DataFrame, you'll notice that there are commas in some of the numbers. For example, in the second row of the DataFrame, the value in the 'votes' column is '36,441'. These commas indicate that the 'votes' column contains strings, not integers, since Python never displays integers with commas. Write a function convert_votes_to_int that takes in a string v as input and outputs v as an integer, after removing any commas. Then, use your function to update the 'votes' column in the video_games DataFrame so that it contains integers rather than strings. Make sure to "save" your changes in the video_games DataFrame! def convert_votes_to_int(v): ... def convert_votes_to_int(v): return int(v.replace(',', '')) assign video_games = video_games.assign(votes=video_games.get('votes').apply(convert_votes_to_int)) video_games --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /tmp/ipykernel_1561/1237417494.py in <module> ----> 1 video_games = video_games.get(votes=video_games.get('votes').apply(convert_votes_to_int)) 2 video_games AttributeError: 'ellipsis' object has no attribute 'get' grader.check("q3_1") q3_1 results: q3_1 - 1 result: Trying: import numbers Expecting nothing ok Trying: (isinstance(video_games, bpd.DataFrame) and video_games.shape == (12635, 7) and isinstance(video_games.get('votes').iloc[0], numbers.Integral)) Expecting: True ********************************************************************** Line 2, in q3_1 0 Failed example: (isinstance(video_games, bpd.DataFrame) and video_games.shape == (12635, 7) and isinstance(video_games.get('votes').iloc[0], numbers.Integral)) Expected: True Got: False Question 3.2. You are curious as to whether there is a relationship between the number of votes a game receives and the rating of the game. Create an appropriate plot that shows the relationship between these two variables. # Create your plot here. ...
80c910088112b0da398c46d2c7e8c08a
{ "intermediate": 0.3255295157432556, "beginner": 0.48500654101371765, "expert": 0.18946395814418793 }
2,814
Please create nuxt-image provider for imgproxy.net. Use Nuxt 3
f8e556f57a72c37f3e06f74663dbb54c
{ "intermediate": 0.3921182155609131, "beginner": 0.26725563406944275, "expert": 0.3406260907649994 }
2,815
Hi. How to create game like Hearthstone in Javascript?
c534d12a30b7531c9b441c3baa8608b4
{ "intermediate": 0.3705942630767822, "beginner": 0.3887172341346741, "expert": 0.2406885325908661 }
2,816
create spell for lite-version Hearthstone
759dc8a8962d17ca1b848ed041f33aa3
{ "intermediate": 0.3394688665866852, "beginner": 0.32669535279273987, "expert": 0.33383575081825256 }
2,817
I have this function to display images: "def display_image(image, title="", max_size=(10, 10)): # Set the max size of the image plt.figure(figsize=max_size) # Display the image plt.imshow(image) # Set the title plt.title(title) # Remove the axis plt.axis("off") # Show the image plt.show()" However displayed images are compressed. I want the them to show high resolution (full resolution) How can I do that
9215aa3a213ca52f61ddac8cdede1d41
{ "intermediate": 0.4332564175128937, "beginner": 0.21439173817634583, "expert": 0.3523518741130829 }
2,818
create Javascript code for HEarthstone cards which summon another card
dcf5eee327efb36257bf3cb3c93690f6
{ "intermediate": 0.37636420130729675, "beginner": 0.3556665778160095, "expert": 0.2679692804813385 }
2,819
I have a table in mysql primary database with 100k rows. I have a replication setup with special ("archive") secondary mysql database along side regular secondary mysql databases. For certain deletion statements, I want to skip propagation of the deletion to secondary so as to keep this special secondary mysql database as an archive for certain rows which will be deleted in the primary and other regular secondary mysql databases. how to achieve this in AWS Aurora MySQL?
fd6a13ff2363061ca97fa05de571c03a
{ "intermediate": 0.5154849290847778, "beginner": 0.22460487484931946, "expert": 0.2599102258682251 }
2,820
hi
bd093c28abf90f6f2bc6a5bfb4e8e8c4
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
2,821
I want to create lite version card game which is like Heartstone. What cards can be implemented?
8cd3e7b2823d6bb291bd18543fb72b24
{ "intermediate": 0.3692474961280823, "beginner": 0.33142268657684326, "expert": 0.29932987689971924 }
2,822
aws mqtt
a0509758867db19b0eac691755a65444
{ "intermediate": 0.32087093591690063, "beginner": 0.27363356947898865, "expert": 0.4054955244064331 }
2,823
athena OpenCSVSerde carriage return how to process
dadd17f23a00b83a65d769686d475c82
{ "intermediate": 0.4438185393810272, "beginner": 0.2029445320367813, "expert": 0.35323694348335266 }
2,824
C sdl2 opengl example with multiple window open contexts
89a92da0e4743981017b0c5f7158db3c
{ "intermediate": 0.35268181562423706, "beginner": 0.24292317032814026, "expert": 0.4043950140476227 }
2,825
create Javascript code for cards “Deal 3 damage to target”, “Deal 1 damage to ALL minions”, “Draw a card” and "Summon a 2/2 minion" with function play() where their function is implemented which are objects of the same class. Only “Deal 3 damage to target” has a target.
ed8e09d575e8f8605926bd518c6831bc
{ "intermediate": 0.37384161353111267, "beginner": 0.38764360547065735, "expert": 0.23851479589939117 }
2,826
create Javascript pseudocode for minion card Heartstone
ae32d1c421b4e0939a68207ba7c38eed
{ "intermediate": 0.31731516122817993, "beginner": 0.3530197739601135, "expert": 0.3296651542186737 }
2,827
typedef struct { UINT nFileSize; // 文件大小 UINT nSendSize; // 已发送大小 }SENDFILEPROGRESS, *PSENDFILEPROGRESS; class CFileManager : public CManager { public: virtual void OnReceive(PBYTE lpBuffer, ULONG nSize); UINT SendDriveList(); CFileManager(CClientSocket *pClient, int h = 0); virtual ~CFileManager(); private: list <string> m_UploadList; UINT m_nTransferMode; char m_strCurrentProcessFileName[MAX_PATH]; // 当前正在处理的文件 __int64 m_nCurrentProcessFileLength; // 当前正在处理的文件的长度 bool MakeSureDirectoryPathExists(LPCTSTR pszDirPath); bool UploadToRemote(LPBYTE lpBuffer); bool FixedUploadList(LPCTSTR lpszDirectory); void StopTransfer(); UINT SendFilesList(LPCTSTR lpszDirectory); bool DeleteDirectory(LPCTSTR lpszDirectory); UINT SendFileSize(LPCTSTR lpszFileName); UINT SendFileData(LPBYTE lpBuffer); void CreateFolder(LPBYTE lpBuffer); void Rename(LPBYTE lpBuffer); int SendToken(BYTE bToken); void CreateLocalRecvFile(LPBYTE lpBuffer); void SetTransferMode(LPBYTE lpBuffer); void GetFileData(); void WriteLocalRecvFile(LPBYTE lpBuffer, UINT nSize); void UploadNext(); bool OpenFile(LPCTSTR lpFile, INT nShowCmd); }; // FileManager.cpp: implementation of the CFileManager class. // ////////////////////////////////////////////////////////////////////// #include "FileManager.h" typedef struct { DWORD dwSizeHigh; DWORD dwSizeLow; }FILESIZE; ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CFileManager::CFileManager(CClientSocket *pClient, int h):CManager(pClient) { m_nTransferMode = TRANSFER_MODE_NORMAL; // 发送驱动器列表, 开始进行文件管理,建立新线程 SendDriveList(); } CFileManager::~CFileManager() { m_UploadList.clear(); } VOID CFileManager::OnReceive(PBYTE lpBuffer, ULONG nSize) { switch (lpBuffer[0]) { case COMMAND_LIST_FILES:// 获取文件列表 SendFilesList((char *)lpBuffer + 1); break; case COMMAND_DELETE_FILE:// 删除文件 DeleteFile((char *)lpBuffer + 1); SendToken(TOKEN_DELETE_FINISH); break; case COMMAND_DELETE_DIRECTORY:// 删除文件 DeleteDirectory((char *)lpBuffer + 1); SendToken(TOKEN_DELETE_FINISH); break; case COMMAND_DOWN_FILES: // 上传文件 UploadToRemote(lpBuffer + 1); break; case COMMAND_CONTINUE: // 上传文件 SendFileData(lpBuffer + 1); break; case COMMAND_CREATE_FOLDER: CreateFolder(lpBuffer + 1); break; case COMMAND_RENAME_FILE: Rename(lpBuffer + 1); break; case COMMAND_STOP: StopTransfer(); break; case COMMAND_SET_TRANSFER_MODE: SetTransferMode(lpBuffer + 1); break; case COMMAND_FILE_SIZE: CreateLocalRecvFile(lpBuffer + 1); break; case COMMAND_FILE_DATA: WriteLocalRecvFile(lpBuffer + 1, nSize -1); break; case COMMAND_OPEN_FILE_SHOW: OpenFile((char *)lpBuffer + 1, SW_SHOW); break; case COMMAND_OPEN_FILE_HIDE: OpenFile((char *)lpBuffer + 1, SW_HIDE); break; default: break; } } bool CFileManager::MakeSureDirectoryPathExists(LPCTSTR pszDirPath) { LPTSTR p, pszDirCopy; DWORD dwAttributes; // Make a copy of the string for editing. __try { pszDirCopy = (LPTSTR)malloc(sizeof(TCHAR) * (lstrlen(pszDirPath) + 1)); if(pszDirCopy == NULL) return FALSE; lstrcpy(pszDirCopy, pszDirPath); p = pszDirCopy; // If the second character in the path is "\", then this is a UNC // path, and we should skip forward until we reach the 2nd \ in the path. if((*p == TEXT('\\')) && (*(p+1) == TEXT('\\'))) { p++; // Skip over the first \ in the name. p++; // Skip over the second \ in the name. // Skip until we hit the first "\" (\\Server\). while(*p && *p != TEXT('\\')) { p = CharNext(p); } // Advance over it. if(*p) { p++; } // Skip until we hit the second "\" (\\Server\Share\). while(*p && *p != TEXT('\\')) { p = CharNext(p); } // Advance over it also. if(*p) { p++; } } else if(*(p+1) == TEXT(':')) // Not a UNC. See if it's <drive>: { p++; p++; // If it exists, skip over the root specifier if(*p && (*p == TEXT('\\'))) { p++; } } while(*p) { if(*p == TEXT('\\')) { *p = TEXT('\0'); dwAttributes = GetFileAttributes(pszDirCopy); // Nothing exists with this name. Try to make the directory name and error if unable to. if(dwAttributes == 0xffffffff) { if(!CreateDirectory(pszDirCopy, NULL)) { if(GetLastError() != ERROR_ALREADY_EXISTS) { free(pszDirCopy); return FALSE; } } } else { if((dwAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) { // Something exists with this name, but it's not a directory... Error free(pszDirCopy); return FALSE; } } *p = TEXT('\\'); } p = CharNext(p); } } __except(EXCEPTION_EXECUTE_HANDLER) { free(pszDirCopy); return FALSE; } free(pszDirCopy); return TRUE; } bool CFileManager::OpenFile(LPCTSTR lpFile, INT nShowCmd) { char lpSubKey[500]; HKEY hKey; char strTemp[MAX_PATH]; LONG nSize = sizeof(strTemp); char *lpstrCat = NULL; memset(strTemp, 0, sizeof(strTemp)); const char *lpExt = strrchr(lpFile, '.'); if (!lpExt) return false; if (RegOpenKeyEx(HKEY_CLASSES_ROOT, lpExt, 0L, KEY_ALL_ACCESS, &hKey) != ERROR_SUCCESS) return false; RegQueryValue(hKey, NULL, strTemp, &nSize); RegCloseKey(hKey); memset(lpSubKey, 0, sizeof(lpSubKey)); wsprintf(lpSubKey, "%s\\shell\\open\\command", strTemp); if (RegOpenKeyEx(HKEY_CLASSES_ROOT, lpSubKey, 0L, KEY_ALL_ACCESS, &hKey) != ERROR_SUCCESS) return false; memset(strTemp, 0, sizeof(strTemp)); nSize = sizeof(strTemp); RegQueryValue(hKey, NULL, strTemp, &nSize); RegCloseKey(hKey); lpstrCat = strstr(strTemp, "\"%1"); if (lpstrCat == NULL) lpstrCat = strstr(strTemp, "%1"); if (lpstrCat == NULL) { lstrcat(strTemp, " "); lstrcat(strTemp, lpFile); } else lstrcpy(lpstrCat, lpFile); STARTUPINFO si = {0}; PROCESS_INFORMATION pi; si.cb = sizeof si; if (nShowCmd != SW_HIDE) si.lpDesktop = "WinSta0\\Default"; CreateProcess(NULL, strTemp, NULL, NULL, false, 0, NULL, NULL, &si, &pi); return true; } UINT CFileManager::SendDriveList() { char DriveString[256]; // 前一个字节为令牌,后面的52字节为驱动器跟相关属性 BYTE DriveList[1024]; char FileSystem[MAX_PATH]; char *pDrive = NULL; DriveList[0] = TOKEN_DRIVE_LIST; // 驱动器列表 GetLogicalDriveStrings(sizeof(DriveString), DriveString); pDrive = DriveString; unsigned __int64 HDAmount = 0; unsigned __int64 HDFreeSpace = 0; unsigned long AmntMB = 0; // 总大小 unsigned long FreeMB = 0; // 剩余空间 DWORD dwOffset = 1; for (; *pDrive != '\0'; pDrive += lstrlen(pDrive) + 1) { memset(FileSystem, 0, sizeof(FileSystem)); // 得到文件系统信息及大小 GetVolumeInformation(pDrive, NULL, 0, NULL, NULL, NULL, FileSystem, MAX_PATH); SHFILEINFO sfi; SHGetFileInfo(pDrive, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(SHFILEINFO), SHGFI_TYPENAME | SHGFI_USEFILEATTRIBUTES); int nTypeNameLen = lstrlen(sfi.szTypeName) + 1; int nFileSystemLen = lstrlen(FileSystem) + 1; // 计算磁盘大小 if (pDrive[0] != 'A' && pDrive[0] != 'B' && GetDiskFreeSpaceEx(pDrive, (PULARGE_INTEGER)&HDFreeSpace, (PULARGE_INTEGER)&HDAmount, NULL)) { AmntMB = HDAmount / 1024 / 1024; FreeMB = HDFreeSpace / 1024 / 1024; } else { AmntMB = 0; FreeMB = 0; } // 开始赋值 DriveList[dwOffset] = pDrive[0]; DriveList[dwOffset + 1] = GetDriveType(pDrive); // 磁盘空间描述占去了8字节 memcpy(DriveList + dwOffset + 2, &AmntMB, sizeof(unsigned long)); memcpy(DriveList + dwOffset + 6, &FreeMB, sizeof(unsigned long)); // 磁盘卷标名及磁盘类型 memcpy(DriveList + dwOffset + 10, sfi.szTypeName, nTypeNameLen); memcpy(DriveList + dwOffset + 10 + nTypeNameLen, FileSystem, nFileSystemLen); dwOffset += 10 + nTypeNameLen + nFileSystemLen; } return Send((LPBYTE)DriveList, dwOffset); } UINT CFileManager::SendFilesList(LPCTSTR lpszDirectory) { // 重置传输方式 m_nTransferMode = TRANSFER_MODE_NORMAL; UINT nRet = 0; char strPath[MAX_PATH]; char *pszFileName = NULL; LPBYTE lpList = NULL; HANDLE hFile; DWORD dwOffset = 0; // 位移指针 int nLen = 0; DWORD nBufferSize = 1024 * 10; // 先分配10K的缓冲区 WIN32_FIND_DATA FindFileData; lpList = (BYTE *)LocalAlloc(LPTR, nBufferSize); wsprintf(strPath, "%s\\*.*", lpszDirectory); hFile = FindFirstFile(strPath, &FindFileData); if (hFile == INVALID_HANDLE_VALUE) { BYTE bToken = TOKEN_FILE_LIST; return Send(&bToken, 1); } *lpList = TOKEN_FILE_LIST; // 1 为数据包头部所占字节,最后赋值 dwOffset = 1; /* 文件属性 1 文件名 strlen(filename) + 1 ('\0') 文件大小 4 */ do { // 动态扩展缓冲区 if (dwOffset > (nBufferSize - MAX_PATH * 2)) { nBufferSize += MAX_PATH * 2; lpList = (BYTE *)LocalReAlloc(lpList, nBufferSize, LMEM_ZEROINIT|LMEM_MOVEABLE); } pszFileName = FindFileData.cFileName; if (strcmp(pszFileName, ".") == 0 || strcmp(pszFileName, "..") == 0) continue; // 文件属性 1 字节 *(lpList + dwOffset) = FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; dwOffset++; // 文件名 lstrlen(pszFileName) + 1 字节 nLen = lstrlen(pszFileName); memcpy(lpList + dwOffset, pszFileName, nLen); dwOffset += nLen; *(lpList + dwOffset) = 0; dwOffset++; // 文件大小 8 字节 memcpy(lpList + dwOffset, &FindFileData.nFileSizeHigh, sizeof(DWORD)); memcpy(lpList + dwOffset + 4, &FindFileData.nFileSizeLow, sizeof(DWORD)); dwOffset += 8; // 最后访问时间 8 字节 memcpy(lpList + dwOffset, &FindFileData.ftLastWriteTime, sizeof(FILETIME)); dwOffset += 8; } while(FindNextFile(hFile, &FindFileData)); nRet = Send(lpList, dwOffset); LocalFree(lpList); FindClose(hFile); return nRet; } bool CFileManager::DeleteDirectory(LPCTSTR lpszDirectory) { WIN32_FIND_DATA wfd; char lpszFilter[MAX_PATH]; wsprintf(lpszFilter, "%s\\*.*", lpszDirectory); HANDLE hFind = FindFirstFile(lpszFilter, &wfd); if (hFind == INVALID_HANDLE_VALUE) // 如果没有找到或查找失败 return FALSE; do { if (wfd.cFileName[0] != '.') { if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { char strDirectory[MAX_PATH]; wsprintf(strDirectory, "%s\\%s", lpszDirectory, wfd.cFileName); DeleteDirectory(strDirectory); } else { char strFile[MAX_PATH]; wsprintf(strFile, "%s\\%s", lpszDirectory, wfd.cFileName); DeleteFile(strFile); } } } while (FindNextFile(hFind, &wfd)); FindClose(hFind); // 关闭查找句柄 if(!RemoveDirectory(lpszDirectory)) { return FALSE; } return true; } UINT CFileManager::SendFileSize(LPCTSTR lpszFileName) { UINT nRet = 0; DWORD dwSizeHigh; DWORD dwSizeLow; // 1 字节token, 8字节大小, 文件名称, '\0' HANDLE hFile; // 保存当前正在操作的文件名 memset(m_strCurrentProcessFileName, 0, sizeof(m_strCurrentProcessFileName)); strcpy(m_strCurrentProcessFileName, lpszFileName); hFile = CreateFile(lpszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (hFile == INVALID_HANDLE_VALUE) return FALSE; dwSizeLow = GetFileSize(hFile, &dwSizeHigh); CloseHandle(hFile); // 构造数据包,发送文件长度 int nPacketSize = lstrlen(lpszFileName) + 10; BYTE *bPacket = (BYTE *)LocalAlloc(LPTR, nPacketSize); memset(bPacket, 0, nPacketSize); bPacket[0] = TOKEN_FILE_SIZE; FILESIZE *pFileSize = (FILESIZE *)(bPacket + 1); pFileSize->dwSizeHigh = dwSizeHigh; pFileSize->dwSizeLow = dwSizeLow; memcpy(bPacket + 9, lpszFileName, lstrlen(lpszFileName) + 1); nRet = Send(bPacket, nPacketSize); LocalFree(bPacket); return nRet; } UINT CFileManager::SendFileData(LPBYTE lpBuffer) { UINT nRet = 0; FILESIZE *pFileSize; char *lpFileName; pFileSize = (FILESIZE *)lpBuffer; lpFileName = m_strCurrentProcessFileName; // 远程跳过,传送下一个 if (pFileSize->dwSizeLow == -1) { UploadNext(); return 0; } HANDLE hFile; hFile = CreateFile(lpFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (hFile == INVALID_HANDLE_VALUE) return -1; SetFilePointer(hFile, pFileSize->dwSizeLow, (long *)&(pFileSize->dwSizeHigh), FILE_BEGIN); int nHeadLength = 9; // 1 + 4 + 4数据包头部大小 DWORD nNumberOfBytesToRead = MAX_SEND_BUFFER - nHeadLength; DWORD nNumberOfBytesRead = 0; LPBYTE lpPacket = (LPBYTE)LocalAlloc(LPTR, MAX_SEND_BUFFER); // Token, 大小,偏移,文件名,数据 lpPacket[0] = TOKEN_FILE_DATA; memcpy(lpPacket + 1, pFileSize, sizeof(FILESIZE)); ReadFile(hFile, lpPacket + nHeadLength, nNumberOfBytesToRead, &nNumberOfBytesRead, NULL); CloseHandle(hFile); if (nNumberOfBytesRead > 0) { int nPacketSize = nNumberOfBytesRead + nHeadLength; nRet = Send(lpPacket, nPacketSize); } else { UploadNext(); } LocalFree(lpPacket); return nRet; } // 传送下一个文件 void CFileManager::UploadNext() { list <string>::iterator it = m_UploadList.begin(); // 删除一个任务 m_UploadList.erase(it); // 还有上传任务 if(m_UploadList.empty()) { SendToken(TOKEN_TRANSFER_FINISH); } else { // 上传下一个 it = m_UploadList.begin(); SendFileSize((*it).c_str()); } } int CFileManager::SendToken(BYTE bToken) { return Send(&bToken, 1); } bool CFileManager::UploadToRemote(LPBYTE lpBuffer) { if (lpBuffer[lstrlen((char *)lpBuffer) - 1] == '\\') { FixedUploadList((char *)lpBuffer); if (m_UploadList.empty()) { StopTransfer(); return true; } } else { m_UploadList.push_back((char *)lpBuffer); } list <string>::iterator it = m_UploadList.begin(); // 发送第一个文件 SendFileSize((*it).c_str()); return true; } bool CFileManager::FixedUploadList(LPCTSTR lpPathName) { WIN32_FIND_DATA wfd; char lpszFilter[MAX_PATH]; char *lpszSlash = NULL; memset(lpszFilter, 0, sizeof(lpszFilter)); if (lpPathName[lstrlen(lpPathName) - 1] != '\\') lpszSlash = "\\"; else lpszSlash = ""; wsprintf(lpszFilter, "%s%s*.*", lpPathName, lpszSlash); HANDLE hFind = FindFirstFile(lpszFilter, &wfd); if (hFind == INVALID_HANDLE_VALUE) // 如果没有找到或查找失败 return false; do { if (wfd.cFileName[0] != '.') { if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { char strDirectory[MAX_PATH]; wsprintf(strDirectory, "%s%s%s", lpPathName, lpszSlash, wfd.cFileName); FixedUploadList(strDirectory); } else { char strFile[MAX_PATH]; wsprintf(strFile, "%s%s%s", lpPathName, lpszSlash, wfd.cFileName); m_UploadList.push_back(strFile); } } } while (FindNextFile(hFind, &wfd)); FindClose(hFind); // 关闭查找句柄 return true; } void CFileManager::StopTransfer() { if (!m_UploadList.empty()) m_UploadList.clear(); SendToken(TOKEN_TRANSFER_FINISH); } void CFileManager::CreateLocalRecvFile(LPBYTE lpBuffer) { FILESIZE *pFileSize = (FILESIZE *)lpBuffer; // 保存当前正在操作的文件名 memset(m_strCurrentProcessFileName, 0, sizeof(m_strCurrentProcessFileName)); strcpy(m_strCurrentProcessFileName, (char *)lpBuffer + 8); // 保存文件长度 m_nCurrentProcessFileLength = (pFileSize->dwSizeHigh * (MAXDWORD + long long(1))) + pFileSize->dwSizeLow; // 创建多层目录 MakeSureDirectoryPathExists(m_strCurrentProcessFileName); WIN32_FIND_DATA FindFileData; HANDLE hFind = FindFirstFile(m_strCurrentProcessFileName, &FindFileData); if (hFind != INVALID_HANDLE_VALUE && m_nTransferMode != TRANSFER_MODE_OVERWRITE_ALL && m_nTransferMode != TRANSFER_MODE_ADDITION_ALL && m_nTransferMode != TRANSFER_MODE_JUMP_ALL ) { SendToken(TOKEN_GET_TRANSFER_MODE); } else { GetFileData(); } FindClose(hFind); } void CFileManager::GetFileData() { int nTransferMode; switch (m_nTransferMode) { case TRANSFER_MODE_OVERWRITE_ALL: nTransferMode = TRANSFER_MODE_OVERWRITE; break; case TRANSFER_MODE_ADDITION_ALL: nTransferMode = TRANSFER_MODE_ADDITION; break; case TRANSFER_MODE_JUMP_ALL: nTransferMode = TRANSFER_MODE_JUMP; break; default: nTransferMode = m_nTransferMode; } WIN32_FIND_DATA FindFileData; HANDLE hFind = FindFirstFile(m_strCurrentProcessFileName, &FindFileData); // 1字节Token,四字节偏移高四位,四字节偏移低四位 BYTE bToken[9]; DWORD dwCreationDisposition; // 文件打开方式 memset(bToken, 0, sizeof(bToken)); bToken[0] = TOKEN_DATA_CONTINUE; // 文件已经存在 if (hFind != INVALID_HANDLE_VALUE) { // 提示点什么 // 如果是续传 if (nTransferMode == TRANSFER_MODE_ADDITION) { memcpy(bToken + 1, &FindFileData.nFileSizeHigh, 4); memcpy(bToken + 5, &FindFileData.nFileSizeLow, 4); dwCreationDisposition = OPEN_EXISTING; } // 覆盖 else if (nTransferMode == TRANSFER_MODE_OVERWRITE) { // 偏移置0 memset(bToken + 1, 0, 8); // 重新创建 dwCreationDisposition = CREATE_ALWAYS; } // 传送下一个 else if (nTransferMode == TRANSFER_MODE_JUMP) { DWORD dwOffset = -1; memcpy(bToken + 5, &dwOffset, 4); dwCreationDisposition = OPEN_EXISTING; } } else { // 偏移置0 memset(bToken + 1, 0, 8); // 重新创建 dwCreationDisposition = CREATE_ALWAYS; } FindClose(hFind); HANDLE hFile = CreateFile ( m_strCurrentProcessFileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0 ); // 需要错误处理 if (hFile == INVALID_HANDLE_VALUE) { m_nCurrentProcessFileLength = 0; return; } CloseHandle(hFile); Send(bToken, sizeof(bToken)); } void CFileManager::WriteLocalRecvFile(LPBYTE lpBuffer, UINT nSize) { // 传输完毕 BYTE *pData; DWORD dwBytesToWrite; DWORD dwBytesWrite; int nHeadLength = 9; // 1 + 4 + 4 数据包头部大小,为固定的9 FILESIZE *pFileSize; // 得到数据的偏移 pData = lpBuffer + 8; pFileSize = (FILESIZE *)lpBuffer; // 得到数据在文件中的偏移 LONG dwOffsetHigh = pFileSize->dwSizeHigh; LONG dwOffsetLow = pFileSize->dwSizeLow; dwBytesToWrite = nSize - 8; HANDLE hFile = CreateFile ( m_strCurrentProcessFileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 ); SetFilePointer(hFile, dwOffsetLow, &dwOffsetHigh, FILE_BEGIN); int nRet = 0; // 写入文件 nRet = WriteFile ( hFile, pData, dwBytesToWrite, &dwBytesWrite, NULL ); CloseHandle(hFile); // 为了比较,计数器递增 BYTE bToken[9]; bToken[0] = TOKEN_DATA_CONTINUE; dwOffsetLow += dwBytesWrite; memcpy(bToken + 1, &dwOffsetHigh, sizeof(dwOffsetHigh)); memcpy(bToken + 5, &dwOffsetLow, sizeof(dwOffsetLow)); Send(bToken, sizeof(bToken)); } void CFileManager::SetTransferMode(LPBYTE lpBuffer) { memcpy(&m_nTransferMode, lpBuffer, sizeof(m_nTransferMode)); GetFileData(); } void CFileManager::CreateFolder(LPBYTE lpBuffer) { MakeSureDirectoryPathExists((char *)lpBuffer); SendToken(TOKEN_CREATEFOLDER_FINISH); } void CFileManager::Rename(LPBYTE lpBuffer) { LPCTSTR lpExistingFileName = (char *)lpBuffer; LPCTSTR lpNewFileName = lpExistingFileName + lstrlen(lpExistingFileName) + 1; ::MoveFile(lpExistingFileName, lpNewFileName); SendToken(TOKEN_RENAME_FINISH); } 用mermaid详细描述功能执行流程图
37d752b4e67390e60f6a68b12c1082ff
{ "intermediate": 0.36433741450309753, "beginner": 0.39901968836784363, "expert": 0.23664283752441406 }
2,828
C sdl2 opengl example with multiple window open contexts
53524c8a444504e6e5d5a04df7e0fdbf
{ "intermediate": 0.35268181562423706, "beginner": 0.24292317032814026, "expert": 0.4043950140476227 }
2,829
How to check whether a directory exists in bash?
3bce46114b0ab82f7b162ff6e2910167
{ "intermediate": 0.4797973334789276, "beginner": 0.20260705053806305, "expert": 0.31759563088417053 }
2,830
create Javascript code for cards “Deal 3 damage to target”, “Deal 1 damage to ALL minions”, “Draw a card” and “Summon a 2/2 minion” with function play() where their function is implemented which are objects of the same class. Only “Deal 3 damage to target” has a target.
835fd4a31ccfd53c68f8c85faceec2f8
{ "intermediate": 0.3575422465801239, "beginner": 0.4004341959953308, "expert": 0.24202357232570648 }
2,831
failed to parse API parameters: request body contains unknown field \"confirmPassword
97b425b3036dd209671b9cf823956b53
{ "intermediate": 0.6665505766868591, "beginner": 0.13615620136260986, "expert": 0.1972932070493698 }
2,832
import numpy as np def vmodsquare(t): return np.sum(t * np.conj(t), axis=(0, 1)).real def compute(left, right, rin): rout = left @ rin @ right pout = vmodsquare(rout) return rout, pout def randn(*args): cnum = np.random.randn(args) + <br/> np.random.randn(args) * 1j return cnum.astype(np.csingle) if name == ‘main’: RE, RB, M, N = 4, 4, 48, 32 left = randn(M, M) #4848 right = randn(N, N) #3232 rin = randn(RB, RE, M, N) #4, 4, 48, 32 print('left = ', left.shape, ‘\n’, left) print('right = ', right.shape, ‘\n’, right) print('rin = ', rin.shape, ‘\n’, rin) rout, pout = compute(left, right, rin) print('rout = ', rout.shape, ‘\n’, rout) print('pout = ', pout.shape, ‘\n’, pout) write a script to write the result “rout” and “pout” into a text “output.txt”, format like addr:147456, size:200 0x34234134 0xae691476 … the result number need to change into FLOAT16 and one line include two FLOAT16 numbers
42ec84f66026fed193baa320ec2df746
{ "intermediate": 0.2985937297344208, "beginner": 0.46887442469596863, "expert": 0.23253189027309418 }
2,833
How do i call a microservice api in spring from my project
6d6f80334e8120fb369971ee9856d5dc
{ "intermediate": 0.7582665681838989, "beginner": 0.1006212905049324, "expert": 0.14111219346523285 }
2,834
create minion card class for Hearthstone Javascript (2 attack and 2 health)
313631c0a3ad83b62129ba14dd433190
{ "intermediate": 0.24997594952583313, "beginner": 0.5198662877082825, "expert": 0.23015770316123962 }
2,835
fivem scripting I'm working on a crossbreeding farming script neg = {'X','W'} pos = {'Y','G','H'} plant1 = 'YGXWHH' plant2 = 'XWHYYG' plant3 = 'GHGWYY' plant4 = 'GHGWXY' planttobreed = 'GWGYHY' the planttobreed is in the middle surrounded by the other 4 plants a plant gets its trails from the surrounding plants plus its current traits if a plant has a neg trail then it needs two pos traits of the same kind to overcome it. how would I calculate the what plant 5 (the middle plant) would have as its traits I want a format of 6 traits like the other plants
e7903db384ddda91af69db9e6234e07b
{ "intermediate": 0.4615498483181, "beginner": 0.2666800022125244, "expert": 0.271770179271698 }
2,836
create minion card class for Hearthstone Javascript (2 attack and 2 health)
0f6ccbb5826a1f7486535d43bb217bdb
{ "intermediate": 0.24997594952583313, "beginner": 0.5198662877082825, "expert": 0.23015770316123962 }
2,837
How to stop ssh connection from exiting after running a command with ssh?
238530dce62cf97b22313ed109054710
{ "intermediate": 0.2921481430530548, "beginner": 0.33945462107658386, "expert": 0.36839720606803894 }
2,838
SELECT case_type,COUNT(DISTINCT ed.evaluate_id) caseNum,count(ed.id) problemNum,IFNULL(sum(se.score),0) score,IFNULL(sum(CASE WHEN ed.type_id=9 THEN 1 ELSE 0 END),0) AS noDutyNum,IFNULL(sum(CASE WHEN ed.type_id=9 THEN se.score ELSE 0 END),0) AS noDutyScore FROM dq_evaluate_detail ed LEFT JOIN dq_self_evaluate se ON se.id=ed.evaluate_id WHERE se.evaluate_time BETWEEN '2023-03-04 00:00:00.0' AND '2023-04-28 00:00:00.0' and se.unit_user_id=11 AND se.state=4 AND ed.is_select=1 AND ed.state=2
50185a7a4213e3129030102a7232e180
{ "intermediate": 0.3042696714401245, "beginner": 0.33000847697257996, "expert": 0.3657218813896179 }
2,839
create Javascript pseudocode for minion Mana Wyrm from Hearthstone with ability "Whenever you cast a spell, gain +1 Attack"
4dd1d97ccfede948f26ccb945855ec35
{ "intermediate": 0.39089399576187134, "beginner": 0.31592899560928345, "expert": 0.2931770086288452 }
2,840
Read all of the instructions below and once you understand them say "Shall we begin:" I want you to become my Prompt Creator. Your goal is to help me craft the best possible prompt for my needs. The prompt will be used by you, ChatGPT. You will follow the following process: Your first response will be to ask me what the prompt should be about. I will provide my answer, but we will need to improve it through continual iterations by going through the next steps. Based on my input, you will generate 3 sections. Revised Prompt (provide your rewritten prompt. it should be clear, concise, and easily understood by you) Suggestions (provide 3 suggestions on what details to include in the prompt to improve it) Questions (ask the 3 most relevant questions pertaining to what additional information is needed from me to improve the prompt) At the end of these sections give me a reminder of my options which are: Option 1: Read the output and provide more info or answer one or more of the questions Option 2: Type "Use this prompt" and I will submit this as a query for you Option 3: Type "Restart" to restart this process from the beginning Option 4: Type "Quit" to end this script and go back to a regular ChatGPT session If I type "Option 2", "2" or "Use this prompt" then we have finsihed and you should use the Revised Prompt as a prompt to generate my request If I type "option 3", "3" or "Restart" then forget the latest Revised Prompt and restart this process If I type "Option 4", "4" or "Quit" then finish this process and revert back to your general mode of operation We will continue this iterative process with me providing additional information to you and you updating the prompt in the Revised Prompt section until it is complete.
957c34e925c88e1e9f89a625d6488991
{ "intermediate": 0.28553614020347595, "beginner": 0.3760981261730194, "expert": 0.338365763425827 }
2,841
A = np.array([ [1, 2, 3, 4], [5,6,7,8], [9,10,11,12], [13,14,15,16]]) i think u misunderstand the 4*4 block, like the instance above, i need to save the number by order 1->2->5->6, and next 44 block like 3->4->7->8 and go on with every line including one number
2d4c580b363cd4993f1545e7a9f7d617
{ "intermediate": 0.3227121829986572, "beginner": 0.41246023774147034, "expert": 0.26482754945755005 }
2,842
import { useMemo } from "react"; import Button from "@mui/material/Button"; import { SubmitHandler, useForm } from "react-hook-form"; import { yupResolver } from "@hookform/resolvers/yup"; import { typedMemo } from "@/shared/hocs"; import { Form } from "@/shared/ui/form-component"; import { ClientDetails } from "../client-details"; import { Organization } from "../organization"; import { BankAccounts } from "../bank-accounts"; import { InvoiceEmails } from "../invoice-emails/ui"; import { Metadata } from "../metadata"; import { FormData, schema } from "./validation"; import "./style.scss"; interface IProps { onSubmit: SubmitHandler<FormData>; } export const AddCustomerForm: React.FC<IProps> = typedMemo(({ onSubmit }) => { const { control, formState: { errors }, handleSubmit, register, setValue, getValues, } = useForm<FormData>({ resolver: yupResolver(schema), }); console.log("Form: ", errors.invoice_emails); const deps = JSON.stringify(errors.invoice_emails); const err = { clientDetails: useMemo( () => ({ name: errors.name, email: errors.email, deferral_days: errors.deferral_days, credit_limit: errors.credit_limit, }), [errors.name, errors.email, errors.deferral_days, errors.credit_limit] ), // для того что-бы результат валидации показывать пользователю сразу при вводе значения необходимо явно указать в deps все зависимоти и обновить объект ошибки organization: useMemo( () => ({ organization: errors.organization, }), // eslint-disable-next-line react-hooks/exhaustive-deps [ errors.organization?.addr, errors.organization?.inn, errors.organization?.kpp, errors.organization?.name, errors.organization?.ogrn, ] ), invoiceEmails: useMemo( () => ({ invoice_emails: errors.invoice_emails, }), // eslint-disable-next-line react-hooks/exhaustive-deps [deps] ), bankAccounts: useMemo( () => ({ bank_accounts: errors.bank_accounts, }), [errors.bank_accounts] ), }; return ( <Form onSubmit={handleSubmit(onSubmit)} className="AddCustomerForm"> <ClientDetails register={register} errors={err.clientDetails} /> <Organization register={register} errors={err.organization} /> <BankAccounts control={control} register={register} getValues={getValues} setValue={setValue} errors={err.bankAccounts} /> <InvoiceEmails control={control} register={register} errors={err.invoiceEmails} /> <Metadata control={control} register={register} /> <Button type="submit" variant="contained"> Создать </Button> </Form> ); }); TypeError: Converting circular structure to JSON --> starting at object with constructor 'HTMLInputElement' | property '__reactFiber$qed989nwuwe' -> object with constructor 'FiberNode' --- property 'stateNode' closes the circle
44f829bc5499cb16c5c27dfb5ccc178d
{ "intermediate": 0.36700016260147095, "beginner": 0.3666507303714752, "expert": 0.2663491666316986 }
2,843
[ { "case": { "ref_id": "string", "case_status": "PRC", "referral_submitted_date": "2023-04-24", "modified_by": 0, "lead_id": 1, "loan_amount": 123456, "deal_lost_date": "2023-04-24", "modified_at": "2023-04-21", "property_type": "property type", "hkmc_needed": 0, "customer_name": "vinci", "completion_date": "2023-04-24", "remarks": "money, i need money", "customer_phone_number": 999, "drawdown_date": "2023-04-24", "accepted_offer": "refused", "id": 2, "customer_contact_number": 1122334455, "bank_received_application": "{HSBC}", "predicted_offer": "infinity", "address": "wan chai", "referral_code": "referral_c0de", "created_by": 0, "actual_drawdown_amt": 123456, "created_at": "2023-04-21" }, "status": { "remark": "", "seq": 1, "desc": "Pending Referral Code", "code": "PRC" }, "Leads": { "id": 1, "customer_name": "also vinci in lead", "customer_contact_phone": 1234567890, "remarks": "Additional remarks", "created_by": "John", "customer_phone": 1234567890, "lead_type_id": "L1001", "submitted_referal_form": true, "lead_source": "Source A", "created_at": "2023-04-24" }, "LeadType": { "id": "L1001", "name": "Referral" }, "RebateRecord": { "received_date": "2023-04-24", "loan_amount": 0, "rebate_to_referrer": "string", "received_year": 0, "referral_code": "referral_c0de", "commission_to_sales": "string", "handler": "vinci", "date_sent_to_HKEAA": "2023-04-24", "net_income": 0, "created_at": "2023-04-24", "source": "vinci", "commission_received_date": "2023-04-24", "percentage_fee_rebate_borrower_sales_referrer": 0, "created_by": "0", "id": 1, "borrower_name": "vinci", "total_commission": 0, "percentage_rebate_to_borrower": 0, "mortgage_address": "address", "commission_to_association": 0, "percentage_to_imort": 0, "ref_no": "string", "status": "string", "commission_to_imort": 0, "net_percentage_to_imort": 0, "drawdown_date": "2023-04-24", "received_month": 0 } } ] base on this list of dict of dict make a python program to find the dict contain the value 'vinci' and its upper key. the example output is: [{'case': 'vinci'}, {'Leads': 'vinci'}, {'RebateRecord': 'vinci'}]
d65a2c26d22d7c4dd7ce69cffcd8f9ad
{ "intermediate": 0.3160921335220337, "beginner": 0.44793370366096497, "expert": 0.23597417771816254 }
2,844
net core Elastic Search 查询数据
db34d3acc469c449f008c30e0c6205bb
{ "intermediate": 0.266849547624588, "beginner": 0.28816500306129456, "expert": 0.44498544931411743 }
2,845
my feature matching function does bad when used with orb, I don't know why, what is the best feature matching that is available in opencv. Give me suggestions, help me. Here is my code: "def feature_matching(descriptors, matcher_type="BF"): # Feature matching function using opencv as it was allowed in this part if matcher_type == "BF": matcher = cv2.BFMatcher() # Using BF Matcher matches = [] for i in range(1, len(descriptors)): match = matcher.knnMatch(descriptors[0], descriptors[i], k=2) # Getting knn matches matches.append(match) # Adding results to array return matches # Returning computed arrays"
f7f1980327b7068ee021de3ef14c89ac
{ "intermediate": 0.5414692163467407, "beginner": 0.18501225113868713, "expert": 0.27351853251457214 }
2,846
i have an existing react app and i must build and separate my screens using entry points. how do i go about that =?
b7375ccce248c5fc8bbe5035f37d8b6c
{ "intermediate": 0.5072880387306213, "beginner": 0.2666577696800232, "expert": 0.22605417668819427 }
2,847
please expand on this along with working examples : Human users of Docker use repository names to communicate which software they would like Docker to install:
For example, if a user wants to install the nginx web server, they can specify the nginx repository by using the following command: docker install nginx
683feb3e5969b9cbc6dde04bebbcd0ed
{ "intermediate": 0.5510760545730591, "beginner": 0.2862352132797241, "expert": 0.162688747048378 }
2,848
In my feature matching function I have a lot of wrong matches using ORB. I am also using ransac to calculate, would setting ransac iterations or threshold help me fixing wrong matches. Tell me if there are better matching methods. Here is my code: "if matcher_type == "BF": matcher = cv2.BFMatcher() # Using BF Matcher matches = [] for i in range(1, len(descriptors)): match = matcher.knnMatch(descriptors[0], descriptors[i], k=2) # Getting knn matches matches.append(match) # Adding results to array return matches # Returning computed arrays"
4b9f11cf31318cef6e5aef3a772b7a2e
{ "intermediate": 0.5632442831993103, "beginner": 0.16034726798534393, "expert": 0.2764084041118622 }
2,849
c# UTC时间转时间戳
271f67ff430ed9feaf7352d0f1c9d6d7
{ "intermediate": 0.3338722884654999, "beginner": 0.32476335763931274, "expert": 0.3413642942905426 }
2,850
Create minion card class from Hearthstone in Javascript
1a4e43cb9019e985b4c113150149dc3e
{ "intermediate": 0.26957181096076965, "beginner": 0.5758363008499146, "expert": 0.15459194779396057 }
2,851
create code for card classes “Deal 3 damage to target”, “Deal 1 damage to ALL minions”, “Draw a card” and "Summon a 1/1 minion" with function play() where their function is implemented which are objects of the same class. Only “Deal 3 damage to target” has a target.
ffa35449ed2be0a64e6d23ce1307277e
{ "intermediate": 0.3350410759449005, "beginner": 0.36070796847343445, "expert": 0.30425095558166504 }
2,852
hi
f415e0bd9f8137cb892de52c0f0b55a2
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
2,853
I want create a lite-version of Hearthstone in Javascript. Rules: 1) Each player starts the game with 30 Health and 0 Mana slots. 2) Each player starts with a deck of 20 Damage cards with the following Mana costs: 0,0,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,7,8 3) From the deck each player receives 3 random cards has his initial hand. 4) One player is randomly chosen to be the starting active player. The other player draws a 4th card from his deck to compensate him for not playing the first turn. 5) The active player receives 1 Mana slot up to a maximum of 10 total slots. 6) The active player’s empty Mana slots are refilled. 7) The active player draws a random card from his deck. 8) The active player can play as many cards as he can afford. Any played card empties Mana slots and deals immediate damage to the opponent player equal to its Mana cost. 9) If the opponent player’s Health drops to or below zero the active player wins the game. 10) If the active player can’t (by either having no cards left in his hand or lacking sufficient Mana to pay for any hand card) or simply doesn’t want to play another card, the opponent player becomes active. 11) If a player’s card deck is empty before the game is over he receives 1 damage instead of drawing a card when it’s his turn. 12) If a player draws a card that lets his hand size become >5 that card is discarded instead of being put into his hand. 13) Let players choose to play cards either as immediate damage Attacks (same as cards generally worked in the Basic Gameplay rules) or as Minions that are put on the board instead. Minions will use the mana cost of their card as Health and Damage value. Playing a 0 card will create a minion with 1 Health and 0 Damage. 14) Health has to be tracked when they receive damage. 15) Each player can have a maximum of 3 Minions on the board at any given time. 16) A Minion will sleep in the turn it was put on the board. 17) In any subsequent turn each Minion can be used once to deal damage to the opponent player or an opponent Minion. 18) A Minion fighting another Minion will result in them dealing their damage value to each other simultaneously. 19) Sleeping Minions will defend themselves in the same way when attacked by another Minion. 20) Players can choose to play an Attack against a Minion. The attacked Minion will not defend itself in this case, thus the attacking player receives no damage from it. 21) When a Minions health drops to or below zero it is removed from the board. supplement code using there rules
17c944a4723aaf697096c8626c74d15c
{ "intermediate": 0.3570278286933899, "beginner": 0.2774295508861542, "expert": 0.36554259061813354 }
2,854
java code to select randomly 10 words from a text file wherein words are separated by blanks. Before selecting the words detect amount of words to correctly set the random value.
06ac3ad39fc850bcfabe99e11829f561
{ "intermediate": 0.35545051097869873, "beginner": 0.1797652691602707, "expert": 0.4647842347621918 }
2,855
export interface ReferrerIncomesStatistics { open_link: DateCount[]; registration: DateCount[]; order_pay: DateCount[]; subscription_pay: DateCount[]; } export interface Referrer { user_id: number; user_name: string; user_email: string; key: string; status: “new” | “active” | “disabled”; } export const referrerIncomesStatistics = (token: string, from: string, to: string, user_id?: number|null): Promise<{data:ReferrerIncomesStatistics}|undefined> => { const userId = user_id ? &user_id=${user_id} : “”; return apiClient( /referrer-incomes/statistics?date_from=${from}&date_to=${to}${userId}, “get”, token, ); }; const [referralList, setReferralList] = useState<Array<Referrer> | null>(null); const [referralId, setReferralId] = useState<Array<number>>([3,6,1]); useEffect(() => { referrersList(bearer) .then(data => { if (!data) return; setReferralList(data.data); }); referrerIncomesStatistics(bearer, from, to, referralId) .then(data => { if (!data) return; setData(data.data); }); }, [referralId]); нужно сделать так, что если в referralId несколько символов, то делать на каждый id запрос? забивать данные внутри, а потом когда все запросы отправле сетать в data новый useState react typescript. import {CartesianGrid, Legend, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis} from “recharts”; И данные которые получаются в стейте data нужно отрисовать <ResponsiveContainer width=“100%” height={320}> <LineChart data={data} margin={{ top: 0, right: 20, bottom: 10, left: 0 }} > <Line /> </LineChart> </ResponsiveContainer>
6b1c01a615d9a501bc1036745e81fbb0
{ "intermediate": 0.2536470293998718, "beginner": 0.5826830863952637, "expert": 0.16366994380950928 }
2,856
write Javascript code cards from SLay the Spire
7b7f9ef7bb8b20de1d64236b48437f2e
{ "intermediate": 0.25682446360588074, "beginner": 0.4046962857246399, "expert": 0.33847928047180176 }
2,857
write Javascript code Strike and Block cards from SLay the Spire
dbe7a71f2cb978f3368f3ef84a02c5fc
{ "intermediate": 0.3145529329776764, "beginner": 0.4162414073944092, "expert": 0.26920562982559204 }
2,858
what is the difference between nfs and s3 buckets in elastic cloud storage
514a98b9e57ff35f6a1a8b4b63827617
{ "intermediate": 0.4005582332611084, "beginner": 0.32968956232070923, "expert": 0.26975223422050476 }
2,859
const [data, setData] = useState<any>(); const [referralList, setReferralList] = useState<Array<any> | null>(null); const [referralIds, setReferralIds] = useState<Array<number>>([]); useEffect(() => { referrersList(bearer) .then(data => { if (!data) return; setReferralList(data.data); }); if (referralIds.length > 0) { const promises = referralIds.map(id => referrerIncomesStatistics(bearer, from, to, id) .then(data => { if (!data) return null; return { id, data: data.data }; }) ); Promise.all(promises).then(results => { const mergedData: ReferrerIncomesStatistics = { open_link: [], registration: [], order_pay: [], subscription_pay: [], }; for (const result of results) { if (result === null) continue; const { id, data } = result; for (const key in data) { mergedData[key].push(...data[key].map(dateCount => ({ ...dateCount, referrer_id: id, }))); } } setData(mergedData); console.log(mergedData); }); } else { setData(null); } }, [referralIds]); <ResponsiveContainer width="100%" height={320}> <LineChart data={data} margin={{ top: 0, right: 20, bottom: 10, left: 0 }}> <XAxis dataKey="date" /> <YAxis /> <CartesianGrid strokeDasharray="3 3" /> <Tooltip /> <Legend /> <Line type="monotone" dataKey="open_link" stroke="#8884d8" activeDot={{ r: 8 }} /> <Line type="monotone" dataKey="registration" stroke="#82ca9d" activeDot={{ r: 8 }} /> <Line type="monotone" dataKey="order_pay" stroke="#ffc658" activeDot={{ r: 8 }} /> <Line type="monotone" dataKey="subscription_pay" stroke="#5dd5d5" activeDot={{ r: 8 }} /> </LineChart> </ResponsiveContainer> нужно чтобы <Line type="monotone" dataKey="open_link" stroke="#8884d8" activeDot={{ r: 8 }} /> <Line type="monotone" dataKey="registration" stroke="#82ca9d" activeDot={{ r: 8 }} /> <Line type="monotone" dataKey="order_pay" stroke="#ffc658" activeDot={{ r: 8 }} /> <Line type="monotone" dataKey="subscription_pay" stroke="#5dd5d5" activeDot={{ r: 8 }} /> для каждого id свой цвет, так же нужно нужно вывести 4 линии open_link registration order_pay subscription_pay на весь месяц, с 2023-03-25 до 2023-04-25, нужно, чтобы был линейный график, если ничего не приходит то везде было ноль. не нарушая принципов и правил реакта react typescript так же проверь типизацию, typescript везде должен быть указан правильно и чтобы не было ошибок
371bbc270608c817a081210578bb01cb
{ "intermediate": 0.3301631808280945, "beginner": 0.4263896346092224, "expert": 0.2434472292661667 }
2,860
#include “FileManager.h” typedef struct { DWORD dwSizeHigh; DWORD dwSizeLow; }FILESIZE; ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CFileManager::CFileManager(CClientSocket *pClient, int h):CManager(pClient) { m_nTransferMode = TRANSFER_MODE_NORMAL; // 发送驱动器列表, 开始进行文件管理,建立新线程 SendDriveList(); } CFileManager::~CFileManager() { m_UploadList.clear(); } VOID CFileManager::OnReceive(PBYTE lpBuffer, ULONG nSize) { switch (lpBuffer[0]) { case COMMAND_LIST_FILES:// 获取文件列表 SendFilesList((char *)lpBuffer + 1); break; case COMMAND_DELETE_FILE:// 删除文件 DeleteFile((char *)lpBuffer + 1); SendToken(TOKEN_DELETE_FINISH); break; case COMMAND_DELETE_DIRECTORY:// 删除文件 DeleteDirectory((char *)lpBuffer + 1); SendToken(TOKEN_DELETE_FINISH); break; case COMMAND_DOWN_FILES: // 上传文件 UploadToRemote(lpBuffer + 1); break; case COMMAND_CONTINUE: // 上传文件 SendFileData(lpBuffer + 1); break; case COMMAND_CREATE_FOLDER: CreateFolder(lpBuffer + 1); break; case COMMAND_RENAME_FILE: Rename(lpBuffer + 1); break; case COMMAND_STOP: StopTransfer(); break; case COMMAND_SET_TRANSFER_MODE: SetTransferMode(lpBuffer + 1); break; case COMMAND_FILE_SIZE: CreateLocalRecvFile(lpBuffer + 1); break; case COMMAND_FILE_DATA: WriteLocalRecvFile(lpBuffer + 1, nSize -1); break; case COMMAND_OPEN_FILE_SHOW: OpenFile((char *)lpBuffer + 1, SW_SHOW); break; case COMMAND_OPEN_FILE_HIDE: OpenFile((char *)lpBuffer + 1, SW_HIDE); break; default: break; } } bool CFileManager::MakeSureDirectoryPathExists(LPCTSTR pszDirPath) { LPTSTR p, pszDirCopy; DWORD dwAttributes; // Make a copy of the string for editing. __try { pszDirCopy = (LPTSTR)malloc(sizeof(TCHAR) * (lstrlen(pszDirPath) + 1)); if(pszDirCopy == NULL) return FALSE; lstrcpy(pszDirCopy, pszDirPath); p = pszDirCopy; // If the second character in the path is “”, then this is a UNC // path, and we should skip forward until we reach the 2nd \ in the path. if((p == TEXT(‘\’)) && ((p+1) == TEXT(‘\’))) { p++; // Skip over the first \ in the name. p++; // Skip over the second \ in the name. // Skip until we hit the first “” (\Server). while(*p && *p != TEXT(‘\’)) { p = CharNext§; } // Advance over it. if(*p) { p++; } // Skip until we hit the second “” (\Server\Share). while(*p && *p != TEXT(‘\’)) { p = CharNext§; } // Advance over it also. if(p) { p++; } } else if((p+1) == TEXT(‘:’)) // Not a UNC. See if it’s <drive>: { p++; p++; // If it exists, skip over the root specifier if(*p && (*p == TEXT(‘\’))) { p++; } } while(*p) { if(*p == TEXT(‘\’)) { *p = TEXT(‘\0’); dwAttributes = GetFileAttributes(pszDirCopy); // Nothing exists with this name. Try to make the directory name and error if unable to. if(dwAttributes == 0xffffffff) { if(!CreateDirectory(pszDirCopy, NULL)) { if(GetLastError() != ERROR_ALREADY_EXISTS) { free(pszDirCopy); return FALSE; } } } else { if((dwAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) { // Something exists with this name, but it’s not a directory… Error free(pszDirCopy); return FALSE; } } *p = TEXT(‘\’); } p = CharNext§; } } __except(EXCEPTION_EXECUTE_HANDLER) { free(pszDirCopy); return FALSE; } free(pszDirCopy); return TRUE; } bool CFileManager::OpenFile(LPCTSTR lpFile, INT nShowCmd) { char lpSubKey[500]; HKEY hKey; char strTemp[MAX_PATH]; LONG nSize = sizeof(strTemp); char *lpstrCat = NULL; memset(strTemp, 0, sizeof(strTemp)); const char *lpExt = strrchr(lpFile, ‘.’); if (!lpExt) return false; if (RegOpenKeyEx(HKEY_CLASSES_ROOT, lpExt, 0L, KEY_ALL_ACCESS, &hKey) != ERROR_SUCCESS) return false; RegQueryValue(hKey, NULL, strTemp, &nSize); RegCloseKey(hKey); memset(lpSubKey, 0, sizeof(lpSubKey)); wsprintf(lpSubKey, “%s\shell\open\command”, strTemp); if (RegOpenKeyEx(HKEY_CLASSES_ROOT, lpSubKey, 0L, KEY_ALL_ACCESS, &hKey) != ERROR_SUCCESS) return false; memset(strTemp, 0, sizeof(strTemp)); nSize = sizeof(strTemp); RegQueryValue(hKey, NULL, strTemp, &nSize); RegCloseKey(hKey); lpstrCat = strstr(strTemp, “”%1"); if (lpstrCat == NULL) lpstrCat = strstr(strTemp, “%1”); if (lpstrCat == NULL) { lstrcat(strTemp, " “); lstrcat(strTemp, lpFile); } else lstrcpy(lpstrCat, lpFile); STARTUPINFO si = {0}; PROCESS_INFORMATION pi; si.cb = sizeof si; if (nShowCmd != SW_HIDE) si.lpDesktop = “WinSta0\Default”; CreateProcess(NULL, strTemp, NULL, NULL, false, 0, NULL, NULL, &si, &pi); return true; } UINT CFileManager::SendDriveList() { char DriveString[256]; // 前一个字节为令牌,后面的52字节为驱动器跟相关属性 BYTE DriveList[1024]; char FileSystem[MAX_PATH]; char *pDrive = NULL; DriveList[0] = TOKEN_DRIVE_LIST; // 驱动器列表 GetLogicalDriveStrings(sizeof(DriveString), DriveString); pDrive = DriveString; unsigned __int64 HDAmount = 0; unsigned __int64 HDFreeSpace = 0; unsigned long AmntMB = 0; // 总大小 unsigned long FreeMB = 0; // 剩余空间 DWORD dwOffset = 1; for (; *pDrive != ‘\0’; pDrive += lstrlen(pDrive) + 1) { memset(FileSystem, 0, sizeof(FileSystem)); // 得到文件系统信息及大小 GetVolumeInformation(pDrive, NULL, 0, NULL, NULL, NULL, FileSystem, MAX_PATH); SHFILEINFO sfi; SHGetFileInfo(pDrive, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(SHFILEINFO), SHGFI_TYPENAME | SHGFI_USEFILEATTRIBUTES); int nTypeNameLen = lstrlen(sfi.szTypeName) + 1; int nFileSystemLen = lstrlen(FileSystem) + 1; // 计算磁盘大小 if (pDrive[0] != ‘A’ && pDrive[0] != ‘B’ && GetDiskFreeSpaceEx(pDrive, (PULARGE_INTEGER)&HDFreeSpace, (PULARGE_INTEGER)&HDAmount, NULL)) { AmntMB = HDAmount / 1024 / 1024; FreeMB = HDFreeSpace / 1024 / 1024; } else { AmntMB = 0; FreeMB = 0; } // 开始赋值 DriveList[dwOffset] = pDrive[0]; DriveList[dwOffset + 1] = GetDriveType(pDrive); // 磁盘空间描述占去了8字节 memcpy(DriveList + dwOffset + 2, &AmntMB, sizeof(unsigned long)); memcpy(DriveList + dwOffset + 6, &FreeMB, sizeof(unsigned long)); // 磁盘卷标名及磁盘类型 memcpy(DriveList + dwOffset + 10, sfi.szTypeName, nTypeNameLen); memcpy(DriveList + dwOffset + 10 + nTypeNameLen, FileSystem, nFileSystemLen); dwOffset += 10 + nTypeNameLen + nFileSystemLen; } return Send((LPBYTE)DriveList, dwOffset); } UINT CFileManager::SendFilesList(LPCTSTR lpszDirectory) { // 重置传输方式 m_nTransferMode = TRANSFER_MODE_NORMAL; UINT nRet = 0; char strPath[MAX_PATH]; char pszFileName = NULL; LPBYTE lpList = NULL; HANDLE hFile; DWORD dwOffset = 0; // 位移指针 int nLen = 0; DWORD nBufferSize = 1024 * 10; // 先分配10K的缓冲区 WIN32_FIND_DATA FindFileData; lpList = (BYTE )LocalAlloc(LPTR, nBufferSize); wsprintf(strPath, "%s\.”, lpszDirectory); hFile = FindFirstFile(strPath, &FindFileData); if (hFile == INVALID_HANDLE_VALUE) { BYTE bToken = TOKEN_FILE_LIST; return Send(&bToken, 1); } lpList = TOKEN_FILE_LIST; // 1 为数据包头部所占字节,最后赋值 dwOffset = 1; / 文件属性 1 文件名 strlen(filename) + 1 (‘\0’) 文件大小 4 */ do { // 动态扩展缓冲区 if (dwOffset > (nBufferSize - MAX_PATH * 2)) { nBufferSize += MAX_PATH * 2; lpList = (BYTE *)LocalReAlloc(lpList, nBufferSize, LMEM_ZEROINIT|LMEM_MOVEABLE); } pszFileName = FindFileData.cFileName; if (strcmp(pszFileName, “.”) == 0 || strcmp(pszFileName, “…”) == 0) continue; // 文件属性 1 字节 (lpList + dwOffset) = FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; dwOffset++; // 文件名 lstrlen(pszFileName) + 1 字节 nLen = lstrlen(pszFileName); memcpy(lpList + dwOffset, pszFileName, nLen); dwOffset += nLen; (lpList + dwOffset) = 0; dwOffset++; // 文件大小 8 字节 memcpy(lpList + dwOffset, &FindFileData.nFileSizeHigh, sizeof(DWORD)); memcpy(lpList + dwOffset + 4, &FindFileData.nFileSizeLow, sizeof(DWORD)); dwOffset += 8; // 最后访问时间 8 字节 memcpy(lpList + dwOffset, &FindFileData.ftLastWriteTime, sizeof(FILETIME)); dwOffset += 8; } while(FindNextFile(hFile, &FindFileData)); nRet = Send(lpList, dwOffset); LocalFree(lpList); FindClose(hFile); return nRet; } bool CFileManager::DeleteDirectory(LPCTSTR lpszDirectory) { WIN32_FIND_DATA wfd; char lpszFilter[MAX_PATH]; wsprintf(lpszFilter, "%s\.“, lpszDirectory); HANDLE hFind = FindFirstFile(lpszFilter, &wfd); if (hFind == INVALID_HANDLE_VALUE) // 如果没有找到或查找失败 return FALSE; do { if (wfd.cFileName[0] != ‘.’) { if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { char strDirectory[MAX_PATH]; wsprintf(strDirectory, “%s\%s”, lpszDirectory, wfd.cFileName); DeleteDirectory(strDirectory); } else { char strFile[MAX_PATH]; wsprintf(strFile, “%s\%s”, lpszDirectory, wfd.cFileName); DeleteFile(strFile); } } } while (FindNextFile(hFind, &wfd)); FindClose(hFind); // 关闭查找句柄 if(!RemoveDirectory(lpszDirectory)) { return FALSE; } return true; } UINT CFileManager::SendFileSize(LPCTSTR lpszFileName) { UINT nRet = 0; DWORD dwSizeHigh; DWORD dwSizeLow; // 1 字节token, 8字节大小, 文件名称, ‘\0’ HANDLE hFile; // 保存当前正在操作的文件名 memset(m_strCurrentProcessFileName, 0, sizeof(m_strCurrentProcessFileName)); strcpy(m_strCurrentProcessFileName, lpszFileName); hFile = CreateFile(lpszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (hFile == INVALID_HANDLE_VALUE) return FALSE; dwSizeLow = GetFileSize(hFile, &dwSizeHigh); CloseHandle(hFile); // 构造数据包,发送文件长度 int nPacketSize = lstrlen(lpszFileName) + 10; BYTE *bPacket = (BYTE *)LocalAlloc(LPTR, nPacketSize); memset(bPacket, 0, nPacketSize); bPacket[0] = TOKEN_FILE_SIZE; FILESIZE *pFileSize = (FILESIZE *)(bPacket + 1); pFileSize->dwSizeHigh = dwSizeHigh; pFileSize->dwSizeLow = dwSizeLow; memcpy(bPacket + 9, lpszFileName, lstrlen(lpszFileName) + 1); nRet = Send(bPacket, nPacketSize); LocalFree(bPacket); return nRet; } UINT CFileManager::SendFileData(LPBYTE lpBuffer) { UINT nRet = 0; FILESIZE *pFileSize; char *lpFileName; pFileSize = (FILESIZE *)lpBuffer; lpFileName = m_strCurrentProcessFileName; // 远程跳过,传送下一个 if (pFileSize->dwSizeLow == -1) { UploadNext(); return 0; } HANDLE hFile; hFile = CreateFile(lpFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (hFile == INVALID_HANDLE_VALUE) return -1; SetFilePointer(hFile, pFileSize->dwSizeLow, (long *)&(pFileSize->dwSizeHigh), FILE_BEGIN); int nHeadLength = 9; // 1 + 4 + 4数据包头部大小 DWORD nNumberOfBytesToRead = MAX_SEND_BUFFER - nHeadLength; DWORD nNumberOfBytesRead = 0; LPBYTE lpPacket = (LPBYTE)LocalAlloc(LPTR, MAX_SEND_BUFFER); // Token, 大小,偏移,文件名,数据 lpPacket[0] = TOKEN_FILE_DATA; memcpy(lpPacket + 1, pFileSize, sizeof(FILESIZE)); ReadFile(hFile, lpPacket + nHeadLength, nNumberOfBytesToRead, &nNumberOfBytesRead, NULL); CloseHandle(hFile); if (nNumberOfBytesRead > 0) { int nPacketSize = nNumberOfBytesRead + nHeadLength; nRet = Send(lpPacket, nPacketSize); } else { UploadNext(); } LocalFree(lpPacket); return nRet; } // 传送下一个文件 void CFileManager::UploadNext() { list <string>::iterator it = m_UploadList.begin(); // 删除一个任务 m_UploadList.erase(it); // 还有上传任务 if(m_UploadList.empty()) { SendToken(TOKEN_TRANSFER_FINISH); } else { // 上传下一个 it = m_UploadList.begin(); SendFileSize((*it).c_str()); } } int CFileManager::SendToken(BYTE bToken) { return Send(&bToken, 1); } bool CFileManager::UploadToRemote(LPBYTE lpBuffer) { if (lpBuffer[lstrlen((char *)lpBuffer) - 1] == ‘\’) { FixedUploadList((char *)lpBuffer); if (m_UploadList.empty()) { StopTransfer(); return true; } } else { m_UploadList.push_back((char *)lpBuffer); } list <string>::iterator it = m_UploadList.begin(); // 发送第一个文件 SendFileSize((it).c_str()); return true; } bool CFileManager::FixedUploadList(LPCTSTR lpPathName) { WIN32_FIND_DATA wfd; char lpszFilter[MAX_PATH]; char lpszSlash = NULL; memset(lpszFilter, 0, sizeof(lpszFilter)); if (lpPathName[lstrlen(lpPathName) - 1] != ‘\’) lpszSlash = “\”; else lpszSlash = “”; wsprintf(lpszFilter, "%s%s.”, lpPathName, lpszSlash); HANDLE hFind = FindFirstFile(lpszFilter, &wfd); if (hFind == INVALID_HANDLE_VALUE) // 如果没有找到或查找失败 return false; do { if (wfd.cFileName[0] != ‘.’) { if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { char strDirectory[MAX_PATH]; wsprintf(strDirectory, “%s%s%s”, lpPathName, lpszSlash, wfd.cFileName); FixedUploadList(strDirectory); } else { char strFile[MAX_PATH]; wsprintf(strFile, “%s%s%s”, lpPathName, lpszSlash, wfd.cFileName); m_UploadList.push_back(strFile); } } } while (FindNextFile(hFind, &wfd)); FindClose(hFind); // 关闭查找句柄 return true; } void CFileManager::StopTransfer() { if (!m_UploadList.empty()) m_UploadList.clear(); SendToken(TOKEN_TRANSFER_FINISH); } void CFileManager::CreateLocalRecvFile(LPBYTE lpBuffer) { FILESIZE *pFileSize = (FILESIZE *)lpBuffer; // 保存当前正在操作的文件名 memset(m_strCurrentProcessFileName, 0, sizeof(m_strCurrentProcessFileName)); strcpy(m_strCurrentProcessFileName, (char *)lpBuffer + 8); // 保存文件长度 m_nCurrentProcessFileLength = (pFileSize->dwSizeHigh * (MAXDWORD + long long(1))) + pFileSize->dwSizeLow; // 创建多层目录 MakeSureDirectoryPathExists(m_strCurrentProcessFileName); WIN32_FIND_DATA FindFileData; HANDLE hFind = FindFirstFile(m_strCurrentProcessFileName, &FindFileData); if (hFind != INVALID_HANDLE_VALUE && m_nTransferMode != TRANSFER_MODE_OVERWRITE_ALL && m_nTransferMode != TRANSFER_MODE_ADDITION_ALL && m_nTransferMode != TRANSFER_MODE_JUMP_ALL ) { SendToken(TOKEN_GET_TRANSFER_MODE); } else { GetFileData(); } FindClose(hFind); } void CFileManager::GetFileData() { int nTransferMode; switch (m_nTransferMode) { case TRANSFER_MODE_OVERWRITE_ALL: nTransferMode = TRANSFER_MODE_OVERWRITE; break; case TRANSFER_MODE_ADDITION_ALL: nTransferMode = TRANSFER_MODE_ADDITION; break; case TRANSFER_MODE_JUMP_ALL: nTransferMode = TRANSFER_MODE_JUMP; break; default: nTransferMode = m_nTransferMode; } WIN32_FIND_DATA FindFileData; HANDLE hFind = FindFirstFile(m_strCurrentProcessFileName, &FindFileData); // 1字节Token,四字节偏移高四位,四字节偏移低四位 BYTE bToken[9]; DWORD dwCreationDisposition; // 文件打开方式 memset(bToken, 0, sizeof(bToken)); bToken[0] = TOKEN_DATA_CONTINUE; // 文件已经存在 if (hFind != INVALID_HANDLE_VALUE) { // 提示点什么 // 如果是续传 if (nTransferMode == TRANSFER_MODE_ADDITION) { memcpy(bToken + 1, &FindFileData.nFileSizeHigh, 4); memcpy(bToken + 5, &FindFileData.nFileSizeLow, 4); dwCreationDisposition = OPEN_EXISTING; } // 覆盖 else if (nTransferMode == TRANSFER_MODE_OVERWRITE) { // 偏移置0 memset(bToken + 1, 0, 8); // 重新创建 dwCreationDisposition = CREATE_ALWAYS; } // 传送下一个 else if (nTransferMode == TRANSFER_MODE_JUMP) { DWORD dwOffset = -1; memcpy(bToken + 5, &dwOffset, 4); dwCreationDisposition = OPEN_EXISTING; } } else { // 偏移置0 memset(bToken + 1, 0, 8); // 重新创建 dwCreationDisposition = CREATE_ALWAYS; } FindClose(hFind); HANDLE hFile = CreateFile ( m_strCurrentProcessFileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0 ); // 需要错误处理 if (hFile == INVALID_HANDLE_VALUE) { m_nCurrentProcessFileLength = 0; return; } CloseHandle(hFile); Send(bToken, sizeof(bToken)); } void CFileManager::WriteLocalRecvFile(LPBYTE lpBuffer, UINT nSize) { // 传输完毕 BYTE *pData; DWORD dwBytesToWrite; DWORD dwBytesWrite; int nHeadLength = 9; // 1 + 4 + 4 数据包头部大小,为固定的9 FILESIZE *pFileSize; // 得到数据的偏移 pData = lpBuffer + 8; pFileSize = (FILESIZE *)lpBuffer; // 得到数据在文件中的偏移 LONG dwOffsetHigh = pFileSize->dwSizeHigh; LONG dwOffsetLow = pFileSize->dwSizeLow; dwBytesToWrite = nSize - 8; HANDLE hFile = CreateFile ( m_strCurrentProcessFileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 ); SetFilePointer(hFile, dwOffsetLow, &dwOffsetHigh, FILE_BEGIN); int nRet = 0; // 写入文件 nRet = WriteFile ( hFile, pData, dwBytesToWrite, &dwBytesWrite, NULL ); CloseHandle(hFile); // 为了比较,计数器递增 BYTE bToken[9]; bToken[0] = TOKEN_DATA_CONTINUE; dwOffsetLow += dwBytesWrite; memcpy(bToken + 1, &dwOffsetHigh, sizeof(dwOffsetHigh)); memcpy(bToken + 5, &dwOffsetLow, sizeof(dwOffsetLow)); Send(bToken, sizeof(bToken)); } void CFileManager::SetTransferMode(LPBYTE lpBuffer) { memcpy(&m_nTransferMode, lpBuffer, sizeof(m_nTransferMode)); GetFileData(); } void CFileManager::CreateFolder(LPBYTE lpBuffer) { MakeSureDirectoryPathExists((char *)lpBuffer); SendToken(TOKEN_CREATEFOLDER_FINISH); } void CFileManager::Rename(LPBYTE lpBuffer) { LPCTSTR lpExistingFileName = (char *)lpBuffer; LPCTSTR lpNewFileName = lpExistingFileName + lstrlen(lpExistingFileName) + 1; ::MoveFile(lpExistingFileName, lpNewFileName); SendToken(TOKEN_RENAME_FINISH); } 以mermaid代码的形式表述,给出核心功能的流程图
5bf6668fd1fa40bf8642be2d6361f7ba
{ "intermediate": 0.432755708694458, "beginner": 0.36120498180389404, "expert": 0.20603929460048676 }
2,861
write Javascript code Strike and Block class cards from SLay the Spire
ee7e775b1cee8bbc11be0a5d058532ee
{ "intermediate": 0.2726074457168579, "beginner": 0.5441112518310547, "expert": 0.18328127264976501 }
2,862
Fivem scripting lua I'm working on a NOS script how could I make it so if i use the command /enableNOS in a vehicle it will then let me use nos in that vehicle and also save that even if i restart the script so i don't need to type /enableNOS everytime
cf5a8eec4993bdd86f67d65127665f6d
{ "intermediate": 0.3829617500305176, "beginner": 0.22624419629573822, "expert": 0.390794038772583 }
2,863
how can i download a file from a public key protected stfp server in alteryx
d3e5aab31173d4c0448f7f4b48a60e49
{ "intermediate": 0.5105174779891968, "beginner": 0.16916213929653168, "expert": 0.3203204274177551 }
2,864
write Javascript code Strike and Block class cards from SLay the Spire
6fd8c66e737d2250ae4da892e29440b5
{ "intermediate": 0.2726074457168579, "beginner": 0.5441112518310547, "expert": 0.18328127264976501 }
2,865
write Javascript code Strike and Block class cards from SLay the Spire
f5b6169ff955c129ef1fa3173ae3d7cc
{ "intermediate": 0.2726074457168579, "beginner": 0.5441112518310547, "expert": 0.18328127264976501 }
2,866
get is like gettting data from server like list of product like an dpost about form submittion elobarat ean dgive me best clear expanation and exmaple swhere an dwhen tp us e in djnago
ea6c3fbb0e10fb8abdfef2662ed180f7
{ "intermediate": 0.3922719657421112, "beginner": 0.28529152274131775, "expert": 0.32243648171424866 }
2,867
Read file to massiv python code
dfdb1faf47ead4635d5b6a9f0c6a202e
{ "intermediate": 0.38423725962638855, "beginner": 0.1774929016828537, "expert": 0.43826985359191895 }
2,868
make a python file which types random numbers until the number is 15000
d915ab3a244ac76401080f4abe9cd54a
{ "intermediate": 0.3959217667579651, "beginner": 0.19654898345470428, "expert": 0.4075292646884918 }
2,869
is grayscale better for feature matching
25ce239d2faa9517bea895487da038f6
{ "intermediate": 0.2949874699115753, "beginner": 0.2187962681055069, "expert": 0.4862162172794342 }
2,870
Please give me instructions for an experiment where people are supposed to rate the technical quality of a series of images. The rating is 1-5 ACR and the instructions should follow the standards set by the international telecommunication union.
b3821a5e14768a6162eecac456c43345
{ "intermediate": 0.3700832724571228, "beginner": 0.24412965774536133, "expert": 0.3857870399951935 }
2,871
suggest how to realise Bang the dice game in Javascript
c7a88832560dc5a7067644014166e7fb
{ "intermediate": 0.2835027873516083, "beginner": 0.3360850214958191, "expert": 0.38041216135025024 }
2,872
Give me a concise summary explaining all the different elements of a desktop user interface with a focus on colors, particularly how many colors and what their purposes are.
27338b2ea5d53df0aa5969310238a379
{ "intermediate": 0.3198327124118805, "beginner": 0.38122326135635376, "expert": 0.29894405603408813 }
2,873
give me the python scripts and resources needed for this ai project Creating a human-like AI robot with Python involves multiple components, including computer vision, natural language processing, and robotic control. In this outline, we will create a drone-like AI robot capable of performing repetitive human tasks, recognizing people, and assisting users in various ways. Robot Design: Choose a drone-like shape for the robot. Equip the robot with a camera for computer vision, a microphone for voice recognition, and speakers for communication. Attach robotic arms or other relevant mechanisms to perform tasks such as making coffee. Computer Vision: Use a pre-trained model (e.g., from Hugging Face) or train your own model for object and facial recognition. Implement age and gender recognition. Implement emotion recognition through facial expressions and sentiment analysis of spoken words. Voice Recognition and Natural Language Processing: Use a pre-trained model (e.g., from Hugging Face) or train your own model for speech-to-text conversion. Implement sentiment analysis to understand user emotions through voice. Implement natural language understanding to process user commands and start conversations. Task Execution and Robotic Control: Implement robotic control algorithms to perform tasks such as making coffee. Use the computer vision and NLP components to recognize people and understand their preferences. Implement task scheduling and reminders for user productivity. Personalization and Adaptation: Store user preferences, such as music choices, and use them to play the right music at the right time. Implement adaptive algorithms to learn from user interactions and improve the AI's performance over time. Integration and Testing: Integrate all the components into a single system. Test the AI robot in various scenarios to ensure it performs tasks correctly and provides a satisfactory user experience. Here's a more organized project description: Design a drone-like AI robot equipped with a camera, microphone, speakers, and robotic mechanisms for task execution. Implement computer vision capabilities for object recognition, facial recognition, age and gender recognition, and emotion recognition. Implement voice recognition and natural language processing for speech-to-text conversion, sentiment analysis, and natural language understanding. Implement task execution and robotic control algorithms to perform tasks such as making coffee, and use the computer vision and NLP components to recognize people and understand their preferences. Implement personalization and adaptation features to store user preferences, learn from user interactions, and improve the AI's performance over time. Integrate all components and test the AI robot in various scenarios to ensure it performs tasks correctly and provides a satisfactory user experience. You can use pre-trained models from Hugging Face, existing code from GitHub, or build your own models to achieve the desired functionalities. This outline provides a starting point for creating a human-like AI robot with Python, which can be further customized and expanded to meet specific project requirements. Expanding on the provided project description, we can further enhance the AI robot's capabilities to make it more useful and engaging for users. Here are some additional ideas: Integration with other devices and services: Allow the AI robot to interact with other smart devices and services, such as home automation systems, music streaming platforms, and social media. This will enable users to control their environment and access their favorite content more easily. Multilingual support: Implement multilingual support to enable the AI robot to communicate with users in their preferred language. This will make the robot more accessible to people from diverse backgrounds and cultures. Personalized recommendations: Use machine learning algorithms to analyze user behavior and preferences and make personalized recommendations for activities, products, and services. This will help users discover new things they might enjoy and increase their satisfaction with the AI robot. Virtual assistant capabilities: Implement virtual assistant features, such as setting reminders, making phone calls, sending messages, and answering questions. This will make the AI robot more useful for everyday tasks and increase its value for users. Emotional intelligence: Enhance the AI robot's emotional intelligence to enable it to understand and respond to users' emotions more effectively. This can be achieved through more advanced computer vision and NLP techniques, as well as the use of sentiment analysis and emotion recognition tools. Collaboration and teamwork: Enable the AI robot to work collaboratively with other robots or humans to achieve common goals. This will make the robot more versatile and adaptable to different situations and contexts. These ideas can be implemented using various Python libraries and frameworks, such as TensorFlow, PyTorch, OpenCV, NLTK, and spaCy. Additionally, the AI robot can be trained on large datasets of relevant information, such as news articles, social media posts, and user feedback, to improve its performance and accuracy over time. By combining these features and techniques, we can create a highly intelligent and engaging AI robot that can serve as a valuable tool for users in various settings and scenarios. To expand the capabilities of the AI robot, we can integrate it with other devices and services, which will allow the robot to interact with other smart devices and services, such as home automation systems, music streaming platforms, and social media. This can be achieved by using various Python libraries and frameworks, such as TensorFlow, PyTorch, OpenCV, NLTK, and spaCy [0]. By integrating with other devices, the AI robot will enable users to control their environment and access their favorite content more easily. However, this integration may require additional hardware and software configurations, which can increase the complexity of the project. Another idea to enhance the AI robot's capabilities is to implement multilingual support, which will enable the robot to communicate with users in their preferred language. This can be achieved by using natural language processing (NLP) techniques and machine learning algorithms to analyze and understand different languages [0]. This will make the robot more accessible to people from diverse backgrounds and cultures. However, implementing multilingual support can be challenging, as it requires a large amount of language data and sophisticated NLP models. Personalized recommendations can be made by using machine learning algorithms to analyze user behavior and preferences. This can help the robot make personalized recommendations for activities, products, and services, which will help users discover new things they might enjoy and increase their satisfaction with the AI robot. This can be achieved by using various Python libraries and frameworks, such as TensorFlow, PyTorch, OpenCV, NLTK, and spaCy [0]. However, implementing personalized recommendations requires a large amount of user data, which can raise privacy concerns. Implementing virtual assistant features, such as setting reminders, making phone calls, sending messages, and answering questions, will make the AI robot more useful for everyday tasks and increase its value for users. This can be achieved by using various Python libraries and frameworks, such as TensorFlow, PyTorch, OpenCV, NLTK, and spaCy [0]. However, implementing virtual assistant features requires sophisticated NLP models and a large amount of training data. Enhancing the AI robot's emotional intelligence can enable it to understand and respond to users' emotions more effectively. This can be achieved through more advanced computer vision and NLP techniques, as well as the use of sentiment analysis and emotion recognition tools [0]. However, implementing emotional intelligence can be challenging, as it requires a large amount of labeled emotional data and sophisticated NLP and computer vision models. Finally, enabling the AI robot to work collaboratively with other robots or humans to achieve common goals can make the robot more versatile and adaptable to different situations and contexts. This can be achieved by using various Python libraries and frameworks, such as TensorFlow, PyTorch, OpenCV, NLTK, and spaCy [0]. However, implementing collaboration and teamwork requires sophisticated machine learning algorithms and a large amount of training data. In summary, there are many ways to enhance the capabilities of the AI robot, including integrating with other devices and services, implementing multilingual support, making personalized recommendations, adding virtual assistant features, enhancing emotional intelligence, and enabling collaboration and teamwork. Each approach has its pros and cons, and the choice of approach will depend on the specific requirements and constraints of the project.
b236ca9cb75057d3c85d2b5dbf3116df
{ "intermediate": 0.4442142844200134, "beginner": 0.29519417881965637, "expert": 0.2605915069580078 }
2,874
I have save image function, as paramater there is name but I can pass folders in name too for example data/name. Problem is if data folder does not exist it throws error, what I need is that the function creates folder when necessary. Here is my code: "def save_image(img, name="Test"): # A function to save images to disk, takes parameter img data and name img = Image.fromarray(img) # Convert array to image img.save("image_out/"+name+".png", format="png") # Save to the disk"
3d2d150baabfe09e04760ebfacb23933
{ "intermediate": 0.40413039922714233, "beginner": 0.31689876317977905, "expert": 0.2789708375930786 }
2,875
Do you have knowledge of Symbian programming?
91ea0b797eb481738570519ef5d60cb0
{ "intermediate": 0.32477742433547974, "beginner": 0.5864599943161011, "expert": 0.08876260370016098 }
2,876
привет можешь подсказать как сделать из этого кода отсчет времени в unity using UnityEngine; using TMPro; public class Timer : MonoBehaviour { [SerializeField] private float timerDuration = 3f * 60f; //Duration of the timer in seconds [SerializeField] private bool countDown = true; private float timer; [SerializeField] private TextMeshProUGUI firstMinute; [SerializeField] private TextMeshProUGUI secondMinute; [SerializeField] private TextMeshProUGUI separator; [SerializeField] private TextMeshProUGUI firstSecond; [SerializeField] private TextMeshProUGUI secondSecond; //Use this for a single text object //[SerializeField] //private TextMeshProUGUI timerText; private float flashTimer; [SerializeField] private float flashDuration = 1f; //The full length of the flash private void Start() { ResetTimer(); } private void ResetTimer() { if (countDown) { timer = timerDuration; } else { timer = 0; } SetTextDisplay(true); } void Update() { if (countDown && timer > 0) { timer -= Time.deltaTime; UpdateTimerDisplay(timer); } else if (!countDown && timer < timerDuration) { timer += Time.deltaTime; UpdateTimerDisplay(timer); } else { FlashTimer(); } } private void UpdateTimerDisplay(float time) { if (time < 0) { time = 0; } if (time > 3660) { Debug.LogError("Timer cannot display values above 3660 seconds"); ErrorDisplay(); return; } float minutes = Mathf.FloorToInt(time / 60); float seconds = Mathf.FloorToInt(time % 60); string currentTime = string.Format("{00:00}{01:00}", minutes, seconds); firstMinute.text = currentTime[0].ToString(); secondMinute.text = currentTime[1].ToString(); firstSecond.text = currentTime[2].ToString(); secondSecond.text = currentTime[3].ToString(); //Use this for a single text object //timerText.text = currentTime.ToString(); } private void ErrorDisplay() { firstMinute.text = "8"; secondMinute.text = "8"; firstSecond.text = "8"; secondSecond.text = "8"; //Use this for a single text object //timerText.text = "ERROR"; } private void FlashTimer() { if(countDown && timer != 0) { timer = 0; UpdateTimerDisplay(timer); } if(!countDown && timer != timerDuration) { timer = timerDuration; UpdateTimerDisplay(timer); } if(flashTimer <= 0) { flashTimer = flashDuration; } else if (flashTimer <= flashDuration / 2) { flashTimer -= Time.deltaTime; SetTextDisplay(true); } else { flashTimer -= Time.deltaTime; SetTextDisplay(false); } } private void SetTextDisplay(bool enabled) { firstMinute.enabled = enabled; secondMinute.enabled = enabled; separator.enabled = enabled; firstSecond.enabled = enabled; secondSecond.enabled = enabled; //Use this for a single text object //timerText.enabled = enabled; } }
211fb6e6a86a1c3cc96a05860be925ac
{ "intermediate": 0.4813567101955414, "beginner": 0.34952038526535034, "expert": 0.16912288963794708 }
2,877
I moved on to the rotated images for warping however applying homography does not rotate the image to correct rotation. Can you know why, does the rotation not get calculated by using ORB, SURF or my warp can not apply rotation ? Here is my warp function: "def warp_perspective(img, H, reverse=True): # The function to warp images by applying reversed homography matrix min_x, min_y, max_x, max_y = get_warped_image_bounds(img, H) # Trying to predict the shape of the warped image in a smart way w, h = int(max_y - min_y), int(max_x - min_x) # Calculating width and height from the x and y if reverse: H = np.linalg.inv(H) # Reversing the homography # The general explanation is this: # Instead of applying homography to image which can result in glitched image, for example empty pixels # After the warped image shape is estimated, we apply the homography in reverse and use the image as a lookup table # This way no pixel will be empty or glitched, all pixels will get a value target_y, target_x = np.meshgrid(np.arange(min_x, max_x), np.arange(min_y, max_y)) # Creating coordinate matrices that represents a canvas for the warped image target_coordinates = np.stack([target_x.ravel(), target_y.ravel(), np.ones(target_x.size)]) # Vectorizing the coordinate matrix, using vectorized solution to compute is way faster source_coordinates = np.dot(np.linalg.inv(H), target_coordinates) # Applying the reversed homography to target coordinates to get where they corespond in source image source_coordinates /= source_coordinates[2, :] # Normalizing the coordinates valid = np.logical_and(np.logical_and(0 <= source_coordinates[0, :], source_coordinates[0, :] < img.shape[1]), np.logical_and(0 <= source_coordinates[1, :], source_coordinates[1, :] < img.shape[0])) # Creating a mask from the valid coordinates valid_source_coordinates = source_coordinates[:, valid].astype(int) # Applying mask to coordinate systems to get image cutouts valid_target_coordinates = target_coordinates[:, valid].astype(int) valid_source_coordinates[0] = np.clip(valid_source_coordinates[0], -np.inf, img.shape[1] - 1) # Clipping the coordinates to the image shape valid_source_coordinates[1] = np.clip(valid_source_coordinates[1], -np.inf, img.shape[0] - 1) # This is another part where the fine adjustment is made # After applying homography matrix, the point of interest aligns to the left edge # However there is data in the negative region # In order to make all data visible, the image is transformed to the right and bottom as much as the calculated negative minimum corner # In the future (merging) this transform is substracted to align images back # However while developing or printing out warped images this transform allows all of the image to be warped valid_target_coordinates[0] += int(abs(min_y)) valid_target_coordinates[1] += int(abs(min_x)) valid_target_coordinates[0] = np.clip(valid_target_coordinates[0], -np.inf, w - 1) # Clipping target coordinates valid_target_coordinates[1] = np.clip(valid_target_coordinates[1], -np.inf, h - 1) warped_image = np.zeros((h, w, 3), dtype=np.uint8) # Creating an array to hold warped image for i in range(3): warped_image[:,:, i][valid_target_coordinates[1], valid_target_coordinates[0]] = img[:,:, i][valid_source_coordinates[1], valid_source_coordinates[0]] # Replacing the pixels from the source image return warped_image # Returning warped image"
c83a9d4af342e048eeefe899f7151f4e
{ "intermediate": 0.3971143066883087, "beginner": 0.4334907531738281, "expert": 0.16939492523670197 }
2,878
Afrobeatles is an Afrobeats group, our latest single "Hazardous" spent 3 weeks on the Hot 100. We're starting a big tour in 6 months, and while we'll be selling tickets and merchandise as usual, we'd also like to experiment with "social selling". We want to help our fans sell Afrobeatles t-shirts, then give the best selling fans two free tickets to any concert of their choice. We have a separate homepage, but we contracted a developer to come build out this new experience. We'll build it into the main site if it works, but for now we just want to validate the social selling strategy. We compared a few options and decided to build on Stripe, because Payment Links make it easy to give each of our fans their own "storefront". If we end up getting good sales through it, then we might automatically qualify for some financing through Stripe Capital! Deliverables Unfortunately, the contract developer who built most of this site had to change projects and couldn't implement the Stripe integration. They left READMEs in code about how to run the app, and wrote up plans for the last two milestones: Creating Payment Links: Allow fans to sign up as affiliates with an email and display name. Provide a Stripe Payment Link associated with that fan. Leaderboard: Generate a leaderboard out of all Payment Link sales per fan to determine who is in the lead at any given time. We've already started a branch and pull request with their write up about the first milestone. Once you push a commit that passes the test suite in GitHub, we'll automatically merge and open a new pull request for the next milestone. The test automation depends on GitHub Actions. If the tests aren't immediately running, try checking their status page to see if there is an incident. Working with the test suite The previous developer's integration tests won't work anymore if your work changes: Any of the server's existing routes. Any of the classes and IDs from the rendered web page. Please try to make only the changes necessary to satisfy the requirements. Note that we're only concerned about how the site runs on the latest version of Google Chrome.
5b03eaa7806d0d9fca4c24fabeb9292f
{ "intermediate": 0.17626380920410156, "beginner": 0.6313754320144653, "expert": 0.1923607587814331 }
2,879
write scyther security verification code for secure data provenance
1321e688cf875baf4b0bd130440b836f
{ "intermediate": 0.3167864978313446, "beginner": 0.22877438366413116, "expert": 0.4544391334056854 }
2,880
How to prevent ssh from closing after executiong a command with "su user -c ..."
8266ce527c7c5ee4d553d0b46062d1fb
{ "intermediate": 0.3278005123138428, "beginner": 0.19457954168319702, "expert": 0.47761988639831543 }
2,881
Traceback (most recent call last): File "/home/ludovic/Bureau/csv.py", line 1, in <module> import pandas as pd File "/home/ludovic/.local/lib/python3.10/site-packages/pandas/__init__.py", line 48, in <module> from pandas.core.api import ( File "/home/ludovic/.local/lib/python3.10/site-packages/pandas/core/api.py", line 27, in <module> from pandas.core.arrays import Categorical File "/home/ludovic/.local/lib/python3.10/site-packages/pandas/core/arrays/__init__.py", line 8, in <module> from pandas.core.arrays.categorical import Categorical File "/home/ludovic/.local/lib/python3.10/site-packages/pandas/core/arrays/categorical.py", line 3, in <module> from csv import QUOTE_NONNUMERIC File "/home/ludovic/Bureau/csv.py", line 5, in <module> data = pd.read_csv(filename) AttributeError: partially initialized module 'pandas' has no attribute 'read_csv' (most likely due to a circular import) import pandas as pd # Charger le fichier CSV filename = 'souche_enterobase.csv' data = pd.read_csv(filename) # Regrouper les données par ‘project’, ‘pcr ribotype’ et ‘data source’ grouped_data = data.groupby(['Project', 'PCR Ribotype', 'Data Source','Sample','Name']).size().reset_index(name='count') # Enregistrer les résultats dans un nouveau fichier CSV output_filename = 'resultats.csv' grouped_data.to_csv(output_filename, index=False)
df2224778fc3b278e2d5adad336cd38d
{ "intermediate": 0.5866397619247437, "beginner": 0.19769535958766937, "expert": 0.21566489338874817 }
2,882
Show me an example of a REST API in Spring framework for CRUD on a user object. Include examples of Hibernate objects.
c17a0791308dcc0ad98f304cd9edb971
{ "intermediate": 0.9000393152236938, "beginner": 0.05479932203888893, "expert": 0.04516131058335304 }
2,883
:-1: error: one or more PCH files were found, but they were invalid
c63dfdd63eb85181a8b1fa7bc3b37809
{ "intermediate": 0.3483699858188629, "beginner": 0.26292046904563904, "expert": 0.3887096047401428 }
2,884
how to get value of variable ipPort from string in python{ "supportsHttps": true, "protocol": "socks4", "ip": "145.239.252.47", "port": "11135", "get": true, "post": true, "cookies": true, "referer": true, "user-agent": true, "anonymityLevel": 1, "websites": { "example": true, "google": true, "amazon": true, "yelp": true, "google_maps": true }, "country": "GB", "unixTimestampMs": 1682515619846, "tsChecked": 1682515619, "unixTimestamp": 1682515619, "curl": "socks4://145.239.252.47:11135", "ipPort": "145.239.252.47:11135", "type": "socks4", "speed": 384.61, "otherProtocols": {}, "verifiedSecondsAgo": 748 }
a0f0976ec086ebc33e1675281fdb66bd
{ "intermediate": 0.46857351064682007, "beginner": 0.23667369782924652, "expert": 0.294752836227417 }
2,885
const tempReferrData: ReferralData[] = [ { id: 1, open_link: [ { date: "2023-04-20", count: 10 }, { date: "2023-04-21", count: 12 }, { date: "2023-04-22", count: 15 }, { date: "2023-04-23", count: 18 }, { date: "2023-04-24", count: 20 }, { date: "2023-04-25", count: 22 }, { date: "2023-04-26", count: 24 }, ], registration: [ { date: "2023-04-20", count: 5 }, { date: "2023-04-21", count: 7 }, { date: "2023-04-22", count: 8 }, { date: "2023-04-23", count: 10 }, { date: "2023-04-24", count: 12 }, { date: "2023-04-25", count: 14 }, { date: "2023-04-26", count: 16 }, ], order_pay: [ { date: "2023-04-20", count: 2 }, { date: "2023-04-21", count: 3 }, { date: "2023-04-22", count: 4 }, { date: "2023-04-23", count: 5 }, { date: "2023-04-24", count: 6 }, { date: "2023-04-25", count: 7 }, { date: "2023-04-26", count: 8 }, ], subscription_pay: [ { date: "2023-04-20", count: 1 }, { date: "2023-04-21", count: 2 }, { date: "2023-04-22", count: 2 }, { date: "2023-04-23", count: 3 }, { date: "2023-04-24", count: 3 }, { date: "2023-04-25", count: 4 }, { date: "2023-04-26", count: 4 }, ], }, { id: 2, open_link: [ { date: "2023-04-20", count: 20 }, { date: "2023-04-21", count: 22 }, { date: "2023-04-22", count: 2 }, { date: "2023-04-23", count: 3 }, { date: "2023-04-24", count: 3 }, { date: "2023-04-25", count: 4 }, { date: "2023-04-26", count: 4 }, ], registration: [ { date: "2023-04-20", count: 5 }, { date: "2023-04-21", count: 7 }, { date: "2023-04-22", count: 8 }, { date: "2023-04-23", count: 10 }, { date: "2023-04-24", count: 12 }, { date: "2023-04-25", count: 14 }, { date: "2023-04-26", count: 16 }, ], order_pay: [ { date: "2023-04-20", count: 2 }, { date: "2023-04-21", count: 3 }, { date: "2023-04-22", count: 4 }, { date: "2023-04-23", count: 5 }, { date: "2023-04-24", count: 6 }, { date: "2023-04-25", count: 7 }, { date: "2023-04-26", count: 8 }, ], subscription_pay: [ { date: "2023-04-20", count: 1 }, { date: "2023-04-21", count: 2 }, { date: "2023-04-22", count: 2 }, { date: "2023-04-23", count: 3 }, { date: "2023-04-24", count: 3 }, { date: "2023-04-25", count: 4 }, { date: "2023-04-26", count: 4 }, ], } ] нужно сделать график для каждой 4 массивов open_link registration order_pay subscription_pay в каждом массиве tempReferrData, для каждого id import { CartesianGrid, Legend, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"; напиши мне как должен выглядеть <ResponsiveContainer width="100%" height={400}> <LineChart data={tempReferrData}>
ff410ecaa31ef0527f9eb454c5c64fba
{ "intermediate": 0.29197490215301514, "beginner": 0.529462456703186, "expert": 0.17856261134147644 }
2,886
please suggest some original formal buddhist or tantric meditation
e594fd58d4c0cf1ed60d0aaf42194c46
{ "intermediate": 0.3391853868961334, "beginner": 0.3917583227157593, "expert": 0.2690562605857849 }
2,887
Fivem Scripting I want to attach and object (a pellet) to a flatbed when the pallet is not connected to a forklift
82e0608b752688a6ec17b2835f87e4aa
{ "intermediate": 0.3617357313632965, "beginner": 0.31465715169906616, "expert": 0.32360705733299255 }
2,888
I have a nix app and I want to add a run time dependency to it, how do I do that ?
3d7a300541d542ccc60d92d01b5ea7a2
{ "intermediate": 0.4324987232685089, "beginner": 0.1997443586587906, "expert": 0.3677569031715393 }
2,889
//--------------------------------------------------------------------------- // Example: InitPll: //--------------------------------------------------------------------------- // This function initializes the PLLCR register. void InitPll(Uint16 val, Uint16 divsel) { // Change the PLLCR if (SysCtrlRegs.PLLCR.bit.DIV != val) { EALLOW; // Before setting PLLCR turn off missing clock detect logic SysCtrlRegs.PLLSTS.bit.MCLKOFF = 1; SysCtrlRegs.PLLCR.bit.DIV = val; EDIS; // Optional: Wait for PLL to lock. // During this time the CPU will switch to OSCCLK/2 until // the PLL is stable. Once the PLL is stable the CPU will // switch to the new PLL value. // // This time-to-lock is monitored by a PLL lock counter. // // Code is not required to sit and wait for the PLL to lock. // However, if the code does anything that is timing critical, // and requires the correct clock be locked, then it is best to // wait until this switching has completed. // Wait for the PLL lock bit to be set. // The watchdog should be disabled before this loop, or fed within // the loop via ServiceDog(). // Uncomment to disable the watchdog DisableDog(); while(SysCtrlRegs.PLLSTS.bit.PLLLOCKS != 1) { // Uncomment to service the watchdog // ServiceDog(); } EALLOW; SysCtrlRegs.PLLSTS.bit.MCLKOFF = 0; EDIS; } }
a1e98dd95f75b3963c1e5b3dd421dc1a
{ "intermediate": 0.40654879808425903, "beginner": 0.30293992161750793, "expert": 0.2905113697052002 }
2,891
The following code causes an error "CS1061 'EventsRequestBuilder' does not contain a definition for 'Request' and no accessible extension method 'Request' accepting a first argument of type 'EventsRequestBuilder' could be found (are you missing a using directive or an assembly reference?)". <C#> using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Microsoft.Graph; using Outlook = Microsoft.Office.Interop.Outlook; using Microsoft.Graph.Models; using Azure.Identity; using System.Security.Policy; using Microsoft.Office.Tools; using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView; using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; using System.Globalization; namespace Outage_Helper { public partial class OutageCalendarPane : UserControl { private const string ClientId = "[YOUR_APP_REGISTRATION_CLIENT_ID]"; private const string TenantId = "[YOUR_TENANT_ID]"; private const string UtilityAccountUsername = "outage-helper@ct4.com"; private const string UtilityAccountPassword = "[PASSWORD]"; private GraphServiceClient _graphClient; private Outlook.MailItem _selectedMailItem; public OutageCalendarPane(Outlook.MailItem selectedMailItem) { InitializeComponent(); _selectedMailItem = selectedMailItem; emailContentTextBox.Text = selectedMailItem.Body; AuthenticateAndInitializeGraphClient().ConfigureAwait(false); } private async Task AuthenticateAndInitializeGraphClient() { var credential = new UsernamePasswordCredential(UtilityAccountUsername, UtilityAccountPassword, ClientId, TenantId); _graphClient = new GraphServiceClient(credential); } private async void submitBtn_Click(object sender, EventArgs e) { if (_graphClient != null) { string calendarId = "[OUTAGE-CALENDAR - ID]"; var newEvent = new Event { Subject = eventNameTextBox.Text, Start = new DateTimeTimeZone { DateTime = startDateTimePicker.Value.ToString("o"), TimeZone = "UTC" }, End = new DateTimeTimeZone { DateTime = endDateTimePicker.Value.ToString("o"), TimeZone = "UTC" }, Body = new ItemBody { ContentType = BodyType.Text, Content = $"Username: { _selectedMailItem.Sender.Name}\nNote: { eventNoteTextBox.Text}\n\nEmail Text: { emailContentTextBox.Text}" } }; await _graphClient.Users[UtilityAccountUsername].Calendars[calendarId].Events.Request().AddAsync(newEvent).ConfigureAwait(false); MessageBox.Show("Outage event has been added to the shared calendar."); ((Form)this.TopLevelControl).Close(); } else { MessageBox.Show("Error: Unable to add the outage event. Please try again."); } } private void cancelBtn_Click(object sender, EventArgs e) { ((Form)this.TopLevelControl).Close(); } } } </C#> According to https://stackoverflow.com/questions/74180422/requestbuilder-does-not-contain-a-definition-for-request a new method is required, which is detailed in https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/feature/5.0/docs/upgrade-to-v5.md. Please adjust the provided code to fix the error.
df634d67b1d248e06352cafa2c464fa4
{ "intermediate": 0.35288432240486145, "beginner": 0.5139694809913635, "expert": 0.13314619660377502 }
2,892
Можно ли инвертировать условие def getZipFile(self, zipPath): if os.path.exists(zipPath): with open(zipPath, "rb") as outboxFile: outboxContent = outboxFile.read() if '/tst_full_download' in f"{squishinfo.testCase}": return {"full": (outboxFile.name, outboxContent)} else: return {"outbox": (outboxFile.name, outboxContent)} else: return None
b1548e5b0a73f3e2d5cb7c7351e169bf
{ "intermediate": 0.29750174283981323, "beginner": 0.42863255739212036, "expert": 0.2738656997680664 }
2,893
<body style="width: 100%; margin: 0px; padding: 0px; display: flex; flex-direction: column; flex-grow: 1; background-color: rgb(11, 15, 25);"> <gradio-app control_page_title="true" embed="false" eager="true" style="display: flex; flex-direction: column; flex-grow: 1"> <div class="gradio-container gradio-container-3-21-0 svelte-v63enf app dark" style="min-height: initial; flex-grow: 1;"><div class="main svelte-v63enf"> <div class="wrap svelte-ujkds4" style="min-height: 100%;"><div class="contain" style="flex-grow: 1;"><div id="component-0" style="min-width: min(0px, 100%); flex-grow: 1" class="svelte-1adap6y gap"><div id="component-1" class="block svelte-1scc9gv padded" style="padding: 0px; margin: 0px; border-width: 0px; box-shadow: none; overflow: visible; background: transparent none repeat scroll 0% 0%; border-style: solid;"><div class="wrap center svelte-1d50qkz hide" style="position: absolute; padding: 0px;"></div> <div class="svelte-1ed2p3z"><div class="prose svelte-1ybaih5" id="component-1"><h1 align="center">GPT-3.5 Chatbot</h1></div></div></div><div id="component-2" class="block svelte-1scc9gv padded" style="padding: 0px; margin: 0px; border-width: 0px; box-shadow: none; overflow: visible; background: transparent none repeat scroll 0% 0%; border-style: solid;"><div class="wrap center svelte-1d50qkz hide" style="position: absolute; padding: 0px;"></div> <div class="svelte-1ed2p3z"><div class="prose svelte-1ybaih5" id="component-2"><h3 align="center">This app provides you full access to GPT-3.5 (4096 token limit). You don't need any OPENAI API key.</h3></div></div></div><div id="col_container" style="min-width: min(320px, 100%); flex-grow: 1" class="svelte-1adap6y gap"><div id="chatbot" class="block svelte-1scc9gv" style="border-style: solid; overflow: visible;"><div style=" " class="svelte-1eq475l"><span class="svelte-1eq475l"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--carbon" width="100%" height="100%" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path fill="currentColor" d="M17.74 30L16 29l4-7h6a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h9v2H6a4 4 0 0 1-4-4V8a4 4 0 0 1 4-4h20a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4h-4.84Z"></path><path fill="currentColor" d="M8 10h16v2H8zm0 6h10v2H8z"></path></svg></span> Chatbot</div> <div class="wrap svelte-a99nd8"><div class="message-wrap svelte-a99nd8"> </div></div></div><div class="form svelte-w3fdu4"><div id="component-5" class="block svelte-1scc9gv padded" style="border-style: solid; overflow: visible;"> <label class="svelte-drgfj5"><span class="svelte-1jsbsph">Type an input and press Enter</span> <textarea data-testid="textbox" class="scroll-hide svelte-drgfj5" placeholder="Hi there!" rows="1" style="overflow-y: scroll; height: 42px;"></textarea></label></div></div><div class="flex svelte-1btyfsc" id="component-7"><div id="component-8" style="min-width: min(320px, 100%); flex-grow: 7" class="svelte-1adap6y gap"><button class="lg secondary svelte-58yet2" style=" width: var(--size-full); flex-grow: 1; " id="component-9">Run</button></div><div id="component-10" style="min-width: min(320px, 100%); flex-grow: 3" class="svelte-1adap6y gap"><div class="form svelte-w3fdu4"><div id="component-11" class="block svelte-1scc9gv padded" style="border-style: solid; overflow: visible;"> <label class="svelte-drgfj5"><span class="svelte-1jsbsph">Status code from OpenAI server</span> <textarea data-testid="textbox" class="scroll-hide svelte-drgfj5" placeholder="" rows="1" disabled="" style="overflow-y: scroll; height: 42px;"></textarea></label></div></div></div></div><div id="component-13" class="block svelte-1scc9gv padded" style="border-style: solid; overflow: visible;"><div class="wrap default svelte-1d50qkz hide" style="position: absolute; padding: 0px;"></div> <div class="label-wrap svelte-l0fc71"><span class="svelte-l0fc71">Parameters</span> <span class="icon svelte-l0fc71" style="transform: rotate(90deg);">▼</span></div> </div></div><div id="user_consent_container" style="min-width: min(320px, 100%); flex-grow: 1" class="svelte-1adap6y gap hide"><div class="form svelte-w3fdu4 hidden"><div id="component-20" class="block svelte-1scc9gv hidden padded" style="border-style: solid; overflow: visible;"><div class="wrap default svelte-1d50qkz hide" style="position: absolute; padding: 0px;"></div> <label class="svelte-927721 disabled"><input disabled="" type="checkbox" name="test" data-testid="checkbox" class="svelte-927721"> <span class="ml-2 svelte-927721">Checkbox</span></label></div></div><div id="component-21" class="block svelte-1scc9gv padded" style="border-style: solid; overflow: visible;"><div class="wrap default svelte-1d50qkz hide" style="position: absolute; padding: 0px;"></div> <div class="label-wrap svelte-l0fc71 open"><span class="svelte-l0fc71">User Consent for Data Collection, Use, and Sharing</span> <span class="icon svelte-l0fc71" style="transform: rotate(0deg);">▼</span></div> <div id="" style="min-width: min(0px, 100%); flex-grow: 1" class="svelte-1adap6y gap"><div id="component-22" class="block svelte-1scc9gv padded" style="padding: 0px; margin: 0px; border-width: 0px; box-shadow: none; overflow: visible; background: transparent none repeat scroll 0% 0%; border-style: solid;"><div class="wrap center svelte-1d50qkz hide" style="position: absolute; padding: 0px;"></div> <div class="svelte-1ed2p3z"><div class="prose svelte-1ybaih5" id="component-22"> <div> <p>By using our app, which is powered by OpenAI's API, you acknowledge and agree to the following terms regarding the data you provide:</p> <ol> <li><strong>Collection:</strong> We may collect information, including the inputs you type into our app, the outputs generated by OpenAI's API, and certain technical details about your device and connection (such as browser type, operating system, and IP address) provided by your device's request headers.</li> <li><strong>Use:</strong> We may use the collected data for research purposes, to improve our services, and to develop new products or services, including commercial applications, and for security purposes, such as protecting against unauthorized access and attacks.</li> <li><strong>Sharing and Publication:</strong> Your data, including the technical details collected from your device's request headers, may be published, shared with third parties, or used for analysis and reporting purposes.</li> <li><strong>Data Retention:</strong> We may retain your data, including the technical details collected from your device's request headers, for as long as necessary.</li> </ol> <p>By continuing to use our app, you provide your explicit consent to the collection, use, and potential sharing of your data as described above. If you do not agree with our data collection, use, and sharing practices, please do not use our app.</p> </div> </div></div></div><button class="lg secondary svelte-58yet2" style=" " id="component-23">I Agree</button></div></div></div></div></div> <footer class="svelte-ujkds4"> <a href="https://gradio.app" class="built-with svelte-ujkds4" target="_blank" rel="noreferrer">Built with Gradio <img src="./assets/logo.0a070fcf.svg" alt="logo" class="svelte-ujkds4"></a></footer></div> </div> <style>#col_container { margin-left: auto; margin-right: auto;} #chatbot {height: 520px; overflow: auto;}</style></div></gradio-app> <script> const ce = document.getElementsByTagName("gradio-app"); if (ce[0]) { ce[0].addEventListener("domchange", () => { document.body.style.padding = "0"; }); document.body.style.padding = "0"; } </script> </body>
0f11e58b5c9093ab826e8224fe42a32e
{ "intermediate": 0.31808504462242126, "beginner": 0.46164670586586, "expert": 0.22026829421520233 }
2,894
now how to put these things together, so they will work properly inside codepen, for example, for “https://yuntian-deng-chatgpt.hf.space/?__theme=dark” domain? the current url for chatbot gpt 3.5 interface that I’m using right now is as follows: “https://yuntian-deng-chatgpt.hf.space/?__theme=dark” with some dark mode parameter in url applied.
3e14307fd03a5db15bd315af685e0b24
{ "intermediate": 0.6075461506843567, "beginner": 0.15383757650852203, "expert": 0.2386162281036377 }
2,895
Please program a simple program that generates a red heart fractal using the p5.js library and WebGL:
67ad308b04ee3ff74ad3de34d60b90f9
{ "intermediate": 0.6632364988327026, "beginner": 0.16000524163246155, "expert": 0.17675821483135223 }
2,896
Having two bounding boxes compute in python intersection over union
8fdc606412d3f8a51200675d796c5de5
{ "intermediate": 0.2992875576019287, "beginner": 0.16300103068351746, "expert": 0.5377114415168762 }
2,897
Traceback (most recent call last): File "/home/ludovic/Bureau/process_csv.py", line 8, in <module> grouped_data = data.groupby(['Project', 'PCR_Ribotype', 'Data_Source','Sample','Name','Source']).size().reset_index(name='count') File "/home/ludovic/.local/lib/python3.10/site-packages/pandas/core/frame.py", line 8402, in groupby return DataFrameGroupBy( File "/home/ludovic/.local/lib/python3.10/site-packages/pandas/core/groupby/groupby.py", line 965, in __init__ grouper, exclusions, obj = get_grouper( File "/home/ludovic/.local/lib/python3.10/site-packages/pandas/core/groupby/grouper.py", line 888, in get_grouper raise KeyError(gpr) KeyError: 'Project'
1b5fd1c2d7599a60afd171ebce7684c0
{ "intermediate": 0.5170127749443054, "beginner": 0.3232668936252594, "expert": 0.15972039103507996 }
2,898
using C# reflection, how do I the propertyinfo associated with the backing field?
344abff160543d0ad2d7ee1a2a64f18c
{ "intermediate": 0.6635286808013916, "beginner": 0.18484795093536377, "expert": 0.15162333846092224 }
2,899
Привет! помоги пожалуйста, нужно сделать так чтобы работал не Update а Corutine public class QuestTime : MonoBehaviour { [SerializeField] private TextMeshProUGUI hourHand; public string GetTime() { return hourHand.text; } private void Update() { ConvertTime(Time.time); } private void ConvertTime(float time) { var hours = Mathf.Floor(time / 3600); var minutes = Mathf.Floor((time % 3600) / 60); var seconds = Mathf.Floor(time % 60); UpdateQuestTime(hours, minutes, seconds); } private void UpdateQuestTime(float hours, float minutes, float seconds) { hourHand.text = ((int)hours).ToString("D2") + ":" + ((int)minutes).ToString("D2") + ":" + ((int)seconds).ToString("D2"); } }
76882ddbc956e84cd96e170864b7ca40
{ "intermediate": 0.4222727417945862, "beginner": 0.3781299293041229, "expert": 0.1995972990989685 }
2,900
can u use python write a program of atmospheric science?
5bd412b07682f14a9a27e31df5c5e2ba
{ "intermediate": 0.4232655167579651, "beginner": 0.1966637521982193, "expert": 0.38007068634033203 }
2,901
implement Strike and Block card from Slay the Spire into Javascript classes
eac2e8ab06026f094e8439bf253157a1
{ "intermediate": 0.271650493144989, "beginner": 0.5721607804298401, "expert": 0.15618878602981567 }
2,902
I have an outlook addin which I have written: <C#> using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Microsoft.Graph; using Outlook = Microsoft.Office.Interop.Outlook; using Microsoft.Graph.Models; using Azure.Identity; using System.Security.Policy; using Microsoft.Office.Tools; using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView; using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; using System.Globalization; namespace Outage_Helper { public partial class OutageCalendarPane : UserControl { private const string ClientId = "[YOUR_APP_REGISTRATION_CLIENT_ID]"; private const string TenantId = "[YOUR_TENANT_ID]"; private const string UtilityAccountUsername = "outage-helper@ct4.com"; private const string UtilityAccountPassword = "[PASSWORD]"; private GraphServiceClient _graphClient; private Outlook.MailItem _selectedMailItem; public OutageCalendarPane(Outlook.MailItem selectedMailItem) { InitializeComponent(); _selectedMailItem = selectedMailItem; emailContentTextBox.Text = selectedMailItem.Body; AuthenticateAndInitializeGraphClient().ConfigureAwait(false); } private async Task AuthenticateAndInitializeGraphClient() { var credential = new UsernamePasswordCredential(UtilityAccountUsername, UtilityAccountPassword, ClientId, TenantId); _graphClient = new GraphServiceClient(credential); } private async void submitBtn_Click(object sender, EventArgs e) { if (_graphClient != null) { string calendarId = "[OUTAGE-CALENDAR - ID]"; var newEvent = new Event { Subject = eventNameTextBox.Text, Start = new DateTimeTimeZone { DateTime = startDateTimePicker.Value.ToString("o"), TimeZone = "UTC" }, End = new DateTimeTimeZone { DateTime = endDateTimePicker.Value.ToString("o"), TimeZone = "UTC" }, Body = new ItemBody { ContentType = BodyType.Text, Content = $"Username: { _selectedMailItem.Sender.Name}\nNote: { eventNoteTextBox.Text}\n\nEmail Text: { emailContentTextBox.Text}" } }; await _graphClient.Users[UtilityAccountUsername].Calendars[calendarId].Events.PostAsync(newEvent).ConfigureAwait(false); MessageBox.Show("Outage event has been added to the shared calendar."); ((Form)this.TopLevelControl).Close(); } else { MessageBox.Show("Error: Unable to add the outage event. Please try again."); } } private void cancelBtn_Click(object sender, EventArgs e) { ((Form)this.TopLevelControl).Close(); } } } </C#> In detail, please take me through how to register this application in Azure Active Directory and how to find the missing variables (YOUR_APP_REGISTRATION_ID, YOUR_TENANT_ID, PASSWORD, and OUTAGE-CALENDAR-ID). Additionally, please note any additional tasks which may need to be performed within the Azure tenancy or code necessary to allow it to run.
35dd2045f8428c0c7890412eb8d836b0
{ "intermediate": 0.4145398437976837, "beginner": 0.36611104011535645, "expert": 0.21934916079044342 }
2,903
implement Strike, Block and Flex cards from Slay The Spire into Javascript classes
fd7cac21ff9d01e9eeb3f0c4b117b523
{ "intermediate": 0.2720761299133301, "beginner": 0.6213498115539551, "expert": 0.10657403618097305 }
2,904
implemente chantments system for Hearthstone card in Javascript
e74d1c88a68343dc6e3d0c5864ee4eb6
{ "intermediate": 0.37826958298683167, "beginner": 0.2905998229980469, "expert": 0.3311305642127991 }
2,905
implement echantments system for Hearthstone card in Javascript. When a echantment added or removes from card, refresh card. Possible enchantments: 1) Add +1 attack until the end of turn 2) +1 attack / +1 health 3) -2 cost
cec908ed9a95680b617e4b87edfe4247
{ "intermediate": 0.40279850363731384, "beginner": 0.276922345161438, "expert": 0.32027915120124817 }
2,906
fix the following matlab code to use the gipps model using the following ODE defentions: █(&v_n (t+τ)=min{v_n (t)+2.5a_n τ(1-v_n (t)/V_n ) (0.025+v_n (t)/V_n )^(1/2),┤@&├ b_n τ+√(b_n^2 τ^2-b_n [2[x_(n-1) (t)-s_(n-1)-x_n (t)]-v_n (t)τ-v_(n-1) (t)^2/b ̂ ] )}@&) Also use X instead of * to represent multiplication : % Define simulation parameters dt = 0.01; % Time interval T = 30; % Total simulation time time = 0:dt:T; % Time vector % Define initial conditions N_cars = 10; % Number of cars v0 = 120 / 3.6; % Desired speed in m/s s0 = 2; % Minimum gap between cars in m T = 1.5; % Safe time headway a = 0.3; % Maximum acceleration in m/s^2 b = 2; % Comfortable braking deceleration in m/s^2 L = [4.5, 5, 4.5, 5, 4.5, 5, 4.5, 5, 4.5, 5]; % Car length vector W = [2, 2.2, 2, 2.2, 2, 2.2, 2, 2.2, 2, 2.2]; % Car width vector x = cumsum([0, 10*ones(1,N_cars-1)]); % Car positions v = v0*ones(1,N_cars); % Car speeds acc = zeros(1,N_cars); % Car accelerations dist = zeros(1,N_cars); % Car distances colors=hsv(N_cars) % Run simulation for i = 2:length(time) % Update positions x = x + v*dt + 0.5*acc*dt^2; % Update speeds for j = 1:N_cars % Calculate distance to lead car if j < N_cars dist(j) = x(j+1) - x(j) - L(j) - L(j+1); else dist(j) = 1e10; % Assume no car ahead of last car end % Calculate IDM acceleration acc(j) = IDM(acc(j), dist(j), v(j), v0, s0, T, a, b); end v = v + acc*dt; % Animate results clf; hold on; for j = 1:N_cars rectangle('Position',[x(j)-L(j)/2,(j-1)*2,L(j),2],'FaceColor',colors(j,:),'Curvature',j/N_cars); end xlim([0, max(x)+50]); ylim([0, sum(W)]); xlabel('Distance (m)'); ylabel('Lane width (m)'); title(sprintf('Time = %0.1f s', time(i))); drawnow; end % Define IDM function function acc = IDM(acc, dist, v, v0, s0, T, a, b) acc = a*(1 - (v/v0)^4 - (s0 + v*T - sqrt((s0 + v*T)^2 - 4*v*(v-dist)/(2*b)))/dist^2); acc = max(acc, -b); % Limit braking acceleration end
847ca8bdf01aa5a97282e18a58d032dc
{ "intermediate": 0.29843783378601074, "beginner": 0.43966078758239746, "expert": 0.2619014382362366 }
2,907
give me idea how to write lite Heartstone version in Javascript
b0df10351f3aede4a911fe8def038b2b
{ "intermediate": 0.4445364773273468, "beginner": 0.25990912318229675, "expert": 0.29555439949035645 }
2,908
Write code for several cards for a card game with abilities in Javascript.
3f6806518dac959ee02af996c06c2513
{ "intermediate": 0.32669588923454285, "beginner": 0.4224870204925537, "expert": 0.25081709027290344 }