iewi: autumn tree (autumn)
My school has wifi. Free wifi. Bad wifi. Can't even connect half the time wifi. Pretty typical wifi sadly enough. Well, you have to sign in to use the wifi (still don't have secured wifi, but you take what you can get, right? just don't go banking), but anyway it has a web authentication redirect page, because of the many, many IDs they have to keep track of. So far, so good, right? There is one minor annoyance: the web authentication redirect page redirects you to the college's home page once you're done signing in instead of whatever page you were going to. Still, it's pretty ok so far.

I'm coding an android app that requires a web connection to work. As part of making sure it's robust in the exceptions it handles, I'm testing it without any network connection, pointing it to the wrong url, etc. I get this brilliant idea: I'll test it on my college's wifi to see if it can handle a web authentication redirect. I still think it's a brilliant idea, even if it's caused me a lot of headaches recently.

I get the normal exceptions at first, and I handle those. Just pop up a dialog saying "check your network connection" or whatever. Then I start getting weird ones. Null pointer exceptions. XML parser exceptions. I look at my code and 'fix' the null pointer exceptions (hey, it looked fixed at the time). But I'm still getting XML parser exceptions, and I'm confused now. I know the XML is fine; I've tested it before. Web services don't generally just start delivering malformed XML out of the blue. I think, what the hell's wrong here?

I track the flow of control in my program, and I discover that the web authentication page is giving me an HTTP status code 200 OK. This is not cool. It's not cool because a 200 OK means that the request you sent executed like you thought it would and nothing went wrong and you are where you want to be. It doesn't mean that the server served up the code without issue. It means the code served up is the code you want.

So, for example, the New York Times has more than one domain. Let's take for example. redirects you to the home page of the New York Times, It gives you a 200 OK, but that's fine. Why? Because if you're going to, you probably want the New York Times. So the server is returning the code you want, so it can give you a 200 OK if everything else works out.

Let's take a different example. Earlier on in the election cycle, back when Jeb Bush was still in the race, someone redirected to Donald Trump's campaign website. In that case, they should give you a HTTP status code in the 300s, because those are the redirects. If you go to, you probably don't expect to get Donald Trump's website, so they shouldn't give you a 200 OK, because you might not have expected that.

The web authentication redirect page at my school should probably have given a 407 Proxy Authentication Required, or maybe something from the 300s. Definitely not a 200 OK. Because my problem ended up being I was expecting XML, but receiving HTML.

And I had even tried to account for that, by having an if statement that checked the response code to see if it was 200 OK, and threw an exception if it wasn't. But my school not sticking with web standards screwed me. Now I check to see if the URL is what I expect it to be.

protected void grabData() { try { HttpURLConnection cnx = (HttpURLConnection) here.openConnection(); cnx.connect();
if (cnx.getResponseCode() == 200 && cnx.getURL().toString().contains("")) in = cnx.getInputStream(); else { throw new IOException("Connection bad: " + cnx.getResponseCode()); } } catch (MalformedURLException e) { networkError = true; e.printStackTrace(); } catch (UnknownHostException e) { networkError = true; e.printStackTrace(); } catch (IOException e) { // you can assume that if the above block of
// code throws an exception, it's a network-
// related one
networkError = true; e.printStackTrace(); } }

iewi: feet (Default)
One thing I notice when I read graphic novels or watch television set as a fantasy (looking at you, Game of Thrones) is that the women are hairless. Completely hairless, except for the hair on their heads and maybe some unobtrusive hairs on their arms. When this happens in a pseudo-Western-European fantasy, it shows me that the author/adapter either didn't research whether or not women shaved in the era in which it was set (the answer is, for medieval Europe, no, no they did not), didn't care (or wanted the women to look "pretty" according to modern standards of beauty), or didn't think about this. These are all stupid reasons, and people should start thinking through this.
It makes little sense for women to shave because:
  • Women didn't, as a rule, go into battle, where hair gets pulled, and thus needs to be minimal
  • No one except for intimate partners and certain servants would actually see a woman's legs or armpits
  • Hair actually keeps you warmer in the winter, which is important in pre-central-heating Europe (of course, you have the Roman version of central heating, but no one really used that anymore. I don't know why.)
  • The only implements they would have had to shave with would be distinctly non-safety blades.
  • This is before knowledge of germs, so the above blade would probably be unsanitary, leading to possible infection and death every time you nicked yourself (And guess when you nick yourself the most often? Oh yeah, when you have to shave in an awkward, fatty place. Like the back of your legs (especially since the medieval standard of beauty included some fatty padding. See Renaissance/Medieval paintings of women))
  • If you were a common woman, you wouldn't have time to shave.
So, there would be no reason to shave, and plenty of reasons not to do so. This is an example of why you should think through like everything that you believe or do. Because then when you try to write a different culture, you fail.

Sorry for the rant.


iewi: feet (Default)

February 2016

2122232425 2627


RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 26th, 2017 12:38
Powered by Dreamwidth Studios