Apr 13

#AmazonFail: Why Does It Matter?

Category: personal

This is hardly breaking news anymore, but there’s been a flurry of activity on Twitter (and the internet in general) surrounding Amazon’s removal of ranking data for a large number of LGBT (Lesbian, Gay, Bisexual, Transgender) titles. This move, in effect, buries gay or gay-friendly content in searches since sales rank is used in determining which books actually show up as results. For instance, if you search for homosexuality on their site right now, the first book you see is a guide on preventing homosexuality in children.

Amazon has issued statements saying that this was simply a glitch in the system, and that they’re in the process of rectifying the situation. However, this has affected LGBT-themed books on a smaller scale over the last two months, and the fix doesn’t seem to be too quick in coming. So the “glitch” scenario seems somewhat far-fetched.

To those outside of the LGBT community, this whole fiasco may seem trivial. If they’re fixing the issue, why does it matter? The answer to that is actually fairly simple, if not obvious.

The queer community is a somewhat unique minority in that, unlike many other minorities, most of us do not grow up in households with family members that share our minority status. In other words, most queer children grow up in families which are, at least ostensibly, straight. This means we frequently grow up without someone to teach us to value ourselves despite being in the minority — without someone to teach us how to cope with the bigotry we encounter. Oftentimes, our families are the people who are marginalizing us, teaching us that we are worth less than our straight peers.

No wonder, then, that the queer community has come to have such a close relationship with the media. As each of us has come to terms with who we are, by and large we have had to find our role models outside of the home. In many cases that search leads to television, movies, music, and books as the only source for such role models.

The internet has made huge strides in that area, and has provided an immeasurable source of strength for struggling members of the LGBT community, both young and old. It can make the difference between feeling completely alone in the world and feeling like there are others out there who understand how you feel. It can make the difference between hopelessness and hope.

A more subtle element of this is the issue of acceptance outside of our own community. As long and as hard fought as the political and legal fight for LGBT rights has been, day-to-day acceptance does not come from the law but from familiarity. As problematic as they tend to be, queer characters in the mainstream media in recent years have been absolutely crucial in getting straight people to see that the queer community is, in fact, made up of people. Not monsters, not predators, but people. This exposure, though by no means perfect, and by no means a panacea, does a great deal to reduce the fear and the contempt that mainstream America has for members of the LGBT community.

Amazon’s actions strike a severe blow on both of these fronts. By losing a drastic amount of visibility in one of the most popular and widely known media outlets on the internet, we do not simply lose an important resource for those coming to terms with their own identity. We also lose a great deal of important exposure to those who would be potential allies but for their genuine unawareness. Neither of these losses is acceptable, and I can only hope that this situation will, in fact, be remedied.

2 comments

Feb 19

Maybe C# Doesn’t Suck… or Maybe it Does

Well, my progress on the C# front has been somewhat slow — it seems that our migration from a LAMP setup to a Microsoft setup has hit a few snags (shocking). Fortunately one of our partner companies has been doing the grunt work on the initial move, so I haven’t had to deal with any of those headaches. But the delays have meant that I needed to give learning C# a somewhat lower priority.

Things are much better now that I’ve started having to sprinkle in small doses of C# here and there instead of spending hours on end watching screencasts. Screencasts just turn my brain into jello, and leave me with the distinct impression that someone has just told me not to pay any attention to the man behind the curtain.

At any rate, limited exposure means I’ve found some things that I like about the language!

Operator Overloading!

A year or two ago when I started (and never finished) looking at Java, one of the things that annoyed me was the lack of operator overloading. I understand the reasoning behind it, but it bothers me. I plan carefully. I think about the ways my classes will be used. I deserve to be able to determine what gets used in a comparison, or what properties get added when someone uses a plus sign. I promise I won’t try printing to a stream when people want to shift bits. Really.

So I was pleasantly surprised when, after reading about the similarities between C# and Java, I saw that C# allows you to overload operators. This gave me a warm fuzzy feeling all over. Of course, that means that I need to hope that other people also take care to avoid doing anything stupid with the awesome power they wield over operators. This one may well come back to haunt me.

Intelligent Allowance for Implicit Numeric Casting! (Almost!)

After my last run-in with casting, I pretty much assumed that C# was going to be obnoxious when it came to handling types. And, actually, upon further inspection, there IS a bit of stupidity that I found after a little bit of poking around. But first the good stuff!

When dealing with integers, floats, and doubles, Visual Studio *usually* gives you warnings in the appropriate places. It will let you implicitly cast a float into a double, but it won’t let you implicitly cast a double into a float. This is good! A double can contain a float, but a float can’t contain a double. Likewise, you can coerce a ushort (16 bits, no sign bit) into an integer (32 bits, 1 of which is a sign bit), but you cannot coerce a uint (32 bits, no sign bit) into an integer. Yay, logic!

It won’t implicitly convert a float into an integer — you need to manually cast it. This is good! It will, however, let you implicitly cast an integer into a float. This is where things start to get bad again. It seems perfectly fine and good if you’re dealing with small values. When you get into large values, however, casting from an integer to a float will also cause data to be lost. Consider the following code:

int foo = int.MaxValue;
float bar = foo;

Console.WriteLine("foo contains: " + foo.ToString());
Console.WriteLine("bar contains: " + bar.ToString());

This produces the output:

foo contains: 2147483647
bar contains: 2.147484E+09

That means your value just increased by 253 without any warnings, which is a very big problem when an IDE coddles you from those types of mistakes as much as Visual Studio does. If you want to employ strict warnings about implicit conversions, great — it alerts programmers to the sorts of┬ápotential errors that are easy to miss and can be horrible to track down once they’re in place. But at least be consistent with it, otherwise you’re just making it MORE likely that conversion/coercion errors will be overlooked.

On a somewhat related note, I’m annoyed at the way Visual Studio interprets hex and bitwise operators. Observe:

int foo = 0xffff << 16; // This is considered legal by VS2008
int bar = 0xffff0000;   // This is considered illegal by VS2008;
						//  it thinks the value is a uint.
int baz = 0x7fff0000;   // This is legal again.

If this worked, "foo" and "bar" would contain identical bit patterns. But one is considered a legal value, while the other is not. Interestingly, "baz" accepts its value without any complaint. It seems that you're not allowed to touch the sign bit with a direct assignment. This makes sense, until you consider the following:

uint foo = 0xffff << 16; // This is considered illegal by VS2008;
						 // it parses the value as -65536 and
						 // considers it an int.
uint bar = 0xffff0000;   // This is considered legal by VS2008
uint baz = 0xffffu << 16;    // This is legal as well.

So, if you're shifting bits, the sign bit makes it negative unless you cast it as unsigned before shifting. Gah. I can understand this if you're shifting to the right, when the sign would potentially either be preserved or ignored:

0b10 >> 1

could either be 0b11 or 0b01, depending on whether you're preserving the sign bit. Shifting to the left always introduces 0's, however, so it baffles me as to why sign would matter or should matter.

No comments

Jan 27

C# Sucks: Excessively Strict Typing

So my first gripe about C# is one that I ran into by mistake. I was playing around with some AJAX components, and one called for a web service method that returned an array of strings. I wanted to populate that array of strings with a database call. That seems simple enough, right?

Wrong. It took me several hours to figure out what object types were being returned by methods, what object types I wanted to be returned by methods, and what in G-d’s name I needed to do to get the values from the one type to the other.

Eventually I managed to extract the strings I wanted from the jumble of overlapping database classes and methods (why a framework needs that many ways to get data from a database, I don’t know). Now all I had to do was stuff those strings into an array. That seems simple enough, right?

Wrong. C# doesn’t allow for dynamically sized arrays. OK, well, I just need to find the size of the data set and make the array that size. Except I can’t just get the size of the data set. Why? Because for some reason the database select method I stumbled on returns an IEnumerable, which for some reason doesn’t keep a count of its members. Because why would you ever need to know how many results you get from a query without wanting to first loop over those results?

So putting that data directly into an array would mean looping over the data set not once, but twice. The first time around I’d only be incrementing a counter. Then I could initialize my array to the correct size. Then I could loop over the data set again and actually populate the array. Seriously, Microsoft?

I couldn’t bring myself to do that, so I did some quick searching and found the ArrayList class. It was exactly what I wanted, and it had a seemingly straightforward method to convert its contents into an array. Hooray.

So I try something like the following code:

public string[] someFunction(string someArg) {
	ArrayList aList = new ArrayList();
	// Populate aList with string objects
	return aList.ToArray();
}

No good. It throws an error saying I cannot implicitly convert an array of objects into an array of strings. I think it’s odd that this is an issue given that the objects are strings, but I try the following:

public string[] someFunction(string someArg) {
	ArrayList aList = new ArrayList();
	// Populate aList with string objects
	return (string[]) aList.ToArray();
}

This doesn’t give me any errors, but it doesn’t give me any data, either. Fine. If that’s how you want to play it, C#, that’s how we’ll play it. So I try this:

public string[] someFunction(string someArg) {
	ArrayList aList = new ArrayList();
	// Populate aList with string objects
	return aList.ToArray(typeof(string));
}

Suddenly the angry red squiggly is back, with the error that I cannot implicitly convert type ‘System.Array’ to type ‘string[]‘. It assures me that an explicit conversion exists, and asks me if I’m missing a cast. You’re joking, right? Right?

As it turns out, what I actually needed was:

public string[] someFunction(string someArg) {
	ArrayList aList = new ArrayList();
	// Populate aList with string objects
	return (string[]) aList.ToArray(typeof(string));
}

Because it’s not enough to convert a list of string objects to an array of string objects. You also need to convert the individual string objects to string objects. And then you also need to convert the array of string objects to an array of string objects. Did you notice that only one of those steps actually changed the type of anything? I certainly did.

Maybe this wouldn’t have been such an issue if I hadn’t been using a pre-built component that demanded an actual array of strings. Perhaps “old school” arrays are used infrequently in the rest of C# land. But the fact remains that a language should not require you to cast a type into itself. Repeatedly.

The mind boggles.

6 comments

Jan 21

New Feature: C# Sucks

I’ve recently been dragged kicking and screaming into the world of ASP.Net. Our managers have decided to migrate from a LAMP environment to a Microsoft environment. They tried this once already and failed miserably, but maybe the second time around will actually work. Personally, I think they’re glossing over the actual resources necessary to overhaul and migrate our entire setup, but that’s beside the point.

I’ve actually worked with ASP.Net before, using Visual Basic (about two years ago, and for a period of maybe two months). I liked the ideas behind the ASP.Net framework, but VB just felt like a toy language to me. I think that can probably be chalked up to learning QBasic as a kid — an experience that surely traumatized me for life.

Fortunately (or unfortunately, as the case may be), the packages we’re looking at buying are largely based on C#, so we’ve decided to focus on that as our language of choice. I was actually really excited to learn C#. It seemed like it would address a lot of the things that annoyed me with PHP, and it’d be a much more enjoyable way to transition into the world of ASP.Net.

I may have been wrong about that.

As I learn the language, I’m running across some things that strike me as ridiculous, excessive, confusing, or just plain annoying. Taking inspiration from jwz’s whining about Java, I’m going to write down my complaints about the language as I learn it.

Maybe someone can explain to me why these things don’t actually suck, or perhaps they can show me how to do things in a less suck-filled manner. But mostly I’m just happy to have an excuse to bitch and moan about something.

No comments

Oct 1

Brain Soup

Category: personal

It’s been a while since I’ve posted in here, and again it boils down to starting a lot of entries but never actually finishing any entries. I think part of this is fallout from graduating. You see, the last six years of my life consisted of constant, overlapping, conflicting, and frequently unrealistic deadlines. Two and a half years of that time were spent working and schooling simultaneously, since the debt I was racking up by focusing entirely on school was getting out of control.

Now all I have is work. It’s weird. I don’t need to go home from work and write 2 papers, read 200 pages of critical and/or computational theory, and create 3 new art pieces by next week. I can just go home from work and…not work. On weekends, I have entire two day stretches where I don’t even need to try to work (apparently, from what I hear, this is what most people’s weekends are like. Who knew?). When I get a vacation now, it’s time to enjoy myself, not time to catch up on reading and make headway on projects without class and office time getting in the way. I often find myself getting full nights of sleep, and even eating two full meals a day (alas, I don’t think I’ll ever master the art of waking up early enough for breakfast).

While this is all very nice, it’s also very foreign. And, I’ll be honest, it’s a bit disconcerting. I’ve found that, in the absence of an impossible mountain of tasks piled in front of me (or, as was more often the case, on top of me), I seem to become a black hole of energy. If I don’t need to work up the vigor to write a paper on the significance of Alfred Hitchcock’s work in the development of postmodern feminist thought while also reverse engineering IA64 machine code in order to execute a successful buffer overflow attack, then after I get out of work I certainly won’t bother doing anything more involved than stopping at a drive-through window for my dinner. Even microwaves seem like too much effort now. If I’m not going to spend the weekend memorizing the intricacies of optimizing matrix math operations and data structures for varying cache memory sizes, then I might as well just spend the weekend playing video games and watching marathons of America’s Next Top Model.

On the bright side, this trend does seem to be turning around. For instance, I’m actually finishing a post! I’ve also started resuscitating my social life, although I still get cranky if I’m not in bed by midnight during the week. And I’m still watching far too much reality television, which is a poor substitute for some sort of creative outlet.

But I think that the post-graduation slump is somewhat common, and I also think that I’ve handled it fairly well so far. I’m gainfully employed, I at least have some idea of what direction I want to steer my life in, and I… well… that’s about as much as I have. But still, it’s a start.

No comments

Apr 18

In the Midst of Life, We are in Debt

Category: personal,work

Life’s been a bit crazy the last few weeks. Graduation is exactly a month away, and I have an ever-increasing list of things that need to have been done yesterday. But the end is in sight, which is both really exciting and really, really, really, really daunting. The daunting part, of course, consists primarily of student loans.
According to the loan repayment calculators I’ve looked at, I’ll need to make approximately $145k/year to repay my student loans in 10 years without experiencing financial hardship. To put that into perspective, consider what salary.com says I can expect to earn after a couple of additional years’ experience.
So, according to the loan calculator, I could be in the top 90th percentile of salaries in my profession and still be struggling to get by. How’s that for upward socioeconomic mobility? I’m just hoping that their definition of “sufficient income to avoid financial hardship” includes expenses like children, palatial suburban estates, luxury cars that get 15 miles per gallon, and yearly vacations to Europe. Because if their definition of avoiding financial hardship is being able to afford to eat name brand macaroni and cheese five nights a week, I’m pretty well screwed.

No comments

Mar 29

It’s, like, a metaphor or something

Category: personal,random

OK, here’s a little tidbit about me: I love lexicons. I especially love community-run lexicons. Back before wikipedia existed, dict was one of my favorite time killing applications, particularly when coupled with the Jargon File database. I’m one of those people who will look up words at the drop of a hat. Some people would call me a pedant, but I would rather think of it as a rich and healthy appreciation for the nuances of language…combined with an unhealthy need to be semantically correct.

Anyway.

I was chatting with an old college friend last night about healthy/unhealthy crushes. At one point it dawned on me that the unhealthy spectrum of things was the emotional equivalent of an infinite loop. Rather than processing the emotions and moving on, you just keep getting caught up on the same ones over and over. Wanting to explain programming terminology to a non-programming friend was all the excuse I needed, so I opened up wikipedia. Sure enough, the definition is like something lifted from the dialog of one of those mid-90′s dramas. Just picture the following being said in voice over, with something by, say, The Cranberries playing softly in the background and images of a character staring dejectedly into the middle distance.

Looping is repeating a set of instructions until a specific condition is met. An infinite loop occurs when the condition will never be met, due to some inherent characteristic of the loop. There are a few situations when this is desired behavior. For example, many server programs such as Internet or database servers loop forever waiting for and servicing requests, though these may not be strictly considered infinite loops, because manual program termination still serves as a condition which exits the loop. Most often, the term is used for those situations when this is not the intended result; that is, when this is a bug. Such errors are most common among novice programmers, but can be made by experienced programmers as well, and their causes can be quite subtle.

But wait! It gets better! Observe: Multi-Party Loops

Although infinite loops in a single program are usually easy to predict, a loop caused by interaction of several entities is much harder to foresee. Consider a server that always replies with an error message if it does not understand the request. Apparently, there is no possibility for an infinite loop in the server, but if there are two such servers (A and B), and A receives a message of unknown type from B, then A replies with an error message to B, B does not understand the error message and replies to A with its own error message, A does not understand the error message from B and sends yet another error message, and so on ad infinitum.

That’s pretty deep, right there.

No comments

Mar 15

It’s a bunny!

Category: random

I was driving home from the city the other night, partaking in the long-standing Boston tradition of cursing out every single other driver on the road, when something I saw out of the corner of my eye in my side mirror registered as “odd”. Turning to look, I saw that I was being passed by a giant, golden, bunny head.

I think it’s fairly understandable that my brain did not want to process the image that it was presented with, and the giant golden bunny head was moving at a fairly quick pace. The net result was that the bunny head was out of view by the time I got as far as “Wait. Was that really what it looked like it was? Were those actually ears?” I resigned myself to the fact that it was all a vivid hallucination, most likely the result of too much stress and not enough sleep.

And so on I drove, contemplating whether hallucinating something like a giant golden bunny head was the sort of thing that a sane person would do, and whether it would impinge on my plans to avoid institutionalization. Just as I was getting ready to head over to the local sanatorium and sign my own commitment papers, I approached a cluster of slow-moving traffic. And there, in the middle of the rush hour traffic was an inexplicably golden, inexplicably giant, and inexplicably independently mobile bunny head.

Lo and behold, I wasn’t insane — or, at least, the giant golden bunny head wasn’t a symptom of my worsening mental condition. Instead, it was a publicity stunt by Lindt chocolate. For the rest of my commute, every time the bunny head entered my field of vision, I reverted to six-year-old mode, donning a huge stupid grin and mentally shouting “IT’S A BUNNY! YAAAAY BUNNY!”

Normally I would follow up that story with a commentary on how society is doomed to become nothing but product placement after product placement. But dammit, I just can’t badmouth the giant golden bunny head. And part of me thinks that anything that could provide that much enjoyment during the dreaded commute can’t be all bad.

No comments

Feb 29

Dear Management, Continued

Category: work

As previously stated, I understand that I am not necessarily qualified as a manager. However, that didn’t stop me from making a few observations in the past, and it won’t stop me from making a couple more now.

  1. Yes, the important foundation of the project planning process is asking the target users what they want. However, that cannot be the only step in the project planning process.
  2. Continuing that theme, at some point you need to put the “throw new functionality” phase on hiatus. That doesn’t mean you can’t ever take requests for new features once you’ve begun implementation. It just means that the more unrelated and/or contradictory features you add, the more of a backup you’re going to cause in development.
  3. A bad idea doesn’t suddenly become a good idea because it’s taken the form of an end-user feature request. Some people just do things in ways that don’t make sense, and trying to accommodate them will only cause problems.
  4. After re-writing an entire system from scratch twice and having it fail both times because of feature creep and poorly planned infrastructures, you should really start to grasp points one, two, and three. Really.
  5. Taking a web app that everyone complains about and turning it into a facebook app will not save it. People will not suddenly think that it’s intuitive and useful just because it’s next to their list of social networks. It will just be easier for them to gripe about it to their friends.
No comments

Feb 20

Frivolity

Category: work

Somebody in my office has spent literally hours a day for over a month negotiating what type of fabric to use on chairs. This is somebody whose salary is almost certainly in the $60,000+ per year range. The chairs are not for our company, nor are we actually in the business of manufacturing chairs — we sell spring break trips. In other words, this person has been paid over $5,000 for being the middle man in chair fabric negotiations. Apparently, this sort of thing happens all the time.

I’m just waiting to hear that there’s a new reality show where people fight lions to the death.

No comments

Next Page »