Archive for the 'PHP' Category

You are currently browsing the archives of HidayahTech .

Naïve integer primality calculator in PHP

Bismillaahir Rahmaanir Raheem

Alhamdulillaah, while reading about integers and, subsequently, prime numbers last night, I decided the time had come for me to write a primality calculator in PHP.  The test I use in my implementation is about as a naïve as one can possible get, but it was fun, nonetheless.

Interestingly enough, I discovered that there already exists a primality calculator for *nix-based systems - primes.  It comes with the bsd-games package for Fedora.  I assume the same is true for other distributions.  Mine isn’t quite as fast yet…but it does accept, optionally, one or two arguments. If there are two arguments, then it will calculate all primes starting from the first going until the second. If there is only one argument, it will calculate from PRIME_START (defined to be 2) through to the largest integer PHP can handle on your platform (usually the maximum value of a signed int on your machine).

There are loads of potential optimizations that can be performed, and this was just something written on a whim as a proof of concept. It seems to be accurate, however. The code, released under the GNU GPL v. 3.0, can be found below.
Continue Reading »

Posted by Basil on Aug 24th 2008 | Filed in Development, Fedora, Free Software, Fun, GNU/Linux, PHP | Comments (0)

Audio Islam now running on lighttpd

Bismillaahir Rahmaanir Raheem

Alhamdulillaah, I’ve been able to make some major- and sorely-needed-upgrades to Audio Islam.  Interestingly enough, for the vast majority of people, these changes won’t really be that visible as they are all behind-the scenes.

Continue Reading »

Posted by Basil on Aug 16th 2008 | Filed in Audio Islam, Design, Development, Free Software, GNU/Linux, PHP, Projects, Technology | Comments (5)

My projects running on free software (and how to better integrate them)

Bismillaahir Rahmaanir Raheem

Software that is free from proprietary restrictions (a.k.a, free-and-open-source software, which I will refer to as simply “free software” for the rest of this post) has become exceedingly important in my life for both philosophical as well as practical reasons. Not only do I truly believe free software to be inherently better in every way for humanity than proprietary/closed-source software, but I have become increasingly incapable of working with non-free software. Now that free software solutions run the gamut of nearly everything I have a need for, I have all but eliminated non-free software from my essential stack. Having said that, I have a special interest in web-based free software as this particular realm of software has become crucial not only to myself, but to nearly all projects in which I am involved.

Continue Reading »

Posted by Basil on Jan 29th 2008 | Filed in Development, PHP, Projects | Comments (0)

phpBB 3.0 Beta5 released

Alhamdulillaah, phpBB 3.0 Beta5 has been released! They mention in the announcement that they are anticipating the next release to be a Release Candidate, which means we may possibly have phpBB 3.0 final by this Summer, in shaa Allaah.

I have been anxiously awaiting phpBB 3.0 for a loooong time (predating this blog, that’s for sure). Features like sub-forums, UTF-8, and others that make sense for administering a larger forum have been a long time coming, and I have to hand it to the phpBB team - it is not for slacking, they are just so darn thorough. And they are probably dead-set on making phpBB 3.0 rock-solid in terms of performance, security, and stability, so I’m not pushing them to hurry to the final release…I just wish they would hurry to the final release.

My immediate need is for an upgrade for the Columbus Dawah forums, but I am reasonably sure that it won’t be the last forum I am working on, and I always prefer using a free-and-open-source alternative to proprietary and closed-source code.

Posted by Basil on Jan 30th 2007 | Filed in Development, PHP, Projects | Comments Off

phpBB 3.0 Beta3 released!!!

Alhamdulillaah, the final release of phpBB3 approaches ever nearer with the release of Beta3. I’ve always been an avid phpBB fan, and although I was the friendly admin of a vBulletin 3-powered forum for well over a year, phpBB has always been my choice when it came to deploying my own bulletin board sites for its free-and-open-source philosophy and generally high-quality nature (despite a surge of security breaches a short while back). Continue Reading »

Posted by Basil on Nov 13th 2006 | Filed in Development, PHP | Comments (2)

MySQL Server, Apache HTTPD, PHP, & Subversion source configuration & installation

I have my webserver (at the time of this writing, the one on which this blog is posted) configured rather nicely, however, as with everything that accumulates over time, it’s current state is a combination of quite a lot of trial-&-error sessions that would be really hard to duplicate the first time I tried to do so on another environment. Therefore, I’m going to try to log the configuration I use to get a system working as I like. This may or may not turn into a tutorial-type series, but for now, it’s just notes for myself. Continue Reading »

Posted by Basil on May 27th 2006 | Filed in Development, GNU/Linux, PHP, Subversion, Tutorials | Comments (2)

PHP, PEAR, & Zend Framework coding standards

I’m all for standardization and standardizing procedures for long-term efficiency. However, up until now, where there were no “official” standards for something, I would make up my own or imitate what I thought was the nicest. One place where I’ve done just this was with regards to my coding styles for PHP - I had my own styles. Well, no more! I’ve finally decided to take the plunge and following the PEAR coding standards. Continue Reading »

Posted by Basil on Apr 29th 2006 | Filed in Development, PHP | Comments (0)

Implementing PHP Iterators - The Beginning

One of the new features that came with PHP 5 is the ability to implement Iterators. Implementing one of your objects as an iterator essentially allows you to treat it as a standard array. By default, without adding any additional code, you can enable iteration over a regular objects variable members. So, for example, if I had the following code:

(I’ve removed the plugin that I used to format PHP code here, so until I find out that works, I apologize for not showing my code examples…)
If I were to run a foreach() loop over this, I would get behavior that would correspond to an array with the elements of $bar1, $bar2, & $bar3. This is wonderful default functionality. However, you can go a step further if you want to implement more complex & complete behavior. I’m going to be experimenting on this kind of behavior with my DBObject class - namely, converting it to a DBArray object, and see how well that goes over. I will report on my successes & travails in followup posts.

(Boy I’m having a hard time to get Wordpress to format code on this thing…probably need to get an extension to do it. Any suggestions?)

Posted by Basil on Apr 7th 2006 | Filed in Development, PHP, Tutorials | Comments (1)

Zend Framework

My supervisor brought to my attention the Zend Framework - an interesting PHP-powered answer to Ruby-on-Rails.  The Zend Framework seems to espouse the MVC design pattern.  It looks really interesting & is worth another look here shortly.  I’ll follow-up & let you know what I find out.

Posted by Basil on Mar 14th 2006 | Filed in Development, PHP | Comments (4)

Creative Commons Attribution-ShareAlike 3.0 United States
Creative Commons Attribution-ShareAlike 3.0 United States