Padding Inside a Floating div | Need Help

I am in the middle of creating a basic, plain jane, old school div layout. But for the life of me, I can't figure out how to get padding in the content area and side menu without the template distorting with extra padding. I've been searching online for hours — and I'm finding 'apparent' solutions, but when I try to implement them, they don't work. I now have a migraine. If anyone has a solution, I'd be rapt to know what it is.

Note: The template isn't complete, per se. I'm just trying…

Padding Inside a Floating div | Need Help

Como hacer un widget InkWell con margin y padding

Estoy creando un ÌnkWell en el que tiene como hijo un Container con valores en margin y padding pero al lanzar la aplicación aparece el error: 'padding == null || padding.isNonNegative': is not true.

final buttonnHome = InkWell(         onTap: () {           Scaffold.of(context).showSnackBar(SnackBar(             content: Text("Navegando"),           ));         },         child: Container(           margin: EdgeInsets.only(top: 300.0),           padding: EdgeInsets.symmetric(horizontal: 32.0),           child: Material(               borderRadius: BorderRadius.all(Radius.circular(30.0)),               child: Container(                 decoration: BoxDecoration(                     borderRadius: BorderRadius.circular(30.0),                     gradient: LinearGradient(                         colors: [Color(0xFF4268D3), Color(0xFF584CD1)],                         begin: FractionalOffset(0.2, 0.0),                         end: FractionalOffset(1.0, 0.6),                         stops: [0.0, 0.6],                         tileMode: TileMode.clamp)),                 child: Center(                   child: Text("Click button"),                 ),               )),         )); 

Padding multi-dimensional array to its max shape

For some machine learning purpose, I need to work with sequences with different lengths. To be able to process efficiently those sequences, I need to process them in batches of size size_batch. A batch typically has 4 dimensions and I want to convert it to a numpy’s ndarray with 4 dimensions. For each sequence, I need to pad with some defined pad_value such that each element has the same size: the maximal size.

For example with 3 dimensional input:

[[[0, 1, 2],   [3],   [4, 5]],  [[6]],  [[7, 8],   [9]]] 

desired output for pad_value -1 is:

[[[0, 1, 2],   [3, -1, -1],   [4, 5, -1]],  [[6, -1, -1],   [-1, -1, -1],   [-1, -1, -1]]  [[7, 8, -1],   [9, -1, -1],   [-1, -1, -1]]] 

which has shape (3, 3, 3). For this problem, one can suppose there are no empty list in the input. Here is the solution I came up with:

import numpy as np import itertools as it from typing import List  def pad(array: List, pad_value: np.int32, dtype: type = np.int32) -> np.ndarray:     """ Pads a nested list to the max shape and fill empty values with pad_value      :param array: high dimensional list to be padded     :param pad_value: value appended to     :param dtype: type of the output     :return: padded copy of param array     """     # Get max shape     def get_max_shape(arr, ax=0, dims=[]):         try:             if ax >= len(dims):                 dims.append(len(arr))             else:                 dims[ax] = max(dims[ax], len(arr))              for i in arr:                 get_max_shape(i, ax+1, dims)         except TypeError:  # On non iterable / lengthless objects (leaves)             pass          return dims      dims = get_max_shape(array)      # Pad values     def get_item(arr, idx):         while True:             i, *idx = idx             arr = arr[i]             if not idx:                 break         return arr      r = np.zeros(dims, dtype=dtype) + pad_value     for idx in it.product(*map(range, dims)):         # idx run though all possible tuple of indices that might          # contain a value in array         try:             r[idx] = get_item(array, idx)         except IndexError:             continue      return r 

It does not feel really pythonic but does the job. Is there any better way to do it I should know ? I think I might be able to improve its speed by doing smart breaks in the last loop but I haven’t dug much yet.

Thanks !

Почему для заголовка h1 у меня не работают margin и padding?


<!DOCTYPE HTML> <html> <head>  <meta charset="UTF-8">     <title> Cooking Food </title>     <link rel="stylesheet" href="css/style.css">      </head> <body>   <header>    <h1>COOKING FOOD </h1>      </header>       <div>   <img src="" alt="Fruits" height="100%">     </div>     </body> </html> 


h1 {     text-align: center;     font-size: 60 px;     font-family: "Raleway";     color: #686868;     font-family:"sans-serif"; } header{     margin-left: 190 px;     padding: 50 px; } 

Set the padding in a cell in SpreadJs which auto resizes correctly

When I set the padding of a cell in SpreadJs, then do an auto resize on the row, the cell shrinks to just what the padding is.

If I set no padding, then the cell auto resizes to a standard size which is what I would like to happen.

I would like the standard size of the cell to have slightly more padding than the default, is this possible but for auto resize to work as the default rather than shrinking the cell?

enter image description here

Padding lists for accurate plotting

I have the following data which is in the form of irregular/non rectangular arrays

list1 = {{1}, {2}, {3}, {4}, {5, 6, 7}, {8, 9, 10}, {11}, {12}} 

To transpose it for plotting, I have to use (because of the irregular shape)

list2 = Flatten[list1, {{2}, {1}}] 

This is now a $ 3\times1$ column. I want to plot this data, So I use the ListLinePlot as

ListLinePlot[list2, DataRange -> {1, 3}, Frame -> True]  

The three rows are plotted as three curves, but the problem is that the upper two curves which correspond to the second and third row of list2 also start from 1 on the x-axis.? Shouldn’t they start from 2 instead of 1? I thought I could use PadLeft or PadRight with empty entries {} to the left or right of the last two (2 element) rows of list2 (to make them 6 element rows, like the first row of list2) to force the two curves to start from 2, but I failed. Could someone tell any workaround?

Is a padding oracle attack possible with randomly generated keys?

In a project we collect data from devices in the field using a hybrid encryption scheme. When a device wants to send data it generates a random AES key (session key) and encrypts the payload with that. Then it uses an RSA public key to encrypt the session key and sends that encrypted session key along with the AES encrypted payload. On the server side we decrypt the session key (as we have the private key there) and then use the decrypted session key to decrypt the payload. The advantage of this is that you don’t need a shared secret between the devices in the field and our server collecting the data.

Now during an audit it came up that we use AES/CBC/PKCS5Padding and that this is vulnerable to a padding oracle attack. From what I understand this attack works by sending manipulated packets to guess the AES key.

Given the scheme I described, I would argue that this attack is not really feasible here as every message has an own AES key and in addition we do not give any message back to the caller even if the packet could not be successfully decrypted.

Is that assumption correct or would we need move away from CBC?