Sunday, November 28, 2021

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow


Why the file will be garbled after I use the EAS algorithm to encrypt base64

Posted: 28 Nov 2021 06:15 AM PST

I need to implement an encrypted interface to ensure that the returned data is not acquired. I think I can use EAS and RAS to deal with but the result outside I expect.

My achievement is like this:

  1. When the requester needs to use the request parameters to encrypt the EAS encryption, then use RSA to encrypt the EAS key to me.

  2. I use RSA to derypt the EAS key and use EAS derypt again.

  3. I handle the result of the relevant operation and return EAS encryption

Can someone help me?

(My English is not good, I hope you can understand what I mean.)

Thanks~

enter image description here

enter image description here

enter image description here

How do I make a function to print a check in j frame>

Posted: 28 Nov 2021 06:15 AM PST

Following youtube tutorials I have created a mypanel class. I overrided the paint function in the class and called drawRect() and other functions in paint(). What I want to do is to make a function which takes no of boxes as parameter and create a check. Currently I am able to make a check but since the paint() is overrided I am unable to pass number of boxes. Following is the implementation of mypanel class

package com.example;    import javax.swing.*;  import java.awt.*;    public class mypanel extends JPanel {      @Override      public void paint(Graphics g) {          super.paint(g);          int noofchecks=10;          for (int j=0;j<noofchecks;j++)          {          for (int i=0;i<noofchecks;i++){             if(j%2==0)             { if(i%2==0)              {                  g.setColor(Color.white);              }              else{g.setColor(Color.black);}}             else{if(i%2==0)             {                 g.setColor(Color.black);             }             else{g.setColor(Color.white);}}          g.fillRect(5+(i*20),5+(j*20),20,20);}      }}      public void makerect(Graphics g)      {        }  }  

and this is example class calling mypanel class

package com.example;  import javax.swing.*;  import java.awt.*;    public class example extends JFrame {      example()      {            setDefaultCloseOperation(EXIT_ON_CLOSE);          setLocationRelativeTo(null);        }      public void load(int noofchecks)      {int x=(noofchecks*20)+30;          int y=x+30;          setSize(x,y);          mypanel panel=new mypanel();          panel.setBackground(Color.white);          add(panel);        }      public static void main(String[] args)      {              example ex=new example();                      ex.setVisible(true);                      ex.load(10);        }  }  

what I want is a function such as

void printcheck(int size)  

Advice on refactoring (Python)

Posted: 28 Nov 2021 06:15 AM PST

This algorithm parses numbers from a string, any advice on how to split this large functions into smaller functions would be be apreciated. I'm often told that functions shouldn't exceed 10 lines of code but I just don't know how to refactor complex functions into smaller more comprehesible pieces.

def parse_numbers(string_to_parse):       output_array = []      indexes = [-1, -1]      has_decimal = False        string_to_parse += ' '        for i, char in enumerate(string_to_parse):          if '0123456789'.find(char) > -1:               if indexes[0] == -1: indexes[0] = i              else: indexes[1] = i              continue            if (('.'.find(char) > -1) & (not has_decimal) & (indexes[0] != -1)):             has_decimal = True             continue            if indexes[0] != -1:              if indexes[1] != -1: output_array.append(float(string_to_parse[indexes[0]:indexes[1]+1]))              else: output_array.append(float(string_to_parse[indexes[0]]))                    indexes = [-1, -1]          has_decimal = False                return output_array      example_string = 'donotparsethis . 1.1 .1. .123 .. 19.11.12'  print(parse_numbers(example_string))  

Ubuntu 20.04 WIFI

Posted: 28 Nov 2021 06:15 AM PST

I have Ubuntu 20.04.3 LTS , Previously every thing was working but now my WIFI works with my phone's hotspot but do not work with my home WIFI or any other WIFI other than phone's hotspot even ethernet cable also not working , I tried many things but none worked for me problem still persists. home WIFI connects but seems no internet and that same WIFI works on other devices.

And in my Software & Updates --> Additional Drivers : There are no drivers its empty actual message - "No additional drivers available"

So is it Driver problem ? if yes then why its working with phone's hotspot and not with home WIFI ? Please someone help me with this.

Thanks in Advance.

subset () with using a vector

Posted: 28 Nov 2021 06:15 AM PST

I have a dataset in which all countries are identified by a country code. From this dataset, however, I only need the observations from a couple of countries. I saved the country codes of the relevant countries in x. Then I wanted to use subset(), to create a new dataset:

Dset <- subset(Dataset, Dataset$countrycode == x)

which created an inconsistent dataset with the warning: Warning message: "In Dataset$countrycode == x : longer object length is not a multiple of shorter object length"

If I identify each country separately the code works...

Dset <- subset(Dataset, Dataset$countrycode == 40)

Can someone explain the problem to me, as I would like to understand it and offer a solution? Thank you in advance

how do i clear my display after 16 characters?

Posted: 28 Nov 2021 06:14 AM PST

I have a metro mo express the a 16x2 lcd screen. I am using a mpr121 touch capacitance sensor with this unit as well. What i want to happen is when i touch a sensor it displays a letter on the screen. I have this function working but what is need is it to erase the first letter after 16 have printed. so if i print hjketdhetchsudbe and the next letter is g it will erase the h at the beginning and add the g to the end jketdhetchsudbeg. here is my code so far:

#include <LiquidCrystal.h>  #include <Wire.h>  #include "Adafruit_MPR121.h"    #ifndef _BV  #define _BV(bit) (1 << (bit))  

No comments:

Post a Comment