Programming

Anyone here use Azure? I’m in the midst of writing my first app on it, have got to the point where I need to add some sort of logging, googled for help and it’s all pretty incomprehensible. One of those situations where it’s like “you can use anything!” and I’m like OK, sure, but what SHOULD I do.

One of the big problems in googling for assistance is the conflation of “logging” in terms of API calls, security logs and that kind of service-layer stuff and “logging” in terms of my code did a thing that I want to make a note of.

I just VPS all the things

My one experience with Azure was pretty similar - painful. I’d put AWS, Heroku and Digital Ocean all much better than Azure from a usability POV.

You want application logging. What language are you using? You should be able to just log and it will show up somewhere. Every running app should have a link to logs which will be a mix of system-level stuff added by Azure and whatever you log out.

Yeah I figured it out, wasn’t too tough in the end, just had to find the right set of instructions. I haven’t written in C# for like 5 years so I’m having to remember how everything works at the same time as learning how Azure works, not to mention .NET Core was only just a thing back then and things work slightly differently in that, the built in DI container is new, etc etc.

It’s nice to come back to C# after Java though, where the language helps me out instead of constantly getting in my way.

You should solve them in C++. Get your daughter into them too. I worked on last year’s problems when i was learning JavaScript, and it was a good way to get some motivation to poke around into various language features (like the lolJS mod bug…).

1 Like

Programmer who moderately enjoys arts, crafts, and human interactions desired. Two out of three will do.

Hmm. Would be in but the Venn diagram of “into programming” and “creative type; can come up with a fun and interesting exercise” has very small intersection. Trying to think of a toy exercise that would interest people.

I need to learn how to trust myself more. I always have an “oh shit oh shit oh shit” moment when asked about something or asked to update something from 3+ months ago because the context is completely out of my mind and I’m worried I left it in a complete mess.

Instead I usually find it tidily and nicely packaged for me to come back to. Idk why I always panic or feel reluctant to go back to stuff I did a while ago. I usually dot my i’s and cross my t’s.

1 Like

https://mobile.twitter.com/danoot/status/1334967635318956034

1 Like

Dog Dancers

https://mobile.twitter.com/ViolenceWorks/status/1335382435031252992

1 Like

c++ problem. This is an except that recreates an error

I think this is a problem with not understanding the compiler/linker. This is on windows with g++.

VectorTest.h file

#include <iostream>
#include <string>
#include "Sequence.h"

namespace CS52
{
  class Vector : public Sequence
  // class Vector
  {
    public:
      Vector();                       //default constructor
      Vector(int size, int int_val);  // overloaded constructor

    private:
      int _size = 0;
      int _capacity = 0;
      int* _data = nullptr;
  }; //Vector class
} //namespace

VectorTest.cpp file

#include <iostream>
#include <string>
#include "VectorTest.h"

namespace CS52
{
  Vector::Vector()
  {
    std::cout << "default constructor\n";
  };

  Vector::Vector(int size, int int_val)  // overloaded constructor
  {
    _size = size;
    _capacity = size;
    _data = new int[size];
    for (int i = 0; i < size; i++)
    {
      _data[i] = int_val;
    }
  };

} // end namespace CS52

SequenceTest.h file

#include <iostream>
#include <string>

namespace CS52
{
  class Sequence
  {
    public:
      virtual int size() const = 0;
      virtual int capacity() const = 0;
      virtual std::string type() const = 0;
      virtual ~Sequence() {}
  };
}

A05Test.cpp file

#include <iostream>
#include <string>
#include "Vector.h"

void info(CS52::Vector& v);

int main()
{
  CS52::Vector(5, 3);
  return 0;
} //main

compile command

g++ A05Test.cpp VectorTest.cpp -o A05Test.exe

error

C:\Users\jayne\AppData\Local\Temp\cciChZFF.o:A05Test.cpp:(.text+0x38): undefined reference to `CS52::Vector::~Vector()'
collect2.exe: error: ld returned 1 exit status

Had this working when Vector Class was on it’s own, but part of the assignment here is making the Vector Class a subclass of Sequence. And I think that with the virtual functions in Sequence you’re not supposed to need a cpp file, but ??? I don’t know if including the SequenceTest.h file in the VectorTest.h file is right or if it should be enough for the compiler/linker.

Thanks for looking at this if you do and sorry for this, but I’m at’ing @goofyballer and @ChipsAhoy - both C++ dudes, but I’ll be grateful for any help from anyone.

:pray:

  1. You have #include “Vector.h” and #include “Sequence.h” but your files are named VectorTest.h and SequenceTest.h – I’m guessing you use both names and didn’t change everywhere?

  2. Where (in which cpp) is virtual ~Sequence() {} defined? Code in headers is funny. It’s easy to add the same implementation to multiple files when you #include. Then what is the linker supposed to do?

If your problem wasn’t solved by the filename, move the implementation Sequence::~Sequence() {} to a cpp file.

To clarify: you have a virtual destructor in the base class. you don’t override it in the derived class. So the dervived vtable entry should point to Sequence::~Sequence, but the linker can’t find it.

Really appreciate the help. The missing “Test” stuff was an artifact of me trying to eliminate extraneous stuff for you guys to look at. That was a mistake because I got it to compile by correcting something that wasn’t shown. There was another function that was declared and not defined. The thing was, the error was exactly the same. The error messages I’ve found to generally suck, but I guess these linker error message especially suck.

Still, I’m surely misunderstanding stuff and your answers were helpful in getting me somewhere near understanding this stuff.

Some of this class being hard like this is that there was a C class that was a prereq that my daughter skipped (and I never did) because she did an AP class, but that class was in javascript.

Thanks again.

This book is a quick read and a solid foundation in C.

1 Like

Makefile syntax is really annoying. I had to do a lot of work with C and Makefiles in my last job.

A lot of things in C/C++ are done either because that’s the way it’s been done for 40 years and it ain’t gonna change, or for efficiency/speed. I don’t argue.

Chips, is C++ mostly what you’re doing for a living?

Chips and Goofy,

What do you guys do generally? Game development? General apps? Backend support for search?

I don’t really know if I understand how this works well enough to successfully make this snarky comment, but…

Template classes and overloading operators are cool. If I do enough of that stuff I think I can turn C++ into Python!

Now that you’ve had a taste of C++ - you should appreciate learning Java or C#. They’re both C++ w/o all the painful compiling/cross-platform stuff. They keep you out of trouble in a lot of other ways. C++ with guardrails.

Learn Rust instead! It’s C++ except the compiler tells you when you do something wrong. Also the unsigned 64-bit integer type is u64 rather than unsigned long long int.

1 Like