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

10-26-2018 , 01:18 PM
When you come in in the morning and can tell it was a good research session the night before:

** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 03:58 PM
Quote:
Originally Posted by candybar
I don't have strong opinions on the others but for these two, definitely xUnit and actual Visual Studio. VS Code kind of sucks in comparison though it's gotten better.
Playing around with xunit. It seems pretty sparse on the information reporting.

Here's the test:

Code:
[Fact]
public async void SingleUserSuccessTest()
{
    Response singleUser = await (new HandlerTest()).LookupCrmUser(new Request{email="x@y.com"}, null);

    Assert.NotNull(singleUser.Success);
    Assert.NotNull(singleUser.Success.payload);
    Assert.NotNull(singleUser.Error);
}
And here's the test fail output:

Code:
tarting test execution, please wait...
[xUnit.net 00:00:00.5936292]     AwsDotnetCsharp.HandlerTest.SingleUserSuccessTest [FAIL]
Failed   AwsDotnetCsharp.HandlerTest.SingleUserSuccessTest
Error Message:
 Assert.NotNull() Failure
Stack Trace:
   at AwsDotnetCsharp.HandlerTest.SingleUserSuccessTest() in /lab/csharp-lambdas/lookup-crmuser-lambda/HandlerTest.cs:line 28

Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.
Test Run Failed.
Test execution time: 1.1990 Seconds
Is there a way to get better annotations and it to spit out the object in question when it fails? Like in the old JS world you have describe(msg) and should(msg) which both contain useful long descriptions to know what failed. Here it seems like all you have is the function name. Stack trace seems like overkill.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 04:12 PM
Quote:
Originally Posted by Grue
FFS time for my Friday rant:

If you can't ****ing write code that doesn't ****ing suck and then have someone do the code review and doesn't see that it ****ing sucks and merges it to master I'm going to ****ing lock down the repo and make it so only I can do merges. You have a "renderRow" function that maps through an array and outputs JSX? And it puts the same ****ing hardcoded ID on the container?? Gee I wonder if IDs should be unique or not? And then even worse you don't even ****ing use the ID anywhere in the entire repo other than where its created? What the **** are you doing? What the **** is happening in code review? For ****s sake.
Couldn't they have just used the index for the id?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 04:13 PM
Code:
import json, math, sqlite3
from flask import Flask, redirect, render_template, request, url_for, jsonify
from sqlite3 import Error
app = Flask(__name__)
app.config["DEBUG"] = True
def create_connection():
    try:
        conn = sqlite3.connect(':memory:')
        return conn
    except Error as e:
        print(e)
print('I am here')
conn = create_connection()
try:
    conn.execute('''CREATE TABLE comments
        (id INT PRIMARY KEY,
        content SiTRING);''')   #I misspelled string on purpose
except sqlite3.Error as e:       # I tried this as just "except Error as e:" as well
    print('why am I not here?')
    print(e)
When I run this from command line in shell I see the "I am here" and "I am here as well", but I don't get "why am I not here" or any error.

If I run it with

Code:
if __name__ == "__main__":
    app.run();
It starts up the wsgi server (I think - some server anyway). If I comment that out it executes and finishes with no errors. If I make the request from a browser (served by apache2/mod_wsgi) it gives and internal server error 500. Without the misspelling it work from the web page.

It spits out a bunch of stuff in the apache error log, but nothing that I can see as helpful.

My first preference would be to see a helpful error message on the browser, but running the script from command line and getting an error message is fine too.

Any thoughts?

(obviously I know the error here, but I just want to see database errors easily)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 04:47 PM
Grue - quality rant. Would read again.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 05:40 PM
So, I have another project which will take precedence over other project for a little while at least.

Generating PDFs using node. Google's first hit is "pdfkit". Any thoughts?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 05:53 PM
Quote:
Originally Posted by microbet
When I run this from command line in shell I see the "I am here" and "I am here as well", but I don't get "why am I not here" or any error.
Because there's no error. sqlite is notoriously forgiving about stuff like this. Consider this code

Code:
import sqlite3

conn = sqlite3.connect(':memory:')

conn.execute('''CREATE TABLE comments
    (id INTxx PRIMARY KEY,
    content SiTRING);''')   #I misspelled string on purpose

print("Does the table exist")
for row in conn.execute("select * from sqlite_master where name='comments'"):
    print row

print("Can we insert?")
conn.execute("insert into comments(id, content) values(1, 'hi')")

for row in conn.execute("select * from comments"):
    print row
Despite your error, the table exists and you can insert and select from it. There's no (python) error.

Quote:

It starts up the wsgi server (I think - some server anyway). If I comment that out it executes and finishes with no errors. If I make the request from a browser (served by apache2/mod_wsgi) it gives and internal server error 500. Without the misspelling it work from the web page.
You don't have any endpoints defined so I'm not very surprised you get a 500, although you might also be getting one for another reason.

Quote:
My first preference would be to see a helpful error message on the browser, but running the script from command line and getting an error message is fine too.
Errors will generally show up in the console you're running the debug server in - you just don't have any errors here.

If you need any help or guidance on python stuff you can feel free to email me: me@rustybrooks.com
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 06:51 PM
Quote:
Originally Posted by RustyBrooks
We have a new hiring rule at my job. Basically, all programming applicants must have a CS degree (no math/physics/ee/etc) from a top-10 school or must be provably gods gift to programming. The majority of people working here now couldn't get hired under these criteria. I had forgotten about this until recently when I started going through resumes to bring people in to interview and my boss recommended me that some of the ones I'd shortlisted were not going to make it past the CTO.

It's a little weird to work someplace that wouldn't hire you.
this is super lol for many reasons. first off, coding really isnt that hard.

also, I am not sure how competitive your company is, so this could be way off, but I am guessing that you guys are not paying salaries on the level of what some of these guys can command. so you may be left with the weird guys who have fantastic achievements on paper but cant get along with teammates and all that other crap.

like the technical challenge of programming/dev work really isnt that intense that some super genius is all that much better than a decently smart guy that can learn quickly.

and as for value to a company, getting along with your coworkers and being able to work well with business is super important.

finding some guy who can split the atom with his code is just not at all important to working together on a team to provide business value to your customers.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 06:54 PM
Quote:
Originally Posted by jmakin
Could be worse, we dont even really have code review
how is this even possible? do you guys actually provide a product to someone? a product that they like, use?

what if someone merged some code that effed something up?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 07:04 PM
Quote:
Originally Posted by Victor
how is this even possible? do you guys actually provide a product to someone? a product that they like, use?



what if someone merged some code that effed something up?


We have a master branch which is basically WIP and release branch which is tested/modified for customers.

Problem is we have a habit of modifying releases to specifically tailor to customers needs and branches diverge too much from master. Is a problem i’m constantly fighting.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 07:20 PM
still, breaking the dev branch is annoying as hell
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 07:31 PM
Rusty,

Thanks. I'm going to try to keep doing Python on the side. Maybe it's the culty community or something, but I think Python is going to be where I'll end up. But, I got a little paying gig in node!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 07:44 PM
Quote:
Originally Posted by Victor
how is this even possible? do you guys actually provide a product to someone? a product that they like, use?

what if someone merged some code that effed something up?
Welcome to a couple days / weeks of putting out fires depending on how bad the merge was effed up.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 08:01 PM
I just came up with a pretty cool way to do C# lambda testing, which will also work for integration testing with the browser. Maybe this is standard I dunno.

So first you have your lambda:

Code:
[assembly:LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]

namespace AwsDotnetCsharp
{
    public class Handler
    {

        // this is the entry point called by AWS
        public async Task<Response> LookupCrmUser(Request request, ILambdaContext context)
        {
           ...
        }

        // virtual so it can be overriden by test hander
        // ideally eventually will pull from a service class that can be overridden to return mock services with env vars
        public virtual IDataList<EmailInput, LookupOutput> getDataList(AppFxClient client, Guid callId) 
        {
              // DataList is a semi-generic library class that fetches data from our CRM system for a number of different calls
              return new DataList<EmailInput, LookupOutput>(client, callId);
        }
...
And then the companion test class:
Code:
...
using Xunit;

namespace AwsDotnetCsharp
{
    public class HandlerTest : Handler, ILambdaTest
    {
        // xunit tests
        [Fact]
        public async void SingleUserSuccessTest()
        {
            Response user = await (new HandlerTest()).LookupCrmUser(new Request{email="x@y.com"}, null);

            Assert.NotNull(user.Success);
        }

        ... more tests ...

        // spoof DataList to return mock data
        public override IDataList<EmailInput, LookupOutput> getDataList(AppFxClient client, Guid callId) 
        {
             // mockDataList implements IDataList
             var mockDataList = new MockDataList<EmailInput, LookupOutput>(client, callId); 
             mockDataList.HandlerTest = this;
             return mockDataList;
        }
So add xunit and run dotnet test and it all just works. You can unit test one lambda at a time or all of them. The script will block the lambda from being deployed if the tests don't pass.

But the really cool part - is since HandlerTest extends Handler - you can specify it to AWS as the active lambda class. In serverless.yml:

Code:
functions:
  lookup:
    handler: CsharpHandlers::AwsDotnetCsharp.HandlerTest::LookupCrmUser
So now your lambda has all the same business logic, except it's hitting a mock service for data - which will come in handy for integration tests from the browser.

Lambda is a whole new world - it's fun.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 08:15 PM
Quote:
Originally Posted by Victor
still, breaking the dev branch is annoying as hell
this is why i've completely reworked and spent so much time on our testing pipeline. We placed far too much confidence in our testing before, the coverage was poor and the logging/reporting was even worse. So, if we're gonna fly by automation I'm gonna make sure the damn stuff at least works and has decent coverage. That's all I can really do.

Code review is hard because everyone is stretched so thin, no one wants to do it, and rarely are there two people in the office who know enough about the affected source (which is extremely complicated) to even adequately review each other's code. So this is what it is.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 08:40 PM
Quote:
Originally Posted by RustyBrooks
You don't have any endpoints defined so I'm not very surprised you get a 500, although you might also be getting one for another reason.

Oh, and I didn't post the whole file. This comes up later:

Code:
@app.route('/', methods=["GET", "POST"])
def index():
    if request.method == "GET":
        sql = "INSERT INTO comments (content) VALUES ('this is a string in the database')"
        cur = conn.cursor()
        cur.execute(sql)
        secondcomment = cur.lastrowid 
    return render_template("main_page.html", secondcomment=secondcomment)
When "STRING" is spelled correctly it works and returns the id.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 08:55 PM
I can't explain that without trying it, because for me, I can insert/select fine without string being spelled right. If you want to send me the whole setup I can probably give you an idea what's going on.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 09:24 PM
Quote:
Originally Posted by ChrisV
2) Yeah, you use XML. Details here.
FYI - I couldn't figure out how to set compiler options in .netcore build step. So I ended up using doxygen for this. Super simple to install and run. My boss was interested in doxygen anyway so this will make her happy.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 09:39 PM
Interviewed at a <desirable Bay Area mega-co> today, and something interesting happened, curious what you guys would do about it.

They scheduled me for their typical interview panel, running until 3:30, consisting of 5 technical interviews with a lunch break. I was exceptionally nervous going into this, I tried to go to bed early last night but tossed and turned and slept like **** (on a night when I MOST need to have a good night's sleep, more than ever ), been studying for 1-2 weeks - having been like 4 years since my last coding interview (when I joined my current job), and that being the only interview I had done in the last six years before that, I was really anxious about how I'd perform.

Anyway, we start off, first interview goes pretty well - not a super complex problem, start with something simple, gets a little more complex, I think I handled it well. Second interview, similar pattern, I'm starting to feel like - okay - this is going well, I'm not an idiot/impostor, I got this.

After my 2nd interview, the 3rd interviewer doesn't show up. This being a large company and all, it's not like they all work with each other, they have nfi who my other interviewers are so it's not like my 2nd guy can go drop by 3rd guy's desk or something. So, 2nd guy steps up like a champ and says, well, if he's not here, let's start another problem. And he basically does my 3rd interview. The guy who was supposed to do that interview showed up halfway through, but given the timing and that my lunch break was coming up, they decided 2nd guy should just finish the 2nd problem we were working on together. We do that, I think I did pretty well.

Sometime around lunch, my interviewer and I both notice the room schedule now has me booked until 4:15. I'm like...whaaaat? I email the recruiter I'd been working with and ask if he knows why that happened, I suspect it was due to the snafu, but he doesn't respond.

I get back from lunch, do two more interviews, I feel pretty good about both of them, and having now done 5 sessions I feel really good about my performance on the day. But, my lack of sleep is starting to catch up, that 5th interview went well but I feel like I'm starting to run on fumes. It's 3:30. My day was supposed to be over.

(oh, fun fact: interviewer #5 was familiar with the products I work on now, and really liked them! very cool to meet someone like that, and prob good for his impression of me, as most people have never heard of us)

And then...the guy who was supposed to be interviewer #3 comes back.

So, I guess figuring that he missed his interview, The Powers That Be moved it to the end, maybe not knowing that I essentially did do that third interview anyway, just with the same guy as the second?

He asks me his question, it trips me up a bit, I'm not sure if I would have necessarily aced it if I did it 4 hours earlier but I'm positive I at least would have done better. I get to a workable solution to the problem, but with way more of him helping me out through the places I got stuck than is remotely ideal. All interviews obv have some degree of "hmm, this seems tricky, should I go this way or that way", and the interviewer pointing you in the right direction, but I got a little too stuck on some of the weeds of this problem and it was definitely my worst performance.

So, to be somewhat dramatic about it, this feels really unfair. They brought me in for 5 interviews and gave me 6, and the worst one came when I was most tired at the end of an exhausting, packed day. This is a great opportunity and I would feel absolutely gutted if this scheduling snafu I had no control over wound up costing me an offer. I may still get one, but like, if my day ended after interview #5 I feel like 90% I passed it, after interview #6...I have no idea.

So, question for you guys: would you bring this up as a concern? The impression I got from talking to the recruiter in the morning was that, most likely, the next time I talk with him will be next week, probably after they go through their hiring process and make a decision. Do you think it's worth mentioning in an email before they make that decision - hey, I did get the 5 interviews, and I felt really good about them until the 6th one came at the end of a tired day? I could word it better than that obv, but basically just let him know (because, again, this is a BigCo and I legitimately do not know how well they transmit information between each other, and if he even knows that I didn't spend the 3rd interview slot browsing the web on my phone), and to hopefully not let that extenuating circumstance (a 6th, exceptionally tired interview) sway the decision too much.

Obv having just gotten home and being utterly exhausted, I'm def over thinking this, so hoping some people with clearer heads can give me their thoughts.

In any case - I think doing as well as I did today, regardless of the outcome, boosted my confidence for other places I'm talking to and made me feel pretty good. I got an email today that I passed my phone screen yesterday for another co and they want to bring me in for onsites, and I'm talking with another recruiter on Monday from a friend's referral, so lots of promising stuff on the horizon.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 09:49 PM
goofy all I can say is that ****ing sucks.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 10:04 PM
Quote:
Originally Posted by RustyBrooks
I can't explain that without trying it, because for me, I can insert/select fine without string being spelled right. If you want to send me the whole setup I can probably give you an idea what's going on.
Ok, I was wrong about that problem entirely. It "works" with "STRING" misspelled. It throws an error at the command line if I misspell "CREATE" and I get my message and something from sqlite3.Error. What happens is if I reload the page I get the Internal Server Error, but then if I reload it again it works. The in memory database persists well enough that the return of id iterates up every time it displays. If I restart apache it goes back to 1. I opened a new browser (firefox instead of chrome) and it didn't reset - so the db was still around.

So, I looked in the apache error logs and there's this:

Code:
sqlite3.
ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in
 thread id 140021827057408 and this is thread id 140021843851008
So, it has something to do with threads.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 10:10 PM
Quote:
Originally Posted by Grue
goofy all I can say is that ****ing sucks.
Thanks, I appreciate a proverbial shoulder to cry on atm.

One thing I just remembered that seems relevant - when talking to the recruiter a couple weeks ago ahead of scheduling onsites, he said to me (paraphrasing), "I'm gonna be in the room for all the meetings about your hiring, I'm there to advocate for you". So, that makes me lean towards sending him an email and making sure he knows the situation, and to ask that they not let that 6th interview be disqualifying.

Like, if my read about the first 5 is wildly off and they thought I wasn't good enough based on those already - that would surprise me, but, at least that's fair, I can live with that and learn from it. If they let this 6th interview swing it from a "yes" to a "no", ugh, that'd be so miserable.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 10:27 PM
It sucks but there's not a lot you can do right now. In my experience trying to explain problems in an interview to the interviewers isn't going to work unless one of them knows you. Tell your recruiter what happened, hope they're decent and hope for the best. Try to remember that everyone ****s up some in interviews, and that interviewers pass on people who are 100% good enough for the job every day. It's not personal.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 10:27 PM
Yeah goofy, that sucks. I don't know that it would help to explain to the recruiter, but it couldn't hurt could it?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2018 , 10:34 PM
Quote:
Originally Posted by RustyBrooks
Try to remember that everyone ****s up some in interviews, and that interviewers pass on people who are 100% good enough for the job every day. It's not personal.
Yeah, I know, this one just feels particularly important because of the specific company and the opportunity it represents. Like, I make a comfortable salary at my current job, but when you look at the highest paying jobs around here, it's the difference between buying-a-home-in-Silicon-Valley-no-****s-given versus staying a renter (in this very expensive market) for awhile.


Fun anecdote from my interview: I have ~never used a min heap in my programming career, and had probably forgotten what the hell a min heap was after college, until I happened to brush up on them yesterday, in my final day of studying.

TWO of my six interviews had a min heap as the preferred data structure in the solution! Thank god I brushed up on that. If I do get an offer, that data structure could be the difference, lol.

I also studied, like, every sorting algorithm and had zero sorting questions. I guess it's a fun sample size quirk, pulling 6 random questions from a BigCo's list of interview questions and seeing what subjects you do/don't get.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m