Questions tagged [block]

DO NOT USE This tag is scheduled for removal because it can refer to many different things depending on the use of other tags with it.

This tag has an active burnination. Remove it from questions if a) you can improve the question in other ways at the same time or b) you have 2k+ rep.

Depending on the tags it's used with, it can refer to:

  • Blocking access to certain resources.
  • Blocks specific to the program or language its used within.
  • Blocks in a file system.
3655 questions
118
votes
6 answers

How to use nonnull and nullable Objective-C keywords in block-based API method

Consider the following method - (void)methodWithArg:(NSString *)arg1 andArg:(NSString *)arg2 completionHandler:(void (^)(NSArray *results, NSError *error))completionHandler; With the new nonnull and nullable annotation keywords we can enrich it as…
albertodebortoli
  • 1,768
  • 2
  • 16
  • 20
118
votes
9 answers

Display block without 100% width

I want to set a span element to appear below another element using the display property. I tried applying inline-block but without success, and figured I could use block if I somehow managed to avoid giving the element a width of 100% (I don't want…
Staffan Estberg
  • 6,795
  • 16
  • 71
  • 107
107
votes
7 answers

is there a 'block until condition becomes true' function in java?

I'm writing a listener thread for a server, and at the moment I'm using: while (true){ try { if (condition){ //do something condition=false; } sleep(1000); } catch (InterruptedException ex){ …
Rolan
  • 2,924
  • 7
  • 34
  • 46
106
votes
5 answers

Understanding Magento Block and Block Type

I just want to understand the meaning of I got many references from Google and understood many things about it but I am still unable to understand the formation of…
Anup_Tripathi
  • 2,817
  • 3
  • 26
  • 37
82
votes
6 answers

Django : Is it impossible to static tag into block tag?

The code below makes error.. How could I resolve this problem? {% block header %} {% endblock %} The error output: TemplateSyntaxError : Invalid block tag: 'static', expected…
nextdoordoc
  • 1,727
  • 6
  • 20
  • 30
63
votes
4 answers

What does to_proc method mean in Ruby?

I am learning rails and following this thread. I am stuck with the to_proc method. I consider symbols only as alternatives to strings (they are like strings but cheaper in terms of memory). If there is anything else I am missing for symbols, then…
swapnesh
  • 26,318
  • 22
  • 94
  • 126
59
votes
4 answers

jQuery CSS Opacity

What's wrong? I want to change the opacity if #nav .drop is display:block; jQuery(document).ready(function(){ if (jQuery('#nav .drop').css('display') === 'block') { jQuery('#main').css('opacity') = '0.6'; } });
Mike
  • 751
  • 1
  • 6
  • 17
58
votes
5 answers

Compiler error when declaring a variable inside if condition and no curly braces

Why does this first if compile well and the second fail? if(proceed) {int i;} // This compiles fine. if(proceed) int i;// This gives an error. (Syntax error on token ")", { expected after this token)
ironwood
  • 8,936
  • 15
  • 65
  • 114
53
votes
2 answers

optional closure and check if it is nil

So what I want to have is a class that may get a closure passed to it in a function, it may also at some point want to disregard a that closure. How can I check if the closure variable is set and hwo can I delete it when I am done with it? Cannot…
Ágúst Rafnsson
  • 601
  • 1
  • 5
  • 9
53
votes
3 answers

How to center things - display:block/inline-block

When centering things in html and css, I find two approaches - either applying on the element : display:block; margin:0 auto; or using: display:inline-block; text-align:center; (on the parent element) I always wonder which is better and why.…
user2335065
  • 2,337
  • 3
  • 31
  • 54
51
votes
8 answers

data block size in HDFS, why 64MB?

The default data block size of HDFS/Hadoop is 64MB. The block size in the disk is generally 4KB. What does 64MB block size mean? ->Does it mean that the smallest unit of reading from disk is 64MB? If yes, what is the advantage of doing that?-> easy…
dykw
  • 1,199
  • 3
  • 13
  • 17
49
votes
2 answers

PowerShell try/catch/finally

I recently wrote a PowerShell script that works great - however, I'd like to now upgrade the script and add some error checking / handling - but I've been stumped at the first hurdle it seems. Why won't the following code work? try { Remove-Item…
steve
  • 849
  • 2
  • 9
  • 15
46
votes
4 answers

Change the context/binding inside a block in ruby

I have a DSL in Ruby that works like so: desc 'list all todos' command :list do |c| c.desc 'show todos in long form' c.switch :l c.action do |global,option,args| # some code that's not relevant to this question end end desc 'make a new…
davetron5000
  • 24,123
  • 11
  • 70
  • 98
43
votes
2 answers

Pass block passed to method to another method in Ruby

I'm trying to write a clone of the ruby keep_if and delete_if array methods. Here is my code. module Strain def keep self.inject([]) do |extracts, element| yield(element) ? extracts << element : extracts end end def discard …
Kappie001
  • 898
  • 2
  • 10
  • 20
42
votes
6 answers

How to make text input box to occupy all the remaining width within parent block?

How do achieve the following: ┌────────────────────parent────────────────────┐ │ label [text-box ] [button] │ │ paragraph │ └──────────────────────────────────────────────┘ label is aligned to…
user422039
  • 1,447
  • 4
  • 13
  • 28
1
2 3
99 100