JavaScript 4 Hire

08.29.2014

Today"s blog is for my own ego, to show what nearly 2 decades of web development actually does for me.

Yesterday Jacob told me of a little JavaScript job I could do for a site he manages. The crux is that sometimes an id will be passed along through the URL, and when that happens it needs to replace that id in a link on 2 pages. People might browse around on the site, but if they originally come in with that special id, it needs to be the one in the link on those 2 pages.

The actual description of what was needed wasn"t much like the above, as it went into unneeded detail about where links were coming from and going to, with special names for each.

This all had to be accomplished via JavaScript as the site is hosted on a server with no server-script side access. Jacob thought of because I know JavaScript and passed it along. While I know JavaScript, I have to look up a lot of the syntax, but I know how JavaScript works. Especially with the help of the Google.

I talked to Jacob to make sure I knew what was going on (see my re-written description in the 2nd paragraph above) and went over my plan:

With the above in mind I set out on the handy home PC and got to work. I found a function online to read in variables through the URL so JavaScript could access them. I found a nice set of functions that let me create and read JavaScript cookies by name (by default it"s just a string with all of the cookie names and values stored). I found a good example of regular expression replacement. After a good hour of programming, which took two to three times that as I kept getting sidetracked and was doing laundry at the same time, I sent it all off to Jacob to try out.

And it didn"t work.

The id would change on that initial page load with the id in the URL, but then it got lost.

So I looked at saw that on the live site each page appears under a different directory. Maybe it was a problem with cookie path permissions? I made a local test with files in sub-directories and had the same results as Jacob. The problem I suddenly had was that everything looked right in debuggers, inspectors, etc. Everywhere but where I had an alert box that was supposed to pop up when JavaScript found the cookie. After a quick chat with Jerry, I decided to just write out what the JavaScript cookie string was.

It turns out the handy dandy functions I found online for creating and getting named cookies worked fine if nothing else on the site wrote a cookie, as these functions used a completely different delimiter than what already existed. As such, my new cookie was getting merged into an existing cookie thanks to having the wrong delimiter. I Googled up a fix (just show me functions that work better!), tested it out, and sent it to Jacob.

And it still didn"t work.

Luckily I had an early breakthrough that would have had me beating my head for a long time. I noticed that on the live site, if I went to http://website.com?id=blah it quickly redirected to http://website.com/?id=blah. This is probably a side effect of some type of SEO URL parsing optimization. Unfortunately, it wasn"t cooperating with my script to read the URL and grab out the id as that added slash broke the JavaScript window.location.search parameter and left it blank as opposed to filling it full of juicy parameters to parse. After a couple of passes of trial and error I figured out how to get the parameter values out, and from there tested some more and passed it along to Jacob one more time.

This time it worked.

This was a little project that was estimated to take 2 hours, that I knew was really 30 minutes of coding. I worked on it off and on for 6 hours, which was at least 2 hours of real work. While I couldn"t remember the syntactical details of all of the JavaScript, I knew enough about how JavaScript worked, what it"s capable of, and more importantly what it"s not capable of, that I got this working and was never in fear of it not. Each time Jacob deployed the code and it didn"t work, I knew where to look (and what to look for) to get a fix coded.

Over the past 2 months of sending out resumes, I tend to underestimate and undervalue my skills when I talk to people - mainly recruiters. While some JavaScript programmer, or even a front-end developer, could have made the above chunk of code in much less than 2 hours, and there"s a good chance it would have worked the first time instead of the third, I can do that plus a whole lot more. Plus, I enjoy doing this kind of stuff. It was a little frustrating when the code didn"t work, but got a little excited about figuring out what was going on and how to fix it, because I knew that I was going to get it done.

I will now return to my humble self. Except when I talk about how far I"ve been walking.


programming/interweb

Dead Walking Season 4... No, 1?

08.28.2014

This evening, after having a pretty good day, I decided to eschew my normal routine of watching and coding along with some Unity tutorials and instead popped in disc 1 of season 4 of the Walking Dead, freshly delivered to my stoop yesterday. At the end of the first episode I was completely lost.

The gang is back at the prison. There's a whole gaggle of people milling about and I don't understand who they are or why they got there.

Somehow I've skewed story lines between the comic and the tv show. I knew it would happen. I remember it happening a little when I was watching a couple of episodes from season 3. But I've got some Walking Dead Dementia/Alzheimer's going on now.

Is would make the most sense to either re-watch the last episode or two from season 3, or more easily go online and look at season summaries. But this is an opportunity for me to start over and re-discover the episodes. I like Walking Dead as it captures what I like about the zombie genre - you're not going to win, just see how long you can survive. I think I remember most of what happens in the first season, but I'm going to start over with episode 1 anyway.

I watch movies multiple times and enjoy them. I've watched the entire run of Friends and Frasier multiple times. Why should I feel so bad doing the same for Walking Dead?


movies/tv/dvd

Job Searches and SQL.

08.24.2014

After almost a month I'm still on the job hunt. That sounds a little bad, but I'm still limiting my job hunt searches to those jobs I wouldn't dread going to (i.e. not on the Arsenal). On Thursday I had a phone screen/interview with the local credit union that was supposed to last around half an hour but instead was closer to an hour. That may sound like good news, but the more I talked to the guy the more I thought of how I wasn't a good fit for the job. A lot of that stems from my lack of formal learning of .net and the Microsoft world it comes from. I know how to do plenty of things, I just don't know the name of what it is that I'm doing. A lot of that comes from years of anti-Microsoft thinking ingrained in my head.

My phone call also led me to think that I need to add more details into my resume. I worked on getting my resume down to 2 pages and only managed 2½ instead. When I was talking to this guy, he seem shocked that I knew HTML. I've been writing HTML for 18 years. How did I not stress that on paper? With that in mind, I've gone back and filled in more details per job and listing all of the little things I've done, especially HTML, CSS, and writing SQL queries, as those seem to be the big questions I'm asked about.

Speaking of SQL queries, my phone call had an interesting question or two when I told the guy I knew and had written plenty of SQL. He casually asked if I knew the difference between a LEFT JOIN and a RIGHT JOIN, and I casually answered yes and told him it just depended which side of the tables you wanted your records. He then asked casually if I knew what a UNION was and I told him it returned all the records from both tables that met the search criteria. His questions were so easy I started thinking about it afterwards. Was there something simple I had missed? I don't know if I had ever written a UNION query, but I made JOINS all the time. 99% of the time I just used the default LEFT JOIN and didn't really think anything about it. So I went to the Google to make sure.

Luckily what I thought was the difference between a LEFT and RIGHT JOIN was right. They're the same, at least the way I think about it. I found out that UNION is a little different than what I thought, or more importantly how I was asked. In a JOIN, records are combined in the results. In a UNION, records are tacked on to the results.

How often am I really going to need to use a UNION?


programming/interweb

I would walk 400 my-uhls - is that a song?

08.11.2014

It's been a little while since I mentioned anything about my walking regimen, but I'm still going at it. I've switched from 5 times per week to 3 times per week, but upped my distance per walk from 3.7 miles to 4.5-5. I've also slowed my pace a little, due in part to not walking as much with Gina (as she tries to get over a bout of plantar fasciitis) but a slower pace is also easier on my knees. I tell myself the longer distance helps to make up for it.

I've also started walking in the morning instead of the evening. Starting a walk at 6AM helps to beat the traffic, plus just moving around during the course of the day seems to help keep me from feeling as stiff as when I walk and go to bed soon thereafter.

I'm not sure how much of this is in my head and how much really makes a difference, but I still feel better every day.


diet gastric sleeve

Painting The Next Generation

08.06.2014

As I've been talking about painting something other than Dust minis, I finally moved forward!

I did not move forward to any of the minis previously mentioned, instead I dug out the War Rocket ships that Jerry gave me for Christmas a year or three ago. Painting non-people is a little different - more smooth surfaces, which I'm not quite as good at painting, at least not yet. As such, the War Rocket ships are my tutorial and learning squadron!

The first ship, well, the first ship didn't have a picture taken since I learned a lot from a lot of little mistakes. First, red paint doesn't cover primer worth crap (the above pictured ship was primed red to begin with). I also tried varying my order of washes, highlighting, and painting (not a good idea with light/bright colors). As such, the first ship is now sitting in a bath of Simple Green to see if the paint can be stripped and the ship salvaged and re- primed. This worked with a batch of Dust minis, so I'm holding out hope here as well.

For the above ship, it was primed red - plain old Krylon Flat Red. After that I added some gold (Vallejo) and painted anything window-looking a shade of what I can only point at as baby-blue (another Vallejo paint). Just to see if there was a difference in how metallic paints covered, I used a different brand (Citadel) silver. To wrap it up I washed the ship in a black-ish wash (Citadel- Nuln Oil) and went over everything with my usual gunmetal silver drybrush.

I missed a few spots of detail here and there, and there's an errant drop of silver on the top of the hull. Overall, it looks about as good as I had hoped. I'll pick out another ship later and try a similar color scheme and perhaps try to pull out a few more details - the canopy is going to be a challenge to get all the details and not overlap the paint.

Below is a sample of the final ship (above) versus a freshly primed ship with the windows filled in. Before putting them side by side, I hadn't noticed just how much darker the wash and drybrushing turned everything. It's not nearly as comic-book-like as I originally imagined/feared.


gaming miniatures hobbies

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)