Just a quickie update: I fixed that bug!

Yep, my ListView updates correctly now; it’s not an iteration behind any more. I don’t know if it was just that the computer maybe just needed the processing time to add the new entry to the list, but a little confirmation page with a button did the trick. (And I kind of like how it looks.)

It’s nice when things work the first time around, isn’t it?

Now to start storing data. I don’t have a server (*makes puppy dog eyes at Y Combinator*), so I think I’ll start with just JSON and move to redis when I have online space for it.

I don’t know anything about servers. I wonder if I could find a cofounder who does, or if this is going to be Yet Another Thing Rebekah’s Learning. (It probably will be either way; the question is how much it’s going to slow me down.)

But anyway, once I get the storage and the camera down, I’m going to try to launch my prototype by registering it on the Play store and putting it on my actual phone to try out!

It’s really tempting to say, “But it’ll just take a little bit longer to fill in the rest of the categories and put all the colors back, and maybe put in cropping and compression and backups and on and on…” — but the startup wisdom I read is that if an internet troll wouldn’t make fun of what you released, you released too late.

Tomorrow is my last day before I start work. I’d better make use of it.

Hey–wouldn’t it be cool if I not only made my 2-week timeline, but got this finished tomorrow (Sunday) thus getting it done in one week? That’d be so awesome. And then what if I got the other categories and the colors and the cropping and compression and backups all done before school starts? That’s two more weeks. Maybe I could even get that done in one, too.

Stretch goals! 😀

I cleaned up tinypapers, and got something else accomplished too

It’s functional again, but it’s got a bug. I’ve got a ListView that won’t update until I navigate away from the screen and then come back. I think if I put in a confirmation page or something, though, it might start working. I’m going to have to investigate things a little better.

The refactoring detour I took was worth the time, I think. I ended up not doing anything too drastic, but I got rid of some out-of-place abstraction, trimmed odd code, reorganized a little. More importantly, I understand the program a little better now.

Why do I become so productive past midnight? It’s just bizarre. I’m going to have to stop staying up this late, though, because…..

I got a job! A programming job, at that. Just a temp position for now, but the people seem friendly, the pay’s good, and I get to work on some cool machinery which no one in the building knows how to use (including, right now, me–but that will change). That’s all the detail I’m giving for now, though.

I’m still kind of holding out hope that I can get a working tinypapers prototype out within the next few weeks, though. I’d like it to get done before school starts, because I’m going to be really busy with working 30-40 hours a week and also taking a full load of classes. Mondays and Wednesdays will be especially hectic, as the classes I’m taking fill up the whole evening from three-something in the afternoon to 10:45 at night or something crazy–and if I’m at work the same amount every day, that means I’m spending the first half of my day at work and then going straight to class. It’d mean packing lunch and dinner!

I’m hoping that after the first week of work, they’ll just let me work shorter days on Monday and Wednesday (so I can stop home before class) and longer ones on Tuesday, Thursday and Friday. They don’t need me in at any particular time, from what I understand–the work just needs to get done–and they advertised flexible hours in the job description. I hope they’re as good as their word; these folks seem reasonable, though.

Anyway. I am pretty darn tired after running around and doing stuff today, so… à demain, midnight readers. Or I guess just à l’heure. It is already technically tomorrow, after all. Er, sort of. 😉

Design sense, belatedly triggering

There’s something pretty sucky about the way I’ve been structuring tinypapers. It’s getting too spaghettti-code-like. A line I wrote a few days ago to solve a problem made me feel uneasy (I think I mentioned this already somewhere?) and I couldn’t find a different approach. Then there are these more recent issues that have been making me twitchy. My design sense finally put two and two together… there’s some funky stuff going on I need to fix.

Anyway, I’m going to have to spend a day or two refactoring (and, where possible, minimizing) the “power” structure before it gets any more complicated. I just sat down with an actual pen and paper (magical tools) and it’s pretty obvious that something isn’t right. Hopefully the visual aid will help kick me into solving what’s wrong.

—–

(several hours later)

Kivy is really confusing about this, though. Because child structures and inheritance are mostly defined in KVlang rather than Python, ordinary design patterns don’t… quite work. I’m in a better position to figure this out now than before I wrote any code, of course.

Here’s the structure.

I’ve got one class (widget if you’re speaking KVlang) which controls which of the other classes is being displayed. I’m calling it a window manager. Of course, in each of the “child” classes (which don’t actually inherit anything from the window manager), there’s at least one button that’s supposed to trigger the window manager and make it display a different page.

You can’t just randomly call them from other classes. The page-switcher methods need an instance of the window manager to work. And I can’t just put the page-switcher methods in the child classes. The reason the window manager exists is that it’s the only part of the program that knows how to do that sort of thing.

So, there isn’t… really a hierarchy in the Python file. It’s mostly just there to define any logical back-end that the KVlang file might need.

The KVlang file has hierarchy all over the place. It basically declares everything.

Anyway, I’ve got this window manager. Underneath it I have the main page that lists categories of documents (“Business Cards”, etc) and each of those categories has (will have; I’m only working with one right now) its own instance of IndexPage to display the documents in that category. Each category also has an Add page for new entries.

It’s not that complicated! It shouldn’t be this complicated! It’s still complicated!

—–

(an hour later)

As you can tell, I’m still getting my head around Kivy.

Basically, whenever you need to do stuff that crosses over different classes, you have to make your method calls in Kivy. Kivy keeps basically all the class instances in memory. This gets kinda tricky if you lose track of things though.

I do need to clean up the Kivy inheritance… and then stop bashing my head against trying to make things happen in the Python file that just can’t happen in the Python file. Sigh.

Frustration and solving problems in the shower

I’m really wary of how dangerous it is to my productivity to write blog posts every day, but there’s a reason I don’t stop–which is because it only looks/feels dangerous. As leery as I am of sitting down and writing for two hours every day like this, I know that if I denied myself the time to swap out what I’m thinking, I’d have a lot fewer ideas for solutions.

I am just DYING for a cofounder with a real working knowledge of Python. I really like programming… but I don’t feel like I’ve ever gotten to a point where I really, truly understood it, and I’ve been absolutely unable to find a teacher, and the Internet isn’t as useful as one might think if you don’t know the right questions to ask, or the right way to phrase the questions you have.

I’ve run into this sort of problem before, and tried to fix it for other people (see the post “How I Learned Linux”). I guess it’s inevitable that I’ll write “How I Learned Python” and include all the stuff I’m bashing my head against now.

And it’s really stupid stuff. Like, I know full well that anyone who’d written an actual application (I don’t mean little scripts or toy programs) would be able to answer my questions in an instant if they were standing over my shoulder. [Edit: actually, they wouldn’t; my problem was more obscure than I thought.] Alas, there is no one standing over my shoulder; alas, I don’t know if I can describe my problems.

I think I might need to go trawling through some Python source of an existing program. The trick is finding an example that shows me what I need… argh.

This is one of the things I like least about living in Iowa. I live in a fairly mellow little city where the people are friendly and the Oriental food is excellent. But it’s not really a college town; we’re short on programmers. Oddly enough, I’m kind of missing a few guys I knew in high school who would have made really good cofounders. I wonder where they are now. Probably MIT, they were really smart programmers. (I had crushes on both at different points; it didn’t hurt that one was really physically attractive and the other was adorably nerdy.) Eli, Gordon, drop me a line if you’re reading this.

The problem I’m having right now–although it isn’t by any means the only one I’ve come across or the only one I’ll have, or even the only one I’m having now–is a dumb little OOP-type issue.

When this one button is pressed, I need other widgets to react to it. I have methods in those widgets’ classes that provide the reaction instructions, but one of their required parameters is an instance of the class they’re in.

I think the problem I’m facing is that the application is re-rendering the widgets that I need names for every time they’re constructed, and I don’t need it to do that. I think maybe there’s a way to do this with Kivy’s ObjectProperty stuff, but I haven’t gotten it to do that yet. I’m sure I’ve seen it before… but I don’t remember where or how. I think it was the Kivy book, but I might be wrong.

Actually, it’s not a dumb OOP issue. It’s a Kivy issue, and I can forgive myself for not knowing what I’m doing. In Python you’d be spelling things out manually and you’d have the objects available to pass. I think this is why I was having trouble finding Python source examples.

tfw you need to have a little more faith in yourself

And once again, having written out a blog post helped me solve the problem. That and taking a shower in the middle of writing this. It took me a lot longer to write this than it looks like; I spent a lot more time chasing thoughts in circles than typing.

To be honest, I was able to get the app to do what I wanted already, because of the lack of syntactic salt in Kivy. But the solution was really klugey and I didn’t like it [1], and I’ve always been a perfectionist since I was a little kid. The way I forced the app to do what I wanted blurred the lines between the Kivy and the Python code too much for my liking.

But I appreciate that Kivy gives the freedom to do stuff like that anyway; it really helps test things. I was actually going to give up on this for now and move on, but then I remembered the ObjectProperty thing in the shower.

This is still way more fulfilling than the noddy little programs from school. I’m kind of brain-tired and frustrated, but I sprang back from demoralized within an hour or so. School programs and (I’ll assume) work programs don’t have this factor that brings me back from demoralized. This is why I want to start a startup.

I guess the lesson here is that I need to be a little easier on myself. I mean, I’m an 18-year-old girl going into my second year of college. It’d probably be my last semester if I’d taken classes this summer, and even so I’ll probably graduate before I turn 19. I shouldn’t doubt my intelligence.

I probably shouldn’t be so hard on myself about my pace, either. I know from empirical evidence that when it comes to stuff like this, I’m a persistent little snot. (On multiple occasions, this was to the frustration of school officials.) I don’t mind changing my approach if something isn’t working, but if I want to do something, there’s not a lot that can stop me. I never let high school tame me. I tried to tame it instead, and when it stubbornly resisted, I took the advantages I could from it (about $2000 of free college, I think) and then left.

But, arrrrggggghhhhh. I want to go faster. There are features I want to implement. Grr.

I’ve been fighting this thing all afternoon. It’s time to take a break and maybe get some food… I don’t think I’ve eaten for five or six hours, so dinner and a few rounds of 2048 or something are in order.

—————————

[1] I have no idea where my sense of design in programs came from. Certainly not experience. I do know that I can’t remember anything I’ve ever written under Windows has triggered its appeal switch (probably because those programs were all for class and most were written in Visual Studio).

“Add” There Was Much Rejoicing

Yes, that was a pun combined with a Monty Python reference. I know, I’m awful. tinypapers IS written in Python though.

I wrote the UI skeleton for tinypapers’s most basic “Add” page, and a little more back-end stuff for switching from screen to screen. It was pretty easy, actually! After that ListView nonsense, I was kind of expecting another fight with Kivy… which of course made it harder to start working on something else. I guess I wanted to savor the victory for a few hours before I broke tinypapers again! XD

Basic Add Form

Also, the Back button works now.

I guess I’m ready for the next big hurdle… which is going to be integrating the camera. Kivy is said to  handle this gracefully, but I don’t know how it’s going to work when I test it on my laptop. I have a functional webcam… I guess it’ll use that?

The Return of Tinypapers

 

 

 

progress

 

It’s not the prettiest right now, but I got tinypapers to do something. It doesn’t seem very impressive, but the data structures behind it are pretty complex, this part of Kivy is still under development, the documentation they have isn’t the easiest to read, and the answers on the Internet are basically all different.

What it does is take input, add it to a special sort of string array, and hand it off to a really complex little widget that makes the array into those green buttons. The complex widget involved is still experimental code and the syntax for getting it to work isn’t easily understood.

After groveling through a whole bunch of Internet stuff, I came back to Kivy’s ListView documentation and for whatever reason, I was able to understand it more.

For those who want to know, here’s how to declare a ListAdapter and write its args_converter in KVlang:

adapter:
ListAdapter(data=[“{0}”.format(i) for i in root.button_list_entries], cls=ListItemButton)

In actual code files, you’ll want to break that up into more lines. It’s certainly more than eighty characters long, just put on one line here for readability.

I may end up refactoring this later and writing the args_converter in the Python file or something; I’m kind of meh about having this Python code stuck in the middle of a KVlang file, even though it’s just a function call. That’s okay for now, though. I’m more concerned about getting the prototype to work; I’ll worry about refactoring and things like correcting my (very likely non-canonical) indentation style later or if it becomes a problem.

Here’s a quick visual demo of what I got the thing to do:

Screen Shot 2015-08-01 at 3.40.50 PM

 

The nice UI colors from before will eventually come back, don’t worry–I’m not neglecting the interface or anything. This is just more important right now.

 

Just a small update

I’ve been working ~8-hour days on tinypapers and learning Kivy, which is actually longer than I’m used to. I’m expecting my mental stamina to increase over time, which is a pretty safe bet… but for now, I’m tired. I think I’m just having an off day.

Nevertheless, I did a few hours of tinkering with the interface. A lot of what I’ve been adjusting is structure and stuff, so you can’t see a ton of change, but here’s a quick screenie to whet your curiosity:

tinypapers v0.0.1

As you can see, I managed to put in some margins around the button. There are quite a few issues, though.

To name a few that you can actually see:

1. If there aren’t enough buttons to fill the page, they sit at the bottom rather than the top.

2. For some reason, only the second sample button I put in is showing up.

3. The blue-gray color looks a lot more blue and clash-y when it’s next to the other blue and the turquoise. I need to put borders in that pomegranate red around things so they aren’t right next to each other, or change the color scheme a little.

Of course, there are a zillion things you CAN’T see that I need to be working on…

…but can’t right now because my brain is not at its clearest. Maybe I’ll just down an energy drink and keep going. That sounds more fun than being restless for the rest of the day and just thinking about what I want to be doing (i.e., this). Or maybe I’ll do chores and paperwork and catch up on email. That needs to be done, too. :/