Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

10-25-2017 , 10:55 PM
Quote:
Originally Posted by PJo336
Ugh, yes. It honestly feels silly at this point to use a static language for a JSON api. Currently writing one in node and one in scala and its unreal how much more painful it is in scala
Yeah I think back to the first generic java SQL querying interface I wrote, vs ones in scripting languages like tcl or perl. Java wanted to know in advance the type of every column in every query. Scripting languages didn't care, until I wanted to treat a column as something specific.

Quote:
Originally Posted by candybar
What language do you have in mind? I can't think of any mainstream langauge where this is true. Allowing typed collections is not the same thing as disallowing untyped collections.
Well, consider C++. Generally speaking, any templated collection will let you have foo<mytype> but if you want a collection that can hold "anything" you're left with foo<void *> and a lot of extra work - and, it has all the run time exception risks of an untyped language. Or, you can make a BaseType class, and make a foo<BaseType> or foo<BaseType *> and have IntType and StringType and FloatType and ButtType that all extend BaseType just so that you can have a statically typed foo container.

I haven't programmed for a living in Java since 1999 but I seem to recall that most of the built in types would take an "object" as a type (i.e. anything), but, if you wanted to actually execute a function on an object you had to do this dance of "if o is a string, then run o.whatever(), if o is a float, run o.somethingelse()" and so forth.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 05:12 AM
Quote:
Originally Posted by goofyballer
Question for Wolfram or any other Go experts. Here's a code snippet that caused a problem for me today:

Code:
n, addr, err := conn.ReadFrom(buf)
...
if addr != sock.addr {
}
These variables are of the type net.Addr, which is an interface. I assumed this would perform struct-level equality, and I was wrong; it did pointer comparison, and even though the addresses held identical data, it executed the code in the if.

So, uh, what's the right way to do this? This kinda led me down a rabbit hole of how interfaces, despite being the same type on the surface, can hold either a struct (if they did in this case, my code above would have worked as I expected) OR a pointer, and behave differently as a result. In C++ you at least know what type of object you're dealing with (if you have pointers, you can dereference them to compare data equality), and I'm not sure how to deal with this uncertainty in Go.
Have you tried https://golang.org/pkg/reflect/#DeepEqual

I think it works for both pointers and structs.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 09:08 AM
Quote:
Originally Posted by RustyBrooks
Well, consider C++. Generally speaking, any templated collection will let you have foo<mytype> but if you want a collection that can hold "anything" you're left with foo<void *> and a lot of extra work - and, it has all the run time exception risks of an untyped language.
Well that's what you wanted though. It's like the unsafe keyword in Rust - they can't simultaneously let you skip all compile-time typechecks and guarantee runtime safety.

Quote:
if you wanted to actually execute a function on an object you had to do this dance of "if o is a string, then run o.whatever(), if o is a float, run o.somethingelse()" and so forth.
If you want to manually dispatch based on the type, you have to do the same thing in any language. If you're talking about the fact that you have to cast it to the right type before you can call methods that are available for that type, that will often reveal errors of the type you were talking about earlier, which is sort of the point.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 09:48 AM
Quote:
Originally Posted by candybar
One thought I had is that you may have spent too much time in low-trust environments. We've been doing some home renovation and been hiring a bunch of contractors, handy-men and what not for all kinds of stuff and it was interesting to see how people behave in a low-trust environment - most business in that world seems to be one-off without that much in the way of previous relationships - how many times are you going to install central AC or renovate your kitchen - so everyone's somewhat defensive and paranoid, at least compared to the corporate world. It seems to me that spending too much time in that kind of environment will damage your ability to work in a high-trust environment because you come across as excessively cynical and paranoid, not to mention spending a lot of energy guarding yourself against phantom threats is suboptimal in a competitive environment.

Does this make sense at all? It seems to me that a lot of people with no concrete skills (not even great social skills) often get paid 6-figures mostly for their ability to act normally in and thereby sustain a high-trust environment. You seem like the opposite case.
This is a fantastic, well made point.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 10:55 AM
Quote:
Originally Posted by candybar
Well that's what you wanted though. It's like the unsafe keyword in Rust - they can't simultaneously let you skip all compile-time typechecks and guarantee runtime safety.
Right, I'm not saying they're doing it wrong, exactly, just that languages that don't have easy bucket-of-objects ability often lead you to something that is maybe even less safe than a more loosely typed language.

Quote:
If you want to manually dispatch based on the type, you have to do the same thing in any language. If you're talking about the fact that you have to cast it to the right type before you can call methods that are available for that type, that will often reveal errors of the type you were talking about earlier, which is sort of the point.
Yeah that's what I mean. They could all have a "draw" function but I have to make them into their real type before I can call "draw". C++ finally added "auto" in one of the recent updates to the spec, which is nice. This at least partly solves this problem (and ffs it keeps me from having to specify these pointless long iterator type names)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 11:08 AM
Quote:
Originally Posted by Larry Legend
That "Not sure why people put that kind of faith into their employer" is straight crazy talk.

There's no way in hell you can convince me that at my worst sales job with 60 day hard quotas or termination I was anywhere near as risky weighted as working phone customer service and eating fire.

Having 2 low paying jobs isn't a hedge against having 1 decent one.
I'm not sure what the inflection point is, but I'd do the same thing if I was earning $100 / hour. The higher number is a massive opportunity to really make a go of something major and it seems foolish to me to not take advantage of that.

Recently, I was running 3 contracts all paying $50+ / hour. One ended, one is delayed over circumstance, and I changed my mind on another. The lower-paying work is part needed, part not needed.

For example, I was paid $200 for one day this past weekend. I met the person who advised me about being burned out along with some fascinating girl. The changes and the opportunity to explore and see new situations, companies, and people, is interesting to me, and sometimes I'm willing to take a hit in pay to experience and learn more.

Of course, locality helps a lot. Being LA has opened up many more opportunities to find new and interesting contracts, especially relating to programming, music, and other creative things I would never have thought of. LA is also very much a gig-based economy, more so than any other place I've been. I would like to work 7 days a week if I can, and I don't have to earn $400 every day.

Quote:
Originally Posted by candybar
One thought I had is that you may have spent too much time in low-trust environments. We've been doing some home renovation and been hiring a bunch of contractors, handy-men and what not for all kinds of stuff and it was interesting to see how people behave in a low-trust environment - most business in that world seems to be one-off without that much in the way of previous relationships - how many times are you going to install central AC or renovate your kitchen - so everyone's somewhat defensive and paranoid, at least compared to the corporate world. It seems to me that spending too much time in that kind of environment will damage your ability to work in a high-trust environment because you come across as excessively cynical and paranoid, not to mention spending a lot of energy guarding yourself against phantom threats is suboptimal in a competitive environment.

Does this make sense at all? It seems to me that a lot of people with no concrete skills (not even great social skills) often get paid 6-figures mostly for their ability to act normally in and thereby sustain a high-trust environment. You seem like the opposite case.
It makes sense. I'm sorry you had a bad experience with various construction workers, but that's unfortunately the status quo. I don't have a lot of room to talk **** here, but that field is sort of the "out" for your average HS drop out, ex-con, and other types, though to be sure, there are quite a few people who are well-equipped to take on a Blue Chip job earning much more.

What I've found is that older people and non-union workers tend to give the best bang for the buck. A young lifer in the business generally won't work out. A union-person won't work because because they were trained do industrial construction and union workers are trained to not do anything but their little job (which means they won't pick up their own water bottle), plus they are trained to build, not fix or work around mistakes. I never heard of a residential union worker, but the skill-sets for each are very different. The tools, approaches, supplies, and thinking (or lack of) are worlds apart.

Regarding backgrounds, the person who taught me the most had a degree in mechanical engineering and used to work at JPL, but he just decided he'd rather do construction. It's not easy to find these types, but there are quite a few of them out there. They tend to work on higher end housing and charge what appears to be an arm and a leg, but like a good programmer or lawyer, they end up being much higher quality work and materials, yet end up costing about the same as average Joe Plumber at the end of the job.

There is a lot of defensiveness in some situations. I can be difficult to work in a situation where the home owner is staring you down all day because they think you are going to steal from them or break their toilet. Interior designers are the worst people on the planet.

One thing you quickly learn in contracting, no matter the field, is that you have to deal with people who inherently don't trust you. I get this a lot in programming (much more than I experienced in construction, actually), and that's okay since I'm often dealing with people who got harmed by a prior programmer or I'm number 15 in a line of failures. My only approach is saying very upfront what I can do, what I can't do, and showing them that I'm able to do part 1, and that generally diffuses the doubt.

I think that people find clear and straight-forward language refreshing; I don't think this is true in an interview setting. Also interviewing for a contract is talking about the problem at hand and solutions to the problem. This is much easier for me and aligns with my general attitude toward work.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 11:15 AM
Quote:
Originally Posted by Larry Legend
This is a fantastic, well made point.
To be fair, humans are fairly biased against high trust encounters. (For obvious evolutionary biology reasons.) So it isn't like this sort of behavior is common for everyone (obviously its gonna be common among upper-middle class/rich) and considering his underclass upbringing is likely incredibly foreign to him.

Regardless, its just another social norm he needs to understand and comply with. No one speaks like Lebron James in corporate America. And no one has a level of trust like they're living in the projects and criminality is rampant.

NB: Not that I disagree with what cb said in any way, just trying to explain why daveT is struggling with this.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 12:04 PM
so it seems to me that switchMap should almost always be used rather than mergeMap.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 12:08 PM
Speaking of high trust vs. low trust - good news everyone! The Chinese have a solution.

http://www.wired.co.uk/article/chine...ivacy-invasion

Quote:
Imagine a world where many of your daily activities were constantly monitored and evaluated: what you buy at the shops and online; where you are at any given time; who your friends are and how you interact with them; how many hours you spend watching content or playing video games; and what bills and taxes you pay (or not). It's not hard to picture, because most of that already happens, thanks to all those data-collecting behemoths like Google, Facebook and Instagram or health-tracking apps such as Fitbit. But now imagine a system where all these behaviours are rated as either positive or negative and distilled into a single number, according to rules set by the government. That would create your Citizen Score and it would tell everyone whether or not you were trustworthy. Plus, your rating would be publicly ranked against that of the entire population and used to determine your eligibility for a mortgage or a job, where your children can go to school - or even just your chances of getting a date.

A futuristic vision of Big Brother out of control? No, it's already getting underway in China, where the government is developing the Social Credit System (SCS) to rate the trustworthiness of its 1.3 billion citizens. The Chinese government is pitching the system as a desirable way to measure and enhance "trust" nationwide and to build a culture of "sincerity". As the policy states, "It will forge a public opinion environment where keeping trust is glorious. It will strengthen sincerity in government affairs, commercial sincerity, social sincerity and the construction of judicial credibility."
Quote:
Penalties are set to change dramatically when the government system becomes mandatory in 2020. Indeed, on September 25, 2016, the State Council General Office updated its policy entitled "Warning and Punishment Mechanisms for Persons Subject to Enforcement for Trust-Breaking". The overriding principle is simple: "If trust is broken in one place, restrictions are imposed everywhere," the policy document states.

For instance, people with low ratings will have slower internet speeds; restricted access to restaurants, nightclubs or golf courses; and the removal of the right to travel freely abroad with, I quote, "restrictive control on consumption within holiday areas or travel businesses". Scores will influence a person's rental applications, their ability to get insurance or a loan and even social-security benefits. Citizens with low scores will not be hired by certain employers and will be forbidden from obtaining some jobs, including in the civil service, journalism and legal fields, where of course you must be deemed trustworthy. Low-rating citizens will also be restricted when it comes to enrolling themselves or their children in high-paying private schools. I am not fabricating this list of punishments. It's the reality Chinese citizens will face. As the government document states, the social credit system will "allow the trustworthy to roam everywhere under heaven while making it hard for the discredited to take a single step".
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 12:18 PM
Quote:
Originally Posted by RustyBrooks
Right, I'm not saying they're doing it wrong, exactly, just that languages that don't have easy bucket-of-objects ability often lead you to something that is maybe even less safe than a more loosely typed language.
But you don't have to use it everywhere, you just use it for the things you need. I use this type of pattern often in statically typed languages but it's still so much safer because I'm not forced to use this pattern everywhere. And the mistakes like the ones you and LL were talking about are still caught, because there's no need for these things to be untyped. It's like the difference between a zoo and a jungle. Sure there are dangerous wild animals in both places, but one does a much better job of containing them and warning you where appropriate. That you could in theory do stupid things at a zoo and get eaten by a tiger doesn't mean it's just as unsafe and you might as well do without all the fences and so on.

Quote:
C++ finally added "auto" in one of the recent updates to the spec, which is nice. This at least partly solves this problem (and ffs it keeps me from having to specify these pointless long iterator type names)
6 years ago. Practically all modern statically typed languages have similar features - Go, Scala, C#, C++, F#, OCaml, Haskell, etc, etc - Java is the only exception I can think of. Meanwhile I'm still finding 4 year-old bugs in JS that wouldn't even compile in a statically typed language.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 12:37 PM
Quote:
Originally Posted by candybar
6 years ago.
To me, 6 years ago is recent. And actually as someone who writes C++ for windows, osx and various linux flavors, it actually kinda is. OSX in particular has had ancient versions of gcc by default.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 12:44 PM
C++ is also a strange example to use when discussing static typing because it also differs from Pythons of the world on so many other dimensions. You want to compare Python against Go and Ruby against Scala and JavaScript against C# - languages that are at least vaguely similar aside from types.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 12:46 PM
Quote:
Originally Posted by Wolfram
Have you tried https://golang.org/pkg/reflect/#DeepEqual

I think it works for both pointers and structs.
I came across that in my searching yesterday and noticed one case where it fails in my test code (this is from memory but should be right I think):

Code:
type MyInterface interface {
  blah()
}

type MyStruct struct {
  n int
}

func (m *MyStruct) blah() {}

func foo() {
  obj := MyStruct{}
  var a MyInterface = obj
  var b MyInterface = &obj
  fmt.Println("a == b", a == b")
  fmt.Println("DeepEquals(a, b)", reflect.DeepEquals(a, b))
}
Output is false, false, and while in practice this is probably an unlikely situation to come across, it seems like an unfortunate side effect of the fact that an interface can be both a pointer and a struct at different times, and will behave differently as a result, while appearing the same the whole time (i.e. the language strongly discourages the use of interface pointers) to the person writing code.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 01:41 PM
Does it bother anyone else that languages can't agree upon an abbreviation for "function"? There's function, func, fun, and fn. You could even throw Python's "def" in there, but even without that we're memorizing 4 different variations of the word function.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 01:53 PM
Quote:
Originally Posted by saw7988
Does it bother anyone else that languages can't agree upon an abbreviation for "function"? There's function, func, fun, and fn. You could even throw Python's "def" in there, but even without that we're memorizing 4 different variations of the word function.
Tcl uses "proc"
Lisp uses "defun"

I've probably seen some others
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 02:04 PM
Quote:
Originally Posted by saw7988
Does it bother anyone else that languages can't agree upon an abbreviation for "function"? There's function, func, fun, and fn. You could even throw Python's "def" in there, but even without that we're memorizing 4 different variations of the word function.
People can't agree on anything in general - if they did, we wouldn't have all these different languages. I'm guessing you're not a fan of this project:

https://en.wikipedia.org/wiki/Endang...guages_Project
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 02:15 PM
Quote:
Originally Posted by RustyBrooks
Tcl uses "proc"
Lisp uses "defun"

I've probably seen some others
Haha yea I'm sure there's a ton of others... I shouldn't have brought up Python, because my random thought was really about the function abbreviations, not just "different syntax" in general. I play around with Rust and Kotlin in my spare time, but you see a lot of JavaScript everywhere (for obvious reasons) and now reading Go code just topped it off
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 05:46 PM
Wow, first time using SQL Server ever. What a nightmare of a system.

I'm running this on a docker image. I'm simply trying to bulk load a txt, csv or xlsx file and make it work. By default, a newline is "\n" , but since there's who-knows-what, you have to use some 0x0a. Despite defining a delimiter as a TAB, it STILL truncates the data and blows up with a bunch of errors!

Oh, and what does it do when it "succeeds?" Nothing. Nothing at all. No messages, no new rows, no errors. I'm truly stuck and can't believe nothing is working.

Okay, seriously, anyone know how to load a flippin' txt, csv, or xlsx file onto SQL Server?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 06:24 PM
I've never done it in the SQLServer magic way, I just use scripts for it. I haven't worked with SQLServer since about 2008 so I don't think I even have anything around that I've used.

The scripting I use for database stuff these days is built around sqlalchemy, which supports MSSQL. I could probably make you a sample if you want. It'll probably be slower than the build in bulk insert from file thing they have, but it'll probably be OK.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 06:51 PM
It's all good. I think it's the usual encoding issue between Linux and Windows, and MSSQL didn't quite fix all of that. I also had to use docker because MSSQL requires an outdated version of openssl, because heartbleed I guess.

IMO, SQL Server isn't ready for Linux yet.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 07:23 PM
I didn't know they'd even bothered to put it on linux. I'm not quite sure why they did, tbh. I guess maybe they're trying to capture some legacy server applications?

(The reason it seems odd to me is that I don't think anyone who prefers linux is going to choose MSSQL over the other offerings, so the only reason I can think of why you would is if you had an app that already ran on MSSQL server and you were tired of running NT servers)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 07:35 PM
Quote:
Originally Posted by RustyBrooks
Yeah I think back to the first generic java SQL querying interface I wrote, vs ones in scripting languages like tcl or perl. Java wanted to know in advance the type of every column in every query. Scripting languages didn't care, until I wanted to treat a column as something specific.



Well, consider C++. Generally speaking, any templated collection will let you have foo<mytype> but if you want a collection that can hold "anything" you're left with foo<void *> and a lot of extra work - and, it has all the run time exception risks of an untyped language. Or, you can make a BaseType class, and make a foo<BaseType> or foo<BaseType *> and have IntTypbe and StringType and FloatType and ButtType that all extend BaseType just so that you can have a statically typed foo container.

I haven't programmed for a living in Java since 1999 but I seem to recall that most of the built in types would take an "object" as a type (i.e. anything), but, if you wanted to actually execute a function on an object you had to do this dance of "if o is a string, then run o.whatever(), if o is a float, run o.somethingelse()" and so forth.
C++ std::tuple
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 07:42 PM
Quote:
Originally Posted by adios
You have to provide a type to the template. It does not hold arbitrary types at run time. The closest you can get is std::tuple<void *, void*> and so forth.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2017 , 07:58 PM
Quote:
Originally Posted by suzzer99
Speaking of high trust vs. low trust - good news everyone! The Chinese have a solution.

http://www.wired.co.uk/article/chine...ivacy-invasion
This is, pretty much exactly, the premise of an episode of Black Mirror. (3x01 Nosedive).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-27-2017 , 02:35 AM
My brothers startup just went under and now he's looking for a new job. Only been at it for 10 months. Reminder to always keep your resume up to date. A month ago they were looking to move to a bigger office and now they are tanking.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m