Search Results

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

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

  • What is the worst programming mistake you have made?

    - by George Edison
    Most of us are not perfect. (Well, except Jon Skeet) Have you made a terrible mistake that you would like to share? The idea is that we could all learn from our mistakes and by collecting them together here, we can avoid some common ones and discover some no-so-common ones we may have overlooked. Oh, and this question is CW, of course. Edit: This question is different than http://stackoverflow.com/questions/1928002/what-is-the-worst-programming-mistake-you-have-ever-seen because we are sharing our own mistakes. Edit again: And this one http://stackoverflow.com/questions/130965/what-is-the-worst-code-youve-ever-written is different too - it asks for code. My question does not have that restriction!

    Read the article

  • How to cancel drop event in YUI drag & drop utility?

    - by gk
    We are using drag & drop utility between one source and multiple targets. We have a restriction that one of the target can only have one child element while the other ones can have multiple items. I have tried subscribing dragDropEvent of the proxy item and returning false in case the destination target has multiple child elements, with out much luck. var m = new YAHOO.example.DDList("dli" + j, 'documentSelection'); m.subscribe('dragDropEvent', function(e){ if (e.info == 'ulMasterDocument' && $('#ulMasterDocument').children().length > 1){ e.event.canceBubble = true; return false; } return true; }); Is this code correct? Or do i need to subscribe some other event? Thanks

    Read the article

  • Exception design: Custom exceptions reading data from file?

    - by User
    I have a method that reads data from a comma separated text file and constructs a list of entity objects, let's say customers. So it reads for example, Name Age Weight Then I take these data objects and pass them to a business layer that saves them to a database. Now the data in this file might be invalid, so I'm trying to figure out the best error handling design. For example, the text file might have character data in the Age field. Now my question is, should I throw an exception such as InvalidAgeException from the method reading the file data? And suppose there is length restriction on the Name field, so if the length is greater than max characters do I throw a NameTooLongException or just an InvalidNameException, or do I just accept it and wait until the business layer gets a hold of it and throw exceptions from there? (If you can point me to a good resource that would be good too)

    Read the article

  • Propietary modules within GPL and BSD kernels

    - by Francisco Garcia
    Since the Linux kernel is GPL and not LGPL I suppose that it is illegal to link proprietary code to it. How does the industry circumvents this? I would expect that the GPL license will force any developer to release under GPL driver and/or kernel module. Maybe I am confused and implementing a new module is not really linking against the kernel code ??? How do companies deal with this? Maybe linking the other way around (from kernel to their binaries)? On the other hand there is the BSD kernel. Where you are free to link protected IP. Can you get a better design implementing your drivers within a BSD kernel? Is there any design restriction when implementing drivers for GPL kernels?

    Read the article

  • Why is it impossible to declare extension methods in a generic static class?

    - by Hun1Ahpu
    I'd like to create a lot of extension methods for some generic class, e.g. for public class SimpleLinkedList<T> where T:IComparable And I've started creating methods like this: public static class LinkedListExtensions { public static T[] ToArray<T>(this SimpleLinkedList<T> simpleLinkedList) where T:IComparable { //// code } } But when I tried to make LinkedListExtensions class generic like this: public static class LinkedListExtensions<T> where T:IComparable { public static T[] ToArray(this SimpleLinkedList<T> simpleLinkedList) { ////code } } I get "Extension methods can only be declared in non-generic, non-nested static class". And I'm trying to guess where this restriction came from and have no ideas.

    Read the article

  • Browser for cross-site-script testing (for testing Mozilla Add-On)

    - by Anthony
    I am working on a Firefox extension that will involve ajax calls to domains that would normally fail due to the same-origin policy set by Firefox (and most modern browsers). I was wondering if there is a way to either turn off the same-origin restriction (in about:config, perhaps) or if there was a standard lite-browser that developers turn to for this. I really would like to avoid using any blackhat tools, if possible. Not because I'm against them, I just don't want to add another learning curve to the process. I can use curl in PHP to confirm that the requests work, but I want to get started on writing the js that the addon will actually use, so I need a client that will execute js. I also tried spidermonkey, but since I'm doing the ajax with jquery, it threw a fit at all of the browser-based default variables. So, short version: is there a reliable browser/client for cross site scripting that isn't primarily a hacker app? Or can I just turn off same-domain policy in Firefox?

    Read the article

  • Source code comparison app that doesn't require files?

    - by ZenBlender
    I'm looking for an easy-to-use, free source code comparison app for Windows, which will highlight differences side-by-side between two pieces of source code. Some apps get close to what I want, but are too restrictive by requiring you load in entire files and compare them in their entirety. Sometimes I just want to compare a section of my file, such as a single function, which may be in totally different locations in the two versions I'd be comparing, making it hard to find in both panes in large files. Basically, I'd like to be able to simply edit/copy/paste the content in both panes rather than have the restriction of using files. That way I can copy and paste one function into one pane and another into the other, editing/re-ordering as necessary. (Note that I realize there are other comparison app recommendation threads out there, but I'm having a hard time finding a free app that isn't a strict file-to-file comparison app) Thanks for any pointers or links, thanks!

    Read the article

  • C# Language Design: explicit interface implementation of an event

    - by ControlFlow
    Small question about C# language design :)) If I had an interface like this: interface IFoo { int Value { get; set; } } It's possible to explicitly implement such interface using C# 3.0 auto-implemented properties: sealed class Foo : IFoo { int IFoo.Value { get; set; } } But if I had an event in the interface: interface IFoo { event EventHandler Event; } And trying to explicitly implement it using field-like event: sealed class Foo : IFoo { event EventHandler IFoo.Event; } I will get the following compiler error: error CS0071: An explicit interface implementation of an event must use event accessor syntax I think that field-like events is the some kind of dualism for auto-implemented properties. So my question is: what is the design reason for such restriction done?

    Read the article

  • Array.BinarySearch where a certain condition is met

    - by codymanix
    I have an array of a certain type. Now I want to find an entry where a certain condition is met. What is the preferred way to do this with the restriction that I don't want to create a temporary object to find, but instead I only want to give a search condition. MyClass[] myArray; // fill and sort array.. MyClass item = Array.BinarySearch(myArray, x=>x.Name=="Joe"); // is this possible? Maybe is it possible to use LINQ to solve it?

    Read the article

  • Abstract Forms using WinForms

    - by pm_2
    I’m trying to achieve a similar affect in a WinForms application as a master form does with ASP.NET. My initial thoughts on this were to create a base form and declare it as abstract, but the compiler doesn’t seem to let me do this. public abstract partial class Master : Form { public Master() { InitializeComponent(); } } So I have two questions: Why will the compiler not let me do this? Am I using the wrong syntax or is this a genuine restriction. Can anyone suggest a workaround or better way to do this? EDIT: InitializeComponent code: private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.mainMenu1 = new System.Windows.Forms.MainMenu(); this.Menu = this.mainMenu1; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.Text = "Master"; this.AutoScroll = true; }

    Read the article

  • Limit Connections with semaphores

    - by Robert
    I'm trying to limit the number of connections my server will accept using semaphores, but when running, my code doesn't seem to make this restriction - am I using the semaphore correctly? eg. I have hardcoded the number of permit as 2, but I can connect an unlimited number of clients... public class EServer implements Runnable { private ServerSocket serverSocket; private int numberofConnections = 0; private Semaphore sem = new Semaphore(2); private volatile boolean keepProcessing = true; public EServer(int port) throws IOException { serverSocket = new ServerSocket(port); } @Override public void run() { while (keepProcessing) { try { sem.acquire(); Socket socket = serverSocket.accept(); process(socket, getNextConnectionNumber()); } catch (Exception e) { } finally { sem.release(); } } closeIgnoringException(serverSocket); } private synchronized int getNextConnectionNumber() { return ++numberofConnections; } // processing related methods }

    Read the article

  • Library for polygon operations

    - by AJM
    I've recently encountered a need for a library or set of libraries to handle operations on 2D polygons. I need to be able to perform boolean/clipping operations (difference and union) and triangulation. So far the libraries I've found are poly2tri, CGAL, and GPC. Poly2tri looks good for triangulation but I'm still left with boolean operations, and I'm unsure about its maturity. CGAL and GPC are only free if my own project is free. My particular project isn't commercial, so I'm hesitant to pay or request for any licenses. But I may want to use my code for a future commercial project, so I'm hesitant about CGAL's open source licenses and GPC's freeware-only restriction. There doesn't seem to be any polygon clipping libraries with nice BSD-style licenses.

    Read the article

  • Multiple schema validation in Java

    - by user279554
    Hi, I am trying to do multiple schema validation in Java. I don't understand where I am doing wrong. Any help will be appreciated. abc.xsd <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xn="project-xml-r4j_another.xsd"> <xsd:import namespace="project-xml-r4j_another.xsd"/> <xsd:element name="abc" type="abc"> </xsd:element> <xsd:complexType name="abc"> <xsd:sequence> <xsd:element name="test" type="test" minOccurs="0" maxOccurs="1"> </xsd:element> <!--<xsd:element name="proj" type="xn:proj"/>--> </xsd:sequence> <xsd:attribute name="id" type="xsd:ID" use="required"/> </xsd:complexType> <xsd:complexType name="test"> <xsd:attribute name="id" type="xsd:ID" use="required"></xsd:attribute> <xsd:attribute name="value" use="required"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="100" /> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:complexType> </xsd:schema> project-xml-r4j_another.xsd <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="project-xml-r4j_another.xsd" xmlns="project-xml-r4j_another.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:element name="proj" type="proj"> <xsd:annotation> <xsd:documentation> The project is the root tag of a project-xml. </xsd:documentation> </xsd:annotation> </xsd:element> <xsd:complexType name="proj"> <xsd:attribute name="id" type="xsd:ID" use="required"/> </xsd:complexType> </xsd:schema> Test case package test; import java.io.File; import java.io.IOException; import javax.xml.XMLConstants; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import org.apache.log4j.Logger; import org.junit.Test; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; import com.ericsson.ccrtool.core.project.projectxml.InvalidProjectXmlException; public class TestSchema { private static final Logger logger = Logger.getLogger(TestSchema.class); static final String W3C_XML_SCHEMA = XMLConstants.W3C_XML_SCHEMA_NS_URI; @Test public void test() { System.out.println("TestSchema.test()"); try { SchemaFactory schemaFactory = SchemaFactory.newInstance(W3C_XML_SCHEMA); // create a grammar object. Source [] source = { new StreamSource(new File("C:\\jaydeep\\Ericsson\\R5B\\abc.xsd")), new StreamSource(new File("C:\\jaydeep\\Ericsson\\R5B\\project-xml-r4j.xsd"))}; Schema schemaGrammar = schemaFactory.newSchema(source); Validator schemaValidator = schemaGrammar.newValidator(); schemaValidator.setErrorHandler(new MessageHandler()); // validate xml instance against the grammar. schemaValidator.validate(new StreamSource("C:\\jaydeep\\Ericsson\\R5B\\project_tmmk17cells_xnaveen_project-xml.xml")); } catch (SAXException e) { throw new InvalidProjectXmlException("Project-xml validation failed, Exception: " + e.getMessage(), e); } catch (IOException e) { throw new InvalidProjectXmlException("Project-xml validation failed, Exception: " + e.getMessage(), e); } } class MessageHandler extends DefaultHandler { private String errMessage = ""; @Override public void warning(SAXParseException e) { logger.info("Warning Line " + e.getLineNumber() + ": " + e.getMessage()); } @Override public void error(SAXParseException e) { errMessage = new String("Error Line " + e.getLineNumber() + ": " + e.getMessage()); logger.info(errMessage); throw new InvalidProjectXmlException("Project-xml validation failed, Exception: " + errMessage); } @Override public void fatalError(SAXParseException e) { errMessage = new String("Error Line " + e.getLineNumber() + ": " + e.getMessage()); logger.info(errMessage); throw new InvalidProjectXmlException("Project-xml validation failed, Exception: " + errMessage); } } } Thanks, Jaydeep

    Read the article

  • Complex Selectors with jQuery Delegate

    - by Keith Rousseau
    Is there a restriction on the complexity of selectors that can be used with delegate in jQuery 1.4.2? This works for me: $('.activeTabsList').delegate('.activeTabsListItem', 'click', function() { alert('here'); }); This does not work: $('.activeTabsList').delegate('.activeTabsListItem:not(.selected)', 'click', function() { alert('here'); }); As you can probably assume, there is only 1 item at a time that has the selected class. When I click the other tabs, my delegate handler is still not fired.

    Read the article

  • Efficient way to ASCII encode UTF-8

    - by Andreas Gohr
    I'm looking for a simple and efficient way to store UTF-8 strings in ASCII-7. With efficient I mean the following: all ASCII chars in the input should stay ASCII chars in the output the resulting string should be as short as possible the operation needs to be reversable without any data loss there should be no restriction on the input length the whole UTF-8 range should be allowed My first idea was to use Punycode (IDNA) as it fits the first three requirements, but it fails at the last two. Can anyone recommend an alternative encoding scheme? Even better if there's some code available to look at.

    Read the article

  • Change SVN Path Entirely

    - by Tom
    Hi Guys, We have an SVN at http:/XX.XXX.XXX.XXX:1111/svn/AB/ - and the first two folders of the SVN are like http:/XX.XXX.XXX.XXX:1111/svn/AB/abc/filefolder/ The problem is we want to move the entire svn to get rid of /abc/filefolder/ - as the entire project sits under /abc/filefolder/ [created long ago and never bothered to change] (que stupid yes yes) How would we could about fixing this so we dont loose logs etc ? We dont want to have to export and create a new svn - since then we loose all our log files. But we want to "move" the svn root so for example it becomes From: http:/XX.XXX.XXX.XXX:1111/svn/AB/abc/filefolder/documents/ To: http:/XX.XXX.XXX.XXX:1111/svn/AB/documents/ Any help appreciated ? [ps - yes had to remove http:// due to link restriction]

    Read the article

  • How to acces File over the Network

    - by Polo
    Hi! I am having a hard time on this one, I have à folder over the network wit public accès (no credential restriction). I am trying to do à File.Exist or Directory.Exist and I keep on having a exception. Can somewone tell me the good way to do IO over the network. EDIT 1 FOR DETAILS: if i do execture = \agoodip\Public\test.txt I get the file etc etc In my code it look like a basic Directory.Exist(@"\agoodip\Public") or File.exist(@"\agoodip\Public\test.txt") The exception I get is Path not found. Thanks!

    Read the article

  • How to open email by x-gm-msgid in Gmail with Javascript

    - by Rui J
    I'm writing an extension which surfaces links to gmail messages. As the UI loads right in Gmail, I should be able to click on one of these links and have Gmail load it (without refreshing). I have "x-gm-msgid" available and theoretically, I should just be able to navigate to "https://mail.google.com/mail/u/0/#inbox/[x-gm-msgid]". I've tried using location.hash = "#inbox/[x-gm-msgid]" I've tried using history.pushState(null, null, "/mail/u/0/#inbox/[x-gm-msgid]") Neither of which works. Gmail just thwarts any attempt to change the URL (unless it is done via user interaction) Any thoughts on how to get around this restriction?

    Read the article

  • How to access File over the Network

    - by Polo
    Hi! I am having a hard time on this one, I have a folder over the network with public access (no credential restriction). I am trying to do a File.Exist or Directory.Exist and I keep on having a exception. Can someone tell me the good way to do IO over the network. EDIT 1 FOR DETAILS: if i do execture = \agoodip\Public\test.txt I get the file etc etc In my code it look like a basic Directory.Exist(@"\\agoodip\Public") or File.exist(@"\\agoodip\Public\test.txt") The exception I get is Path not found. EDIT 2 : I am using Silverlight 3, Is there any security pattern to be aware of to lookup file on the network? Thanks!

    Read the article

  • Any tips of how to handle hierarchical 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

  • Acts as Tree with Multiple Models

    - by Joe
    I've got several models that I'd like to relate together hierarchically. For simplicity's sake, let's say I've got these three: class Group < ActiveRecord::Base acts_as_tree has_many :users end class User < ActiveRecord::Base acts_as_tree belongs_to :group has_many :posts end class Post < ActiveRecord::Base acts_as_tree belongs_to :user end Under the current acts_as_tree, each node can individually can relate hierarchically to other nodes provided they are of the same type. What I'd like is to remove this restriction on type identity, so that SomePost.parent could have a User or a Post as its' parent, and that SomeUser.parent could have another user or a group as its parent. Any thoughts?

    Read the article

  • How can you query for an object using one of its properties' id

    - by James Smith
    I have two entities, say, House and People, where multiple people can live in one house. It's a unidirectional link where each Person has a field for which House they belong to, so the Person table has a column named house_id. I need to be able to return all the Person objects who belong to a certain House, but I only have the id of the house. This can be done like this: House house = houseDAO.findById(houseId); List people = session.createCriteria(Person.class).add(Restrictions.eq("house", house)).list(); But since I don't need the house, that's adding an unnecessary query. I've tried to do: session.createCriteria(Person.class).add(Restrictions.eq("house_id", houseId)).list(); But that doesn't work because house_id is not a property, it's a database column. I could just add an sql restriction, but is there a hibernate way of doing this?

    Read the article

  • document.getElementById in toString

    - by KooiInc
    edit Found my answers here. Bottom line: toString/valueOf can only return primitive types. So here the lack of native getters in javascript shows, I suppose. I would like to use the following simple function in an elementwrapper: function ElGetter(id){ var id = id; return { set: function(nwid){id = nwid;}, toString: function(){return document.getElementById(id);}, valueOf: function(){return document.getElementById(id);} }; } var myEl = ElGetter('myId'); console.log(myEl.innerHTML); //=> undefined But I can't get it to work. Is it a DOM/javascript restriction or am I missing something? Normally it works, as in: function Tester(){ var x = 1; return { toString: function(){return x}, valueOf: function(){return x} } } var myTest = Tester(); console.log(myTest); //=> 1

    Read the article

  • Express highest floating point quantity that is less than 1

    - by edA-qa mort-ora-y
    I was doing some rounding calculations and happened upon a question. How can I express the highest quantity less than 1 for a given floating point type? That is, how I write/represent value x such that x < 1, x + y >= 1 for any y > 0. In fractions this would be x = (q-1)/q where q is the precision of the type. For example, if you are counting in 1/999 increments then x = 998/999. For a given type (float, double, long double), how could one express the value x in code? I also wonder if such a value actually exists for all values of y. That is, as y's exponent gets smaller perhaps the relation doesn't hold anymore. So an answer with some range restriction on y is also acceptable. (The value of x I want still does exist, the relationship may just not properly express it.)

    Read the article

  • Parsing a dynamic value with Lift-JSON

    - by Surya Suravarapu
    Let me explain this question with an example. If I have a JSON like the following: {"person1":{"name": "Name One", "address": {"street": "Some Street","city": "Some City"}}, "person2":{"name": "Name Two", "address": {"street": "Some Other Street","city": "Some Other City"}}} [There is no restriction on the number of persons, the input JSON can have many more persons] I could extract this JSON to Persons object by doing var persons = parse(res).extract[T] Here are the related case classes: case class Address(street: String, city: String) case class Person(name: String, address: Address, children: List[Child]) case class Persons(person1: Person, person2: Person) Question: The above scenario works perfectly fine. However the need is that the keys are dynamic in the key/value pairs. So in the example JSON provided, person1 and person2 could be anything, I need to read them dynamically. What's the best possible structure for Persons class to account for that dynamic nature.

    Read the article

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