block

Nested blocks in Django templates

The master template in my Django app looks like this: {% block parent %} Some text... {% block child %} Default content here... {% endblock child %} ...some more text {% endblock parent %} Now, this template should be overwritten in a way that the child block is changed: {% extends "master.html" %} {% block c...

Django bug with a tag

My code {% if GET['search'] % } {% block count codes|length as counter %} Is the following a valid if -clause as a Django tag? {% if GET['search'] % } The following code gives me an error that block takes only one argument. What is wrong in the code? {% block count codes|length as counter %} ...

how to protect server directory using .htaccess

I have designed a website, and within it I have a range of PHP scripts which interact with my system. For example, if a user uploads an image, this is processed by the script image.php and if a user logs in this is processed by the script login.php All these scripts are stored in the folder called: scripts how do I ensure someone...

li click events on safari?

This issue is specifically with Safari. <div id="list"> <ul> <li onclick="do_something();"><!-- block with stuff in it --></li> </ul> </div> When the above is loaded normally, the onclick applies to the entire li block. The problem is, later on when I use ajax to populate the #list div dynamically... $("#list").html('...

Block all content on a web page for people using an Adblock-type browser add-on/extension?

I wish to block ALL my content from any users using an ad-blocking browser extension (ie. Adblock Plus for Firefox, Adthwart for Chrome). How can I acheive this? Is there a server-side solution? Client-side? Edit 1 This question regards the detection of ad-blocking browser extensions: http://stackoverflow.com/questions/1185067/detec...

how to return from a blocked call ?

is it possible to force a thread to return from a call to a blocking function such as a blocking read from a stream ? int x; std::cin >> x; for example... ...

Remove a section of a website; web browser control. C#

Is there any way of removing a section of a website without altering the code. Let's say for an example, I would create a webBrowser control in my windows form and tell it to load stackoverflow.com, would there be any way of removing; lets say the top 100 pixels from displaying? Thanks Lawrence ...

Using do block vs brackets {}

New to ruby, put on your newbie gloves. Is there any difference (obscure or practical) between the following two snippets? my_array = [:uno, :dos, :tres] my_array.each { |item| puts item } my_array = [:uno, :dos, :tres] my_array.each do |item| puts item end I realize the bracket syntax would allow you to place the block on...

python subprocess communicate() block

i am using subprocess to call a external program plink.exe to login to a server, but when i call communicate to read the output, it blocking. the code is below: import subprocess process = subprocess.Popen('plink.exe [email protected] -pw 123456'.split(), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) print process....

Drupal: How to retrieve parent page's $node variable in a block using module_invoke()?

Hi, I'm using module_invoke() to include a block and I need in this block to read a value contained in my parent content type page. So how can I get the $node variable in my block from the view? Code I'm using: <?php $block = module_invoke('my_blocks', 'block', 'view', 7); print $block['content']; ?> Now I need to access $no...

MATLAB block size and memory management

I'm using a block processing approach to handle a calculation between two large matrices. The code significantly speeds up when using a larger block size. But if I go too large, then I get an Out of Memory error. Currently I hand-tune my code to find the largest working block size for a given input. My question: how can I automate ...

Is it possible to compare two Objective-C blocks by content?

float pi = 3.14; float (^piSquare)(void) = ^(void){ return pi * pi; }; float (^piSquare2)(void) = ^(void){ return pi * pi; }; [piSquare isEqualTo: piSquare2]; // -> want it to behave like -isEqualToString... ...

Encoding an Objective-c Block?

Is it possible to encode an objective-c block with an NSKeyedArchiver? I dont think a Block object is NSCoding compliant, therefore [coder encodeObject:block forKey:@"block"] does not work? Any ideas? ...

Why don't diametrically opposed margins overlap with a table being involved?

I wonder why diametrically opposed margins (a margin-top following a margin-bottom) between to block elements (eg. divs) are merged, while between a block element and a table, those margins add up. Example: <style> .a { margin-bottom: 18px; } .b { margin-top: 6px; } </style> <div class="a">Foo</div> <div class="b">Bar</div> ...

C# Enterprise Block Application Settings and Settings.Settings designer

I am working with v4 of the Enterprise Application block and I am trying to learn how to access the Application Settings that I have added using the Enterprise Library Configuration tool. It's as if the code does not recognize the settings even though I can see them in the app.config. I DO have a Settings.Settings designer added and I ...

Drupal 6 preprocess blocks & nodes

I build a BLOCK that sits on a right side of the website and is available for whole site. Also I got a many CONTENT_TYPE NODES like (pages, news,gallery, files). How can I modify _preprocess_xxxxx and which one, so I can let my BLOCK know which CONTENT_TYPE is currently displaying. so then my BLOCK displays var $section = top 10 dow...

Ruby using block and params to DRY up template

I have a pattern in a couple of templates that's repeated. The code is for rendering a set of tabs and content for each tab. Contents of /app/views/general/_product_groupings.html.erb <table cellpadding="1" cellspacing="0" class="sub_container clear"> <tr> <% first_visible_tab = true %> <% @bundle.groupings.each do |group| %...

Magento: Multiple calls to same block template with cache on

Hi all, I am calling a block multiple times in the footer of my site as follows: <reference name="footer"> <block type="catalog/navigation" name="footer.category.occasion" as="cat_occasion"> <action method="setTemplate"><template>catalog/category/menu.phtml</template></action> <action method="setData"><name>categor...

Magento CMS page (or block) mass import

I have 50 CMS pages I want to create in Magento. These are essentially mail merges off of a database with different content (but same structure) in each, so I'd love to be able to import them if possible. I want individual pages so they can be indexed by the search engines. Is there a handy/dandy way to do this? I could alternatively...

Javascript block script execution

Hi, i need to do something like this: Execute a piece of code Start to load an image and block the script execution When the image is loaded resume the execution Execute the rest of the code I know that the simplest way is to assign a function on the onload event of the image and then execute the rest of the code in the function, but...