URL GET vars to PHP Array 

Sometimes you will need to retrieve the GET variables passed into the current page URI or you will have a URL string to work from which contains certain GET variables, the below method helps a lot to convert them into an array which you can easily manipulate later. $url = $_SERVER["REQUEST_URI"]; parse_str(parse_url($url, PHP_URL_QUERY), $array); `$array` [...]

python “AttributeError: ZipFile instance has no attribute ‘__exit__” 

This is actually a very easy error to fix, eventhough off the bat it seems a lot more involved. You probably have syntax something like this: with zipfile.ZipFile(wr_zip) as zipfd:     extract(zipfd, wr_csv, wr_csv) So instead we will change it to this: zipfd = zipfile.ZipFile(wr_zip) extract(zipfd, wr_csv, wr_csv) The reason this fixes it is [...]

Remove specific HTML tags using PHP 

There are times when you want to remove a specific HTML tag from an HTML block of text. This could be an anchor(<a/>>) or an image(<img/>) perhaps. You can use preg_replace to do this quite quickly and efficiently. Remove an anchor: $content = "Sample text <a href=’#’>Our anchor</a>. Etc etc"; $content = preg_replace(‘/<\/?a[^>]*>/’,”,$content); //$content is [...]

Keep Google Map v3 centered when browser is resized 

Using Google Maps V3 Javascript API you can keep the map centered to the browser’s window by using the following trick when resizing the window. var mapOptions = {     zoom: 2,     center: new google.maps.LatLng(0,0), mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); // this is our gem google.maps.event.addDomListener(window, "resize", function() [...]

Buy a Google Nexus 10 in the UK! 

If you are looking to get a Google Nexus 10 inch tablet and are based in the UK you are in for a shocker! The only place to buy it is at the Google Play store and since about the middle of November 2012 they have been sold out. Some people say it’s due to [...]

Let Joomla and MySQL interact! 

I often need a quick and easy few lines to retrieve some data from MySQL using Joomla without all the MVC nonsense that usually goes about this topic. So here is how I do it! $dbSEL = JFactory::getDbo(); $dbSEL->setQuery("SELECT MAX(`start_price`) FROM #__some_table"); $dbSEL->query(); echo $dbSEL->fetchRow(); As you can see above, we get the current database [...]

Perform a Mysql Query using Joomla! 

This is really actually meant for future reference for myself as lately I’ve been doing quite a lot of Joomla! mysql coding and have used the following code just short of 3million times. $db = JFactory::getDbo(); $querySelectId = "SELECT `id` FROM #__some_table WHERE `user_id`=’$user_id‘"; $db->setQuery($querySelectId); $db->query(); $data = $db->loadAssoc(); What we do in the above [...]

Refresh User Data in Joomla 

I was busy with a custom component in Joomla, and it stored it’s own user_details based off of the main users table, but if the details were changed then I needed the system to update the session to reflect the changes. This is what I did: $user = JFactory::getUser(); $session = JFactory::getSession(); $session->set("user", new JUser($user->id)); [...]

Extract email addresses from a string – PHP 

Sometimes you need to extract multiple email addresses from a string and the following function will make all your dreams come true. function extract_emails_from($string){     preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string, $matches);     return $matches[0]; } ..and this is how you use it: $text = "this is some text and here is an email address xxx@example.com, here’s [...]

How to drive traffic to your website! 

This is a very hot topic indeed. Definitely one that everyone with a website should know all about.   To begin our journey we will look directly at the Traffic Generator Sites out there who – to be honest – are complete scams because all they really do is one of two things… 1.) Load [...]

jQuery limit fields to alphanumeric characters only 

I was trying to restrict a form’s field from only allowing the user to enter alphanumeric characters into it. I looked all around and couldn’t find a nice way to do it without a plugin, so I wrote my own bind function that you can attach straight to an element. $("#yourFieldsElementId").bind("keypress", function (event) {   [...]

Make a dynamic year dropdown using PHP 

Ever wanted to have a dropdown that automatically showed the current year and the few years before it? This is a quick and easy way to do exactly that! <select name="year">     <?     for($i=date("Y")-5;$i<=date("Y");$i++) {         $sel = ($i == date(‘Y’)) ? ‘selected’ : ”;         [...]

Latest Sites on SiteInfo

1. bettercall.com
(1 hour ago)
2. biggaloot.com
(1 hour ago)
3. flatcast.cn
(5 hours ago)
4. net4sat.com
(7 hours ago)
5. concentrix-iberia.com
(7 hours ago)
6. meteogalicia.es
(8 hours ago)
7. chebnet.ru
(9 hours ago)
8. vas.dk
(9 hours ago)
9. jxs.cz
(9 hours ago)
10. lianti.net
(9 hours ago)