Wednesday, October 31, 2012

Quick Stats!

IsItPrime now includes a Quick Stats view to show you detailed results of tests in an easy-to-understand format.

Take a look:

Oops, now I've got to fix those buttons clipping over into the quotient view...

Tuesday, October 30, 2012

Test IIP QT - again!

This time, it will actually run. Turns out that no matter how I actually build the application, the DLLs must currently be present in the application folder. I've actually never had to link a DLL before (and didn't know I had to this time) so for now they're just kinda sitting there.

UnRAR this and go ahead!

Bear in mind that Reverse BFTD verbose testing is not at all present (which is why the option is disabled). And yes, there's a large blank box...not quite sure what to do with that!

Monday, October 29, 2012

Update

I fixed saving and did a bunch of formatting fixes today. I had a day off (and tomorrow too) because of the hurricane.

I'll upload another testing alpha tomorrow provided we still have electricity and internet!

Sunday, October 28, 2012

Test IsItPrime 2.0.0 Qt!

I've gotten a nearly-complete version of IsItPrime 2.0.0 working, more or less. It's been a bit of a struggle, but verbose BFTD testing finally works as it should. Pretty much.

You can find this very alpha version here.

Bear in mind that saving is still a bit flawed and I don't quite know why. This is not pure Qt just yet. In fact, much of it is still using the Win32 API. That will change soon, obviously. The idea here is to make a fully cross-platform application, which is what Qt is meant for.

Tweeting works, SPAT testing works, BFTD works, and BFTDV should work pretty well. Unfortunately, the GUI gets a bit laggy during the test, and there is currently little indication in the UI of what's going on behind the scenes. That may change as well if at all possible.

Updating the GUI from another thread is done by emitting signals, which are connected to slots. The updating happens "when convenient" for the application, meaning when it's thread-safe. Perhaps that's why things might seem a bit slow. It could also just be the debugging code. I don't quite know.

Have fun testing it out!


Thursday, October 25, 2012

Progress (again)

IsItPrime 2.0.0 is underway again. I have managed to get all the QThreads "working" for the verbose BFTD tests. This does not mean the test actually runs, though. In fact, if anything, it is never initialized. It appears as though nothing is...

Oh well. At least there are no more errors and no more "Thread destroyed while still running" and no signal/slot connection problems at all. That can't be anything but a plus.

I will keep you all updated on the progress being made. So far, only normal BFTD (non-verbose) and SPAT testing actually works. Saving is giving me lots of problems, and Tweeting works perfectly. Oh yeah, so does the "Clear" button. And the GUI looks neat!

That's all for now.

Saturday, October 20, 2012

One Thread, Two Thread, Red Thread, QThread

QThreads are not actually difficult to implement at all!

In fact, according to this reference, subclassing is not only unneeded but actually discouraged, and one can simply initialize a new thread object with Qt's signal-slot "queued connections" interface. Sounds great, looks clean and simple, and conducive to code organization too!

WRONG

Fact: multi-threaded applications become more and more unstable the more individual threads communicate with other threads and objects, especially those created / owned by other threads.

It almost might make more sense to finally learn how to use mutexes...or are they muteces? Mutices? Whatever they are, they could be quite useful. I just need to figure out this QThread stuff, and then head on back over to the fantasy land that is OS X and force myself to understand how Apple decided their computers should handle multi-threading with the mystical NSThread class.

Actually, it's not that QThread itself is giving me problems. It's the fact that the class member functions are "protected" and I can't seem to access them as signals. It's more than a little annoying, but I'm using the Qt Project forums and am expecting answers soon. They've already been surprisingly helpful in a surprisingly short amount of time. They're the ones who initially told me about the documentation for the new QThread class.

Thing is, I'm starting to think that perhaps I somehow don't have the right libraries installed. I have 4.8.3, which is the "latest" version available (and also currently the only version I can find with VS 2010 builds) - the documentation is for "Qt 5.0," which I can't find anywhere.

Back to waiting for answers.

Thursday, October 18, 2012

IsItPrime QT Threading

I am not a fan of difficult-to-implement class-based multi-threading, especially when it means I cannot start threads simultaneously.

I have, however, managed to get the verbose testing threading working in my test version of IsItPrime 2.0.0.

I have to say, I like the interface in general. Very clean and organized, just they way I like it, although admittedly not much has changed. If anything, the actual display boxes are smaller.

Also, that big box on the bottom right does nothing. I forgot it existed while I was was writing the code that lets the threads talk to the UI...and now I have no idea what to actually make it.

Saving works as well!

That's all on that for now. Just so you all know I have actually been doing stuff on this program despite having not made a post in longer than usual.

Thursday, October 11, 2012

IsItPrime 2.0.0 Progress Report

Today has been quite a productive day with the "new" IsItPrime.

The interface itself has changed, obviously, as I am now using the Qt API in hopes of soon (eventually) developing a fully cross-platform app that will run natively in any (or at least most) OS environment(s).

Thus far, it's actually a weird hybrid of the Windows API and Qt, meaning it will still only compile and run on Windows, since it uses Windows libraries and headers. That will change, though.

Today, and within the last few days, I have implemented and tested several features:
  • Tweeting
  • Screenshots
  • SPAT testing
  • The Instructions/Help dialog box
  • The website list/contact info dialog box
SPAT testing was easy enough. I do, however, have to change the entire threading protocol behind the testing since I am no longer passing in a handle to a window, but rather a pointer to an instance of the user interface within a specific instance of a class (phew that's a lot).

That means instead of using the CRT's _beginthread() or the Windows API's CreateThread(), I am using the QThread class. This certainly has its benefits, such as the fact that it's the only method that would work with the current layout of my source files...

Not that that's a problem. Qt has made a very good impression on me as it seems the learning curve is quite manageable. Instead of being variable-based with strong typing, it's class- and pointer-based. It reminds me of Java quite a bit, and that's totally fine.

In fact, if anything, it looks like I'm going to end up writing less code! That's mainly because I don't have to put in several hundred lines just to create the GUI, as that's all done through the automagic QtCreator program, which is integrated with VS2010 (or at least, it is in the way in which I've installed stuff, anyway).

There is the small issue of character encoding...QString is meant to be cross-platform, so it's something like utf-16, which is neither here nor there in terms of wide-character Unicode or multi-byte utf-8. That means it has built-in functions to convert it to, say, a byte array whose data can be reinterpreted as a const char*, which then needs converted to a wide-character string...blah, I'm gonna write a helper function for that!

The screenshot function works perfectly, as I mentioned earlier. It was actually considerably more straightforward than the Windows API's equivalent(s) - that is, I didn't have to use any ATL or MFC classes or even touch GDI+ (thank goodness). Trying to use GDI+ left a bad taste in my mouth last time, since even after following direct instructions on MSDN and other official documentation, it still didn't work/crashed.

But in any case, we're beyond that now. Here is a sample screenshot of a SPAT test in the "new" IsItPrime.

No, that giant LCD number has no code associated with it...yet. Working on it!

Tuesday, October 9, 2012

IsItPrime Interface Changes!

Check it out - I'm learning a new API! The Qt API, to be specific. So far, it looks like it works a bit like Cocoa. This is great because it's cross-platform and highly customizable.

Take a look:

It's just a shell at the moment - nothing is implemented except Tweeting, but that doesn't even work just yet. Almost. It'll be a simple matter of re-writing all the functions to reference the main UI instead of HWNDs and the like.

Essentially, no more Win32. :)

More on this as it develops! (read: I work on it)

Saturday, October 6, 2012

Screenshots for Everyone!

MuPuPriNT 1.2.02b includes a "screenshot" button that takes a picture of the active MuPuPriNT window and saves it automatically. I put that in IsItPrime 1.9.5 yesterday, and into GJSieve 2.0.4 today!

This latest version of GJSieve 2.0 also includes some minor formatting fixes and the window looks only slightly different. It should (and does) work exactly the same.

Find it here.

That's all!

A Proth Number is Always Odd?

The short answer is "Yes, I think so."

The long answer is "Probably, and here's why." A Proth number is any positive integer of the form k * 2^n + 1 where k is any positive, odd integer and n is a positive integer such that 2^n > k.

The example I like to use is 3 * 2^2 + 1. 3 x 4 = 12 + 1 = 13. 13 is therefore the smallest possible Proth number, and is also a prime. The next few are 25, 49, and 97, all of which are odd. 97 is also prime.

The fact is, all powers of 2 are even numbers, and any even number multiplied by any other positive integer is also even. For these purposes, an "even number" is any positive integer which is divisible by 2 with a remainder of exactly 0 - these are concepts of discrete math that any elementary school student knows!

This means that if you add 1 to any even number, the sum is always odd. Thus, a Proth number is always odd.

This begs the question - why does GJSieve need three separate threads to test numbers?

Thread 1 starts at x = 2 and divides the Proth number each time by x += 3 (that is, x increments by 3 each time). Thread 2 starts at x = 3 and thread 3 at x = 4. All of these threads will test even numbers, but they don't necessarily have to at all.

An odd number cannot be divisible by an even number - can it?

This time, the short answer is "No." An even number multiplied by any other number results in another even number. The product is always even. Divisibility is simply finding the other multiplier when you know one number and the product.

It would be difficult to make GJSieve test only odd numbers, though. It would actually take a lot longer. This would involve a thread starting at 3 and incrementing by 2 each time. Alternatively, we could use 2 threads, starting at 3 and 5 and incrementing by four each time. We could use 3 threads, starting at 3, 5, and 9 and incrementing by four each time - or six? - no wait, then we'd test the same number twice. Or more.

What a dilemma!

See, I'm trying to develop a new testing method I can call my own, but currently it's just brute-force trial division in a fancy threaded fashion. Not particularly insightful or efficient in terms of time or computing power!

I'll do more on this later, I'm sure...

Friday, October 5, 2012

IsItPrime 1.9.5 Test Beta

While waiting at an Exxon in Woodstock, VA for the thermostat on the car to be fixed, I had enough time to create a solution for IsItPrime 1.9.5 based on MuPuPriNT 1.2.02 and fully implement everything!

I wouldn't call it perfect, as anything done in under an hour rarely is, but it's certainly a start.

This version is also 64-bit only, as will be all future NCPrime releases. You can find 1.9.5 here.

Saving, Tweeting, screenshots, and all forms of testing do work. If there are any minor glitches, I'd appreciate if you could let me know!

Thanks and have fun!

MuPuPriNT 1.2.02 Released!

I have finished MuPuPriNT 1.2.02. It is definitely still a beta, although everything is fully functional.

The major changes (to the interface, etc) should be fairly obvious. Additional changes include a screenshot button, which takes a screenshot of the MuPu window, then names and saves it automatically.

The readme will have more information about the changes and how to use the "new" MuPuPriNT.

Here's the interface.


As I write this, I am at a Mariott in northern Virginia. This is naturally making it more difficult to work all day, although I did work late into the night last night (hence the screenshot works).

There are actually a lot of unnecessary things in the SVN for MuPuPriNT regarding screenshots. Oh well.

More on this later!
 

Thursday, October 4, 2012

The next few days

Development of NCPrime applications may temporarily be put on hold as I have family business out-of-state for at least the next four days.

Don't worry, it's nothing bad! In fact, it's anything but, although it will definitely be keeping me busy.

Currently, I need to finish one small thing in MuPuPriNT 1.2.02 and polish it up to 1.2.10 before I can officially deem it a stable beta set for release.

GJSieve 2.1 is also still in the works - it includes this mystery function of MuPuPrint as well as a few performance tweaks.

From now on, ALL NCPrime applications will be 64-bit ONLY. I will work on a stable version of IsItPrime 1.8.0 for x86 before making that x64 only as well.

It is entirely possible I may begin packaging my apps in universal packages containing two executables, but that would likely be for Mac only.

That's all for now.

Tuesday, October 2, 2012

打算為中文的MuPuPriNT

我希望把MuPuPriNT寫完了以後翻譯到中文!

我只有幾個事情得做,就可以給你們用.

 

MuPu Progress

I have nearly finished MuPuPriNT 1.2.02!

Sorry for the lack of any kind of progress report. I have actually been working on it since last week, but only recently remembered to write about it.

Currently, all testing is implemented, saving works, Tweeting works, and all the dialogs and stuff are up-to-date. There are just a few things I want to accomplish first...