Posts

How to get most recent date from an array of dates?

$all_dates = array( "15-03-2015-14:50", "16-03-2013-14:50", "15-08-2017-14:52", "15-03-2014-14:50", "20-03-2016-14:50", ); // foreach($all_dates as $date_one){ $date_one_to_string = strtotime($date_one); $all_date_strings[$date_one] = $date_one_to_string; } arsort($all_date_strings); $latest_date_strings = current($all_date_strings); $key = array_search($latest_date_strings, $all_dates); print 'Latest Date Is :'.$latest_date_strings;

Install urdu fonts in Linux (Ubuntu)

1- NafeesWeb.ttf (For urdupoint.com etc) Go to  http://www.crulp.org/software/localization/Fonts/nafeesWebNaskh.html Download the file with title ‘ Font with MS VOLT project source ‘. Unzip it. 2- asunaskh.ttf (For bbcurdu.com etc) Download from http://www.quran.or.kr/urdu/font/asunaskh.ttf 1- Go to your home directory like /home/[name]. You can use nautilus for this. Click on Places -> Computer and then navigate to your home directory . 2- Now click on ‘ View ‘ in the menu and click ‘ Show hidden files ‘. Or you can use Ctrl+h . 3- Search for folder .fonts . Just create it if it is not there, right click and create a directory with name without quotes ‘ .fonts ‘. 4- Now copy the fonts from the downloaded directory and paste it in .fonts directory. 5- Open terminal and type sudo fc-cache -vf Enter your password if asked 6- Thats it, restart the browsers and check the websites.

Installing Gnome 3 on Ubuntu 12.04

Image
Installing Gnome 3 on Ubuntu 12.04 is very easy. Just copy-paste the following lines for the latest release from the Gnome team into a terminal. sudo add-apt-repository ppa:gnome3-team/gnome3 sudo apt-get update sudo apt-get install gnome-shell Now reboot your computer and when you see your login screen you have the following additional options (click on the little Ubuntu icon next to your login name).

Installing Drupal 7 using Drush

Drush is raealy handy to do the Drupal stuff ver quick and easy. If you haven't already installed Drush check http://drupal.org/project/drush. Installing Drupal 7 with DRUSH is awsome, with just two simple commands, setting up MYSQL user and DB, note down the passwoprd, then run the following comman. Make sure to replace the user and passwords names for your local setup: drush dl drupal-7.x drush site-install standard --account-name=admin --account-pass=admin --db-url=mysql://MySQLUser:Password@localhost/MySQLDatabase ...and you're done. *Note: The Drupal username and password seemed to always end up as admin/admin. So, just using those and then changing them after you login to your new site.

Override Default Blog View

Image
Drupal by default creates a blog view for evry use at sitename.com/blogs/user-name. To override this view with your custom one, create a page view of content type Blog Entry, with path as "blogs/%". Add "Content: Author" in Relationship. As you can see in below screen shot. Now you need to filter it by the author of content. In contextual filter use "(Author) user: Uid" with selection of "Specify Validation Criteria", Choose user as "Validator". See attached screen shot for this. And there you go. Now what ever url you set in path auto, it will get that automatically.

Resetting Drupal Passwords in Drupal 7 with Drush

Sometimes, whether in testing or other situations, you need to reset a password (often the admin password) for a Drupal site. The shortest answer is that two wonderful options are built into drush! # Get an admin login link drush uli # Set the password for any user drush upwd admin --password="newpassword"

How to Reset Root Password in Drupal 7 with phpMyAdmin

Image
Copy the hash.. $S$C6x2r.aW5Nkg7st6/u.IKWjTerHXscjPtu4spwhCVZlP89UKcbb/ (that’s the hash for newPassword ).   Navigate to your phpMyAdmin (likely in your control panel online somewhere). Then browse the User table for the Root user, look like his. Take the copied hashed text and paste it into the pass field of the Root user and hit “Go”. See this If you want to reset Drupal pasword using Drush .