problem about blocks-Collection of common programming errors


  • Mudasir Abi
    views blocks
    I have SQL Query and I want to execute it in Drupal. My SQL Query is like this. select cat.tid as cat_tid, cat.name as cat_name, cat_parent.parent as cat_parent_tid, count(deals.nid) as no_of_deals from taxonomy_term_data as catleft outer join taxonomy_term_hierarchy as cat_parent on cat_parent.tid=cat.tidleft outer join field_revision_field_categories as store_categories on store_categories.field_categories_tid=cat.tidleft outer join field_revision_field_store as deal_stores on field_store_n

  • Mark Daly
    7 blocks links
    In one of our Drupal sites (core 7.14) links in two blocks displayed on the front page recently started using one of the alternate domains defined in the Apache config for the site instead of the primary domain. Neither block was changed recently. There are other blocks on the front page, and throughout the site, that were not affected.The links in the block were of the style href=”node/123″ (without a leading slash). After investigating any modules or settings that seemed related to blocks or l

  • John
    7 nodes taxonomy blocks
    I’m in drupal 7. Let’s say I have a block on a website page. The website page is a node that has taxonomy terms. How do I programatically get the taxonomy terms of the website page node from my block?

  • Tallkotten
    c++ sdl codeblocks blocks
    l SDL_BlitSurface(tileSheets.at(sheet), &clip[tile], screen, &tileBox);Works just fine and i initiliaze the clips like this:clip[ 0 ].x = x; clip[ 0 ].y = y; clip[ 0 ].w = 48; clip[ 0 ].h = 48; x += 48; clip[ 1 ].x = x; clip[ 1 ].y = y; clip[ 1 ].w = 48; clip[ 1 ].h = 48;This however doesnt work at allSDL_BlitSurface(tileSheets.at(sheet), &clip.at(tile), screen, &tileBox);I initilize them like this: for(int i = 0; i < number; i++){SDL_Rect clipBox = {x,y,48,48};clip.push_ba

  • George
    7 blocks
    I have a block module that displays some data taken from XML. That module has multiple (approx. 7) blocks, each of which displays a different “view” of the same XML. Each block can be positioned independently on the page, but all of the blocks are displayed at once and all of the blocks use the same data.Since the XML parsing code runs inside the block_view() hook, it runs once for every block.My problem is that the XML parsing is expensive in terms of time (not hugely so, but easily >95% of th

  • emenegro
    ios automatic-ref-counting blocks
    I’m wrapping an UIAlertView inside a regular NSObject to allow completion handler blocks instead of the delegate pattern.The problem is that I allocate a local instance of my object, that internally creates an UIAlertView and assigns its delegate to the object itself. When the alert is shown and the user taps a button, the apps crashes with an EXC_BAD_ACCESS because ARC has released my object and the delegate of the alert is that object.How could I handle this situation? I saw that a solution is

  • elpsk
    objective-c animation blocks
    I have several animation blocks, all of which follow this basic format with different delays so that they fire one after another:[UIView animateWithDuration:.85 delay:3 options:opts animations:[animations objectAtIndex:ww] completion:[completions objectAtIndex:ww]];The options are just UIViewAnimationOptionAutoreverse in a variable for easy access.I want there to be a delay between the animations and completion so that the images stay in their new position for a little bit before returning to th

  • justin k.
    objective-c cocoa objective-c-blocks blocks nsundomanager
    Of all the things that I would expect to support blocks, NSUndoManager curiously does not seem to do so. Is there some inherent reason for this, or has Apple simply not gotten around to modernizing this bit of API?In particular I would like to define a method on NSObject,- (void)performBlock {void (^block)(void) = (id)self;block(); }in order to be able to call,[[undoManager prepareWithInvocationTarget:^{NSLog( @”hello world” ); }] performBlock];Have I missed something? Is there anything wrong wi

  • Monolo
    objective-c cocoa cocoa-touch blocks objective-c-blocks
    Is calling a method on super supported in the implementation of an Objective-C block?When I was calling a method on super an EXC_BAD_ACCESS error would be thrown but as soon as I changed those calls from [super methodToCall] to [self methodToCall] and let the message move up the responder chain it worked fine. There is no implementation of -methodToCall in the instance of the class that the block exists in, but there is one in the superclass (that is, the class that self inherits from).I’m just

  • Brad Larson
    objective-c cocoa automatic-ref-counting blocks
    I have created a wrapper for the FBConnect iOS SDK that declares a block property for performing some code after successful login. Relevant code is as follows:typedef void(^FacebookServiceLoginBlock)(BOOL loginSuccessful);@interface FacebookService : NSObject <FBSessionDelegate,FBRequestDelegate> @property (nonatomic, copy) FacebookServiceLoginBlock loginBlock; – (void) checkAuthorization:(FacebookServiceLoginBlock)loginBlock; @end@implementation FacebookService @synthesize loginBlock;- (v

  • suhail
    objective-c ios crash thread-safety blocks
    I got an iPhone crash report with a SIGSEGV and I think I’ve narrowed down the possible cause and a solution. Since crashes caused by threads are hard to debug I can’t repro this problem, but could use some help with my hypothesis – is it sound?My code uses ASIHttpRequest to download a set of files using an ASINetWorkQueue. Here is a simplified sample//initialize download queue and do this code block in a loop for each fileNSURL *fileURL = [NSURL URLWithString:… __block ASIHTTPRequest *fileReq

  • btotheg
    7 blocks input-formats
    I have a custom input filter module, and I am trying to figure out why it crashes when I attempt to insert a block into a post via a shortcode. The method works perfectly when I am inserting a string, but when I try to insert a block, it causes a http 500 error. Any ideas? I am using Drupal 7.15. Also, I have tried the insert_block module, and it generates a similar error…Here is the input filter process that works (with a string)function _related_links_filter_related_block_process($text, $fil

  • Beebee
    7 blocks
    I need an array of all enabled blocks’ deltas.For example, if I display the array, it should output the block deltas e.g. search_form, user_new, user_login, and not the block titles e.g Search, User etcI’ve found a few candidates: http://api.drupal.org/api/drupal/modules!block!block.module/function/block_list/7http://drupalcontrib.org/api/drupal/drupal%21modules%21block%21block.module/function/block_get_blocks_by_region/7But they all crash my site. Really can’t get it to work, please give some e

  • Letharion
    blocks php
    I have created a Block with PHP as text format.What I want is to insert record into separate database using db_insert function.Here’s my code:<?php $tracker = array(‘database’ => ‘tracker’,’username’ => ‘tracker’,’password’ => ‘PASSWORD’,’host’ => ‘localhost’,’driver’ => ‘mysql’, );Database::addConnectionInfo(‘tracker’, ‘default’, $tracker); db_set_active(‘tracker’);// This code requires the code found in “Record Visit Pre-requisite in Block”. This will compute the total page l

  • nsecord
    uitableview twitter ios5 blocks
    I’ve been trying to work with TWrequest and retrieve a block of Tweets but I’m running into problems keeping the data synchronized and update the tableview.I have the following relatively simple block in the TableViewController to get the users account information :- (void)viewDidLoad {NSArray *twitterAccounts = [[NSArray alloc] init]; if ([TWRequest class]) { store = [[ACAccountStore alloc] init];ACAccountType *twitterType = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIde

  • slaterjohn
    ios crash uibutton action blocks
    I’m implementing UIButtons with block actions set on them for connivence and speed of integration. I’ve used this method before, a while ago now, and had little issue with it. Now, however, i’m facing an issue where integrating…https://gist.github.com/2468899… into my app now crashes it on launch. The error i’m receiving is as follows…2012-09-27 22:18:47.459 flink[12174:907] -[UIButton setAction:withBlock:]: unrecognized selector sent to instance 0x1e8ae610 2012-09-27 22:18:47.460 flink[12

  • nathan6137
    7 modules blocks
    Hi here is the code that works when i put it in a custom block as PHP <?php drupal_add_library(‘system’, ‘ui.accordion’); drupal_add_js(‘jQuery(document).ready(function(){jQuery(“#archivetree”).accordion({ active: “h3:last” });});’, ‘inline’);$result = db_query(“SELECT DATE_FORMAT((DATE_ADD(‘19700101’, INTERVAL node.created SECOND) + INTERVAL -18000 SECOND), ‘%Y%m’) AS created_year_month, COUNT(node.nid) AS num_records FROM {node} node WHERE (( (node.status = ‘1’) AND (node.type IN (‘blog’)

  • user1071840
    views nodes blocks comments node-update
    I want to put a new icon next to node listed in a block if it was created/updated or commented on in last 1 day. I’m able to fetch all the nodes which were created/updated or commented on sorted in descending order of their time of creation/update or comment.This is my code in template.php:function analytic_preprocess_views_view_fields(&$vars) {$viewName = $vars[‘view’]->name;$view1 = “view1”;$view2 = “view2”;$view3 = “view3”;if (strcasecmp($viewName, $view1) == 0 ||strcasecmp($viewName,

  • Jurudocs
    forms blocks
    So far, the form is rendered in the block, but the following errors are displayed:Notice: Undefined index: ios_lang_checkbox_nameform_function indrupal_retrieve_form()Warning: call_user_func_array() expects parameter 1 to be a validcallback, function ‘ios_lang_checkbox_nameform_function’ not found orinvalid function name in drupal_retrieve_form()<?phpfunction ios_lang_checkbox_block_info() {return array(‘ios_lang_checkbox’ => array(‘info’ => t(‘Ios Like language switcher’),’description’

  • kiamlaluno
    7 blocks themes
    I have created a custom block to display some contact information.I have a preprocess function that sets a contact variable like so:function atstump_preprocess(&$vars, $hook) {$vars[‘contact’] = array(‘name’ => ‘Doug Gillum’,’business’ => ‘Portland Stump Grinding’,/…); }I enabled the PHP filter, and set this as the text:<ul><li><?php print $contact[‘name’]; ?></li><li><?php print $contact[‘phone’]; ?></li><li><?php print $contact[’em

  • FatalError
    7 views blocks
    I have spent several hours searching for my solution. I found some but none of them is working. My problem is I have multi-site setup of drupal. Site A has a drupal views generated block of events calendar with next/back navigation of months (mini calendar). I want to use that block in another website of same drupal installation. Both of website has common user tables, theme and modules. I have tried following options until nowWeb Widgets module, web widget block does not have month header and t

  • kiamlaluno
    7 blocks
    I’ve looked through different threads about this issue and didn’t see any answers. I have a fresh install of Drupal 7 with no extra modules enabled. I’ve started building a custom theme but it doesn’t list itself in the blocks section even though it’s enabled. It shows the original bartik theme and the admin seven theme. The odd part is I added a new block under Header which I have listed in my .info page and it showed up in my theme but I can’t edit the block because the it only gives access to

  • Laxman13
    blocks
    I don’t understand why I put $node->field_test[‘und’][0][‘value’] appears the next error:Notice: Undefined index: und in eval() The field “field_test” is a boolean field. The code is the following one:$node = node_load(153); if ($node->field_test[‘und’][0][‘value’] == 1) { echo “test”; }What is my error?

  • kiamlaluno
    7 views blocks
    When editing a view, I get the following message in the popup.Notice: Undefined index: advertising_block in eva_plugin_display_entity->options_summary() (line 41 of/…/sites/all/modules/eva/eva_plugin_display_entity.inc).This view contains 2 displays: a view attached and a block (called advertising_block). This error message appeared both before and after deleting the “advertising_block” to which it seems to refer.Any idea of what may be causing this error message and how to fix it?

  • Steve Johnson
    ruby function blocks yield
    I recently purchased the book Seven Languages in Seven Weeks and have been reading through the chapter on Ruby. In the section which introduces blocks (page 40), a code sample is given which illustrates the use of blocks for the purpose of conditionally executing something:in_case_of_emergency douse_credit_cardpanic enddef in_case_of_emergencyyield if emergency? endThis code doesn’t make much sense to me, and the book doesn’t provide much of an explanation. I was wondering if one of you Ruby gur

  • mohit_rocks
    form-api blocks
    I am creating block module in Drupal 7.In the body of block I want to put the form which will restripe the data of table in forms.I have created block as shown below but it doesn’t showing the form.<?php /*** @file* This is module file which display the links on the welcome page.* This module will create a block of the link which is to be displayed on the welcome page.*//*** Implements hook_block_info().** This hook declares what blocks are provided by the module.*/ function welcomepage_li

Web site is in building