Category Archives: Information Technology

Setting up Drupal to handle many more visitors than normal.

Note: This article was mostly written to reference Drupal 6, but most of this should also be valid in Drupal 7 as well (I am not 100% sure).

Drupal is a great system, that is built to handle large volumes of users.  If you have noticed your Drupal site having problems with pages loading, traffic clogging up your server, and other related issues..there are a few very common problems that are known to cause this. With a little bit of settings optimization you can prevent these issues from arising.

The first thing you want to do is modify some of your cache settings.  You first have to login to your Drupal website, and then go to the Performance Settings. You can also find these by going here: (once logged in).  After that just modify some of the options.  Change the Caching Mode to “Normal” and then enabled Page Compression and Block Cache. Once done, then save the settings.

The second thing you can do to help performance is to turn off your developer modules.  Your site will run a lot quicker, and allow your server to handle a much larger capacity.  

Android + Netbeans…development Setup – Live Android Testing

I have been getting pretty heavily into Android development lately. I use the Netbeans IDE to handle all of my development. In order to develop with Netbeans, you need the following software:

  1. Netbeans IDE:
  2. The required Java Downloads (You can find these on Google)
  3. The Android SDK. You don’t really need all of the API’s. Just get the most recent API, the Google API in case you need it, the documentation, and other related misc tools. That’s
    all you really need.  The most recent API also has support for older versions of Android as well, at least from what I have been able to tell. I can write applications for virtually any version of
    Android using the most recent API.  It also gives it better overall support for all systems, from what I can tell.  Correct me if I am wrong, I am still pretty new to Android development.
  4. The Netbeans Android plugin. There is an exceptionally easy install and integration guide here: (VERY simple instructions).

Now, I also found a secret for testing android apps.  If you have an Android phone…turn on USB Debugging and plug it into the computer you are using. Then if you go to build, and then run the app (or just
Run) then it gives you the option of loading the app directly onto your phone. So you can easily just launch it and test it on your own Android phone..which also makes it easy. Every time you run it, it’ll re-install
the newest version on the phone, restart the app,a nd have the new changes. It makes it very easy to test apps out while your building them, and it’s been an invaluable utility for me. I highly recommend this setup
as opposed to trying to use an Emulator. If you don’t have an Android get an old crappy one (even if it doesn’t have service) just to use it as a test environment. Much more efficient and you can develop apps
much faster.  Because..just because there is no compile error, doesn’t mean it won’t crash in the phone..makes it much easier to test it live that way.

I might have more Android development related blog posts, as I learn new stuff and continue to get more into Android development.

So far I have not gotten very far, but made good progress for it only being 4 days. I got my environment setup, I was able to get text to show to the screen, get the current Longitude/Latitude (one instance of it so far, that doesn’t update..still working on it), manifest permissions (basics), get JSON or other content from a website URL, and parse and use the JSON and print it back to the screen.  I am currently in the process of learning the different layouts, about the layout file, more manifest related stuff, and trying to get better layouts setup on it.

JangoMail Setup

Alright, I just had a good bout with the Jangomail API.  Seemed easy enough, but I wanted to share my results with everyone. I am going to share a simply command to send a basic transaction email, in HTML, with an

First off, create yourself an account at Jangomail.  Secondly, make note of your username/password that you use to login to your account.  Once you have that all together, open up some FTP program, and
connect to the jangomail servers.  The Host is going to be and the username/password are, of course, your username password.  Take the attachments that you want to include in your
mail outs and insert them into the attachments folder.  Simple as that.  Now it’s time to write some code, that is going to send out one basic test Transaction email.  The code is below.

$client = new SoapClient('');
$parameters = array
        'Username'          => (string) 'JangomailUsername',
        'Password'          => (string) 'JangomailPassword',
        'FromEmail'         => (string) '',
        'FromName'          => (string) 'Your Website',
        'ToEmailAddress'    => (string) '', // Your email address
        'Subject'           => (string) 'Test Email',
        'MessagePlain'      => (string) 'This will show if they don\'t support HTML at their email service.',
        'MessageHTML'       => (string) '

Test HTML Email

Test HTML email text goes here.

        'Options'           => (string) 'OpenTrack=True,ClickTrack=True,Attachment1=fileattachment.pdf'

    $response = $client->SendTransactionalEmail($parameters);
    echo "Message(s) sent!";
catch(SoapFault $e)
    echo $client->__getLastRequest();

Just make sure your attachment is named the exact same as it was in the attachments folder.

Very simple. The hard part for me was the attachment. At first I was trying to figure out how to get it uploaded to the FTP that I was running the Jangomail system from…then finally realized it had to be
loaded into your Jangomail FTP system to work.

Good luck, and hope this helps.  Also their support systems are very helpful. I had some issues with the attachment systems, and they helped me work it out pretty easily. They have great developer support.

C++ Case/Switch Statement Warning

If you are a programmer of any kind, you are most likely familiar with the Case/Switch statement.  This is simply a way in programming for you to do different things depending on the value of a variable.  For example..if your working with a variable named abc.  You might want to do different things depending on what the value is.  The long way would be to put down a long if/else statement to deal with each potential value type.  The easy way is to use a simple switch/case statement.  No matter what language you are using, this will come into play at some point.

If you are using PHP a switch/case statement might look like follows:

$variable = 'test';
switch($variable) {
  case 'test':
  // do something
case 'test2':
  // do something
  // do something

That is very simple.  It’s quite similar to JavaScript, but with a little different syntax.  Now here is the tricky part.  I don’t know every language out there. However, quite a few of them have the same type of structure of Switch/Case statements.  Then suddenly C++ throws you a loophole.  In working with C++ it’s just about the same as PHP.  Except for one strange thing. If you initialize a variable inside of a switch/case statement you have to use brackets around each interior case when you are initializing a variable. Just something tricky that I had to figure out with a lot of trial and error.

My Favorite Webhost

My General Thoughts

So I wanted to share my thoughts pertaining to web hosting. They are kind of biased…but it is what it is. Throughout my entire web/application development career, I cannot describe how many hosts I have researched, intensely studied, or personally tried. I have personally tried a variety of them (tons of free ones, bluehost, 1and1, hostgator, godaddy, and many others). I have researched/reviewed more than i can name. The world of hosting changes every year. Every single year there are new things happening in the world of hosting. Companies shut down, companies down size, other companies get bigger, some get worse, some get better. It is always changing.

Let me start off by giving you some examples. These are all my personal opinions. If you do not agree, that is OK. These are not set in stone, they are just my thoughts. So let’s start off simply. I always refer all of my clients to the host I am currently at. I always make sure I am at the best host I can find, with the best services, most features, and best support. I always choose the best that I can find (I am a perfectionist). If a host does not stay the best, and I get a hint of a better host, I change. So does all of my clients generally. Since I refer every new client to the host I am currently using.

So let’s start with Bluehost. When I first started my career…about 7 years ago, they were an awesome host. They did everything I needed. They were simply amazing. So, I used them a long time. However, after awhile they started going down hill. They had a lot of downtime around the time I stopped using them. They had a lot of complaints in the forum. I was just trying to start a business and my site was down all the time. This was happening due to growing pains. They were starting to grow faster than they could support. They lost my business permanently at that point. Not because I did not like them, but because I knew they were no longer the best (at the time). By the way, they have gotten a lot better since then. I have heard a lot of good ratings. But generally once I get that impression about someone, I stay away from them. On top of that, I never really did like the way they had their CPanel setup, I checked recently and it’s almost the same.

From there I went to Godaddy. They are “OK”. They are too big for their britches I think. They are too popular, and too big. So they are very restrictive of their resources. Their other features (domain registration) is also a pain to me. So I eventually left them. They are huge. Not to mention some of the third party systems that I like playing around with can’t be installed easily in Godaddy. This is just another negative. Everytime I have had a client on Godaddy I have ran into one issue or another.

After that was over, I went to 1and1. I fell in love with this host. I had used them a VERY long time. I currently can say I have really no complaints. Over a period of time however, I got sick of the setup. There are a lot of things I find annoying about it. The interface in their panel is not user friendly, it’s just not what I am looking for anymore. After a lot of debating, and thoughts, I finally decided it was to leave the dinosaur that is 1and1 and find something a little more suited to my current needs.

My Final Decision
With a ton of looking, I ran into Host Gator. This ended up being the beginning of a beautiful relationship. Host Gator ended up being my favorite host, that I have ever had the pleasure of hosting with. I have a great deal of things i have liked about them…and every time I start to think I have ran out of ideas to love them, I notice something else that I like even more about the whole experience. I have listed some of those experiences below. I have had a lot of experiences with a lot of hosts, but none of them were quite so…enjoyable. I actually enjoy going through my panel and doing stuff with my websites now, this has really engaged me to take on a lot more personal projects than I previously was.

The hosting company is a growing company, but their down time is very good compared to other hosts. I have seen a few blog posts online that describe heavily about the downtime, on a grade chart they come somewhere around 99%. They have really good down time, and I have noticed no issues whatsoever since I started using them.

This host is the fastest that I had used. I do a lot o custom development, sometimes I use Drupal, sometimes I use WordPress, and sometimes I experiment with random third party systems. With 1and1 my own personal sites ran very slowly, because of their server.
When I moved everything over to Hostgator everything was almost instant. I noticed that all of my sites load almost lightning fast.
Makes it easier for me to get around, and perform development on new personal projects as well.

The main thing I like about Hostgator is their supreme host gator setup. Their databases are all inline for one thing. SO you can
go into the system, setup a database/user and be done with it. It is very fast to set this up, and their CPanel runs so fast, that you
can add 5-6 databases within just a few minutes. Another great thing is their PHPMyadmin import is set at 50 gigs (more than most of the
hosts I have seen). So most of the time, I can upload whatever sized SQL files I need, saving me a lot of time having to bring out
Putty and doing it the manual way. Another thing, is their open database. Once you click “PHPMyadmin” it does checks to make sure your in the Cpanel. Then it brings up a directory of ALL the databases on your account. You can go through them all and review stuff, change stuff, and just work on them all in one interface. Since your logged into the master account, you are logged into all databases. It also doesn’t disconnect you every few minutes of inactivity, so you can do something and come back to the database as you need. It does disconnect you
after a few minutes, but the time on it is a lot more…reasonable than 1and1.

That’s not all. The way you setup domains and structures on the site is pretty good. Their is one issue (having to re-add add-on domains just to be able to reset the default directory), but that is an issue with Cpanel, not with Host Gator. I am just waiting on the developers of Cpanel to do something about that.

Language Support
I am a programmer also, so that means I like working with a variety of languages. The Host Gator standard server (I have business hostings) allows me access to a bunch of primary languages (PHP, Perl, Python, Ruby) and a few others. This is a great experience when I want to play around with a few other languages, or if I decide I want to build a few sites in some of those other languages. This is also great for experimenting, learning new skills, or practicing my usage of various languages. This is a major thing for me. Very few hosts offer a variety of languages..this increases the capacity for development by a great deal, even allows a programmer to perform experiments between a variety of languages. TO me, the more languages you have available, the better.

Domain Handling
Right now the way that Host Gator handles domains is very annoying. I am actually registering and managing my domains through 1and1, then sending the DNS servers to Host Gator. However, Host Gator even has a solution to this issue. During the month of February, they are going to release their own Domain Management Utility. This is going to solve all of my issues pertaining to the domain registration handling. Not to mention they are becoming their own Registrar. Right now, they go through ENom, and their prices are VERY expensive. To transfer a domain, your looking at 20 bucks. The register a domain, they are around 10-15. Almost triple the price of 1and1. The good thing, is once they setup themselves as their own registrar, they are going to be getting a great deal of discounts for their users. That means the prices might potentially get cut in half. This is something to look forward to, and it’s happening this month (so less than a 30 day wait). This is going to address the only negative thing I had to say about Host Gator (meaning they would be even better then, than they are right now.

I can’t even describe the support. They have 24/7 phone and chat support. Every issue I have had so far (NO MATTER WHAT IT WAS) I opened a technical support ticket, ask my questions, and log off chat. They are always very nice, very knowledgable, and answer my questions the best they can. I have had no complaints with support whatsoever. They even discussed with me the ins and outs of the hosting panel as I had various questions about the way their CPanel was configured.

Overall…host gator is my favorite host. If something else gets better than them, I would consider changing…but I expect Host Gator to be on top throughout at least all of 2011, 2012, and most of 2013. By that point it just remains to be seen if they end up growing too big to support hosting in the majestic way they do now.

If you are interested in what I had to say about Host Gator, and want to try them yourself, then please either use the banner link on the right hand side of the page, or use the code “ninjakreborn” when signing up. This will get me credit for your signing up, as well as give you a 9.00+ discount on whatever your first package payment is. This is also a good way to support the time I put into this site, if you find any use out of it.

Integrating CKFinder with the Codeignitor Framework (PHP)

Note (3/9/2013) – This blog post was written a long time ago.  So I am not entirely sure if this fix would still apply.  Although, it most certainly might, if not then something very similar would still work.

I have become very familiar with Codeignitor, CKFinder, and CKEditor since I have been in business. Recently I have had the challenge of trying to integrate the CKEditor and CKFinder systems into the Codeignitor framework.

CKEditor is pretty easy to setup inside Codeignitor. All you have to do is just load all of the ckeditor files/folders into the root directory and then include the JS file and configure it like you would on any normal website. CKFinder is practically the same. All you really have to do is load the files to the server and specify were to find them when you create the instance, as well as do all of the configuration options and initial setup.

I have known how to do this for quite awhile. However recently I was approached with a challenge that I did not readily know how to accomplish. Basically I had multiple different user accounts, and each user account needed to have the ability to have their own folder to use with CKFinder. Normally CKFinder defaults to ckfinder/userfiles and it works all internally. I had a situation where I had to basically have a new folder (named the ID of the user) for each user. I went back and forth into the code trying to work this out, I dug through Google for hours, and I also spent a great deal of time in forums trying to get the answer.

Finally I ran across a stray post in the Codeignitor forums that did exactly what I needed. It was pretty easy to setup, and since I got it initially configured it worked great. Here are the steps I followed to get this implementation up and running with the least amount of stress. It was very affective and it has worked fine ever since it was setup, and it’s been in a production environment for awhile.

1) Setup a new folder in the main directory (the same directory that contains your Codeignitor index file). I named my folder “ckfinder_userfiles”. Once you setup the new folder, load it up to the server.

2) Now open the CKFinder config file. If you loaded your CKFinder folder into the server in the main directory then you can find the config file at the following location: /ckfinder/config.php

3) Once you have the file open we are going to assume that you have a session saved using codeignitor that is called “user_id” for example. It can really be anything but it will serve our purposes for this example. By default you need to look at line 61 but it could change if you have a custom setup for your config file. Your looking for the area where the base_url is setup. Just replace the base url parameter with the following code:

$session = unserialize($_COOKIE[‘ci_session’]);

$user_id = $session[‘user_id’];
$baseUrl = ‘/ckfinder_userfiles/’ . $user_id . ‘/’;

That is it. It will take the internal Codeignitor session and dig out the user_id and use that to build the base url. Now anytime that user is logged in (assuming the user_id is set as a session to their user id, then it will automatically default internally to the folder ckfinder_userfiles/theirid. It also handles all of this automatically so you don’t have to worry about doing anything to the folder or creating it. CKFinder will create it automatically. The good part is this restricts user across the board to only entering their one folder. So this prevents people from getting into other people’s folder (Which can be a problem if you are needing to restrict users to only their specific folders.

There are probably other solutions to this problem. I found this specific solution to be very effective, and seemingly very secure. I would be interested to hear about other people’s thoughts regarding this procedure, or maybe things they have tried in their own implementations. Feel free to comment.

Xhtml to PDF – My Thoughts

I wanted to express my thoughts here about PDF generation in PHP.  Doing this by default is pretty easy.  You download FPDF (or the library of your choice), you install it, configure it, and set it up. Then generally you just build your PDF. I recently ran across a few different classes that have claimed to take an xhtml/css page, and convert it to a PDF.  I wanted to test it out. So I downloaded a PHP conversion class, tried it out, and it works perfectly.  This is a strange euphoria. Not to mention, it pretty much supported all CSS.  So the next time your stuck fighting with a manual PDF build, especially on those troublesome reports…try a converter instead.  Might be as simple as trapping your HTML into a variable, passing it into a function and your done.  The one that I used works with any good formatted HTML and most CSS styling options (just not floats).

Just to save you some time, I have done a little research and gotten some of the best options together for XHTML to PDF generation in a variety of different programming languages.

These languages had easy to find ones.  There were a few languages I had trouble finding one for (ASP, and a few other languages).

If I find any more good ones for any major language, I will come back and list it here later on.

Facebook Login

Disclaimer: The code within the post is NOT ready for a production environment.  I have halfway pulled it out of Codeigniter and half formatted as you would need.  So this is not usable in a production environment. It is ONLY meant to serve as examples.

I had to write about this.  This was probably one of the most annoying things I have had to work with in a long time.  I have found a lot of people online who have had very similar problems with this. I want to try and hopefully save someone a lot of stress and heartache from having to try to figure out the Facebook registration and login by themselves.  I have had about 2-3 days worth of very aggravating trial and error. I figured out a few key points and thoroughly understand how this works, inside and out.

Step One: Create App

Create a facebook account (unless you already have one).  Once that is created, go into Facebook and login. At the very bottom of the page,
once you login, you will see a “Developers” link.  You have to go to the very bottom of the page.  Click that link.  At the top right hand corner of the screen, click “My Apps”. At the top right of this page click, “Set Up New App”.  Follow the instructions from there. It’s pretty simple. Just put in all of your information, and setup the return URL as your website address. This is VERY important. So if your website is, then that is what goes in your domain and URL settings.  This is a very important step. Make sure you follow the instructions on this part very carefully.

Also note..if you can’t get to the create app screen, then it might be because your Facebook account isn’t authorized. IF that is the case, Facebook would return an error about having to register your account (either using your mobile number, or your credit card).  Perform whatever steps are needed to verify that. Once you have all of that ready, your ready to go.

That’s it.  You have created the app. Inside the app settings please note your app information. You will need the APP Id, Secret Key, and API Key.  You will need to make note of all of these. They are very important, as is the site url and site domain.  90% of the time you have issues setting this up, it’s going to come down to some of that basic information being wrong.

Step Two: Registration

The first thing you have to do is setup a way for users to assign their user account (on your site) with a facebook system.  This is what allows the automatic login to occur from Facebook.  There has to be some type of communication initially between Facebook and your system in order to record the Facebook User ID.  This is what allows your system to match up user accounts during the login process.  To be honest with you, the entire registration process is very easy.

There are a variety of ways to set this up. However, I did not want to have to fight with some of the methods they present, so I used the more straight forward Iframe. It worked for me very well.  You would simply add the following code to your registration form. So you have your standard registration form (where they can register) and then you have your facebook Connect code.  This code allows for standard registration, along with setting up Facebook integration (so they can do facebook login).