David Gillette

Greenhorn
+ Follow
since Mar 12, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
3
Given in last 30 days
3
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by David Gillette

I don't know the parlance of the mathies. I'm not making any technical sense. I'm just a simple greenhorn, but I'm trying communicate this thing and I do appreciate your patience while I blunder through it.

I don't want to get caught up in trivialities such as what exactly log(x) "is", as far as java is concerned it is nothing more than a static method in the math class. The question I was attempting to ask is about the type of calculation process that is involved in solving a logarithm. Plus when you use ""is"" all I can think about is this: https://youtu.be/BS-cip2brsg?t=14



From what I understand (and that isn't much), the calculation of a logarithm requires some type of iterative work. You directed me toward Gauss and his unique way to calculate the sum of the series of the first 100 integers. That was very interesting. It makes me think that there might be a way to calculate a logarithm in a manner that doesn't involve iterative work. Do you know if this is possible? Is there some truth statement that says something like, "the sum of any series or iterative calculation process can also be solved through an algebraic generalized form which does not utilize any type of iterative process"?
The "guts" of a logarithm is a series. Please don't freak out about this oxymoronic question I'm about to ask: Is there a way to calculate a series without iterative work? Is there a math that can do this? At the bare metal level?
Ok, I just used this thing called the internet to find the change-of-base formula.

The expression would be:

int x = (n > 1) ? ( (int) log10(n) / log10(2) ) + 1 : 1;

That did it! Thanks smart dudes! [hat-tip]
Wow, that is simple, ugh, very humbling.

So you guys are saying the expression is something like

x = (n > 1) ? ((int) log2(n)) + 1 : 1;

But java has no log base 2 math function, or does it?
Example of absurdly simple: lang.Integer.toBinaryString().length() - nothing like that.

It should be like (math.sqrt(some*crazy)/expression-that+I(won't/ever))+figure/Math.pow(out*but, might);
WAIT, not so fast there you cattle rustlers!!! There's a caveat: no iterations, no looping, no recursion, no tables, no lists, nor any such devices which renders the problem absurdly simple. Also, this would for "pure" integers not the java primitive, so for java we would need to include any BigInteger if that makes any difference.

I've been attempting to solve this, but a mathematician I amn't. At first glance, it looked so simple, but I started working on it and everything I have tried has failed.

It's apparent to me--yet may seem foolish to you--the best way to start is to find the mathematical expression that solves the following sequence:

1, 3, 7, 15, 31, 63, 127, 255, 511, 1023...

You can establish this pattern by starting with 1 (n0) and taking the binary sequence element at n+1 and summing them together. The first element of this sequence is 1. The second element is 3 (first element of this sequence plus second element of the binary sequence, which is two). The third element is 7 (the second element of this sequence, three, plus the third element of the binary sequence, four) on into infinity.

So the expression needs to work something like this:

any number less than 2 and greater than or equal to 0 will return 1 and...
any number less than 4 and greater than or equal to 2 will return 2 and...
any number less than 8 and greater than or equal to 4 will return 3 and...
so on and so forth.

The solution would be a Java expression that could produce the following examples:

input: 7
output: 3

input: 100
output: 7

input: 32498531901
output: 36

If there's any math persons out there cringing at my naive attempts to explain and constrain the problem. You have my apologies. Also, if the underlying class utilizes any recursive or iterative techniques that's ok, like I'm sure many of the java.lang.Math functions use iterations of some sort, but that's fine. There just can't be anything like that in the solution expression.
Drinking beer is better than being with 99% of men/women.

Roughly, only 1% of people will provide you with an intimate proximate long-term relationship (deemed compatible) that is preferable to drinking a glass of your favorite beer. It doesn't take much imagination to understand the difficulties in finding a voluntary partner with which we are compatible. How many variables are involved? Genetic, life-style, constitutional, location, paradigmatic, idiosyncratic transient preference, etc. The probability of finding relationship compatibility must be far less than 1%, it's probably at most 0.1%.

This holds true for non-beer drinkers as well. It would still be better to drink beer than to be in an intimate proximate long-term relationship with that incompatible someone. The momentary displeasure of taste would be less than the displeasure of being in an incompatible relationship. The momentary stumble for an ascetic (for whatever reason) will prove less troublesome than a long-term incompatible "trigger" relationship full of strife and horror.

Of those unfortunate souls who find themselves in a tribulative incompatible relationship with one of the 99%, it's common sense that grief levels will far outweigh any possible grief produced by responsibly drinking a glass (or two or three) of your favorite beer. They will probably drink beer anyway, so remove the grief and you are left with a better situation, and you get to drink beer.

I don't see how this would need to be defended any further? It seems self-evident.

1 week ago
Without getting too philosophical, it is highly improbable there is a way to prevent any being with the time, resources, and aptitude from causing any malice. As far as incompetence goes ... well, I have a predilection the confidently incompetent will destroy everything by virtue of unintended consequences. My intention is merely to create a single-step safety mechanism, just in case. (The CIA rejected my application as a developer on grounds of "National Security" by the way.)

Given the application requires WAN access for all of its various functions, yes, the application should check for WAN/Email/website issues and handle those situations appropriately. Good stuff...

Thank you! All of you have been very helpful in refining my thoughts and guiding me, like Socratic Psychopomps, toward a practical approach.
1 week ago
Maybe the following would be a better solution:

1) the application upon startup logs into an email account
2) check for a designated folder (do either 3 or 4)
3) if folder does not exist, this is first run -> run application under first run condition -> create designated folder
4) if folder exists, this is not first run -> check for .ser and do stuff

This approach might be more practical because the email account will be used to store backups and programmatically replace the .ser should it become missing or corrupt.
1 week ago
The application needs to know if this is the first run because after, say, six months the .ser will contain important information against which the new data will be qualified. The .ser is a basic CRM database and will contain some metrics and flags for contacts. Continuity of data needs to be maintained for each run to cultivate a professional relationship with contacts. For example, the CRM has an exclusion flag and time stamp information on each object to track things like a hard bounces, requests for no contact, last contact date, and so forth. This is why after a first run, there should be a trigger that alerts the application to stop in the event the .ser file is missing or corrupt.
1 week ago
Thank you all very much for helping me think this through.

I believe I've found, an ugly, but simple approach:

1) drop firstRun.txt in the .jar
2) check for presence of firstRun.txt ( do 3 or 4 )
3) if firstRun.txt exists, this is first run -> run application -> when finished send timeout cmd command to delete firstRun.txt -> exit application before timeout ends
4) if firstRun.txt does not exist, this is not first run -> check for .ser and do stuff

Any thoughts? Is this the worst thing you've ever seen?

There must be a more sophisticated way of doing this...
1 week ago
What do you think would be the best or a conventional approach ... if an application needs to know if this is the first run and needs to track that information inside the .jar?
1 week ago
Is it possible to write to something inside the .jar, like an .ini file?
1 week ago
Or, more so, what should be used so that the application:
1) Knows if there should be an .ser file?
2) Makes one .ser file that is "strictly" associated with this specific instance of the application?

I'm fairly certain that's what I'm attempting!
1 week ago