Monday, 1 February 2016

Ultra-light and simple Accordion With Jquery

Hello,
remember to include jQuery library before the javascript code below.
here is the code:
JS/Jquery:
if($('.faq-post').length){
        var self = $('.faq-body');
        $('.faq-body .faq-answer').hide();
        $('.faq-question').on('click',function(e){
            $('.faq-answer').hide();
            $(this).next().show();
            e.preventDefault();
            return false;
        });
    }
HTML:
<article class="col-xs-12">
<div class="faq-body">
<h5 class="faq-question"><a href="#" title="">Topic heading </a></h5>
<div class='faq-answer'>Content</div>
</div>
</article>
You can add you style as you wish.
Enjoy!!!

Follow me on twitter: http://www.twitter.com/_josiah_king Join me on Google+: https://www.plus.google.com/u/0/113541005774136102412/posts/p/pub?cfem=1

Tuesday, 26 January 2016

CSS3: Using vw and vh units

VW simply means viewport width while VH is viewport height.

So, you've heard about px, pt, em, and the fancy new rem. Let's look at a couple more: vw and vh.
Often times, there are certain elements within our design that we'd like to ensure can fit into the viewport in their entirety. Normally, we'd have to use JavaScript to do this. Check the size of the viewport and then resize any elements on the page accordingly. If the user resizes the browser then the script runs again to resize the elements on the page.

With vw/vh, we can size elements to be relative to the size of the viewport. The vw/vh units are interesting in that 1 unit reflects 1/100th the width of the viewport. To make an element the full width of the viewport, for example, you'd set it to width:100vw.

Putting it to good use

Lightboxes seem like a great candidate for using vw and vh units, since the lightbox is normally positioned in relation to the viewport. For elements positioned in relation to the viewport, however, I find using fixed positioning with top, bottom, left, and right values to be an easier approach—completely forgoing the need to specify height and width at all.
A good use case for these new units would be for content that sits within a normal document flow. For example, scrolling this page, I could include a number of screenshots. For those screenshots, I don't want them to exceed the height of the viewport. In this case, I can set a maximum height on my images.
img { max-height:95vh; }
In this case, I set the height to 95 to give the element a little bit of breathing room while on the page.

Browser Support

This feature is supported by all major browsers including internet explorer 9.


Follow me on twitter: http://www.twitter.com/_josiah_king Join me on Google+: https://www.plus.google.com/u/0/113541005774136102412/posts/p/pub?cfem=1

Monday, 18 January 2016

Developing a web base fingerprint/biometric software using PHP and Javascript

Hello, i got some request few days ago on how to use fingerprint with php. Here are some useful links to check out if you are considering developing a web base fingerprint app.

http://jayakody2000lk.blogspot.com.ng/2009/07/phphd-server-side-hardware-port-access.html
https://github.com/Valve/fingerprintjs2
https://www.npmjs.com/browse/keyword/fingerprint
http://www.bayometric.com/web-based-biometrics/

And yes, it is possible with todays technologies, but not directly. I am yet to develop a fingerprint software of any platform, so i have not test any of the above solutions.

Follow me on twitter: http://www.twitter.com/_josiah_king Join me on Google+: https://www.plus.google.com/u/0/113541005774136102412/posts/p/pub?cfem=1

Thursday, 14 January 2016

Detect if file is not empty before upload in PHP

I was working with a script developed by something else and i got hooked because i could not post content due to some logical issue with the programming of the script.
The script was design to upload file whether empty or not and this was causing problem for me because i am not attaching a file to the post.
Here is the code to here detect if the file upload is not empty:
if(!$_FILES["file"]['error'] == 4){ //process upload }

That solves the issue, i could now post without upload a file.


Follow me on twitter: http://www.twitter.com/_josiah_king Join me on Google+: https://www.plus.google.com/u/0/113541005774136102412/posts/p/pub?cfem=1

Monday, 11 January 2016

Search and replace string in PHP

Search and replace string in php.
Search and replacing string is not difficult using the function str_replace();
I have to search a string (actually an html content which i extracted from a file using file_get_content()), string to was src=" and replace with src="http://path/to/the/image/folder/ and i acheived this by simply str_replace('src="','src="http://path/to/the/image/folder/',$str);

Follow me on twitter: http://www.twitter.com/_josiah_king Join me on Google+: https://www.plus.google.com/u/0/113541005774136102412/posts/p/pub?cfem=1

Friday, 8 January 2016

Working with PHP ZipArchieve Class


This happened today, it was my first time working with zip file.
The issue came up when i opened the file like this:

$zFile = $zip->open($filePath,  \ZipArchive::OVERWRITE);
$zip->extractTo($bookDir);

After opening the file i was trying to extract to another directory, this returns true but no extracted data was found.
The is a really troublesome bug, but thank God for the internet.
After sometime i debugged and removed the \ZipArchive::OVERWRITE and it worked.

$zFile = $zip->open($filePath);
$zip->extractTo($bookDir);





Follow me on twitter: http://www.twitter.com/_josiah_king Join me on Google+: https://www.plus.google.com/u/0/113541005774136102412/posts/p/pub?cfem=1

Monday, 14 September 2015

In 20years to come, What stage will technology (particularly web development) be?

Hello fellow developers, bloggers and tech enthusiast.
I first saw a computer in early 2000 and started web development 2007.
My first encounter with a computer was when it was brought to my school for practical training and we played pac man game. I was very excited, then computer(Microsoft window) was still in black and white and no appealing GUI( graphical user interface).

Lets have your say.



Follow me on twitter: http://www.twitter.com/_josiah_king Join me on Google+: https://www.plus.google.com/u/0/113541005774136102412/posts/p/pub?cfem=1

Thursday, 5 February 2015

Why SSD is better than HDD



Now, you can configure your computer with either an HDD, SSD, or in some cases both. But how do you choose? i explain the differences between SSDs and HDDs, and walk you through the advantages and disadvantage of both to help you come to your decision.

HDD and SSD Explained

The traditional hard disk drive (HDD) is the basic nonvolatile storage on a computer. That is, it doesn't "go away" like the data on the computer memory when you turn the computer off. Hard disk drives are essentially metal platters with a magnetic coating. That coating stores your data, whether that data consists of weather reports from the last century, a high-definition copy of the Star Wars trilogy, or your digital music collection. A read/write head on an arm accesses the data while the platters are spinning in a hard disk drive enclosure.

An SSD does much the same job functionally (saving your data while the computer is off, booting your system, etc.) as an HDD, but instead of a magnetic coating on top of platters, the data is stored on interconnected flash memory chips that retain the data even when there's no power present.

Difference between SSD and HDD

See differences in the image below:

Follow me on twitter: http://www.twitter.com/_josiah_king Join me on Google+: https://www.plus.google.com/u/0/113541005774136102412/posts/p/pub?cfem=1

Saturday, 24 January 2015

How to check if value is a number (isNumer()) in javascript

After Stubbling at this challenge, i googled and found different solutions include the jQuery implementation of this, but none seems to do what i wanted, they either return true or false.
I wanted to know if a value is a number whether it's a typeof string or number. The codes below did the job very well, unlike !isNaN() or $.IsNumeric() which return true in the case of newline or space.
var isNumber = function(v){
    //return typeof v === 'number' && isFinite(v);
    return !isNaN(parseFloat(v)) && isFinite(v);
}
The commented code is the yahoo UI implementation which i tried but didn't give me what i wanted.
Return false if typeof is 'string' while true if typeof is 'number'. But the uncommented code does the job.

Than you for reading. Please post your comment.

Friday, 22 November 2013

How to have a great day everyday

1) write out a basic plan for the day. Evaluate and prioritize the day's activities in the other of their reward in benefits to you.

2) concentrate on those activities that produce quality result, give them your best to produce excellent result.

3) give total attention to the task at hand dont get distracted.

4) be sensitive to the schedules of others, if you shift things it can change everything.

5) remember to appreciate someone today, it will relax you mind and glady your spirit.

6) give the Holy Spirit time of fellowship and consultations.

7) make sure your activities are all focus for the achievement for your greater goals.

A great day is that one day that brings you even closer to your greater goals.

Follow me on twitter: http://www.twitter.com/_josiah_king Join me on Google+: https://www.plus.google.com/u/0/113541005774136102412/posts/p/pub?cfem=1