Search Results

Search found 1557 results on 63 pages for 'daniel gollas'.

Page 43/63 | < Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >

  • How to get a template tag to auto-check a checkbox in Django

    - by Daniel Quinn
    I'm using a ModelForm class to generate a bunch of checkboxes for a ManyToManyField but I've run into one problem: while the default behaviour automatically checks the appropriate boxes (when I'm editing an object), I can't figure out how to get that information in my own custom templatetag. Here's what I've got in my model: ... from django.forms import CheckboxSelectMultiple, ModelMultipleChoiceField interests = ModelMultipleChoiceField(widget=CheckboxSelectMultiple(), queryset=Interest.objects.all(), required=False) ... And here's my templatetag: @register.filter def alignboxes(boxes, cls): """ Details on how this works can be found here: http://docs.djangoproject.com/en/1.1/howto/custom-template-tags/ """ r = "" i = 0 for box in boxes.field.choices.queryset: r += "<label for=\"id_%s_%d\" class=\"%s\"><input type=\"checkbox\" name=\"%s\" value=\"%s\" id=\"id_%s_%d\" /> %s</label>\n" % ( boxes.name, i, cls, boxes.name, box.id, boxes.name, i, box.name ) i = i + 1 return mark_safe(r) The thing is, I'm only doing this so I can wrap some simpler markup around these boxes, so if someone knows how to make that happen in an easier way, I'm all ears. I'd be happy with knowing a way to access whether or not a box should be checked though.

    Read the article

  • I did my own web framework: now, how keep it sync with applications? must I use versions?

    - by Daniel Koch
    ... and I did the first web application using it, now I'm going to create the second. In this first web application I enhanced the framework's core library with new things and promptly updated framework branch. I'm using bazaar to keep framework and web application committed. The application was in the beginning, a full branch of framework source tree, now I'm updating framework manually at every change on core files. (copying changed files from web app to framework's branch). With this second web application that I'm going to create, I need to know about versions (or revisions) which the application is based. If I found a bug in this version I can fix and then sync files with first web application no worrying: functions will be the same to this application. If I'm going to make changes in core (new behavior, new functions in library or something new in source tree) it must be named as "new version". What's the best way to do this? Because I'm using a Distributed Version Control System (bazaar), I'm not dealing with VERSIONS, but revision numbers that change every time. Please fresh my mind with new ideas.

    Read the article

  • Foolishness Check: PHP Class finds Class file but not Class in the file.

    - by Daniel Bingham
    I'm at a loss here. I've defined an abstract superclass in one file and a subclass in another. I have required the super-classes file and the stack trace reports to find an include it. However, it then returns an error when it hits the 'extends' line: Fatal error: Class 'HTMLBuilder' not found in View/Markup/HTML/HTML4.01/HTML4_01Builder.php on line 7. I had this working with another class tree that uses factories a moment ago. I just added the builder layer in between the factories and the consumer. The factory layer looked almost exactly the same in terms of includes and dependencies. So that makes me think I must have done something silly that's causes the HTMLBuilder.php file to not be included correctly or interpreted correctly or some such. Here's the full stack trace (paths slightly altered): # Time Memory Function Location 1 0.0001 53904 {main}( ) ../index.php:0 2 0.0002 67600 require_once( 'View/Page.php' ) ../index.php:3 3 0.0003 75444 require_once( 'View/Sections/SectionFactory.php' ) ../Page.php:4 4 0.0003 81152 require_once( 'View/Sections/HTML/HTMLSectionFactory.php' ) ../SectionFactory.php:3 5 0.0004 92108 require_once( 'View/Sections/HTML/HTMLTitlebarSection.php' ) ../HTMLSectionFactory.php:5 6 0.0005 99716 require_once( 'View/Markup/HTML/HTMLBuilder.php' ) ../HTMLTitlebarSection.php:3 7 0.0005 103580 require_once( 'View/Markup/MarkupBuilder.php' ) ../HTMLBuilder.php:3 8 0.0006 124120 require_once( 'View/Markup/HTML/HTML4.01/HTML4_01Builder.php' ) ../MarkupBuilder.php:3 Here's the code in question: Parent class (View/Markup/HTML/HTMLBuilder.php): <?php require_once('View/Markup/MarkupBuilder.php'); abstract class HTMLBuilder extends MarkupBuilder { public abstract function getLink($text, $href); public abstract function getImage($src, $alt); public abstract function getDivision($id, array $classes=NULL, array $children=NULL); public abstract function getParagraph($text, array $classes=NULL, $id=NULL); } ?> Child Class, (View/Markup/HTML/HTML4.01/HTML4_01Builder.php): <?php require_once('HTML4_01Factory.php'); require_once('View/Markup/HTML/HTMLBuilder.php'); class HTML4_01Builder extends HTMLBuilder { private $factory; public function __construct() { $this->factory = new HTML4_01Factory(); } public function getLink($href, $text) { $link = $this->factory->getA(); $link->addAttribute('href', $href); $link->addChild($this->factory->getText($text)); return $link; } public function getImage($src, $alt) { $image = $this->factory->getImg(); $image->addAttribute('src', $src); $image->addAttribute('alt', $alt); return $image; } public function getDivision($id, array $classes=NULL, array $children=NULL) { $div = $this->factory->getDiv(); $div->setID($id); if(!empty($classes)) { $div->addClasses($classes); } if(!empty($children)) { $div->addChildren($children); } return $div; } public function getParagraph($text, array $classes=NULL, $id=NULL) { $p = $this->factory->getP(); $p->addChild($this->factory->getText($text)); if(!empty($classes)) { $p->addClasses($classes); } if(!empty($id)) { $p->setID($id); } return $p; } } ?> I would appreciate any and all ideas. I'm at a complete loss here as to what is going wrong. I'm sure it's something stupid I just can't see...

    Read the article

  • how to access anti aliasing method of a font with CSS

    - by Daniel Ramirez-Escudero
    I've had this problem in a lot of different webs. You have a font which has different anti-aliasing options, the designer uses the same font with different anti-aliasing options on different parts of the text on the web. So there is a difference between some elements. In this case I have sharp, crisp, strong and smooth. I've used a font generator to get the code to access it via @font-face. Even so, I also have the original .otf if important to know. Is there a method to access this? I upload a picture of what I mean and my actual code: ![@font-face { font-family: 'light'; src: url('../_fnt/light/gothamrnd-light.eot'); src: url('../_fnt/light/gothamrnd-light.eot?#iefix') format('embedded-opentype'), url('../_fnt/light/gothamrnd-light.woff') format('woff'), url('../_fnt/light/gothamrnd-light.ttf') format('truetype'), url('../_fnt/light/gothamrnd-light.svg#../_fnt/light/gothamrnd-light') format('svg'); font-weight: normal; font-style: normal; }]![enter image description here][1]

    Read the article

  • Where is it appropriate to define inflector rules in CakePHP 1.3?

    - by Daniel Wright
    In CakePHP 1.2, custom inflector rules could be defined in a file app/config/inflections.php. This file was removed in CakePHP 1.3. Instead, the documentation prescribes using the Inflector::rules function to load custom inflections. There's adequate documentation of how to define the custom inflections themselves, but the documentation gives no context—where to use Inflector::rules. Should any custom inflections be defined in the bootstrap.php script? At the top of applicable corresponding controllers? Somewhere else? See also: Configuration: Inflections in the documentation Inflector::rules definition in the API documentation

    Read the article

  • centering a div without setting width

    - by Daniel
    Is there a way to do this? When using navigation that can change the number of items often, it would be nice not having to calculate the with and updating the css, but just having a solution that works. if that's impossible (I'm assuming it is) can anyone point me to a javascript that can do this? edit re: provide code some code basically I'm working with, what I think is, the most typical setup <div class="main"> <div class="nav"> <ul> <li>short title</li> <li>Item 3 Long title</li> <li>Item 4 Long title</li> <li>Item 5 Long title</li> <li>Item 6 Extra Long title</li> </ul> </div> </div> edit .main { width:100%; text-align:center; } .nav { margin:0 auto; } .nav ul li { display:inline; text-align:left; } the issue I've found with this/these solutions is that the content is nudged to the right adding some right padding (of 40px) seems to fix this across the browsers I'm checking on (O FF IE). .nav { margin:0 auto; padding-right:40px; } I don't know where this value is coming from though and why 40px fixes this. Does anyone know where this is coming from? it's not a margin or padding but no matter what I do the first about 40px can not be used for placement. Maybe it's the ul or li that's adding this. I've had a look at the display:table-cell way of doing this, but there's that complication with IE and it still has the same issue as the other solution edit (final) okay I've tried some things in regard to the indent. I've reset all padding to 0 *{padding:0;} that fixed it, and I don't need to offset the padding (I think I'll leave my whole process up so if anyone comes across this, it'll save them some time) thanks for the comments and replies

    Read the article

  • Dynamically setting the queryset of a ModelMultipleChoiceField to a custom recordset

    - by Daniel Quinn
    I've seen all the howtos about how you can set a ModelMultipleChoiceField to use a custom queryset and I've tried them and they work. However, they all use the same paradigm: the queryset is just a filtered list of the same objects. In my case, I'm trying to get the admin to draw a multiselect form that instead of using usernames as the text portion of the , I'd like to use the name field from my account class. Here's a breakdown of what I've got: # models.py class Account(models.Model): name = models.CharField(max_length=128,help_text="A display name that people understand") user = models.ForeignKey(User, unique=True) # Tied to the User class in settings.py class Organisation(models.Model): administrators = models.ManyToManyField(User) # admin.py from django.forms import ModelMultipleChoiceField from django.contrib.auth.models import User class OrganisationAdminForm(forms.ModelForm): def __init__(self, *args, **kwargs): from ethico.accounts.models import Account self.base_fields["administrators"] = ModelMultipleChoiceField( queryset=User.objects.all(), required=False ) super(OrganisationAdminForm, self).__init__(*args, **kwargs) class Meta: model = Organisation This works, however, I want queryset above to draw a selectbox with the Account.name property and the User.id property. This didn't work: queryset=Account.objects.all().order_by("name").values_list("user","name") It failed with this error: 'tuple' object has no attribute 'pk' I figured that this would be easy, but it's turned into hours of dead-ends. Anyone care to shed some light?

    Read the article

  • Looking for a wsdl-based scaffolding framework.

    - by daniel.balla
    I am looking for a wsdl scaffolding framework, or even better if it was a POCO scaffolding framework. I need something like Dynamic Data, but running on wsdl metadata instead of db. I am currently using office infopath which generates decent forms based on wsdl, but I would like to have it in my app, and generated at runtime. Any ideas would be appreciated. Thanks

    Read the article

  • Accept-Encoding headers being sent by browser but not received by server

    - by Daniel Jacobs
    I have been trying to debug this for weeks. All of the browsers on all of the clients on my home network are sending 'Accept-Encoding: gzip,deflate'. However, that header is somehow, somewhere being dropped before the request makes it to a web server. For example, http://www.whatsmyip.org/http_compression/ says 'No, your browser is not requesting compressed content'. I've used Fiddler to make sure that all of my browsers are indeed sending the header. I've swapped out my router. I've turned off all anti-virus software. Brighthouse/Roadrunner (the local cable ISP) says they are not doing any filtering (and I can't see why they would in this case). Any suggestions would be most welcome!

    Read the article

  • dojo.connect won't connect 'onclick' with button

    - by Daniel
    I'm running into a problem using dojo.connect() to connect an 'onclick' event with this button: <button dojoType="dijit.form.Button" widgetId="inbox_button" id="inbox_button">Inbox</button> and the code making the connection is: var inbox_button=dojo.byId("inbox_button"); dojo.connect(inbox_button,'onclick',function(){ var container=dijit.byId("center"); container.addChild(new dijit.layout.ContentPane({region: "left", content: "...", style: "width: 100px;"})) }); However, instead of executing the function when the button is clicked, ANY onclick event triggers the function, and I end up with a lot of children containers. Even though I'm pretty certain the .connect() function should be available as part of dojo's base functionality, I've 'required' it explicitly: dojo.require("dojo._base.connect"); Any ideas as to why this might be happening?

    Read the article

  • How can I simply change a class variable from another class in ObjectiveC?

    - by Daniel
    I simply want to change a variable of an object from another class. I can compile without a problem, but my variable always is set to 'null'. I used the following code: Object.h: @interface Object : NSObject { //... NSString *color; //... } @property(nonatomic, retain) NSString* color; + (id)Object; - (void)setColor:(NSString*)col; - (NSString*)getColor; @end Object.m: +(id)Object{ return [[[Object alloc] init] autorelease]; } - (void)setColor:(NSString*)col { self.color = col; } - (NSString*)getColor { return self.color; } MyViewController.h #import "Object.h" @interface ClassesTestViewController : UIViewController { Object *myObject; UILabel *label1; } @property UILabel *label1; @property (assign) Object *myObject; @end MyViewController.m: #import "Object.h" @implementation MyViewController @synthesize myObject; - (void)viewDidLoad { [myObject setColor:@"red"]; NSLog(@"Color = %@", [myObject getColor]); [super viewDidLoad]; } The NSLog message is always Color = (null) I tried many different ways to solve this problem, but no success. Any help would be appreciated.

    Read the article

  • Scalability of Ruby on Rails versus PHP

    - by Daniel
    Can anyone comment on which is more scalable between RoR and PHP? I have heard that RoR is less scalable than PHP since RoR has a little more overhead with its MVC framework while PHP is more low level and lighter. This is a bit vague - can anyone explain better?

    Read the article

  • IEnumerable<T> ToArray usage, is it a copy or a pointer?

    - by Daniel
    I am parsing an arbitrary length byte array that is going to be passed around to a few different layers of parsing. Each parser creates a Header and a Packet payload just like any ordinary encapsulation. And my problem lies in how the encapsulation holds its packet byte array payload. Say i have a 100 byte array, and it has 3 levels of encapsulation. 3 packet objects will be created and i want to set the payload of these packets to the corresponding position in the byte array of the packet. For example lets say the payload size is 20 for all levels, then imagine it has a public byte[] Payload on each object. However the problem is that this byte[] Payload is a copy of the original 100 bytes. So i'm going to end up with 160 bytes in memory instead of 100. If it were in c++ i could just easily use a pointer however i'm writing this in c#. So i created the following class: public class PayloadSegment<T> : IEnumerable<T> { public readonly T[] Array; public readonly int Offset; public readonly int Count; public PayloadSegment(T[] array, int offset, int count) { this.Array = array; this.Offset = offset; this.Count = count; } public T this[int index] { get { if (index < 0 || index >= this.Count) throw new IndexOutOfRangeException(); else return Array[Offset + index]; } set { if (index < 0 || index >= this.Count) throw new IndexOutOfRangeException(); else Array[Offset + index] = value; } } public IEnumerator<T> GetEnumerator() { for (int i = Offset; i < Offset + Count; i++) yield return Array[i]; } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { IEnumerator<T> enumerator = this.GetEnumerator(); while (enumerator.MoveNext()) { yield return enumerator.Current; } } } This way i can simply reference a position inside the original byte array but use positional indexing. However if i do something like: PayloadSegment<byte> something = new PayloadSegment<byte>(someArray, 5, 10); byte[] somethingArray = something.ToArray(); Will the somethingArray be a copy of the bytes, or a reference to the original PayloadSegment which in turn is a reference to the original byte array? Sorry it was hard to word this lol _<

    Read the article

  • Visual Studio 2010 "Not enough storage is available to process this command"

    - by Daniel Perez
    I'm fighting with VS 2010 and this error that seems to be very common in previous versions, but it looks like not everyone is having it in the latest version. I've got VS 2010 SP1 and I'm getting this error quite often. The problem is that it's not even enough to restart VS in order to make it go away, I usually have to restart my pc, and i'm losing a lot of time doing this (it's quite frequent) I've got Windows 7 32bits (can't upgrade to 64 bits, the company doesn't allow it), and I can't do things like creating another solution (please don't reply this :) ) I've used the command to make devenv.exe LARGEADDRESSAWARE, but the error keeps on happening My virtual memory size is set to automatic, and the weird thing is that VS doesn't even take 2gb of ram, so I don't know if the error is really because it's lacking memory, or if it's some bug in the program any ideas, things to try, something?

    Read the article

  • Is there a better way than #if DebugMode for logging

    - by Daniel
    I'm making a c++ library thats going to be P/Invoked from c#, so i am unable to breakpoint/debug the c++ side of things. So i decided to add logging so i can see if anything goes wrong and where it happens. I add a #define DebugMode 1 in order to determine if i am to log or not. First of all i'm not very good at c++ but i know enough to get around. So my questions are: Is there a better way than wrapping #if DebugMode #endifs around every Log call? I could simply do that inside the method and just return if logging isn't disabled but won't that mean then all those logging strings will be in the assembly? How can i emulate what printf does with its "..." operator enabling me to pass something like Log("Variable x is {0}", x); Thanks!

    Read the article

  • What's a good way to make a Flex component with placeholders in it?

    - by Daniel Brockman
    I want to create a component that has a couple of "holes" that are to be filled in differently on each use. Currently, I'm doing it like this (using the Flex 4 framework in this example --- it would look almost the same for Flex 3): public var fooComponent : IVisualElement; public var barComponent : IVisualElement; override protected function createChildren() : void { super.createChildren(); fooContainer.addElement(fooComponent); barContainer.addElement(barComponent); } <Group id="fooContainer"/> <!-- ... other components ... --> <Group id="barContainer"/> This works well, but it's kind of a lot of code to write for something so simple. What I'd like is something like this: [Bindable] public var fooComponent : IVisualElement; [Bindable] public var barComponent : IVisualElement; <Placeholder content="{fooComponent}"/> <!-- ... other components ... --> <Placeholder content="{barComponent}"/> Now, I could implement the Placeholder component myself, but I can't help wondering if there isn't a better way to do this using the existing tools in the Flex framework. Theoretically, with the proper compiler support, it could even be boiled down to something like this: <Placeholder id="fooComponent"/> <!-- ... other components ... --> <Placeholder id="barComponent"/>

    Read the article

  • How do I save a transient object that already exists in an NHibernate session?

    - by Daniel T.
    I have a Store that contains a list of Products: var store = new Store(); store.Products.Add(new Product{ Id = 1, Name = "Apples" }; store.Products.Add(new Product{ Id = 2, Name = "Oranges" }; Database.Save(store); Now, I want to edit one of the Products, but with a transient entity. This will be, for example, data from a web browser: // this is what I get from the web browser, this product should // edit the one that's already in the database that has the same Id var product = new Product{ Id = 2, Name = "Mandarin Oranges" }; store.Products.Add(product); Database.Save(store); However, trying to do it this way gives me an error: a different object with the same identifier value was already associated with the session How do I get around this problem?

    Read the article

  • User Defined Exceptions with JMX

    - by Daniel
    I have exposed methods for remote management in my application server using JMX by creating an MXBean interface, and a class to implement it. Included in this interface are operations for setting attributes on my server, and for getting the current value of attributes. For example, take the following methods: public interface WordManagerMXBean { public void addWord(String word); public WordsObject getWords(); public void removeWord(String word); } The WordsObject is a custom, serializable class used to retrieve data about the state of the server. Then I also have a WordManager class that implements the above interface. I then create a JMX agent to manage my resource: MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName wordManagerName = new ObjectName("com.example:type=WordManager"); mbs.registerMBean(wordManager, wordManagerName); I have created a client that invokes these methods, and this works as expected. However, I would like to extend this current configuration by adding user defined exceptions that can be sent back to my client. So I would like to change my interface to something like this: public interface WordManagerMXBean { public void addWord(String word) throws WordAlreadyExistsException; public WordsObject getWords(); public void removeWord(String word); } My WordAlreadyExistsException looks like this: public class WordAlreadyExistsException extends Exception implements Serializable { private static final long serialVersionUID = -9095552123119275304L; public WordAlreadyExistsException() { super(); } } When I call the addWord() method in my client, I would like to get back a WordAlreadyExistsException if the word already exists. However, when I do this, I get an error like this: java.rmi.UnmarshalException: Error unmarshaling return; nested exception is: java.lang.ClassNotFoundException: com.example.WordAlreadyExistsException The WordAlreadyExistsException, the WordsObject and the WordManagerMXBean interface are all in a single jar file that is available to both the client and the server. If I call the getWords() method, the client has no difficulty handling the WordsObject. However, if a user defined exception, like the one above, is thrown, then the client gives the error shown above. Is it possible to configure JMX to handle this exception correctly in the client? Following some searching, I noticed that there is an MBeanException class that is used to wrap exceptions. I'm not sure if this wrapping is performed by the agent automatically, or if I'm supposed to do the wrapping myself. I tried both, but in either case I get the same error on the client. I have also tried this with both checked and unchecked exceptions, again the same error occurs. One solution to this is to simply pass back the error string inside a generic error, as all of the standard java exceptions work. But I'd prefer to get back the actual exception for processing by the client. Is it possible to handle user defined exceptions in JMX? If so, any ideas how?

    Read the article

  • Enum exeeding the 65535 bytes limit of static initializer... what's best to do?

    - by Daniel Bleisteiner
    I've started a rather large Enum of so called Descriptors that I've wanted to use as a reference list in my model. But now I've come across a compiler/VM limit the first time and so I'm looking for the best solution to handle this. Here is my error : The code for the static initializer is exceeding the 65535 bytes limit It is clear where this comes from - my Enum simply has far to much elements. But I need those elements - there is no way to reduce that set. Initialy I've planed to use a single Enum because I want to make sure that all elements within the Enum are unique. It is used in a Hibernate persistence context where the reference to the Enum is stored as String value in the database. So this must be unique! The content of my Enum can be devided into several groups of elements belonging together. But splitting the Enum would remove the unique safety I get during compile time. Or can this be achieved with multiple Enums in some way? My only current idea is to define some Interface called Descriptor and code several Enums implementing it. This way I hope to be able to use the Hibernate Enum mapping as if it were a single Enum. But I'm not even sure if this will work. And I loose unique safety. Any ideas how to handle that case?

    Read the article

< Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >