@GeekAndDad@mastodon.social
@GeekAndDad@mastodon.social avatar

GeekAndDad

@GeekAndDad@mastodon.social

The Dad of GeekAndDad, Mac & iPhone programmer, Maker.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

schwa, to random
@schwa@mastodon.social avatar

deleted_by_author

  • Loading...
  • GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @schwa Art!

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @schwa Looks nice and grainy :)

    pixel, to mentalhealth
    @pixel@social.pixels.pizza avatar

    Swift debugging driving me nuts.

    I have a multiline file that I’ve loaded into a string using String(contentsOfFile:encoding:)

    I'm trying to split the string using “someString.components(separatedBy: "==========\n“)

    But it... just doesn’t. I know that particular string does exist in the file multiple times.

    If I change the separator to just a linefeed it does split the file into 1600 items just fine. So for some reason it's not finding the "==========\n“ ?

    I'm stumped.

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @pixel Would “=\n” work?

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @pixel Guessing the equal signs are different Unicode than you are typing into the source.

    Also wondering about a nonbreaking space or something between the = and the newline.

    Only other idea is escaping the “=“ (shouldn’t need to that I’m aware of but ¯_(ツ)_/¯). So:

    “=\n”

    But that seems very weird.

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @pixel What value are you using for encoding:?

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @pixel I was going to recommend looking at it in BBedit :)

    Possible the editor is converting the character (normalizing it or something?) or the clipboard isn’t transferring it without conversion.

    I’d next hexdump the file and look at the bytes.

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @pixel oh doh!

    separatedBy: takes a CharacterSet, not a string constant.

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @pixel oh, no, there’s another definition in the protocol on a generic T. my bad.

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @pixel Using your test file gist pasted into BBEdit doc works for me.

     let s = try String(contentsOfFile: "/Users/dad/Downloads/testfile.txt",  
     encoding: .utf8)  
     let lines = s.components(separatedBy: "=\n")  
     print( "\(lines.count)")  
    

    -> 4

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @pixel In Xcode Version 15.2 because macOS 13.6.6 on this M1 MBP.

    I’m in a macOS SwiftUI app because that was the easiest to do a quick test in for me,
    so import SwiftUI at the top.

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @pixel Just for giggles, try changing to NSString?

    // let s = try NSString(contentsOfFile: "/Users/dad/Downloads/testfile.txt",  
    // encoding: NSUTF8StringEncoding)
    
    and the rest?
    
    GeekAndDad,
    @GeekAndDad@mastodon.social avatar
    bigzaphod, to random
    @bigzaphod@mastodon.social avatar

    You may not like it, but this is what peak performance looks like.

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @bigzaphod There are a number of creative ideas to find something in the middle before ordering a PCB (though that’s getting a lot easier and cheaper according to folks I follow who do it regularly).

    Some examples: https://www.crowdsupply.com/ben-wang/perf-2

    But this is the most amazing one (they’re working on a new version with improvements):

    https://github.com/Architeuthis-Flux/Jumperless

    GeekAndDad, to random
    @GeekAndDad@mastodon.social avatar

    @schwa does the F2 have a film advance override button? Lets you wind the film advance so you can press the shutter again but it disengages the sprockets so the film doesn’t advance. Allows doing double exposures which can be fun :) (see linked post).

    Just another play item for your film camera fun. https://indieweb.social/@alwirtes/109337175618649191

    schwa, to random
    @schwa@mastodon.social avatar

    deleted_by_author

  • Loading...
  • GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @schwa Had to go read what this was and read that it was built in to view cameras since the early days of photography and came to smaller format cameras in the 1960s.

    So now I’m curious if you have a lens for a DSLR you are using or if this is a digital effect.

    Thanks for introducing me to a new-to-me photographic thing!

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @schwa LOL - Looks like you dropped and broke it! that’s indeed “wild” looking.

    Sounds like a fun thing to play with.

    Thanks.

    GeekAndDad, to random
    @GeekAndDad@mastodon.social avatar

    Didn’t read but I sure hope SpaceX / Starlink company is paying for this and not us taxpayers… https://mastodon.online/@mastodonmigration/112457475753592138

    GeekAndDad, to random
    @GeekAndDad@mastodon.social avatar

    Getting desperate to stop Birdbrain from molesting my truck (nearly two months now!).

    Cardboard box and mirror trap on top of a blue truck.

    GeekAndDad, (edited )
    @GeekAndDad@mastodon.social avatar

    @schwa ACME Corp live bird trap for Birdbrain Robin that keeps attacking its reflection in my truck 🤬

    Hanging mirror will hopefully get its impact, pull the fishing line that will pull out the stick and drop the weighted box down on top of it. Then I’ll drive it many miles away to a large park and release this menace.

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @schwa Hahaha

    schwa, to random
    @schwa@mastodon.social avatar

    deleted_by_author

  • Loading...
  • GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @schwa Yah, your profile sums up the response to that.

    Nope.

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @schwa Though, now that I think about it more, NaN seems apropos also :)

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @schwa 😂🤣🤣

    GeekAndDad, to random
    @GeekAndDad@mastodon.social avatar

    Uhg…. Not interested in made up answers. Why are they doing this? https://mastodon.social/@macrumors/112433267752186185

    simonbs, to random
    @simonbs@mastodon.social avatar

    Sorry for all the espresso posts lately! To those here for the coding, Swift, and Apple posts — I pinky-promise more are coming soon 😄

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @simonbs I don’t drink coffee or espresso, but it’s still been fun to see your experiments :)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag3
  • rosin
  • InstantRegret
  • mdbf
  • osvaldo12
  • Durango
  • DreamBathrooms
  • everett
  • magazineikmin
  • thenastyranch
  • ngwrru68w68
  • Youngstown
  • slotface
  • kavyap
  • JUstTest
  • khanakhh
  • Leos
  • cisconetworking
  • tacticalgear
  • modclub
  • GTA5RPClips
  • cubers
  • ethstaker
  • anitta
  • megavids
  • normalnudes
  • tester
  • lostlight
  • All magazines