Monthly Archives: March 2014

There is no operating system installed in this virtual machine Parallels

Problem: You are trying to load Windows in Parallels (Virtual Machine) and it is not loading either because you partitioned your hard drive or you downgraded/upgraded to different version of OS.

Cause: The problem is probably the boot record has been altered. Windows will not load either from loading directly pressing the ALT option or in Parallels.

Resolution: The easiest solution is, load a Windows 7 CD. It will start installation process. Go to where it says repair disk. Select the first option that says “Fix issues with the operating System”. Let it do its job. At the end of the its operation it may show a dialog, “OS X did not allow the boot record to be changed”. Click ok. Then it will say something like “The boot record in Virtual Machine was changed but it was not written to hard drive”. This will basically fix loading of Windows in Parallels.

The server response was: x is currently not permitted to relaythrough this server.

You got this error on Mac OX X (Mavericks in my case) when send email. You have configured your smtp mail server (smpt.yourdomain.com) and the check shows that it is connecting fine without password. The problem here is you need to enable password authentication which be default may be disabled.

Go to your SMTP Server Lists (double tab on concerned account, click edit “account”, click “Outgoing Mail Server(SMPT)” drop box and select Edit SMTP Server List”). select your server and choose password in authentication. Supply your username as follows

Screenshot 2014-03-30 12.35.16

Screenshot 2014-03-30 12.34.53

Screenshot 2014-03-30 12.34.30
username: your_email_id@your_domain.com
password: [your password]

That should fix it for you.

mysql transaction rollback on error

I tried to create a transaction inside stored Procedure in MYSQL that will roll back if it did not insert a row (basically an error occurred) but I could not find anything. Below is a working example that rolls back the first insert operation if there is an error in the second Query. Note that the order of various declaration is important, esp DECLARE Exist .. should be declared right before start Transaction.

DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `InsertUser`(IN `name` VARCHAR(20), IN `email` VARCHAR(30), IN `password` VARCHAR(30))
BEGIN 

DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK;

START transaction;

INSERT INTO USER( username, email, 
PASSWORD ) 
VALUES (
name,  email,  '1234'
);

SET @last_id = LAST_INSERT_ID();

INSERT INTO Week(user_id,company_id,year) VALUES(@last_id,1,1);
select Row_Count();

COMMIT;

END;;
DELIMITER ;

By default this stored procedure does not return any result (which may be needed in program eg. PHP). I have used ROW_COUNT() function that returns if a row was insert in the last SQL command. If it returns 1 that means successful transaction, if 0 or empty that means some kind of error.

MySQL said: Can’t connect to MySQL server on ‘127.0.0.1’ (61) Sequel Pro

Screenshot 2014-03-28 22.29.56
I was getting this error when connecting to MySQL Database after I changed password for `root` user. The error was

MySQL said: Can't connect to MySQL server on '127.0.0.1' (61)

This took my quite some time to resolve. The problem in my case started when I changed the root password. Sequel Pro gave me error first so I thought it is easy, just use the new password. But that did not work. Note that only Sequel Pro was broke, My PHPMYADMIN was working fine without any trouble. What really worked for me to fix Sequel Pro connectivity, I changed two things

* Change 127.0.0.1 to localhost in connection string
* Used the old password (not the new one that I  just changed)

Trouble Shoot Connection from Command Prompt

Other things you can do is, try to connect to MYSQL from command prompt in Terminal (I am on mac OS X Mavericks).

/Applications/xampp/xamppfiles/bin/mysql -u root -p 
# this will prompt for password

Once this connects using the correct password, you already know what is the password. Then change 127.0.0.1 to localhost (all lower case). That should probably solve it.

The following screenshot setting should connect.

Sequel Pro Connection Setting

Note that the following setting used to work but after I changed the password, it no longer works.

Sequel Pro connection String IP

When you provide localhost, it will popup this dialog. Just select “Connect Via Socket”.

connection failed sequel pro

connection failed sequel pro

I was getting these errors while I was working on it

Password provided on command prompt was wrong.

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

and

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

How to execute commands on Mac

On Windows running a command from command prompt is straightforward. Will simply type the name of the exe file. For example command.exe (this will run the command/program).

On Mac, when the file is sitting in the current folder, the file will not run if you just provide the file name. You have to specify the complete path of the file in order to run it. Not sure why is this (may be safety?). If the file is in the current folder/directory, there is an easy trick. Simply provide the dot operator (.) followed by forward slash.

Example: cd /Applications/XAMPP/xamppfiles/bin
See what is the directory: Issue ‘ls’ command (without comma’s)
Notice there is : mysql command, to run this type

./mysql

Peshawar Doctors Reviews

Let us know how your experience is with Doctors in Peshawar. I will right some of mine.

Dr. Miqdad Ali, Cardiologist, RMI Hayatabad

I had a very good experience with Dr. Miqdad Ali (Cardiologist) of RMI, Hayatabad. I took my mother some 3 years ago who had slight tired breathing problem as she had minor heart attack in the past. I explained the situation to Dr. Miqdad. He was very quick in writing prescription but I insisted he list more (Please always explain your real problem that the doctor may not know). After expelling it in more detail, he said the pill that my mother was taking was the right medicine but now my mom has reacted to it and it has bad effect on her. He changed the bills. My mother had no problem ever since.

I would highly recommend this doctor with advice that please explain your case fully. Do not just get a quick prescription. Wish you all the best.

Reviews of AutoShops in Peshawar

Review of Akbar Auto Workshop, Peshawar Board, Peshawar

I had  a bad experience at Akbar Auto Workshop near Peshawar Board in Peshawar. They are expensive, not professional and misguides you in their work. They will lie just so they do not have to work to fix the problem.

My car needed a couple of loose bolts tightened underneath. I came from Hayatabad hoping that they will get all the parts if the car needs any, saving my money and trouble as they are right on the main road. Another mechanics had quoted me 500 Rs but I just wanted to get the job done by a better mechanic.

The mechanic test drove the car and told me it may cost around this much. I told him, the car does make *a little* sound when turning left. He said, he’d recommend “Gutka” which is the source of the problem. I reluctantly agreed as the car was doing pretty much fine. He young boys (some were children) started work on my car, dismantling the parts. The mechanic could not get the “Gutka” outside of its axils so he said his little boy to another shop to get it done. I also went with him to get the parts. We went their by taxi, bought the part, went to this other job who put the “Gutka” in the axil. He asked for 150 Rs which I paid from my pocket. Came  back to the shop where the put it back. At the end of the day, I asked how much, he said 1500 Rs. I was surprised as he put me through so much trouble as I had to go *myself* to get the parts and 1500 were a lot for this job. I test drove the car with the mechanic and the mechanic noticed immediately, the car was still making sound. It actually gotten worse. The mechanic said, most of these parts are made in china are not not good quality. He asked did I get warranty? I said no, I just got the part. Before he told me this part comes with 6 month in warranty but he was not interested in getting it fixed and goring through the trouble again.

Anyways I end up paying $1800 Rs for parts and 1200 Rs for labour. As I drove the car, I noticed the car brakes had gotten very loose. I was too tired to come back the same day so I came back the next day and complained about the brakes. It was  a simple job to fix it but Mr. Mechanic insisted the brakes were totally fine. I had argued with him that I almost skipped an accident because of loose brake. He called head mechanic. Wen went test drive again. He *also* said, the brakes are totally fine and said if it were he would fix it as he had no work at the time. But I insisted this needs to be fixed. Finally they took air from the brake fluid pipes which pretty much fixed the brake problem. But that was after a lot of argument.

I would not recommend this mechanic. They are basically totally rip off. Open the car and put it back. There were other things wrong with my car like a loose accelerator wire which the head mechanic spotted. The junior mechanic never bothered to complain about it. Also I need work with my mirror. They could have advised me to get it fixed by electrician as it was fixable, instead  they asked me to buy a new one and he could put it for me. Which was really unscrewing and screw it back. Unfotunately I did get a new mirror but they did not fit and I had to take it back. In short I did all the work for them, bought the parts, the put it back, it did not work. They charge me a lot of money for nothing. My car is actually in bad shape right now as before as not it has big axle noise because of changed “Gutka”.