Questions tagged [unwrap]

181 questions
2
votes
2 answers

Unwrapping creates barrier for Value types

Looking at the following code (playground ready). I'm unable to append data to an unwrapped optional array from within an if let statement. What's the best method to allow appending for an optional array? class ValueTypeTest { var data:…
Maxim Veksler
  • 29,272
  • 38
  • 131
  • 151
2
votes
2 answers

Force any task to be attached to parent

I'm trying to create an extension method that will make any task attached to parent. Extension code: internal static class TaskHelpers { public static Task AttachToParrent(this Task task) { var tsc = new…
2
votes
2 answers

Remove specific HTML with jQuery on Tumblr Theme?

I'm trying to mimic the new Tumblr Text Post that removes blockquotes so all the important text is visible in a 250px text post without having to scroll. Of course Tumblr hasn't updated their entire code so blockquotes are still wrapped in custom…
Tash
  • 27
  • 5
2
votes
1 answer

jquery unwrap() sting split issue

I have a function that adds an element to the dom around matching characters. So a user searches "Can" every instance of "Canada" for example turns to CanAda When the user does the next search…
user2390419
  • 41
  • 1
  • 1
  • 7
2
votes
1 answer

Value of optional type 'String?' not unwrapped; did you mean to use '!' or '?'?

I define a class in Swift like that: class RecordedAudio: NSObject { var title: String! var filePathUrl: NSURL! init(title: String, filePathUrl: NSURL) { self.title = title self.filePathUrl = filePathUrl } } After…
Trung Trịnh
  • 49
  • 1
  • 3
  • 11
1
vote
0 answers

Cannot access EntityManager with Hibernate 6.1.3

I am trying get Hibernate session with entityManager.unwrap(Session.class); But it keeps giving error: error: cannot access EntityManager Here is class structure: @Service @AllArgsConstructor @Log4j2 @Transactional(readOnly = true) public class…
Erdel
  • 370
  • 3
  • 16
1
vote
1 answer

Unwrapped optional keeps refreshing / Working with optionals, arrays and randomElement()

I was wondering how you would approach making the following application work: You have an array where you take a random element. You make it multiply with a random number. You have to input the answer and then whether or not you were right you get…
b.joe
  • 69
  • 4
1
vote
1 answer

Why is in Rust the expression in Option.and evaluated, if option is None?

I don't understand, why Option.and() is evaluated, if option is None. The documentation says .... Returns None if the option is None, otherwise it returns optb (the argument of and()). So I would expect, that and() is only (and only then) taken into…
Horowitzathome
  • 359
  • 3
  • 13
1
vote
0 answers

libpnet error: thread 'main' panicked at 'called `Option::unwrap()` on a `None` value' on using tcp_header.set_options()

I recently started to learn Rust and i'm trying out libpnet(github, crates). But after creating the code to build and Ethernet, IP and TCP header I stumbled upon an issue. It seems that adding tcp_header.set_options() results in a panic. thread…
FUBARnl
  • 75
  • 3
  • 7
1
vote
0 answers

How can I solve using incompatible versions of the cygwin DLL

I want to extract DEM from SLC data. But I get this error in Snaphu unwrapping because of Cygwin unmatching. Can anyone tell me any solution please the error is snaphu v2.0.4 27 parameters input from file snaphu.conf (84 lines total) Logging…
1
vote
0 answers

cant unwrap the promise returned by the dispatched thunk

I don't know what I'm missing here
1
vote
0 answers

Is there any way to chain optional assignment unwrapping into if conditional in Flutter, the way it is like Swift?

In Swift, there's a simple language feature to chain unwrapping and checking for non null like this: if let data = functionReturningNullableNumber(), data != 0 { processNum(data) } if let data = functionReturningNullableString(), data != "" {…
Chen Li Yong
  • 5,459
  • 8
  • 58
  • 124
1
vote
0 answers

How to re-wrap phase image

I got several phase images ([-pi,pi]),and these images are interfeogram. I succeed in wrapping unwrapping velocity image by following code from skimage import exposure image= exposure.rescale_intensity(image, out_range=(0,4*np.pi)) image_wrapped =…
1
vote
1 answer

How to use unwrap in this case?

I am actually trying do unwrap a signal and the numpy function don't do what I want. I already searched the web for an answer of course and nothing help me unfortunatly: here is a part of the code: NT can be in the range of 1 to 48. The size of h1…
Cocapy
  • 21
  • 5
1
vote
1 answer

Swift safe unwrapping optional a Class Constant without redundancy

I am trying to get more Structure into my code so I am implementing this UserDefaultsService: class UserDefaultsService { let defaults = UserDefaults(suiteName: UserDefaults.Keys.groupKey) static let shared = UserDefaultsService() …
Chris
  • 1,828
  • 6
  • 40
  • 108