SQL statements: from mild to hot.

Recently I have been asked a couple of SQL questions, so I decided to brush up on some of it.  I was going to talk about mild being things like “CREATE TABLE” or “INSERT INTO”, medium being joins, then hot being this other thing.

I don’t have patience for all of that, so lets get straight into the HOT.

Did you know you can create TRIGGERs in SQLite?  Yeah, you can create snippets of SQL that run before or after specified events to specified data. I know this because originally I was interested in adding a last modified column to my data, but could not figure out a way short of me coding it into all of my statements. Not any more!  Here is an example of creating a table which will update last modified column, if I understand correctly.

Yeah, I haven’t tested it yet, I found that idea after I commited for the last time tonight.  (Maybe/probably) Anyway, hasta la pasta!  Be safe and watch for ninjas!

First Github sync

First sync of five commits.  I basically create a database. Yeah, it is not a lot, but it is something.

Originally I had set the goal to make commits with as few lines of change as possible. When I set that goal, I was literally thinking that I would create a commit for every couple of lines that the project grew.

ROFLMAO.  I have a lot more than a 10 lines of stuff for those five commits. My last commit was a 60 line file where I finally added the first code to the repo. The first third of that, though, is comments. And they are interspersed through the rest of the code. Basically it is not a lot of code, but there is a lot of stuff.

A quick walkthrough:

  • README – you know it, you love it. Talks about what the goal is and some general commit guidelines for myself.
  • LICENSE – MIT, of course.  I mean I like writing stuff for me, but I would rather be able to have other people have access to something if it can help them. I want anyone to use this software for anything they can, hopefully not evil.
  • .gitignore – With this recent change to using sqlite the change that I made may be unnecessary.
  • db – FOLDER
    • __init__ the file that lets the interpreter know that this is a module. (It can also be used for other useful things. For instance we may try and get it to automate db loading when importing the db module.  We will see.
    • td_db.py the file which will house most of the methods to interact with the database.

Database data and ideas of future growth.

Okay, so originally I said that I wanted to use MySQL because I had instances available through my hosting provider. After thinking about it, and wanting to choose it, I decided to go with SQLite instead.

Yeah, me wanting to do it was the final decider, but look at what all we gain by using SQLite: It allows this application have its data passed around like a file, it is super cheap, doesn’t run when it is not being used, can be somewhat secure since it does not have a server running, is everywhere in Python books and Android, and, probably most importantly right now, I want to.

Finally I was steered in the direction of SQLite because ultimately I want to build an Android application which is more than just an interface to a remote mysql server.

Iterative Development and my todo list.

Iterative development is the process where you make frequent changes to your code base, constantly growing it.  Taking this concept to its logical, absurd, extreme would mean that I create a release for each small improvement to my todo list.

Currently this is my plan. v0.1 will likely be a Python script that creates a basic database and allows someone to add items to the list. v0.2 will likely allow the user to mark a task as complete. This numbering/release scheme will continue through each iteration of feature



Restarting my todo app.

I have attempted several times in the past to figure out a todo application that I would want to use, everything from the database in the backend to the API to the web client to the mobile client to everything.

I am officially restarting this quest. Everything from planning to implementation, to update and maintenance I am going to try and write something about.

Once I decided to restart this endeavor with my bigger-than-last time skillset I decided to start at the very beginning: Planning the object UML (I think it’s UML. Basically I am planning the values and methods that will make it up) I have not gotten very far as I am currently debating on trying to make the todo list itself a parent item to every item on it, or if they should not share inheritance. I think I will not have them share inheritance, rather the todo list will be full of methods for planning, moving, and fitting the actual todo items and sub items. (Maybe with projects, that seems like a should have too.)

As you can see, I still have a lot of planning to do, so I am going to get to it and will update you again within a week!

Edited to add: Some things that I forgot to mention in the first post. I am going to start by using a mysql database, as that is what I have access to on my hosting provider. The book that I read, Head First Android, touched on creating adapters. I am pretty sure that I can get the adapter written, assuming (and I have to imagine) mysql is supported on Android. If not, I may do something with just API calls and an Android client, microservices style.

Head First Android by David Griffiths

I recently read Head First Android by David Griffiths. This book was a decent, very high level introduction to Android application development. It will give you all of the tools you need to build a basic application which can interact with other applications, has a pull out menu with multiple pages delivered in varied fragments using a SQLite db to power the options. It does get into using device services briefly as well as Material Design.

It does require some knowledge of Java, although my rusty skills more than sufficed. While I now have a great basic introduction to application development, I have not learned the skills to do the sorts of things that I would like. (Ideally something like a match three game.) I may or may not continue reading more into Android, however that may need to wait for a couple of weeks/months.

New JLMarks.org

Hello folks!  I am unsure if anyone will read this, but if you do welcome to this ol blog. I am removing the old jlmarks.org because try as I might, I never could string a series of coherent sentences together.

To be honest with you, the ideal end goal of me having a blog and posting to it is to be worth more when it comes time to move to my second programming job. My first one will hopefully start before there is much here.