Jim Venolia

Ranch Hand
+ Follow
since Sep 07, 2013
Jim likes ...
VI Editor Chrome Linux
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jim Venolia

Turns out they put the classes in .hxx files to inline the code.  They're running on small embedded devices and had serious performance problems.  They traded code size for speed, and instrumented the results to prove it.  
4 years ago
Belated thanks, I'm just now getting back to this code and your replies helped a lot.

One thing about this code seems very bad to me.  Several classes are defined in header (.hxx) files.  Is this normal in C++?  If so, my learning curve pretty much just went 90 degrees.

Templates, yeah I get that.  But classes?  What happens when 2 .cxx files include a .hxx defining a class?
4 years ago
Ahhh, you work for a body shop that hires you out and takes a 30% cut.  Got it.

Did that in the 90s.  What I did was work for 3 body shops.  I let them all know when my current contract was ending and first one to find me another acceptable job got my 30%.  Did get a couple jobs on my own where I got to keep that 30%, but I suck at networking and really have no desire to get better at it.  I'd rather cross a roomfull of legos barefoot in the dark at 3 AM to pee.

I started to learn Kotlin last spring/summer and was quite liking it, then life happened and I didn't program for nearly a year.  I cringe when I re-read my posts here from May-July 2018.
4 years ago
serveraddr was declared a struct serveraddr_in.  connect() wants a pointer to a serveraddr, "(struct sockaddr*)&serveraddr" casts serveraddr_in to a serveraddr.  Keep in mind the underlying data doesn't change, just what connect thinks it's being fed.

Think of it as primitive inheritance.  serveraddr_in can be thought of as inheriting serveraddr.

The joys of C

Edit.  Googled for the definitions of serveraddr and serveraddr_in and found this, which explains it better than I ever could:  w00t!
4 years ago
QA is a lot like development.  You read the requirements, write tests to ensure the code meets the requirements.  Then the fun starts.  You try to break the other guy's code, err, I mean look for bugs.  I found it pretty enjoyable.

You'll also know the system better than most developers.  Each developer will focus on their little section.  You will focus on all sections.  Integration testing (where you combine code from other developers) is especially fun.

The one caveat is you need to automate the tests as much as possible.  Running manual tests quickly becomes drudgework.  At least until you can get a worker bee or two to do the drudgework for you.

CSB.  I first looked at Java in '96.  I had an 8 person team with the responsibility of testing a brand new cell-phone gateway.   I quickly realized my test suite would be a couple hundred individual tests, one or two per requirement.  Java was brand spanking new so I gave it a shot.  It took 20-30 seconds just to start up and print hello world.  Once it got going the speed was fine, but that startup delay was a killer.  Ended up using Perl and C++ (hadn't heard of Python yet), each of my hundreds of tests took maybe 2-3 seconds to run.  Not using Java at that time was a wise decision.

4 years ago
I'm an expert at C and fairly good at Java.  I volunteered to help a friend with a C++ codebase I'm having trouble making heads or tails of.  Example:

tl;dr How do I interpret the ConfiguredConsumer constructor?

This is inside a .hxx file, and I'm 90% sure it's not a template (lots of macros above it I haven't quite sussed out yet).  What do I duckduckgo to find out how to understand "SomeMethod(args) : something(args?), somethingElse(more args?), yetAnotherSomething(stuff) {}"?  I've got a couple C++ books, most recent dated 2017, and I'm not seeing anything in them that helps decipher this line.

I'm at a total loss here.
4 years ago

Campbell Ritchie wrote:

Darko Jakimovski wrote:. . . . You can find everything on the internet and when the going gets tough ask on the ranch. . . . .

I don't like the idea of searching the Net; you cannot tell whether what you have found is good or bad, and there is a lot of bad advice out on the Net

This.  When looking for something specific duckduckgo is a terrific resource.  When trying to learn something it's pretty hit and miss, more miss than hit.

As for books, Head First Java is pretty good but only goes up to Java 7.  So no streams nor lambdas.  The Dietel book is good but not for people first learning how to program.
4 years ago
Google trailing average, or moving average.  One of those should do the trick.

The question is what happens when you exceed the limit.  Do you drop the token, or make a queue of tokens waiting?  If the queue fills up what then?

You might want to read up on networking also.  The hardware can send at a certain max rate, packets get queued up to handle bursts.  Make the queue too large and you get something called buffer bloat, which is bad.

4 years ago
If you really want to get tangled up in your underwear take a look at the Time Stamp Register.  It's a 64 bit register that counts clock ticks.  Back in the day it was a great way to get nanosecond resolution.  Then some perverted boffins invented stuff like multiple cores, threads, and CPUs that could adjust their clock frequency based on demand.  If you're clever you can work around these, I'm not that clever.

If you want I might still have some C++ code I wrote about 20 years ago that uses the register, I'd just have to dig around to find it.

Then again, I have no idea how you could read a hardware register in Java.

Caveat:  I haven't looked at this register in 20 years, I'm not even sure it still exists in modern CPUs.  It may also be Intel specific.

Edit:  Looky what I found.

4 years ago

Campbell Ritchie wrote:Have you ever tried prodding a moose? Do you think you would live to tell the tale? Not even with a friendly one like our Thaddeus.[/quote

As a matter of fact I have.  Several times.  But I've never tried calling my wife a moose.  Scientists have proven that women who carry a bit of extra weight live longer.  Than the men who point that out.

4 years ago

Jeanne Boyarsky wrote:Yes. We are working on it. We tried prodding the cows, but that didn't work. So we moved on to technical solutions.

There's your problem right there.  It's a moose ranch, not cattle.  Try prodding some moose.

It's just slow for me, no timeouts.
4 years ago
You could also do 1/22, the only thing that changes is the decimal point.  This shows the second result is indeed correct (adjusting the decimal point, of course).

As others have said, you've just discovered the joys of big numbers and floating point math on computers.

4 years ago
In both C and Java i should be 3.  You assign it before you increment it.

That said, if someone who reported to me wrote that line they would know I strongly disapproved.  Quite possibly whilst living in a dishwasher box under an overpass.
IMHO, things like "y = ++x + x++" should never be done.  I come from a C background, where it was up to the compiler to determine if ++x or x++ got evaluated first.  Java may be different, I don't need to know the grisly details of evaluation order because I don't do stuff like this.