|
Had to implement a globally unique ID generator that would work in distributed/disconnected system for a project in TS today. Doesn't warrant an article (I think??), so here it is if anyone wants it. Much like YouTube IDs, etc. the result is in base62 to keep it as short as possible. Runs fast enough to generate 100,000 IDs in 340ms in a WSL environment.
Big ol' edit: Made this a tip/trick. Nothing to see here now. La la la.
Jeremy Falcon
modified 1hr 10mins ago.
|
|
|
|
|
Perhaps Tip/Trick or Weird and Wonderful material?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
jeron1 wrote: Perhaps Tip/Trick or Weird and Wonderful material? Oh crap, I'm gonna seem like an old fart now... what's the tip/trick thing?
Jeremy Falcon
|
|
|
|
|
Ooooooooh, wait. I see it now. Um, it's been a while since I posted a new article, as you can tell. Thanks.
Jeremy Falcon
|
|
|
|
|
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
Wordle 1,036 4/6*
⬛⬛⬛⬛⬛
⬛⬛🟨⬛⬛
⬛🟩🟨🟨🟩
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 1,036 3/6
⬜🟨🟨⬜🟨
🟨⬜🟩🟨⬜
🟩🟩🟩🟩🟩
|
|
|
|
|
Of course it does...
Low-code tools boost developer productivity[^]
"Over 90 percent of respondents to a new survey say that low-code tools have boosted developer productivity in their organizations. 43.5 percent of developers are saving up to 50 percent of their time when they use low-code tools on a project."
I keeping thinking one of these days I will actually find an organization that actually measures developer productivity. Or devops. Or IT. Or DBAs. Or CEOs.
Now Sales ... those guys have it down ... 'how many contracts did you sign last month?'
But back to the article ...
""Low-code software has real value in democratizing software development to include non-developers," says Jason Beres, senior VP of developer tools at Infragistics, and creator of App Builder software."
Any one want to guess what Infragistics sells? Come on - I dare you.
The 'story' is based on a study created by ... bet you can't guess!
"The full report is available from the App Builder site."
|
|
|
|
|
I'm posting this because when I rant about these things to you folks I tend to come up with a solution, and I've been at this since last night. Skip it if you'd rather not be used like that. It's not a programming question, though I will describe the problem. There's not really code as such.
[\r\n]* (zero or more carriage returns or line feeds) yields a proper set with two transitions
[^\r\n]* (zero or more of anything but carriage returns or line feeds) matches any characters (incorrect). The set has one range with all unicode code points in it, and when you invert the set and then minimize the result it will actually crash.
[^\n\r]* (functionally same as above) but works properly, yielding a set of all except carriage return or line feed. This despite the sets ostensibly being sorted.
I thought I narrowed it down to a normalization routine I have that takes overlapping ranges and merges them. That still might be part of the problem. However, I removed the call to the normalization routine and it still fails my test, so something else is at fault further downstream.
One of the issues is this is in live code - with deployed nuget packages and codeproject articles, and I only just discovered it. So there's some pressure on me to fix it, albeit self imposed.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Sometimes over-engineered code breaks your neck. And then I can't help but laugh maliciously.
|
|
|
|
|
It's actually based on some simple mathematical concepts.
I know enough about the present bug that it has to do with the way I'm sorting and categorizing ranges of characters.
I wouldn't even use ranges except I need to in order to make Unicode practical, but it does cause the algorithm to significantly deviate from what you'd find in a textbook.
It all works, but basically here's what's going on:
Range 1: 0-12
Range 2: 10-0x1ffff
It works fine if range two comes before range one, but how do i sort this? Normally it needs to sort such that Z-A becomes A-Z and therein lies the issue, or at least an issue. Maybe I can side step it somehow. Still stewing on this.
Edit: I just realized it's groups of ranges I'm trying to sort. Maybe I don't need to at all?
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Does the issue only apply to control characters, or do you have issues with other match groups not in order?
e.g. if [^\r\n] fails and/or crashes, does [^rn] fail and/or crash also? If the latter fails also, then maybe you have an issue in your normalization routine. If only the former fails, then I'd have to suspect that it has something to do with handling "special" (i.e. control) characters. Does the group [^\v\n] also fail? What about code>[^\n\r\a\v\t] or other combinations of control chars? What about [^abc\n] ?
"A little song, a little dance, a little seltzer down your pants"
Chuckles the clown
|
|
|
|
|
I'll check it out. thanks
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
I would say you should never do any of those. So do not attempt to solve anything.
All of those are unbounded and optional.
Something like the following is correct in that it provides a bound and is not entirely optional.
^\d[^\r\n]*[\r\n]+
|
|
|
|
|
Well, I caught this as part of a larger regular expression, I'm simply taking out a portion in order to simplify.
In my engine, it's perfectly fine to have a zero length match because every subexpression is an expression. It's expressions all the way down.
(Oh, and I get the same results with +)
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Might be an ordering issue: \r(0x0d) > \n(0x0a) .
Mircea
|
|
|
|
|
It is, but I just can't find where it's creating the problem. I've been kind of avoiding it at the moment.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Message removed
modified 7hrs 5mins ago.
|
|
|
|
|
I think this is C++, so it should have been posted in that forum
Anyway, a class can have a default constructor, in which case no arguments are required to construct an object of the class. You just write new Class and the constructor assigns a default value to each member...or lets the compiler assign them...or leaves some unassigned, which is usually naughty.
|
|
|
|
|
Have a look at this page : cplusplus.com tutorial variables/[^] and scroll down to the section titled "Initialization of variables."
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
Salvatore Terress wrote: I did not make many friends with my last rant.
Hopefully that will not stop somebody to tell me You're still in the wrong forum dude. This is the same reason why celebrities seem mean or hot chicks seem standoff-ish. Sometimes coders want to chillax despite having coded their entire lives. That's why there's a forum for programming questions.
Jeremy Falcon
|
|
|
|
|
Jeremy Falcon wrote: hot chicks seem standoff-ish
For you, maybe.
|
|
|
|
|
Ha ha ha ha. Touché.
Jeremy Falcon
|
|
|
|
|
PIEBALDconsult wrote: For you, maybe
They're not that way for everyone?
Do tell.
|
|
|
|
|
Greg Utas wrote upthread: I think this is C++, so it should have been posted in that forum
Not only that, this would be a QT question, and should probably be asked in a QT specific forum.
Maybe you should get a copy of "The C++ Programming Language" by Bjarne Stroustrup, which covers the language in depth by the person who invented it. If there's nothing that even remotely related to your issue in the book (hint, there's nothing about QT in there at all), then you probably want to ask somewhere that's more relative to your question. Also, consulting the book and reading some of the chapters cannot but help you with your understanding of the language. There's a lot of stuff in C++. I'm sure others here also find that particular book a useful tool. It's not unknown for me to wonder "Wait, how does that work again?" and dig through and not only find the answer to the question that I was asking, but find alternate ways of solving the problem, sometimes in a much more elegant fashion that the approach I was considering. IMHO it's worth the cost.
This isn't meant to be a rant at you. Just a suggestion about how to improve your C++ knowledge, and a gentle reminder that the users here may not be experienced with QT, so QT specific questions should posted on a forum that caters to QT. Likewise for gtkmm or WxWidgets or any other framework that are not part of the core language.
"A little song, a little dance, a little seltzer down your pants"
Chuckles the clown
|
|
|
|