In The Now

Category: Professional

405 Error Loading Spring Resources

by hadaad

I find, as I get more experience programming, that the times when I’m laid up for a half a day or more with an issue are more rare than they were when I was greener. However, the problems, when I do run into them, are more insidious and a heck of a lot harder to pin down.
Today’s problem was brought to you in the form of a 405 error when the page loaded and attempted to fetch javascript and css files. I looked into the configuration. That’s always where things like this reside. I want to say that I learned a lot about the ways that resources are loaded and the different configuration options that can be used. Maybe strategies that could circumvent the problem. But that wasn’t the case. Instead, I spent the afternoon backing out changes and reintroducing them one by one.
Eventually, and it’s funny because I backed out and reintroduced every change and it was the last possible file, the one that had me saying, “No way it could be this one,” when I finally figured out what was going on.
In a controller, annotated with @RequestMapping, the method was specified, but the value was not. It was also nat specified at the class level. So it is my conclusion that Spring chose to use the no-value RequestMapping method as a catch-all for requests that were not specified by other controllers and RequestMapping methods. That means that any get request couched in a <script> or <style> tag as well. And since the method in question was a POST handler and no such GET method was specified (it was, but it had the value attribute filled in), I got the 405 error for the implicit get of the <script> and <style> tags.
So, if you, like me, search these kinds of things before getting into serious debugging, keep in mind to check out your request mappings. It could save you a pile of time playing with source control.

[tl;dr: if you're getting 405 errors in a spring web application, check that all RequestMapping-annotated controller methods have a value, either at the method level or at the class level]

[Note: has this post helped you out? Please let me know in the comments. It will keep posts like this one coming. Thanks -- L]

Bob’s Ugly Blue Truck

by hadaad

It was a 1987 GMC. It was baby blue. It either used to be an automatic or had the steering column from an automatic installed but it was a 4-speed manual with the shifter on the floor. This truck was exactly what I said. It was Bob’s Ugly Blue Truck.

There were flakes of … something on the bottom of the gas tank so that if you let the tank go below about a quarter of a tank, those flakes would get disturbed and they’d get caught in the fuel filter. At that point, you could replace the filter or drive around with no power. One time, Meghan was driving the truck home and the fuel filter got dirty. I think she said it took her almost twice as long to get home as it should have.

The steering wheel had been replaced with a racing steering wheel. This was because the man who sold the truck to my dad was a big man and couldn’t fit his legs under the steering wheel that came with it. But it looked ridiculously out-of-place in the cab of that truck.

The tires were always going flat. There was one time I had to jack the truck up on a jack with 4 2X4s providing enough height to get the tire changed. That was a quick and stressful job.

I tell you these things not so that you’ll understand why I hated the truck. Because I didn’t hate it. It got me around during university. It got my stuff down to Lethbridge. It was a more relaxed driving experience. Someone once saw me driving down to Lethbridge and described my driving as “old man slow.” It helped me move friends. And even while it had the occasional fuel filter problem or flat tire that saw the truck up on the rickety, jury-rigged jack system, there was nothing ever wrong with it that I couldn’t fix myself.

I think Dad retired the BUB truck some years ago, when he upgraded to a Dodge Ram but I sure did appreciate the use of Bob’s Ugly Blue Truck while it lasted.

Adventures in Ajax

by hadaad

[Disclaimer: this post will have little value to you if you are not developing a web application with Spring MVC and AJAX. Still, it’s always funny to some to read the multiple ways that I screw up so enjoy! -- L]

Have you ever seen something that just shouldn’t happen? Something that made absolutely no sense and was wrong just on the face of it? Like if you’d entered 1+1 on the calculator and not gotten 2? That happened to me today.

No, not the calculator thing. Unlike my grandfather, I trust calculators with simple math. No, I encountered something that should not have been.

I made a GET request through ajax to my web server. It hit the breakpoint, which convinced me that the connection was made. The appropriate object was changed in the database. And the response was returned.

The browser interpreted it weird, though. It was treating the request like a 404 error. Resource not found. Don’t give me that crap, I just saw it hit the server!

It took some time to figure it out but debugging showed me that it was trying to create a ModelAndView for the return. That’s when it hit me. My ajax call was trying to redirect the browser and the response I was returning would obviously not be found since it wasn’t a view. After that, it was a simple matter to discover that I was missing the @ResponseBody annotation from my method. The 404 message on the Ajax was too vague and said that the endpoint I’d reached was not found when it was really the return value from that method, which should have been returned to the page as it was.

Bisonweb Update

by hadaad

The thought was, when I became a contractor, that I would sign with Haemonetics and spend two or three years with them, working on the DoD project and eventually moving on in 2011 or 2012. That didn’t happen. Instead, I found myself scrambling for another job when the contract and the project were both cut short in March 2009. Since then, I’ve had a long-term contract (again with Haemonetics — this time working on the commercial project instead of the DoD side) but other than that one, my contracts have all been relatively short, from the 8-week contract at Accenture to a couple of 6-month contracts (one of which extended out to 8 or 9 months).

What I’m looking at after my current contract are three prospective opportunities.

Opportunity #1 is six months with no appreciable change in salary. I interviewed with that company today after testing for them last week. They’ve assured my recruitment agent that I’m their #1 candidate and that they feel I would be a great fit for the company and the project. This contract starts March 1.

Opportunity #2 is a one-year contract with a possibility of two more years after that. There is, again, no appreciable change in salary. I interviewed with them last Thursday and, if it was offered, I think that this is the position that I would take. Two problems exist for this, though: They are taking their time to decide and the position doesn’t open until April 1. Which leads us to:

Opportunity #3 is an extremely short-term contract. Originally, it had been slated as a 4-month contract but, as I talked to the hiring manager, I told him that the long-term contract I hoped for started on April 1 and we discussed the possibility of a 1-month contract with some fill-in duty after hours in the time after. This interview went about as well as I could have hoped and we both came away feeling really good about the situation. There are two problems with this, though: The hiring manager doesn’t have the authority to change the agreement like that and I can’t take this position if I don’t get opportunity #2 as well.

So, I’ve been offered opportunity #1. Numbers-wise, I would rather have opportunity #2 (and #3 thrown in there as well). Thing is, the folks at opportunity #1 talked a really good game. I like the sound of what they’re doing, it sounds like the team is really good, they’re really making a push to go agile (which has the buy-in of management and everything) and it’s the bird in hand. I’ve communicated to my agent at opportunity #2 and let him know the situation. I explained that I need to make a decision by the end of the day tomorrow. If I don’t hear back from him, I have to take opportunity #1. The thing is, that’s not a bad scenario. I want to have a long-term contract again but the combination of team and work from #1, not to mention that I’ve always preferred the hire-fast mentality, means that, while it wouldn’t be my first choice, it’s a pretty good choice to get to make.

2012 High (and Low) lights of the LAST YEAR EVER

by hadaad

I’ve done a number of these year-end things where I try to wrap up the year that was. I’ve tried different methods and I haven’t found the right one. The month-by-month always seems to favour the more recent months because of obvious reasons.

This year, I’m going to do a point-form scatter-shot of the year that we just had. Some of them may seem insignificant, I’m sure, but if I remembered it, I’m guessing it was not terribly insignificant to me.

Moved out to the country. I couldn’t have a wrap-up of this year’s events without including the most significant change our family has had since Olivia was born. Things are working out great at the new place and, thanks to the help of our amazing friends and family, we moved in halfway through July. The biggest highlight of our new house, so far, to me, is going outside to get a container on Christmas morning, only to see a moose in the clearing down the hill. The biggest lowlight was the ever-backing-up septic system that had me cleaning out the basement in sporadic but frequent intervals.

Moved out of our old house. I have blogged about the difficulty I had saying goodbye to our old house. I won’t pretend that it was better than our new place. It was in the same neighbourhood as at least two drug dealers and there were plenty of reasons to move away. Despite that, I miss the house and the memories we built there. Heck, I still miss the condo from time to time.

Working at Intuit. I’m not going to pretend that it was a breeze at the old office. There was a mountain of things that needed to get done and a whole crapload of long hours but I worked the extra hours, not because I felt I had to but because I wanted to. I didn’t want to let the team down and I didn’t. Despite everything that it took, we didn’t miss any of the target deadlines that were set out. I think about my work there often and I miss it every time I think about it.

Leaving Intuit. I’m willing to admit, now, that it was a mistake. In the spring, tax season was over and people were working on their whitespace projects. I helped out with one, a web application that used Spring and web services. But I was feeling itchy feet. They extended me to the end of the summer, I’m assuming so that they could have me available for the fall, when the big work started up again, but I was worried. How could I know whether or not they would extend me when the summer was over? And during the time that there was uncertainty, before they extended me, I had an interview at POSP. With all that, I felt it was time to leave. With all that’s come at POSP, I wish I’d taken the extension at Intuit. That ship has sailed, though, and my time at POSP is nearly at an end.

Getting a car. For six and a half years, I commuted via bus and bike. I lived in the city, I worked in the city – it just made sense. But I’d also forgotten how great it was to have my own vehicle. The freedom it affords – the ability to stop on the way home to pick things up – lessens a burden that I didn’t even know I had. And it’s fun. I like driving. I always have. Now, despite the cost, both of the car and the insurance, not to mention the gas, I have a car that I drive to work every day and it has cut serious time off my commute, completely forgetting the fact that I live much further away.

Getting ready to sell the old house. I certainly don’t begrudge the necessity of home repairs in getting ready to sell the house. There were a list of small-to-medium jobs that I’d been putting off and they finally came due. For weeks, Kim and I obsessed over floor tiles, paint, stair-handrails, not to mention the endless chore of keeping the house showable. I’d meant to blog all the work that went into the house in those weeks, but I was so busy working at the changes that the blogging never happened. In fact, that statement could be re-worked to account for a lot of things that happened this year. Maybe I’ll make a blog post about everything I could have blogged about this year but didn’t.

Vacati-ain’t. For the first time, I went a year without any time off or vacation. Granted, there was a day here and another day there when I took the day off for whatever reason but there were no week-long trips anywhere. Kim and the kids went to Southern Alberta for a getaway in a rented camper and there were the Anderson Acres weekend and the camping weekend at Old MacDonald’s Farm near Stettler, but that was it. I could use some time off but I don’t think it’s coming any time soon.

Quad. We bought a quad to help with snow-removal. The problem was, it wouldn’t start after we’d owned it a week or so. With the awesome work of my father-in-law and his brother, John, we’ve been happily clearing snow since just after the first huge dump which we cleared with shovels and the help of our neighbour, Aaron.

Junior High? Nick hit Junior High age this year. It isn’t that we didn’t expect it to ever happen, just that the fact that it did seems surprising. Hard to believe that I met him when he was just 2 years old. Now, we’re having conversations about stars and why the light from the furthest stars doesn’t reach our planet. It really is a marvel how far he’s come.

A Decade of Liam + Kim. On New Year’s Eve, it marked the tenth year that I’ve known Kim. We met December 31, 2002, at a New Year’s party. I got invited almost accidentally – a topic for a different blog post. Six days later, we were a couple and a year and a half after that, we were married. Happy tenniversary, Kim!

Christmas. Christmas, 2012, was a great time. So much food, so much candy, so many wonderful presents, and a chance to recharge from a December that was work-intensive. I have a blog post in the works about a touchy-for-me Christmas subject but it hasn’t resolved itself yet.

Houston Texans. I know a pile of you are not football fans, so feel free to ignore this bit and move on to the next emboldened header. At the beginning of the year, I was ecstatic for the Texans. They were in the playoffs. They won their first ever playoff game. The fact that they lost the next week in nail-biting fashion hurt but there was excitement and it was the first time the best part of the Texans’ season wasn’t the draft. This year proceeded in exciting and elating fashion with the Texans holding on to the top spot in the conference for most of the season. Then December hit and the team went for poop. I watched but I did not enjoy most of the last games. They made the playoffs, they host the Bengals on Saturday, and my heart is in my throat because of the way they’ve played. Still, PLAYOFFS!

Penelope and Angel. Sometime over the summer, Angel took off. He was the black cat we got around the time of Olivia’s first birthday. He left home and didn’t come back. I don’t know if some family found him and is treating him better than we did or he ran afoul of some predator. We mourned for a little bit and then got a new cat. Penelope has her ups and her downs but it evens out and it’s nice for the kids to have a cat to play with.

NaNoWriNOOOOOO. I thought I had a foolproof plan. I pulled it off for half of NaNo. Then I lost all interest. It got hard to write so I stopped. But I have half the wordcount of a NaNoWriMo novel and I didn’t have that before, so I could pick it up and keep going on it at some other time. I’m actually more enthusiastic about the story I was writing the year before, as well as the story I’ve been noodling with since high school than I am about that story, though.

Read-tastic or Read-drastic? Every year I set myself a reading goal. Since 2003, it’s been 50 books. I’ve never made it, despite a first-year result of 49 books. In fact, it hasn’t been over 40 since then. To that end, I scaled the goal back to 35 this year, which I thought was really doable. What I didn’t take into consideration were the facts that I would be dedicating a lot of time to getting ready to move, packing, moving, dealing with the increased overhead of an acreage, and not commuting by bus anymore. To that, I failed to reach my goal of 35 books, instead topping out at 25, thanks to a couple post-Christmas reads on my new Kobo Glo. What’s worse, the real goal I wanted to hit, even more than the 35 books, was finishing the Malazan series by Steven Erikson. I got a quarter of the way through the penultimate book then got distracted by other, more immediately-gratifying books. Since that is the case, the first two books I’ll read in 2012 are Dust of Dreams and The Crippled God. One goal that I’m pretty happy with, so far, is that I wanted to be caught up on my Wheel of Time re-read before the last book of the series, A Memory of Light, comes out on January 8. With the help of Audible.com and my local library, I should be done The Towers of Midnight by early next week, which will free me to finish the series. In a way, I’ll miss the frenzied re-reads, what with no new books coming out, but I’m sure I’ll periodically revisit Rand, Perrin, Mat, and the rest.

A Blog Dies.

Sometime in April, my blog hit a snag. Twice over the course of three months or so, malware caused the site to get blocked by Google’s services. I looked at the code and there were countless references to foreign sites. Needless to say, I felt no compulsion to navigate to those sites. After the second time, I was angry. Not just at myself for letting it happen again but at the software the blog was running on, the host for not having better security, and pretty much at blogging in general. I took the site down. I spent a couple of weeks trying to decide if I would even have the blog anymore. It was time-consuming but enjoyable, and gratifying to see people visiting and reading what I had to say. But if it was going to be compromised over and over again, I wasn’t going to keep working at it. So I made an agreement with myself. I signed up for more security with Dreamhost, paying a bit to make it as solid as I could. I increased the security of my passwords. And I blogged again. But this is it. This is the last chance. If the site is compromised again, even with all the enhanced security, I’m going to take it down.

So that was my year in a nutshell. Obviously it doesn’t encompass all that happened to me or that I did, including starting out with guitar lessons and other things, but it is an overview. On the horizon, I plan to bring forward a selection of the posts I deleted when I refreshed the blog, I plan to have a short synopsis of all the books I read last year, post about the books I plan to read this year, and get back on track with blogging in general.
Happy new year!

Balancing Act

by hadaad

So my last blog post wasn’t exactly shiny and positive. I won’t apologize for that. I have grumpy, grumbly days in real life and as much as I filter out a bunch of the crap that goes on in my life, I felt like sharing.

Now, though, even though I’m still working overtime, with a possibility, if not a likelihood of extended overtime through December, my attitude is much more positive. I’m balancing indigestion with frustration, eagerness, fear, and excitement.

The frustration comes from the fact that the contracting phase of the project is not yet done. They keep bringing me more bugs, more enhancements, and I have no idea how extensively they’ve tested it. By the nature of the things they’re presenting to me, it’s either a rock-solid piece of software that just needs a couple of new features or a spit shine here and there, or it’s not tested in the ways that they’re going to actually use it. I sincerely hope that  it’s the first one, but I’m afraid that it’s the second one. My true suspicion is that it’s a reasonably-solid piece of software that is only partially tested in the ways that they’re going to use it. But time will tell, particularly if it’s going to be in production in two days, which was the plan a couple of weeks ago.

Eagerness comes from the fact that starting at midnight tonight, we officially kick off NaNoWriMo. 30 days of literary abandon. I’m going in another new direction this year. I’m excited about the novel that I wrote back in 2007 and I want to finish that story arc, but I’m leaving it for a time after I’ve had a chance to edit what I’ve written. I wrote it knowing that there were a bunch of holes. (Does that guy have a horse, or no? And where did he get that knife from?)

But I’m writing a different story this year. A guy gets caught up in the idea of an old flame so much that he loses the family he has, even as he realizes that they’re what he wants. Maybe that doesn’t describe it properly. Basically, it’s a Romantic Tragedy starring a self-involved jerkwad, I think. Unless that changes.

I’m looking forward to the first winter at the new place. It’s already changed so much from when we moved in.

My contract ends at the end of the year. There have been grumblings about an extension though nothing has firmed up.

Mostly, though, I’m excited for NaNo. And I have indigestion.

Overtime

by hadaad

I don’t mind working overtime. Schedules are part of the job and when you fall behind, it’s something you can do to help you catch up. I didn’t mind it when I was salaried, and now that I’m earning an hourly rate, it’s even better.

I’m tired. Maybe extending my day by starting it earlier wasn’t the best choice but it’s the one that impacted my family the least. And it’s only really supposed to extend to the end of next week.

I got some praise from my boss today, about my responsiveness and the quick turnaround on defects. Considering I put those defects in the software, it’s faint praise but after the last couple of months, I’ll take it.

The end is in sight for phase 1 of the project, but it feels like a moving target and every time we take a step forward, the target moves back the same distance.

I guess that’s just frustration coming through. Better day tomorrow.

Liam

My Problem, Not Yours

by hadaad

Hey, how’ve you been? I’ve been busy.

There’s always a slight feeling of guilt and sheepishness when I write a blog post after a long layoff. It isn’t to say that I haven’t had anything to say, or haven’t wanted to post. But it’s been a beast.

The truth is, work is holding my head under water and not really letting up.

This isn’t intended to be a self-pitying post. It isn’t meant to generate pity or forgiveness for my long periods of e-silence. It isn’t even meant to be a “Let off some steam about work” post.

The truth is, I don’t know entirely what kind of post it is meant to be. But it’s overdue.

I’m not particularly happy at my current position. We’re behind, and pressure is intense to release quickly. I can understand completely the realities of the situation. I’m as much to blame as anyone else. The team is really good and I enjoy working with them but the project just doesn’t feel entirely right. Couple that with the fact that I’m worried about the end of the contract and what happens when it’s done and you have where I find myself. A job I’m not entirely enjoying, but that I don’t really want to end.

This feeling, this sense of dislocation or dissatisfaction, at least, has started me wondering where I’m going, professionally. I want to stay in software but do I want to be a programmer? Or do I want to move on to Project Management? I don’t have any relevant experience or training, and the job at Haemonetics kinda made the idea of being a manager set my teeth on edge, but it might be the next step in my career. Do I want it? Do I want the responsibility of getting everyone on the same page and working together? If so, what steps do I need to take to get there?

I like working with code. I love the challenges that it can present. I am happiest when I’m working out a problem like that, so the question has to be, why would I take myself away from that? Why would I walk away from hours of solving problems and jump into hours of meetings, setting schedules, hiring, firing, interfacing with the business, and budgeting?

Some things that this contract has left me with are the knowledge that I have some areas where I need to get better. When it comes to solving a problem, I’m really good. I can and will help people and be happy doing it. I’m confident when stating my solution and backing it up with evidence. I’m good at poking holes in solutions, even when I’ve come up with them.

I don’t budget my time very well. I spend too much time on small details when the big picture isn’t even clear to me. I jump in with both feet when closer analysis is required. I am far too optimistic when it comes to giving estimates. I talk myself out of solutions before even trying them. I overthink problems to the point of paralysis. When I get behind, I stop all communication. I try to solve problems with my hermit hat on. I don’t test things properly when I am late. Instead of asking for more time, I try to cut corners. When I get stressed, I take my work home with me in my head, to the point where it interferes with my sleep, my volunteer activities, and my hobbies (hence my lack of interaction on In The Now.)

A more considered approach, to me, seems like it would help. I know I get eager to start creating things and that’s why I don’t really look at the big picture enough at the outset. So I need to work on my patience and really read up on the design and requirements. I need to take a more test-driven approach to development, set up test cases based on the requirements so that I can release the software with a reasonable level of confidence. I need to be more communicative, not less, when timelines are tight or unreachable. I need to compartmentalize so that I can have a full life, even when the chips are down at work. I need to have the confidence that the challenges that programming software present are nothing I can’t handle. I need to ask for help when I need it, whether that is in the form of advice, more time, or whatever comes along.

This is probably the most challenging contract I’ve been on and I want to do it well. I want to do it right. But I can’t let it compromise my personal life. I hope that this is a lesson I’ll internalize and that I’ll be seeing more of you here at In The Now.

Liam

IntelliJ Idea Java File Not Class

by hadaad

You want a C but you have a J

I won’t waste a lot of time with this one. IntelliJ IDEA will sometimes identify a java file as a java file that isn’t a class. This is sometimes correctly the case, as with the package-info.java file, but sometimes incorrectly. As in, it’s a class, but it isn’t registered as one, or identified as one. However you want to term it, inspections don’t work on it and attempts to import the class come across as errors even though the compiler doesn’t show errors.

Usually, this is a problem with generated code that you either import from a generation utility or from a third party.

The problem is that in idea.properties, the idea.max.intellisense.filesize property is most likely set too low. You can find idea.properties in the bin folder of your IntelliJ installation.

idea.max.intellisense.filesize is a cap to the number of lines that can be in a java file before IntelliJ decides that it will not register the file as a class, perform inspections on it or recognize it in the CTRL+N shortcut for opening classes.

If you increase this property or just delete it from the properties file, IntelliJ will see it as a class and perform inspections and all that.

Hope I was able to save you some time with this post.

[NOTE: The original source for this information is this post, in the comments. I don't claim to have discovered the solution. I'm just throwing it out there so maybe more people can see it. -- Liam]

The Taste Of Victory

by hadaad

I’m sure that for a lot of you out there, the taste of a donut is just a donut. Whether you enjoy them, are nauseated by them, can’t get enough or simply can’t digest, donuts can be a polarizing thing.

I’ve had problems with donuts in the past. I used to be able to knock off a dozen donuts on my own in a single sitting. Sure, I might feel nauseous afterwards, but it was an accomplishment.

I’ve been watching what I eat more closely, lately, after being assured that losing weight is as much or more about diet than exercise.

There is, however, a treat that I will not pass up on. That would be the Monday morning donut.

At work, we have an automated build process that builds and tests the project we’re working on every time we check code in. In order to provide as minimal obstruction to the other developers as possible, by way of broken code, we have a policy that if you break the build (by checking in code that breaks, or that causes the tests to fail) you get a mark against you. At the end of the week, the developer with the most marks against him is on the hook for Monday morning donuts.

It’s a small thing, but it’s something to talk about, it’s a chance to give other developers a hard time about something (something that everyone in the office loves a chance to do) and as an added bonus, if the build goes unbroken for the whole week, the project manager has to buy donuts for the team.

That was the case today. Since he was on vacation, though, the responsibility for buying donuts fell on the Business Analyst, which was even better.

So, for you, donuts may taste like a small piece of heaven or a small piece of, well, let’s not go there, but to me, they taste like victory.

Switch to our mobile site