Search Results

Search found 646 results on 26 pages for 'restriction'.

Page 18/26 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • What is the possible benefit (if any) of allowing recursive contructors?

    - by Penang
    In Java, constructors cannot be recursive. Compile time error: "recursive constructor invocation". Let's assume that we did not have this restriction. Things to keep in mind: The return type of a constructor is void. Since it is a void method you can't harness the complete power of recursion. A constructor can invoke itself (or any other constructor) using this(). But a "call to this must be first statement in constructor" We could use non local data between consecutive calls to still have some possible gain from recursive constructors. Would there be any benefit from allowing recursive constructors?

    Read the article

  • Strict pointer aliasing: any solution for a specific problem?

    - by doublep
    I have a problem caused by breaking strict pointer aliasing rule. I have a type T that comes from a template and some integral type Int of the same size (as with sizeof). My code essentially does the following: T x = some_other_t; if (*reinterpret_cast <Int*> (&x) == 0) ... Because T is some arbitary (other than the size restriction) type that could have a constructor, I cannot make a union of T and Int. (This is allowed only in C++0x only and isn't even supported by GCC yet). Is there any way I could rewrite the above pseudocode to preserve functionality and avoid breaking strict aliasing rule? Note that this is a template, I cannot control T or value of some_other_t; the assignment and subsequent comparison do happen inside the templated code. (For the record, the above code started breaking on GCC 4.5 if T contains any bit fields.)

    Read the article

  • Poster image on embedded youtube video

    - by Srijan Deshpande
    Hi, I want to embed a youtube video on my website and I need to replace the default poster image that shows up on the video with a jpg of my own. The default image that shows up is a scaled-up thumbnail and is therefore very blurry and pixelated and I need to use a hi-res jpg in place of it. I'm aware that youtube only allows us to pick one of three auto-generated thumbnails, but does that restriction also apply to youtube videos embedded on an external website? If so, is there an alternate way to do this? Thanks!

    Read the article

  • BizTalk external assembly namespace and static methods

    - by SteveC
    Is there some restriction in BizTalk 2006 R2 to accessing static methods in external assemblies when the assembly has a "." in the name ? I have the solution set-up with the BizTalk project "FooBar", and the external assembly project "FooBar.Helper" (strongly signed and GAC'ed) with a class "Demo" (public and serializable), which is referenced in the BizTalk project I can create a BizTalk variable of type "FooBar.Helper.Demo" and access an instance method fine, but an expression window the Intellisense shows the FooBar namespace, but if I dot it, I get the error "illegal dotted name" ??? However I can add another project, "ExtComp" with class "Test" and it's static methods are displayed in Intellisense !!! The only difference I can see is the first external assembly has the dot in it

    Read the article

  • UDF function with library dependencies on MySQL 5.1

    - by Fredrik
    I'm having a problem with a MySQL UDF function (mychem.sourceforge.net) that's dependent on a large library (openbabel.org) which is in turn plugin based. The problem is that the format plugins to openbabel doesn't seem to load in MySQL 5.1 and I suspect it might be due to the plugin_dir setting. I have set plugin_dir to /usr/lib/ which is the location for both libmychem.so and libopenbabel.so as well as the directory openbabel that contains the format plugins. Is there a way to turn off the plugin_dir restriction in MySQL (preferably without compiling MySQL from sources) so that I can test this hypothesis or do you have a different idea on what might cause the problem? All this is done on Ubuntu 10.04 (but I had the same kind of problems on 8.04, where I managed to get it working after a lot of steps that I unfortunately have forgotten...) I have turned off apparmor during testing and it doesn't help either.

    Read the article

  • printing using one '\n'

    - by Alex
    I am pretty sure all of you are familiar with the concept of the Big4, and I have several stuffs to do print in each of the constructor, assignment, destructor, and copy constructor. The restriction is this: I CAN'T use more than one newline (e.g., ƒn or std::endl) in any method I can have a method called print, so I am guessing print is where I will put that precious one and only '\n', my problem is that how can the method print which prints different things on each of the element I want to print in each of the Big4? Any idea? Maybe overloading the Big4?

    Read the article

  • Why can't I start XML entity names with 'xml''?

    - by flamey
    <XmlInfo /> I ran into problem using Perl's popular SOAP::Lite module, where it wouldn't accept XML entity names starting with "xml" (regardles letters' case). The author of the module replied to email saying that entity names starting with "xml" are not permitted in XML specification, but I couldn't find it in W3C's documents for 1.0 and 1.1 specs, I also couldn't find it in any of the articles or guidelines docs about XML entity naming. In fact some guideline documents used names starting with xml as an example, and lots of people are using it, as I see via Google Code Search. So are there any restrictions (besides which characters to use as defined in W3C's documents) in Entity naming in XML? Is there a restriction saying you can't name entities starting with "xml"?

    Read the article

  • getJSON for dropbox data

    - by gheil.apl
    Although i used getJSON in http://jsbin.com/dbJSON/edit i have not been able to connect with any of my own made up data. i tried 4, and the example at Flickr for "cats". Only the latter worked... this is the output: {assoc: null,assoc.js: null,stub: null,stub.js: null,cat: [object Object]} i am at that "base", as i did get the image there, but db.tgu.ca/repsychal/poems/10/0512-g2g/assoc.json db.tgu.ca/repsychal/poems/10/0512-g2g/assoc.js db.tgu.ca/repsychal/poems/10/0512-g2g/stub.json db.tgu.ca/repsychal/poems/10/0512-g2g/stub.js were all invisible==null! (they are all URL, just put h t t p //: in front ... a restriction on the # of URL in a post) How do i get "my" data into the page?

    Read the article

  • htpasswd, secure specific files in zend framework

    - by AKFourSeven
    Hi I have been bashing my head against the wall with this riddle and cannot find the way to solve this. I would like to secure couple of files to restrict access to certain pages but my attempts so far are unsuccessful. I do not want to use Zend Auth as it is a very small web site doing simple stuff. Here is a sample of what I have done: AuthUserFile /path/to/my/.htpasswd AuthName "Admin Restriction" AuthType Basic <Files file.phtml> require valid-user </Files> Is there any way to achieve this ?

    Read the article

  • Import module stored in a cStringIO data structure vs. physical disk file

    - by Malcolm
    Is there a way to import a Python module stored in a cStringIO data structure vs. physical disk file? It looks like "imp.load_compiled(name, pathname[, file])" is what I need, but the description of this method (and similar methods) has the following disclaimer: Quote: "The file argument is the byte-compiled code file, open for reading in binary mode, from the beginning. It must currently be a real file object, not a user-defined class emulating a file." [1] I tried using a cStringIO object vs. a real file object, but the help documentation is correct - only a real file object can be used. Any ideas on why these modules would impose such a restriction or is this just an historical artifact? Are there any techniques I can use to avoid this physical file requirement? Thanks, Malcolm [1] http://docs.python.org/library/imp.html#imp.load_module

    Read the article

  • Technique to limit number of instances of our application under Terminal Server

    - by Malcolm
    I'm looking for simple ways to monitor and limit the number of instances of our application under Terminal Server (2003 and 2008). The purpose of this restriction is to make sure we don't overload our servers. This is an internal administrative requirement - I am not looking for a licensing solution. The application in question is written in Python 2.6 (32-bit) but I'm happy to receive development tool agnostic answers. Although we are not using Citrix, I am happy to receive Citrix related ideas with the hope that I can use a similar technique with Terminal Server. Thank you, Malcolm

    Read the article

  • Can any function be a deleted-function?

    - by Caspin
    The working draft explicitly calls out that defaulted-functions must be special member functions (eg copy-constructor, default-constructor, etc). Which makes perfect sense. However, I don't see any such restriction on deleted-functions. Is that right? Or in other words are these three examples valid c++0? struct Foo { // 1 int bar( int ) = delete; }; // 2 int baz( int ) = delete; template< typename T > int boo( T t ); // 3 template<> int boo<int>(int t) = delete;

    Read the article

  • Optimizing python code performance when importing zipped csv to a mongo collection

    - by mark
    I need to import a zipped csv into a mongo collection, but there is a catch - every record contains a timestamp in Pacific Time, which must be converted to the local time corresponding to the (longitude,latitude) pair found in the same record. The code looks like so: def read_csv_zip(path, timezones): with ZipFile(path) as z, z.open(z.namelist()[0]) as input: csv_rows = csv.reader(input) header = csv_rows.next() check,converters = get_aux_stuff(header) for csv_row in csv_rows: if check(csv_row): row = { converter[0]:converter[1](value) for converter, value in zip(converters, csv_row) if allow_field(converter) } ts = row['ts'] lng, lat = row['loc'] found_tz_entry = timezones.find_one(SON({'loc': {'$within': {'$box': [[lng-tz_lookup_radius, lat-tz_lookup_radius],[lng+tz_lookup_radius, lat+tz_lookup_radius]]}}})) if found_tz_entry: tz_name = found_tz_entry['tz'] local_ts = ts.astimezone(timezone(tz_name)).replace(tzinfo=None) row['tz'] = tz_name else: local_ts = (ts.astimezone(utc) + timedelta(hours = int(lng/15))).replace(tzinfo = None) row['local_ts'] = local_ts yield row def insert_documents(collection, source, batch_size): while True: items = list(itertools.islice(source, batch_size)) if len(items) == 0: break; try: collection.insert(items) except: for item in items: try: collection.insert(item) except Exception as exc: print("Failed to insert record {0} - {1}".format(item['_id'], exc)) def main(zip_path): with Connection() as connection: data = connection.mydb.data timezones = connection.timezones.data insert_documents(data, read_csv_zip(zip_path, timezones), 1000) The code proceeds as follows: Every record read from the csv is checked and converted to a dictionary, where some fields may be skipped, some titles be renamed (from those appearing in the csv header), some values may be converted (to datetime, to integers, to floats. etc ...) For each record read from the csv, a lookup is made into the timezones collection to map the record location to the respective time zone. If the mapping is successful - that timezone is used to convert the record timestamp (pacific time) to the respective local timestamp. If no mapping is found - a rough approximation is calculated. The timezones collection is appropriately indexed, of course - calling explain() confirms it. The process is slow. Naturally, having to query the timezones collection for every record kills the performance. I am looking for advises on how to improve it. Thanks. EDIT The timezones collection contains 8176040 records, each containing four values: > db.data.findOne() { "_id" : 3038814, "loc" : [ 1.48333, 42.5 ], "tz" : "Europe/Andorra" } EDIT2 OK, I have compiled a release build of http://toblerity.github.com/rtree/ and configured the rtree package. Then I have created an rtree dat/idx pair of files corresponding to my timezones collection. So, instead of calling collection.find_one I call index.intersection. Surprisingly, not only there is no improvement, but it works even more slowly now! May be rtree could be fine tuned to load the entire dat/idx pair into RAM (704M), but I do not know how to do it. Until then, it is not an alternative. In general, I think the solution should involve parallelization of the task. EDIT3 Profile output when using collection.find_one: >>> p.sort_stats('cumulative').print_stats(10) Tue Apr 10 14:28:39 2012 ImportDataIntoMongo.profile 64549590 function calls (64549180 primitive calls) in 1231.257 seconds Ordered by: cumulative time List reduced from 730 to 10 due to restriction <10> ncalls tottime percall cumtime percall filename:lineno(function) 1 0.012 0.012 1231.257 1231.257 ImportDataIntoMongo.py:1(<module>) 1 0.001 0.001 1230.959 1230.959 ImportDataIntoMongo.py:187(main) 1 853.558 853.558 853.558 853.558 {raw_input} 1 0.598 0.598 370.510 370.510 ImportDataIntoMongo.py:165(insert_documents) 343407 9.965 0.000 359.034 0.001 ImportDataIntoMongo.py:137(read_csv_zip) 343408 2.927 0.000 287.035 0.001 c:\python27\lib\site-packages\pymongo\collection.py:489(find_one) 343408 1.842 0.000 274.803 0.001 c:\python27\lib\site-packages\pymongo\cursor.py:699(next) 343408 2.542 0.000 271.212 0.001 c:\python27\lib\site-packages\pymongo\cursor.py:644(_refresh) 343408 4.512 0.000 253.673 0.001 c:\python27\lib\site-packages\pymongo\cursor.py:605(__send_message) 343408 0.971 0.000 242.078 0.001 c:\python27\lib\site-packages\pymongo\connection.py:871(_send_message_with_response) Profile output when using index.intersection: >>> p.sort_stats('cumulative').print_stats(10) Wed Apr 11 16:21:31 2012 ImportDataIntoMongo.profile 41542960 function calls (41542536 primitive calls) in 2889.164 seconds Ordered by: cumulative time List reduced from 778 to 10 due to restriction <10> ncalls tottime percall cumtime percall filename:lineno(function) 1 0.028 0.028 2889.164 2889.164 ImportDataIntoMongo.py:1(<module>) 1 0.017 0.017 2888.679 2888.679 ImportDataIntoMongo.py:202(main) 1 2365.526 2365.526 2365.526 2365.526 {raw_input} 1 0.766 0.766 502.817 502.817 ImportDataIntoMongo.py:180(insert_documents) 343407 9.147 0.000 491.433 0.001 ImportDataIntoMongo.py:152(read_csv_zip) 343406 0.571 0.000 391.394 0.001 c:\python27\lib\site-packages\rtree-0.7.0-py2.7.egg\rtree\index.py:384(intersection) 343406 379.957 0.001 390.824 0.001 c:\python27\lib\site-packages\rtree-0.7.0-py2.7.egg\rtree\index.py:435(_intersection_obj) 686513 22.616 0.000 38.705 0.000 c:\python27\lib\site-packages\rtree-0.7.0-py2.7.egg\rtree\index.py:451(_get_objects) 343406 6.134 0.000 33.326 0.000 ImportDataIntoMongo.py:162(<dictcomp>) 346 0.396 0.001 30.665 0.089 c:\python27\lib\site-packages\pymongo\collection.py:240(insert) EDIT4 I have parallelized the code, but the results are still not very encouraging. I am convinced it could be done better. See my own answer to this question for details.

    Read the article

  • How to handle this type of model validation in Ruby on Rails

    - by randombits
    I have a controller/model hypothetically named Pets. Pets has the following declarations: :belongs_to owner :has_many dogs :has_many cats Not the best example, but again, it demonstrates what I'm trying to solve. Now when a request comes in as an HTTP POST to http://127.0.0.1/pets, I want to create an instance of Pets. The restriction here is, if the user doesn't submit at least one dog or one cat, it should fail validation. It can have both, but it can't be missing both. How does one handle this in Ruby on Rails? Dogs don't care if cats exists and the inverse is also true. Can anyone show some example code of what the Pets model would look like to ensure that one or the other exists, or fail otherwise? errors.add also takes an attribute, in this case, there is no particular attribute that's failing. It's almost a 'virtual' combination that's missing.

    Read the article

  • passing variable to a batch file

    - by sushant
    i am calling a batch file for xcopy. i have the path of the file to b copied in variable a. my code is: dim shell,z z="for.bat " & a & " " & b & " " & c set shell=createobject("wscript.shell") shell.Run z, 1, true where for.bat is: for %%f in (%1,%2,%3) do xcopy %%f D:\shipment\ /e when 'a' has small path like D:\flexcube, it works. but if i put some big path, say: D:\flexcube1\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder it does not work. is their some length restriction on %1 type variables or is this some other problem? any help is really appreciated.

    Read the article

  • How few a files does it take to load a program on Linux?

    - by BCS
    The (hypothetical for now) situation is the user of my system is going to be given a chunk of C code and needs my system to compile and run it in a chroot sandbox that is generated on the fly and I want to require the fewest files in the box as possible. I'm only willing to play with compiler and linker settings (e.g. static link everything I can expect to be able to find) and make some moderate restriction on what the code can expect use (e.g. they can't use arbitrary libs). The question is how simple can I get the sandbox. Clearly I need the executable, but what about an ELF loader and a .so for the system calls? Can I dump either of them and is there something else I'll need?

    Read the article

  • UDP + total order, non-reliable

    - by disown
    I'm trying to find a version of UDP which just alleviates the restriction of a maximum size of the message sent. I don't care about reliability or partial retransmission, if all chunks arrive I want the message to be assembled from the chunks in sending order and delivered to the listening app. If one or more chunks are missing I would just like to discard the message. The goal is to have a low-latency notification mechanism about real time data, but with the added support for bigger messages than what would fit in an IP datagram. I would like the protocol to be one way only, and not have long connection setup times. An optional feature to be able to respond to a received message wouldn't hurt (a concept of an unreliable connection), but is not necessary.

    Read the article

  • Managed C++ prospects

    - by Srikanth
    Has anyone tried coding in managed C++? I have a few questions : How productive is the language compared to C#? Is there any restriction on type of projects that can be written? Can we write a web application in managed C++? Is it possible to mix managed and unmanaged C++ code in one application? Is MFC still valid in managed C++? Will it be the best option when considering migration of a VC++ application?

    Read the article

  • Why can't I have static public fields in my managed beans?

    - by AlanObject
    I just started using the Netbeans 7.1 beta and it is calling out errors of a type which I have never seen before. Specifically: A managed bean with a public field should not declare any scope other than @Dependent. The fields it is complaining about are public static final. I can understand the restriction on non-static fields, but I can't think of a good reason this would not be allowed for a static field. Unfortunately I use a lot of them since I don't like having constants in my code. I note that even though I get the red dot in the margin in the editor, the maven-driven build still works and GlassFish still runs my application the way I would expect. So what is my denoument on this issue? Am I going to have to move my static fields elsewhere or is there another way of handling this?

    Read the article

  • integrity Constraints on a table.

    - by Dinesh
    See this sample schema Passenger(id PK, Name) Plane(id PK, capacity, type); Flight(id PK, planeId FK(Plane), flightDate, StartLocation, destination) CREATE TABLE Reservation(PassengerId, flightId, PRIMARY KEY (passengerId, flightId), FOREIGN KEY (passengerId) REFERENCES Passenger, FOREIGN KEY (flightId) REFERENCES Flight); I need to define an integrity constraint that enforces the restriction that the number of passengers on a plane cannot exceed the plane’s capacity. I have tried and achieved so far is this. CREATE TABLE Reservation( passengerId INTEGER, flightId INTEGER, PRIMARY KEY (passengerId, flightId), FOREIGN KEY (passengerId) REFERENCES Passenger, FOREIGN KEY (flightId) REFERENCES Flight, Constraint check1 check(Not Exists(select * from Flight s, (select count(*) as totalRes from Reservation group by flightId) t where t.totalRes > s.capacity ) ) ); I am not sure i am doing in right way or not. Any suggestions?

    Read the article

  • Track Pedestrians

    - by 2vision2
    I am using OpenCV sample code “peopledetect.cpp” to detect and track pedestrians. The code uses HoG for feature extraction and SVM for classification. Please find the reference paper used here. The camera is mounted on the wall at a height of 10 feet and 45 degree down. There is no restriction on the pedestrian movement within the frame. I want to track the detected pedestrians’ movement within the frame. The issue I am facing is pedestrians are detected only in the middle region of the frame as most of the features are not visible as soon as the pedestrian enters the frame region. I want to track each person’s movement in the entire frame region. How to do it? Is tracking required? Can anyone give any reference to blogs/codes?

    Read the article

  • c# Delegates, Events and Lambda Expr for new students

    - by MarkP
    I've been asked by my pointy haired boss to educate our new co-ops (interns) in the ways of C#. I have roughly ~30mins to cover the topics of Delegates, Events and Lambda Expressions. The time restriction is rather tight and the topics are broad. Since I'm not a C# guru, I would like some hints and pointers. Since my time is short, what points should I cover with respect to the three topics listed above? What are some good Do's and Dont's when using those three things? I might have time for a short Lambda Expr demo. What is the most common use of LExpr (probably a Select().Where() statement on an enumerable??) that I could demo? Thanks. EDIT: The students have working knowledge of C++ and Java.

    Read the article

  • Accessing FILESTREAM from an SQL CLR assembly

    - by superware
    I'm trying to stream FILESTREAM data from an unsafe SQL CLR assembly. The connection string is Data Source=LAPTOP2\SQLEXPRESS;Initial Catalog=test;Integrated Security=True;Enlist=False When creating a new SqlFileStream (inside a SqlTransaction, of course), I'm getting: The request is not supported at OpenSqlFilestream. So I decided to try native OpenSqlFilestream, but then I'm getting an invalid handle (-1) while GetLastWin32Error returns that same: The request is not supported (ERROR_NOT_SUPPORTED). I have also tried SqlContext.WindowsIdentity.Impersonate() with no apparent effect. I couldn't find any documentation referencing this restriction. Is it really unsupported? If it is unsupported, is there a good reason? Does anyone know of a workaround?

    Read the article

  • Any tips of how to handle hierarchial trees in relational model?

    - by George
    Hello all. I have a tree structure that can be n-levels deep, without restriction. That means that each node can have another n nodes. What is the best way to retrieve a tree like that without issuing thousands of queries to the database? I looked at a few other models, like flat table model, Preorder Tree Traversal Algorithm, and so. Do you guys have any tips or suggestions of how to implement a efficient tree model? My objective in the real end is to have one or two queries that would spit the whole tree for me. With enough processing i can display the tree in dot net, but that would be in client machine, so, not much of a big deal. Thanks for the attention

    Read the article

  • How to Design Programs: An Introduction to Programming and Computing -- teacher guide access

    - by user295683
    Hello -- I'm a biologist switching careers, and trying to learn programming as a result. I stumbled upon the aforementioned book on Amazon, which jived with my liberal arts background. Despite my great satisfaction with the didactic approach, I was frustrated to see that the answers to the exercises are restricted to teachers only. As I am pursuing this endeavor on my own, this restriction dramatically cripples the value of this book. My request to the author's website for access to the answers has not been answered, and I would desperately like to continue with this book. Anyone have any experience dealing with the book's website, or at the very least a torrent of the answers? Otherwise, I suspect I will be relegated to using JavaScript for everything! Thanks!

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >