Some times I need the document the important decisions in choosing approach or documenting current issue or bugges of framework or app or even future updates to code or new goals! This all things are just private and just for developer, I was using *.txt file for that then I update it to *.md file. But using *.md file is not all what I wanted, for example for having big title we should use # before title, but the sign of # is visible when I want read it and it is kind of annoying. Like this: I have to say i am not looking to make documentation for functions or structs or other things. I just w
I am just curious how fgets() reads input in C. As per syntax, the second argument is maximum characters to be read (n-1). This is some code where I am trying to copy contents of one file to another: void myCopy(char* src, char* dest) { FILE *fp_src; FILE *fp_dest; fp_src=fopen(src, "r"); fp_dest=fopen(dest,"w"); char buff[2]; while(fgets(buff,2,fp_src)) { fputs(buff,fp_dest); } return; } Here max characters to be read = 2-1=1, How does this copies every line of source to destination perfectly? Shouldn't it skip to next line after reading first character itself?
Historical background In discussions about European medieval archery, there is a lot of emphasis on the english longbow, and the physique and training required to field an archer of that caliber. The stereotypical English longbowman must have the strength to draw a 150lb bow, have trained from adolescence as an archer, and even have their very skeleton deformed over time by their dedication to the weapon. Asian communities have their own stereotypes. Because of historical examples and depictions of fat samurai or generals, there is a narrative that if you want to pull a strong bow you must be
I've been using a Telegram Bot to send notifications for a group, and for users. I already know I can get the Chat ID by receiving a message from the user on my bot, using getUpdates. I also know I can get the Group ID using the same method. But what I really need is the following. There are three users in my group. My bot. Me. Another user that didn't send any messages to my bot, so it does not appear on getUpdates. Is it possible to get the ID of this third user? I am the group owner, and also added my bot as Admin. The third user is a normal user.
I'm trying to implement the redis caching in my API for the first time it is a simple fastapi application which is using openweather api to query some weather information and my intention is to cache each json response in the redis server. I'hve made it to work with single key city but with this approach validating query parameters not working with the error handling I put in the place. caching.py import sys from datetime import timedelta import json import redis from services.openweather_service import get_report def redis_connect() -> redis.client.Redis: try: client = redis.Redis( host="loca
this error happens to me when I want to do the npm install and it is canceled in the middle of the process, It should be noted that this did not happen before. I already applied many of the suggestions I saw, for example: disable the anti virus, run as administrator, among others. version node :10.13.0 and 10.16.0 (nvm) version angular :8.0.0 error console PowerShell my dependencies project "dependencies": { "@agm/core": "^1.0.0-beta.5", "@angular-material-components/datetime-picker": "^2.0.3", "@angular-material-components/moment-adapter": "^2.0.1", "@angular/animations": "^8.0.0", "@angular/
I used gather_facts to get the OS details of each instance that I'm dealing with. For Amazon Linux OS, it just says Amazon 2 or Amazon 2018. Use case: I'm dynamically constructing the file name for a task. The file name is nothing but the name of the OS. When I see the contents of /etc/os-release, it says Amazon Linux only but Ansible facts returns: "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python2.7", "distribution": "Amazon", "distribution_file_parsed": true, "distribution_file_path": "/etc/os-release", "distribution_file_variety": "Amazon", "distribution_major_version":
Para extrair data e hora no pyspark, estou utilizando essa função, pois, já me traz no UTC correto. from pyspark.sql import functions as F df.withColumn('teste',F.current_timestamp()).show() Mas ela me traz data e hora, e gostaria somente da hora, será que tem como manipular, ou existe alguma outra função que me traga somente a Hora,minuto e segundo?
In excel sheet i want to compare the 2 columns. The column names like file_1 and file_2. by using these 2 cols want to create the another col like 'diff' by using excel formula [countifs]. In case , if file_1 and file_2 column records matched it should be 0 (Zero) in diff column otherwise it should be 1. But, i am not as excepted result. Could please help anyone. here is my inputs : file_1 file_2 G G A B C F E H A C H E Output Dataframe : file_1 file_2 diff G G 0 A B 1 C F 1 E H 0 A C 0 H E 0 Sample code : df = pd.read_excel('file1.xlsx') df1 = df[df['file_1'].isin(df['file_2'])] df['diff'] =
I am new to using docker and nginx together so i apologize in advance for my simple question which I am unable to get an answer to despite going through many resources on youtube. I created an ubuntu server and ran the following command sudo apt install nginx Now I have a very simple flask application docker image(publicly available on docker hub and not developed by me) and I want to configure my nginx to work as a reverse proxy to my container running the said image. My code for the reverse proxy in nginx configuration is as follows: server{ listen 80; location / { proxy_pass "http://192.168
I have a little sketch application. We can press down the mouse and paint something. When mousedown and mouseenter event happens to a cell, it change the color. But this combination is somehow similar to drag. Sometime this "little earth" icon appears, and then mouseup event will be swollen. Anyone knows where does this "little earth icon" come from? I've already set the cell.draggable = false. No drag event is fired. Here's my code to reproduce the bug. It's very rare, maybe 1/20 to 1/50 of chance. Click first the create canvas button than you can paint. /* create grids in canvas */ const ini
I write in python but wanted to write something in SQL but there is an error I cannot understand. I cannot see anything wrong in my code. Please help me. spark.sql("create table happiness_perm as select * from happiness_tmp"); %sql select Country, count(*) from happiness_perm group by Country I tried use my data freame df_happiness instead happiness_perm and still I receive this: Error in SQL statement: AnalysisException: Table or view not found: happiness_perm; line 1 pos 30; 'Aggregate ['Country], ['Country, unresolvedalias(count(1), None)] +- 'UnresolvedRelation [happiness_perm], [], false
I was writing an article on the swapcase function of Python's str class and couldn't think of any real-world use case of this function? What's a real-world use case of Python's swapcase function? Has anyone ever used swapcase function in a real-world project?
I am getting these errors during ES logging using fluentd. I'm using fluentd logging on k8s for application logging, we are handling 100M (around 400 tps) and getting this issue. I'm using M6g.2xlarge(8 core and 32 RAM) AWS instances 3 master and 20 data nodes. Under 200 tps everything is working fine after 200 getting these issue. There is a lag in Kibana and data loss on ES. ES version: 7.15.0 fluentd version: 1.12.4 My logging flow: Fluentd > ES > Kibana Error Log: 2022-02-04 00:37:53 +0530 [warn]: #0 failed to flush the buffer. retry_time=3 next_retry_seconds=2022-02-04 00:37:56 +0530 chun
I have a simple import in python code (import matplotlib.pyplot as plt), but I keep getting this error, any idea how to solve it? (Using it on VS Code, on an Apple M1 pro chip). Traceback (most recent call last): File "/Users/mk/Desktop/courses spring 22/EECE 433/assignment 1/code/code.py", line 4, in <module> import matplotlib.pyplot as plt File "/Users/mk/Library/Python/3.8/lib/python/site-packages/matplotlib/__init__.py", line 109, in <module> from . import _api, _version, cbook, docstring, rcsetup File "/Users/mk/Library/Python/3.8/lib/python/site-packages/matplotlib/rcsetup.py", line 27,
I am having a heck of a time getting Cloud Run to work correctly. I am creating a new service from the GCP console with a Cloud Build trigger to my Github repo. Under the security tab, I am setting the service account to one of my service accounts which has the following permissions: Cloud Build Service Account Cloud Run Admin Cloud Run Service Agent Cloud Scheduler Service Agent Service Account User When I create the service, it always ends with the following error: Step #2 - "Deploy": ERROR: (gcloud.run.services.update) PERMISSION_DENIED: Permission 'run.services.get' denied on resource 'nam
So I'm trying to do a POST request with guzzle with multiple files. The user has selected one or more files in a form and hit submit to POST the form. The following code gets run in the controller after that: public function upload(Request $request){ $validator = Validator::make($request->all(), [ 'file-upload' => 'required', 'file-upload.*' => 'file|mimes:mp3,wav,mp4' ]); if ($validator->fails()) { return redirect('/upload-files') ->withErrors($validator) ->withInput(); } $names = []; if($request->hasFile('file-upload')) { foreach ($request->file('file-upload') as $file) { if(file_exists($fil
I'm creating webpack5 setup for an small app and while doing I'm facing the below mentioned issue. Please suggest the way to resolve Issue Snapshot Module not found: Error: Can't resolve 'faker' in 'C:\Gowtham\micro-frontend-training\products\src' resolve 'faker' in 'C:\Gowtham\micro-frontend-training\products\src' Parsed request is a module using description file: C:\Gowtham\micro-frontend-training\products\package.json (relative path: ./src) Field 'browser' doesn't contain a valid alias configuration resolve as module C:\Gowtham\micro-frontend-training\products\src\node_modules doesn't exist
I am developing a frontend using bootstrap 5. I'm using the grid system to make the site responsive overall. There's an issue that I can't really understand with my code. I've set up two rows inside of a container, they work fine in a desktop display, but when I change to a cellphone viewport, one of the rows appears in front of the other: Desktop: Cellphone: Does anyone have an idea of what is going on here? I have added a smaller version of the code, with the second row using a bg-dark to make the problem clearer: li { list-style: none; /* display: inline-block; */ } .window { --items-number
I would need to filter a date column based on two other dates in a dataframe (dataframe is too big and cannot load it and do it as usual in pandas), I used the following snippet of code but I am not able to do it as it throws error: filename = "df.parquet" date_filters = [('current', '>=', 'start'), ('current', '<=', 'end')] df = pd.read_parquet(filename, engine='pyarrow',filters=date_filters) This is the error that I get. ArrowNotImplementedError: Function greater_equal has no kernel matching input types (array[timestamp[us]], scalar[string]) I am wondering if there is another way of doing it
I am using SmtpClient with office365 mailserver to send email. But everytime i try smtpclient.Send(msg),it will throw 'Operation has timed out' smtpexception. I have tried all the earlier options like to change the port to 587 and increase the timeout value but nothing works. Can anyone help me out. Below is my source code. using (MailMessage msg = new MailMessage { From = new MailAddress("[email protected]"), Subject = this.Subject, Body = this.Body, IsBodyHtml = true }) { msg.To.Add(new MailAddress("[email protected]")); using (SmtpClient client = new SmtpClient { Host = "smtp.office
I was trying to get youtube videos transcript but, I don't know why I am getting incomplete transcript from the youtube transcript api. I am using youtube-transcript-api 0.4.3 here is my code from youtube_transcript_api import YouTubeTranscriptApi def Transcript(url): id = url.split('watch?v=') srt = YouTubeTranscriptApi.get_transcript(id[1]) print(srt) # text_list = [] # for i in srt: # text_list.append(i['text']) # text = ' '.join(text_list) # print(text) Transcript('https://www.youtube.com/watch?v=TQMbvJNRpLE') here is the output screen, it is showing incomplete transcript not sure what to
I am using Google cloud managed redis cluster(v5) via redisson(3.12.5) Following are my SingleServer configurations in yaml file singleServerConfig: idleConnectionTimeout: 10000 connectTimeout: 10000 timeout: 3000 retryAttempts: 3 retryInterval: 1500 password: null subscriptionsPerConnection: 5 clientName: null address: "redis://127.0.0.1:6379" subscriptionConnectionMinimumIdleSize: 1 subscriptionConnectionPoolSize: 50 connectionMinimumIdleSize: 40 connectionPoolSize: 250 database: 0 dnsMonitoringInterval: 5000 threads: 0 nettyThreads: 0 codec: !<org.redisson.codec.JsonJacksonCodec> {} I am ge
I am wondering what the best practice for the following scenario is: I have an application where a manager using the device authenticates on behalf of a customer. If the customer is banned, what is the best practice for the http status code I return them? When I return a 403 it seems as if the request they made was invalid, it does not convey to the agent the user is banned. In the same sense I do not want to send a 401 unless the credentials used to make the request were invalid. I have read a few answers and the spec and haven't found what I was looking for. I was leaning towards a custom 2X
A plot will be made from these data: library(ggplot2) mtcars %>% gather(-mpg, key = "var", value = "value") %>% ggplot(aes(x = value, y = mpg)) + geom_point() + facet_wrap(~ var, scales = "free") + theme_bw() How can I change the gray color of the titles of the panels for instance panels of am and hp green panels of gear drat disp red panels of vs wt blue panels cyl qsec carb black add a legend green = area red = bat blue = vege black = indus
I try to update this layer from OpenLayers v5.3.0 to v6.12.0 but I get an error: ReferenceError: TileLayer is not defined as if the function was not loaded from the ol library call: <link rel="stylesheet" type="text/css" href="/iliad/bibliotheques_javascript/olv6.12.0/css/ol.css"> <script type="text/javascript" src="/iliad/bibliotheques_javascript/olv6.12.0/build/ol.js" data-url="/iliad/autoconfINRAP.json"></script> the layer code in v5.3.0 var osmLyr = new ol.layer.Tile({ olParams: { crossOrigin: "Anonymous", }, source: new ol.source.OSM(), opacity: 1, name: 'Carte Osm', description: "carte o
How to remove space after prefix icon in TextFormField in flutter? I've already tried isCollapsed = true, isDense = true. And I have set my contentPadding: EdgeInsets.all(0). Using prefix instead of prefixIcon however solves my issue, but there is another problem. Prefix appears only on focus. How to solve my problem? I want to prefix(or prefixIcon) to appear always visible at the beginning. And TextFormField's text must be like continue of the prefix.
I have a variable having following format bundle="chn-pro-X.Y-Z.el8.x86_64" X,Y,Z are numbers having any number of digits Ex: 1.0-2 # X=1 Y=0 Z=2 12.45-9874 # X=12 Y=45 Z=9874 How can I grab X.Y and store it in another variable? EDIT: I wasn't right with my wording, but I want to store X.Y into new variable not individual X & Y's I'm looking to finally have a variable version which has X.Y grabbed from bundle: version="X.Y"
I am right now developing a Web App for Samsung Tizen TVs. My setup is as follows: Samsung Tizen Studio 4.5.1 Samsung Tizen Smart TV GQ75Q95TGTXZG The TV can be connected to the PC via the Samsung Device Manager just fine as long as the Developer Mode is enabled on the TV. I can then run my app directly on the TV by running it from within Tizen Studio. However I'd like to get the app on my TV more permanently. In the Device Manager I have clicked the "Install App" menu entry in the context menu of my TV. Then, nothing happens. No error message, but also I cannot find the app on the TV. I have
I'm trying to make my code more clean. My function seems rather oblique to do a simple find/replace. Is there a cleaner way to do this find/replace array function with awk or something similar? # Finds first item in array that matches find item, and replaces it with 1 or more array elements. # Preserves sort order of original array. find_replace_in_list(){ # $1 = list # $2 = find item string # $3 = replace array. local -n _list=$1 local -n _replace_list=$3 for i in "${!_list[@]}"; do # Iterate over indices. if [ ${_list[$i]} == "$2" ]; then # Insert the replace array starting at indice. local