Threads for zain

  1. 3

    I’m going to try to add more examples to https://swiftui.gallery/ – if you’ve dabbled in SwiftUI, please feel free to contribute!

    1. 2

      Trying to finish porting my photo sharing app from UIKit to SwiftUI.

      1. 2

        While I understand the sentiment, I wish we would use languages where it’s not possible to have a state that wasn’t explicitly designed by the programmer. If an input to a function can be null, it should be some kind of nullable type and you should deal with the null case in the function. If it can’t be null, make it a non-nullable type and require the caller to send you a valid value.

        1. 2

          Very few of us can actually wrap our minds around such formal thinking. For better or worse, “Make Computer Do Thing” is still the purpose of our profession, and things making it harder to attain that like the type beauty in Haskell don’t help us enough.

          1. 8

            I strongly disagree with this article. If these big tech companies can figure ways of detecting stage 0-1 cancer, that would go a long way in basically “curing” cancer and I’m pretty sure that’s what Microsoft was claiming they could accomplish by 2026.

            1. 13

              I think this article fails at highlighting its central point, which is unfortunate because the proper concern feels legitimate. I’m going to quote some snippets and then try to reword what I think it’s trying to say.

              But the theory of cancer as a logic problem, rather than an evolving entity in the space and time of ecology, persists.

              But the problem of cancer may even go beyond the cancer cell, its circuitry and shapeshifting tricks. Cancer cells can make ad hoc use of environmental cues. Caloric restriction reduces recurrence, for example, and cytokine IL6 works to block apoptosis, which explains why aspirin can reduce cancer risk.

              Problematically, a shift in understanding cancer as a three-dimensional problem has risen of late, as we are finding that walls, which separate genetic neighborhoods, can break down, resulting in interplay between growth signals and hundreds of genes that turn on cell growth and its energy use. Cancer cells can use various shapeshifting tricks to turn into metastatic forms that travel to other sites in the body, miraculous alterations that can have nothing to do with alterations in the genetic code.

              Basically we’re classifying “cancer” as a singular thing that is around some sort of corruption of the cells causing this massive growth, leading to an idea that cancer as a whole can be attacked with similar things. But in fact “cancer” describes a whole class of processes, and even now we’re finding new vectors for cancer growth that are totally unlike the basic idea of how this stuff works.

              So research is going into solutions around re-engineering cells in specific ways to prevent runaway growth, but cancer ends up working through he coordination of various parts of the ecosystem (” the problem of cancer is ecological”), and attacking the problem at such a microscopic level misses the forest for the trees.

              (I don’t think I fully got the point and I kinda disagree about the relative utility of jumping in front of at least one of he cancer-causing processes)

              1. 13

                One analogy that occured to me is that cancer is a policing problem of cells in a multicellular organism.

                Curing cancer is akin to “solving crime”. Which crime? What causes crime? What causes people to commit crime? What causes cells to go cancerous? What causes cells to flip the table and unilaterally withdraw from the pact that is living in a multicellular organism?

                1. 7

                  This is the best analogy for cancer I’ve ever encountered!

                  Makes me think of this snippet from The Atlantic

                  The reality is, cancer is hundreds of different diseases, and it’s still deeply complex and far from fully understood. So since there’s no clear solution to stopping cancer, therapy is the next best answer, since patients are suffering now.

                  1. 1

                    Agreed, this is a great analogy and I will be stealing it!

                2. 6

                  Detection is different from a cure. Diagnostics has been improving for a long time now but fundamental understanding remains illusive and any cure will require a breakthrough in understanding and not detection or diagnostics.

                  1. 2

                    I mostly agree with you, though I’d argue that detection and diagnostics are necessary in order to achieve understanding

                    1. 2

                      You are right, but early warning can help to increase the survival rates and the quality of life of the patients by applying more targeted, more limited treatements.

                  1. 2

                    Until a couple of months ago, I was kind of looking for something like this to get my son started in programming. I ended up using a Raspberry Pi with a C64 emulator using retropie.

                    I used to think that learning BASIC was the best way to get into programming because that’s how I got into it. Only recently have I realized that learning BASIC worked in the 80s and 90s when technology was just more limited. You would turn on a computer and you would be met with a monochromatic prompt. I remember learning how to use BASIC to change the text color on the screen and it blew my mind and prompted me to keep exploring.

                    I bought the old book that I used when I was in the 5th grade to learn programming (called Basic Fun: Computer Games, Puzzles, and Problems Children Can Write). I remembered it being awesome but a lot of the exercises in there are pretty boring in 2018 :(

                    1. 2

                      They may feel boring in 2018 because our minimum expectation has been raised by modern marketing/entertainment training us over time to have shorter and shorter attention spans.

                    1. 3

                      https://github.com/zainhoda/orbgo

                      Free and open source Tableau alternative that generates Python Pandas code. Still in early stages but I’d love to bounce some ideas around if you know anything about IPython.

                      1. 1

                        If you’d like some feedback: when I first opened the website I tried dragging a couple of things into the big white gap at the bottom of the screen and nothing happened so I got a bit confused. Is it a graphical editor for designing charts?

                      1. 2

                        Microsoft Sculpt Ergonomic Keyboard

                        1. 1

                          Same. The Fn key switch is a bit annoying but most of the Fn functions I use are accessible through alternative combos.

                          When it comes to my overall health and comfort, however, changing to an ergonomic keyboard helped a little but correcting my desk and posture helped a lot.

                          1. 2

                            I prefer the Fn key switch to a Fn button that requires a combo key press

                            1. 1

                              Unfortunately, it seems that many of the things I prefer in the short term (such as combo key presses) wind up hurting my hands in the long term. :-/

                        1. 9

                          totally happy with a Microsoft ergonomic keyboard.

                          1. 4

                            Same here.

                            I’d love to have a fancy mechanical keyboard with lots of option keys etc. but I don’t have endless spare time to research let alone configure something like that.

                            1. 2

                              Same on both counts

                            2. 1

                              The MS Natural 4000 is perfect for me: I went from pain after an hour to no pain no matter how much I type. It’s only $30! Great stuff.

                              I’ve got an ergodox, but getting used to the thumb keys at work but not having it on my laptop at home was just too much to get used to.

                            1. 3

                              No mention of app engine?

                              1. 2

                                Sorry, I should have mentioned that I only reviewed services I used. Due to load balancer upload limits on App Engine I wasn’t able to use App Engine as the application server so I didn’t look into it too deeply. It definitely looks good though.

                                1. 4

                                  If you can make your use-case fit into AppEngine’s constrained data & runtime model then it is absolute nirvana. If you can’t then you’re stuck using something else.

                              1. 0

                                So far I’ve only found one solution that is actually robust. Which is to manually check that the value is not nil before actually using it.

                                This seems reasonable to me. If anything, I’d consider knowing how and when to use this kind of check a part of language competency knowledge as it is how Go was designed.

                                1. 9

                                  We expect people to be competent enough to not crash their cars, but we still put seatbelts in.

                                  That’s perhaps a bad analogy, because most people would say that there are scenarios where you being involved in a car crash wasn’t your fault. (My former driver’s ed teacher would disagree, but that’s another post.) However, the point remains that mistakes happen, and can remain undiscovered for a disturbingly long period of time. Putting it all down to competence is counter to what we’ve learned about what happens with software projects, whether we want it to happen or not.

                                  1. 9

                                    I wish more languages had patterns. Haskell example:

                                    data Named = Named {Name :: Text} deriving Show
                                    
                                    greeting :: Maybe Named -> Text
                                    greeting (Just thing) = "Hello " + (Name thing)
                                    greeting _ = ""
                                    

                                    You still have to implement each pattern, but it’s so much easier, especially since the compiler will warn you when you miss one.

                                    1. 3

                                      Swift does this well with Optionals

                                      1. 5

                                        You can even use an optional type in C++. It’s been a part of the Boost library for a while and was added to the language itself in C++17.

                                        1. 4

                                          You can do anything in C++ but most libraries and people don’t. The point is to make these features integral.

                                          1. 1

                                            It’s in the standard library now so I think it’s integral.

                                            1. 4

                                              If it’s not returned as a rule and not as an exception throughout the standard library it doesn’t matter though. C++, both the stdlib and the wider ecosystem, rely primarily on error handling outside of the type-system, as do many languages with even more integrated Maybe types

                                        2. 2

                                          Yep. Swift has nil, and by default no type can hold a nil. You have to annotate them with ? (or ! if you just don’t care, see below).

                                          var x: Int = nil // error
                                          var x: Int? = nil // ok
                                          

                                          It’s unwrapped with either if let or guard let

                                          if let unwrapped_x = x {
                                              print("x is \(x)") 
                                          } else {
                                              print("x was nil")
                                          }
                                          
                                          guard let unwrapped_x = x else {
                                              print("x was nil")
                                              return
                                          }
                                          

                                          Guard expects that you leave the surrounding block if the check fails.

                                          You can also force the unwraps with !.

                                          let x_str = "3"
                                          let x = Int(x_str)! // would crash at run-time if the conversion wouldn't succeed
                                          

                                          Then there’s implicit unwraps, which are pretty much like Java objects in the sense that if the object is nil when you try to use it, you get a run-time crash.

                                          let x: Int! = nil
                                          
                                      2. 7

                                        Hey, I’m the author of the post. And indeed that does work, which is why I’m doing that currently. However, like I try to explain further in the post this has quite some downsides. The main one is that it can be easily forgotten. The worst part of which is that if you did forget, you will likely find out only by a runtime panic. Which if you have some bad luck will occur in production. The point I try to make is that it would be nice to have this be a compile time failure.

                                        1. 1

                                          Sure, and that point came across. I think you’d agree that language shortcomings - and certainly this one - are generally excused (by the language itself) by what I mentioned?

                                      1. 2

                                        Wow. I was using Atom until I read this post. I had dismissed VSCode because Microsoft but WOW, this is zippy!

                                        1. 2

                                          For too long, finance has been a net consumer of open source.

                                          The nature of finance is such that it’s largely a zero-sum game so cooperation between companies is not the norm.

                                          1. 1

                                            I don’t understand the point you’re making. What does lack of cooperation have to do with companies in the finance space funding OSS projects?

                                            (Asking out of a sincere desire to know, not debating or doubting your claim)

                                          1. 3

                                            Another great example is Autozone. Remember when they had the text consoles where people could very quickly lookup parts. It’s all be replaced by a GUI app now. If you learn all the keyboard shortcuts, it can be close to the original, but most people I just watch click and click and click.

                                              1. 2

                                                I just turned on HTTPS in my App Engine web app – it’s integrated with Let’s Encrypt. It was surprisingly easy compared to the times I’ve used old school CAs.

                                                1. 3

                                                  Creating a simple Go appengine service with datastore as a db for future project. Starting from CRUD, than adding integrations to Slack/Github.

                                                  1. 2

                                                    lmk if you have any questions/issues. The product I’m developing right now uses Go appengine with datastore and an Elm frontend.

                                                    I’m a big fan of the dev_appserver

                                                    1. 1

                                                      dev_appserver

                                                      yeah, dev_appserver is a beast and works like a charm :)

                                                      I had an issue with context.Background(), before I’ve found solution appengine.NewContext(r) (r is a http.Requset).

                                                      And one more: moving away from datastore.Client, ’cause cloud.google.com/go/datastore and google.golang.org/appengine are unequal things.

                                                  1. 4

                                                    Interesting but not really alarming.

                                                    This article is saying that if someone breaks into my house, they can hack the Echo and use it to record my conversations. If someone is going to break into my house to monitor me, I’d be more concerned that they’d hack my router.

                                                    1. 3

                                                      Agreed that this isn’t very concerning. If somebody’s willing to break into my house to get information on me, Alexa is the least of my worries.

                                                      That said, I don’t own an Echo because the prospect of Amazon (or any company) listening in on me is creepy.

                                                    1. 1

                                                      I don’t code in Python but it seems to be that many of these are solutions to the fact that Python is dynamically typed.