Showing posts with label js. Show all posts
Showing posts with label js. Show all posts

Friday, July 22, 2011

Moving along with Validation

Just a couple things to share today:

HTML review is complete. Probably missing some essentials, but the core is there and I can more on to CSS. Best things I realized:

HTML is all about structure. It should really be all about the framework.
CSS is all about presentation and what I want all this information to look like. The more I break it up with id, class, div, span, the more unique the website can be.
I assume, then, that JS is about interaction. How the website works with the user. This is where the legit coding comes in, and ideally, where I can start using my ruby background to design some really neat things.

Also want to share a couple one page web app links:

Get Skeleton: This is a framework that helps you format a single webpage. All the code you'd ever need.

Node.js Web App: From an up and coming startup founded in New York City (I believe), a founder shares how node can be used to form a solo page for a web app. hij1nx breaks it down fairly clearly--skills coming from his lecturing experience, I think.

Follow my splash page work on github. It's slowly coming along, and I have a much better idea of how to present all this information now. Looking forward to writing all original blog CSS code as well.

Tuesday, July 19, 2011

Interview Week 1 Completed

Just finished the last job interview I had lined up of several since last week. There are two hopefuls; one I'm hoping I'll hear back from soon, the other wants me to come in for round two later this week or next.

I'm meeting with Jon to discuss some website designs for his Disc Jockey business. Hopefully he will approve a couple, get me the things I need from him, and then I can get this website figured out by the end of the month--something to add to my starving portfolio.

In the meantime, working on splash page for heypodo.com (I'm sure everyone has noticed the contents is just a blog for now), and flipping through this article on web standards sent by Chris Korhonen. Another reader suggested I run the webpage through my mac, though I'm looking at more "open" hosting options. I assume I can get through this and write up my own blogger markup for something more interesting than this simple template.

Till then!

Saturday, June 25, 2011

Exceptions! And all that other nonsense.

I puttered through Eloquent JS chapters 4 and 5 after falling asleep last night about half way through chapter 4. Can I blame myself? The majority of the chapter was about cats. I get enough cats on reddit.

Today's valuable lesson, however, was in error management, something I completely suck at (some might say epicfail). I learned about catch and throw, which is useful when certain qualifiers come up, say... an error you expect, and you need the program to zoom through to another block of code, ignoring all previous code.

After reading about that, I said, hey! This is how I'm going to fix my secret santa program! As it turned out, it didn't work the way I wanted it to in Ruby, so I will have to practice catch/throw a bit more to make sure I get it. I tried 'raise' as well, but all that does is shoot out the error that I was already expecting. I imagine raise being more useful when you expect your code to produce an error later if certain parameters are not correct.

So after much strolling around the internet, I ran into my true solution (for now) on tutorialspoint.com, where I learned about something Chris Pine just glanced over when explaining loops. Apparently I can use 'retry' statements to start loops over if something goes wrong--in this case, if the person is left with himself to pick.

I'm going to try mu is too short's solution as well (listed here), because it just dawned on me how simple it would be in comparison.

Tomorrow is Engagement/Peace Love and Firefox at Dolores Park, so I think I'm gonna try and get down there for ice cream and swag.


EDIT: And before I forget, my Secret Santa code is on github here: https://github.com/podopie/startingruby/blob/master/secretsanta.rb Also celebrating +100 hits on the blog, which is awesome since I've only had it for two weeks! Here's hoping to getting at least 1000 hits before the summer ends.

Thursday, June 23, 2011

Moving on with Eloquent JavaScript

After cruising through Metal Gear Solid last night (such a great critical thinking game!), I read through chapter 3 of Eloquent JavaScript. I'm avoiding my original idea of skipping ahead after reading this chapter; there was some great content that helped explain a lot of the fundamental ideas in Ruby that I already was slightly aware of, but actually took the time to explain them in detail. These would be scope, stacking, and branching, the last of which was brand new to me.

Scope

Scope, to my understanding, is all the different levels of the program. I think the best personal example I can think of is a book. Books consist of the "book," or top-level, chapters, or different methods, and the literature (or just words). Variables can take place on various levels of your scope, so it's important to consider when writing a program the organization and scope of your variables. When I last posted on stackoverflow, I got asked why I used global variables ($), especially because Ruby makes it almost unnecessary. This would be... me not thinking about my scope.

Stacking

I posted my first question at stackoverflow on a stack error. Stacking essentially is Inception, or how many levels deep you go. Fortunately (or unfortunately, depending on how you look at it), computers only allow so many stacks, probably in the tens of thousands. I know you can increase it manually, but most of the time it's not necessary. Anyway, if you're using recursion, and the stacking NEVER STOPS, you'll eventually run into a stack error. They look a little different between Ruby:
SystemStackError: stack level too deep
and JavaScript:
RangeError: Maximum call stack size exceeded
but mean the same thing. Bright side of things: I can create a stackerror on command. The world is mine... recursively.

Branching

If you can figure out stacking pretty well, branching is the idea of working with a flow chart. Eloquent JavaScript adds to this mix or even more lucrative branching, letting more than branch work at the same time using ||, the computer equivalent of "or." I'll post an example of this later tonight in Ruby, borrowing the original example from Eloquent JavaScript just to practice my Ruby skills... or rather translation skills.

Till then! Time to make dinner, and then back to go from learning to using.