FAQ Database Discussion Community


How to block the link from malicious bot visitors?

javascript,hyperlink,block,bots,nofollow
I'm producing an event registration website. When someone click on a link: <a href="/reserve/10" rel="nofollow">Reserve id=10 event</a> The system is doing a "lock" on this event for ten minutes for this visitor. In that case no one else can reserve this event in next ten minutes. If the payment is...

Incompatible block pointer type initializing float

objective-c,block
Im not sure how to get this to work: I was thinking something to do with typedef, but I can't find much on the subject. float (^pixelsToDistance)(float, float, NSString *) = ^(float distance, float scale, NSString *conversion) { // Code goes here } Im trying to return a float value...

Firefox: how to block link [closed]

firefox,block
I'm using Firefox as a web browser so I want block some links where I can doing it from Firefox ? please help

iOS: pass data to another class

ios,swift,delegates,block,delegation
I have my class named "Service" where inside I do a lot of GET/POST request with Alamofire, an example of request id this func requestDocuments(){ request(.POST, "http://example.com/json/docs") .responseJSON { (_, _, JSON, error) in if error == nil{ var response = JSON as NSArray println("array document: \(response)") //**** HERE I...

completion handler in method which request information from server

ios,callback,block,objective
I have a method which send request to server and i have created the call to that function with completionHandler as follows: -(void)sendAddSubscriptionRequest:(NSString*)owner withComppletionHandler:(void (^)(BOOL, NSArray *, NSError *))completion dataWebService = [[NSMutableData alloc] init]; NSURL* aUrl = [NSURL URLWithString:[NSString stringWithFormat:@"https://www.google.com/add?"]]; NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:aUrl cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0]; [request...

to find mean square error of two cell arrays of different sizes

matlab,block,cell-array,mse
I have two cell arrays. One is 'trans_blk' of size <232324x1> consists of cells of size <8x8> and another 'ca' is of size <1024x1> consists of cells of size <8x8>. I want to compute mean square error (MSE) for each cell of 'ca' with respect to every cell of 'trans_blk'....

Passing an argument to a callback block

ruby,block
I'm writing a simple callback for a gem I'm working on. Please note that due to certain architectural constraints, I can't use the ActiveSupport define_callbacks method for this specific case. Right now, I have something like this: def self.after_data_transcoding(&block) define_method :_after_data_transcoding_callback { block.call } end So an use case is...

Equivalent “completion handler” from MagicalRecord to Realm.io

ios,block,magicalrecord,realm,completion
I searched for a many days, but I can not find it. What would be the equivalent of the following MagicalRecord statement in Realm.io? [MagicalRecord saveUsingCurrentThreadContextWithBlock:^(NSManagedObjectContext *localContext) { // Save block } completion:^(BOOL success, NSError *error) { // Completion block }]; I need "Save block", and when it finish, execute...

How to make a button responsive and centered?

css,width,block
I want to make a button centered and responsive. But I can't give it a width otherwise the background color goes with it. any solutions? Code: background-color: #03326c; font-size: 25px; height: 35px; margin-left: 530px; margin-top: -70px; position: relative; text-align: center; width: 180px; z-index: 100000; } <div class="product-button1"><a href="http://blabla.com/blabla.html" title="reserveren"><span class="reserverenButton1">Reserveer...

Align Text Inside A Inline-Block Div? CSS

css,css3,block,inline,text-alignment
I am trying to align a group of text, including p and h5 html elements. I am using inline-block display type to get the text to be on the same line for the titles. If the aligning with this display type is not possible it would be helpful if you...

Break out of nested blocks Objective-C

objective-c,block
If I have a block inside a block inside a block, etc... how would I "stop" executing any further blocks. void (^simpleBlock)(void) = ^{ //block A void (^simpleBlock)(void) = ^{ //block B //something happened, stop block C from executing... void (^simpleBlock)(void) = ^{ //block C }; }; }; ...

Why putting “self” in the GCD blocks will cause a memory leak?

ios,block,grand-central-dispatch,autorelease,retain-cycle
I have read the great article write by benzado that using block will cause memory leak if we have a class variable retain the block itself, and the block retain "self", that cause a retain cycle. How do I avoid capturing self in blocks when implementing an API? But I...

block in Swift : return error “ is not convertible to ”

ios,swift,block,type-alias
I made a mistake but I cannot see how to solve it. I would like to load all the assets from GameScene and send a Bool in a completion method. I use typealias : should it be renamed twice for the two files (gameScene and gameController)? Then I have got...

ios When I create a class-method,it shows the error: Member reference base type 'Class' is not a structure or union

ios,block,class-method
@interface A : UIView{ NSInteger z_num; } + (void)getNum; @end @implementation A + (void)getNum{ __weak typeof(self) weakSelf = self; [[SingletonClass shareInstance] getNum:^(NSInteger status, NSString *num) { __strong typeof(weakSelf) strongSelf = weakSelf; if (strongSelf) { if (status == NET_OK) { strongSelf->z_num = [num integerValue]; //error:Member reference base type 'Class' is not...

How To Pass A Twig Output String Into the urlFor() Function

php,twig,block,slim
I would like to pass the id of a category into a parameter using urlFor(). {% for category in categories %} <br> <p><a href="{{urlFor('showTopic.post', {"cat_id": "{{category.id}}"})}}">{{category.category_title}}<a><br>{{category.category_description}}</p> <br> <br> {% endfor %} This currently does not work. It just passes in {{category.id}} instead of the actual id for the category. I...

How To return a value From block in iOS

ios,block
Im using google geocode Svc to get Lat and Lng from the Address,Some times Google geocode Svc is getting failed(Because of toomany counts per second or perday ), So i want to use Default Geocoder Svc provided by Apple. See here My code -(void)getLatandlongfromAddress { CLLocationCoordinate2D Coordinate=[self geoCodeUsingAddress:@"orlando"]; } -...

Why moodle block is not showing?

php,layout,block,moodle
I have fallowing Moodle document for creating a new block, called "simplehtml" liked document, I can install this block, but why when I put this fallowing code in layout, it is not returning anything for rend? Code in layout for call my block: <?php echo $OUTPUT->blocks('simplehtml', 'span4 desktop-first-column'); ?> ...

Concrete5 5.7 Block permissions

permissions,block,concrete5,concrete5-5.7
Simple question. How can I add permission to edit one single block in the whole website for one user/group? I just can't figure it out. I want to make a small website with only one area editable for client.

Restrict/Change content according to Country (IP Address)

wordpress,redirect,block,ip-address
a = worldwide access b = only one specific country I have a wordpress website:domain.com, that includes 1 page:domain.com/a that is relevant for all countries worldwide except for 1 country (example: Italy). I want to block italy from domain.com/a and automatically show them the other version of this page domain.com/b....

Drupal Webform - How to load values from form, filled in a previous page

drupal-7,block,drupal-webform
Working on Drupal, I have a page with a form made with "Webform" module, containing several fields (text fields and sliders) and a "Submit" button. When the user enters the information and presses the "Submit" button, another page is loaded with custom code into it. The new page is devided...

CSS: How to make custom file upload button take full width (button works)

html,css,width,block,fixed-width
I am new to CSS and hope someone here can help me with this. I am trying to apply a simple custom style to a file upload button (as part of an HTML form) to make it look similar to other buttons on my page and to get a similar...

multiple return values in callback blocks

ios,objective-c,callback,block
people I am working with don't wanna use delegate methods for a couple of reasons and they want me to come up with a solution; basically they want a callback block with multiple return values, and when the first return value arrived block should still wait for the upcoming return...

Xcode Objective-C ShotBlocker: How to detect and block screenshots [duplicate]

objective-c,xcode,block,screenshot,detect
This question already has an answer here: Notification of or detecting screenshot being taken? 4 answers iOS Detection of Screenshot? 4 answers In an app I'm creating, you're not allowed to take screenshots. I was wondering how you could detect and block screenshots. I found out you could do...

Is it possible to call a block completion handler from another function in iOS?

ios,swift,block,objective-c-blocks
I have a custom UIView with a UITapGestureRecognizer attached to it. The gesture recognizer calls a method called hide() to remove the view from the superview as such: func hide(sender:UITapGestureRecognizer){ if let customView = sender.view as? UICustomView{ customView.removeFromSuperview() } } The UICustomView also has a show() method that adds it...

Objective-C Assigning to UIView from incompatible type block

objective-c,types,block
I was trying to assign an UIView to an UITableView footer with a block. This works fine: UIView* (^createFooter)() = ^UIView*{ UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0,0,300,100)]; return footer; }; myTableView.tableFooterView = createFooter(); Why isn't this working: myTableView.tableFooterView = ^UIView*{ UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0,0,300,100)]; return footer; }; Thanks...

Pass a variable to a template .phtml block in Magento

magento,block,phtml
This code is write in market.phtml <?php echo $this->getLayout()->createBlock('core/template')->setData('vendorId',$vendor->getCustomerId())->setTemplate('marketplace/vendors/badge.phtml')->toHtml();?> In Badge.php echo $this->vendorId; But my output is null. Is this correct way to pass data to block? ...

Add static blocks into certain columns in magento

magento,static,block
I have a site with a 3 column layout. In the left is a menu where you can select the products, in the middle is an image slider. Now, i created another static block, but how can i add it into the right column? thanks

Blank line as block-data separator

r,data,block
I have a one-column dataset with blank lines. Each blank line defines a new data block, i.e. what I would plot with gnuplot (if blank line were doubled) like this: plot "datafile" i n where n is the n-th block. How could I implement a data import in R so...

How to add a custom UIView as a loading screen

ios,objective-c,asynchronous,block,loading
I have tried to search and check many questions on this site but I still cannot find the answer for my question. Maybe there are some similar questions can solve my problem but I don't have enough experience to know about this, please forgive me. I'm working on an application...

div function inside another div function

php,html,function,block
Is it possible in php to make the second div appears inside the first one instead of getting two separated divs ? I would like to make a php dom system but I'm stuck with this problem. This is the HTML I get when the page returns : <div style="width:...

magento remove block in layout.xml

xml,magento,layout,block
I have tier pricing set up for some items. This template is used on the product view page: catalog/product/view/tierprices.phtml. I am trying to remove this by editing layout.xml with no success. How can I remove this block?

How to get Objective-C block input parameter in Swift Closure

objective-c,swift,closures,block
I need use a Objective-C SDK in my Swift project, the Objc demo is in below [[AlipaySDK defaultService] payOrder:orderString fromScheme:appScheme callback:^(NSDictionary *resultDic) { NSLog(@"reslut = %@",resultDic); }]; It pass a block to payOrder:orderString:: function, but when I call it in Swift, the auto complete help me generate these code AlipaySDK.defaultService().payOrder(orderString,...

How if I set hdfs blocksize to 1 GB?

hadoop,size,containers,block,hdfs
I want to ask. How if I set the hdfs blocksize to 1 GB, and I'll upload file with size almost 1 GB. Would it become faster to process mapreduce? I think that with larger block size, the container request to resource manager (map task) will fewer than the default....

Positioning issues with display block

html,css,position,block
I have my navigation set to display: block; and my paragraph set to display: block; however my paragraph section sits at the top of the page covering the navigation. I have the css for my navigation and I would have thought it should push other objects away? nav { display:...

Is possible to set hadoop blocksize 24 MB?

hadoop,size,hdfs,block,megabyte
I just want to ask your opinion about HDFS block size. So I set HDFS block size to 24 MB and it's can run normally. I remember that 24 MB is not an exponential number (multiplication of 2) for the usual size on computer. So I want to ask all...

ios custom block can not compile for arm64

ios,compilation,block,arm64
When change to arm64 from armv7s, I can't compile the custom block. How I can reslove the problem? Thanks. Here is my code: //typedef NSInteger (^ActionSheetPickerNumberOfRowsBlock) (ActionSheetPicker *picker); ActionSheetPickerNumberOfRowsBlock numberOfRows = ^(ActionSheetPicker *picker) { return 29; }; ...

Block as an argement of the block

ios,block
I wonder if it's possible to declare/pass block as an argument of another block. Let me illustrate via code and simple (not real) use-case: Assume that ViewController fetched list of objects aka items via ItemsAPI ViewController would like to display pins on mapView When mapView pin is tapped (selected): MapView...

How to pass data from the popped model view controller to the previous view controller using Swift language?

ios,objective-c,block
I know that we can switch to VC1 to VC2 using model segue presentViewController. And we can use segue to pass the data from VC1 to VC2 in the prepareForSegue method, like below: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { var vc2: VC2ViewController = segue.destinationViewController as! VC2ViewController vc2.desiredData = "The...

How i can add relative path of image in Block Body Drupal7?

php,drupal-7,block
Previously my images were present in default/files folder ,i want to move them in theme specific images . priorly i accessed them via but i want to give relative path of themes images folder now in block body . Can anyone please guide how it can be achieved . I...

How to modify multiple elements of a block with BEM CSS

css,block,element,modifier,bem
Let us say I have the following setup, .block .block__header .block__content .block__footer Now I want to show an active state of this block. Let us say the block itself gets a green background and element 2 and 3 should get bold text. As I understand the philosophy of BEM, one...

Using objective-C blocks to write a completion handler [duplicate]

ios,objective-c,block,completion
This question already has an answer here: How to write an Objective-C Completion Block 2 answers I've had a look at lots of different answers about blocks and I'm still struggling to figure out how to use it. Here is what I have so far... @interface myController () typedef...

What does NBD_SET_SIZE set the size of? The channel or the size of the block device?

networking,block,device,definitions
I'm using Network Block Device (NBD) and I couldn't find any documentation on what NBD_SET_SIZE refers to. I suspect that it's the size of the block device, and then NBD_SET_BLKSIZE is the hint for the underlying device's block size. So then what's NBD_SET_SIZE_BLOCKS? Is there someplace where I can get...

Replace block with template

php,forms,magento,layout,block
I need to replace a block with another one. This is the code that calls the block i need to replace. <?php echo Mage::getModel('cms/block')->load('contact_us_page')->getTitle() ?> I could replace the block calling another block, simply by replacing contact_us_page with the other block's name. The thing is, i need to change it...

Method taking an argument or a block

ruby,methods,block
Is it possible to write a method that acts differently depending on the type of input? I'm trying to write one that acts like this hello("derick") #=> "hello derick!" hello do "derick" end #=>"<hello>'derick'<hello/>" ...

How can I make each block move in the opposite direction once they reach a certain point on the side of the screen?

java,object,block,velocity
I am trying to get three different blocks to move back and forth from one side of the screen to the other. If the block on the far right reaches the game frame's width, it's velocity is reversed and it starts moving to the left side. However, my problem exists...

Python - bypass Malwarebytes blocked websites with urllib?

python,block,urllib
Here's a part my code that gets source code from websites: #Header dictionary headers = {} #Header for websites headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17" #Urllib code req = urllib.request.Request(url, headers=headers) resp = urllib.request.urlopen(req) respData = resp.read() This works, however my Malwarebytes blocks some...

OSX Blocking JNLP Launch Java1.8U40 - Anyone Know Why?

java,osx,block,jnlp
We deploy our application as a JNLP launch file and/or as a webpage applet. I have a customer that updated his MAC OSX system to the latest Java Version 1.8_40. After upgrading the JNLP launch stopped working. It seems to start Java (flashes blue java logo) then stops. No Exception...

C# - How can I block the typing of a letter on a key press?

c#,winforms,input,block,letter
I have a textbox with a OnKeyPress event. In this textbox I wish to input only numbers, and for some specific letters like t or m, I would want to execute a code without that letter being typed in the textbox. Small sample of what I am trying to do:...

pass parameter in objective-c block

objective-c,block
My program: - (void)getPostPraiseListWithSessionId:(NSString *)sid withPostId:(NSString *)postId withPageNo:(int)pageNo completeBlock:(void (^)(NSError *))complete{ AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; NSDictionary *parameters = @{ @"sid":sid, @"post_id":postId, @"pageNo":[[NSNumber alloc] initWithInt:pageNo], }; [manager POST:[NSString stringWithFormat:@"%@%@",K_BASE_URL,K_GET_POST_PRAISE_LIST_URL] parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject)...

How display block that overwflows table cell?

apache,table,block,cell,fop
I render a table using Apache™ FOP (Formatting Objects Processor). I want to display a yellow block with fixed height and width. Block bottom should be at the same position where row bottom is. Block should overflow cells, block should not make cell larger. I'd rather not use rowspan. Any...

Wordpress- block characters in custom input field

wordpress,input,character,block
Can enybody help me with block special characters in my custom field in front-end? I want add this block only for one field with specific #id. Thanks!...

Writing php code to creating menu in block show and alert

php,drupal,drupal-7,block
I have a menu in a block and this is my code in that block that is in sidebar second: <?php $url=$base_url.'/drupal'; echo '<ul> <li><a href="'.$url.'/article/1">One</a></li> <li> <a href="'.$url.'/article/2">Two</a></li> </ul>'; ?> it is working correctly, but return and red alert: Notice: Undefined variable: base_url in eval() (line 2 of C:\xampp\htdocs\drupal\modules\php\php.module(80)...