Sunday, August 29, 2021

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow


I am unable to plot graph in colab .its showing error. Plot _history

Posted: 29 Aug 2021 08:10 AM PDT

Rails: Rendering video uploaded by paperclip

Posted: 29 Aug 2021 08:10 AM PDT

I am using Rails 6.1 + Ruby 3 and trying to allow users to upload videos and then watch them in app.

clip.rb

class Clip < ApplicationRecord      belongs_to :chapter      has_attached_file :video, styles: {          :medium => {            :geometry => "640x480",            :format => 'mp4'          },          :thumb => { :geometry => "160x120", :format => 'jpeg', :time => 10}        }, :processors => [:transcoder]      validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/   end  

show.html.erb

<video autobuffer="autobuffer" autoplay="autoplay" id="hero-video" loop="loop" src="<%=  @clip.video %>"></video>  

I've been uploading this video successfully in RailsAdmin, but when I try to view it, I get this error:

undefined method `escape' for URI:Module

Here is what @clip.video brings back:

=> #<Paperclip::Attachment:0x00007feaaa84f728 @name=:video, @instance=#<Clip id: 5, order: 1, tts: "First up, skating. Need skates? Get fitted for fre...", tts_url: nil, created_at: "2021-08-27 18:20:35.181752000 +0000", updated_at: "2021-08-27 18:48:53.832933000 +0000", chapter_id: 1, video_file_name: "test.mp4", video_file_size: 6707510, video_content_type: "video/mp4", video_updated_at: "2021-08-27 18:48:46.276117000 +0000">, @options={:convert_options=>{}, :default_style=>:original, :default_url=>"/:attachment/:style/missing.png", :escape_url=>true, :restricted_characters=>/[&$+,\/:;=?@<>\[\]\{\}\|\\\^~%# ]/, :filename_cleaner=>nil, :hash_data=>":class/:attachment/:id/:style/:updated_at", :hash_digest=>"SHA1", :interpolator=>Paperclip::Interpolations, :only_process=>[], :path=>":rails_root/public:url", :preserve_files=>false, :processors=>[:transcoder], :source_file_options=>{}, :storage=>:filesystem, :styles=>{:medium=>{:geometry=>"640x480", :format=>"mp4"}, :thumb=>{:geometry=>"160x120", :format=>"jpeg", :time=>10}}, :url=>"/system/:class/:attachment/:id_partition/:style/:filename", :url_generator=>Paperclip::UrlGenerator, :use_default_time_zone=>true, :use_timestamp=>true, :whiny=>true, :validate_media_type=>true, :check_validity_before_processing=>true}, @post_processing=true, @queued_for_delete=[], @queued_for_write={}, @errors={}, @dirty=false, @interpolator=Paperclip::Interpolations, @url_generator=#<Paperclip::UrlGenerator:0x00007feaaa84f638 @attachment=#<Paperclip::Attachment:0x00007feaaa84f728 ...>, @attachment_options={:convert_options=>{}, :default_style=>:original, :default_url=>"/:attachment/:style/missing.png", :escape_url=>true, :restricted_characters=>/[&$+,\/:;=?@<>\[\]\{\}\|\\\^~%# ]/, :filename_cleaner=>nil, :hash_data=>":class/:attachment/:id/:style/:updated_at", :hash_digest=>"SHA1", :interpolator=>Paperclip::Interpolations, :only_process=>[], :path=>":rails_root/public:url", :preserve_files=>false, :processors=>[:transcoder], :source_file_options=>{}, :storage=>:filesystem, :styles=>{:medium=>{:geometry=>"640x480", :format=>"mp4"}, :thumb=>{:geometry=>"160x120", :format=>"jpeg", :time=>10}}, :url=>"/system/:class/:attachment/:id_partition/:style/:filename", :url_generator=>Paperclip::UrlGenerator, :use_default_time_zone=>true, :use_timestamp=>true, :whiny=>true, :validate_media_type=>true, :check_validity_before_processing=>true}>, @source_file_options={}, @whiny=true, @normalized_styles={:medium=>#<Paperclip::Style:0x00007feaaa84c988 @name=:medium, @attachment=#<Paperclip::Attachment:0x00007feaaa84f728 ...>, @geometry="640x480", @format="mp4", @processors=nil, @convert_options=nil, @source_file_options=nil, @other_args={}>, :thumb=>#<Paperclip::Style:0x00007feaaa84c910 @name=:thumb, @attachment=#<Paperclip::Attachment:0x00007feaaa84f728 ...>, @geometry="160x120", @format="jpeg", @processors=nil, @convert_options=nil, @source_file_options=nil, @other_args={:time=>10}>}>  

How can i make text in inputfield persist when navigating to other page?

Posted: 29 Aug 2021 08:10 AM PDT

I am building a multi step form for a user. One of the step is to fill out a form with name, email and number. How can i make it so that when user navigates away from that step, the input text is still there when navigating back to that step again. In other words, how can i make the state persist.

Showing wrong error alert in login page in php

Posted: 29 Aug 2021 08:09 AM PDT

Why is it showing this even if I am entering right username and pass

Incorrect username and/or password!  

I am trying to do is that if someone enter wrong username or pass then show this and if enter right username and pass than show welcome username but not working

<?php  session_start();  include '_dbconnect.php';  // Now we check if the data from the login form was submitted, isset() will check if the data exists.  if ( !isset($_POST['user_name'], $_POST['user_pass']) ) {      // Could not get the data that should have been sent.      exit('Please fill both the username and password fields!');  }  // Prepare our SQL, preparing the SQL statement will prevent SQL injection.  if ($stmt = $conn->prepare('SELECT sno, user_pass FROM `Users` WHERE user_name = ?')) {      // Bind parameters (s = string, i = int, b = blob, etc), in our case the username is a string so we use "s"      $stmt->bind_param('s', $_POST['user_name']);      $stmt->execute();      // Store the result so we can check if the account exists in the database.      $stmt->store_result();  if ($stmt->num_rows > 0) {      $stmt->bind_result($sno, $user_pass);      $stmt->fetch();      // Account exists, now we verify the password.      // Note: remember to use password_hash in your registration file to store the hashed passwords.      if (password_verify($_POST['user_pass'], $user_pass)) {          // Verification success! User has logged-in!          // Create sessions, so we know the user is logged in, they basically act like cookies but remember the data on the server.          session_regenerate_id();          $_SESSION['loggedin'] = TRUE;          $_SESSION['name'] = $_POST['user_name'];          $_SESSION['sno'] = $sno;          echo 'Welcome ' . $_SESSION['name'] . '!';      } else {          // Incorrect password          echo 'Incorrect username and/or password!';      }  } else {      // Incorrect username      echo 'Incorrect username and/or password!';  }        $stmt->close();  }  ?>  

removing array elements containing the certain specified and placing them at last

Posted: 29 Aug 2021 08:09 AM PDT

I have an array generated by a system (downloaded). The order is always random.

I need to remove certain items and place them at last

download_array1 = ["me","father","mother","sister","you","brother","grandfather","grandmother"] download_array2 = ["brother","grandfather","me","grandmother","father","mother","sister","you"] download_array3 = ["you","father","mother","grandmother","sister","me","brother","grandfather",""]

input_always_place_at_last = ["me","you"]

expected output

["father","mother","sister","brother","grandfather","grandmother","me","you"]  ["brother","grandfather","grandmother","father","mother","sister","me","you"]  ["father","mother","grandmother","sister","brother","grandfather","me","you"]  

I have tried with

download_array1.includes(input_always_place_at_last).push(input_always_place_at_last)  

why styling in react native is d/f between andriod and ios?

Posted: 29 Aug 2021 08:09 AM PDT

this is my one and first component of a small app that I was learning on but it displays different outcomes in the android and ios phones can someone explain to me why?

import React from 'react';  import { Text, View, StyleSheet } from 'react-native';  import {TextInput} from "react-native-paper";      export const Focas = () => {    return (      <View style={styles.container}>      <View style={styles.titleContainer}><Text style={styles.title}>What you want to focas on ?</Text>      <TextInput/></View>                  </View>    );  }    const styles = StyleSheet.create({  container:{    flex:1,  },  titleContainer:{    flex:0.5,    padding: 16,    justifyContent: "center",      },    title:{      color:"white",      fontWeight:"bold",      fontSize:24,  }});  

ios displayandroid display

Fix or hide 'styleimagemissing' console warning from Mapbox GL JS

Posted: 29 Aug 2021 08:08 AM PDT

After changing one of the data sources for a Mapbox component, I get these 'styleimagemissing' console warnings alerting that some icons for points of interest are not available. For my purposes it's OK that those icons aren't shown, so I'm wondering if there's a way to avoid getting these warnings from the frontend code, without changing the data sources. Perhaps ignoring points of interest or images/icons?

I've already tried writing some function that's triggered when an image is missing instead of the warning:

map.on('styleimagemissing', () => {  // do something  });  

But this seems to happen after the warning has already been triggered.

Any help much appreciated.

How can I create a new column in df with min value between selected columns? [duplicate]

Posted: 29 Aug 2021 08:10 AM PDT

I have the following df:

data = {          'A':[0,0,1,1,1,1,1,1,1],          'B':[0,0,1,1,0,1,4,1,2],          'C':[0,10,130,1,0,1,4,1,12]         }    df=pd.DataFrame(data)  df["D"]=min(df["A"],df["B"])  print(df)  

I've tried to create a new column - D, with the minimum value from A and B for each row but I'm getting the following error:

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().  

I have an error msg trying to use a slug field that contains an unusual character

Posted: 29 Aug 2021 08:09 AM PDT

My DB, my model and my view are all defined to use unicode characters. The creation of the record is ok and a slug is correctly created with a value as for example corée. The problem raise right after the creation with a NoReverse match error msg. I had a look to the documentation but I don't understand what I'm doing wrong. Thanks for your support.

Model:  class Countrycode(models.Model):      cou_code = models.CharField(          "Country name", max_length=40, primary_key=True)      cou_recblocked = models.BooleanField("Country record blocked")      cou_creator = models.ForeignKey(          User, on_delete=models.PROTECT, related_name='+', verbose_name="Created by")      cou_creationdate = models.DateTimeField("Creation date", auto_now=True)      cou_modifier = models.ForeignKey(          User, on_delete=models.PROTECT, related_name='+', verbose_name="Last modification by")      cou_modified = models.DateTimeField(          "Last modification date", auto_now=True)      slug = models.SlugField(max_length=50, allow_unicode=True)        class Meta:          ordering = ["cou_code"]         def __str__(self):          return self.cou_code        def get_absolute_url(self):          return reverse('countrycode_update', kwargs={'slug': self.slug})    View:  from masterdat.models import Countrycode  #-----------------------  # List view Management  #-----------------------  class CountrycodeListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):      permission_required = 'masterdat.view_countrycode'            model = Countrycode      paginate_by = 10        def get_context_data(self, *args, **kwargs):          context = super().get_context_data(*args, **kwargs)          return context    # Search bar      def get_queryset(self):          result = super(CountrycodeListView, self).get_queryset()            query = self.request.GET.get('q')          if query:              query_list = query.split()              result = result.filter(                  reduce(operator.and_,                      (Q(cou_code__icontains=q) for q in query_list))              )            return result  #-----------------------------------  # Create and Update Views Management  #-----------------------------------  from masterdat.forms import CountrycodeForm    # Create View -----------  class CountrycodeCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView):      permission_required = 'masterdat.add_countrycode'        model = Countrycode      form_class = CountrycodeForm      success_url = reverse_lazy('countrycode_list')        def form_valid(self, form):          form.instance.slug = slugify(form.instance.cou_code, allow_unicode=True)          form.instance.cou_creator = self.request.user          form.instance.cou_modifier = self.request.user          form.save          return super().form_valid(form)    # Update View -----------  class CountrycodeUpdateView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView):      permission_required = 'masterdat.change_countrycode'        model = Countrycode      form_class = CountrycodeForm      success_url = reverse_lazy('countrycode_list')        def form_valid(self, form):          form.instance.cou_modifier = self.request.user          form.save          return super().form_valid(form)  

python web request timeout error (requests.exceptions.ConnectTimeout: HTTPSConnectionPool)

Posted: 29 Aug 2021 08:09 AM PDT

i have wrote a python code take subdomain from file and do a web request i am using get method i set a timeout to 5 seconds, the code work perfect when the request take less than 5 seconds but when the request take more than 5 seconds it shows me an error. the error says requests.exceptions.ConnectTimeout: HTTPSConnectionPool(..,..), i know there is something to do with Exception Handling but i do not know what is it. below the code snippet:

import requests  import time     subdomain = []  with open("test.txt","r") as test:      lines = test.readlines()  count = 0   for i in lines:      count = count +1      subdomain.append(i)    for urls in subdomain:            make_request = requests.get(urls,timeout=5)      print(make_request.status_code)  

wanna merge to new associative array in php

Posted: 29 Aug 2021 08:08 AM PDT

i tried like to merge the array before like this:

<select id="nik" name="nik" onchange="changeValue(this.value)" required="true">      <option value='' disabled='disabled' selected>Pilih</option>          <?php                $query = mysqli_query($conn, "SELECT * FROM datapegawai order by nik esc");                  $sql = "SELECT * FROM datapegawai";                  $result = mysqli_query($conn, $sql);                  $nama = "var nama = new Array();\n;";                    while ($row = mysqli_fetch_array($result)) {                          $nama .= "nama['" . $row[nik] . "'] = {nama:'" . addslashes($row[nama])."'};\n";                      echo '<option name="nik" value="'.$row['nik'] . '">' . $row['nik'] . '</option>';                         $data[] = $row;                  }                  $datas = $data;                  $arr = [];                  $dt = count($datas);                  if($dt == 0){                      $n = 0;                      echo 'n = '.$n;                  }else if($dt == 1){                      $n = 0;                      echo 'n = '.$n;                  }else{                      if($dt %2 == 0){                          $half = $dt /2;                          $minhalf = (-$half);                          for($j = -1; $minhalf <= $j; $minhalf++){                              array_push($arr, $minhalf);                          }                            for($i = 1; $i <= $half; $i++){                              array_push($arr, $i);                          }                      }else if($dt % 2 != 0){                          $ttl = $dt / 2;                          $negttl = ceil($ttl);                          $minneg = (-$negttl);                          $posttl = floor($ttl);                                                    for($j = -1; $minneg <= $j; $minneg++){                              array_push($arr, $minneg);                          }                            for($i = 1; $i <= $posttl; $i ++){                              array_push($arr, $i);                          }                      }else{                          echo "ERROR";                      }                  }                  $ximer = array_merge($datas, $arr);                  foreach ($ximer as $key => $value) {                      print_r($value);                      echo "<br>";                  }              ?>           </select>  

but the result like this :

Array ( [0] => 21951 [nik] => 21951 [1] => Andi Marthin [nama] => Andi Marthin )  Array ( [0] => 21952 [nik] => 21952 [1] => Marthin Pandapotan [nama] => Marthin Pandapotan )  Array ( [0] => 21953 [nik] => 21953 [1] => Pandapotan Sitanggang [nama] => Pandapotan Sitanggang )  Array ( [0] => 21954 [nik] => 21954 [1] => Ricardo Situmorang [nama] => Ricardo Situmorang )  Array ( [0] => 21955 [nik] => 21955 [1] => Ucok Baba [nama] => Ucok Baba )  Array ( [0] => 21956 [nik] => 21956 [1] => Michael Arianto [nama] => Michael Arianto )  Array ( [0] => 21957 [nik] => 21957 [1] => William Panjaitan [nama] => William Panjaitan )  -4  -3  -2  -1  1  2  3  

i wanna tried to make like :

Array ( [0] => 21951           [nik] => 21951           [1] => Andi Marthin           [nama] => Andi Marthin =>           [2]=> -4           [xi] => -4)  

or

Array ( [0] => 21951           [nik] => 21951           [1] => -4           [xi] => -4)  

How to stop a Jupyter Notebook loop without losing the data obtained so far

Posted: 29 Aug 2021 08:09 AM PDT

I'm in a similar situation to Stop a python script without losing data.

I am currently using Jupyter Notebook, the notebook is open and running.

I was wondering exactly how to make the answer work for my case. I am not a programmer, so I would need a step by step if at all possible.

The loop that has been running for 2 days is the following:

data = []  for file_origin in onlyfiles:      path_to_text = mypath + '/' + file_origin      data.append(tratamiento_datos(path_to_text))  

I would like to retrieve data, saving whatever I can from the loop.

Hydratating received data using React Node Socket.io

Posted: 29 Aug 2021 08:09 AM PDT

I've learning to use socket.io and I may messed it up somewhere, I ended up with a functionally real time chat app and It's storing the data properly, but I'm trying as last step to add the previous messages when refreshing the page so the conversation can keep even when re-opening the app.

server

io.on("connection", (socket) => {    socket.on("join_room", (roomName) => {      socket.join(roomName);      console.log(`User joined the room ${roomName}`);      // send message history to client      let query = `select * from messageHistory where room = ${roomName} order by created_at;`;      (async () => {        let data = await getPersistedData(query);        socket.to(roomName).emit("hydratate", data);        console.log("event emmited");      })();    });      socket.on("message", (data) => {      socket.to(data.room).emit("messages", data);      // persist data      query = `insert into messageHistory (userName, room, message, created_at) values (        '${data.author}', '${data.room}', '${data.message}', '${dateTimeFormatter()}')`;      storeData(query);    });  });  

client

const [message, setMessage] = useState("");  const [messageHistory, setMessageHistory] = useState([]);    useEffect(() => {      console.log(`roomName: ${roomName}`);      socket.emit("join_room", roomName);    }, [roomName]);     useEffect(() => {      socket.on("messages", (data) => {        console.log(`messagesEvent: ${data}`);        setMessageHistory([...messageHistory, data]);      });      socket.on("hydratate", (data) => {        console.log(`hydratate: ${data}`);        data.forEach((el) => {          setMessageHistory([...messageHistory, el]);        });      });      // avoid message loop:      return () => {        socket.off();      };    }, [messageHistory]);      const submit = (e) => {      e.preventDefault();      let messageContent = {        room: roomName,        author: userName,        message: message,        created_at: getCurrentDate(),      };      socket.emit("message", messageContent);      setMessageHistory([...messageHistory, messageContent]);      setMessage("");    };  

messageHistory is not being fulfilled with the data and can't figure out the reason

How do I update an object in Post Model from the User Model using Mongoose, Node.js and React.js?

Posted: 29 Aug 2021 08:10 AM PDT

I am still on this issue and I have implemented so far what I have seen online, still not working. I have two models named: PostSchema and UserSchema. PostSchema and Userschema both have a field called 'username'. So, I have created action that enables the user to update their profile. The challenge I have now is that the update made by the user which is stored in the UserSchema does not reflect on the PostSchema. For instance, I would like the username on the PostSchema to be updated to the current username on the UserSchema was the user updates or change their name from the UserSchema. I am trying to use the ref and populate features in mongoose. Probably, I am not doing it the right way. With the current codes I have now, the posts are not fetching. If I remove the populate(' username', 'username').exec() line, it will fetch but the post.username will not change to user.username coming from the UserSchoma model.

Here are my codes: I am still new and still learning, kindly help me pass this stage.

UserSchema model

const mongoose = require("mongoose"); //import mongoose     const UserSchema = new mongoose.Schema({        username:{  //I want the username here to update to post model too          type: String,          required: true,          unique: true      },      email:{          type: String,          required: true,          unique: true      },      password:{          type: String,          required: true      },      profilePicture:{          type: String,          default: "",      },   }, {timestamps: true}  );  //exporting this schema  module.exports = mongoose.model("User", UserSchema);  

PostSchema model

  const mongoose = require("mongoose"); //import mongoose    const Schema = mongoose.Schema;     const PostSchema = new mongoose.Schema(   {           title:{          type: String,          required: true,          unique: true      },      description:{          type: String,          required: true,       },      postPhoto:{          type: String,          required:false,      },      username:{ //this should reference user.username          type: Schema.Types.ObjectId, ref: 'User',          required: true,      },      categories:{          type: Array,          required: false                },         }, {timestamps: true}    );   //exporting this schema    module.exports = mongoose.model("Post", PostSchema);   

This is where I am getting the posts

//Get Post   router.get("/:id", async(req, res)=>{   try{      const post = await Post.findById(req.params.id);            populate(' username', 'username').exec()              res.status(200).json(post)     }catch(err){      res.status(500).json(err)   }  })  

This is the client side code with React.js where I called the posts from the api

import { useLocation } from 'react-router';    export default function SinglePost() {  const location = useLocation()  const path = location.pathname.split("/")[2];  const [post, setPost] = useState({});  const [title, setTitle] = useState("")  const [description, setDescription] = useState("");  const [updateMode, setUpdateMode] = useState(false)       useEffect(() => {           const getPost = async () => {         try{          const response = await axios.get("/posts/"+path )          setPost(response.data);          setTitle(response.data.title);          setDescription(response.data.description);          setPostUser(response.data.username)             }catch(err){           }          };          return getPost()  }, [path]);  

How to construct an output which consists an array of objects?

Posted: 29 Aug 2021 08:09 AM PDT

lets say I have a sample data like this,

const questions_chklist =     { credit_broker_checklist:       [ { id: '1', title: 'Are any identified risks to the customer given equal prominence?', question_id: 'wmBHr' }       , { id: '2', title: 'Content has been approved by an authorised individual',            question_id: 'sPYvu' }       , { id: '3', title: 'Does it clearly name your company or the ?',                       question_id: '64bBL' }       ]     , test_checklist_checklist:       [ { id: '1', title: 'new questionn 1',     question_id: '0VsnL' }       , { id: '2', title: 'new question 02',     question_id: 'c9jrW' }       , { id: '3', title: 'New question 03',     question_id: 'fbJON' }       , { id: '4', title: 'new question 412234', question_id: 'AbcDE' }       ]     , new_list_checklist: [ ]     }   

Now I am trying to create an object like this,

{ credit_broker_checklist:     [ { answer: '', comments: '', question_id: 'wmBHr' }     , { answer: '', comments: '', question_id: 'sPYvu' }     , { answer: '', comments: '', question_id: '64bBL' }     ]   , test_checklist_checklist:     [ { answer: '', comments: '', question_id: '0VsnL' }     , { answer: '', comments: '', question_id: 'c9jrW' }     , { answer: '', comments: '', question_id: 'fbJON' }     , { answer: '', comments: '', question_id: 'AbcDE' }     ]   , new_list_checklist: [ ]   }   

Currently , I don't know how to generate an object so I am generating like this,

const questions_chklist =     { credit_broker_checklist:       [ { id: '1', title: 'Are any identified risks to the customer given equal prominence?', question_id: 'wmBHr' }       , { id: '2', title: 'Content has been approved by an authorised individual',            question_id: 'sPYvu' }       , { id: '3', title: 'Does it clearly name your company or the ?',                       question_id: '64bBL' }       ]     , test_checklist_checklist:       [ { id: '1', title: 'new questionn 1',     question_id: '0VsnL' }       , { id: '2', title: 'new question 02',     question_id: 'c9jrW' }       , { id: '3', title: 'New question 03',     question_id: 'fbJON' }       , { id: '4', title: 'new question 412234', question_id: 'AbcDE' }       ]     , new_list_checklist: [ ]     }     let jsonObj = []  for (var key in questions_chklist)    {    if (questions_chklist.hasOwnProperty(key))       {      let option_count = questions_chklist[key].length;      for (let i = 0; i < option_count; i++)        {        let item            = {}         item ["answer"]     = "";        item ["comments"]   = "";        item["question_id"] = questions_chklist[key][i].question_id        jsonObj.push(item);        }      }    }    console.log( jsonObj )
.as-console-wrapper { max-height: 100% !important; top: 0 }

Its simply creating an array of several objects,

[    {      answer: '',      comments: '',      question_id: 'wmBHr'    },    {      answer: '',      comments: '',      question_id: 'sPYvu'    },  ...  ....  

Download calculated Google Spreadsheet

Posted: 29 Aug 2021 08:09 AM PDT

So we have bunch of google sheets with formulas in google drive. How can I download a xlsx file with calculated values from Spreadsheet API? For now I used Drive API to download xlsx file and openpyxl with formulas libraries to calculate spreadsheet formulas. But it's returning error because unable to calculate some specific Google Sheets formulas or something. It needs to be calculated and then downloaded.

Current code snippet which I need to change to work with Sheets api and get calculated values:

import openpyxl  import formulas    file_path = f'{TMP_FILES_DIR}/{TMP_XLSX_FILE_NAME}'  xl_model = formulas.ExcelModel().loads(file_path).finish()  xl_model.calculate()  xl_model.write(dirpath=TMP_FILES_DIR)  wb = openpyxl.load_workbook(filename=file_path)  

And it's giving me errors with some of xlsx files (I can't change original sheets - only read them):

formulas.errors.FormulaError: ('Not a valid formula:\n%s', '=IF(Table2[[#This Row],[Date of shipment (MM/DD/YYYY)]]=$C$276,1,2)')  

Can I use numpy array with dtype=object to share list of arbitrary type across class instances?

Posted: 29 Aug 2021 08:09 AM PDT

Here is what I want to achieve:

I have a class MyData that holds some sort of data.

Now in class A I store a sequence of data with attribute name data_list and type List[MyData].

Suppose MyData instances are data with different type index. Class A is a management class. I need A to hold all the data to implement sampling uniformly from all data.

But some other operations that are type-specific also need to be done. So a base class B and derived class B1,B2... is designed to account for each type of data. An instance of class A have a list of B instances as member, each storing data points with one type. Code that illustrates this: B.data_list = A.data_list[start_index:start_index+offset].

A have methods that returns some of the data, and B have methods that may modify some of the data.

Now here is the problem: I need to pass data by reference, so that any modification by member function of B is also visible from the side of A.

If I use python builtin List to store data, modifications by B won't be visible for A. I did some experiment using np.array(data_list, dtype=object), it seemed to work. But I'm not familiar with such kind of usage and not sure if it works for data of any type, and whether there will be performance concerns, etc.

Any suggestions or alternatives? Thanks!!

Illustrating code:

class A:      def __init__(self, data_list, n_segment):          self.data_list = data_list          data_count = len(data_list)          segment_length=data_count // n_segment          self.segments = [self.data_list[segment_length*i:segment_length*(i+1)] for i in range(n_segment)]          self.Bs = [B(segment) for segment in self.segments]        def __getitem__(self, item):          return self.data_list[item]    class B:      def __init__(self, data_list):          self.data_list = data_list        def modify(self, index, data):          self.data_list[index]=data    A_data_list = [1,2,3,4,5,6,7,8,9]  A_instance = A(A_data_list, n_segment=3)  print(A_instance[0]) # get 1  A_instance.Bs[0].modify(0,2) # modify A[0] to be 2  print(A_instance[0]) # still get 1  

Note that in the above example changing A_data_list to numpy array will solve my problem, but in my case elements in list are objects which cannot be stacked into numpy arrays.

OpenCL : incompatible integer to pointer conversion passing

Posted: 29 Aug 2021 08:08 AM PDT

I wrote the following kernel code, but it gave me the following warning. I have tried different solutions but failed. plz any suggestion would help

`26:48: warning: incompatible integer to pointer conversion passing '__global int' to parameter of type 'int *'              array_dist[i] = Euclidean_distance(X_train[i],  data_point[j]);  

my kernel code:

 inline float Euclidean_distance(int * array_point_A, int * array_point_B) {      float sum = 0.0;        float  w[20] = { 0.0847282, 0.0408621, 0.105036, 0.0619821, 0.0595455, 0.0416739, 0.0181147, 0.00592921,       0.040049, 0.0766054, 0.0441091, 0.0376111, 0.0124285, 0.0733558, 0.0587338, 0.0303001, 0.0579207, 0.0449221,            0.0530462, 0.0530462 };        for (int i = 0; i < 20; ++i) {          float a = array_point_A[i] - array_point_B[i];          float wieghted_distance = w[i] * (a * a);          sum += wieghted_distance;        }      return sqrt(sum);  }        __kernel void KNN_classifier(__global  int * restrict X_train, __global  int * restrict Y_train, __global  int * restrict data_point, int k)  {             float array_dist[4344] = {};      int index_arr[4344] = {};      for (int i = 0; i < 4344; ++i) {           for (int j = 0; j < 20; ++j) {              array_dist[i] = Euclidean_distance(X_train[i],  data_point[j]);              index_arr[i] = i;          }      }          

Configure HTTPS in Spring Boot Apache Camel REST API with keystore having multiple certs using camel-jetty component

Posted: 29 Aug 2021 08:08 AM PDT

I am trying to configure https in my apache camel Spring Boot REST application (using apache-camel v3.11.1, springboot v2.5.3) with keystore having multiple certificates.

Problem:

Application run failed    org.apache.camel.RuntimeCamelException: java.lang.IllegalStateException: KeyStores with multiple certificates are not supported on the base class org.eclipse.jetty.util.ssl.SslContextFactory. (Use org.eclipse.jetty.util.ssl.SslContextFactory$Server or org.eclipse.jetty.util.ssl.SslContextFactory$Client instead)      at org.apache.camel.RuntimeCamelException.wrapRuntimeCamelException(RuntimeCamelException.java:51) ~[camel-api-3.11.1.jar:3.11.1]  

Project setup:

pom.xml: (dependencies only, to show that I am not using spring-boot-web-starter)

    ..      <dependencies>          <dependency>              <groupId>org.springframework.boot</groupId>              <artifactId>spring-boot-starter</artifactId>          </dependency>          <dependency>              <groupId>org.apache.camel.springboot</groupId>              <artifactId>camel-spring-boot-starter</artifactId>          </dependency>          <dependency>              <groupId>org.apache.camel.springboot</groupId>              <artifactId>camel-jetty-starter</artifactId>          </dependency>          ..          ..<!-- all other required dependencies are in place-->          ..      </dependencies>      ..  

application.properties

#camel.component.jetty.keystore=keystore-with-one-certificate.jks # WORKS  camel.component.jetty.keystore=keystore-with-multiple-certificates.jks # DOESN'T WORK  camel.component.jetty.ssl-key-password=password  camel.component.jetty.ssl-password=password    

Rest Route:

        restConfiguration()          .component("jetty")          .scheme("https")          .port("8080");                    rest()          .path("/api")          .get("/{name}")           ..           ..          .to("direct:x");  

Looked at answers in the below posts, but still not able to resolve the exception that I get,

  1. https://stackoverflow.com/a/60598953/6363894,
  2. https://stackoverflow.com/a/55499113/6363894

I know that exception clearly states to use org.eclipse.jetty.util.ssl.SslContextFactory$Server, but I don't understand how/where to use SslContextFactory.Server object.

SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();  sslContextFactory.setKeyStoreResource(findKeyStorePath());  sslContextFactory.setKeyStorePassword("password");  sslContextFactory.setKeyManagerPassword("password");  sslContextFactory.setNeedClientAuth(true);   

Also I've created a bean for sslContextParameters and added that to restConfiguration as below, this time application runs successfully but then when I test, SSL handshake fails.

       restConfiguration()          .component("jetty")          .endpointProperty("sslContextParameters", "#sslContextParameters")          .scheme("https")          .port("8080");      @Bean(name = "sslContextParameters")      public SSLContextParameters setSSLContextParameters() {                    KeyStoreParameters ksp = new KeyStoreParameters();          ksp.setResource("keystore-with-multiple-certificates.jks");          ksp.setPassword("password");            KeyManagersParameters kmp = new KeyManagersParameters();          kmp.setKeyStore(ksp);          kmp.setKeyPassword("password");            SSLContextServerParameters scsp = new SSLContextServerParameters();          scsp.setClientAuthentication("REQUIRE");                    SSLContextParameters scp = new SSLContextParameters();          scp.setServerParameters(scsp);          scp.setKeyManagers(kmp);                    return scp;      }  

Any help on how to configure SslContextFactory.Server object with the restConfigurations() or any other way I can achieve this? I'll update the post, if any more details are required.

How do I resize the console window to a set number of rows and columns?

Posted: 29 Aug 2021 08:08 AM PDT

I'm writing a c++ console program for Windows using the windows.h include.

I've been trying to tailor the console size to fit my program output, but without finding a reliable way to obtain the value for width and height of a "cell" (the character boxes). I've tried both GetConsoleFontSize and GetConsoleScreenBufferInfo + GetDesktopWindow as demonstrated in the code sample below.

    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);        CONSOLE_FONT_INFO font_size;      GetConsoleFontSize(hOut,GetCurrentConsoleFont(hOut, false, &font_size));        CONSOLE_SCREEN_BUFFER_INFO csbi;      GetConsoleScreenBufferInfo(hOut, &csbi);        RECT desktop;      // Get a handle to the desktop window      const HWND hDesktop = GetDesktopWindow();      // Get the size of screen to the variable desktop      GetWindowRect(hDesktop, &desktop);        // Calculate size of one cell in the console, expressed in pixels.      COORD cell;      // Screen width/max number of columns      cell.X = desktop.right/ csbi.dwMaximumWindowSize.X;      // Screen height/max number of rows      cell.Y = desktop.bottom / csbi.dwMaximumWindowSize.Y;            // Change console size      HWND console = GetConsoleWindow();      MoveWindow(console, 0, 0, 10 * cell.X * 2, 10 * cell.Y, TRUE);      MoveWindow(console, 0, 0, 10 * font_size.dwFontSize.X * 2, 10 * font_size.dwFontSize.Y, TRUE);  

Of both attempts I expected a square window able to contain just about 20x10 cells (the height of the cells seem to be 2x the width), with some margin of error on one of the examples given the integer division. However, they both seemed to be approximately 25% too small, apart from the width of the first example with is about 10% too large.

I assume that the font size does not include the spacing between letters and that the dependencies of .dwMaxWindowSize (such as buffer size etc) comes into play, but I can't quite get either method straight.

If anyone has any knowledge of how to obtain the width/height of the cells in pixels reliably I'd be very grateful. Any information regarding what goes into the cells, what affects the return value of either function or other functions I can use to achieve my goal.

Also note that the size is ultimately going to be bigger, but since I wanted to manually count the rows/columns to debug I made it smaller.

what is wrong with my code about making minicalculator

Posted: 29 Aug 2021 08:09 AM PDT

I'm trying to code a simple calculator function that takes two numbers and an operator. The example given to me by the guide I'm following is:

if (stringOperator === '+') {    return num1 + num2;  }  else if (stringOperator === '-') {    return num1 - num2;  }  

However I wanted to try something different and store the operator (not a string) in a variable and calculate the result that way.

function miniCalculator(num1, num2, stringOperator) {    let operator;    if (stringOperator === '+') {      operator = +    }    else if (stringOperator === '-') {      operator = -    }    else if (stringOperator === '*') {      operator = *    }    else if (stringOperator === '/') {      operator = /    }    return Number(num1) operator Number(num2)  }  

For the call miniCalculator(1, 2, "+") the return value would transform from Number(num1) operator Number(num2) into the actual calculation 1 + 2, thus returning 3.

Why does this not work? And how can I make it work?

"Find the access codes" Google Foobar challenge

Posted: 29 Aug 2021 08:09 AM PDT

I am currently working on the google foobar challenge, and was doing this task as follows:

"Write a function answer(l) that takes a list of positive integers l and counts the number of "lucky triples" of (li, lj, lk) where the list indices meet the requirement i < j < k. The length of l is between 2 and 2000 inclusive. The elements of l are between 1 and 999999 inclusive. The answer fits within a signed 32-bit integer. Some of the lists are purposely generated without any access codes to throw off spies, so if no triples are found, return 0. A "lucky triple" is a tuple (x, y, z) where x divides y and y divides z, such as (1, 2, 4). For example, [1, 2, 3, 4, 5, 6] has the triples: [1, 2, 4], [1, 2, 6], [1, 3, 6], making the answer 3 total."

I have wrote an attempt at it, resulting in this code:

def solution(input):      count = 0      tempList = []      for _ in range(len(input)):          value = input.pop()          for item in input:              if value % item == 0 and value >= item:                  tempList.append(item)          combinations = itertools.combinations(tempList,2)          for combination in combinations:              if combination[1] % combination[0] != 0:                  continue              count += 1          tempList = []      return(count)  

This code was passing most test cases except for test case 5, however I have almost exhausted the tests to find out what fringe case was causing this issue, I have tested both test cases I manually wrote, and found a solution that works, and tried to use it with a randomiser to create new test cases and comparing them until I found the issue, I have however not found it yet.

I have originally used a code to display the combinations, but I went for this code because I suspected that the execution speed might've had something to do with it, however I am not sure if that's the issue, because even after minimising the code only one test case was giving me any faults.

I am expecting that I am missing some very silly case, I am mostly concerned in finding what the source of my issues with my code is in this case. Thank you.

Edit: I have been investigating delays, running basic timeit does show my solution is slower, but not siginficantly so. But regardless, I have ran additional delays in the working code, introducing significant enough delay that it should've tripped if that was the case. However it still works, leading me to believe I am missing something else here.

oracle datasource java.sql.SQLException: String index out of range: -1 in spring

Posted: 29 Aug 2021 08:08 AM PDT

I have a spring boot 1.5.22 app and i am trying to connect to oracle 10g with tomcat-jdbc and ojdbc6.
i have the datasource getproperties() function to connect to my db :

DataSource dataSourceProperties()  {       DataSource ds=null;      try {      ds = DataSourceBuilder.create()              .driverClassName("oracle.jdbc.OracleDriver")              .url("jdbc:oracle:thin:@//host:port/DBname")              .username("xxx")              .password("xxx")              .build();      }catch (Exception e) {          System.out.println(e.toString());}  

when the url was with this SID format : jdbc:oracle:thin:@host:port:DBname i got an oracle error : refused:ROR=(code=12505)(EMFI=4) when i changed it to jdbc:oracle:thin:@host:port/DBname i got java.sql.SQLException: String index out of range: -1 and finally this format jdbc:oracle:thin:@//host:port/DBname and still getting java.sql.SQLException: String index out of range: -1

that's how i make call to that function in getConnection function :

public Connection getConnection() throws SQLException      {                      Connection conn=null;              try {                  this.ds=this.dataSourceProperties();                  conn=ds.getConnection();              }catch (SQLException e ) {                  System.out.println(e.toString());                                }              return conn;}  

here are somme error logs :

2021-08-16 18:33:59.926 ERROR 22476 --- [bio-8080-exec-1] o.a.tomcat.jdbc.pool.ConnectionPool      : Unable to create initial connections of pool.    java.sql.SQLException: String index out of range: -1          at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:332) ~[tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) ~[tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:736) [tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:668) [tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483) [tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154) [tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) [tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) [tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) [tomcat-jdbc-8.5.43.jar:na]          at com..web.services.DBConnection.getConnection(DBConnection.java:68)     [classes/:na]  Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1  java.sql.SQLException: String index out of range: -1  Mon Aug 16 18:33:59 CEST 2021  java.lang.NullPointerException  

here are new error logs after modifying the url to the correct format jdbc:oracle:thin://xx:1509/xxx

2021-08-17 11:25:27.368 ERROR 15440 --- [bio-8080-exec-5] o.a.tomcat.jdbc.pool.ConnectionPool      : Unable to create initial connections of pool.    java.sql.SQLException: Connection refused: connect          at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:223) ~[jdbc-oracle-11.2.0.3.jar:na]          at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:100) ~[jdbc-oracle-11.2.0.3.jar:na]          at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:146) ~[jdbc-oracle-11.2.0.3.jar:na]          at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319) ~[tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) ~[tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:736) [tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:668) [tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483) [tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154) [tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) [tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) [tomcat-jdbc-8.5.43.jar:na]          at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) [tomcat-jdbc-8.5.43.jar:na]                        

NuGet dependency files copied in build output directory when targeting .NET Core+ but not copied for .NET Framework

Posted: 29 Aug 2021 08:08 AM PDT

I made a NuGet package, Askaiser.Marionette, that targets .NET Standard 2.0/2.1 and .NET 5.

Two of its dependencies are OpenCvSharp4 and OpenCvSharp4.runtime.win (native OpenCV bindings for Windows x64/x86).

Whenever I consume my package in a .NET Core app or .NET 5 app, any OpenCvSharp4 method works well because in the build output directory there is this runtimes directory that contains the native OpenCV library:

Debug/<netcoreapp3.1>/  ├── <...>  └── runtimes/      ├── unix/<...>      ├── win/<...>      ├── win-x64/native/OpenCvSharpExtern.dll      └── win-x86/native/OpenCvSharpExtern.dll  

However, if my app targets .NET Framework (net461 up to net48), this runtimes directory is missing from the build output directory, resulting in the failure of any OpenCV wrapped method. This is fixed when the consumer app also installs the two OpenCvSharp4 packages.

Why do the consumer app needs to install the OpenCvSharp4 packages to work on .NET Framework? Right now, any person that tries to consume my package on .NET Framework would have to do that. This is not convenient.

If it can help, this is how my generated .nuspec looks like:

<?xml version="1.0" encoding="utf-8"?>  <package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">    <metadata>      <id>Askaiser.Marionette</id>      [...]      <dependencies>        <group targetFramework="net5.0">          <dependency id="OpenCvSharp4" version="4.5.2.20210404" exclude="Build,Analyzers" />          <dependency id="OpenCvSharp4.runtime.win" version="4.5.2.20210404" exclude="Build,Analyzers" />          <dependency id="Tesseract" version="4.1.1" include="All" />          <dependency id="Tesseract.Drawing" version="4.1.1" exclude="Build,Analyzers" />        </group>        <group targetFramework=".NETStandard2.0">          <dependency id="OpenCvSharp4" version="4.5.2.20210404" exclude="Build,Analyzers" />          <dependency id="OpenCvSharp4.runtime.win" version="4.5.2.20210404" exclude="Build,Analyzers" />          <dependency id="System.Text.Json" version="5.0.2" exclude="Build,Analyzers" />          <dependency id="Tesseract" version="4.1.1" include="All" />          <dependency id="Tesseract.Drawing" version="4.1.1" exclude="Build,Analyzers" />        </group>        <group targetFramework=".NETStandard2.1">          <dependency id="OpenCvSharp4" version="4.5.2.20210404" exclude="Build,Analyzers" />          <dependency id="OpenCvSharp4.runtime.win" version="4.5.2.20210404" exclude="Build,Analyzers" />          <dependency id="System.Text.Json" version="5.0.2" exclude="Build,Analyzers" />          <dependency id="Tesseract" version="4.1.1" include="All" />          <dependency id="Tesseract.Drawing" version="4.1.1" exclude="Build,Analyzers" />        </group>      </dependencies>      [...]    </metadata>  </package>  

NPM run * doesn't do anything

Posted: 29 Aug 2021 08:09 AM PDT

I was running an Electron project, and everything worked just fine. But now when I run any of the scripts in my package.json (including npm start), it just escapes a line and doesn't do anything.

command line screenshot

My package.json:

{    "name": "interclip-desktop",    "version": "0.0.7",    "description": "Interclip for desktop",    "repository": "https://github.com/aperta-principium/Interclip-desktop",    "main": "main.js",    "scripts": {      "start": "electron .",      "package-mac": "electron-packager . --overwrite --asar=true --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds",      "package-win": "electron-packager . Interclip --overwrite --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Interclip\"",      "package-linux": "electron-packager . Interclip --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/icon.png --prune=true --out=release-builds",      "win-install": "node installers/windows/createinstaller.js",      "postinstall": "electron-builder install-app-deps",      "build": "electron-builder --linux",      "release": "electron-builder --linux --publish always"    },    "keywords": [      "Desktop",      "Interclip"    ],    "author": "Filip Troníček",    "license": "MIT",    "devDependencies": {      "electron": "^7.1.2",      "electron-builder": "^22.1.0",      "electron-installer-dmg": "^3.0.0",      "electron-packager": "^14.1.1",      "electron-reload": "^1.5.0",      "electron-winstaller": "^4.0.0"    },    "dependencies": {      "axios": "^0.19.0",      "mousetrap": "^1.6.3"    },    "build": {      "appId": "com.aperta-principium.interclip",      "productName": "Interclip",      "mac": {        "category": "public.app-category.utilities"      },      "dmg": {        "icon": false      },      "linux": {        "target": [          "AppImage"        ],        "category": "Utility"      }    }  }  

I tried updating NPM, didn't work. When I tried in different projects, also doesn't work.

Thanks in advance

Yahoo Finance API for BSE & NSE

Posted: 29 Aug 2021 08:09 AM PDT

I have found below API for Yahoo Finance but these does not seem to be working for NSE & BSE.

http://financequotes-api.com/#singlestock

Is anybody using similar API for BSE & NSE ?

Logging basicConfig not creating log file when I run in PyCharm?

Posted: 29 Aug 2021 08:08 AM PDT

When I run below code in terminal its create a log file

import logging   logging.basicConfig(filename='ramexample.log',level=logging.DEBUG)  logging.debug('This message should go to the log file')  logging.info('So should this')  logging.warning('And this, too')  

but when I run the same code (with different filename='ram.log') in PyCharm it's not creating any log file. Why?

import logging   logging.basicConfig(filename='ram.log',level=logging.DEBUG)  logging.debug('This message should go to the log file')  logging.info('So should this')  logging.warning('And this, too')  

What I have to do to create a log file with PyCharm?

Add bottom border line to UI TextField view in SwiftUI / Swift / Objective-C / Xamarin

Posted: 29 Aug 2021 08:09 AM PDT

I would like to keep the border at the bottom part only in UITextField. But I don't know how we can keep it on the bottom side.

Can you please advise me?

Making button go full-width?

Posted: 29 Aug 2021 08:09 AM PDT

I want a button to take up the full width of the column, but having difficulties...

<div class="span9 btn-block">      <button class="btn btn-large btn-block btn-primary" type="button">Block level button</button>  </div>  

How do I make the button as wide as the column?

How do you copy a linked list into another list?

Posted: 29 Aug 2021 08:08 AM PDT

I'm studying data structures and linked lists, but I'm not getting the concept of how to make a copy of a linked list. Can someone explain this, possibly using pseudocode or C code?

No comments:

Post a Comment