Search Results

Search found 17342 results on 694 pages for 'custom draw'.

Page 101/694 | < Previous Page | 97 98 99 100 101 102 103 104 105 106 107 108  | Next Page >

  • belongs_to with a custom class_name not producing proper foreign key in Rails 3

    - by Tony
    I am updating an application to Rails 3 and I am having trouble creating a custom foreign key. I have something like this: class Product < ActiveRecord::Base belongs_to :owner, :class_name => 'User' ... end class User < ActiveRecord::Base has_many :products ... end class ProductsController < ApplicationController before_filter :authenticate_user! def index @products = current_user.products end end The view: <%- @products.each do |p| -%> <%= p.created_at %><br /> <%- end -%> I get this error in my Rails log: Mysql::Error: Unknown column 'products.user_id' in 'where clause': SELECT `products`.* FROM `products` WHERE (`products`.user_id = 1) It should see the belongs_to :owner and look for a foreign key called owner_id. I even tried explicitly setting the foreign key and that does not work. I also checked lighthouse for a possible Rails 3 bug but no luck.

    Read the article

  • How do I nested options for plugins in jQuery

    - by Oscar Godson
    I know how to do plugins, but how do I do nested options like: var defaults = { spacing:10, shorten_to:50, from_start:0, from_end:2, classes: { test:'testing' } }; i know that isn't right, i just dont know how to write the proper syntax when I want to do something like this: $('#breadcrumbs').breadcrumbs({classes{test:'new_example'},spacing:12}) other suggestions are welcome, im in need of the ability to custom class names and there are 7, so rather than making something like test_class, example_class, etc id like it cleaner and neater like the example above.

    Read the article

  • Accessing WPF Template for Custom Control from Code behind

    - by Ashwani Mehlem
    Hi, i am trying to access a named grid inside a default template for a custom control from code behind. But it seems that the template for the control is null, even after calling ApplyTemplate(). Is that impossible inside the controls constuctor? Here's the code: Generic.xaml: ... <ControlTemplate TargetType="{x:Type local:TimeTableControl}"> <Grid Name="ContentGrid"> </Grid> </ControlTemplate> ... TimeTableControl.cs: public TimeTableControl() { ApplyTemplate(); contentGrid = (Grid)(Template.FindName("ContentGrid", this)); //Line above causes null-pointer-exception ... }

    Read the article

  • NSNumberFormatter to display custom labels for 10^n (10000 -> 10k)

    - by Michele Colombo
    I need to display numbers on a plot axis. The values could change but I want to avoid too long numbers that will ruin the readability of the graph. My thought was to group every 3 characters and substitute them with K, M and so on (or a custom character). So: 1 - 1, 999 - 999, 1.000 - 1k, 1.200 - 1.2k, 1.280 - 1.2k, 12.800 - 12.8k, 999.999 - 999.9k, 1.000.000 - 1M, ... Note that probably I'll only need to format round numbers (1, 10, 1000, 1500, 2000, 10000, 20000, 30000, 100000, ...). Is that possibile with NSNumberFormatter? I saw that it has a setFormat method but I don't know how much customizable it is. I'm using NSNumberFormatter cause the graph object I use wants it to set label format and I want to avoid changing my data to set the label.

    Read the article

  • How to align centre a custom label in highcharts

    - by Chrissy
    See a jsfiddle example I am trying to align the custom label in the /labels/items JSON element to hang right under the title and subtitle. Playing with firebug I can alter the SVG text element for the label and add text-align='middle' and change the x='' attribute to have the same value as the title's x attribute. This makes it perfectly align under the title and stay there when resized but I can't figure out how to make the highcharts library generate this source. Maybe there is a better way to add another label under the subtitle?

    Read the article

  • Running custom Javascript on every page in Mozilla Firefox

    - by saturn
    I have a custom piece of Javascript which I would like to run on every web page from specific domains, or perhaps simply on every web page. (If you are wondering: it is not malicious. It allows to display formulas by using MathJax.) Is that possible? I tried including it in userContent.css, that of course did not work. A simple Greasemonkey script I tried did not insert it. Is it because of the security precautions? (Which would be very logical). Still, there should be a way to do it on the machine I physically control, by changing something in Mozilla chrome directory, shouldn't it? Anyway, how can I do this for myself?

    Read the article

  • PHPBB Using Custom Field External

    - by moustafa
    Basically I'm using phpbb as a forum of the main site and for images there are captions and in the Control Panel of the forum I added a custom profile field asking if the user if he/she wants amusing or descriptive captions. The below is something i came up with, but it is horrible, i know, and I'm stuck. The default captions should be descriptive, so if ($user->data['is_registered']){ include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); $user->get_profile_fields( $user->data['user_id'] ); $user->profile_fields['pf_captions']; if (pf_captions_value == descriptive) echo "Lassoed, Hogtied, and Captured..."; else { echo "Not your typical $18..."; } } There is also code for connecting to phpbb so ask me if you want it.

    Read the article

  • Cutom event dispatchment location

    - by Martino Wullems
    Hello, I've been looking into custom event (listeners) for quite some time, but never succeeded in making one. There are so many different mehods, extending the Event class, but also Extending the EventDispatcher class, very confusing! I want to settle with this once and for all and learn the appriopate technique. package{ import flash.events.Event; public class CustomEvent extends Event{ public static const TEST:String = 'test'; //what exac is the purpose of the value in the string? public var data:Object; public function CustomEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, data:Object = null):void { this.data = data; super(); } } } As far as I know a custom class where you set the requirements for the event to be dispatched has to be made: package { import flash.display.MovieClip; public class TestClass extends MovieClip { public function TestClass():void { if (ConditionForHoldToComplete == true) { dispatchEvent(new Event(CustomEvent.TEST)); } } } } I'm not sure if this is correct, but it should be something along the lines of this. Now What I want is something like a mouseevent, which can be applied to a target and does not require a specific class. It would have to work something like this: package com.op_pad._events{ import flash.events.MouseEvent; import flash.utils.Timer; import flash.events.TimerEvent; import flash.events.EventDispatcher; import flash.events.Event; public class HoldEvent extends Event { public static const HOLD_COMPLETE:String = "hold completed"; var timer:Timer; public function SpriteEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false) { super( type, bubbles, cancelable ); timer = new Timer(1000, 1); //somehow find the target where is event is placed upon -> target.addEventlistener target.addEventListener(MouseEvent.MOUSE_DOWN, startTimer); target.addEventListener(MouseEvent.MOUSE_UP, stopTimer); } public override function clone():Event { return new SpriteEvent(type, bubbles, cancelable); } public override function toString():String { return formatToString("MovieEvent", "type", "bubbles", "cancelable", "eventPhase"); } ////////////////////////////////// ///// c o n d i t i o n s ///// ////////////////////////////////// private function startTimer(e:MouseEvent):void { timer.start(); timer.addEventListener(TimerEvent.TIMER_COMPLETE, complete); } private function stopTimer(e:MouseEvent):void { timer.stop() } public function complete(e:TimerEvent):void { dispatchEvent(new HoldEvent(HoldEvent.HOLD_COMPLETE)); } } } This obviously won't work, but should give you an idea of what I want to achieve. This should be possible because mouseevent can be applied to about everything.The main problem is that I don't know where I should set the requirements for the event to be executed to be able to apply it to movieclips and sprites. Thanks in advance

    Read the article

  • How do I make nested options for plugins in jQuery

    - by Oscar Godson
    I know how to do plugins, but how do I do nested options like: var defaults = { spacing:10, shorten_to:50, from_start:0, from_end:2, classes: { test:'testing' } }; i know that isn't right, i just dont know how to write the proper syntax when I want to do something like this: $('#breadcrumbs').breadcrumbs({classes{test:'new_example'},spacing:12}) other suggestions are welcome, im in need of the ability to custom class names and there are 7, so rather than making something like test_class, example_class, etc id like it cleaner and neater like the example above.

    Read the article

  • Custom certificate as proof of transaction

    - by Andy
    I'm developing a site where a user conducts a given transaction and once completed, the user is issued with a 'secure certificate'. The certificate serves as proof of the transaction and the user is able to upload the certificate at a later stage, to view the details of the transaction. At the moment I'm using a custom XML document with encrypted fields. It works perfect, but I would like a standardized approach, such as an X.509 certificate. I'm no encryption expert, but from what I gather, X.509 is more geared towards SSL issued by a CA. Is it possible to create your own valid valid CRT file? As a test, I created a CRT file with the example provided on WikiPedia. However, when I open the file in Windows I get this warning: Invalid Public Key Security Object File - This file is invalid as the following: Security Certificate. Not having much luck here, so time to ask the experts. What direction should I be heading in? Any guidance would be greatly appreciated.

    Read the article

  • Is restricting attributes to class or properties doable?

    - by Will Marcouiller
    I have two custom attributes defined like so: internal class SchemaAttribute : Attribute { internal SchemaAttribute(string schema) { Schema = schema; } internal string Schema { get; private set; } } internal class AttributeAttribute : Attribute { internal AttributeAttribute(string attribute) { Attribute = attribute; } internal string Attribute { get; private set; } } I would like to restrict the SchemaAttribute to classes, and the AttributeAttribute to properties. Is this doable?

    Read the article

  • Custom jQuery dropdown

    - by Coughlin
    I am creating a custom simple dropdown using jQuery that hides/shows a element based on over state. The problem I have now is that when you go over the shown element it hides, you cant move your mouse in to the dropdown that was created. Any thoughts on how to fix that also, is there an easier way to do what I have? I am going to be reusing this and not sure the best way to set the code up for I dont need to copy/paste six times. $(function(){ $("#dog-nav").hover( function(){ $(".sub-drop-box-dog").show("fast"); }, function(){ $(".sub-drop-box-dog").hide("fast"); } ); $("#cat-nav").hover( function(){ $(".sub-drop-box-cat").show("fast"); }, function(){ $(".sub-drop-box-cat").hide("fast"); } ); });

    Read the article

  • Wordpress custom pages CMS

    - by all-R
    Hi guys, I'm considering Wordpress as my CMS platform for a client site I'm doing at the moment. However, I need to create a couple of custom 'modules'. One of these modules is a form that people will be able to complete and have a quote, and once submitted, in a special place in the Wordpress panel (like a menu or something), there will be a listing of all the submitted quotes (just fetching it from a table in my database). Another one is to manage a cafeteria menu, so the client can add a different meal to each day of the week. I know perfectly how to do this kind of things using some kind of MVC framework and doing it 'by-hand', but I'm just wondering if this would be possible to do with WP and if yes, what kind of tools I'll have to use. Thanks

    Read the article

  • How to write a Custom DesignerSerializer for an class used by a Activity (WF)

    - by Stefan Steinegger
    I have a type which is used in a WF activity. It should be serialized. It doesn't work out of the box, most probably because of the private setters in that type. I'm not sure if this is the correct way, but I tried to write my own serializer and declared it on my class. [DesignerSerializer( typeof(FooDesignerSerializer), // my custom serializer typeof(WorkflowMarkupSerializer))] public class Foo { public Foo(int value, string name { // ... } public int Value { get; private set; } public string Name { get; private set; } } Is this the easiest way to get it serialized? How do I write this serializer? That's what I got so far: public class FooDesignerSerializer : WorkflowMarkupSerializer { protected override string SerializeToString( WorkflowMarkupSerializationManager serializationManager, object value) { // how to create a valid / XOML-like string? } }

    Read the article

  • Exclude category from custom taxonomy output

    - by Nordin
    Hello, I'm using the query below to output all links from a custom taxonomy. It outputs all posts that are tagged 'http' from the taxonomy 'words'. I would like to exclude some general categories from the output. So, fe. it only outputs links in the media and news categories. What would be the best way to achieve this. $wp_query->request = " SELECT DISTINCT * FROM $wpdb->posts LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) LEFT JOIN $wpdb->terms ON($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id) WHERE $wpdb->posts.post_type = 'post' AND $wpdb->posts.post_status = 'publish' AND $wpdb->term_taxonomy.taxonomy = 'words' AND $wpdb->terms.slug = 'http' ORDER BY $wpdb->posts.post_date DESC LIMIT $ppp OFFSET $offset"; $pagelinkposts = $wpdb->get_results($wp_query->request, OBJECT);

    Read the article

  • How to generate Doctrine models/classes that extend a custom record class

    - by Shane O'Grady
    When I use Doctrine to generate classes from Yaml/db each Base class (which includes the table definition) extends the Doctrine_Record class. Since my app uses a master and (multiple) slave db servers I need to be able to make the Base classes extend my custom record class to force writes to go to the master db server (as described here). However if I change the base class manually I lose it again when I regenerate my classes from Yaml/db using Doctrine. I need to find a way of telling Doctrine to extend my own Base class, or find a different solution to a master/slave db setup using Doctrine. Example generated model: abstract class My_Base_User extends Doctrine_Record { However I need it to be automatically generated as: abstract class My_Base_User extends My_Record { I am using Doctrine 1.2.1 in a new Zend Framework 1.9.6 application if it makes any difference.

    Read the article

  • MOSS Collect Data from user custom email

    - by nav
    Hi, I am trying to send out a custom email, after the Collect Data from user step in my primary workflow which starts when an item in list X is created. I have created a secondary workflow to start when a new Task item is created (this is created by the Collect Data from user action in the primary workflow). But I am having problem how I retrieve the information on the list X. I know the ID of the referenced item in List X is stored in a URL within the "Link" column in the Tasks lists. But can't see any string manipulation function that will grab this ID so I can use it to link back to relevant item in List X. Is there an easier way to do this? Many Thanks, Nav

    Read the article

  • GAE/J: unable to register a custom ELResolver

    - by dfa
    I need to register a custom ELResolver for a Google App Engine project. Since it must be registered before any request is received, as specified by the Javadoc: It is illegal to register an ELResolver after the application has received any request from the client. If an attempt is made to register an ELResolver after that time, an IllegalStateException is thrown. I'm using a ServletContextListener: public class RegisterCustomELResolver implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); JspApplicationContext jspContext = JspFactory.getDefaultFactory().getJspApplicationContext(context); jspContext.addELResolver(new MyELResolver()); } ... } The problem is that JspFactory.getDefaultFactory() returns always null. I've alreay filled a bug report. Any idea for a workaround?

    Read the article

  • changing text color in custom UITableViewCell iphone

    - by Brodie4598
    Hello. I have a custom cell and when the user selects that cell, I would like the text in the two UILabels to change to light gray. ChecklistCell.h: #import <UIKit/UIKit.h> @interface ChecklistCell : UITableViewCell { UILabel *nameLabel; UILabel *colorLabel; BOOL selected; } @property (nonatomic, retain) IBOutlet UILabel *nameLabel; @property (nonatomic, retain) IBOutlet UILabel *colorLabel; @end ChecklistCell.m: #import "ChecklistCell.h" @implementation ChecklistCell @synthesize colorLabel,nameLabel; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) { // Initialization code } return self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (void)dealloc { [nameLabel release]; [colorLabel release]; [super dealloc]; } @end

    Read the article

  • Custom buttons in MS-Access 2k7

    - by terence6
    I'm adding some custom buttons to my forms in MS Access, but somehow I can't make them work. In buttons properties Event tab I've changed 'On Click' event to call 'Event procedure'. Then in VBasic I'm selecting my button and from what I know this code should give me prompt, and if Yos is selected the form should close. But when I click my buttons simply nothing happens. Am I doing something wrong ? Option Compare Database Option Explicit Private Sub cmdQuitApp_Click() If MsgBox("Are you sure you want to close the form?", vbYesNo + vbQuestion + vbInformation, "Clasing the form.") = vbYes Then DoCmd.Close End If End Sub

    Read the article

  • Passing parameters to custom RESTful routes in Rails (using :collection)

    - by dwhite
    I am trying to add a custom route to my RESTful routes using the :collection param on map.resources like so: map.resources :products, :collection => { :tagged => :get } The tagged action takes in a :tag parameter. I am able to link to the URL route using: tagged_products_path(:tag => tag.name). My issue with this is that the URL that this generates: /products/tagged?tag=electronic I would like the tag to be in the URL and not the tag, like so: /products/tagged/electronic Of course this can be accomplished by a separate named route, but I'm wondering if I'm missing something and there is a way to do this with the :collection hash. Thanks in advance for your help -Damien

    Read the article

  • ASP MVC: Custom Validation Attribute

    - by user323395
    I'm trying to write my own Custom Validation attribute but i'm having some problems. The attribute i'm trying to write is that when a user logs in, the password will be compared against the confirmation password. namespace EventCompanion.Data.Attributes { public class ComparePassword : ValidationAttribute { public string PasswordToCompareWith { get; set; } public override bool IsValid(object value) { if (PasswordToCompareWith == (string)value) { return true; } return false; } } Now my problem is when i'm trying to set the attribute like this in the model file: [Required] [ComparePassword(PasswordToCompareWith=ConfirmPassword)] public string Password { get; set; } [Required] public string ConfirmPassword { get; set; } } I get the following error: Error 1 An object reference is required for the non-static field, method, or property 'Project.Data.Models.GebruikerRegistreerModel.ConfirmPassword.get' It seems that VS is not accepting the confirmpassword in the "PasswordToCompareWith=ConfirmPassword" part Now my question: What am i doing wrong? Thanks in advance!!!

    Read the article

  • Custom Classes Passed from Service to a UI threads via AIDL

    - by Honza Pokorny
    I have a service that regularly queries a web server for new messages. The service stores the new messages in an arrayList. These messages are implemented using a custom class, storing all kinds of metadata (strings and longs). An activity then connects to this service to retrieve those messages and display them to the user. I have an .aidl file that describes the interface that the service exposes. package com.example.package; interface MyInterface { List<Message> getMessages(); } The Message class extends the Parcelable class which should allow for the IPC transfer. The problem is this: Eclipse gives me an error saying that the type of List<Message> is unknown. Any imports are marked as invalid. Ideas? Thanks

    Read the article

  • Adding Custom dialogs in Visual Studio Setup projects

    - by constant learner
    Hello All I need to develop a Visual Studio Setup Project for my application. As far as i see, i can use only a handful of preconfigured dialogs which i can use. Is there any way possible to use any custom dialogs in Visual Studio SetUp Project ? For ex: Whenever i start my setup, a dialog should be shown to the user prompting him to select a language for installation. The user then shall select a language based on his preference and the installation shall then commence thereafter. I hope i have made myself clear CL

    Read the article

  • Custom HTMLControl derived from HtmlImage control not visible in VS2008 toolbox

    - by Tinvan
    I have a custom control deriving from HtmlImage control which I cant get to show up on toolbox, it says "There are no components in '...\bin\Debug\ImageCustomControl.dll' that can be placed on the toolbox.". Here is the code for the control: namespace ImageCustomControl { public class ImageHtmlControl : HtmlImage { public override void RenderControl(HtmlTextWriter writer) { this.Src = "https://somedomain.com" + this.Src; base.RenderControl(writer); } } } Here is a post back from 2003 that says its not possible, but just wanted to know if it has changed since: http://www.microsoft.com/mspress/books/sampchap/5728d.aspx Thanks in advance.

    Read the article

< Previous Page | 97 98 99 100 101 102 103 104 105 106 107 108  | Next Page >