Somedays back I noticed that when I type something into my browser it takes me to a different search engine called "searchguide.level3.com" which I don’t remember installing or set in the browser. I looked into my browser settings for anything suspicious but didn’t find any. Now, how to get rid of the “searchguide.level3.com” hack ?
After searching and reading some forum posts, I finally found the cause and fixed it.
It happens because of faulty, free DNS servers. In my case, I was using Level3’s DNS servers (188.8.131.52 through 184.108.40.206) and it was hijacking the traffic. When something messy is entered directly into the URL of the browser, it redirects to Level3’s searching site.
To fix the problem, simply search for a good DNS server and use that instead. Same thing will happen with most free DNS servers, however, I am OK with Google’s free DNS server.
Two of the best DNS servers that can be used instead.
In latest versions of Mac OS X, by default the postfix is set to send emails from your local machine to outside world. This might cause you troubles if you are developing applications on your local machine and your application has email sending functionality to customers. Unfortunately if you have some customers’ email addresses in the database or in your code in the local setup, then test emails get delivered to them which is embarrassing. This happens even if you have not setup/integrated any 3rd party smtp services in your application.
To avoid this kind of situation, you can stop outgoing emails being sent through postfix from your local machine. Simply put the line below into the /private/etc/postfix/main.cf file in your Mac OS X.
default_transport = error:No outside emails.
The variable default_transport specifies which transport is used to deliver non-local mail (default is smtp). With this setting, any outgoing mail will bounce back with the error specified.
Well there you can find a lot of Job Sites, But why Linkedin is different ? Because It is Social.
In WordPress, creating a job board is much cheaper and easier to get up and running. Here is one of the most popular plugin “WP Job Manager“. But It lacks social features. Well in WordPress there is another popular plugin called “BuddyPress“. It is used creating Social Networking Sites. If We are connecting both plugin then we are done.
How to Connect!! Thank god there is a plugin in WordPress for It. It is BuddyPress Job Manager. It’s free too 🙂
It is very simple to use. It follows normal installation.
This very simple like other wordpress plugin:
1. Upload the plugin to the /wp-content/plugins/ directory 2. Activate the plugin through the Plugins menu in WordPress
There are situations when you have to use some values stored in DB or values being calculated in PHP script based upon different conditions in the java-script and css code. This can be achieved by writing the inline js/css code directly inside the php script. But in WordPress, this can be done very easily with help of functions built for that which is kind of more neat and clear way of doing the same.
Pass dynamic values from PHP to JS in WordPress:
wp_localize_script( $handle, $name, $data ) : Makes any dynamic data available to your java-script that is available in the server side of WordPress.
Solution: I get into the “pear” directory and checked config values set for different pear related directories. All were set to C:\ drive by default. So, we need to change those settings to correct path.
The other day, I had some problem setting up latest WordPress coding standard for PHP CodeSniffer on a Windows machine. It was throwing some errors/warnings like the below. There were some others, but eventually we had fixed some of those. However the WP coding standards were not getting listed in phpcs. 🙁
Warning:file_put_contents(C:\php\pear\data/PHP_CodeSniffer/CodeSniffer.conf):failed toopen stream:No such file ordirectory inC:\xampp\php\pear\PHP\CodeSniffer.php on line2166
Here are the steps to fix the problems and setup PHP CodeSniffer along with WordPress Coding Standards namely WordPress, WordPress-Core, WordPress-Extra and WordPress-VIP. FYI, I am on a Windows 7 box with XAMPP setup for Apache, MySql & PHP.
Install PHP CodeSniffer on Windows through PEAR installer: Uninstall the old CodeSniffer(if any):
As, all of the individual standards of WordPress namely WordPress, WordPress-Core, WordPress-Extra and WordPress-VIP are in one directory, for phpcs to be able to detect the standards we need to add the path to phpcs’s installed_paths.
Recently, I have been asked to help install and setup XDebug along with Webgrind in a Mac OS X system using SSH on one of my colleague’s system. All of this setup were done remotely from another system. Here are the steps/commands for achieving the same.
Steps for installing Xdebug:
Get the information about installed PHP on the system. This is needed to get the custom installation instructions from xdebug website here: http://xdebug.org/wizard.php
Compile and build the php extension from the source. Install the same.
Enable Xdebug in the php.ini file.
Find the complete path of the xdebug.so file prior to editing the php.ini file. The path looks something like this: /usr/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so Can be located using the command:
Edit the php.ini file and add the following lines to the extreme end.
For last few days, I have been working on a WordPress project where I am creating a set of APIs to be consumed by mobile apps. While writing these REST APIs I have tried to make the things work faster. While checking the REQUEST/RESPONSE time, I found that the WordPress initialization is taking much time then the API method processing. I looked into the time taken for the whole flow through xDebug Profiler and discovered that there are lots of plugins which are not needed for the API processing and are consuming most part of the loading and API response timing. Plugins like Backup WordPress, Contact Form 7, Simple Responsive Slider, Google Site-map, FancyBox, WordPress SEO etc. are required for the website front-end and don’t really play any role in the APIs.
Now, my intention was to selectively disable the plugins specifically for the API requests coming to the server. How to do that on WordPress ? Before jumping to the solution, below are some backgrounds:
Basic flow of WordPress init for loading the plugins.
WordPress loads it’s core environment –> Must Use plugins are loaded –> if you’re on multisite setup – Network activated plugins are loaded –> Registers a few initial post types –> Sets up the theme directory –> finally loads the currently active plugins.
wp_get_active_and_valid_plugins() is the function which fetches all the active plugins and load them. This function gets these active plugins from the database where the list of active plugins are stored as an array in the wpdb_options table with option name as “active_plugins”. So, we can use the filter hook “option_active_plugins” to do modification to the list active plugins for temporary period.
Code for selectively disable plugins on WordPress for a specific request. This must be made a MU (Must Use) plugin to load and remove the plugins which are to be removed while initializing the WP.
Plugin Name: API Load Time Enhancement
Plugin URI: http://subharanjan.com/
Description: Disables plugins for API requests in order to speed up the API response times.
Questions those come into mind when someone switches from Windows to Mac OS X for web development and wants to compare files:
Which editor has support for file diff or file compare functionalities on Mac OS X ?
Which is the best tool for file comparison while developing on Mac OS X ?
How to use FileDiff package on Sublime Text editor ?
How to use File Compare functionality in Text Wrangler in mac OS X ?
Answer/Solutions: After developing 4 complete years on Windows, I have recently moved into a MacBook Air. During development, one thing I was missing was the “File Compare” plug-in on Notepad++ which I was using for a long time while on Windows. Even though NotePad++ doesn’t have a Mac version, there are some alternatives to that on Mac OS X. Two editors which I find very useful are Text Wrangler and Sublime Text 3.
File Compare on Text Wrangler:
Open both the files on the TextWrangler editor. Did I mention, this is a free editor and best for editing text based files.
Now select both the files in “Opened Documents” sidebar. [ ⌘ + Click ]
Right click on the selected files and click on “Compare”.
The other day, I was searching for some ways to compare two files(one from production and another from the local development of the same file) in Sublime Text. I found that there is no default tool to compare two files, thats why I installed “FileDiffs“, a package which provides the above needed functionality. What this tool does is: it provides you a result file which contains unified differences from both the compared files with + (Plus) & – (Minus) symbols. Even though it serves the purpose, but for someone who has been using compare tools like WinMerge, or the color-full GUI in Notepad++ editor on Windows, the experience will be horrible.
However a cool feature of this “FileDiffs” package is that, it can integrate with any external diff. tools through command line. So, I installed “DiffMerge“, an free application to visually compare and merge files. Below is the set of settings that integrates “DiffMerge” with “FileDiffs” on “Sublime Text 3”.
// You can set a command like this
// "cmd": ["command", "$file1", "$file2"]
// You can also include other command line parameters like this