Monitor SQL Server DB Processes

If you don’t have DBArtisan or other more advanced SQL Editor, you can use the query below. Take note that you’ll need necessary rights to be able to run it.

select spid, status, blocked, open_tran, waitresource, waittype,
waittime, cmd, lastwaittype, cpu, physical_io,
hostname, hostprocess, loginame, program_name, net_address,
net_library, dbid, ecid, kpid, nt_domain, nt_username, uid, sid,
memusage, last_batch=convert(varchar(26), last_batch,121),
login_time=convert(varchar(26), login_time,121)
from master.dbo.sysprocesses
--where (blocked!=0 or waittype != 0x0000)

If you only want to see those that are blocking or locking, uncomment the last line. One thing that’s lacking here is the list of tables and database objects that each process id is using. That’s important if a user is running stored procedures and you need to know . I’ll provide that later as honestly, I don’t know yet which table holds that information.

I actually contributed this at SQL Reviewer as I don’t see a lot of websites that discusses this. For further reading, you may go to the MSDN website.

Incoming search terms:

  • www kwatog com

String Replace in C++

As I’m just a C++ poser, I don’t know a lot of things programming in this language especially if I have to deal with STL (Standard Template Library). As some of you know, when you’re not using third party libraries in C++, programming gets a little harder (note : my harder is harder than your harder).

So I searched the web and found this solution. Unfortunately, I forgot where I got this. Anyway, the original program doesn’t work.

#include
#include

using namespace std;

int main()
{
string str( "The Horse and the Yokaba" );
string searchString( "Yokaba" );
string replaceString( "Kabayo" );

string::size_type pos = 0;
while ( (pos = str.find(searchString, pos)) != string::npos ) {
str.replace( pos, searchString.size(), replaceString );
pos++;
}
cout << str << endl;
return 0;
}

When I'm using the MString library, it was a breeze. There's a ton of methods that makes things easy but when you need to make your program faster and leaner, you wouldn't want the extra baggage that comes with a third party library. MString is good but it's just brings with it too much things I don't need on my program.

If I have time(which most of the time I spend sleeping), I'll update the post to include a line by line explanation. It's not exactly for you but for me. It's a note to myself. :D

Ciao!

Incoming search terms:

  • string replace in c
  • string replace c
  • StringReplace c

Split-Shared Hosting

What is Split-Shared Hosting

Split-Shared is popularised by the webhosting company CrucialWebhost. It is achieved by using virtualization in a powerful server to create multiple virtual private servers (VPS) and thus, splitting a server. Now, each VPS can then be shared with by a small number accounts and virtually isolated from other accounts in the other VPS in the same server.

In the case of CrucialWebhost, their enterprise grade server comes with Dual Intel Xeon 5450 Quad Core Harpertown processor and 12GB of RAM and 1 local RAID will be split into the following detail:

  • 10 VPS per server
  • 1GB per VPS
  • 25 accounts per VPS

In all, a server can have a maximum of 250 accounts grouped via VPS. But since each VPS runs independently with other VPS in the same machine, there’s less chance that a heywire website will affect your account so long that that problem site is not on the same VPS where your account sits on. The setup, with 2GB RAM to spare allows CrucialWebhost to dynamically ramp up the memory allocation for accounts that requires it.

Is it Right for You?

For a start, it doesn’t come cheap and that would deter much of the would-be clients. But if your sites are already earning money and uptime is critical, I guess it provides one of the best bang for the buck. So if you are just starting and don’t have the money to shell out, this may not be for you.

Conclusion

The introduction of “split-shared” hosting is a good development in the hosting market. Having less clients per instance means there are less competition on resources. But just as important as the hosting service, support is equally important. And it is very important that we read the fine prints that comes with a package.

I admit that when I started with this industry, I was easily attracted by huge numbers of space and bandwidth. Had I inquired further, I wouldn’t have encountered the downtime problems. But that’s part of the learning process. So we must remember that reading and understanding every details of the package allows us to make an informed decision.

Incoming search terms:

  • split shared hosting account

Modified WP Table Prefix in bbPress

If you change your WordPress/WordPress mu table prefix (and thus, renamed the tables too) and you have a bbPress integrated with it, chances are your bbPress will lose its connection with WordPress since the configuration is not in bb-config.php. You’ll need to update the meta tables, too through mysql or phpmyadmin. Here’s the update query.


UPDATE bb_meta
SET meta_value = 'wpmu_'
WHERE meta_key = 'wp_table_prefix';

That’s of course considering your bbPress table is bb_meta and the new prefix for WordPress/WordPress mu is wpmu.

Create New User in CentOS

create the user
syntax
useradd -d [folder_name] -s /bin/bash -c "[name]" [userid]

sample
useradd -d /usr/kwatog/ -s /bin/bash -c "Kwatog Admin" kwatog

set the password
passwd kwatog

clean up later

Incoming search terms:

  • centos create new user -dialog -window
  • kwatog useradd

WordPress as Application Framework

I’ve been using WordPress for several years now for blog-type publishing but never used it for a full scale CMS. For more complicated sites, I use Joomla. The latter is more powerful, flexible, extensible, scalable and with tons of plugins and templates to choose from. But because Joomla is a full-featured CMS, complexity comes with it. A lesser mortal like me would take time to implement changes, much less when I try to create application on top of it. On the otherhand, WordPress doesn’t really consider itself as a CMS platform but instead “a state-of-the-art publishing platform”. And since it’s core purpose is to publish, a lot of people say that it is not scalable among other things which is true.

But with the rise in popularity of WordPress, it has evolved in a more robust application framework where you can build your application on. It still lacks a lot of features other CMS have but it has all the important ones. It has become an increasingly flexible framework where you can build your application on. And with the help of talented template designers, has moved the presentation of WordPress sites even higher. And despite its improved capabilities, WordPress still managed to maintain improve it’s uberly simplistic and almost idiot-proof administration interface.

I think a post over at graduallythensuddenly.com on “WordPress Makes Drupal Irrelevant” explains it further. And if you want to make your application adhere to the MVC(model-view-controller) framework, somebody has just explained how to do it over at nixonmcinnes.co.uk.

And as for me, is it time for me to use WordPress on that web application that I’ve been postponing for the longest time? You bet, it is! And as a matter of fact, I should have started earlier. Actually, I already migrated one custom-script-powered website into wordpress over the weekend out of necessity.

But this decision to migrate to WordPress doesn’t mean I’ll be dumping Joomla altogether. I’ll still use Joomla and will still be my choice for full-cms and complex website for the time being. However when it comes simple blogsite to magazine type websites, WordPress is the way. And one of the added indispensable bonus is the ease of administration. It’s so damn simple, it’s almost idiot proof.

Incoming search terms:

  • wordpress application framework
  • wordpress as an application framework
  • wordpress as application framework
  • use wordpress as application framework

CrucialWebHost Limits Files

I’ve been a customer of Crucial Webhosting for almost a year now and lately, I’m having problem with them. Apparently, Crucial Webhost has an unwritten term of service that you bars you from placing more than 50,000 files per account. No matter what kind of files they are, you are just limited to that number. So if you are running several addon domains to your account, you’ll be out of luck. And that’s what happened to me. Because on my account, I host several other small domains and that caused the problem.

But looking at the problem, I just can’t get it. They offered 250GB of file space that comes with 2.5TB of bandwidth and yet I can’t use them all? That’s totally ridiculous. What’s the use of so many file space if you can’t use it? In that sense, they stoop down to the level of Host Gator.

To compute through simple math, 50,000 files of 1024KB each is 51,200,000KB or 51,200MB or 51.2GB. That’s just a fraction of my allotted space. And we’re just talking about 1MB files. What about your config files, your template files, the scripts and all the other files needed to run your website? And how about that 2.5TB? Since I do not have a high traffic website, I only use a tiny fraction of it.

Do they suck? I don’t know but I feel shorthanded. I did not get what I paid for. They never told me that there’s that 50k inode limit. I signed up for their service because their split-shared package is really good according to reviews. I like most the fact that your account is sitting on a max of 30 accounts per vps that limits the probability of your site going down together with other accounts sitting on the same server as yours. And I paid US$215 for the whole year at a discount price if you compute it with the US$22 monthly they usually charge.

And all the trouble isn’t really compensated with their so called reliability. Because they’re not that really reliable. I found out that some servers Crucial Webhost went down last November. And there goes reliability.

So I’m now on a shopping for a better host. Maybe a VPS will be in order.