Posts

Showing posts from February, 2018

python GUI's FUN!

Image
I'll post the whole code when I get it done...   A new class project Zed gave us to,  I am so happy with this exercise... all the bits I love... Making stuff happen visually on the screen!  So for now just a screen shot,  I'm working it all out,  and figuring out how I'm going to get my doctor_who fan fic game into it....   

Binary String Tree

I decided to go with using python's hash to get the strings into the binary tree.  While I would have loved to get them in alphabetically, it was just a problem that was out of my realm.  Hash was right there... already working and ready for use.  Maybe I'll come back to it and try to tool with it later. So I just ran tests on the 'get', 'set' and 'delete' of this.  I was using the dump without problems, and the count in the pytest without issue.   It's definitely not perfect or anything worth using I'm sure, but learning.  That's the goal.  It's basically just the Binary tree with a few tweaks.  The Node has a new 'string_value' to hold the hash number we create with the method 'ConvertString',   we use that to set, delete and get the nodes. the key and value don't do anything in those methods, they just get placed,  and hold their places. I also still use my self.median.... though I think if I'm using hash,

Spring Break

Image
I'm tooling a little bit with code ((some SQL, some class stuff)), but mostly working on a side project I've been meaning to do a while now.  Spring Break Ya'all. 2-19-18:  for my string binary tree: ((dividing the secondary ord result place by 1000 was not enough to account for values adding up to overcome a first ord result which should always be the greatest factor when determining it's rank....  low-high)) My side project:

suffix arrays

https://en.wikipedia.org/wiki/Suffix_array https://academic.oup.com/bib/article/15/2/138/212729 I'm trying to understand the use for suffix arrays.  One of the examples was DNA studies... hence the bioinformatician's guide link above....  These algorithms and suffix arrays save time and memory... but how?   That's my question for the night,  then I can really tackle the class assignment. I mean, it's kinda like telling someone to build a lawnmower, but they have no idea what a lawnmower is supposed to do.  Does it dry laundry?  Does it walk the family pet?  Does it heat water?  Does it tell you your hair looks silly when it's wet?  What is it supposed to do?  ...  Maybe I need a british comedy.  That always sets the right mood for some reason.

trying to make a hash type algorithm without encryption

Image
What I got so far: Thinking I may add the regular expressions so any string can be returned as an integer. Trying to make a consistent algorithm to return a integer for the value of a string: 2-12-18:  Working on a way to test it...  test so far at the bottom.  (pytest).  Change made, error found still testing.  Purple words are adjustment. 2-12-18:  Newest version... still needs testing.  Think I'm way closer. 2-13-18:  All of this, was because I was trying to find a good way to use strings as keys in a binary tree... but they have to be converted to integers to be placed... python hash is semi-random so it just seemed wrong. Zed actually gave me a link in class the other night to 'ord ()' but it just now popped back in my head.  I came up with this thing today trying to look up a way to simply do it without this stuff I was playing with:   'ConvertString' 2-19-18:  Results today worked well.  alist = ['Amy', 'Axle', 'Barb', 

graphical for my binary tree

Image
How it prints out so far: The code: The spaces in prints will have to be adjusted for your command prompt / terminal Making it print: maple = BinaryTree(10.5) maple.set(8, 'leftbranch') maple.set(13, 'rightbranch') maple.set(10, 'leftleaf') maple.set(11, 'rightleaf') maple.set(9, 'leftbranch') maple.set(12, 'rightbranch') graphic = PrintTree() graphic.graphical(maple.root_node) The class PrintTree: class PrintTree( object): def graphical(self, branches): if branches != None: righty = branches.right lefty = branches.left print("branch") print(f" {branches} ") print(f"                               {branches.key} ") print("                     ///                  \\\\  ") print("                   //                       \\   ") print("                  /                          \\ ")

website thinking static

I gave up on my django droplet.  I have a feeling my laptop is partly to blame for not getting anything to work as it should on the server; that and I really started to lean toward doing a static web page anyways.  I need more education on Django/servers and static I'm sure. I could make a Django/Flask app work on my computer, but could not get the droplet to cooperate.  My domain name never linked up like it was supposed to, and I could not get a manage.py runserver to work with a new Django project. And I did the google tricks to get it to run on the host server port for my droplet, my computer and/or firefox  would just spin and contemplate where or what it was looking at.  Couldn't even get a screen with an error. So... It's a set of files ...  I mean what is it that Flask and Django do for you?  I'm going to try and figure this out, and update. Seems to me you could just load an HTML to the domain name.  I wonder how godaddy lets you access the domain?

My python Binary Tree

Here she is,  I tested the crap out of it,  An edge case error in delete took me a few hours to find. I'll highlight where I fixed it with yellow. That's part of why delete has so many (#print)'s in it. I left them in so if someone has a similar issue...   "Your size is not dropping, although your items are being deleted."  I'm still learning,  if you see something drop me a comment!  I'd love to make it better. --- Start code block -- from random import randint  # for manual testing class BinaryTreeNode(object):     def __init__(self, key, value, left, right):         self.key = key         self.value = value         self.left = left         self.right = right         def __repr__(self):         nleft = self.left and self.left.value or None         nright = self.right and self.right.value or None         return f"{nleft} <--- ( {self.key} : {self.value} ) ---> {nright}"         class BinaryTree(object):     def _