StringBuilder builder = new StringBuilder();
string newline = "";
foreach (Map.Entry<MyClass.Key,String> entry : data.entrySet())
{
builder.append(newline)
.append(entry.key())
.append(": ")
.append(entry.value());
newline = "\n";
}It's been a few days now, so I've had time to think about what this will mean. My interest in Sun lies primarily with MySQL, Java, VirtualBox, and Solaris. As the title indicates, I'm cautiously optimistic.
First I want to consider MySQL. On the one hand, Oracle certainly knows databases. If they choose to they can really take MySQL to the next level. On the other hand, this wouldn't be the first time Oracle has purchased a better and cheaper competitor just to kill it off **cough**Peoplesoft**cough**.
The reason I'm optimistic that they'll do the former here is that MySQL will be a lot harder to just kill off than Peoplesoft. There's a recent open source version available, and they that back. If they try, they'll find that they don't have as much power in that area as they'd hoped. They best they can do is take it closed source and then release a few compelling updates, such that much of the community follows those updates and the open source clone's can't keep up. Only then can they kill it, and even at this point I'll be surprised if there's not still a viable open source-forked clone available.
Now on to Java. Under Sun, Java was starting to fall behind. Oracle relies on Java as the natural language choice for it's database, so it has every motivation to make sure the language stays relevant. That said, it will likely continue to be the same people driving development. I am a little concerned that Oracle will decide it needs to make more money from Java, but not too concerned. After all, there are a number of good open source Java tools available now, so just like MySQL the only way Oracle can really hurt Java is if they innovate at a faster pace than the open source community can emmulate. And that's not necessarily a bad thing.
I'm a little concerned that VirtualBox will cease to be free, and become more like VMWare. There's enough room to move here that Oracle can do what it wants. It's also very possible that Oracle will have no interest in continuing the product and will just turn it over to the community or sell it to someone else.
Finally, Solaris. Solaris is pretty much irrelevant. For Oracle, it gives them a native platform for their database without dependance on anyone else... if they want to go that route. In practice, Solaris is nothing if doesn't take advantage of open source libraries and rely on open source applications. I won't be surprised if Oracle kills Solaris, but I don't think it will matter much if they do. Those who used to use it can easily migrate to linux.
Follow up to this post.
public static string JoinWith(this IEnumerable<string> strings, string separator)
{
return String.Join(separator, strings.ToArray());
}Most .Net programmers who need to use JSON can either pull in a third-party library or are using .Net 3.5 and therefore can rely on the built-in JavascriptSerializer . However, I recently found myself needing to turn a .Net DataTable into JavaScript Object Notation without either of those options available.
My first thought was that something must already be out there that I could use. Indeed, there are some really great libraries for this. Unfortunately, my situation is such that I can't pull in a whole library. I needed some purpose-specific code. I did find some specific implementations as well, but I found them all some how lacking and ended up rolling my own. The code itself would take up about 2 printed pages, so I'll content myself with posting the link for now.
Today's question: How do I append a newline character for all lines except the last one?
boolean first = true;
StringBuilder builder = new StringBuilder();
for (Map.Entry<MyClass.Key,String> entry : data.entrySet()) {
if (first) {
first = false;
} else {
builder.append("\n"); // Or whatever break you want
}
builder.append(entry.key())
.append(": ")
.append(entry.value());
}This is something I stumbled on a while ago and known how to do in a basic sense. But now thanks to this StackOverflow question I also know what it's called. This will make a huge impact on my ability to use this in the future, as before I couldn't really search google or msdn to get help with it.
Today I came across a question about virtualizing web servers and databases. It caught my eye because I'd asked a similar question back in November.
This blog has been feeling a bit neglected recently. So in an effort to get it going again I'm re-purposing it. I'll still post original content from time to time, but effective immediately this place is now primarily dedicated to highlighting interesting questions I come across at StackOverflow.com. Essentially, I'm leveraging the community there to help me create content here. The important point is that I won't normally just repost a question. If I write about it here it's because I have something to add that may not be as appropriate for the other site.
Cloud Computing has arrived. Whether it's the new Windows Azure, Google's AppEngine, Amazon's S3/EC2, or something a little less obvious like the SalesForce platform, you have options available. Unfortunately, they all have one thing in common: none of them really take advantage of a cloud. In every single one of these offerings your app ultimately runs on a single server in a traditional datacenter. All they've done is abstract things away a bit so that you don't need to know which server it is. That's neat, but it's not really what I want from a cloud system.
I've been using the new StackOverflow.com web site a lot. One of the less attractive "features" there is a CAPTCHA that crops up every so often. This CAPTCHA is based off reCaptcha, which is a project that pulls problem text from book scanning projects. It uses words that the scanners couldn't handle for part of the captcha. It's a great concept: if the the legitimate scanners were unable to recognize the word, it's likely that attempted cracks will have the same trouble. Additionally, as a user at least I feel like the annoying captcha has some extra purpose.
One of my personal character traits is that I nitpick my writing. I'll probably edit this blog post at least a dozen times after I post it before I move on (9 or 10 of those edits will fix dumb typos). I therefore hit the StackOverflow captcha fairly often. That's where it happened; I completed a routine edit, received a captcha prompt, and typed what I saw without thinking. Except this time what I typed wasn't exactly what the captcha showed. The captcha had a typo, and I subconsciously entered the word correctly. I realized my "mistake" a moment after I submitted the response, and mentally braced for the rejection. But instead of a rejection, the captcha passed.
Now I have to believe that the captcha requires more than one "opinion" on each snippet before accepting it into the final work. But I wonder, how often does this happen? Could this system actually be correcting spelling or typesetting mistakes in old books via some human psychological phenomon? Probably not: most often the captcha will be entered as shown. But the possibility is at least intriguing.
I've been using SQL Server Management Studio almost since it came out, and before we even had a SQL Server 2005 database for it to talk to. I know a lot of people don't like it, but most of the negatives just didn't apply to me. The two biggest are probably the .Net framework requirements and that it can be very slow. I already had the .Net framework installed, and while it is a little slow to start up the first time after restarting windows, after that it's been fairly responsive.
So I've been watching the SQL Server 2008 launch and patiently waiting for the Express Edition of the management studio to come out. And waiting, and waiting. Every once in a while I'd go back and look for it, only to find the 2005 version instead. Today, I finally found it. I'm still downloading it, so I can't tell you how it does, but here is a partial list of new featuers. And here is a link to try it for yourself. Note that it now requires .Net 3.5 and Windows Installer 4.5.