Id stringlengths 5 14 | messages listlengths 2 2 | Language stringclasses 1
value |
|---|---|---|
code-Mix-901 | [
{
"content": "import a nested module `c.py` within `b` within `a` with importlib",
"role": "user"
},
{
"content": "To import a nested module `c.py` within `b` within `a` using `importlib`, you can use the following code:\n\n```python\nimport importlib\n\nmodule_name = \"a.b.c\"\nmodule = importlib.i... | en |
code-Mix-902 | [
{
"content": "I have a list of 30 data frames (each of length 53x3) named arr. Now I have to bind all these dataframes into 1 dataframe along row. So the new length of Data frame will be (53x30=1590).\nHow to do it in Python?\nIn R, I use rbind function.",
"role": "user"
},
{
"content": "In Python, ... | en |
code-Mix-903 | [
{
"content": "I am trying to set loggers for my python code, I want to set the level of the log from the configuration file. But unable to do by me. Here the code is given below, If you noticed that in the given below code can see **logger.setLevel(logging.INFO)**. I don't want to directly mention as a hardcode... | en |
code-Mix-904 | [
{
"content": "How could I remove duplicates two dimension list without changing the order?\n\n```\nlist_j = [[100,2,3,3], [4,98,99,98], [5,99,98,4], [5,99,98,5], [100,99,98,100,100,6]]\n\nlist_pre = [list(set(i)) for i in list_j]\nprint(list_pre)\n\n[[2, 3, 100], [98, 99, 4], [98, 99, 4, 5], [98, 99, 5], [98, 9... | en |
code-Mix-905 | [
{
"content": "I'm subclassing QAbstractItemDelegate. This is my code. Suggestions are welcome:\n\n```\nQWidget *ParmDelegate::createWidget(Parm *p, const QModelIndex &index) const {\n QWidget *w;\n if (index.column() == 0) {\n w = new QLabel(p->getName().c_str());\n } else {\n if (p->isSe... | en |
code-Mix-906 | [
{
"content": "Alright, I'm trying to get arguments to work properly with a small test application. My code is below. I'm not too experienced at C++, so I'm not sure why when I launch test with -print (or --print) it automatically states \"Not a valid option\" and then finishes up.\n\n```\n#include <iostream>\n\... | en |
code-Mix-907 | [
{
"content": "I have a dataset like this:\n\n```\n2019-01-02-03-04-05-06-07-08-09-10-11-12\n2020-01-02-03-04-05-06-07-08-09-10-11-12\n2021-01-02-03-04-05-06-07-08-09-10-11-12\n2022-01-02-03-04-05-06-07-08-09-10-11-12\n2023-01-02-03-04-05-06-07-08-09-10-11-12\n2024-01-02-03-04-05-06-07-08-09-10-11-12\n\n```\n\nA... | en |
code-Mix-908 | [
{
"content": "Imagine a class like this.\n\n```\nclass Foo:\n def __init__(self,y,x):\n self.y = y\n self.x = x\n\n```\n\nThen I have an array\n\n```\nobj_arr = np.zeros((200,200), dtype=object)\n\n```\n\nI want to fill it with full of the class but with the input parameters as the index of the arra... | en |
code-Mix-909 | [
{
"content": "1. I am new to python inheritance, and I met a simple issue just to\nprint out variables.\n2. I have a parent class prints\n\n```\nclass prints:\n def __init__(self):\n self.__name = \"\"\n def getName(self):\n return self.__name\n\nclass A(prints):\n def __init__(self):\n ... | en |
code-Mix-910 | [
{
"content": "Here is the code snippet. The placeholder doesn't appear in the dropdown, is blank before choosing an option.\n\n```\n<nz-select\n nzShowSearch=true\n class=\"preview-dropdown\"\n [(ngModel)]=\"selectedValue\"\n (ngModelChange)=\"browserSelection($event)\... | en |
code-Mix-911 | [
{
"content": "I have to create an application where I'll have to make multiple threads. SoI thought to try making one function and passing it to different threads. Initially I've created two threads and have declared one function to be passed to both of them. All I am trying to do is to pass different integers ... | en |
code-Mix-912 | [
{
"content": "I have a file containing sql commands and I want to execute the commands given in the file and if any command throws any error then ignore the error and execute the next command.\nHere is a sample file:\n\n```\ndrop table department;\ndrop table classroom;\n\ncreate table classroom\n (building ... | en |
code-Mix-913 | [
{
"content": "I think my code has an infinite loop. Can someone tell me where I went wrong?\nThe code is supposed to find the number of valid numbers, with a valid number being a number without a digit repeating. For example, 1212 would be a non-valid number because 1 and 2 repeated.\n\n```\n#include <iostream>... | en |
code-Mix-914 | [
{
"content": "Design a chat application in javascript.",
"role": "user"
},
{
"content": "To design a chat application in JavaScript, you can use various technologies and frameworks such as Node.js, Express.js, Socket.io, and React.js. Here's a high-level overview of how you can approach the design:\... | en |
code-Mix-915 | [
{
"content": "I have a list of dictionary which looks like.\n\n```\n[\n {\n \"deviceId\": \"d61e\",\n \"floor\": \"L1\",\n \"id\": \"l1-topic\"\n },\n {\n \"deviceId\": \"fd00::212:4b00:1957:d197\",\n \"floor\": \"L3\",\n \"id\": \"l3-topic\"\n },\n {\n \"deviceId\": \"fd00::212:4b00:1... | en |
code-Mix-916 | [
{
"content": "read a file from redirected stdin and save to variable `result`",
"role": "user"
},
{
"content": "To read a file from redirected stdin and save it to a variable `result`, you can use the following code snippet in Python:\n\n```python\nimport sys\n\nresult = sys.stdin.read()\n```\n\nThi... | en |
code-Mix-917 | [
{
"content": "How can I convert string values into python variables?\n\nThe setup is the following: I have `variable_names = ['a', 'b', 'c']` and I would like to create for each item in variable\\_name a variable which I can assign a value to (like this `a = 10`, `b = 20`, `c = 30`). I do not want a dictionary.... | en |
code-Mix-918 | [
{
"content": "I want to use a GPU inside a Visual Studio Code docker container to train model with TensorFlow. To build an image for my container I use next Dockerfile:\n\n```\nFROM mcr.microsoft.com/vscode/devcontainers/anaconda:0-3\n\nARG PROJECT_NAME=fire_rec\n\nARG NODE_VERSION=\"none\"\nRUN if [ \"${NODE_V... | en |
code-Mix-919 | [
{
"content": "I have a list with 48 items. I want to randomly pick out 3 of those items, then remove those three items from the list. After that, randomly pick 3 new items. I wish to loop this 16 times until all the items are removed.\n\nI've tried a for loop. But I can't figure out how to remove those specific... | en |
code-Mix-920 | [
{
"content": "I am trying to host a website using django and I installed `fontawesome-free[version=5.15.3]` which I used in my project but when I am trying to run `python manage.py makemigrations` I am getting this error `ImproperlyConfigured: The app label 'fontawesome-free' is not a valid Python identifier.` ... | en |
code-Mix-921 | [
{
"content": "I am learning C++ on my own and was hoping for some feedback on this simple text-to-binary converter. The program runs and I haven't encountered any errors with it yet. Any input is welcome. \n\n```\n#include <iostream>\n#include <string>\n#include <bitset>\n\nusing namespace std;\n\nint main()\n{... | en |
code-Mix-922 | [
{
"content": "I'm trying to make a code that takes tow words from user and store them as arrays and check if the first word's **all** characters are already exists in the second word , if Yes then just output Yes , if NO then output a NO .\nExample :\n\n***input :***\n\nENTER THE FIRST WORD :\n\n> \n> fos\n> \n... | en |
code-Mix-923 | [
{
"content": "I have implemented the Knuth-Morris-Pratt Algorithm in C++ . The implementation seems right however I am encountering a runtime error which I cant seem to figure out . Need Help in that .\n\n```\n#include <iostream>\n#include <cstring>\n#include <string>\n\nusing namespace std;\n\nint* PrefixFunct... | en |
code-Mix-924 | [
{
"content": "I want to insert paragraph or article content and process each word. Below I am trying to get each string and then get occurance of it. Finally I want word with max occurance. I am new to c++. Right now I have inserted statically two strings.\nWhich gives error `expected primary-expression before ... | en |
code-Mix-925 | [
{
"content": "I am trying to translate the following C code, which basically just tries to convert an arbitrary integer value into a character from a pool of characters, into PHP:\n\n```\n#include <cstdint>\n#include <cstring>\n#include <iostream>\n\nuint8_t GetCharacter(uint32_t value) {\n static const char... | en |
code-Mix-926 | [
{
"content": "Env: python 3.8, flask-sqlalchemy, postgres\n\n```\nclass User(db.Model):\n name = db.Column(db.Text)\n birthday = db.Column(db.DateTime)\n\n @classmethod\n def upcoming_birthdays(cls):\n return (cls.query\n .filter(\"??\")\n .all()\n ... | en |
code-Mix-927 | [
{
"content": "I am creating my first Arduino program on the UNO r3. I have played with the Arduino Uno before just with petty example programs, etc. I am using two analog inputs to sense distance using 2 laser sensors with 0-5vdc scaling. These two inputs are 0-5vdc and I have ensured common grounding throughou... | en |
code-Mix-928 | [
{
"content": "Sample code:\n\n```\n#include <iostream>\n#include <string>\n#include <string.h>\n#include <cstdio>\n\nint main(int argc, char ** argv)\n{\n std::string mystring = \"5448495320574f4e5420574f524b\";\n std::cout << mystring << std::endl;\n char buffer[mystring.size()];\n\n memset(buffer,... | en |
code-Mix-929 | [
{
"content": "Spawn a process to run python script `myscript.py` in C++",
"role": "user"
},
{
"content": "To spawn a process to run a Python script `myscript.py` in C++, you can use the `std::system` function from the `<cstdlib>` header. Here is an example code snippet to achieve this:\n\n```cpp\n#i... | en |
code-Mix-930 | [
{
"content": "I am writing a program to check whether a singly linked list is a palindrome or not. I am using the concept of reversing through iteration.\n\nI have inserted 2,3,5,3,2 in the linked list and reversed it based on the thought that if the linked list obtained after reversing is the same as before re... | en |
code-Mix-931 | [
{
"content": "I wrote the following code to get a basic understanding of Valgrind and having a hard time interpreting its output. This probably is not related to Valgrind but more basic C++.\n\n```\n#include <string>\n#include <iostream>\nusing namespace std;\n\nclass Valgrind_testclass\n{\nstd::string * string... | en |
code-Mix-932 | [
{
"content": "I'm working with a 4D list and I'm trying to remove some duplicate inner lists, I have done something, but it's not exactly working, here is my code.\n\n```\nmylist = [[[], [[4, 3], [4, 3]], [[3, 2], [2, 3], [3, 4]]], [[[4, 2], [2, 3]], [[4, 3], [4, 3]], [[3, 2], [2, 3], [3, 4]]]]\n\nfinal_list = ... | en |
code-Mix-933 | [
{
"content": "Im currently writing an menu where you can create, read, update, delete products from a deposit, so my proffesor told me to use .txt file as a \"database\" not really a database but only to store some information. My question is that i searched everywhere how to create a nested list from user inpu... | en |
code-Mix-934 | [
{
"content": "I have two items directory and movies. I need to represent a single directory with particular set of movies (only 4 per dir). Lets say we have 2 directories and 8 movies. 1 directory will contain 4 movies and another will contain 4. Programatically its like 0th directory contains: 0 to 3 movie ID'... | en |
code-Mix-935 | [
{
"content": "I have a long list of NCBI taxonomic ids for organisms and I want to write a script to get their corresponding translation tables. Is there a way to do this through Entrez?\n\n(packages in R, Python etc. would be fine too)",
"role": "user"
},
{
"content": "Yes, you can use the Entrez m... | en |
code-Mix-936 | [
{
"content": "getting the string between 2 '$' characters in '$sin (x)$ is an function of x'",
"role": "user"
},
{
"content": "To get the string between 2 '$' characters in the given text, we need to extract the substring that falls between the first '$' and the second '$'. In this case, the string ... | en |
code-Mix-937 | [
{
"content": "I have a simple question about finding certain word in text.\nI want to find the lines of text which contain only \"dog\" word (not \"doggy\",\"doggo\" etc.) and print them.\nI just want to use the simplest capabilities of Python.\n\n**Note:** this task can't use regex or re library\n\n```\nimport... | en |
code-Mix-938 | [
{
"content": "Consider the following code.\n\n```\n#include <cassert>\n#include <stdexcept>\n#include <vector>\n\nstruct Item {\n Item() : m_enabled(false) {}\n\n void enable()\n {\n m_enabled = true;\n notify_observers(); // can throw\n }\n bool enabled() const {return m_enabled;}\... | en |
code-Mix-939 | [
{
"content": "I want to erase a pointer in the vector but I also want to empty the pointer content so that it does not store an `A` object and delete the pointer \n\n```\n#include <iostream>\n#include <vector>\n\nclass A {\nprivate:\n int a;\n\npublic:\n A(int a): a(a){}\n int getValue(){return a;}\n};\n\nin... | en |
code-Mix-940 | [
{
"content": "I need to use Numpy on EC2 instance that runs Flask with WSGI-py3, which can be accessed over HTTP.\n\nAfter setting up everything needed, I can see the page in the browser. However, later I am installing Numpy using pip3 and now the service breaks with the following error in /var/log/apache2/erro... | en |
code-Mix-941 | [
{
"content": "What i want to do with this program is that I want it to return \"yes\" and \"no\" over and over again by using recursion. Please help! Am I doing something wrong?\n\n```\ndef yes_or_no():\nfor x in (\"yes\",\"no\"):\n try:\n yield x\n except (StopIteration):\n return yes_or_no... | en |
code-Mix-942 | [
{
"content": "I am trying to learn more about concepts. I ran into some problems with circular dependencies between concepts and constrained template functions, and I've reproduced these errors in a simple example.\n\n---\n\nI have a concept, `Printable`, that I want to be satisfied if and only if `operator<<` ... | en |
code-Mix-943 | [
{
"content": "I'm doing Al Sweigarts How to Automate the Boring Stuff, so I'm fairly new at Python. I'm trying to do a simple elif in a while loop but i get a syntax error:\n\n```\nimport sys\n\nwhile True:\n print(\"Type to exit\")\n response = input()\n if response == \"Exit\":\n sys.exit()\n ... | en |
code-Mix-944 | [
{
"content": "Previously today, I asked a question about implementing a Sieve of Eratosthenes with 2D arrays and was told by a few people to use vectors instead. The only problem is I had no idea how to use Vectors in C++.\n\nI have rewritten my program today using a vector instead of a 2D array and it was goin... | en |
code-Mix-945 | [
{
"content": "I'm trying to simply use a vector within one of my classes. When trying to access the vector it tells me that it's undefined (but I've defined it in my header).\n\nI have two classes, Person and Dog. A person can own one or more dogs so I want to add each dog a person owns into an array. This shou... | en |
code-Mix-946 | [
{
"content": "I have data like this\n\n```\nfinalValue [\n { _id: { _id: 'OUTCOME_APPROUVED' }, count: 1 },\n { _id: { _id: 'OUTCOME_SWITCH_INTERFACE' }, count: 5 }\n]\n\n```\n\nI want to spread the inner object and change the keys to **name** and **value** to make final value looks like this\n\n```\n final... | en |
code-Mix-947 | [
{
"content": "I have a char array which I am trying to turn into a char pointer to a string. I believe this involves getting the pointer to the first element of the char array, and adding a null character to the end of the char array. The reason for this is that I am trying to then pass it to a `SimpleMenuItem`... | en |
code-Mix-948 | [
{
"content": "I have written a program that has to print the unique values in an array, but this source code seems not to be working correctly. I hope that someone can help me correct it.\n\n```\n#include <iostream>\nusing namespace std;\n\nbool is_in(double vettore2[], int n, int k) {\n bool isin = true;\n ... | en |
code-Mix-949 | [
{
"content": "I would like to know the best way to determine if the following code is generating memory leaks, as I understand that you have to free the memory when you are done using it, but in the same time this array or pointer to int is out of scope when the function return then it does not matter if I rele... | en |
code-Mix-950 | [
{
"content": "Task\n\nProduce a spiral array.\n\n\n\nA spiral array is a square arrangement of the first N2 natural numbers, where the\n\nnumbers increase sequentially as you go around the edges of the array spiraling inwards.\n\n\n\nFor example, given 5, produce this array:\n\n 0 1 2 3 4\n15... | en |
code-Mix-951 | [
{
"content": "i tried to separate even and odd numbers using vectors from a array ==>\nso i made a function that returns true is number is even and false for if number is odd\nthen i used an if else statement where if the function returns true then it pushbacks the value in a vector and if the function returns ... | en |
code-Mix-952 | [
{
"content": "Here is the question:\n\nCreate a function that takes an array of names and returns an array where only the first letter of each name is capitalized.\n\nexample\n\ncapMe([\"mavis\", \"senaida\", \"letty\"]) ➞ [\"Mavis\", \"Senaida\", \"Letty\"]\n\nAnd the code I wrote to answer this question:\n\n`... | en |
code-Mix-953 | [
{
"content": "I am really new to Open GL and I am trying to build non deprecated code. Now what I can't grasp is VBO. This is all I got so far, can you please explain what I'm supposed to be doing. Also, I have the OpenGL programming guide, so if you can point out some pages to read that would be very helpful a... | en |
code-Mix-954 | [
{
"content": "I decided for fun to try and make a simple program that \"sort of\" simulates blackjack in a dumbed down way. It's basically done, except for the fact that the randomly generated numbers are WAY too large. I don't care about the bias srand/rand has (for now) I just want to get it working properly.... | en |
code-Mix-955 | [
{
"content": "I am trying to write a threaded function that sends system information via Tcp/ip over the local network to another computer. I have been using sockets to achieve this and this has worked out quite allright thus far. But I am now at a point where this usually works but around 30% of the time I get... | en |
code-Mix-956 | [
{
"content": "I have read something like that before but unfortunately, forgot some details.\n\nPlease, explain function memory alignment:\n\n```\nint f(int a = 3, int b = 5) {\n int c = 7;\n\n int *p = &c;\n\n std::cout << \"Pointer value: \" << *p << \"\\tPointer address: \" << p << std::endl;\n ... | en |
code-Mix-957 | [
{
"content": "Create a Django view to handle GET requests for displaying a list of products with the additional requirement of sorting the products based on their prices in ascending order.\nappname/models.py\n\nclass Product(models.Model):\n name = models.CharField(max_length=200)\n description = models.... | en |
code-Mix-958 | [
{
"content": "The following is my implementation of `SleepConditionVariableCS`, `WakeAllConditionVariable`, and the thread creation functions. The problem is that sometimes when I try to create a thread the creating thread gets stuck on `WaitForSingleObject( cv->mut, INFINITE );` in `SleepConditionVariableCS`. ... | en |
code-Mix-959 | [
{
"content": "this program seems be fine but I still getting an erro, some suggestion?\n\nProgram:\n\n```\n#include \"dot.h\"\n#include <cuda.h>\n#include <cuda_runtime.h>\n#include <stdio.h>\n\nint main(int argc, char** argv)\n{\n int *a, *b, *c;\n int *dev_a, *dev_b, *dev_c;\n int size = N * sizeof(i... | en |
code-Mix-960 | [
{
"content": "I have continuous variable that ranges from 0-200k. I need to create bins that are 10k distance apart. For example\n\n```\n[0-10k), [10k-20k), [20k-30k),...\n\n```\n\nAnd label them this way 0,1,2,3....\n\nHowever, using pd.cut I'll have to manually write these large number of bins myself. Is ther... | en |
code-Mix-961 | [
{
"content": "I have a program, where I enter some numbers in a C++ STL list. I want to find the most frequent element of the list. My question is what am I doing the wrong way, since the program does not work as expected?\n\n```\n// List.cpp : Defines the entry point for the console application.\n//\n\n#includ... | en |
code-Mix-962 | [
{
"content": "I am currently learning python and i cant seen to figure out how to get a if - then statement for a dice to work (randomint).\n\nI tried\n\n```\nif roll_dice < 10:\n print (\"dang, you got a low roll, try again\")\nelse:\n roll_dice > 10\n print (\"nice! you got a high roll\")\n roll_dice = 10... | en |
code-Mix-963 | [
{
"content": "How I can get the number of iterations of binary search?\n\nThis is my code: \n\n```\nint main() \n{\n int target = 11;\n int N = 10;\n std::vector<int> index;\n int num;\n\n for (int i = 0; i < N; i++) {\n index.push_back(i);\n }\n\n int counter = 0;\n unsigned int ... | en |
code-Mix-964 | [
{
"content": "thanks to a request, I gathered all the text from a website. I am now facing a new issue;\nAt some times this appears in the text.\n\n```\n<I>Season 2021/2022</I><BR>\n<IMG SRC=\"Excel.gif\" BORDER=\"0\" ALIGN=\"Absmiddle\"> <A HREF=\"mmz4281/2122/I1.csv\">Serie A</A> <FONT SIZE=\"1\">(... | en |
code-Mix-965 | [
{
"content": "In a large C project there are many `struct`s that have other `struct`s, or pointers to them, as fields. I want to create a directed graph to show the dependencies between the \"types\". An example would be\n\n```\ntypedef struct javaStat {\n int idNo;\n struct idIdentList *className;\n s... | en |
code-Mix-966 | [
{
"content": "Given this date format:\n\n```\n\"15.03.2016\"\n\n```\n\nHow to convert it into ISO8601 yyyy-MM-dd.",
"role": "user"
},
{
"content": "To convert the date format \"15.03.2016\" into ISO8601 format (yyyy-MM-dd), you would need to rearrange the date components in the following way:\n\nOri... | en |
code-Mix-967 | [
{
"content": "I want to pass the variadic template parameters (a set of integers) of an derived class to another templated class.\nI can not modify the second class because its part of an libary.\n\nI already figured out how I can store this parameters at compile time (e.g. constant array or integer\\_sequence)... | en |
code-Mix-968 | [
{
"content": "i'm uploading files to azure like so:\n\n```\nwith open(tempfile, \"rb\") as data:\n blob_client.upload_blob(data, blob_type='BlockBlob', length=None, metadata=None)\n\n```\n\nhow can i get a progress indication?\nwhen i try uploading as stream, it only uploads one chunk.\n\ni'm sure i'm doing... | en |
code-Mix-969 | [
{
"content": "I'm using pyodbc and python.\nMy goal is to update a column in the db in order to delete square bracket and a single quote at the beginning. I would like to do it directly with a sql command called by python.\n\nWhat I would like to do in sql is:\n\n```\nUPDATE [dbo].[Artist]\nSET ARTIST = REPLACE... | en |
code-Mix-970 | [
{
"content": "My outputs have too much decimal points. But I want to 2 points float results. Can you help me?\n\nEX: `42.44468745 -> 42.44` \n\n```\ny_pred=ml.predict(x_test)\nprint(y_pred)\n\n```\n\nOutput:\n\n```\n[42.44468745 18.38280575 7.75539511 19.05326276 11.87002186 26.89180941\n 18.97589775 22.012915... | en |
code-Mix-971 | [
{
"content": "this is my c++ program for binary search and for some reason it is not returning the index of the element that I searched\n\n```\n#include <iostream>\n//using namespace std;\n\nstruct array {\n\n int A[10];\n int size;\n int length;\n};\n\nvoid displayArray(struct array arr) {\n std::... | en |
code-Mix-972 | [
{
"content": "I have installed Python extention on VS code. The version that I use on VS code is 3.9. when I try to install openpyxl package on VS code console using code `pip install openpyxl` I get an error:\n\n`bash: /Library/Frameworks/Python.framework/Versions/3.9/bin/pip: No such file or directory`.\n\nI ... | en |
code-Mix-973 | [
{
"content": "I tried writing a function that returns 'True' if the given parameter is a prime number and 'False' otherwise. In a sense, I achieved my goal but I just wanted to know of a better, more pythonic way to do it, here's what I came up with:\n\n```\ndef prime_one_liner(n):\n return True if len([i fo... | en |
code-Mix-974 | [
{
"content": "I was wondering why there is no concept like \"bound member-function pointer\", i.e. a member function pointer that is bound to a specific object and can therefore can be treated like a normal function pointer, e.g.\n\n```cpp\n#include <functional>\n\nstruct Foo {\n void foo() {} \n};\n\nvoid f... | en |
code-Mix-975 | [
{
"content": "I am using python 3.7 and have intalled IPython\n\nI am using ipython shell in django like\n\n```\npython manage.py shell_plus\n\n```\n\nand then\n\n```\n[1]: %load_ext autoreload\n[2]: %autoreload 2\n\n```\n\nand then i am doing\n\n```\n[1]: from boiler.tasks import add\n[2]: add(1,2)\n\"testing\... | en |
code-Mix-976 | [
{
"content": "I am trying to load my matrix so that consecutive numbers will go down the columns using pointer/addressing methods. Currently my program prints the consecutive numbers across the rows. \n\n```\n#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\nint i,j;\nint twodArray[5][5], *twodArrayptr;... | en |
code-Mix-977 | [
{
"content": "I went through the official docs of google cloud but I don't have an idea how to use these to list resources of specific organization by providing the organization id\n\n```\norganizations = CloudResourceManager.Organizations.Search()\nprojects = emptyList()\n\nparentsToList = queueOf(organization... | en |
code-Mix-978 | [
{
"content": "I have been trying to allocate a 2 dimensional array at run time using `malloc` by using the concept of pointers to pointers. This code doesn't show any compilation error but gives a runtime error.\n\n```\n#include<stdio.h>\n#include<stdlib.h>\n\nint ** alpha(void)\n{\n int **x;\n\n x=(int *... | en |
code-Mix-979 | [
{
"content": "Task\n\nWrite a program which counts up from 1, displaying each number as the multiplication of its prime factors.\n\nFor the purpose of this task, 1 (unity) may be shown as itself.\n\n\n\nExample\n\n 2 is prime, so it would be shown as itself.\n\n 6 is not prime; it wo... | en |
code-Mix-980 | [
{
"content": "Task\n\nWrite a program where the program chooses a number between 1 and 10.\n\nA player is then prompted to enter a guess. If the player guesses wrong, then the prompt appears again until the guess is correct.\n\nWhen the player has made a successful guess the computer will issue a \"... | en |
code-Mix-981 | [
{
"content": "Write 2 programs in the same language which count the number of shared subsequences of consecutive elements from 2 given sequences.\n\nFor example, given `\"test\"` and `\"enter\"`, there are 5 shared subsequences of consecutive elements:\n\n```\nt\nt\ne\ne\nte\n\n```\n\nOne possible algorithm con... | en |
code-Mix-982 | [
{
"content": "I'm trying to get this program working, but get odd output. I know a char buffer is not ideal here, but it's for an assignment and not of my own design. Here's my code:\n\n```\n#include <iostream>\n#include <string>\n#include <cstring>\nusing namespace std;\n\n//Place your class definition here\nc... | en |
code-Mix-983 | [
{
"content": "I am trying to implement multi-threading in python3 to read the lines in a particular file and check whether the line matches the given string. This is causing me some confusion. Please help me with this and also let me know if multi-processing used here instead of multiprocessing. Please check th... | en |
code-Mix-984 | [
{
"content": "I have csv file. It does not have column names. I need to append new column at the start of the row. I mean array[0]. I am new to this. Please help me.\n\nThis is the csv file I have\n\n```\n1,100,303,619,figure\n338,162,143,423,text\n85,768,554,39,text\n504,164,24,238,subtitle\n\n```\n\nI just wa... | en |
code-Mix-985 | [
{
"content": "I declared ReLU function like this:\n\n```\ndef relu(x):\n return (x if x > 0 else 0)\n\n```\n\nand an ValueError has occured and its traceback message is\n\n> \n> ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()\n> \n> \n> \n\nBut if I cha... | en |
code-Mix-986 | [
{
"content": "How can I turn a list like:\n\n```\na = [1, 2, 3, 4, 5]\n\n```\n\nto something like:\n\n```\nb = [[1], [2], [3], [4], [5]]\n\n```\n\nI was thinking of using the `map` function, but then what function would I exactly map a to?",
"role": "user"
},
{
"content": "To turn the list `a` into ... | en |
code-Mix-987 | [
{
"content": "I tried to access a data member by a pointer, so I write this code:\n\n```\n#include <iostream>\n#include <string>\n\nusing namespace std;\n\nclass test{\npublic:\n int * returnAdd();\n int getA();\n void setmember(int x);\nprivate:\n int a;\n};\n\nint *test::returnAdd()\n{\n return... | en |
code-Mix-988 | [
{
"content": "Write a program or a script that returns the last Sundays of each month of a given year. The year may be given through any simple input method in your language (command line, std in, etc).\n\nExample of an expected output:\n\n./last_sundays 2013\n2013-01-27\n2013-02-24\n2013-03-31\n2013-04-28\n201... | en |
code-Mix-989 | [
{
"content": "Creating a list of dictionaries in python",
"role": "user"
},
{
"content": "To create a list of dictionaries in Python, you can simply define each dictionary and then add them to a list. Here is an example code snippet:\n\n```python\n# Define dictionaries\ndict1 = {'name': 'Alice', 'ag... | en |
code-Mix-990 | [
{
"content": "I have this list\n\n```\nlist = ['DI', 'CI', 'CS', 'TQ','CE']\n\n```\n\nand a second list containing strings\n\n```\nlist_string = ['dd4/DI/dew', '55t/ft54/CS/rgd/fge', '32g/tt/CE/45/543/g54', '454/533/633/76']\n\n```\n\nI would like to return a list, the same length as list\\_string, with the ele... | en |
code-Mix-991 | [
{
"content": "I have a two digits number (e.g. 29) ) and wish to further reduce it to a single digit. How can I do such in python? Shall I use the function inside the while loop ?\ne.g.\n\n```\n29 -> 11 -> 2\n\n```\n\nresult:\n[29,11,2]\n\n```\nx=input('Input digit: ')\n\nresult=0\n\nbox=[]\n\ndef add_two(x):\n... | en |
code-Mix-992 | [
{
"content": "Why does the following code give me a segmentation fault:\n\n```\n#include<iostream>\n#include<thread>\n#include<vector>\n\nusing namespace std;\n\ndouble f(double a, double b, double* c) {\n *c = a + b;\n}\n\nint main() {\n vector<double> a ={1,2,3,4,5,6,7,8}; \n vector... | en |
code-Mix-993 | [
{
"content": "Below is an extract of the code that I am currently working with (the rest is unrelated to my issue. I am having trouble with the Information combineInfo(information a1) member function. I get an error that it's not declared in the scope. All I want to do is combine the information and set new var... | en |
code-Mix-994 | [
{
"content": "I'm trying to write a few wrappers for the standard `sprintf` function from `cstdio`. However, I'm having some weird behaviour and access violation crashes when running my program. I've simplified the problem and reproduced it on the code below:\n\n```\n#include <string>\n#include <cstdio>\n#inclu... | en |
code-Mix-995 | [
{
"content": "I'm trying to find a way to do a `for` loop, and if the iteration of the `for` loop is more than the timeout, then it break and go to the next iteration.\n\nExample :\n\n```\ntimeout = 60\nfor i in mylist:\n i += 1\n if time > timeout:\n break\n\n```",
"role": "user"
},
{
"co... | en |
code-Mix-996 | [
{
"content": "I was deploying a cloudformation template (pre-build and provided by AWS) and was looking for a way to control the parameters (i.e. update it on regular basis with new parameters). I was wondering if there is a programmatic best practice to manage this?\n\nThanks!",
"role": "user"
},
{
... | en |
code-Mix-997 | [
{
"content": "I am trying to create a `python3` package using `cpack` (cmake). For some reason it is failing with a cryptic message:\n\n```\n+ /usr/lib/rpm/check-buildroot\n+ /usr/lib/rpm/redhat/brp-compress\n+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip\n+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/s... | en |
code-Mix-998 | [
{
"content": "I want to reduce time complexity of my code that solves the following problem.\n\n> \n> The program receives a positive distance d followed by a sequence of n\n> events: An event can be either that a person appeared at some position, or that a person disappeared\n> from some position. After each e... | en |
code-Mix-999 | [
{
"content": "I have an assignment to create a program that asks the user what temperature they want to convert and then convert it, but my if statements are not working.\n\nHere is my code:\n\n```\n#include <stdio.h>\n#include <string.h>\n\nint main(void) {\n//Declare Variables\nfloat ce; //Celcius\nfloat fa; ... | en |
code-Mix-1000 | [
{
"content": "I am facing a problem when there is a double click during monitoring.\"can anyone provide me a code that how to monitor **mouse doubleclick** in python using **pynput**?\"",
"role": "user"
},
{
"content": "To monitor mouse double clicks in Python using the `pynput` library, you can use... | en |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.