Search Results

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

Page 12/338 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • How to write constructors which might fail to properly instantiate an object

    - by whitman
    Sometimes you need to write a constructor which can fail. For instance, say I want to instantiate an object with a file path, something like obj = new Object("/home/user/foo_file") As long as the path points to an appropriate file everything's fine. But if the string is not a valid path things should break. But how? You could: 1. throw an exception 2. return null object (if your programming language allows constructors to return values) 3. return a valid object but with a flag indicating that its path wasn't set properly (ugh) 4. others? I assume that the "best practices" of various programming languages would implement this differently. For instance I think ObjC prefers (2). But (2) would be impossible to implement in C++ where constructors must have void as a return type. In that case I take it that (1) is used. In your programming language of choice can you show how you'd handle this problem and explain why?

    Read the article

  • CQRS applicability when some commands need to block the UI

    - by regularfry
    I am working on an app which I would dearly love to transition from a fairly traditional layered architecture to CQRS, for a number of reasons, not least fo which is that having a robust event log will make adding a couple of feature requests I can see barrelling towards me trivial to accomodate. Now, I have a conceptual problem: of around 40 commands the user can initiate, there are three which the user needs to be sure have successfully completed before the UI lets them do anything else. Everything else fits into the "submit a request, query for success later" model, except for these three commands. How is this handled in CQRS-land? Do I separate the three blocking commands to effectively a third service, so I have Commands, Queries, and BlockingCommands? Do I have a two-stage event processor with an in-request blocking first stage which only gets used for the blocking commands? Does the existence of these three commands mean that the whole idea of applying CQRS is invalid? Should I just pretend they aren't blocking and poll for success in the UI? I'm sure this must come up on other projects, how is it usually handled?

    Read the article

  • new block adding error

    - by ata ur rehman
    g++: error: ./gr_my_swig.cc: No such file or directory g++: fatal error: no input files compilation terminated. make[3]: *** [_gr_my_swig_la-gr_my_swig.lo] Error 1 make[3]: Leaving directory `/home/ataurrehman/gr-my-basic/swig' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/ataurrehman/gr-my-basic/swig' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/ataurrehman/gr-my-basic' make: *** [all] Error 2

    Read the article

  • Can I block social share buttons with Privoxy?

    - by gojira
    A great many pages have these "Like", "Tweet", "G+1", "share" row of buttons all over the place and in each post in threads. Can I block these unwanted context with Privoxy? I am already using Privoxy and it blocks a lot of unwanted content, but still these "social" buttons are all over the place. I want to completely remove these buttons specifically by using Privoxy. I know that it is possible to block using AdBlock LITE and other software, but my question is specific to Privoxy (reason, I want one point to block all unwanted content and it needs to work on devices / softwares which do not have AdBlock LITE, therefore I use Privoxy). -- Software used: Privoxy 3.0.21 under Windows XP

    Read the article

  • returning a heap block by reference in c++

    - by basicR
    I was trying to brush up my c++ skills. I got 2 functions: concat_HeapVal() returns the output heap variable by value concat_HeapRef() returns the output heap variable by reference When main() runs it will be on stack,s1 and s2 will be on stack, I pass the value by ref only and in each of the below functions, I create a variable on heap and concat them. When concat_HeapVal() is called it returns me the correct output. When concat_HeapRef() is called it returns me some memory address (wrong output). Why? I use new operator in both the functions. Hence it allocates on heap. So when I return by reference, heap will still be VALID even when my main() stack memory goes out of scope. So it's left to OS to cleanup the memory. Right? string& concat_HeapRef(const string& s1, const string& s2) { string *temp = new string(); temp->append(s1); temp->append(s2); return *temp; } string* concat_HeapVal(const string& s1, const string& s2) { string *temp = new string(); temp->append(s1); temp->append(s2); return temp; } int main() { string s1,s2; string heapOPRef; string *heapOPVal; cout<<"String Conact Experimentations\n"; cout<<"Enter s-1 : "; cin>>s1; cout<<"Enter s-2 : "; cin>>s2; heapOPRef = concat_HeapRef(s1,s2); heapOPVal = concat_HeapVal(s1,s2); cout<<heapOPRef<<" "<<heapOPVal<<" "<<endl; return -9; }

    Read the article

  • Drupal 7: Documents as a node/block/field

    - by WernerCD
    I'm working on my first Drupal site. I've progressed in learning the basics . I still have a lot to learn tho. Using FileViewer I can load a PDF saved in a field, for view content of various types. I haven't found something that does the same for Word Docs, Excel, PDF, etc. Does anyone know of something that works in Drupal 7 to load documents other than PDF like FileViewer does inside a browser? Or like Scribd does (Scribd is hosted. I am behind a firewall with limited access for users. So I don't want to use a Scribd like service.)

    Read the article

  • Block ip for long time

    - by Tiziano Dan
    This question is about a iptables, I wanna to know how can I block these ip for 1hour and not only a little time.. because they make to many sql requests, I'm using it for block but it's not enough because there's anyway 100k ip who attack then too much requests for sql server. iptables -N SYN-LIMIT iptables -A SYN-LIMIT -m hashlimit --hashlimit 8/second --hashlimit-mode srcip --hashlimit-name SYN-LIMIT -j RETURN iptables -A SYN-LIMIT -j DROP iptables -I INPUT -p tcp --dport 80 --syn -j SYN-LIMIT iptables -I INPUT -p tcp --dport 80 -m connlimit --connlimit-above 6 -j REJECT --reject-with tcp-reset How can I make the same but block IP for long time ? (Not manually !)

    Read the article

  • Privoxy rule to block Facebook spying

    - by bignose
    Recently, my server's Privoxy rules to block Facebook's spying have failed. How can I block current Facebook spying links? Since soon after [the inception of Facebook's so-called “Open Graph” cross-site tracking widgets][1] (those “Like” bugs on numerous websites), I blocked them by using this rule (in user.action) on our site's Privoxy server: { +block-as-image{People-tracking button.} } .facebook.com/(plugins|widgets)/(like|fan).* That worked fine; the spying bugs no longer appeared on any web page. Today I noticed that they're all making it past that filter [edit: no, they're not]. SOLUTION: The proxy was being silently ignored, though this was not obvious in the client. The above rule continues to work fine.

    Read the article

  • Block (or only allow certian) incoming IP addresses on Verizon FIOS Actiontec Router

    - by jmlumpkin
    I opened a few ports to the outside of my home network so I can get into a few of my machines from outside. When checking some logs, I noticed that I was getting scanned on some ports from various other countries. I already moved my port forward to a non-standard port. I would like to be able to block specific IP's (or even subnets) from my Verizon FIOS router. There is a little bit of documentation online, but I can't find anything specific on how to do this. To start, I just want to block a specific IP. But if it is not to hard, I would also like to know how to possibly block a range of IPs. And with the inverse of this - is there a way to allow only certain IPs or range?

    Read the article

  • block access to certain website types

    - by frustrated teacher
    Need to block access to certain website types without listing each URL to block. Students at secondary school are going to porn sites. Need to be able to block all such access without having to list each possible site URL. Having the Content -- Ratings tab set to None for all categories on the ratings files listed on my computers does not prevent access. Unchecking users may access sites with no rating, even with the security settings set to High, still allows the porn sites to come up. If that is checked, then ONLY listed sites can open and students would not be able to do any research via google, for example. I would rather not have to continue checking each computer and blocking sites as they find them.

    Read the article

  • best practice for initializing class members in php

    - by rgvcorley
    I have lots of code like this in my constructors:- function __construct($params) { $this->property = isset($params['property']) ? $params['property'] : default_val; } Is it better to do this rather than specify the default value in the property definition? i.e. public $property = default_val? Sometimes there is logic for the default value, and some default values are taken from other properties, which was why I was doing this in the constructor. Should I be using setters so all the logic for default values is separated?

    Read the article

  • Exchange 2007 automatically adding IP to block list

    - by Tim Anderson
    This puzzled me. We have all mail directed to an ISP's spam filter, then delivered to SBS 2008 Exchange. One of the ISP's IP numbers suddenly appeared in the ES2007 block list, set to expire in 24 hours I think, so emails started bouncing. Quick look through the typically ponderous docs, and I can't see anything that says Exchange will auto-block an IP number, but nobody is admitting to adding it manually and I think it must have done. Anyone know about this or where it is configured? Obviously one could disable block lists completely but I'd like to know exactly why this happened.

    Read the article

  • melonJS: Entity and solid block on collision layer

    - by Arthur Halma
    Actually I have my player entity with 64x64 sprite animation and 18x60 hitbox also the map is maded by 16x16 tiles. When my player goes some way he can pass through blocks (but not all of them). For example there are 4 situations: Good (player can't pass the tile with isSolid property on collision layer) Good (player can't pass the tile with isSolid property on collision layer) Bad (player pass the tile with isSolid property on collision layer) Bad (player pass the tile with isSolid property on collision layer) Looks like melonJS checks only corners of hitbox instead of whole rectangle. Can anyone help me in this situation.

    Read the article

  • Exchange 2007 automatically adding IP to block list

    - by Tim Anderson
    This puzzled me. We have all mail directed to an ISP's spam filter, then delivered to SBS 2008 Exchange. One of the ISP's IP numbers suddenly appeared in the ES2007 block list, set to expire in 24 hours I think, so emails started bouncing. Quick look through the typically ponderous docs, and I can't see anything that says Exchange will auto-block an IP number, but nobody is admitting to adding it manually and I think it must have done. Anyone know about this or where it is configured? Obviously one could disable block lists completely but I'd like to know exactly why this happened.

    Read the article

  • Why is an Add method required for { } initialization?

    - by Dan Tao
    To use initialization syntax like this: var contacts = new ContactList { { "Dan", "[email protected]" }, { "Eric", "[email protected]" } }; ...my understanding is that my ContactList type would need to define an Add method that takes two string parameters: public void Add(string name, string email); What's a bit confusing to me about this is that the { } initializer syntax seems most useful when creating read-only or fixed-size collections. After all it is meant to mimic the initialization syntax for an array, right? (OK, so arrays are not read-only; but they are fixed size.) And naturally it can only be used when the collection's contents are known (at least the number of elements) at compile-time. So it would almost seem that the main requirement for using this collection initializer syntax (having an Add method and therefore a mutable collection) is at odds with the typical case in which it would be most useful. I'm sure I haven't put as much thought into this matter as the C# design team; it just seems that there could have been different rules for this syntax that would have meshed better with its typical usage scenarios. Am I way off base here? Is the desire to use the { } syntax to initialize fixed-size collections not as common as I think? What other factors might have influenced the formulation of the requirements for this syntax that I'm simply not thinking of?

    Read the article

  • Spring bean initialization in a web app

    - by EugeneP
    We work with a web application and autowire beans using WebApplicationContextUtils in the init method. Could you clarify some details about bean initialization? The question rises from the static factory method. Suppose there's a bean that is created in a static factory method. As we can see, when the web app is deployed, the ContextLoaderListener initializes all the beans present in Spring xml config file. Now happens such a thing. In the static factory method we run a timer that starts ticking. But in reality we wouldn't want it to start ticking unless the bean is injected into a property of the object ! That is question number one - all the beans are automatically initialized on deploy - correct? And after that when we need an injection, it simply feels the link with the address of the object created during initialization, though OBJECT WAS CREATED ON WEB APP DEPLOY, immediately ! (I assume the default singleton-creation Spring behavior) Second question: are all copies of a web app use the same beans, so all beans are WEB-APP wide, every Spring bean is shared between all the copies of this web app running?

    Read the article

  • Any workarounds for non-static member array initialization?

    - by TomiJ
    In C++, it's not possible to initialize array members in the initialization list, thus member objects should have default constructors and they should be properly initialized in the constructor. Is there any (reasonable) workaround for this apart from not using arrays? [Anything that can be initialized using only the initialization list is in our application far preferable to using the constructor, as that data can be allocated and initialized by the compiler and linker, and every CPU clock cycle counts, even before main. However, it is not always possible to have a default constructor for every class, and besides, reinitializing the data again in the constructor rather defeats the purpose anyway.] E.g. I'd like to have something like this (but this one doesn't work): class OtherClass { private: int data; public: OtherClass(int i) : data(i) {}; // No default constructor! }; class Foo { private: OtherClass inst[3]; // Array size fixed and known ahead of time. public: Foo(...) : inst[0](0), inst[1](1), inst[2](2) {}; }; The only workaround I'm aware of is the non-array one: class Foo { private: OtherClass inst0; OtherClass inst1; OtherClass inst2; OtherClass *inst[3]; public: Foo(...) : inst0(0), inst1(1), inst2(2) { inst[0]=&inst0; inst[1]=&inst1; inst[2]=&inst2; }; }; Edit: It should be stressed that OtherClass has no default constructor, and that it is very desirable to have the linker be able to allocate any memory needed (one or more static instances of Foo will be created), using the heap is essentially verboten. I've updated the examples above to highlight the first point.

    Read the article

  • Putting a block inside another in Django

    - by hekevintran
    I have a Django template that I want to extend in multiple places. In some the div must be inside a form, and in others it must not be. To do this I put a block above and below the div so I could add and in them respectively. Desired: <form> <div class="my_div"> {% block div_content %} ... {% endblock %} </div> </form> Template: {% block div_top %}{% endblock %} <div class="my_div"> {% block div_content %} {% endblock %} </div> {% block div_bottom %}{% endblock %} Looking at this I can't help but think that there is a better way to do it. What is the standard Django way of doing this?

    Read the article

  • Define new Drupal theme region inside a block

    - by oalo
    I have a footer block, and I need to print a block inside that block. So i have defined the new region inside my theme.info file, cleared caches, enabled PHP code input, and written this code inside the footer block: <div class="grid-4 suffix-4 omega"> <?php if ($footer-right): ?> <div id="footer-right"> <?php print $footer-right; ?> </div> </div> I have configured a block to appear inside the new region (which appears in the blocks admin page), but it doesnt show. Any idea about what may be happening? Thank you

    Read the article

  • In Java, can a final field be initialized from a constructor helper?

    - by csj
    I have a final non-static member: private final HashMap<String,String> myMap; I would like to initialize it using a method called by the constructor. Since myMap is final, my "helper" method is unable to initialize it directly. Of course I have options: I could implement the myMap initialization code directly in the constructor. MyConstructor (String someThingNecessary) { myMap = new HashMap<String,String>(); myMap.put("blah","blahblah"); // etc... // other initialization stuff unrelated to myMap } I could have my helper method build the HashMap, return it to the constructor, and have the constructor then assign the object to myMap. MyConstructor (String someThingNecessary) { myMap = InitializeMyMap(someThingNecessary); // other initialization stuff unrelated to myMap } private HashMap<String,String> InitializeMyMap(String someThingNecessary) { HashMap<String,String> initializedMap = new HashMap<String,String>(); initializedMap.put("blah","blahblah"); // etc... return initializedMap; } Method #2 is fine, however, I'm wondering if there's some way I could allow the helper method to directly manipulate myMap. Perhaps a modifier that indicates it can only be called by the constructor? MyConstructor (String someThingNecessary) { InitializeMyMap(someThingNecessary); // other initialization stuff unrelated to myMap } // helper doesn't work since it can't modify a final member private void InitializeMyMap(String someThingNecessary) { myMap = new HashMap<String,String>(); myMap.put("blah","blahblah"); // etc... }

    Read the article

  • problem when view the super block in ext3 file system

    - by xuczhang
    I tried to view the superblock by command "dd" in ext3 file system. dd if=/dev/sda3 bs=4096 skip=1 count=1 of=superblock But the result in superblock file is not correct(I compare the value of Inodes count I got from dumpe2fs). The device file /dev/sda3 is started at the boot block and then the superblock of the group0? And another question is the boot block and superblock's size are both BLOCKSIZE(here is 4096)? The disk format of ext2/ext3(I think they are the same) are shown below:

    Read the article

  • Where does apache store initialization state for mod_proxy_balancer

    - by khoxsey
    I run apache2 on Ubuntu as a caching load-balancing reverse proxy in front of a group of application servers. I have noticed that the balancer maintains some state for some of the attributes visible in /balancer-manager such as whether an IP is enabled/disabled, load factor, etc. My site has periods of high (and low) usage, and recently as I added a new server to the working group I noticed that the load balancer picked up the new server but had it set to Disabled. I'm curious where that data is stored, and/or how it is initialized.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >