Find Standard Deviation with C++

2 January, 2010

I wrote a small C++ program to calculate the mean and standard deviation of a given data set. Here it is:

#include <iostream>
#include <cmath>
using namespace std;

int main (int argc, char* argv[])
	int number_of_items;
	cout << "How many pieces of data are in the list? ";
        cin >> number_of_items;
	float list[number_of_items];

	// get all the data items
	cout << "Please enter the data:" << endl;
	int i;
	for (i = 1; i <= number_of_items; i++)
		cout << i << ". "; 		cin >> list[i];

	// find the mean (average) of the data
	float xbar = 0;
	for (i = 0; i <= number_of_items; i++)
		xbar = xbar + list[i];

	xbar = xbar / number_of_items;
	cout << "The mean (average) is " << xbar << "." << endl;

	// find the standard deviation
	float numerator = 0;
	float denominator = number_of_items;

	for (i = 1; i <= number_of_items; i++)
		numerator = numerator + pow((list[i] - xbar), 2);

	float standard_deviation = sqrt (numerator/denominator);
	cout << "The standard deviation for the given data is "
		 << standard_deviation << "." << endl;

	return 0;

The Web Invaded the Desktop

30 September, 2009

I can officially say that the web has infiltrated itself into my desktop operating system. On my dock, eight out of the fourteen applications are directly web-related: Safari, my web browser; Mail, my mail client; Adium, my messaging client; Colloquy, my IRC client; Hulu Desktop, a desktop version of the online TV website; iTunes, especially in regards to the iTunes store; Songbird, for finding music online; and Times, for viewing news online.

Slowing Down

27 August, 2009

Due to other things that have come up, I haven’t been able to write too many blog posts recently. To any followers, I apologize. I will try to set some time apart to write something else soon.

Keynote Thumbnails in Quick Look

31 July, 2009

As can be seen from Apple’s Leopard presentations before release, as well as on page 22 of the Leopard manual, opening a Keynote presentation using Quick Look should allow you to see slide thumbnails on the side, as in 0:28 in this video. However, this is not set as the default behavior. Achieving this is very simple, though. In Keynote’s preferences, under General, simply check off “Include preview in document by default.” There you have it!

via Apple’s Support page

Snow Leopard is Darker

26 July, 2009

It seems that my predictions, which were one of the first on the internet regarding the subject, that Snow Leopard would be darker have come true! Here’s a quick timeline of how I came about the idea and all the steps that Apple took to make it glaringly obvious that Snow Leopard’s UI would be even the slightest bit darker than Leopard’s:

  1. Someone on IRC (nick JHKKHJK or similar, I can’t quite recall it)  in a WWDC discussion channel told me that Snow Leopard’s UI would be darker. That started originally what seemed like a wild goose chase, but ended up being a lot more meaningful than that.
  2. First up was MobileMe, which sported a dark toolbar. Knowing how Apple feels about design and a look of integration across all its products, I found it obvious that it was only a matter of time before other applications started going dark as well.
  3. Next, interfaces began to merge with iTunes 8, which  in Grid View has a dark “sub-toolbar” and even darker scrollbars.
  4. When QuickTime X’s new interface was announced I was sure that my ideas were no longer simply speculation and that Apple was giving way too many clus that they were going to give us a darker interfaces.
  5. Now, Dock context menus are dark. Having five interface items be dark is interesting enough; I wonder what else will be darker in future Snow Leopard releases. Besides, all the iLife apps have dark scrollbars.

Oh, and there are new wallpapers available for Snow Leopard; I’m already using some of them.

What Happened to Project Looking Glass?

9 July, 2009

Project Looking Glass is a cross-platform (compatible with many Unix-based operating systems) three-dimensional desktop environment based on Java technology made by Sun Microsystems. The technology started with the vision of recreating the way the desktop environment works, taking it from the plain 2D and 2.5D we are used to to something rather different.

The project originally went beyond a simple conception into a full-fledged stable desktop environment. Its last stable release (1.0.1), however, was in 2007. Its development seems to have virtually stopped, though. It’s plainly obvious, especially since its website hasn’t been updated in two years or so and we hardly hear anything about it. So what ever happened to Project Looking Glass? Why did the project stagnate?

After giving it some thought and research, here are a few reasons I came up with:

  • There is a lack of user base. Sure, it’s interesting, but not many people felt the compulsion to switch from their two-dimensional desktop environment, one to which they had gotten completely accustomed, to something completely new. Besides, how many common users besides “techies” have heard of Looking Glass at all?
  • There is a lack of interest. This builds up on the previous point. It seems Sun simply got tired of the project and promoting it. Besides, Sun has already accepted GNOME as the de facto standard desktop environment for its OS releases, such as OpenSolaris.
  • It’s another platform. Modern developers, despite being relatively welcoming to new technologies, seem to have already found their niche and divided themselves into what they find suitable. Further more, Looking Glass and its APIs, as far as it seems, has a lot unique features that are not easily or readily deployable to other platforms, so it’s not a WORA (write-once-run-anywhere) situation.

Given these, and other reasons, such as the easier availability of other 3D desktop environments, such as Compiz, it’s relatively easy to see why Looking Glass died out. The project’s latency is still a loss for the world of development.

Opera 10 Beta Review

12 June, 2009

I bet Opera has recently been getting a lot of attention after this article was put on Digg, and while I myself have already tried out Opera, I decided to take another look at it and to see all the good things Opera 10 Beta has to offer. There are a lot cool new features, such graphical tabs (including a Windows Vista-like preview where hovering over a tab let’s you see a preview of the page), 100% on the Acid3 test (although I still find it doesn’t render some pages as well as Safari or Firefox), and better speed, but I’m going to take a look at some of the sidebar features: what I would consider to be separate applications built into the browser.

Before starting, though, I’d just like to mention what’s one of very few cons with this (pre-)release: a few preferences are scattered around other menus when they really should be in Opera > Preferences, namely Appearance and Mail and Chat Accounts.

I’ve never really liked built-in support for e-mail and chat, but Opera implemented it well. When I open up mail in the sidebar, the current page being viewed is still intact. From this sidebar, I can check if I have any new mail. If I do, I can open it in another tab. Once I’m done, I just close the tab and am back to browsing. No more switching between applications. Now, while I’m still a big Colloquy fan, I find that IRC chatting has been implemented quite well. Your favorite (or rather, recently-connected) rooms are listed in the sidebar and all you need is one click to connect to them.

Screenshot of Opera 10 Beta

For jotting down links you want to go back to later but don’t exactly want to bookmark, the notes tab on the side allows you to jot those down, as well as other notes or reminders. There’s also a built-in address book, which makes keeping contacts less cumbersome than it tends to be on Windows and Linux distros (I still prefer OS X’s Address, though).

Overall, Opera 10 Beta a very nice and stable release whose final build I would certainly recommend, especially to Windows and Linux users. Don’t get me wrong; it runs very well on OS X, and is about sixty megabytes smaller than Safari, but I just find that user interface doesn’t fit in very well with the rest of the system. Other than that, it’s great and the features are wonderful.