Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Thursday, July 12, 2012

Kindle & Code

Have I mentioned how much I love my Kindle? Because I love it a lot, if I haven't mentioned it yet.

Reading is one of the good things in life. Always loved reading, always loved sketching. Two of the most constant facts of my life. Reading however had always been a very passive activity for me pre-Kindle... I would read a book, love it or hate it, think about it, talk to folks later about it.

The Kindle added a new layer, a new relationship I could have with my books. It has that lovely little keyboard that lets me... I don't know what... "talk" back to the book? Talk to myself? I don't know what exactly I'm doing with it when I use it, but I love it now too. Never before could I bring myself to mark/deface a page in the book but boy howdy do I love to leave a snarky mark in the Kindle "margins".

These snarkisms were mostly just for the pleasure of commenting at the time. I'd mark it and poof- off into the Kindle either it would go. I've opened that dreaded clippings.txt file a couple times but the site of it revolted me. Quotes, highlights, comments... scattered about, hard to read, not related to one another.

Project this week has been several-fold and is still very much in progress.
  • Get a Google App Engine server up and running. I'm not in love with app engine, but it's free... so... that's why I'm using it (long long ago I thought to set up a python one but I gave up on that ridiculous idea.. phh... python! Ha!)
  • Start poking at some open/public APIs-- notably the GoodReads one, maybe find something Google related I can use... just.. you know, practice
  • MAKE A USEFUL TOOL (I'm sure there are already other Kindle clipping processors out there, I don't care)
I felt like sharing a fragment of the fruits of my labor, so happy have I been with the work... not that it's complicated, or that it looks good yet (heavens no! I'm talking to a designer friend this weekend to hopefully come up with a good UI flow) but that I have liberated my comments! Yay! (merging of comments & quotes is still a bit buggy)

I've included below the clippings from The Hero of Ages by Brandon Sanderson... a book that had lots of great ideas but toooooootally rubbed me the wrong way. It's book 2 in a 3 book series and book 1 & 3 I read in hardcover... so much criticism was never written down...

Anyway, here's my typical behavior with a book. Highlighted physical descriptions (in case I ever want to sketch characters later) and random comments.... (I've no idea what the un-commented bookmarks are for... I've stopped doing that these days)

Spoiler alert!

The Hero of Ages by Brandon Sanderson 34 entries
Location : 1957
03/01/10 12:43 AM
bookmarked location
Location : 1973-75
03/01/10 12:53 AM
" “I do have to say, however,” Breeze continued, chatting along in his normal way, protected from the ash by a parasol attached to the back of his saddle, “the ash is a tad unimaginative.” "
cute discription
Location : 1982-84
03/01/10 12:53 AM
" Black is so monotonous that you can forget about it, but red—you’d always be thinking, ‘Why, look at that. That hill is red. That evil force of doom trying to destroy me certainly has style.’ ” "
something Trisha would say for sure. sounds like her writting style
Location : 2028
03/01/10 12:52 AM
bookmarked location
Location : 2045
03/01/10 12:56 AM
hoooooow many times will we cover the same ground again and again :(
Location : 2060-63
03/01/10 12:57 AM
" The bobbing figure resolved into a young woman with golden hair, wearing a bright pink dress—one that made her look younger than her twenty-something years. Allrianne had a fondness for lace and frills, and she tended to wear colors that made her stand out. Sazed might have expected someone like her to be a poor equestrian. Allrianne, however, rode with easy mastery, something one would need in order to remain on the back of a galloping horse while wearing such a frivolous dress. "
Location : 2065
03/01/10 12:58 AM
" spinning the animal in a flurry of ruffled fabric and golden hair. "
Location : 2078-80
03/01/10 12:59 AM
" She didn’t quite “scamper”—instead, she held up her dress in a rather unladylike fashion. It would have been immodest if she hadn’t been wearing what appeared to be several layers of lace petticoats underneath. "
Location : 2103
03/01/10 01:01 AM
this whole Sazed abandoning his multi faith irritates me and makes me focus on the moromness of the author.
Location : 2105-6
03/01/10 01:02 AM
" He dried his face with a clean towel, then took out his razor and mirror so that he could shave his head properly. "
sazed description....
Location : 2111-12
03/01/10 01:03 AM
" She wore her standard shirt and trousers, after male fashion, though during the last two years she had grown her raven hair to a feminine shoulder length. "
blaaaah.... feminine hair... vin desc
Location : 2205-7
04/01/10 06:51 PM
" Most disturbingly, the First Contract contained a provision which, if invoked, would require the mass suicide of the entire kandra people. 11 "
if they all kill themselves then they release enough power to capture the Ruin. They release the power used to create them. The will do this. My theory
Location : 2218
04/01/10 06:53 PM
they are all naked though... why bother saying it?
Location : 2218
04/01/10 06:52 PM
" cold and naked on the platform. "
Location : 2291-93
04/01/10 11:39 PM
" Vin hadn’t been TenSoon’s master—TenSoon had killed her kandra and taken his place, spying on Vin at Zane’s order. Zane. He had been TenSoon’s master. He had held TenSoon’s Contract. "
oh my god. shut up already. we know this. why say it again damnit!
Location : 2335-36
04/01/10 11:43 PM
" Without her, we have nothing. We cannot create new Blessings, or new kandra, on our own! The Trust is hers, now! We should go to her. If this truly is the end of all things, then the Resolution will soon come. She will—” "
Location : 2471-72
04/01/10 11:51 PM
" Ham asked. As always, he wore simple trousers and a vest. He was a Thug, and could burn pewter—which made him resistant to heat and cold. He’d cheerfully walk around sleeveless on a day that would send most men running for "
Location : 2848-49
05/01/10 08:06 AM
" Tin helped an Allomancer pierce the mists, and Spook’s increasingly sensitive eyes were even better at this. He brushed through the mists, barely noticing them. "
we knooooooooow!!!
Location : 2876
05/01/10 08:09 AM
I'm theeditor now and I say cut this line.
Location : 2876
05/01/10 08:09 AM
" His sense of smell, like his other senses, was incredibly sensitive. So "
Location : 2988
05/01/10 08:25 AM
way too much jessu for me.... blah....
Location : 4046-48
05/01/10 07:07 PM
" We’re thieves, he’d said. And we’re extraordinarily good ones. We can rob the unrobbable and fool the unfoolable. We know how to take an incredibly large task and break it down to manageable pieces, then deal with each of those pieces. "
programmers!
Location : 4258-63
06/01/10 09:49 PM
" Noorden said, looking a bit shaken. “But . . . what if it’s not a coincidence? What does it mean?” “I don’t know,” Elend said. It means consequence, Vin thought. It means that there are laws, even if we don’t understand them. Sixteen. Why sixteen "
Location : 4282-84
10/01/10 02:34 PM
" Each slave who hadn’t been able to find at least one geode a week had been executed. There were likely still hundreds, perhaps thousands, of corpses pinned beneath the ground, lost in deep caverns, dead without anyone knowing or caring. "
omg! we know already! whats with the stupid trivial details repeating all the time
Location : 4384-85
10/01/10 02:43 PM
" “Wasing the where of what?” Spook demanded. "
this is only here, back in the past so that we can hear this style of speach agan. the author is way too in love with his concepts.
Location : 4603
12/01/10 08:26 AM
it seems like all he knows off warfair re sieges and sneak attacks. this sounds so childish when i read it... but only because ive heard it so many times before from him.
Location : 4603
12/01/10 08:24 AM
" and to endure a longer siege without running out of supplies.” "
Location : 5299-5302
12/01/10 05:54 PM
" Plus, you’ve managed—in our short three years together—to kill not only my god, but my father, my brother, and my fiancĂ©e. That’s kind of like a homicidal hat trick. It’s a strange foundation for a relationship, wouldn’t you say?” Vin just rolled her eyes. "
Location : 5547-48
12/01/10 10:28 PM
" The priests who had filled them had mostly been bureaucrats and clerks—but, then, that had been the real power of the Final Empire. Its control of resources and management of people. "
i want to stab my eyes out. we know this already!
Location : 5709-13
12/01/10 10:38 PM
" Vin stood in the doorway wearing a stunning black gown with silver trim, cut after a modern fashion. Somehow, it managed to look sleek despite the bell-shaped skirt, which fanned out with petticoats. Her pure black hair, which she often wore pulled back in a tail, was down, and it now reached to her collarbone, neatly trimmed and curling just slightly. The only jewelry she wore was her simple earring, the one she’d gotten from her mother when she was just a child. "
Location : 6751-52
13/01/10 08:21 AM
" The man was a Smoker, a Misting who could create copperclouds, "
really? do we really need to say that again 40 % of theway through the book?
Location : 7637-38
20/01/10 07:27 PM
" Ash rained down like shards of a broken sky, floating, making the very air look pocked and sickly. "
what the hell? shards ash floating? wtf?
Location : 8985-89
24/01/10 11:58 PM
" Sure enough, as he read about the religion, he saw the holes in its doctrines. True, the Nelazan had known a great deal about astronomy, but their teachings on the afterlife were sketchy—almost whimsical. Their doctrine was purposefully vague, they’d taught, allowing all men to discover truth for themselves. Reading this, however, left Sazed frustrated. What good was a religion without answers? Why believe in something if the response to half of his questions was “Ask Trell, and he will answer”? "
dig at unitarians?
Location : 9558-59
26/01/10 08:15 AM
" The power in the Well was of Preservation, and an Inquisitor could only have taken it by first removing his Hemalurgic spikes. That, of course, would have killed him. "
nut vin removed it and she has that earing...

Wednesday, January 11, 2012

Programming in Paris

Still in Paris. Things are going ok. Did you know that there are NOT fireworks around the Eiffel Tower on New Years? We didn't. No biggie, but still... a pinch of a let down. Adam emailed the Rick Steves Paris 2012 travel book we have with the correction.

So, yeah... no fireworks. And there was this whole being sick for a week thing... Spent a lot of time in our rental sleeping... and... sleeping... there was some reading at least. And sadness.

But! But! Things have been getting done! One of which was the porting of my Java Stereogram program to HTML5! The algorithm is from http://www.techmind.org/stereo/ which is great. Very dry, but I did eventually wrap my head around everything it was doing... back when I implemented it the first time ~3.5 years ago... It was a sample code project for a job application, and after combing through what I wrote back then I'm shocked I ever got hired. It was my first Java project after school and clearly I had a lot to learn. Amusing that I'm using the same project to learn/poke at HTML5 with... I've no doubt I'll look back later and wince at how ugly it all looks...

Took a little under a week of scattered work. Mostly debugging. Fucking lack of typed variables! Ran into lots of "Javascript doesn't have ints" problems... yes, yes, you can cast the value... but remembering to cram everything back into int format is not the same as/far more trixy then just having values that are and will always be int. Grrr...

----- Java ------

int b, c;

int a = b - c/2;



----- javascript ------

var a = Math.floor(b + c/2); // WRONG

var a = b + Math.floor(c/2); // CORRECT

Adam gave me a hard time about it after I found the problem. I mean, *yes* I know the difference between the two and I realize why I was getting problems.... but... when I'm re-writing code quickly, I feel like it was an easy mistake to make... :(



Another gotcha I ran into was with Canvas (a major part of the learning exercise). When trying to scale an image, remember to transform before drawing the image.... This makes total sense when I think about it (and given how other graphics stuff works) but, again, slipped my mind.

ctxt.scale(scale, 1); //don't be retarded, remember this goes BEFORE the .drawImage call
ctxt.drawImage(otherCanvas, 0, 0);

A final thing to note is that I'm using this project as an excuse to finally work with git. Yes, I know I can set git on my own, but I didn't see the harm of using github to track the work. Now all I need is an actual web hosting service to host the page! Anyway, I'm still very much working on the Stereogram code so don't judge too harshly by what you see uploaded now... I'll post again when it's pretty (and hosted) : https://github.com/sithel/Web-Stereogram-Generator

Todos:
  • Lift code to let you save canvas images
  • Made the page less ugly
  • Make sure everything works (just now fixed another rounding bug)
  • Add some tests
  • Provide sample images for depth maps and tiles (the quality of the tile can greatly affect the result!)
  • Find hosting for it
  • remove JQuery need- only used that because I was lazy initially

Friday, July 15, 2011

Generics Suck

Never before have I experienced such rage and failure with Java as I did this week at work. Blah.

Not only did I find finding documentation about it difficult but talking to someone about it proved almost too much. I suck more at knowing the vocabulary then I normally do.

I'm having difficulty articulating what exactly one of the problems was... It had to do with the fact that :
List<subclass> extends List<superclass>
doesn't really work, you need:
List<subclass> extends List<? extends superclass>

All my method and class signatures got super bloated and became obnoxious to read.

Also, while this didn't really factor into how I was fixing the problem, I was boggled to learn something new about the Java language. I may not be great at a lot of things, but to find something totally new after a couple years working with it is... surprising. And perhaps sad.

Anyway, did you know that you can pass type parameters to a method? Like:
fooObject.<X,Y>barMethod();
Woaaaah! Crazy! I'm used to only seeing instance variables and constructors use the <>s when declaring something...

In other news, in other areas where I suck less, I still haven't killed any of my bottled plants. In fact, several seem to be thriving.

Sadly the lettuce (not pictured) is getting rather wilty... so that'll probably be my second failure-- the first being that the catnip NEVER SPROUTED. Everything else I've grown from seed just fine, but the catnip refuses to wake up. Damn.

Thursday, April 14, 2011

The Tichu Project

I'm a Java head. Love it. Love Java. It wasn't even the first language that I learned, but I still love it. I think it fits particularly well with my learning and thinking style... general concepts, without getting into the nitty-gritty of things (like C). There's some order to it though, variable typing is a must for me to feel comfortable.

The best part of Java is the JavaDoc though and the libraries... as someone who can't hold more then 2 digits in her head at a time, I adore the way I need not actually cache knowledge about Java in my memory. So while I consider myself "good" at Java, I could not recite near anything to you on demand...

But, anyway.... Java. Yeah. Awesome.

However, in the real world of life where one strives to impress others, knowing more then just one trick is good. So I decided I should learn Python. I'm using Flex at work so I've already started dipping my toe into the waters of insanity- AS3 is a bit too loosey-goosey scripting like for me. But I hear so many good things about Python. All the cool kids are doing it. As is Google App Engine.

App Engine apparently comes in two lovely flavors- Java and Python... and rather then go for the known tasty option, I'm taking the opportunity to broaden my pallet. Python it is.

It's not going that well so far though.

Fucking lack of typing... I forget what I pass around! If I'm picking up code tomorrow that I wrote yesterday, how am I supposed to remember what everything is?? Also, blah, the documentation on line.... maybe I have to learn to read it first... but right now? I think it's ugly.

App Engine on the other hand is looking pretty awesome so far. Yay.

Hence the Tichu Project... it always helps to have a *reason* to learn something new. So I'm trying to code up an online multi-player Tichu game. Never heard of it? Neither had I really... my artist friend Mel is making a themed deck of cards for the game and I thought it would help us both if they were put to use in a public place.

So... yeah... it's my first personal coding project in quite some time... wish me luck.