Translate

Saturday, November 30, 2013

What value news analysis?

As much as news organizations are fighting with the issue of revenue, along with plenty of others trying to figure out how to make money in our modern web age, I think it fascinating to ponder how news makes sense.

For instance, in our modern world, news travels fast.

And as a baseline I'm going to use the 2012 election year in the United States to make some points. For instance, how long did it take for results to travel? And did we have to have news agencies do it?

Reality is that when it comes to important news which matters to a lot of people they will spread it fast, and while I'm sure lots of people got their results about elections outcomes directly from some news organizations, others may have heard it, like, even shouted at them excitedly by someone else avidly watching.

Doesn't take much to say, this person or that person won or lost, right?

So why should we pay for it?

But what about the 'why' of the news?

Trying to explain the why of events, unlike reporting itself, is a thing called news analysis!

Twitter lets you embed tweets which is something I've found could be useful, and it has relevance here as I have an opinion, which I voiced on election night. Here it is:


So there is this record of my opinion, with a date and timestamp, where looking at it now (and how else would I have remembered as I didn't care a lot at the time), which shows I put that tweet out November 6, 2012, at 5:44 PM PST. And I just favorited it. I favorite my own tweets to keep up with, yup, my favorites, like this one.

That is not news--it is news analysis. And it's JUST an opinion, which happens to be mine.

Is it true? I don't know.

However, unlike the news itself which travels rapidly, news analysis has a value which does not evaporate over time!

Isn't that weird? If I'm correct, then it still matters today, maybe even more than it did back then, as there are more elections coming up!

But who knows?

Time will tell.

When I look over the world of media outlets I am impressed not so much with breaking news--even though it still has a LOT of value but that value fades quickly as the news progresses--but with analysis, which is the key differentiator in my opinion.

And news analysis-- unlike breaking news--gains value over time if correct!

That's where the money is, in my opinion.


James Harris

Wednesday, November 13, 2013

Why not problem solve health insurance?

Growing up I was fascinated by the fictional character Spock on Star Trek. His obsession with logic fascinated me, and lead me to the library where I was disappointed by the reality of how logic is taught. Nonetheless I have remained interested in the subject and with problem solving as well, so I find it weird when I come across relatively simple analysis in big areas, where logic dictates.

Like health insurance is a major issue and in the US it has been problematic to properly provide it for our citizenry for quite some time. So I sat down some years back and analyzed the problem space and came to some simple conclusions.

And I concluded that if you boil down all the debate in the US around health insurance it is just about who pays.

The way insurance is supposed to work is you insure against risk by pooling funds in advance of it.

If a person is sick then they have already incurred risk.

It's like, if you already wrecked your car then you can't exactly insure it, correct?

But what if a wealthy uncle pays for your car to be fixed anyway? Well that's not insurance, it's charity.

So it's impossible from the business side to "insure" people when you are actually giving them charity if they are already sick. But from society's perspective it's important to give them that benefit, and insurance companies are the best at delivering payment on claims as it's their business.

But they don't have to be the ones actually paying.

For instance a wealthy person can hire an insurance company to administer claims made against him, even though he is actually paying out, because he lacks the experience to process the claim.

For instance, his chauffeur might run his vehicle into the back end of someone's car. Should he hire lawyers himself and fight the case in court?

What if instead his insurance company handles it, and determines that the accident was engineered because they've seen such things many times before? And they also determine that the supposedly injured party is in the database as someone who has been in many such accidents and is merely a con artist?

How would the wealthy person know on his own without the insurance company's help? He might get lucky and figure it out. And hire attorneys who could figure it out, and properly fight the case or he could end up taken as he does not have that kind of information and why would he? For instance, he couldn't have a database of insurance claims to search on to find the name of the person who had engineered such accidents in the past!

How does all of the above relate to health insurance?

Well, what if? What if the US Government or some other government entity paid for people who aren't really insurable, but the health insurance companies administer? Just like with the wealthy person example above you get the benefits of their expertise but someone else actually pays.

Years ago I put it all together in a tweet of exactly 140 characters:


Part of the way I use Twitter is to store ideas. And now it's easy to put them back up later by embedding the tweets, which I think is an efficient way to propagate the information.

If that tweet doesn't make sense you can read it all explained on one of my blogs:

lostincomment.blogspot.com/2009/09/my-healthcare-plan.html

I've explained in various ways since then, but I like showing how long I've had this approach out there.

I feel confident that eventually something like it will be the way health insurance will work in the US, but getting there will take some time.

Why? Because unlike the fictional Spock, who loved logic, politicians tend to love other things. As things play out in the US along a predictable path, it will take some time before people get frustrated enough with how things are done to do them better.


James Harris

Saturday, October 05, 2013

My concept of the Infi

A few years ago I started mumbling to myself about the Infi--the INFormation warrIor.

Totally a knock-off from the Jedi from George Lucas, of course. And such a fun idea.

Mostly I've tweeted about it, but thought, why not put something on one of my blogs too?

The idea is that today you have these people who operate in cyberspace as individuals who can really shift things, so it's like real-life Jedi but their powers are not about the physical so much as about wielding information through the modern web. So I call them Infi.

Like Julian Assange would definitely qualify I'd think as an Infi with this concept. And so would PFC Manning, and Eric Snowden.

So are they good or dark adepts?

No point in asking the current Executive Branch of the US Government which may wish to think one thing, but unfortunately there are times it can seem to be like the evil Empire of Star Wars, remarkably enough. Change from such behavior would be a good thing.

Actually it's very weird how much our modern world can be paralleled with the vision of George Lucas, where you may note there were senators and dark political intrigues.

The Jedi moved through this world as remarkable individuals able to change things on a galactic scale.

Today there are individuals who can stand against entire nations, thanks to the power of the web, who live a life that is so far definitely rivaling fiction and even inspiring it.

Possibly we are moving into a different world, with the rise of the Infi.

Here's a tweet I made a couple of years ago:


If so, I suspect it will make the imaginations of even the greats like George Lucas seem not quite up the task of a world where speed, information, and change can happen in battles in cyberspace that can engulf a world, where many people are barely even aware of them.

But their lives are changed regardless.

Here is one of my favorite tweets from me playing around with the idea. I don't take it too seriously. But at one time I thought I would be a science fiction writer but now mostly just muse about things on my blogs.

Still that urge to be dramatic is still there:


To a better world.

And, again, I'm not taking it all too seriously. I'm just a guy who loves to play with ideas. And my concept of the Infi is just one of the fun ones.


James Harris

Sunday, September 22, 2013

Should Marvel go "Rogue"?

Having been a big comic book fan in the past I feel gratified by a lot of movie-making which has finally done the job needed for handling a fantasy reality where superpowers rule.

With that said it occurred to me that I have not seen a movie with the lead from one particular superhero who could, I think, handle the massive weight of a major motion picture all on her super-powered shoulders and that is Rogue.

Movies with female leads have been showing their box office clout, while Wolverine has shown that there is still room for other often singleton superheroes along with the perennial favorite Spiderman.

As a female lead superhero few are in the range of Rogue.

So should Marvel--or someone who has the insight and power--go a movie about Rogue?

(Assumed they have the rights to do so, and finally stumbled across indications they do not. Shows what I know about licensing issues around these characters which is admittedly not much! Will leave the post up though as, why not?)

I think they should.

Rogue can hang with the best of them at her maximum, while she has the vulnerability in character and in her story that can make her appealing to a wide audience. She can not only fly, punch, and hurl cars with the best of them, but she also has to deal with her root ability to steal superpower or memories or life energy.

Of course modern movies are massive investments, but hey, it's the web so I can express my opinion. And maybe some people with clout have already realized the above and there is something in the works.

If so, great thanking you unknown people who help bring the Marvel Universe to life on the big screen!!!

You continue to impress me.

If not?

Go Rogue.

And give us more. And it better be great. Her character deserves nothing less.

I am a HUGE fan of the Rogue character. I am certain there is a lot of strength and power there which is the raw material needed. Getting it right is the job of others.

There are few if any minor heroes in the Marvel Universe.

There may be too many writers and directors not up to the challenge.

Get the best, and make them deliver.

Thank you for your time and attention. And, um, that's it.


James Harris

Friday, September 06, 2013

Back to software development

Back in 2002 I voluntarily left a position as a software developer at a major corporation. At the time it seemed like a great idea. Now over a decade later, I'm not so sure.

But back then I was serenely confident in myself and very naive about important things in the real world.

So I thought I had a duty to concentrate on what I knew then (and know now) was a major mathematical find. And that find is what mathematicians call a prime counting function, but which I've now found may be more commonly called a prime counter.

As my backup I also had an idea for a little app which was a tool for Java developers to check out basic class information. It was evolving from some test programs I'd written to help me study for the Java certification exam.

Besides, I felt confident that if necessary I could easily step back into the computer field considering how well I had been doing. I had been a lead developer. I had lots of experience with plenty of people recognizing my abilities.

So yeah, I was supremely confident and soon in for a shock.

Despite my ability to prove without a doubt the importance of my mathematical find, I got nowhere with mathematicians. And learned that they don't particularly feel motivated necessarily to help out someone like me. I'm not a mathematician. I'm just some guy who found this thing. Academics are not like what I thought.

But I'd been through adversity, I thought. I grew up as a black kid in the American South. While I think I got a lot of support from my rural South Georgia community, across races, I have to admit standing out as someone who went on to college on a full tuition scholarship and got my degree in physics in four years.

I'm used to finding my way.

But now I'm willing to admit--more than 10 years since my find--that academics have me stumped. I've since made more mathematical discoveries and come to the conclusion that I'm finally facing the greatest challenge of my life in getting any of it academically accepted.

Eventually after that pivotal decision of leaving my comfortable software developer position I found myself in San Francisco, and pondered trying to get back into the field then. That was in 2005 when I moved to California, and ended up, instead, working as a data entry person at a large insurance company.

But it paid the bills, gave me time to enjoy myself in the city, and left me time to focus on my continuing struggles with mathematical recognition, and with my various blogs or other online efforts.

I kept thinking: soon, soon, something will work.

And my open source project which I'd belatedly put on SourceForge in 2004, was still out there as a puzzle, and also as my continuing link to the development world. But I struggled with what to do with it, and wondered if it was even worth the effort.

Today I've given up on courting mathematicians for formal recognition and gone more to the long-term, which is just put the information out there and win in the court of better ideas. Meanwhile I've begun to accept that it's probably a good idea to focus a bit more on a job that actually pays well, as nothing else has come close to how well I was paid, now seemingly long ago, working as that software developer at that major corporation.

Now my open source project Class Viewer is critical in that effort, so I'm looking at it more critically.

Oh yeah, actually got laid off from that data entry job in San Francisco, which was a major blow to my ego. The nerve of those people!!! And then focused more on web efforts, pushing math ideas, and other ideas until I exhausted my naivete and delusions about how the real world works.

Ideas do not necessarily move the world.

Products DO, and groups of people DO.

Individuals with ideas who push them often get called nasty names, and make no money.

That making no money gives you a fascinating thing called--perspective.

It also gives you lots of unpaid bills. My apologies to creditors! I still plan on paying you all back.

My problem is that I don't like to lose. Dogged determination can carry you far in life, or leave you high and dry against a problem you can't seem to solve.

The idealist in me though believes that my actual failure was believing in some people who did not live up to great expectations, but the realist in me realizes that can be just a fact of life.

Great expectations may make a great novel title, but are not necessarily the most pragmatic views.


James Harris

Wednesday, September 04, 2013

Why do we still use passwords?

I like puzzling over really dumb things that lots of people have to do, because it amuses me. And one of the stupidest things we all still have to do is use passwords, but why?

Early on, back when there were debates over whether or not "personal computers" were even worth having, as the web began to emerge, it was simpler to use passwords for access to sites. And the username and password way of operating took over.

But it's a dumb way to do things long-term.

People forget the darn things. Or re-use them endlessly. Or get infuriated when they have to come up with new ones on a schedule. And, oh yeah, computers are fiendishly good at cracking them.

But what to do? What else to do?

Why not use keys?

People don't use a username and password to start their cars, right?

Would you use a username and password to get into your house?

I wouldn't. I like keys just fine.

So how do you use keys instead of passwords?

The simplest is a dongle type device that plugs into a USB port with a unique and cycling identifier that runs through a key service. The key service tells people that you are you.

So, for instance, say Mozilla or Google were to provide a key service--or some other organization if you don't trust either of them--then they'd be the ones to tell a website who you are.

They just need to be sure you--are you.

So they would just need a way for you to tell them, which is what that device that plugs into your USB port would do.

And you can keep it, where?

How about on your key-chain?

(That's where a lot of people like to keep their keys. I think it's a decent place. Very familiar.)

How do you cycle it?

How about using the time of device connection?

That's a simple idea I gave away years ago after I failed to get a US patent on the concept which infuriated me, and earned my contempt of the USPTO from then on.

I think the USPTO is stupid. (Maybe I'm using words like "stupid" too much these days but the password thing is way past stupid into endlessly annoying.)

So, like, there's an algorithm that shifts a code on your "key" whenever you connect it to the key service.

The way it works is your key keeps up with how long you're connected because it has a timer and the service keeps up with that connection time too.

So your key calculates its new code after you disconnect and the service does as well. They both know how long you were connected, so each has the critical information. That time of connection is a number which can be pushed through shared formulas to generate a code. So you can endlessly generate codes, replacing a static password, or one that changes every 30 days.

With this idea, you send--by using your key--a new code with each connection.

Here notice that both your device and the key service have a useful bit of information which as far as I know is mostly just thrown away all the time on the web.

They BOTH independently have the time of connection.

It's called SHARED INFORMATION and my idea leverages such information. Simple.

If someone copies your key, and tries to be you, they start generating new codes, and then when you try to be you, the service starts howling as your codes are wrong. You can't both be you at the same time. So, you know you've been hacked. They know you've been hacked.

That simple technique is unbreachable, as long as you eventually use your key again.

If they just take your key then it's just like other situations if people just take your key. If you never use your key again, and they copy it, then it's also like if they just took your key. So technically the technique ensures only one key user is allowed with it impossible for duplicates to co-exist without detection.

I can prove that through logic because I'm really smart.

Our current system is really STUPID.

Do you think I used the word "stupid" enough in this post? I don't. I'd like to use it a bit more but I'm trying to be polite.

Our world is so much worse off because there are people who think they are highly intelligent who insist on ignoring ideas that can make our lives easier while requiring we do STUPID things like use usernames and passwords.

Ok, I feel better now, got one more in there.

So why is my idea a key while username and password is not?

Because your physical keys are unique to you. Yes, others MAY copy them, but it's not like you will not find out. Or probably will find out if you're smart about it, and oh yeah, I digress...they need your physical key to copy it!

Physical keys are awesome things which people should appreciate more, so we can move those key principles to the web.

When you think it, then it is possible it can be done.

If you can't think it, then how can it be made real?

With my idea someone wishing to steal your key needs your physical key to copy it--as the codes it generates shift all the time--and even with it, they may find it hard to hack the freaking thing and copy it. But even if they do, if you get it back, and use it, their copy is now worthless.

So it's actually better than a normal key.

If they just copy a current code from your key as it flies across the web, then they got NOTHING.

Oh yeah, and why give ideas away for free?

Because I don't like the USPTO and I STILL don't like them despite recent legislation.

What we lose is innovation as big corporations have the power to push their ideas through, while others can just keep using usernames and passwords indefinitely because in my opinion big corporations rarely push the best innovation.

(But they do have big legal departments so tread carefully in saying nasty things about them!)

Our world is changed by blocked innovations where people lose more than they often realize because they have no clue how much better things could be.

And that is just sad.


James Harris

Wednesday, August 28, 2013

Print on demand and the post office

People can wonder why problem solving is not enough to get things changed, so I like finding real world examples which are FAMOUS to help get perspective. So, for instance the US Postal service is having well publicized difficulties.

And it turns out I actually first put out a post trying to help them three years ago back in August 2010.

My original idea talked about scanning a letter at the post office but the concept boils down to print on demand for an electronically sent document.

And here we are three years later and it's worth talking about some more. And three years isn't a long time in the world of ideas. Typical time frame, remarkably enough, is 20 years in the old world. Don't believe me? Then read then the Wikipedia article about sliced bread.

I'm thinking things can get a bit faster today, though the problem isn't just getting the idea out there. People can get stuck in their ways. So the real problem is shifting them out of their comfort zone, into recognition that the suggested change is a better way to go.

Now then, with the new idea, if you print out a letter at a regional center closest to where the letter is supposed to go, you shorten the distance a physical thing is carried, allowing cyberspace to help out by transmitting the information.

So the idea would be to let you deliver a physical letter through cyberspace by having print on demand local to the delivery location removing the need to transport a physical letter all over the place when you just wish the information in a PHYSICAL letter to be delivered, so for instance it gets a postmark.

Notice that also is another way to possibly do next day delivery for people and businesses who don't care if someone else prints and stuffs their letter into an envelope for them!

Print on demand has been around for a while, and I'm guessing there is machine envelop stuffing available.

And the post office could charge a premium for the service which could let people pay bills overnight, using their debit cards of course, to have a postal money order stuffed into there too! Or you could send money to a relative quickly, and I don't know what the post office can or cannot do, or whom they can or cannot compete with, but that is for the US Congress to work out.

But regardless, imagine mailing a physical letter to someone you need to contact, by the next day, by emailing it to the post office which will print it out, stuff it into an envelope and deliver it?

Or postcards! What if the post office printed out post cards on demand instead of shipping them around the globe?

Do I believe this will be possible some day? Yes. For all I know there are post offices in other countries already doing it.

Would I like to have it now? YES! I'd love to be able to send a physical letter, with that wonderful thing called a postmark, by emailing the post office or using some online form, and paying for it all online.

I actually trust the US Post Office. It is one of the most trustworthy government institutions.

I think a lot of other people trust the US Post Office as well, and feel SAFER with it than with using other sources, and also, yup, again, get that often critical POSTMARK.

New ideas can seem weird to people at first. But so did sliced bread. Someday I think people will puzzle that there was ever a time in an advanced, technologically savvy country that the post office didn't allow people to electronically send in letters to be physically printed out and delivered!

They'll wonder how such a simple idea could have taken so much to be implemented.


James Harris

Friday, August 02, 2013

Why talk math here?

With several posts now focusing on math results, some might wonder why I'm doing it on this blog, and I wonder as well! And I figure things out at times by typing up a post, as I like to think out loud, so here is a post where I try to explain it.

Best way is to put up a math result which isn't mine, and is ancient so I can talk around it, and what it means to me. I've posted about it before, so the information is already been put up, and I'll repeat to explain more about my motivations.

The equation in focus is x2 - Dy2 = 1, in rationals, which means you have fractions, so to program a solution to it that I'm about to give you need to use doubles.

Turns out you can solve it parametrically, which just means you only need to change one variable:

x = (D + t2)/(D - t2)

and

y = -2t/(D - t2)

So if you have a value for D, then you just shift t, and that gives you x and y.

Cool. Makes solving the thing with fractions--not integers--nice and easy.

And if that all seems strange, like why would you want to solve it parametrically with fractions, well notice that with D = -1, the first equation is the circle: x2 + y2 = 1

And, yeah, people have reasons to solve for circles, right? So what does D do? Well it shifts things around between ellipses, which includes the circle, and hyperbolas. So with it negative, you have ellipses, while with it positive, you have hyperbolas, and D=0 is worthless, as that just gives x=1 or -1, so we don't care about it.

That result has been known to humanity for over 340 years, which I say because Pierre Fermat, who is a famous math dude, knew about it, and he has been dead since 1665. And I noted the above when I posted about it before, so why bother mentioning again now?

Because I never heard of that solution for x and y, until I had re-discovered it myself, got all excited, ready to run off and BRAG, and found out it had been known for centuries. But I had to dig!!!

So why isn't it a standard result, routinely taught? The circle paramaterization IS routinely taught, and is, again, when D=-1, and you have:

x = (1 - t2)/(1 + t2) and y = 2t/(1 + t2)

And you can go look that up to verify, but the earlier result? Wasn't so easy for me to look up and find it, and I think it's a cool result and wish I'd had it years ago when I played around with programming things like drawing circles, and other things.

People who write computer programs appreciate parametric solutions as you can focus just on what matters, and here, the focus is on D, and you don't have to play with square roots, or all kinds of others things, and yes there are parametric solutions for ellipses or hyperbolas, but here is ONE for both of them!

Efficiency. I like efficiency.

And why isn't this thing regularly taught?

Well I have theories, and my best guess is most modern mathematicians don't care about practical. And to them it's a useless little thing, which they don't think is worth discussing!

But I like practical. I don't care if mathematicians like talking about something or not. I like to DO things with math, as I'm a practical guy who codes for a purpose.

When I write a computer program I want it to DO something. I really don't care if some academic somewhere thinks that a tool I'm using is exciting to him or not.

So I talk about it because it's interesting to me, and I think it's a cool tool.

Which is why I include math results that I think are cool tools. They have a purpose. You can DO things with them, like count primes. And they're simple! I love simple.


James Harris


Friday, July 26, 2013

Power of simpler math

I found one of the best mathematical results in human history which is a simpler way to reduce things called binary quadratic Diophantine equations. That is, equations that look like this general case:

c1x2 + c2xy + c3y2 = c4 + c5x + c6y

where x and y are the unknowns to be figured out. A simple example of such an equation is:

x2 + 2xy + 3y2 = 4 + 5x + 6y

where I've simply used,  c1 = 1, c2 = 2, c3 = 3, c4 = 4, c5 = 5, c6 = 6.

With my simple example above I can reduce to a simpler form using my own research to get:

(-4(x+y) + 10)2 + 2s2 = 166

Now you can solve for x+y and s, and it's easier to find that s = 9 works, and x+y = 2 or 3, and x = 4, y = -2 is a solution. To see me work through in more detail, click here.

Now you may say, so what? Well, turns out we can immediately use this thing to get a simple result previously unknown before I discovered it, which is one of the greatest math finds of all time, and we're going to use it for some simple math trivia and approximate the square root of 2 with it.

And I start with a simple equation:

u2 + Dv2 = F.

And with my general method to reduce binary quadratic Diophantine equation we can find that:

(u-Dv)2 + D(u+v)2 = F(D+1)

And I'm now going to let D = -2, F = 1, since we're going after the square root of 2, and to make the equation look like a more familiar one I'm going to shift variables with: u=x, v=y, so my original is now:

x2 - 2y2 = 1

And now I can crank through my result to get:

(x+2y)2 - 2(x+y)2 = -1

And it's iterative! So I can do it again and again:

(3x+4y)2 - 2(2x + 3y)2 = 1

Next is:

(7x + 10y)2 - 2(5x + 7y)2 = -1

And iterating one more time:

 (17x + 24y)2 - 2(12x + 17y)2 = 1

And the more astute of you may have noticed that x = 1, y = 0 is a solution to the original equation, so guess what? We've solved the original equation as well with JUST my research result. Using that on the last:

(17)2 - 2(12)2 = 1

And we can still iterate, but let's do it now with just the numbers.

So now for another iteration: x = 17, y = 12,

so: (3(17)+4(12))2 - 2(2(17) + 3(12))2 = -1

Which is: (99)2 - 2(70)2 = -1

And that gives the slightly more impressive approximation of 99/70 is about: 1.4142

And if you're bored you can just keep going! Where now x=99 and y=70. And it works out to infinity with ever more precise approximations to sqrt(2).

Next one is: x=577, y=408, and 577/408 is approximately 1.41421.

Why do these solutions approximate the positive square root of 2?

Because x2 - 2y2 = 1, is:

(x2 - 1)/y2 = 2, and you can just take the square root of both sides now:

sqrt(x2 - 1)/y = sqrt(2), so the trick then is that approximately x/y = sqrt(2).

And x2 - 2y2 = 1 was used over a thousand years ago, and one of its uses was, yup, approximating square roots, and I wonder if I'd have been cheered if I showed some of the ancients my simple result above?

I've used my result with much bigger things though.


James Harris


Tuesday, July 02, 2013

Class Viewer troubleshooting advice

Update July 3 2014: There was a change to how javadocs are accessed in Java 8. The latest version of Class Viewer dated July 3, 2014 addresses this change with backward compatibility for earlier versions. If you are not getting javadocs to the method please upgrade to this latest version.

-----------------------

A great thing about writing applications in Java is how well they can move around the world, across platforms. And for the most part my Class Viewer application can be used on any platform with Java, but it does do some things that are platform dependent like call your web browser.

Configuring for your system is all in ClassViewerConfig.xml which is where the app goes to see how to do such things. And I just edit it with a text editor.

If you run into problems with my Class Viewer, my guess is you likely need to make a change there.

For the browser and text editor everything is conveniently at the top with the BrowserLoc and Editor sections.


<browserloc>C:\\Program Files\\Mozilla Firefox\\firefox.exe</browserloc> <editor>C:\\Program Files\\gedit\\bin\\gedit.exe</editor> <acceptslinenumber>Yes</acceptslinenumber> <parameter>+</parameter>
Which is what I have as default for systems with Microsoft's Windows.

And if what's there doesn't work then change it to something that does.

If you have a different browser you just change BrowserLoc, and same for your text editor.

If what you try doesn't work the app will put up an error message telling you what it tried.

I ran into a problem recently out of the blue where Windows wanted quotes before it would call gedit, and I have no clue why and don't care. I just added the quotes and it worked. So I had:


<editor>"C:\\Program Files\\gedit\\bin\\gedit.exe"</editor>The default for Linux users is:
<browserloc>firefox</browserloc> <editor>gedit</editor> <acceptslinenumber>Yes</acceptslinenumber> <parameter>+</parameter>
Where it's simpler, and thus easier to change to your own preferences.

But I'm just helping people with those operating systems use Class Viewer while anyone who can run Java just needs to put in what will run on theirs.

Most troubleshooting issues I've found go back to what is in your ClassViewerConfig.xml, or your classpath.

As usual with Java make sure you have the classpath you need to get to programs you want.

You can check your classpath in Class Viewer to know where it is looking.

Any others having problems not covered here? If so, please comment, and I'll try to address any other issues.


James Harris

Updated: Changed packagedirectory.xml to ClassViewerConfig.xml--June 28 2014  __JSH

Saturday, June 29, 2013

Diophantine modular solution

So I have math results that I've had for YEARS and it has occurred to me that maybe some of them might be of interest on this blog. And here's one where I found something so simple it puzzles me if it's not known already.

Consider x2 - Dy2 = F with all integers. Turns out I found there is a very easy way to solve for x and y modularly.

Given x2 - Dy2 = F where all variables are non-zero integers, with a non-zero integer N for which a residue m exists where m2 = D mod N, and with r, any residue modulo N for which Fr-1 mod N exists then:

2x = r + Fr-1 mod N

and

2my = r - Fr-1 mod N

It is EASY to derive so you may see if you can figure it out. Or you can see it derived here.

That result gives solutions to x2 - Dy2 = F mod N.

This thing is so simple I find it hard to believe it's a new discovery. So I'm emphasizing that and also still looking for it elsewhere. I think it's simple and cool though, even if it's just another re-discovery.

I do wonder if you could use it with, say, factoring, but haven't noticed anything about which I'm sure. And I think part of me just kind of just wants it to be important, you know?

But then again, I don't know if you could do much with it either. So it's just this thing I have and wonder about once in a while.


James Harris

Saturday, May 25, 2013

Hyperbolas and ellipses with one equation

Sometimes you don't discover something new in math. Actually, it's really hard to discover something new in math as people have been kind of busy, and I have a result I like which I rediscovered a few years back.

It is a way to get hyperbolas and ellipses with a single equation.

The equation is x2 - Dy2 = 1, in rationals, so to program it you need to use doubles:

y = -2t/(D - t2)

and

x = (D + t2)/(D - t2)

and you get hyperbolas with D greater than 0, and ellipses with D less than 0, and the circle when D=-1, giving the well-known circle parameterization:

With x2 + y2 = 1: y = 2t/(1 + t2) and x = (1 - t2)/(1 + t2)

So yeah, you can just draw an ellipse or a hyperbola by incrementing t, which gives you x and y. Easy.

I like easy.

When I came up with my own solution for x and y with a parameter, I was shocked to discover that I was so far off from the time of the initial discovery that Fermat himself knew the above.

And Pierre Fermat died in 1665. So he's been dead for over 340 years.

Turns out it's really hard to find something new in math. No big deal though. I also like rediscovering things too, as it's fun!

So you can use a single equation for hyperbolas and ellipses, just by shifting that thing D, and yup, if you remember your trigonometry--or is it algebra?--that means that D has to be connected to eccentricity. And if you're really smart, figure out the equation that connects them directly to prove your intelligence.

Now, derive the equations yourself. If some dude centuries ago could do it, why not you today?

I did it. It's not all that hard actually, and might be a fun exercise to test your limits with something easy.

See! Isn't math fun?


James Harris

Saturday, May 18, 2013

Simple and fast prime number counter

One of my favorite discoveries is one of my most innovative. It counts prime numbers. Here is the algorithm version. It uses a much smaller list of primes to count a much bigger number.

With positive ints or longs--where pj is the jth prime:

P(x,n) = x - 1 - sum for j=1 to n of {P(x/pj,j-1) - (j-1)}

The P(x,n) function will count primes up to and including x, if n equals the count of primes up to sqrt(x), and if as you iterate you never let n be greater than the count of primes up to and including sqrt(x), if the function receives an n greater than that value it just needs to reset it to that count.

That is the fastest algorithm for counting primes for its size.

For say, the count of primes up to 100, if you tried P(100,10), the algorithm would reset n to n=4, so you'd have P(100,4), because there are 4 primes--2, 3, 5 and 7--up to sqrt(100).

Notice with just those 4 primes you count all primes up to 100.

P(100,4) = 100 - 1 - (P(50, 0) - 0) - (P(33,1) - 1) - (P(20,2) - 2) - (P(14,3) - 3)

Except P(14,3) needs a correction because the 3rd prime is 5 which squares to 25, so that is going too high as it's bigger than 14 and has to be reset to P(14,2). Then I have:

P(100,4) = 100 - 1 - 49 - 16 - 6 - 3 = 25

Those numbers are explained simply enough: there are 49 even composites, 16 odd composites with 3 as a factor, 6 composites with 5 as a factor but no smaller prime as a factor. And 3 that have 7 as a factor with no smaller prime, and I'll give those as it's just three numbers so easy to do and they are of course: 49, 77 and 91.

And you subtract 1 for 1 itself, where the principle is easy enough--subtract composites and 1 to get the count of primes.

Another example is P(10,2) = 10 - 1 - (P(5,0) - 0) - (P(3,1) - 1) = 10 - 1 - 4 - 1 = 4

Where of course the 4 primes are 2, 3, 5 and 7.

There are 4 even composites--4, 6, 8, 10--which are being counted by P(5,0) and one composite divisible by 3, which is NOT even, which is 9, and that count is given by P(3,1) - 1 = 1.

The algorithm is fairly easy to program.

So you need a list of primes up to sqrt(x), so the hardest thing is how you generate that list of primes, which is usually done using the Sieve of Eratosthenes, even for the currently established fastest prime counting algorithms known! But for something quick you can just enter a small list.

For example the first 10 primes are:

2, 3, 5, 7, 11, 13, 17, 19, 23, 29

With that list using the algorithm you can count primes up to 29*29 = 841.

The P function also has to check to see that n is not greater than count of primes up to, and including sqrt(x), where a simple implementation is just brute force, find floor(sqrt(x)) and count primes, for instance for 840, floor(sqrt(840)) = 28, and you can just count up to see that n  = 9, as 23 is the last prime less than or equal to 28.

Notice at 529 = 23*23, you'd still have n = 9, as you go up to and including sqrt(x).

You can actually get clever here as n tries to go greater at a very specific place as you iterate, so you don't actually have to check the square root at each iteration, but am just showing the simplest route to implementation.

To see a recent rather long-winded explanation of how the algorithm is derived and to understand why it works you can click here. No advanced math in the derivation, as you just need to know what a prime is and what division is, as well as some basic algebra to follow it.

The basic idea of counting composites and subtracting 1 to count primes is centuries old.

What's new with my prime counting function is a slight tweak.

I just did one little extra thing that no one did before over those centuries, which makes it more concise, easier to explain, understand and, importantly, implement.

If you're mathematically adventurous you can have it call itself to remove needing to give it a list of any primes, but then it's a lot slower. Run timing tests if you wish to see how much slower. But that is just a lot more recursion, and you can do things to speed it back up, if you're bored.

I've had it for over ten years, so I no longer play with it. Had all my fun with it years ago.


James Harris

Monday, March 04, 2013

Listening to the language

For a while now I've been focusing this blog on my open source project as I think more about it and try to understand what it is, where it is, and where it should go.

One thing that I realized recently while doing these considerations is that it makes sense to just ask a computer language things and Java lets you do that with the Reflections API and Class Viewer is using that to give you information.

So you're asking the Java language and shouldn't all the various computer languages let you do the same?

So, as a developer when I use Class Viewer I'm getting questions answered from the current Java version I'm using, coming direct from the language itself as it talks to me.

And I can ask questions like, if I go to the String class I can ask, if I know how to use the program, which methods take char?

That's my simple example that I like to use as the String class is so familiar. But you can ask so many more questions and just fiddling with things I've been amazed myself at how flexible it is, especially when you use the search field, which will give you inherited methods.

So why not just listen to the language? If you wish, Java will talk to you. And isn't that just really cool?


James Harris

Wednesday, February 27, 2013

Running Class Viewer

My open source application Class Viewer is meant for Java developers, who presumably want to get the best method to write the best code, so they should have certain skills with Java. And one debate I have had with myself is whether or not I should use a universal installer for downloads. But I think that is more than necessary, as I'll explain how I test download.

I usually download the zip file, but do download the tar-ball file at times to test as well, and unzip it. Then I just double-click on the ClassViewer.jar which will run on many systems as it is an executable jar. Things should be ok at this point as ClassViewerConfig.xml should have unpacked next to the app. The app will give you a little message if it cannot find it! I added the feature that it will also tell you where it is looking for the file.

And if the above works, you can just use it immediately, and I like to use the String class as my test case.

And that is what I do with my test download. It's that easy and that fast. Unpack and double-click on the ClassViewer.jar and try a class.

And the above is just for playing around and seeing that it works! If you use the Firefox browser you can do a search for methods and immediately go to the web to JavaDocs, as Class Viewer will call Firefox out of the box. So don't get surprised if that happens! It's totally normal.

There is where there is an adjustment for your browser, which I don't think is reason enough to bother with an installer. To change your browser, open ClassViewerConfig.xml, where I recommend a text editor, and go to the browser section where you will see Firefox, and change it to your browser! Save, and restart the program. Now it will use your browser.

But for the real work, you'll want a full classpath, and when I run it as described above I don't get one, so the primary way I run to get the full classpath is from the command line.

First you need to unpack the code from the Jar file.

That is done with: jar xf ClassViewer.jar

Then you just use the command: java com.jstevh.viewer.ClassViewer

Or some variant on that theme which of course Java developers, the intended audience would know.

Now the program will have the full classpath.

And that is how you get going immediately. I think an installer is more than necessary, where the one area where plenty of people may change things immediately is with the browser, so why not autodetect the browser? I'm not sure. Sometimes I don't remember why I don't do certain things. If there is any demand for that feature I'd see about adding it.

But going into ClassViewerConfig.xml is important anyway, as you will presumably wish to add more packages including your own. So learning how to do it early shouldn't hurt, and I just use a text editor. Open it up, make some quick changes, save it, and restart Class Viewer and back in business.

If you have any thoughts on the above or suggestions, please comment! Curious about whether others feel like I need to give a different experience for users who download Class Viewer for Java.


James Harris

updated: June 28 2014--changed from packagedirectory.xml to ClassViewerConfig.xml  __JSH

updated: May 20 2017--minor edits to improve visual clarity and emphasis  __JSH