You are here

Risharde's Blog

When should you use MySQL and SQLite

Since I've been recently working on some additional web development projects to get my skills back to top shape and further my skills altogether, I decided I'd talk today on a topic that I couldn't get a straight answer to on the internet. So for those of you who don't know, many websites in this day and age are "dynamic". This means that the data is generated via scripts (basically, little programs) that pull data usually from a database and return it as a page to the user. Most of these websites rely on a database such as MySQL and this is all well and good for most websites. But it really depends. Mainly because running a database also utilizes background resources and retrieving information may require CPU and RAM to get the data back to the user. So firstly, let's talk about MySQL and Sqlite. MySQL is a full fledge compliant database that is extremely popular on the internet. To run mysql with InnoDB, it takes about 512MB of RAM to safely allow it to perform "OK". SQLite is a flat file database which doesn't require the sources of MySQL and might be limited in its functions but it does have it's place. Putting them to a test, it was noticeable that MySQL took a few seconds to do transactions (2 seconds or so) to load a Drupal page with memcache enabled as opposed to a SQlite database which was able to load the page in about 1 second. Overall drupal performance for a small website with about 100 content items is dramatically faster with SQLite. Now with that being said, if you have a lot of records (over 1000), SQLite may perform slower especially on indexed tables and this is where you should use MySQL to get the performance break you need. So in the end, it really depends on how much data you're working with to gain performance breaks.

Flow merges with Cable Wireless, not optimistic at all

A day ago, I received an automated call from Flow with an announcement that Flow would be merging with Cable and Wireless. This really alarmed me because if I have not mistaken, TSTT is also partially owned and operated by Cable and Wireless. Thus for the pas 10 years and more, I was subjected to poor, substandard service from TSTT and thus Cable and Wireless. A good example of such poor service was extremely low dsl speeds and international calling rates that were really insane to easily describe it.

I therefore dont expect that this will improve the Flow brand at all. In fact, if you can recall, it was so bad, people were begging digicel to come into the telecommunications market.

Raspberry PI - Raspbian Static IP Address

auto lo

iface lo inet loopback

auto eth0
iface eth0 inet static

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

COMMENTS: Typically, most router are set by default to so if, try

When to use Wordpress and why? How Drupal isn't getting there yet...

The majority of websites and designers are using Wordpress to create quite impressive websites out there on the internet as opposed to using Drupal. I asked the typical question - WHY? I decided to have a look at Wordpress again to see if or what makes it the choice for most developers out there - I found out that Wordpress has reached 4.x status and a lot has changed since the time when I decided to give up on Wordpress for my more custom / specialized needs.

Interesting enough, one of the reasons developers still use Wordpress is because churning out a simple site is so much easier to do with Wordpress. It just has all the basic bells and whistles with a simple admin control panel that allows you to do what you want to do - GET YOUR INFORMATION ON THE INTERNET! There is hardly any much of a learning curve because the basics are quite straight forward. 

So how is this different from Drupal? Well Drupal's strength is its modules which interact with other modules, reducing the time to develop but there's a problem. The Administration control panel isn't simple and its quite "ugly" so to speak in the sense that its default is stricly text based and not well organized. The learning curve is therefore medium to high. I still love Drupal for custom content creation and views but if you aren't going to do much complexity features, it might be best to stick with Wordpress.

Wordpress feels much more lightweight when it comes to loading times and Drupal tends to require much more resources. While Drupal has come a long way since my list complaint about performance it isn't quite fast without caching mechanisms which you have to install separately. 

What's a breath of fresh air in Wordpress and something I have complained about with Drupal a few years is having the feature to do simple core upgrades. With Drupal, its still quite difficult to do a core upgrade but it seems Wordpress has moved a notch forward and can now do core upgrades right from the interfaces. What's even more convenient is that Wordpress allows you to find plugins right from in the interface, something that Drupal current lacks and sadly makes it a little longer to install plugins.

Drupal with the right backend modifications can stay within the market as a good development choice but only when the developers see the need to ensure that simplicity should be designed in and have an option to add complexity and not the way around.

Microphone USB for Raspberry PI

Plug in your USB microphone.

Let’s open up an ALSA configuration file in vim: sudo vim /etc/modprobe.d/alsa-base.conf

Change the following line: options snd-usb-audio index=-2

To this: options snd-usb-audio index=0

Back in the shell, run: sudo alsa force-reload

Deluged crashing and Libtorrent on the Raspberry Pi - Solution

Okay so I've been really working my new Raspberry Pi Model B and I encountered a problem with deluged (a torrent client) which apparently uses libtorrent. Now according to my research, there is a known problem with deluged and libtorrent 0.15 which really makes me wonder the sanity of the raspbian developer community. Shouldn't they be bundling the libtorrent 0.16 version instead to maintain stability? Anyways, I read that you can compile your own libtorrent 0.16 so I decided that I'd do just that - WHAT A TASK - You'll need to install a lot of dependencies to get this to work properly!

Here goes:
First thing we need to do is make sure the dependencies are installed

sudo apt-get install libssl-dev
sudo apt-get install libboost-dev
sudo apt-get install libboost-system1.50-dev

#Then we need to download the libtorrent-rasterbar-0.16.5 source code. This takes FOREVER to compile, about 5 hours on PI! Man does the raspberry pi need a faster CPU!

tar xvzf libtorrent-rasterbar-0.16.5.tar.gz
cd libtorrent-rasterbar-0.16.5
./configure --enable-python-binding
sudo make install

ldconfig -v | grep libtorrent

python -c "import libtorrent as lt; print lt.version"

Text To Speech (TTS) / Speech Synthesis with the Raspberry PI Model B

First, set up your webcam or usb microphone to get commands

Plug in your USB microphone. Let’s open up an ALSA configuration file in vim:

sudo nano /etc/modprobe.d/alsa-base.conf

Change the following line:

options snd-usb-audio index=-2

To this:

options snd-usb-audio index=0

Install SoX which is used for playback and not Text to Speech (very useful tool to playback wave files)

sudo apt-get install sox

Also, if you have already set up a microphone as main device, you need to set playback device for Sox to output to the raspberry audio jack:

export AUDIODEV=hw:1,0


#Install Festival

sudo apt-get install festival

echo “Hello World” | festival --tts

hostname -I | festival --tts

# or install espeak

sudo apt-get install espeak

espeak -ven+f3 -k5 -s150 "Hello World"

# or Google Android TTS - PICO

sudo apt-get install libttspico-utils

pico2wave -w helloworld.wav "Hello World" && aplay helloworld.wav

Debian - Formatting a partition to EXT4

sudo mkfs.ext4 /dev/sda1 -L partitionname

Notes: You can get partition information by running: blkids

make sure to replace partitionname with the drive label you want

Debian / Raspbian High CPU NTFS

Okay, so this is a major limitation I've encountered with the Raspberry PI. Using a USB hdd with an NTFS partition is going to see a lot of high CPU usage. It seems to be the mount drivers. The only thing I've found to alleviate this completely is to make an EXT4 partition on the USB drive and WOW DID IT MAKE A DIFFERENCE!