Update – April 2018

I have been quiet here on the blog, however my brain has been working non-stop! I feel that I would like to post something here, but I haven’t had anything to “physically” bring to the e-world. So, heres a small update on what’s been happening over the past few months.

Algorithms

For an odd reason as of late, I have been dead set on generating prime numbers. Where this idea came from, I’m not quite sure but it has taken up a large portion of my time.

Originally starting with the bog-basic method of finding a prime number, I created a generator in Python. Now, this may seem boring and arbitrary for most, but I really enjoyed creating and testing this algorithm.
I spent a while researching about prime numbers (as I’m by no means a mathematician), and slowly started to optimize it.

It was whilst numbers greater then 1,000,000 took longer to process, I started to explore different avenues to speed this up.
I first looked into processing these numbers on different threads.  Obviously, there were a number of ways I could do this.

  1. Send a number n to it’s own thread for prime testing
  2. Split the number n in [x number of threads] ways and give each chunk to a separate thread to test. If a thread returned “not prime”, close all threads and start on next n

As you can see, it started to get complicated. Even more-so when this avenue started to dwindle when I realized a thread is just a time share of the same die, not a seperate CPU process. So I then explored the idea of multi-processing.. which would be great for option 2 above.

This became even more complicated as memory isn’t shared between the parent and child processes. I did however, build an algorithm that would split a number between X threads/processes, which works quite nicely.

Still staying with prime numbers, I was interested to see if my Python algorithm would run quicker in another language, so I re-wrote the logic in C and ran the test. It ran super quick, and I was really surprised by the performance increase!

I then explored the idea of importing my C algorithm into Python and running it, but came against some problems. Python will add bits to an int to accommodate for really large numbers, where C seems to lose interest at u_int64.
I hit a nerve when I found this; I ultimately wanted to leave it to run, just to see the biggest number I could find. Obviously, my C algorithm wouldn’t hold up to this, which was a great shame I feel.

I have for now, put this sideline to rest, until I find some more free time.

Webapps

I decided that it was time to expand the internet just a little bit more.

It had been a while since I last created a web app, infact it was my final CS50 project in Flask. I know Flask isn’t greatly maintained anymore, and therefore isn’t used for larger projects. People seem to be moving to Django more and more, so there I went.

I have a collection of calculators, references, generators etc. that I have accumulated and I really wanted to start to put in a nice big box with a bow on top. I also wanted to tie it to jsephler.co.uk somehow, allowing a central location for me and others to access from.

I also wanted to take a dive into website meta data and learn more about it.

Armed with my knowledge of Flask and trusted Bootstrap, I decided to finally take the plunge and learn Django. And boy am I not dissapointed!

Django really is fantastic, and is packed full of some really great features. After shuffling through alot of the documentation and getting my head around Models, I have a good understanding and has been a relativly smooth transition.

I will probably use Django from now on.

Im hoping that my next blog post will be a big reveal, unveiling the new site, however there’s still plenty of work to be done!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.