Me and My Moto X Pure Edition

Moto X Pure Edition

It’s finally here, For the past 24 hour I was busy all playing with it. Finally my Moto X arrived. Although I was supposed to receive it today, I could not resist waiting and I went to the Local courier Skynet and pick it up myself. All I can say, it’s awesome and I’m not regret at all.

This is not my first Motorola phone. for the past 2 years I was using a Moto G for daily and to be honest that was one of the best phones I have ever owned. Although when I bought it Motorola was still belong to Google and wasn’t sold to Lenovo yet and the news made me kind of sad in the beginning, but checking out other Motorola phones made me believe that they still rock, even though their name is now apended with  ‘a Company By Lenovo’.

I am thankful to techbug guys who made it possible for me to own this phone. I have been looking to buy this phone in Malaysia for the past few months. I do not think I would be able to get my hands to it any soon if it wasn’t because of them. make sure you check them out if you are in Malaysia too and you want this phone badly.

Everything seems well with it, as I expected. First thing after the initial setup was upgrade to Android M. I got the OTA right away and I can say it’s perfect.

I’ll be writing more about it soon. I’m still exploring this beast.


Laravel 5 Select Random Row

To select a random row from MySQL using php is not a real hard process. you always can use the rand() function within your queries. but if you are using Laravel and Eloquent Model to work with your database you really should check the random() method out.

Doing a select with your model and using random(1) function will give you a random row from your entire data.  I really think that you should be using this method if you are trying to achieve a random select.


Please note it only works if you are using Eloquent, in case you are using DB class don’t have this method there.

Incoming search terms:

  • SelectrandomrowfrommysqlinLaravel5|MahdiHazaveh
  • 0Q6T
  • how get random row in all() in laravel 5 4
  • https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1830 xZ4CMFWzeo9aMc3gUZqgtLXtrNhkphmIvs5n3GNwTnFtas0fPpx-YeC-EaFzdKgG 74230feaa2411b9d10fcc07293c23e2f563fd40c&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme
  • https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1835 xyE51bANKrTXJrXL0blkVfUukjSmn-3y-MoEi8bexXRv7gSuqcI4qZd80dFwG-3B 3658720c8a694fb4e5f64e4d2841269021ac6261&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme
  • laravel pick random row#spf=1
  • pick random row from query laravel

Fix: Laravel scheduled tasks exception

So I just added a little scheduled tasks to one of my applications which was hosted on a shared environment and I realized that the task was not being executed at all.

running the php command from the shell was working and it was not giving me any clue on what the problem could be.

So as the solution I removed the forwarding to dev/null from the ending of my cron task command, after looking at the output I realized that the following exception was causing the Laravel scheduled tasks not to work.

Continue reading Fix: Laravel scheduled tasks exception

Incoming search terms:

  • laravel schedule mutex cleanup fix

Clicking on a Link using jQuery

Well to me it’s easier to do it with JavaScript but today one of my friends was trying to click on a link on his page using jQuery and he came to me complaining that the click() function is not working.

The problem with his code was that when he was selecting his a with jQuery the result that comes out is an array so you need to specify which item of the array to process. well selecting a single item will always result an array with 1 key and a value which means using [0] is the solution.

Below is the sample code of clicking on a link using jQuery:

in the code above after selecting the element with id “link” you need to make sure to tell jquery that which one of the items of the selected array you wish to click or process.

Please note in my code I also used function one() which means to do this job only once.

Upgrade Magento to 1.9.2.x

Upgrading magento should be quite straight forward, but when it comes to big websites with monstrous databases its kinda tricky.

Anyway, there are few ways to upgrade a magento instance, for example you can download the new package, upload it and override your files and that should do the database upgrade once you open the website for the first time, but I don’t like that.

Another good thing is Magento Connect, Yep. the downloader rocks but I still do not feel good about running long php scripts over http session. specially if you have a big site with lots of extensions and etc.

Last and the best in my opinion is using mage script. its in home directory of your magento installation.

To upgrade lets do below:

1. Lets clean up the database logs. that will ease the upgrade. you can do it by truncating the logs tables. or you can use the log.php script within the shell folder. although thats slow, but since I do that frequently my logs shouldnt be more than few hundred megabytes. so:

it may take some time depending on the logs size.

2. then login to the site and disable all caches. I don’t want them to come along as a bump. also clear all caches.

3. now that we are done with the admin panel we can make a maintenance.flag file in the root directory to put the site in maintenance mode.

4. Lets disable magento compiler too.

5.  Run following commands:

6. remove the maintenance.flag.

7. re-enable the cache and compiler and you should be good to go.


Incoming search terms:

  • https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1822 TWVU3fkCdS1hhFWtr9SqkNfmruAIb4CjT7c2T7zOeVw_-5lQ19ad4Q0VCDwUzMgu 8c84f20cd9b9c1228678630e1321c9bf92d353fd&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme
  • https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1885 H4q1JfsPjKYAIJKc3kCnZn8noCIkEfwddE8HCLyd9nTycn1ppd6-PynRzQXdofK3 3aeb40c3e7da2db5d07f5763f47a922636ec05cc&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme