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
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.50

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

END OF FILE
COMMENTS: Typically, most router are set by default to 192.168.1.1 so if 192.168.1.50, try 192.168.1.1

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

Rapsberry PI and PocketSphinx error fix

http://robot.laylamah.com/?p=35

Lalymah seems to solve the issue of not getting audio into pocketsphinx: Error opening audio device plughw:1,0 for capture: Connection refused

Mixer load failed: Invalid argument FATAL_ERROR: "continuous.c", line 246: Failed to open audio device

To fix on the Raspberry PI, do the following: sudo apt-get remove pulseaudio -y sudo aptitude purge pulseaudio -y sudo mv /usr/include/pulse/pulseaudio.h /usr/include/pulse/pulseaudio.h.old

Recompile sphinxbase and pocketsphinx and you should be good to go

You could also try reading this one: http://www.rmnd.net/speech-recognition-on-raspberry-pi-with-sphinx-racke...

When work became work

Today, is my first day official home after resigning from my job. It's really astonishing to literally FEEL how much time I've gotten back by just not having to fight to beat the traffic to Port of Spain and well work itself. So what can I say from my experience without breaking contractual privacy / confidentiality agreements. Well, let's start where work became work. I know this sounds like I've made a typographical error but it isn't. One reason for pursuing my tertiary education in Computer Science was because I am truly passionate about Information Technology. Doing "I.T" has been turned from second into first nature for me, it is who I am. People in the work place really get confused when I haven't heard about a piece of technology that they know about - as if to say that someone in I.T MUST KNOW THE ENTIRE WORLD OF I.T.

So coming back to my topic about when work became work. I.T has always been the fun part for me, both in and out of work. In work though, I.T became "work" as opposed to a "job". You see, a job is technically work BUT some people actually LIKE their jobs. So a job is like 1 + 1 = 2 in math. The work I am referring to is when its no longer really a job that you like but really just perhaps a frustration. Getting down deeper into how I feel, I'd say that work was once fun and enjoyable but then circumstances changed (as it naturally does) but in an unnatural way. I had to deal with people who thought they knew I.T and further more, people who would say a few sentences and think that one could build the actually solution within the same time it took for them to say some sentences.

For example: Let there be a house, and there was a house....

Obviously, only God could do such miracles... or so I would imagine.
As I further stated, it became work when I had to really explain I.T to people who couldn't understand it but think that they do. Of course, I'm not saying I'm perfect but why hire someone (with experience and knowledge) and then don't take their advice. So essentially, work became literally work... the joy and fun of having a job was lost and thank God I have the resources to quit. I really do feel sorry for those of you out there who are not in a position to quite your miserable works - I really genuinely do feel sorry. Life isn't fair and the work world is worse than life, its hell.

Stay strong my friends.

Lightweight Torrent Client for Raspberry Pi or any other linux distro

I came across an article which explained in detail how to set up a light weight torrent client called Deluged. I think it might help someone out there that has a Raspberry PI or linux distro with only command line access:

http://www.howtogeek.com/142044/how-to-turn-a-raspberry-pi-into-an-alway...

From the tests ran on deluged, it seems it only uses about 12MB of RAM which is absolutely awesome!

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!

wget http://libtorrent.googlecode.com/files/libtorrent-rasterbar-0.16.5.tar.gz
tar xvzf libtorrent-rasterbar-0.16.5.tar.gz
cd libtorrent-rasterbar-0.16.5
./configure --enable-python-binding
make
checkinstall
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

THIS IS WHERE TEXT TO SPEACH COMES IN: THAT IS, TEXT CONVERTED INTO AUDIO FOR PLAYBACK

#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

Pages