Tag Archive for Programming

Google Code Jam 2008

Tagged as: Jun 28

While many of my readers are totally uninterested in the fact that I program computers, the fact remains that I do what I do. And thankfully I enjoy it (well at least most of the time). Geeky as it sounds, I’ve also found that I kind of like to occasionally participate in programming contests.

I participated in the last Google Code Jam in 2006, but I didn’t fare all that well. Of course, that might also be because I decided to open up the problem and then go eat lunch after reading through it. And did I mention that I only got an hour to work on it once I opened it? I could have at least solved that problem! I only needed 5 more minutes! Although, I’m pretty sure that I wouldn’t have solved another so I still wouldn’t have done very well.

Anyways, to make a long story short, I enjoy programming. And programming contests like this can be fun! I’m currently trying out some of their practice problems, and I’m going to go with Python as my language of choice (last time I went with C++).

I don’t particularly have high hopes for how well I can do, but it’s still fun to try! It’s free, and fun (for some people).

[Google Code Jam]

Share This · 5 Comments »

Being Surpassed

Tagged as: , , Nov 21

I recently came upon something that made me both excited and sad. I found GroceryGuide.com. As you know I have previously worked on my own similar application called GROP. However, as any user can obviously see, I have been beat.

GROP: My Idea

Earlier this year, I realized that there was a problem with grocery shopping. It was too difficult to just jump in and be able to figure out whether or not a particular price was a “good” price for an item. I would have needed years of experience in order to intuitively conclude that a price was good. And even that is not safe because the human mind (in general) is just not precise enough to remember hundreds of items and their respective prices. However, a computer would be most excellent at such a task. This idea was totally my own, and I was in no way influenced by other ideas to solve this same problem.

Therefore I thought that it would be worth a try to create a web application that users would be able to input their prices that they’ve bought items at. It would create aggregate data from said application such as the average price bought at. This would help users to figure out if a particular product was listed at a “good” price.

groceryguide
GroceryGuide

And then I happened on a site that had much of what I was doing. Okay well I haven’t touched the application in awhile, but we nevertheless had overlaps in our goals and application. Except it was nicer. And prettier. And probably worked better.

The best thing about it, though, was that it didn’t just have data from users’ input but it actually had all of the sale prices from all stores! This would have been ideal for my own application except I have no idea how they swung that. So either they are getting some kind of list from each of the supermarkets, which would have required getting some deal. Or else they possibly had to create custom mechanisms to scrape their listings online. I rather doubt the latter, and I am impressed with the former.

My Feelings

It’s an interesting feeling to be passed. I’m not sure, but I would think that it’s a pretty safe bet that GroceryGuide started before I had even had the thought to create my own web application. And now that it has an upgrade over its previous version, it seems pretty and functional.

I know that in life, getting beat happens daily. The old get older and the new get better. In sports, the younger athletes coming up will surpass you some day. It’s just a matter of time.

Records are made to be broken

is a quote that has already been stated, I’m sure. And if not, then there it is. There must be new ideas, new modifications, and so on. Sometimes the new isn’t always better. Just ask Hershey with their Change is bad advertising campaign. And sometimes that’s true. But as a general rule, beware if you’re the front runner because someone is going to pass you.

Okay so I’m not the front runner. In fact, I found it hard to even get people that I knew to use GROP, let alone anyone else. I had lots of ideas of what I wanted to do, many of which were covered by GroceryGuide already.

On The Other Hand…

There are still things that I benefit from by having my own custom web application. I can use it to figure out when I last purchased something. I cover items that are likely not covered by GroceryGuide (can you really seem them having listings from the Chinese supermarket??).

And Finally

Mine isn’t as pretty. It doesn’t have as much information. But there are still benefits. I think that I should continue to input prices. However, I kind of doubt that I’d put much more development time into my project. There were lots of things that I wanted to do such as:

  • Make it prettier. This would have made people want to use it! People are attracted to good looks, even if they don’t want to admit it. This goes for being attracted to people as well. You know that it does.
  • Throw on some AJAX to make it more user-friendly. This goes along with making it prettier, but it is a bit more than just looks.
  • Improve the searching and viewing of data so that users who just wanted to look did not have to go through the same extensive process that users who were adding had to.

In fact, in hindsight I think that I went a little overboard on the database relations because I had a very Web 1.0 mindset of how I wanted to do it. Oh well, live and learn. Man this post is full of fun little tidbits of wisdom.

So congratulations to GroceryGuide for having a very nice (from what I can see) application. And I’m going to use it. But you know what, in some ways it’s still not as good as my own because that one is mine. But I’m glad that someone out there is working hard on solving this problem that very many of us have.

Share This · 6 Comments »

Tkinter Keyboard Bindings (In Python)

Tagged as: , Aug 24

So I found this table useful, and I thought that I’d make it available for easier searching for those who might also look for it. It’s useful when creating a GUI with Tkinter in Python. I’m not really sure how much of that kind of development is going on, of course, but that’s beside the point.

Anyways this is specific to the “special keys” that are used in the bind method for event handling, so I’ve not looked into where else this particular information could be useful. I, for one, used this in order to bind the enter key on the keypad to the same functions as the normal enter button. It was annoying me while using The Budgeteeer because I couldn’t figure out what the name of the button to bind was. That has thankfully been remedied!

Example:
root = Tk()
def hello(*ignore):
print 'Hello World'
root.bind('<return>', hello)
root.mainloop()

.keysym .keycode .keysym_num Key
Alt_L 64 65513 The left-hand alt key
Alt_R 113 65514 The right-hand alt key
BackSpace 22 65288 backspace
Cancel 110 65387 break
Caps_Lock 66 65549 CapsLock
Control_L 37 65507 The left-hand control key
Control_R 109 65508 The right-hand control key
Delete 107 65535 Delete
Down 104 65364
End 103 65367 end
Escape 9 65307 esc
Execute 111 65378 SysReq
F1 67 65470 Function key F1
F2 68 65471 Function key F2
Fi 66+i 65469+i Function key Fi
F12 96 65481 Function key F12
Home 97 65360 home
Insert 106 65379 insert
Left 100 65361
Linefeed 54 106 Linefeed (control-J)
KP_0 90 65438 0 on the keypad
KP_1 87 65436 1 on the keypad
KP_2 88 65433 2 on the keypad
KP_3 89 65435 3 on the keypad
KP_4 83 65430 4 on the keypad
KP_5 84 65437 5 on the keypad
KP_6 85 65432 6 on the keypad
KP_7 79 65429 7 on the keypad
KP_8 80 65431 8 on the keypad
KP_9 81 65434 9 on the keypad
KP_Add 86 65451 + on the keypad
KP_Begin 84 65437 The center key (same key as 5) on the keypad
KP_Decimal 91 65439 Decimal (.) on the keypad
KP_Delete 91 65439 delete on the keypad
KP_Divide 112 65455 ↓ on the keypad
KP_Down 88 65433 on the keypad
KP_End 87 65436 end on the keypad
KP_Enter 108 65421 enter on the keypad
KP_Home 79 65429 home on the keypad
KP_Insert 90 65438 insert on the keypad
KP_Left 83 65430 ← on the keypad
KP_Multiply 63 65450 * on the keypad
KP_Next 89 65435 PageDown on the keypad
KP_Prior 81 65434 PageUp on the keypad
KP_Right 85 65432 → on the keypad
KP_Subtract 82 65453 - on the keypad
KP_Up 80 65431 ↑ on the keypad
Next 105 65366 PageDown
Num_Lock 77 65407 NumLock
Pause 110 65299 pause
Print 111 65377 PrintScrn
Prior 99 65365 PageUp
Return 36 652933 The enter key (control-M). The name Enter refers to a mouse-related event, not a keypress
Right 102 65363
Scroll_Lock 78 65300 ScrollLock
Shift_L 50 65505 The left-hand shift key
Shift_R 62 65506 The right-hand shift key
Tab 23 65289 The tab key
Up 98 65362
Share This · No Comments »

How Good Programming Practices Help In Real Life

Tagged as: , , , , Aug 21

So as you very well know, there is software. Now for many, this is a nebulous term that doesn’t really mean much to them until it results in a program that allows them to accomplish something. And that’s just fine. But what is interesting is that there is a methodology to software development that is actually pretty useful in everyday living.

You don’t have to be a software developer to appreciate ideas that will make your life easier or better now, do you? So don’t be scared if you’ve never heard the terms, just think about the ideas.

Anyways, these are just a few of the ideas that I’ve thought were useful:

  1. Leave lots of notes (well-commented code) - Just as in coding, you (should) know what you’re doing at the exact moment that you’re doing it. However, how many times do we do something and then either leave it undone or pick it up again at another time. A prime example of this are those leftovers in the fridge. You threw them into the refrigerator last night after dinner just to get things cleaned up. Then you go get some groceries, put them in, and happen to push those leftovers to the back of the shelf. You find a tupperware in a few days and you are not really sure what it is or how old it is. A good comment from yourself when you had put it into the fridge would help you quite a bit right now wouldn’t it?
  2. Let objects perform functions that they were intended for (object-oriented programming) - How big are the toasters with lcd screens? How much do you want a pot that has a handle with the temperature as well as a clock, an alarm, and a remote control? Sure you could scoff at such ideas, but in reality it’s much more efficient to use objects for their intended purpose. When objects have specific functions, you will immediately know what object to use when it comes time to perform a particular task. Don’t try to open a bottle with a screw driver, you can get diseases from the rusty nail that you were screwing in the garage the other day. Don’t use the same sponge to clean the counter as the dishes that you eat off of for the same reason. Using objects for purposes other than their intended one can not only make you look cheap, it can introduce errors that you would not have thought of. Also they’re better than huge, all-encompassing programs/objects because when some part of it breaks it is easier to fix and there is less loss of function. The television with speakers, a subwoofer, a built-in dvd player, a vcr, audio receiver-like capabilities and numerous other parts is more likely to be completely useless if one of those parts breaks than individual components, is it not?
  3. Fix when needed, upgrade when necessary (don’t get left behind the ages with nasty-to-maintain code) - When something breaks, you have choices. You can get it repaired to the state that it was before or you can upgrade and buy something. So I guess you have a few choices in what to buy as well. You can buy used or new. In software development, there are many tools that you can use. There are code editors, programming languages, and many other tools. There is an unfortunate tendency for some, just as in life probably, to hold on to the old tools and languages simply because that’s how it’s always been. Sometimes we need to take a step back and re-evaluate the state that we are in and whether it is worth it to move on to something bigger and better. It’s not worth it to keep that old junker of a car if the repair costs cost more than a brand new automobile.
  4. Understand how something works rather than specific tasks (similar to concept programming) - Do not limit your knowledge to specifics. Understand the driving force behind the specifics and then the specifics will become clear. This is a rather basic idea that translates to all types of fields. However, in my opinion, it seems to hold a lot of weight in the programming world because there are very many different ways to express the same idea. Notably, programming language choice can very easily decide how a particular goal will be achieved. In the real world, if you want to program a VCR, it is much more useful to understand what you’re doing (setting a timer and settings on the VCR in order to turn on and start recording) rather than simply memorizing the sequence of buttons to press in order to set the timer. It’s going to be pretty tough if you suddenly purchase a DVR and you don’t really understand what you’re trying to do with it.
Share This · 4 Comments »

Budgeteeer vs Budget

Tagged as: , , May 21

Well I suppose that there aren’t too many original ideas out there. Nevertheless, when I happened upon a piece of software called Budget
while I was reading through my feed reader this morning, I had to take a second look. Why? Well because I wrote (and am in current development of) The Budgeteeer!

There were notable differences, obviously. Comparing the two programs, here is what I noticed:

  1. Budget deposits absolute amounts into each sub-account (represented as envelopes) whereas the Budgeteeer deposits percentages into each sub-account. I recently thought about this difference actually. It would be nice to have options to do both/either. My original approach of percentages allows for things such as taking 10% off the top for tithe, but it has pitfalls such as having to specify a percentage for each sub-account. Granted of course you can play around with them over time such that they will approach what you actually need/want/use.
  2. Budget is much prettier. Both their Windows and Mac executables look better than my Python GUI. Granted, I haven’t been trying to make it beautiful or anything. And it is essentially the same functionality (clicking on different buttons, etc). Nevertheless, that is a plus that Budget has.
  3. Obviously Budget is production software that is being sold whereas the Budgeteeer is something that I wrote up in a week and have since played with only a little bit. Budget also costs 30 bucks, and (when the time comes) the Budgeteeer will not.
  4. The Budgeteeer has a cooler name.

All in all, I would like to think that Budget and the Budgeteeer are similar. However, I must concede that they are not even close to similar. Budget is much more polished, and I am now more determined to develop the Budgeteeer!

Share This · No Comments »
Close
  • Social Web
  • E-mail
E-mail It