|
Can't talk politics ...
As I said: don't hate the person, but do "think" about their tactics.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Can't they just roll back the update?
"Go forth into the source" - Neal Morse
"Hope is contagious"
|
|
|
|
|
Working with my current favorite JavaFx using the IntelliJ IDE, I faced a problem earlier today. I had a two-dimensional array of objects to sort. Think for the array as something like:
Object[][] myArray = new Object[88][155]
Index 1 of each sub array held a string as an object. In other words myArray[][1] was a string object.
The problem: To sort the array in alphabetical order for this string.
I looked at the problem and thought: "No way is there a simple solution for this! I'm going to have to write a sorting class for the job. It took me a couple of hours but I got it working in less than 30 lines of code. And it worked well. Just as I was getting ready to pat myself on the shoulder, I developed a nagging thought (don't you just hate those spoiler nagging thoughts?) that I may have overlooked a more simple solution.
So I did an online search and came across a solution to do the sort in some 6 or 7 lines. Skeptically I tried adapting the code to my situation. As I was about to try it out, up pops IntelliJ, suggesting it would be simpler to use a Lambda expression. It even offered to do the conversion for me. So I thought: "What the heck, let's give it a try.
Sure enough IntelliJ's Lambda worked. About three lines of code!
But IntelliJ was not done humiliating me. Up it pops with a suggestion that it can convert the Lambda to a "super lambda" or something of the sort. What could I do? I had to tell it to proceed and voila: The whole sorting action on a 2 dimensional object array done in a single line of code! Here it is:
Arrays.sort(myArray, Comparator.comparing(o -> String.valueOf(o[1]).toLowerCase()));
Tonight I will have nightmares of vicious IDEs chasing after me to correct all my many mistakes!
Get me coffee and no one gets hurt!
modified 25-May-21 9:55am.
|
|
|
|
|
That's pretty impressive. I hadn't heard of Intellij, so I had to look it up. It doesn't support C++, so that's why. And I hope it never does, because I can imagine what it would do to my ego too!
|
|
|
|
|
:laughs:
And here I was, a day or 3 ago, a little surprised my new phone used autocement to alter "b4" into "by".
The first time I tried out Augmented Reality on of all things, an Aldi catalog front-cover, my brain nearly melted. Ohhhhhhhhw - so that's why Pokemon Go has been so successful. :Checks last phone: - 7 years old....
|
|
|
|
|
They have another IDE called CLion that's basically just a customised/simplified IntelliJ - It's much better than Visual Studio, but I don't really know how it stacks up compared to other C++ Editors.
|
|
|
|
|
I know quite a few people who rate it - never tried it myself, mind!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Cp-Coder wrote: String.valueOf(o[1]).toLowerCase()
Nit-picking: Depending on your data, you should normalize strings to upper-case, to avoid the "Turkish i" problem.
The Turkish İ Problem and Why You Should Care | You’ve Been Haacked[^]
(The article is about .NET, but the problem will affect other languages as well.)
In .NET, it's better to pass in a case-insensitive StringComparisonOptions or StringComparer rather than changing the case of the string, so that you don't have to create a new string for every comparison. I don't know whether Java has anything similar, or suffers from the same problem.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That article should be bookmarked on every new developer's PC
|
|
|
|
|
Richard Deeming wrote: In .NET, it's better to pass in a case-insensitive StringComparisonOptions or StringComparer rather than changing the case of the string
|
|
|
|
|
I have a case-insensitive string comparison function in C++. But it normalizes to lower case, so I'll have to read that article. I know that Turkish has an undotted i, but it'll be interesting to learn why that creates a problem.
|
|
|
|
|
Kind of mandatory[^]
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I've asked about this before but now I have a better idea of what I need, so maybe I can ask a better question and get better answers.
I have had no luck getting SPI reads to work on an ESP32 line (basically the MISO line is useless to me)
I need a logic probe that will help me monitor SPI traffic on 3 or 4 lines up to 10MHz total bus speed (that means 3 or 4 million frames per second total of logging or buffer)
The problem I've had with my current probe is there's just not enough buffer and it doesn't do real time logging to the PC (i don't know that any of them can though) - everything goes by too fast so by the time i hit record it's too late, or it's way too early.
What I'd like is a probe that can capture 2-4 million frames, and preferably one that can be programmed to start capturing when one of the lines goes high or low. The last bit is critical because of my current problem.
I know a lot of them including my current one have an API and i can write software to start logging on high or low but I don't want to have to write code.
So any you hardware hackers, do you do this kind of thing? Do you understand the above? And is there a tool that will work this magic?
Real programmers use butterflies
|
|
|
|
|
I don't know if you've taken a look at the Logic Analyzers from Saleae - #1 with Professional Engineers[^]. The Logic 8 supports digital signals up to 25MHz and the Logic Pro 8 supports up to 100MHz if using USB3.0.
I know they're not cheap, $399 for the Logic 8, $699 for the Logic Pro 8 and $999 for the Logic Pro 16.
I have an older model (bought it back in 2014) and it works pretty good.
Kelly Herald
Software Developer
|
|
|
|
|
Thanks. I sent a link to them to my client, who is looking at purchasing one for me on my behalf.
I saved him a ton of money on a computer purchase so I think he's trying to return the favor.
Real programmers use butterflies
|
|
|
|
|
For SPI debugging the OP may be better off with a scope with the ability to decode SPI and other serial formats.
The reason being that bugs with SPI, I2C, RS232 etc are often to do with bad signals which a logic analyser will not show.
The Picoscope range includes multi channel scopes, some with built in logic analysers and some with very large sample buffers at prices from about £150 to £10k.
I have a range of scopes available but the Pico is my first choice device for this sort of work.
www.picotech.com
MK
|
|
|
|
|
was going to suggest the same thing.... salae make very good products.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
I've had a Saleae LA for many years and it's the best investment I've ever made.
It decodes SPI, I2C, Serial, etc.
The lines can be configured.
Can Trigger on rising, falling, etc.
Collection speed and duration can be configured.
Awesome GUI
Used to be a lot cheaper but I've noticed lately that they are a little pricey...but I would still recommend 9if you can afford.
|
|
|
|
|
It looks like these are the ticket for me. Pricy gizmos but they come recommended by several folks.
Real programmers use butterflies
|
|
|
|
|
You can download the GUI and if no device attached it runs sample data so you can see what it's capable of. Kick the tires so to speak.
|
|
|
|
|
|
Another vote for the Salae. I use one for hardware and interrupt timing debug. Absolutely essential. I recently 'race tuned' (well, raceish) an ESP32 to PI SPI interface and literally could not have done that without the device. The pro version also has an analog mode, which, while not perfect, is good enough to deduce some quite subtle hardware/software interactions. I found running the device on a separate PC from my debug system was essential in that instance. It is expensive but has survived much abuse. Divide the cost by the hours I've saved has avoided me working for sub-Maccas hourly rates on a couple of projects.
|
|
|
|
|
A client is buying me a saleae Logic 8 Pro (in red)
I am elated. That's more than the cost of a decent laptop, and it's money I don't need to spend.
Real programmers use butterflies
|
|
|
|
|
The cost is insignificant compared to the cost of a couple hundred engineering hours to develop your own program to do these kind of things. Where I work we have no problem spending a few hundred bucks on a third-party hardware or software that could take 100, 200, 500 hours to do in-house. If you figure 100 bucks an hour personnel cost, spending 100 hours on something costs 10,000 dollars. Purchasing frees us up to do things that we need to do. Anyway, engineering hours for a project are budgeted separately from purchases. The shell game.
|
|
|
|
|
I recognize that. It's still nice not having to spend $700 of my own money for it.
Real programmers use butterflies
|
|
|
|