Questions tagged [unwrap]
181 questions
2
votes
1 answer
Cipher not initialized for encryption/decryption
When I run this code:
public static byte[] unwrap(PrivateKey privateKey, byte[] wrappedKey) throws Exception {
Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding");
cipher.init(Cipher.UNWRAP_MODE,…

rich
- 18,987
- 11
- 75
- 101
2
votes
0 answers
Issues with np.unwrap() in python. Phaseshifting
I have to plot a set of data which is in a 2-pi periodic box and there are discontinuities because of the periodicity of the values, so I used the numpy function unwrap() for discontinuities in pi or 2*pi, but it doesn't solve my problem.
Below is…

ffalk
- 59
- 4
2
votes
2 answers
Ternary Unwrapping in swift
In swift i'm using this code:
var categories: Results? //Realm dataType
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if let categories = categories, !categories.isEmpty {
…

Bjorn Morrhaye
- 687
- 9
- 30
2
votes
1 answer
swift cast from AnyHashable to enum
I have this playground:
import Foundation
enum WeekDay: Int {
case mon, tues, wed, thurs, fri, sat, sun
}
let wd = WeekDay(rawValue: 0)! // mon
let param = [wd: [1, 2, 3]]
message(dict: param)
func message(dict: [AnyHashable: [Int]?]) {
…

quanguyen
- 1,443
- 3
- 17
- 29
2
votes
1 answer
Why using implicit unwrap or force unwrap letting the app crash at some stage not beneficial?
My point is at some places we know that the variable won't have nil at all but due to some reason we can't instantiate it in the class's init function so we have to make it optional.
I also know that we can use optional binding or guard techniques…

Tony Lin
- 922
- 6
- 25
2
votes
2 answers
Powershell - multiple values in custom object
I've been working on a script which will take IPs/DNSes and create a 2-column output. While it's working inside of powershell, as soon as I try to export to CSV it return system.object. How can I fix it? Here's my code:
function Resolve-IPDNS…

Kamil Procyszyn
- 71
- 1
- 7
2
votes
2 answers
Swift type casting / downcasting
Why does the Sprite Kit Game template project created by Xcode use as!:
if let sceneNode = scene.rootNode as! GameScene? {...}
Wouldn't the following be equally good?
if let sceneNode = scene.rootNode as? GameScene {...}
Note, this isn't the…

Stephenye
- 806
- 6
- 12
2
votes
1 answer
Is there way to use NSParagraphStyle.default.mutableCopy() without force unwraping?
I m trying to get an instance of NSParagraphStyle.default.mutableCopy() but are we sure that mutableCopy() will always contain a value?
var paragraphStyle = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle
Would it possible to do…

raed
- 4,887
- 4
- 30
- 49
2
votes
2 answers
Swift 3 - Generated QR Code UIImage to be attached to email but I get error "found nil while unwrapping an Optional value"
I have the QR Code generator working, it display image to my qrImageView UIImageView.
Now, what I want to do is attach that QR Code image to email. Tried the code specified below but I get an error "found nil while unwrapping an Optional…

TSM
- 1,225
- 1
- 9
- 17
2
votes
2 answers
Efficiently unwrap in multiple dimensions with numpy
Let's assume I have an array of phases (from complex numbers)
A = np.angle(np.random.uniform(-1,1,[10,10,10]) + 1j*np.random.uniform(-1,1,[10,10,10]))
I would now like to unwrap this array in ALL dimensions. In the above 3D case I would…

Ethunxxx
- 1,229
- 4
- 16
- 34
2
votes
2 answers
OR condition for optional binding?
I've seen in Swift 3.1 documentation that you can include several optional bindings in an if statement separated by commas, and that it behaves like an AND operator.
Let's say that I have two optional properties and I'd like to check which of them…

AppsDev
- 12,319
- 23
- 93
- 186
2
votes
1 answer
Race in std::future::unwrap() and std::future::get()
A followup with reference to the upcoming feature in C++20 from n3721 "Improvements to std::future and related APIs"
#include
#include
#include
using std::cout;
using std::endl;
int main() {
auto prom_one =…

Curious
- 20,870
- 8
- 61
- 146
2
votes
1 answer
Jquery: Converting Tables into ls
Just looking to converting this with jQuery because I need to style a system that is generated by another company:
Welcome | …