Javascripting & MVC

10.15.2015

For the past couple of weeks at work I've been writing a lot of Javascript. Traditionally Javascript and I don't get along. I'm not completely sure why, Javascript has always been a part of web development. Even in the 90's, although it was avoided because it was evil and could be coerced into doing bad things to your computer. These days, Javascript is a fundamental part of the modern online experience, responsible for the seamless back and forth of data that doesn't interrupt the web page you're looking at. It puts the "fun" in "fundamental"!

It's also responsible for a good chunk of the "mental" in "fundamental" too.

Granted, I don't know the right way to do a lot of things in Javascript, but I can generally hack away and figure them out. Gone are the days of embedding events in an object to go do special things when you click/type/look at a textbox or a button. Now the hip cool thing is to search the Document Object Model for that textbox and button, then add a listener object for when you click/type/look at it. It's of great benefit to add listeners as you can add multiple listeners to a textbox or button. And that's got to happen at least a couple of times every few years.

The above is a by-product, I think, of modern programming separating the code from the design. Adding those embedded events meant that I knew, from a code standpoint, that certain things were fairly certain to happen. With listeners, it's not imperative for those things to happen and they (I think) handle things better when stuff's missing.

But I still make code and design. I don't hand off the logic to somebody and say "go lay this out and display it properly". I'm still in 1997 when there was 1 guy that did everything for a website. Knowing what a pain it was to be that one guy, I should be better accepting of how code/design is at least trying to evolve.

But then I look at the file I worked on last week. It was an HTML table that had 3 columns on each row that you could click on and it would either toggle Yes/No text that was displayed, or edit a number that was present (without turning into a textbox). It took 2½ days for me to make, and it even has a spiffy green background that would fade in to show you had successfully edited a field thanks to a 2 minute Google search-copy-paste. The problem was that the 1 new file and 1 edited file I used was implementing the old, pseudo 1997 way of things. I had to convert it to the new, hot 2015 way.

A week later, with 7 files involved (not counting the usual included files each page on the site has) it was finally working, doing the exact same thing it had been doing a week earlier. It shouldn't have taken that long, but I was fighting with Model-View-Controller object interaction AND that damn Javascript. Javascript that I had working once but all the references changed, somehow, thanks to the MVC setup.

But I learned. I learned the hard way, the painful way, which means it should stick.

And then when I was done, I learned there was a 2nd set of things to do that nobody told me.

Now I'm not done again. I have to return to the breach of MVC and Javascript. As painful as it is, I actually enjoy it. It makes more sense as I step through and use parts. Maybe not common sense, but I can see why it works. And even though a different command may work just as well, I'll use this new stuff I'm supposed to.

One of those reasons to use MVC and our homegrown Javascript objects that just seem like a glorified wrapper popped up earlier. When I develop and test I use Chrome and I often forget to try different browsers. I'm just lazy that way. I've got a Javascript function that will loop through and show all the properties of a Javascript object. When I wanted to toggle those Yes/No fields earlier, I looked and saw an innerHTML property that had what I wanted. Great, I used that. When it came time to edit numbers, innerHTML messed me up when I went to validate that number because any extra characters (space, line break) were converted into HTML and thus made my number not a number. I looked at the properties again and found innerText that had, you guessed it, the text with no HTML. Great, I'll use that. Everything worked great.

Until I switched away from Chrome. There was no innerText. There was no innerHTML.

The cross-browser friendly field turns out to be textContent. I think there's a library call I should have been making that would have grabbed the right property for me. Maybe after 20 years of making websites I should know textContent is the right property to use. But I didn't. Until now.

textContent. That's the ticket.

 


programming/interweb

Tinkering Lament

10.07.2015

Wednesday afternoon was my last (hopefully) mowing of the year. I've had little problems with the mower this year - gas in the carburetor, some kind of belt broke - but for some reason I actually enjoy riding around on the mower so I get things fixed and continue on instead of going back to the guy that I used to have cut my grass.

Most of the things that have gone wrong with the mower were things I could fix if I knew how. Replacing a belt isn't the same as rebuilding a carburetor, but how hard can replacing a belt be? According to a 10 minute YouTube video it's not impossible for the common man. But I lack the fortitude to get in there and try to fix something and not give up in exasperation before something goes wrong. That's why I ended up spending over $100 to replace a $10 belt. Labor and getting the mower carried back and forth adds up.

At some point I decided I was too good to learn how to fix things with wheels. I can narrow it down to when I had my Camaro, and thanks to the combination of being in my teens/early twenties and not able to afford to have someone else fix all the little things that go wrong with a car that was 10 years old when I bought it, me and Terry were constantly fixing all the little things that go wrong with a car that old. And of course, fixing it once NEVER meant not having to fix it again.

With the above said, yesterday when I started to mow I noticed the front right tire didn't look right. My front tires on the mower aren't aligned correctly, I think thanks to hitting a trench not filled in deep enough from my water line replacement 2 years ago (this is on my "get them to fix it next year during the mower tune up" trip list). The tire looked low, not like a car tire does where the weight just kinds of flattens it out, but low as if the tire was skewing on the wheel rim. I hopped off the mower and pressed down on the tire. Yep, it was flat. Well, crap, what do I do now? How do I get air in a mower tire at home?

Back on June 5, 2013, I purchased a Black & Decker air compressor for Amazon. Why? Dunno. At the time I thought I needed one. In the garage, inside a cabinet, I finally opened the box which held that air compressor and read the instructions. Fortunately those instructions boiled down to "plug in, attach hose, inflate" and I was able to continue on mowing with a tire full of air.

It's likely that tire's been flat for a while and it's only my paranoia of getting through 1 last ride for the year before putting the mower away that made me actually notice something was wrong. I felt way to proud that I was able to put air in a tire all by myself. I wish I knew how to (confidently) take care of the other things the mower needs on an annual basis, things my grandfather used to do both at work and just in general - for some reason I remember him sharpening mower blades for our mower when I was little. I have no idea how to sharpen a mower blade, or even change the oil or whatever filter(s) the thing has. While the internet can show the steps for all of this, there's a part about getting your hands dirty and twisting everything around that I tend to screw up.

This sounds like some type of night class that should be available out there. Likely taught by some 14 year old kid.


random

Tracking the Future

09.30.2015

Last week Iplaced an order for gaming stuff I don't need.  Honestly, I've got so much do I really need more?  Mostly I've been wanting better bases on which to mount the minis I've yet to paint.  Miniature Market, my #2 go-to store based out of St Louis, told me they were running a sale on one of the normally overpriced line of miniatures in which I've shown interest  in the past.   So of course this means I have to go buy stuff!!

When placing a gaming order with any of these places, there's usually a minimum order amount that garners free shipping. Well of course I reach that amount! Miniature Market provides free shipping with FedEx Smartpost - FedEx picks up the parcel, then hands it off to USPS at some point to finish up. Once the order was filled I got an email that the estimated delivery date would be Sat Oct 2 (a week from when I placed my order). No problem, I'm not in a hurry to put stuff on a shelf with all the other stuff I've ordered in the past. The last time I placed an order with them I was notified of a similar time frame, but it actually arrived in half the time. With today being half the time for the current order, I checked the tracking and saw the following at Sep 30 7:30AM (Central):

Tracking Number: 61299991028020279865
Carrier: Federal Express
Status: In transit
Delivered on: Oct 2, 2015 12:00 AM
Service Type: FedEx SmartPost

 

Location Date Local Time Description
HUNTSVILLE, AL, US Sep 30, 2015 11:01 AM In transit
US Sep 30, 2015 6:00 AM Shipment information sent to U.S. Postal Service
FEDEX SMARTPOST ATLANTA, GA, US Sep 30, 2015 4:38 AM Departed FedEx location
FEDEX SMARTPOST ATLANTA, GA, US Sep 29, 2015 7:47 AM Arrived at FedEx location
ELLENWOOD, GA, US Sep 28, 2015 11:20 PM Departed FedEx location
ELLENWOOD, GA, US Sep 28, 2015 6:55 PM Arrived at FedEx location
WARTRACE, TN, US Sep 26, 2015 4:30 PM In transit
SAINT LOUIS, MO, US Sep 26, 2015 3:25 AM Arrived at FedEx location
EAST SAINT LOUIS, IL, US Sep 26, 2015 1:38 AM Left FedEx origin facility
EAST SAINT LOUIS, IL, US Sep 26, 2015 12:04 AM Arrived at FedEx location
US Sep 25, 2015 9:08 PM Shipment information sent to FedEx

At first glance it looks like my parcel is in transit (to? from?) Huntsville - in 3 hours. I laughed a little at the location of "US" twice (it's just info being passed off, but still). The parcel stopped in Wartrace, TN on the way from St Louis to Atlanta. I've never heard of Wartrace, but it's only 75 miles from Athens. Maybe that's why my parcel is listed as being delivered on Oct 2, it's gone into the future from Wartrace and has been delivered.

Online tracking is never exact, but I'm used to seeing it behind/updated slowly rather than showing time updates for what's yet to happen.


gaming miniatures random

Reading is half a battle

09.10.2015

It's no secret that I enjoy GI Joe, in all forms of media. After years (and years) of collecting I've finally decided to make my way through the IDW comic series. The series started in 2008, so I'm a little behind. I've read the comics intermittently, but I've never gone through the whole story line (which is still continuing). While I probably have the individual issues, I don't read them. I know, it doesn't make a bit of sense. I wait until the issues are collected into trade paperbacks and then I read them. I just like the heft of ~6 issues collected together. My problem here is that GI Joe isn't 1 title. It's many. Many that I haven't kept up with. Thankfully Wikipedia has the order the trades in which the trades were published. I've missed a few along the way, and I can never remember the order. That brings me to this post, a post just for me so that I can go back and reference what the next book I'm supposed to read is, because I keep forgetting to bookmark the Wikipedia page.

Plus I've got some collections/compendiums that lump together what Wikipedia lists. There are also some that I'm missing, but I doubt that will last for long.

 

7 years of reading to catch up on. The collections I've read cover 2008-mid-2011, but I'm not really in any hurry to get through them all. I've been enjoying them.

Sept 22 Update - Now reading Snake Eyes/Storm Shadow and still getting a kick out of it all.  Makes me miss the days I had the laser--rifle troooper Flash with a JUMP pack flying around, shooting unseen Cobra troops hidden somewhere in my grandparents couch.
 


books/comics

Russellmania.com 2015 ¼-Marathon!

08.22.2015

August 22, 2015 saw me as the winner of the 2015 Russellmania.com ¼-Marathon! I managed first place in this special event held near Athens High School. The route started at my car, which I found very convenient, and passed through scenic Athens, but away from traffic. Finally, after a grueling 6.55 miles that saw temperatures vary wildly from 68° to upwards of 71°, I managed to triumphantly pass the finish line FIRST after just over 2 hours. A finish line that was, again conveniently, at my car.

I was worried I might be beat out by the Kenyans, or even worse, that group of women pushing baby strollers, but I need not have fretted. I was first. FIRST! I wonder if they knew there was a race going on...?

The race wasn't without dangers. There evidently was a bicycle race going the opposite direction, as a dude on a bike passed me a couple of time. And he was flying. Although since we were going opposite directions you may need to take into account that I was viewing our relative speed, so maybe I was flying! Still, we need to talk to race organizers about concurrent races sharing the same route.

I would like to thank everyone for their support, without which I couldn't have realized this accomplishment.

First, I'd like to thank the little infant baby Jesus, laying there in his little heavenly bassinet and most likely with his little baby Jesus thumb in his mouth. I know it's not Thanksgiving but shout out to you there Lil' J.

Thanks to the Kenyans for not beating me.

Thanks to the race organizers for placing the start & finish lines at my car.

Now I've just gotten the official race results. I finished 1/1 overall. 1st in the Men's Division. Also managed 1st in Women's, Handicapable, and Breathing Heavy Divisions. Huh, it seems since it was a field of 1 I technically also came in last place. Well that sucks! I'll over look that part. Ooh, I won't even post that part. I'll hit delete and nobody will ever know!

 


Crap. Hit "Post" instead of "Delete" so now it's too late.


random

Blog Archive

As always, correct spelling is optional in any blog entry. Keep in mind that any links more than a year old may not be active, especially the ones pointing back to Russellmania (I like to move things around!).

Tags have been added to posts back to 2005. There may be an occasional old blog that gets added to the tag list, but in reality what could be noteworthy from that far back?

Blog Tags

3D Printer (26)
4ground (32)
4ground-mall (40)
action figures/toys (10)
airbrush (7)
Aliens (1)
Amazon (12)
antenocitisworkshop (11)
Atlas O Gauge (2)
Batman Miniature Game (2)
Battletech (1)
belt sander (12)
Blood Bowl (4)
boardgames (77)
books/comics (19)
computers hate me (5)
conveyances (15)
diet (53)
dreams (7)
fallout (1)
Foundry (3)
Gale Force Nine (1)
game dev (22)
gaming miniatures (227)
gaslands (10)
gastric sleeve (34)
Green Stuff World (2)
Hasslefree (9)
Hero Forge (1)
hobbies (101)
Jailbirds Minis (1)
kevin smith (1)
Knight Models (2)
malifaux (2)
Marvel Crisis Protocol (2)
mckays (1)
models (9)
mom (32)
moon light (5)
movies/tv/dvd (60)
ninja division (1)
Pathfinder Deepcuts (1)
pilonidal cyst (5)
plastcraft (2)
programming/interweb (41)
rambling (60)
random (365)
random maintenance (3)
Reaper Bones (3)
reaper chronoscape (32)
renovation/remodelling (24)
road trip (26)
salesforce (1)
sarissa precission (2)
scenery (16)
studio miniatures (3)
ttcombat (12)
video games (51)
walking dead (36)
wargame foundry (3)
work (6)
wrestling (45)
zombicide (1)
Zombicide Invader (19)
zombie mall (23)