Search Results

Search found 8448 results on 338 pages for 'initialization block'.

Page 6/338 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Objective C ASIHTTPRequest nested GCD block in complete block

    - by T.Leavy
    I was wondering if this is the correct way to have nested blocks working on the same variable in Objective C without causing any memory problems or crashes with ARC. It starts with a ASIHttpRequest complete block. MyObject *object = [dataSet objectAtIndex:i]; ASIHTTPRequest *request = [[ASIHTTPRequest alloc]initWithURL:@"FOO"]; __block MyObject *mutableObject = object; [request setCompleteBlock:^{ mutableObject.data = request.responseData; __block MyObject *gcdMutableObject = mutableObject; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0),^{ [gcdMutableObject doLongComputation]; dispatch_async(dispatch_get_main_queue(),^{ [self updateGUIWithObject:gcdMutableObject]; }); }); [request startAsynchronous]; My main concern is nesting the dispatch queues and using the __block version of the previous queue to access data. Is what I am doing safe?

    Read the article

  • Magento - Add CMS Block to One Page

    - by a1anm
    I have this code in a xml layout file: <reference name="left"> <block type="blog/blog" name="left.blog.menu" before="-"> <action method="setTemplate" ifconfig="blog/menu/left"> <template>aw_blog/menu.phtml</template> </action> <block type="blog/tags" name="blog_tags" /> </block> </reference> I want to add a cms static block to the blog pages using this code: <block type="cms/block" name="brand_list"> <action method="setBlockId"><block_id>brand_list</block_id></action> </block> If I add it in directly after this line: <reference name="left"> It works but it is then displayed on every page. How can I get it to show only on the blog pages? Thanks. Edit: Here is the entire xml file: <layout version="0.1.0"> <default> <reference name="footer_links"> <block type="blog/blog" name="add.blog.footer"> <block type="blog/tags" name="blog_tags" /> <action method="addFooterLink" ifconfig="blog/menu/footer"></action> </block> </reference> <reference name="right"> <block type="blog/blog" name="right.blog.menu" before="-"> <action method="setTemplate" ifconfig="blog/menu/right" ifvalue="1"> <template>aw_blog/menu.phtml</template> </action> <block type="blog/tags" name="blog_tags" /> </block> </reference> <reference name="left"> <block type="blog/blog" name="left.blog.menu" before="-"> <action method="setTemplate" ifconfig="blog/menu/left"> <template>aw_blog/menu.phtml</template> </action> <block type="blog/tags" name="blog_tags" /> </block> </reference> <reference name="top.links"> <block type="blog/blog" name="add.blog.link"> <action method="addTopLink" ifconfig="blog/menu/top"></action> <block type="blog/tags" name="blog_tags" /> </block> </reference> <reference name="head"> <action method="addItem"><type>skin_css</type><name>aw_blog/css/style.css</name></action> </reference> </default> <blog_index_index> <reference name="content"> <block type="blog/blog" name="blog" template="aw_blog/blog.phtml"/> </reference> </blog_index_index> <blog_index_list> <reference name="content"> <block type="blog/blog" name="blog" template="aw_blog/blog.phtml"/> </reference> </blog_index_list> <blog_post_view> <reference name="content"> <block type="blog/post" name="post" template="aw_blog/post.phtml"> <block type="socialbookmarking/bookmarks" name="bookmarks" template="bookmarks/bookmarks.phtml"/> </block> </reference> </blog_post_view> <blog_cat_view> <reference name="content"> <block type="blog/cat" name="cat" template="aw_blog/cat.phtml" /> </reference> </blog_cat_view> <blog_rss_index> <block type="blog/rss" output="toHtml" name="rss.blog.new"/> </blog_rss_index> </layout>

    Read the article

  • Java Synchronized Write Block

    - by ikurtz
    im new to java and i have a question regarding Synchronized. i have the following code for writing to network (simple implementation for now): public void networkSendData(byte[] data){ try { out.write(data); out.flush(); } catch (IOException e) { } } i was wondering if there is a need for block level Synchronized here as im am writing the whole data at once. or is there a chance for race condition? i ask because the data to write is coming for multiple sources. thank you.

    Read the article

  • Keeping track of dirty blocks on a block device

    - by mikeY
    I'm looking for a way to keep track of what blocks on a block device are modified after a point in time. How I eventually want to use this for is to keep two 2TB disks in sync, one which only comes online (connected through USB) once a month. Without knowing what blocks have been modified, I have to go through the whole 2TB every time. I'm using a recent GNU/Linux OS and have C and Python experience. I'm hoping to avoid writing kernel level code as I don't have any experience in that area whatsoever. My current theory is that there should be some hooks somewhere where my code can get called when a disk flush is performed. Any ideas?

    Read the article

  • Pass form data from block to a page view in Drupal

    - by abdesignuk
    I am using the location module and views module for a postcode search, which works fine in a page display using views. However I want the user to be able to enter their postcode into a block on the homepage and clicking submit my module sends them to the page created in views and the postcode is set as a session S_SESSION['postcode'] before sending to this page, next I want the location page to load but using the session to display the locations automatically. Any ideas I am using hook_form_submit() and inside that declaring the $form_state as a session and then using $form_state['redirect'] to sent to the views page path.

    Read the article

  • Block call in Ruby on Rails

    - by Mattias
    Hi, I'm trying to clean up my code and get rid of a lot of ugly hashes. In my views I define several actions like this: @actions = { :interest => {'Show interest', link_to(..), :disabled => true}, :follow => {'Follow this case', link_to(..)} ... } As these hashes grow, the maintainability decreases. I want to convert the above format to something like: actions do item :interest, 'Show interest', link_to(..), :disabled => true item :follow, 'Follow', link_to(..) ... end How do I structure my helper methods to allow this? Preferably the 'item'-method should only be available in the 'actions' block and not in the global scope. Thanks!

    Read the article

  • My mental block - struggling to learn Objective C

    - by iqessar
    Hello people, this would be my first question after signing up! Anyway heres my question, I did Java at university and I was always told I am a good programmer. However I never pursued it as a career - I went into support and management instead. Im pretty much bored with my job, I have therefore started to learn Objective C so that I can develop apps for the iphone. I am currently watching several different Videos / Books. My problem is that when I go through the Apple documentation, although I understand most of it, sometimes I stumble. I believe that because you/we have the Apple documentation (i.e. Framework references) , everything should be clear, and therefore you should have no need to refer to a book or video (in order to learn how to use a particular class). But I alway do refer to a book and video and subsequently feel guilty as I believe the framework reference should be enough. (I therefore feel I am not up to being a programmer) I also believe that you shouldn't need example code in order to learn how to use a particular class because Apple provides documentation for each class, but AGAIN I find my self googling example code and I find my answer like that - again I feel guilty for doing this. Am I right in saying that Apple documentation is simply not clear? and that its ok to refer to a video/book or google? or forums for that matter? I have proffesional programmers who tell me that I am worrying too much and that I should get on with it and use all the resources that I have. I just cant seem to get round this mental block that I have in my head. When I start a programming project I am able to use the excellent search skills that I have to find the code I need, copy and paste it (yes I do understand it) BUT then I feel guilty telling myself that why didn't you think up the code yourself???? Therefore your not a real programmer, your just good at googling. Currently I am going through 20+ books so that I can learn most of the frameworks, syntax etc to develop iphone apps. I believe if I do this, then when I think of a project I can make it quickly. Should I read a few books, like 2-3 and then just start a project /app , and if I get stuck just google it and get the code I need? Can anybody please answer my questions?

    Read the article

  • Running in to some issues with Tumblr's Theme Parser

    - by Kylee
    Below part of a tumblr theme I'm working on and you will notice that I use the {block:PostType} syntax to declare the opening tag of each post, which is a <li> element in an Ordered List. This allows me to not only dynamicly set the li's class based on the type of post but cuts down on the number of times I'm calling the ShareThis JS which was really bogging down the page. This creates a new issue though which I believe is a flaw in Tumblr's parser. Each post is an ordered list with one <li> element in it. I know I could solve this by having each post as a <div> but I really like the control and semantics of using a list. Tumblr gurus? Suggestions? Sample of code: {block:Posts} <ol class="posts"> {block:Text} <li class="post type_text" id="{PostID}"> {block:Title} <h2><a href="{Permalink}" title="Go to post '{Title}'.">{Title}</a></h2> {/block:Title} {Body} {/block:Text} {block:Photo} <li class="post type_photo" id="{PostID}"> <div class="image"> <a href="{LinkURL}"><img src="{PhotoURL-500}" alt="{PhotoAlt}"></a> </div> {block:Caption} {Caption} {/block:Caption} {/block:Photo} {block:Photoset} <li class="post type_photoset" id="{PostID}"> {Photoset-500} {block:Caption} {Caption} {/block:Caption} {/block:Photoset} {block:Quote} <li class="post type_quote" id="{PostID}"> <blockquote> <div class="quote_symbol">&ldquo;</div> {Quote} </blockquote> {block:Source} <div class="quote_source">{Source}</div> {/block:Source} {/block:Quote} {block:Link} <li class="post type_link" id="{PostID}"> <h2><a href="{URL}" {Target} title="Go to {Name}.">{Name}</a></h2> {block:Description} {Description} {/block:Description} {/block:Link} {block:Chat} <li class="post type_chat" id="{PostID}"> {block:Title} <h2><a href="{Permalink}" title="Go to post {PostID} '{Title}'.">{Title}</a></h2> {/block:Title} <table class="chat_log"> {block:Lines} <tr class="{Alt} user_{UserNumber}"> <td class="person">{block:Label}{Label}{/block:Label}</td> <td class="message">{Line}</td> </tr> {/block:Lines} </table> {/block:Chat} {block:Video} <li class="post type_video" id="{PostID}"> {Video-500} {block:Caption} {Caption} {/block:Caption} {/block:Video} {block:Audio} <li class="post type_audio" id="{PostID}"> {AudioPlayerWhite} {block:Caption} {Caption} {/block:Caption} {block:ExternalAudio} <p><a href="{ExternalAudioURL}" title="Download '{ExternalAudioURL}'">Download</a></p> {/block:ExternalAudio} {/block:Audio} <div class="post_footer"> <p class="post_date">Posted on {ShortMonth} {DayOfMonth}, {Year} at {12hour}:{Minutes} {AmPm}</p> <ul> <li><a class="comment_link" href="{Permalink}#disqus_thread">Comments</a></li> <li><script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=722e181d-1d8a-4363-9ebe-82d5263aea94&amp;type=website"></script></li> </ul> {block:PermalinkPage} <div id="disqus_thread"></div> <script type="text/javascript" src="http://disqus.com/forums/kyleetilley/embed.js"></script> <noscript><a href="http://disqus.com/forums/kyleetilley/?url=ref">View the discussion thread.</a></noscript> {/block:PermalinkPage} </div> </li> </ol> {/block:Posts}

    Read the article

  • Resource Acquisition is Initialization in C#

    - by codeWithoutFear
    Resource Acquisition Is Initialization (RAII) is a pattern I grew to love when working in C++.  It is perfectly suited for resource management such as matching all those pesky new's and delete's.  One of my goals was to limit the explicit deallocation statements I had to write.  Often these statements became victims of run-time control flow changes (i.e. exceptions, unhappy path) or development-time code refactoring. The beauty of RAII is realized by tying your resource creation (acquisition) to the construction (initialization) of a class instance.  Then bind the resource deallocation to the destruction of that instance.  That is well and good in a language with strong destructor semantics like C++, but languages like C# that run on garbage-collecting runtimes don't provide the same instance lifetime guarantees. Here is a class and sample that combines a few features of C# to provide an RAII-like solution: using System; namespace RAII { public class DisposableDelegate : IDisposable { private Action dispose; public DisposableDelegate(Action dispose) { if (dispose == null) { throw new ArgumentNullException("dispose"); } this.dispose = dispose; } public void Dispose() { if (this.dispose != null) { Action d = this.dispose; this.dispose = null; d(); } } } class Program { static void Main(string[] args) { Console.Out.WriteLine("Some resource allocated here."); using (new DisposableDelegate(() => Console.Out.WriteLine("Resource deallocated here."))) { Console.Out.WriteLine("Resource used here."); throw new InvalidOperationException("Test for resource leaks."); } } } } The output of this program is: Some resource allocated here. Resource used here. Unhandled Exception: System.InvalidOperationException: Test for resource leaks. at RAII.Program.Main(String[] args) in c:\Dev\RAII\RAII\Program.cs:line 40 Resource deallocated here. Code without fear! --Don

    Read the article

  • Nginx Browser Caching using HTTP Headers outside server/location block

    - by Danny O'Sullivan
    I am having difficulty setting the HTTP expires headers for Nginx outside of specific server (and then location) blocks. What I want is to something like the following: location ~* \.(png|jpg|jpeg|gif|ico)$ { expires 1y; } But not have to repeat it in every single server block, because I am hosting a large number of sites. I can put it in every server block, but it's not very DRY. If I try to put that into an HTTP block or outside of all other blocks, I get "location directive is not allowed here." It seems I have to put it into a server block, and I have a different server block for every virtual host. Any help/clarification would be appreciated.

    Read the article

  • XHTML validating block level element as a link

    - by Matty F
    I need a way to make an entire DL element clickable with only one anchor tag, that validates as XHTML. As in: <a> <dl> <dt>Data term</dt> <dd>Data definition</dd> </dl> </a> This currently doesn't validate as XHTML as the anchor tag cannot contain the DL. The only way I can get it to validate is if I make two anchor tags and place them inside DT and DD. As in: <dl> <dt><a>Data term</a></dt> <dd><a>Data definition</a></dt> </dl> I'm trying to avoid this, as it would result in two href attributes requiring maintenance, introducing the possibility they could become out of sync. Suggestions?

    Read the article

  • python subprocess block

    - by MW
    Hello. I'm having a problem with the module subprocess. I'm running a script from python through: subprocess.Popen('./run_pythia.sh',shell=True).communicate() and sometimes it just blocks and it doesn't finish to execute the script. Before I was using .wait() instead of .communicate() but then because of this: http://dcreager.net/2009/08/06/subprocess-communicate-drawbacks/ I changed to .communicate(). Nevertheless the problem continues. Can anyone help me?

    Read the article

  • Twig templates, inheritances and block usage

    - by user846226
    I've created three templates using Twig. The first one has block A defined in it, the second one extends from the first one, but includes a third template which sets the content of block A. When loading, through the browser, the url which renders b.html.twig, the content in block A (defined by the 3th template) is not positioned block _A is defined. Example: <!-- base.html.twig --> {% block _css '' %} {% block _header '' %} {% block _content '' %} {% block _footer '' %} {% block _js '' %} <!-- layout.html.twig --> <!-- header and footer are placed in the raight zone --> {% extends ::base.html.twig %} {% block _header %} {% render "MyBundleBundle:Header:header" %} {% endblock %} {% block _footer %} {% render "MyBundleBundle:Footer:footer" %} {% endblock %} <!-- my_template.html.twig --> <!-- content is also placed in the right zone but css and js blocks in the included template are not placed where declared in base.html.twig --> {% extends MyBundleBundle::layout.html.twig %} {% block _content %} SOME_CONTENT {% include MyBundleBundle::my_included_template.html.twig %} {% endblock %} <!-- my_included_template.html.twig --> {% block _css %} <link.......................> {% endblock %} {% block _js %} <script..................> {% endblock %} MORE CONTENT BELONGING TO THE INCLUDED TEMPLATE What i expect here is, _css blocks content to appear on top of the page and _js block content at the bottom, but that's not happening. I hope you can see where i'm going wrong, thanks!

    Read the article

  • Block All Keyboard Input in a Linux Application (Using Qt or Mono)

    - by Evans
    Hi, I'm working on a online quiz client where we use a dedicated custom-made linux distro which contains only the quiz client software along with text editors and other utility software. When the user has started the quiz, I want to prevent him/her from minimizing the window/closing it/switching to the desktop or other windows. The quizzes can be attempted using only the mouse, so I need the keyboard to be completed disabled for the period of the quiz. How could I do this, using Qt or Mono? I'm ready to use any low-level libraries/drivers, if required. Thanks Evans

    Read the article

  • Array Concatenation in C#

    - by Betamoo
    1- How to smartly initialize an Array with 2 (or more) other arrays in C#? double[] d1=new double[5]; double[] d2=new double[3]; double[] dTotal=new double[8];// I need this to be {d1 then d2} 2- Another question: How to concatenate C# arrays efficiently? Thanks

    Read the article

  • I'm confused with block in ruby, compared to smalltalk.

    - by weakish
    What does block in ruby mean? It looks similar with smalltalk, but you can't send messages to it. For example, in smalltalk: [:x | x + 3] value: 3 returns 6. But in ruby: {|x| x + 3}.call 3 will cause SyntaxError. Well, you can pass messages to lambda in ruby, though: irb(main):025:0> ->(x){x+3}.call 3 => 6 So in ruby, block is not a block, but lambda is a block? Is this true? I mean, are there any differences between ruby lambda and smalltalk block? If this is true, then what is ruby block?

    Read the article

  • Block Fortress is an Awesome Tower Defense Game

    - by Akemi Iwaya
    What do you get when you mix Minecraft, tower defense, and a first-person shooter together? Block Fortress! This awesome game combines the best aspects of three game types into one unique, action-packed romp for survival and victory. Keep in mind that the game has quite a bit going on, so we will only be able to offer a quick glimpse with our post. Also, it may take a few minutes to become familiar with how to maneuver around in the game area using various gestures on your device’s screen. From the Block Fortress homepage: It offers more than 30 different building blocks, 16 different turret blocks, and tons of additional items to build (including mining blocks, lumber blocks, storage crates, power generators, and much more). It also includes many different weapon and item upgrades for your character – all brought to bear against the relentless attacks of the Goblocks! Block Fortress currently comes with three modes of game play: Survival, Quickstart, and Sandbox. As you can see, there should be more modes available at a later date. There are many types of terrain to choose from, or if you wish you can select Random for a nice surprise. For our example we chose Snowy Hills. Time to have a look around and find a nice spot to set up our barracks… This spot looks like it will do rather nicely… Just for fun we set up a castle-style set of walls and entry point for our barracks. Now on to fun and adventure! You can see what the game looks like in action with the official launch trailer… Price: 0.99 (U.S.) Block Fortress [iTunes App Store] Block Fortress Homepage Official Block Fortress Launch Trailer [YouTube]    

    Read the article

  • Use IIS Application Initialization for keeping ASP.NET Apps alive

    - by Rick Strahl
    Ever want to run a service-like, always-on application inside of ASP.NET instead of creating a Windows Service or running a Console application? Need to make sure that your ASP.NET application is always running and comes up immediately after an Application Pool restart even if nobody hits your site? The IIS Application Initialization Module provides this functionality in IIS 7 and later, making it much easier to create always-on ASP.NET applications that can act like a service.

    Read the article

  • Reduce Repetitive Initialization Code in C++ Applications by Using Delegating Constructors

    You're often required to repeat identical pieces of initialization code in every constructor of a class that declares multiple constructors. That's because unlike a few other programming languages, The C++ programming language doesn't allow a constructor to call another constructor of the same class. Luckily, this problem is about to disappear with the recent approval of a new C++0x feature called delegating constructors which are explained in this C++ tutorial.

    Read the article

  • When encrypting data that is not an even multiple of the block size do I have to send a complete las

    - by WilliamKF
    If I am using a block cipher such as AES which has a block size of 128 bits, what do I do if my data is not an even multiple of 128 bits? I am working with packets of data and do not want to change the size of my packet when encrypting it, yet my data is not an even multiple of 128? Does the AES block cipher allow handling of a final block that is short without changing the size of my message once encrypted?

    Read the article

  • "initialization error: class file has wrong version" message in JDeveloper 10.1.2.x

    - by [email protected]
    The "initialization error: class file has wrong version" has become a somewhat recurrent error message thrown by JDeveloper 10.1.2.x as newer JDKs have been released in the last years. Note that JDeveloper 10.1.2 was developed to run with JDK 1.4.2. The reasons for this error message to be thrown include: A JDK version higher than 1.4.2 is being used and some unexpected incompatibility conflicts can occur because of that Some of the libraries used on the workspace and/or project were compiled with newer JDK version So, it is strongly recommended to use newer JDeveloper versions (10.1.3 - 11g) for newer JDKs. JDeveloper 10.1.2 will be desupported in December 2010 (or later depending on the support contract). Further information about this can be seen at http://www.oracle.com/support/library/brochure/lifetime-support-middleware.pdf

    Read the article

  • SOA Suite 11g: Unable to start domain (Error occurred during initialization of VM)

    - by Chris Tomkins
    If you have recently installed SOA Suite, created a domain and then tried to start it only to find it fails with the error: Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. the solution is to edit the file <domain home>\bin\setSOADomainEnv.cmd/sh (depending on your platform) and modify the line: set DEFAULT_MEM_ARGS=-Xms512m -Xmx1024m to something like: set DEFAULT_MEM_ARGS=-Xms512m -Xmx768m Save the file and then try to start your domain again. Everything should now work at least it does on the Dell Latitude 630 laptop with 4Gb RAM that I have. Technorati Tags: soa suite,11g,java,troubleshooting,problems,domain

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >