blocks

Scroll block with page in drupal

Is it possible that if i scroll down on drupal the block should also scroll along with the page. Because i have to display long results on the node and i want to scroll the block so that user can see the data on left sidebar everytime. Please help me out ...

Block references as instance vars in Objective-C

Hi there, I was wondering if it's possible to store a reference to an anonymous function (block) as an instance variable in Objective-C. I know how to use delegation, target-action, etc. I am not talking about this. Thanks! ...

Removing a block nested in a block via the local.xml file.

Hello, I'm trying to use my local.xml file (where I do all my updates to the layout) to remove a block that is nested in another block. I can easily remove a block via the <remove> tag, or using the unsetChild method, but I can't seem to remove a block that is nested in another block. Here is the line of code I am trying to remove (lo...

syntax error before '^' token in UIView.h - not fixed by changing compiler setting

Hi, I installed the latest official iphone sdk and now my personal project is getting the same compiler error in UIView.h as described in this question: http://stackoverflow.com/questions/3098611/syntax-error-before-token syntax error before '^' token The solution is apparently to change compiler settings to use GCC 4.2 or LLVM. I've ...

Executing Blocks From NSArray?

Hi, I was just thinking, as you can treat Blocks like objects if I create two of them and then add them to an NSArray is there a way to execute them from the array? int (^Block_001)(void) = ^{ return 101; }; int (^Block_002)(void) = ^{ return 202; }; NSArray *array = [NSArray arrayWithObjects:Block_001, Block_002, nil]; EDIT: Update f...

Blocks within blocks

Hey Guys, I'm having problems displaying nested blocks in a template. eg. {% for category in categories %} //code to display category info {% products = products.object.filter(category = category) %} {% for product in products%} //code to display product info {% endfor %} {% ...

LocalJumpError ( No Block Given ) in Rails

I'm running this method, and this works perfectly on my local machine but does not work on my remote server. I get that it's looking for a block, but I'm not sure 'where' or 'how' to place it. Here's my broken method: def generate_csv if params[:print_envelopes] @signups = CardBatch.find(params[:id]).card_signups.each.reject { |a...

Is there any way to serialize / unserialize an Objective-C block?

I'm writing an app where support for "promotions" is required, and these promotions could be arbitrarily complex and many different pieces of data might be relevant in their calculation. Therefore, whilst in the early stages of development, I don't want to invent a whole specification schema for these things, I'd rather just write each ...

Formatting tips for Objective-C nested blocks

I don't mean to start a code formatting holy war here, but I'm wondering if anyone has any advice on how to best format nested blocks in Objective-C. Here's some code I wrote today: [UIView animateWithDuration:1.0 animations:^{ self.alpha = 0.5; } completion:^(BOOL finished){ [UIView animateWithDuration...

How to construct IBOutlet names in code in order to change them?

Let's say I've got several UILabels which have been set up in IB and connected to IBOulets in code (label1, label2, label3, label4) How would I create these variable names within code, so that I could change the text of each one in a loop, where the labels are taken from a NSArray. Here's the pseudo-code: labelArray = [NSArray arrayWi...

How to collapse blocks of code in Eclipse?

Some days ago my Eclipse was working fine and a +/- appeared in every block that could be collapsed (functions, classes, etc.)... but now it does appear, and I don't know how to activate that feature again. I know this question is kind of silly, but it's driving me nutts. If it helps, it's Eclipse Helios, running on a Gentoo Linux box. ...

Ruby confusion with blocks.

Hello, I'm learning Ruby (using the Pickaxe book) and I've encountered a little confusion with a block operation that goes a little like this: class CsvReader def initialize @book_in_stock = [] end def read_in_csv_data(csv_file_name) CSV.foreach(csv_file_name, headers: true) do |row| # 1. @book_in_stock << BookinSto...

Deleting Managed Objects in Background Block

On iPhone, I´ve tried to delete managed objects in background: - (void) cleanUp { dispatch_queue_t queue_cleanUp; queue_cleanUp = dispatch_queue_create("com.aroundcal.cleanup", NULL); dispatch_async(queue_cleanUp, ^{ while (!self.stopThread) { [self deleteMyObjects]; [NSThread sleepFor...

Combining Option Routes in Rails 2.3

I'm tring to setup a Route like so: GET /settings/ PUT /settings/ GET /settings/photos PUT /settings/photos This is the routing code that I have setup for it: #I just do this for code reuse get = { :method => :get } put = { :method => :put } pub.settings '/settings', :controller => :settings, :action => :index, :conditions => get pub...

Parsing blockbased program output using Python

I am trying to parse the output of a statistical program (Mplus) using Python. The format of the output (example here) is structured in blocks, sub-blocks, columns, etc. where the whitespace and breaks are very important. Depending on the eg. options requested you get an addional (sub)block or column here or there. Approaching this us...

Assign a block to more than 1 region

How do I assign a block (the very same block) twice or thrice to different regions? The idea is not to have the same block on the same page more than once, but in different locations on different pages, so four 'displays' would be available: Block X in the $top_left region Block X in the $top_right region Block X in the $above_content ...

How to have the block driven by the page being visited as opposed to the user who is signed in

Im very new at drupal. My problem is that the block is consistent and not changing. It seems to be based on the user signed in as opposed to the page being visited (ie, in the multi-user blog, each block should reflect the page of the blogger being displayed and not the user who is signed in. I would like the info to be displayed based o...

Blocks & Procs in Ruby

Hi there, I have started learning Ruby, and I have read a couple of tutorials and I even bought a book ("Programming Ruby 1.9 - The Pragmatic Programmers' Guide"), and I came across something new that I haven't seen before in any of the other languages I know (I am working as a PHP webdeveloper). Blocks & Procs. I think I understand wh...

Objective-C Block which accepts an object and returns a boolean.

Can you please write for me a block which conforms to this definition: (BOOL(^)(id))block. The closest I have gotten is: typedef BOOL (^birds)(MyObject*); birds c = ^(MyObject* p){ return (BOOL)[p.something boolValue]; }; But it seems passing this c in a message who wants (BOOL(^)(id))block is a no go. ...

Getting a return value out of Multiple Blocks With Ruby

require 'net/http'; require 'uri'; require 'rexml/document'; require 'sqlite3'; def download_torrent(episode_id, torrent_url, limit = 10) # Check to make sure we haven't been trapped in an infinite loop if limit == 0 then puts "Too much redirection, skipping #{episode_id}"; return true; else # Convert the URL of the ...