Technical Blog

Zyxware default image2
| 1 min read
This is how you would normally render a view display passing filter inputs via code: $view = views_get_view('view-name'); $view->set_display('display-name'); $view->is_cacheable = FALSE; $filter_1 = $view->get_item('display-name', 'filter', 'filter_1_id'); $filter_2 = $view->get_item('display-name', 'filter', 'filter_2_id'); $filter_1['value'] = "value1"; $filter_2['value'] = "value2"; $view->set_item('display-name', 'filter', 'filter_1_id', $filter_1); $view->set_item('display-name', 'filter', 'filter_2_id', $filter_2); dpm($view->render());
Zyxware default image4
| 3 min read
One of the Drupal sites we maintain had recently started slowing down considerably in spite of the site mostly being static and in spite of boost set up on the server. On examination of the site we found that two things were happening on the site. One was that the site was being crawled indiscriminately by rogue crawlers. This we solved using the DDOS deflate script and setting DDOS deflate to run every 10 seconds. The second problem was that there were some bots which were continuously sending POST requests to /comment/cid/reply pages. For this we had to come up with a workaround.
Zyxware default image4
| 2 min read
In Drupal every path in the site goes via index.php and goes through some Drupal menu. However to make the Drupal application behave live a typical static website in terms of URL architecture sometimes clients request for adding slashes to the end of virtual direcotry paths. At the same time slashes would not look good at the end of virtual file paths. There is an easy way to do this using apache htaccess rules
Zyxware default image2
| 3 min read
Blocks are regions on a Drupal website that show small but significant pieces of content. Blocks are an important component from the perspective of a Drupal website. Blocks are usually assigned to regions in a page and they are supposed to be printed on a page. However there are many instances where you might want to print a block within a content. It is not directly possible to assign a block to a region within content (node in Drupal speak) as you can do with a page. But as with everything in Drupal there is a way to do that.
Zyxware default image2
| 3 min read
Sometimes we get requests to update Drupal sites and get it done in less than 5 hours. If we take the Drupal update through the full fail-safe set of steps for Drupal updates we will never be able to complete updates in less than 5 hours on a site we don't maintain. For such sites when the cost of the site going down may not be too high for the site owner it might not be too big an issue if the update is run on a hit or miss approach. We normally do not recommend such an approach but this should work on most small sites without any issues.
Zyxware default image2
| 3 min read
Keeping the Drupal core and contributed modules up-to-date (at least on the security updates) is one of the essential steps for keeping a Drupal site safe and secure. Running updates of Drupal modules is usually a straightforward mechanism on a Drupal site that is done right. However what will you do if you do not know how things have been built? What will you do if some of the custom modules used are tied down to specific versions of some contributed module? What if there were custom changes on the site. Here is how you can run updates on a Drupal site almost completely safely.
Zyxware default image3
| 3 min read
If you run a reasonably popular site there is a very good chance that you will get crawled by unscrupulous crawlers once in a while. The regular search crawlers from the popular search engines like the Google bot, Yahoo bot, Bing bot themselves are pretty intensive when they crawl sites but they do have limits on the number of pages crawled per visit and the number of simultaneous connections opened to your server. However there are lots of unscrupulous crawlers like spam bots, email harvesting bots and even some search engines who do not set any reasonable limits on the number of simultaneous connections to your server. There are hardware solutions that are available to prevent this but they may not be affordable for everybody. There is however a simple netstat based solution to prevent DDOS.
Zyxware default image2
| 2 min read
One of our clients sent us images they want to put in the website as pdf files. There were 100 files each containing a single image. Opening each of these in gimp and then saving it as pngs was a nightmare. For all such situations, ImageMagick is there for your rescue. With mogrify - a command utility available in the ImageMagick package, bulk converting all these pdf files to png was child's play.
Zyxware default image2
| 2 min read
On one of the maintenance projects we got we came across a page that used to take around 11 seconds to load. The page was a views listing for users. We were able to speed up the page load times from around 11 seconds to under 3 seconds by taking out just the distinct option used in the view. The following was the select query that was originally generated from the view with the time logged by views in the preview panel.
Zyxware default image2
| 4 min read
In every operating system, there are a lot of tasks that need to be scheduled to run at a particular time - some, very often (as in, every 5 minutes), and some, less (like, once every month). For a quick example, you might want to run a temporary files deletion operation at midnight each day - this is where you need to write a cron job.Crontab and Cron jobs are Linux’s version of a complete job scheduling system.Let us see these in detail.
Zyxware default image4
| 3 min read
Boost is a module in Drupal that enables file based static page caching in Drupal. When an anonymous user visits a page for the first time in a Boost-enabled Drupal site, the page will get stored as a static html file in a cache folder. When the next anonymous user visits the same page the htaccess rules created by Boost will serve the static file cached in the cache folder instead of bootstrapping drupal for generating the page. This saves a lot of processor usage and would help even entry level hosting servers serve reasonably good volume of traffic. Here is how you can install and configure Boost in a Drupal 6 site.
Zyxware default image4
| 1 min read
We recently saw this error on a Drupal 6 site that had not been updated for quite a while."warning: call_user_func_array() expects parameter 2 to be array, string given in sites/all/modules/contrib/views/views.module" means what it says. call_user_func_array expects the second parameter to be an array whereas a string was given instead. You can troubleshoot problems like this by writing a bit of debug code before the line where the error is reported.
Zyxware default image3
| 3 min read
As the world of internet grows day to day, the more educated and ever-wanting userbase now needs more data asynchronously. They don’t like to wait or load another page to see their data. In such situations we developers need to use more and more AJAX (Asynchronous JavaScript and XML - http://en.wikipedia.org/wiki/Ajax_(programming)) in the development of websites. Using AJAX in your web-development workflow is not that much difficult as you think. There is already a wide range of famous ajax libraries that make handling asynchronous requests easy for us.
Zyxware default image2
| 2 min read
Drupal’s Nice Menus Module provides a highly customizable and nice-looking dropdown menu for Drupal websites. To allow maximum customizability, it includes a CSS file and a javascript file where you can try out your own recipes. The following steps should help you make nice looking drop down menus for your Drupal website using the Nice Menus module:
Zyxware default image1
| 2 min read
Have you ever wondered how that cool site you saw last day had those cool interfaces and you wished your Drupal site could have the same coolness? jQueryUI is your saviour here. jQueryUI is one of the most popular JavaScript libraries out there in the world of web development. jQueryUI allows you to add very cool user interface elements to your website without much effort.
Zyxware default image1
| 2 min read
Solution for CKEditor not working in a Drupal 6 site. One day, all of a sudden we found out that the CKEditor was not working on our Drupal 6 site. It had literally disappeared from our website taking the whole text area on the edit page with it. This meant that we could not create any articles as long as the CKEditor was not working. On seeing this, the first thoughts that flashed through our head was to either update the module or apply a patch believing that the CKEditor module had crashed. However our fears were unfounded and the solution turned out to be more simple than we expected.
Zyxware default image1
| 3 min read
Developing a Drupal website is a complicated and long process. You have to check whether all the design and functionalities meet with the client specifications. And before the site going to be live you have to check certain criteria.These checklists describes the criteria that should be tested before a site going to be live.
Zyxware default image1
| 2 min read
Sometimes we may require updating several rows of data with different queries and make sure every query execute correctly to keep the database consistency. Here is a simple solution to enable such transactions with Mysql and Python. To do this, we can start a transaction and commit the changes to the table. The data will be written to the table only after the commit statement is executed. If there is an error in between, we can rollback, so that all the inconsistencies are cleared.