SQL Math
May 5th, 2009In my quest to avoid looping in code when I can figure out how to use a query:
select cast((select count(*) from tblA where foo is not null) as float) /
(select count(*) from tblA) * 100
In my quest to avoid looping in code when I can figure out how to use a query:
select cast((select count(*) from tblA where foo is not null) as float) /
(select count(*) from tblA) * 100
I grew up using WordPerfect on a Commodore Amiga, so I found this first-person account of the company’s history a really interesting read.
I’m experimenting with an inexpensive ($9.99/mo) VPS from Echo Servers. I have some ideas that I want to put somewhere, and this seemed like a good time to try out some of the new virtual hosting options. I share a dedicated server from ServerMatrix as well. This will be a comparison with a dedicated server, as well as some notes about running (or trying to run) an app server on a VPS with limited resources. Note that I am by no means a sys admin, as you will see.
I picked configuration VPS Hosting 2. This comes with 5Mbps bandwidth, 300G a month, 10G of storage, and 128M of RAM (with the capability to use 192M for short periods of time, I think).
Right off the bat, I will tell you one advantage of using a VPS: the admin control panel is running on the host, not on your dedicated server. We use cPanel on our shared server, and while it is very good for creating and managing multiple accounts for multiple people, keeping it up to date has been a challenge at times. With my VPS, I don’t have to worry about my control panel being a security hole.
Obviously, cPanel also does things like e-mail management that require running on the guest. Echo Servers provides cPanel access if you want it.
I had the option of choosing between Cent OS, Debian, Ubuntu and Fedora. I’ve used Ubuntu a little recently and liked the wide availability of packages and documentation. It also seems like more people are adopting Ubuntu.
Ubuntu Server only used 138M of disk space or so when I first logged into the VPS. This is really nice. I don’t know if this is the default server install or not, but I really like it compared to default server installs that include X, Gnome, KDE, etc. I had to “apt-get install man” to get some documentation on the server.
I installed MySQL and Apache 2.2 and immediately started running into resource issues. It turns out that, from what I’ve read, that swap on a VPS is not recommended. I’m going to ask Echo Servers if this is true and what my options are.
But for now, I wanted to run a HTTP server and database on my VPS. I also want to use Ubuntu packages to do this. I tried reconfiguring Apache to only start one process but no matter what configuration I tried, it wouldn’t start with my limited RAM. If somebody knows a way to do this, let me know!
So I installed Lighttpd. It looks like I can run PHP and Python with it, so we’ll review that more in an upcoming post. But I was able to run it no problem on the VPS.
Next, I revisited MySQL. With Lighthttp and MySQL running, I didn’t have much free memory at all. So I installed PostgreSQL. I’ve used PostgreSQL before and liked it. MySQL is pretty ubiquitous these days, and I probably could configure it to run in a smaller space, but I wanted to see if the default PostgreSQL install would be any different.
Now I’ve got Lighthttpd and PostgreSQL running and according to top, I’m using 59M. Much better! Obviously, we’ll see what happens once I actually start doing something.
My guess is Apache and MySQL allocate caches more aggressively than Lighthttpd and PostgreSQL. We’ll see. To be continued…
Here’s what happened:
Unfortunately, this coincided with me pointing Apache at a new version of the app, which then broke. I just found the reason on Google: if you require a secure session cookie, you better have SSL enabled and working.
Or just comment out the line in php.ini. Either one.
I’m working on the same VS2005 web site solution on two computers. I deleted some binary directories (bin/obj) that I had accidentally added on one of the computers, and committed my changes.
When I tried to update on the other computer, it didn’t like the fact that I had non-versioned local copies of bin and obj. I deleted them and told TortoiseSVN to clean up, but that kept giving me the error that bin “is not a working copy directory.”
I was staring at Explorer when I saw bin and obj get recreated by VS. I realized that if you delete them, VS recreates these directories, even if you haven’t built anything yet. So you have to close the solution, delete the directories, then cleanup, then update, then re-open the solution in VS.
If you can’t browse to your CUCM instance, login to the command-line interface (using the VMWare Console if it’s a VM instance…I have also been able to ssh to CUCM when I can’t browse to ccmadmin). Run “show network eth0″. Write down the current gateway, then run “set network gateway
I think this has the same effect as running /etc/rc.d/init/network restart, as all of a sudden I could ping and browse to the CUCM instance, even though I didn’t change anything.
Upgrading slowed my VM and my Mac to a crawl. I found a post somewhere that recommended the following, which helped a ton (for the record, I have one CPU and 512M allocated for this VM):
If a datasheet view of your list looks the same in SharePoint 2007, you need to install Access 2007 on your client. It looks like the datasheet view is an “Access Web Datasheet.”
If you want to use Tinyscheme on OS X, you’ll need to visit this page:
Disclaimer: I’m definitely not somebody who keeps up with this sort of thing. But I have noticed a couple things recently:
Aggregation sites like FriendFeed make sense to me. But a richer experience like the one TweetDeck provides, I hadn’t really thought of. On a whim, I downloaded it and it is pretty nice.
But what’s next? We’ve been here before, in 2000/2001. A few major players (eBay/Amazon, Facebook/Twitter) win the fight for users. What’s interesting now is we have companies like Gnip making it easier for people to use multiple services. I’m not sure that will have an impact on Facebook’s success, though.
I have no idea where I’m going with this. I’ll just keep it ongoing.