|
Interesting, but I have some doubts it is still relevant with modern compilers and CPUs. Even if it were, a simple lookup table would be faster for the purpose of finding the first estimation.
This algortihm reminds me a bit of Bresenham's line algorithm - Wikipedia[^] : extremely clever, but once it was hard-wired in every graphcs chip there was little point knowing about it. Except maybe to apply such principles to similar problems in other areas.
E. g. I tend to do calculations with 2D and 3D vectors a lot, and if I were to do these calculations straightforward, then yes, I'd need to do a lot of vector normalizations (i. e. calculations of 1/sqrt(x)). But in about 8-9 out of 10 cases I can avoid normalization alltogether by transforming the expressions. E. g. when I want to know whether a vector length is very small (effectively null), then I compare the squared length against the squared threshold value. Or when I calculate the intersection of a plane with a line, I determine the intersection without normalizing any vector. Instead I transform the equations in such a way that I end up with the squared length of the line direction vector, and the plane direction or normal vectors don't need to be normalized at all.
I do agree that the explanations and specifically the animated number representations are formidable, though
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Found this great tip in a Dutch computer magazine:
Quote: You might have some (network)devices that have leds on top to display their status, which might not be visible when tucked away somewhere. To make the leds better visible from a distance take the balls out of some deodorant rollers and place these on top of the led lights
|
|
|
|
|
Or you might have one like my AC1750[^] that puts up a light show like a Christmas tree. The solution is a piece black electrical tape.
Come to think of it, deodorant balls and electrical tape might be, for light problems, what duct tape and WD40 are for mechanical design
Mircea
|
|
|
|
|
To put it in the words of CodeWraith:
Quote: May the duct tape be with you!
|
|
|
|
|
If you just want to disable the nightlight feature while still having statuses visible when needed, I've found LightDims a good solution.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
|
|
|
|
|
How easy would this be to set up?
Oh - no sweat!
If you can't laugh at yourself - ask me and I will do it for you.
|
|
|
|
|
Just don't buy them from a Swedish chemist[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I recently attempted for the first time to ZIP some files I was surprised that each file and directory I selected was placed in the base root of the ZIP file I naively assumed the ZIP program and I have tried several to wit 7-ZIP Zip Free WinRAR and WinZip would place them into the root which is common to them all I utilized the Relative Paths setting for each entry I required this common root arrangement because these are source files utilized in a Visual Studio solution so their paths relative to each other needed to be unchanged The solution I finally decided upon was to copy each of the target files into a separate common root directory and then to simply emplace this directory into the ZIP file and Voila it worked However I still believe it is stupid to be required to do this So either I do not understand how to distribute software using ZIP or people have been enduring this copy requirement w/o complaint If that is the case I am fantasizing of writing a ZIP program which provides the option of calculating the common root so there is no need to perform the aforementioned copy So I seek your advice in telling me what is wrong w/ my fantasy Thank You Kindly
|
|
|
|
|
When did your '.' key break?
|
|
|
|
|
Lecturing:
PaltryProgrammer wrote: So either I do not understand how to distribute software using ZIP Let's agree that you don't distribute software using ZIP. You might send it to a friend, on a very occasional basis but software distribution is done using other, more appropriate tools like NSIS or something similar.
End of lecture
The quick way I zip a tree is to right click on the root folder and "Send to -> Compressed (zipped) folder"
Mircea
|
|
|
|
|
Thank you for informing me of NSIS Maybe it will come in handy However the purpose of my ZIP was to provide project files to Visual Studio support for the purpose of duplicating an apparent error in VS rather than the installation of executables which NSIS seems to be utilized for Thank you also for informing me I need not have purchased WinZip - Cheerio
|
|
|
|
|
I can recommend Inno Setup, see: installers-for-windows-programs[^]
Sadly I was forced to write an installer in C# that uses .zip files, felt like re-inventing the wheel
|
|
|
|
|
Good point .. I use it for about 10 years now for all kinds of deployments. Tolerance to Pascal is handy in this case, it was stimulating for me to look deeper into Pascal, which is interesting ...
|
|
|
|
|
|
I used SharpZipLib to compress some files into folders.
Creating a ZipEntry with a relative path (e.g. Info\readme.txt) would create a readme.txt file in the Info folder. You would then write the file contents to the zip file.
Good luck getting something working.
|
|
|
|
|
I think there is a good answer elsewhere, but if you find yourself doing this repeatedly where you want to exclude sensitive data files, etc.
For extremely complicated inclusion and exclusion rules in a folder hierarchy, the very old Ant build <jar> and <fileset> tags let you build powerful inclusion and exclusion rule sets with recursion to build a jar/zip.
You can use macros or templates for standard cases to generate the filesets.
|
|
|
|
|
I was making a state removal method that would turn a state machine into a regular expression.
In the process I needed to do a subtask, to wit, I needed to set up a quick and dirty finite automaton engine to hold the states.
Rather than make a bunch of objects/states that point to other objects/states using dictionaries, I simply stored all the dictionary transitions as a single tuple (int from, int to, string input) in a flat list.
The result is smaller, and allows me to do complicated queries on the relationships between the states (now represented as simple integers) very simply.
In fact, the result is so good, I may be able to rewrite a more compact and efficient state engine using this technique. And it was originally just intended to be "just enough of a thing" to be scaffolding for my overarching algorithm to work with.
I'm elated. Even if the overarching algorithm doesn't work, it means far more compact and efficient code potentially in terms of the finite automata code it works with.
Real programmers use butterflies
modified 23-Oct-21 14:03pm.
|
|
|
|
|
That reminds me of a third-party product a colleague was using.
It didn't support proper Order-of-Operations.
I said, "it's wrong", and he said, "but it's faaaasssst!"
|
|
|
|
|
Sometimes it doesn't have to be completely right to work for a situation. Honestly I respect code that does just enough to do the job for a particular application - very efficiently. It's to my mind, one of the higher achievements in code such that if you can pull it off regularly you are way more clever than I. I have to respect it.
Real programmers use butterflies
|
|
|
|
|
You're a real innovator!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Accidentally, so. I wish it was repeatable, but when I stumble on something, I'll take it.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: Accidentally, so. Penicillin was accidental too
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.
|
|
|
|
|
honey the codewitch wrote: turn a state machine into a regular expression
That phrase is a bit odd. The way regular expressions work, depending on the match expression, is to create a state machine (and perhaps even more than one.)
|
|
|
|
|
This is doing the reverse of that.
Real programmers use butterflies
|
|
|
|
|
Yes but just want to be clear that although you are using a regular expression it will in fact end up using a state machine to implement that regular expression.
|
|
|
|