In cakephp most of us use ACL with Auth component to manage logins and access to various pages. When we need to implement this feature based on User Roles only. Sometimes the ARO checking gives error – that the User not exist for the foreign key. This is because if the role does not have required permission then the ACL tries to find the permission for logged user.
To prevent ARO from checking for user permissions when only role based access is needed, we need to add following lines in the User model. Please replace “Group” and “group_id” with your Model name used to manage the Role and foreign key name in User table for that respectively.
public function bindNode() {
$data = AuthComponent::user();
return array('model' => 'Group', 'foreign_key' => $data['User']['group_id']);
}
This worked for me. It took me many hours to find this somewhere in Google. I am posting here so, you do not have to waste hours for this.
For one of my project I was required to upload files on an FTP server from the PHP script. Searching on Google I found code required but it was not completely available at one place. So I thought to share this here for use by others as tried and tested code, working on a live website.
This script was created for moving the just uploaded file to FTP server. That is why it uses $_FILES["tmp_name"] as local file. You can change to your file location, if it is already uploaded.
Please replace the variables in first four lines according to the settings you have for your target FTP server.
$ftp_server = "ftp.yourserver.com";
$ftp_user_name = "ftpuser";
$ftp_user_pass = "ftppassword";
$remote_dir = "/target/folder/on/ftp/server";
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = @ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
//default values
$file_url = "";
if($login_result) {
//set passive mode enabled
ftp_pasv($conn_id, true);
//check if directory exists and if not then create it
if(!@ftp_chdir($conn_id, $remote_dir)) {
//create diectory
ftp_mkdir($conn_id, $remote_dir);
//change directory
ftp_chdir($conn_id, $remote_dir);
}
$file = $_FILES["file"]["tmp_name"];
$remote_file = $_FILES["file"]["name"];
$ret = ftp_nb_put($conn_id, $remote_file, $file, FTP_BINARY, FTP_AUTORESUME);
while(FTP_MOREDATA == $ret) {
$ret = ftp_nb_continue($conn_id);
}
if($ret == FTP_FINISHED) {
echo "File '" . $remote_file . "' uploaded successfully.";
} else {
echo "Failed uploading file '" . $remote_file . "'.";
}
} else {
echo "Cannot connect to FTP server at " . $ftp_server;
}
Though most of my work involves use of English as primary language, my mother tongue is Hindi. So when I want to write blog posts or some other personal communication with my closed friends, sometimes I feel the need to be able to type in Hindi. Earlier I was using Google Transliterate tool, but that required 2-3 steps for this. First I need to open the web app of Google then type there and then copy and paste it in required location. This also caused some font issues in my office tool LibreOffice.
So I started looking for some onscreen keyboard using which I can directly type in Hindi. While Googling about this, I stumbled upon this tool from Microsoft itself which directly enables me to input text in Hindi using the transliteration. Meaning I need to type in English the word as it is pronounced in Hindi and the tool automatically converts that to Hindi font. And using this I can type in Hindi at any place in Windows Operating system. That was exactly what I needed, and I was surprised how I did not know about this. I never heard or read about this though I have subscribed for almost all technology blogs and news sites.
Anyway – I thought it may be of help to someone reached here – you can download the tool for your language here - http://www.bhashaindia.com/ilit/Hindi.aspx. The link is for Hindi language tool but you can find on the same page input tool for other languages like – Bengali, Gujrati, Kannada, Malyalam, Marathi, Oriya, Punjabi, Tamil and Telugu.
Recently while visiting a website I got infected by Live Security Platinum malware which disabled all security services on my PC. I was able to remove this using the free Malware Bytes Anti spyware tool. But the Windows firewall and McAfee firewall were unable to run due to some bugs made in the windows. As usual I started looking on Google for the solutions posted by others for similar problem. I found many proposed solutions mentioning issue in McAfee and re-installing it after clean removal. But none of them look promising to me.
Then today I landed on Microsoft Fix It Solution center. I came to know that Microsoft has already provided lots of automated tools to check and fix common problems in various windows version. When searched for my problem I landed on this page:
http://support.microsoft.com/kb/968002
You need to download small software pieces and execute them to check and fix your PC. And I am very thankful to them that this solved my problem. Hope this helps you too.
Today I had to work on the Plesk server webmail vacation responder settings, and looking at the Horde webmail option I found that this is not available in the default Horde Install in Plesk 9. Digging through many google search pages and search phrases I found a very useful and working link given below.
Configuring Vacation Responder on Horde Webmail on Plesk 9
Small change in the above guide is that on the Debian System you can install vacation application directly using the “apt-get”. Just execute the following command:
apt-get install vacation
After configuration when you open the vacation page on the webmail then most probably you were greeted by a warning message that the Plesk driver on Horde Vacation responder requires Horde_DOM installed. The repository address given in the warning message is no more working. It took me around an hour to find this file “DOM.php”, on some blog.
You can download it from here.
Unzip the archive and put this file DOM.php at location - /usr/share/psa-horde/lib/Horde/ .
If everything works well then now you can set the Vacation responder from the Webmail interface of the Horde Webmail.
Most of us work with WordPress and while working we use the handy auto update feature in the admin panel to update the WordPress plug-ins and core. On Plesk control panel, sometimes it asks for FTP access details to write the files on the server. This could be quite irritating to input the same FTP details again and again.
One reason that I found causing this permission issue is – PHP running as Apache module. When new Plesk Account is created, PHP can be configured to run as Apache Module or FastCGI. The default is set to Apache Module and most of the time we do not need to change this. But if you are using WordPress on the Plesk control panel then remember to use PHP as FastCGI module to avoid above permissions issue. Now WordPress does not ask you FTP access details every time you want to update the WordPress from Admin panel.
Today, the usage of mobile is increasing day by day and most of the users are preferring mobile device over desktop. Therefore it is almost necessary to check how a web page looks on a mobile device and make adjustments using the mobile specific CSS. But it is not every time possible to have all different mobile devices handy to test. Here comes the mobile device emulators for help.
You can use following FREE web tools to test your web page, without installing any software on your PC. Hence these will work on Windows, MAC or Linux.
1. MobilePhoneEmulator - Here you can select your device and different parameters, including the screen orientation.
2. Opera Mini Simulator - As one of the most favored browser for mobile devices, it is very much possible that most of your users are visiting your website using this fast browser. So it is very useful to check your web page to work correctly in this browser.
3. iPhone Tester - This is only for iPhone browser. Remember to run this page in a Safari browser so that the rendering is same as you see in iPhone.
4. Opera Mobile Emulator - This is a downloadable desktop application, you can use to test your pages on Opera mobile. The download size for windows is approx 13MB.
Let me know in comments if you are using or know some other great tools for this purpose. Happy Coding!!!
After so many months of hype and secret leaks in the technology blogs and websites, Google Drive launched at last few days back. But does this service justified the anticipation it got? Well, NOT for me.
After waiting for few days to get the Drive enabled in my Google Apps Account. Today I finally installed it on my windows 7 machine. But I was surprised to find that it just created local desktop shortcuts in the corresponding folders to files on the Google Documents account on web. The downloaded application just created new file types like “.gsheet”, or “.gdoc” and when you click on files to open them, it opens the corresponding file in your default browser using the Google Docs service.
The Google Drive service is being touted as a document and files synchronizing service. But to me this is not what I expected it to do. Suppose my internet is down or Google docs service is down due to any reason then I can not access the file I need. So where is the sync.
Also I tried adding a local excel workbook file in the Google Drive folder. It is uploaded automatically to the Google Docs. Fine. But then I am not able to edit it, only preview is available on clicking the file name. For editing the file I need to convert this to Google Docs. And then again this would not be synced to my local desktop.
I am not going to use it in its current format. Unless they change it to actually sync the files and allow editing the local files on web.
On the other hand Microsoft Skydrive provides all the missing features described above with whopping 25GB free space for old users. The files are synced physically i.e. you can access them on the web and on your local desktop also. And MS office format files are editable on web using Office 365 free service.
I had a old Sony Ericsson phone working great for me since long. Recently I upgraded my PC with new Windows 7 professional. I usually does not need to connect my PC with phone as I use the phone primarily for calling and texting only. But recently I bought a new Android mobile and wanted to transfer my contacts in the old Sony K750i to the new phone. And to my surprise when I tried installing the Sony Ericsson PC suite, that refused to install on Windows7, as it works only on Windows XP.
Then the first thought came to my mind that I should get latest Sony PC Suite software, that should work with Windows 7. I downloaded the Sony Ericsson PC Suite 6.x from cnet.com and installed it successfully. After installation it automatically upgraded itself to Sony PC Companion.
Then came another surprise – when I tried to connect my phone using this software – it failed to recognize the phone. Does Sony stopped support to K750 phones? And what would I do with my working phone?
Now there are two choices for me either I should look for another windows XP system, install the PC suite there and get the data synchronized. OR get another third party tool which can help me connect my phone with my PC.
After Googling about this I found a nice piece of software named “MyPhoneExplorer”. It is a small software of just 4.7 MB in size, installed like a breeze. Although it asks for some supported adware software installation, which you should take care to deselect when installing this. OR you can remove them separately after installation finishes; through Control panel “Programs and Features” section.
It connected to my phone quite easily and voila all data like – Phonebook (including SIM contacts and phone contacts in two separate lists), Messages, Calendar, Notes all synchronized in one go, in just few seconds.
I found this quite useful, if you know of any other better software then please do share in comments. So that anyone facing the issue like me get the benefit.
While browsing thorough my emails today morning. I found a link to wordpress plugins for blog administrators. This is a well categorized list and have plugins listed for User interface improvement, security, collaboration, editing support etc.
Let me know if you like it or not. Or which plugins do you use on every wordpress site created by you?
Search the site
Popular posts
- Updating Nokia E72 phone software
- Working with Access-Control-Allow-Origin
- Connecting Sony K750 with Windows 7
- Uploading files to FTP server from PHP Script
- MySql Dump Using a PHP Script
- Javascript code to convert date to timestamp
- Displaying UTF characters in the FPDF
- Using AjaxHelper for pagination in CakePHP 1.3
- Setting include path for a domain in Plesk
- Installing Skype on Fedora 14
Random Testimonial
- ~ The Virtual Mentors team
"Thank you Rajendra. It is always a pleasure to work with you, and your high level of service is very much"
- Read more testimonials »
What's the little bird saying?
- New post: Fix Error 0×80070424 on windows http://t.co/bmK0AZpH 287 days ago
- New post: Configuring Horder Vacation Responder in Plesk 9 http://t.co/gcsPNIVv 311 days ago
- New post: Wordpress update issue on Plesk http://t.co/dUxcjpgR 316 days ago
- I’ve just taken the WordPress 2012 User and Developer Survey, have you? http://t.co/G20SmrMr (pass it on!) 343 days ago
- New post: Mobile device emulators to test web page display http://t.co/jmgc0x99 352 days ago

June 13, 2013 in