Thursday, September 6, 2012

Budget Buddy Transactions and such

 


Above are two snapshots of the transaction Area. In the left image, the +Add Transaction button causes some Javascript to display a form to add transactions, and in the right image the Add Account screen is shown. When transactions are actually in the system, it looks something like the image below:



I'm working on the Edit button right now, which will allow you to change a transactions Name, Amount, Or Date. The trick is going to be updating the account to reflect the change. But once thats done I can get into the meat of the program itself, which isn't its checkbook, but tagging transactions and reporting spending habits based on them.

Sunday, September 2, 2012

SQL foreign key issue. Errno 150 in BudgetBuddy

Budget buddy is coming along, Im working on the transactions page. I worked for a couple hours trying to get an htaccess file to work before realizing that my apache server wasn't set up right, and then had to rework a bunch of code to make the site work again. Alot of relative linking was going awry. Luckily a bit of GIT magic brought me back to working correctly so, its ok!

Coding today took a fun detour for about 10 minutes while I tried to figure out why I couldn't apply a foreign key to my database after successfully applying one before. Heres what I had as a problem and how I solved it:

3 Tables, userinfo which has a primary key of userid, accounts which has a userid associated with it and a name (as well as an amount), and then a transactions table I had just made. So I successfully altered transactions to reference userid from userinfo so that it cascades for both updating and deleting. And if anyone doesn't know how to do it, this is the page I go to everytime I need it: This site is good for foreign key info

But then I went to apply the accountname from transactions to be a foreign key from accounts and started getting this errono-150 bit. Completely unhelpful, saying I couldn't create a table such and such. This unhelpful bit led me to google the error number and I quickly stumbled onto this link. After looking at a couple of the reasons for error I figured it was because the account names weren't indexed. I hadn't told them to be primary keys because multiple users could have an account called "Checking". But then I read up on indexing and then used the mysql documentation on create index to add an index to my table. Tried to alter it again, and viola, foreign key accepted.

I hope that if anyone gets an error similar to the one I experienced that they find this blog and use the good couple of links to fix it!

On a side note:
Has anyone ever noticed that viola, when pronounced with a bit of an accent should probably be spelt walah?

Saturday, September 1, 2012

A break from BudgetBuddy for some evolutionary computation

http://practicalcryptography.com/cryptanalysis/stochastic-searching/cryptanalysis-simple-substitution-cipher/#python-code

I just found this bit of code to break a simple substitution cipher. Its an extremely simple hill climbing algorithm but I'm wondering if I couldn't improve on it by using different methods. I wonder how ALPS or another evolutionary tactic would fare against solving ciphers.